From f3755707da5e6cc87be30ea3eabb4facdc19e449 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 4 Jul 2025 00:55:09 -0700 Subject: [PATCH 01/75] Optimize config unroll with parallel processing for blocks and sections --- packages/config-yaml/src/load/unroll.ts | 271 ++++++++++++++++-------- 1 file changed, 184 insertions(+), 87 deletions(-) diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 1424b2aea..a2f96dbac 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -24,7 +24,7 @@ import { packageIdentifierToShorthandSlug, useProxyForUnrenderedSecrets, } from "./clientRender.js"; -import { getBlockType } from "./getBlockType.js"; +import { BlockType, getBlockType } from "./getBlockType.js"; export function parseConfigYaml(configYaml: string): ConfigYaml { try { @@ -322,12 +322,15 @@ export async function unrollBlocks( "name" | "version" | "rules" | "schema" | "metadata" >)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"]; - // For each section, replace "uses/with" blocks with the real thing - for (const section of sections) { - if (assistant[section]) { - const sectionBlocks: any[] = []; + // Process all sections in parallel + const sectionPromises = sections.map(async (section) => { + if (!assistant[section]) { + return { section, blocks: null }; + } - for (const unrolledBlock of assistant[section]) { + // Process all blocks in this section in parallel + const blockPromises = assistant[section].map( + async (unrolledBlock, index) => { // "uses/with" block if ("uses" in unrolledBlock) { try { @@ -338,10 +341,13 @@ export async function unrollBlocks( ); const block = blockConfigYaml[section]?.[0]; if (block) { - sectionBlocks.push( - mergeOverrides(block, unrolledBlock.override ?? {}), - ); + return { + index, + block: mergeOverrides(block, unrolledBlock.override ?? {}), + error: null, + }; } + return { index, block: null, error: null }; } catch (err) { let msg = ""; if ( @@ -353,99 +359,190 @@ export async function unrollBlocks( msg = `${(err as Error).message}.\n> ${JSON.stringify(unrolledBlock.uses)}`; } - errors.push({ - fatal: false, - message: msg, - }); - console.error( `Failed to unroll block ${JSON.stringify(unrolledBlock.uses)}: ${(err as Error).message}`, ); - sectionBlocks.push(null); + + return { + index, + block: null, + error: { + fatal: false, + message: msg, + }, + }; } } else { // Normal block - sectionBlocks.push(unrolledBlock); + return { index, block: unrolledBlock, error: null }; } - } + }, + ); - unrolledAssistant[section] = sectionBlocks; + const blockResults = await Promise.all(blockPromises); + + // Collect errors and maintain order + const sectionBlocks: any[] = []; + const sectionErrors: ConfigValidationError[] = []; + + for (const result of blockResults) { + if (result.error) { + sectionErrors.push(result.error); + } + sectionBlocks[result.index] = result.block; + } + + return { section, blocks: sectionBlocks, errors: sectionErrors }; + }); + + // Process rules in parallel + const rulesPromise = assistant.rules + ? (async () => { + const rulePromises = assistant.rules!.map(async (rule, index) => { + if (typeof rule === "string" || !("uses" in rule)) { + return { index, rule, error: null }; + } else if ("uses" in rule) { + try { + const blockConfigYaml = await resolveBlock( + decodePackageIdentifier(rule.uses), + rule.with, + registry, + ); + const block = blockConfigYaml.rules?.[0]; + return { index, rule: block || null, error: null }; + } catch (err) { + console.error( + `Failed to unroll block ${rule.uses}: ${(err as Error).message}`, + ); + + return { + index, + rule: null, + error: { + fatal: false, + message: `${(err as Error).message}:\n${rule.uses}`, + }, + }; + } + } + return { index, rule: null, error: null }; + }); + + const ruleResults = await Promise.all(rulePromises); + + const rules: (Rule | null)[] = []; + const ruleErrors: ConfigValidationError[] = []; + + for (const result of ruleResults) { + if (result.error) { + ruleErrors.push(result.error); + } + rules[result.index] = result.rule; + } + + return { rules, errors: ruleErrors }; + })() + : Promise.resolve({ rules: undefined, errors: [] }); + + // Process injected blocks in parallel + const injectedBlocksPromise = injectBlocks + ? (async () => { + const injectedBlockPromises = injectBlocks.map(async (injectBlock) => { + try { + const blockConfigYaml = await registry.getContent(injectBlock); + const parsedBlock = parseMarkdownRuleOrConfigYaml( + blockConfigYaml, + injectBlock, + ); + const blockType = getBlockType(parsedBlock); + const resolvedBlock = await resolveBlock( + injectBlock, + undefined, + registry, + ); + + return { + blockType, + resolvedBlock, + error: null, + }; + } catch (err) { + let msg = ""; + if (injectBlock.uriType === "file") { + msg = `${(err as Error).message}.\n> ${injectBlock.filePath}`; + } else { + msg = `${(err as Error).message}.\n> ${injectBlock.fullSlug}`; + } + + console.error( + `Failed to unroll block ${JSON.stringify(injectBlock)}: ${(err as Error).message}`, + ); + + return { + blockType: null, + resolvedBlock: null, + error: { + fatal: false, + message: msg, + }, + }; + } + }); + + const injectedResults = await Promise.all(injectedBlockPromises); + const injectedErrors: ConfigValidationError[] = []; + const injectedBlocks: { blockType: string; resolvedBlock: any }[] = []; + + for (const result of injectedResults) { + if (result.error) { + injectedErrors.push(result.error); + } else if (result.blockType && result.resolvedBlock) { + injectedBlocks.push({ + blockType: result.blockType, + resolvedBlock: result.resolvedBlock, + }); + } + } + + return { injectedBlocks, errors: injectedErrors }; + })() + : Promise.resolve({ injectedBlocks: [], errors: [] }); + + // Wait for all parallel operations to complete + const [sectionResults, rulesResult, injectedResult] = await Promise.all([ + Promise.all(sectionPromises), + rulesPromise, + injectedBlocksPromise, + ]); + + // Collect all errors + for (const sectionResult of sectionResults) { + if (sectionResult.errors) { + errors.push(...sectionResult.errors); + } + } + errors.push(...rulesResult.errors); + errors.push(...injectedResult.errors); + + // Assign section results + for (const sectionResult of sectionResults) { + if (sectionResult.blocks) { + unrolledAssistant[sectionResult.section] = sectionResult.blocks; } } - // Rules are a bit different because they can be strings, so handle separately - if (assistant.rules) { - const rules: (Rule | null)[] = []; - for (const rule of assistant.rules) { - if (typeof rule === "string" || !("uses" in rule)) { - rules.push(rule); - } else if ("uses" in rule) { - try { - const blockConfigYaml = await resolveBlock( - decodePackageIdentifier(rule.uses), - rule.with, - registry, - ); - const block = blockConfigYaml.rules?.[0]; - if (block) { - rules.push(block); - } - } catch (err) { - errors.push({ - fatal: false, - message: `${(err as Error).message}:\n${rule.uses}`, - }); - - console.error( - `Failed to unroll block ${rule.uses}: ${(err as Error).message}`, - ); - rules.push(null); - } - } - } - - unrolledAssistant.rules = rules; + // Assign rules result + if (rulesResult.rules) { + unrolledAssistant.rules = rulesResult.rules; } // Add injected blocks - for (const injectBlock of injectBlocks ?? []) { - try { - const blockConfigYaml = await registry.getContent(injectBlock); - const parsedBlock = parseMarkdownRuleOrConfigYaml( - blockConfigYaml, - injectBlock, - ); - const blockType = getBlockType(parsedBlock); - const resolvedBlock = await resolveBlock( - injectBlock, - undefined, - registry, - ); - - if (blockType) { - if (!unrolledAssistant[blockType]) { - unrolledAssistant[blockType] = []; - } - unrolledAssistant[blockType]?.push( - ...(resolvedBlock[blockType] as any), - ); - } - } catch (err) { - let msg = ""; - if (injectBlock.uriType === "file") { - msg = `${(err as Error).message}.\n> ${injectBlock.filePath}`; - } else { - msg = `${(err as Error).message}.\n> ${injectBlock.fullSlug}`; - } - errors.push({ - fatal: false, - message: msg, - }); - - console.error( - `Failed to unroll block ${JSON.stringify(injectBlock)}: ${(err as Error).message}`, - ); + for (const { blockType, resolvedBlock } of injectedResult.injectedBlocks) { + const key = blockType as BlockType; + if (!unrolledAssistant[key]) { + unrolledAssistant[key] = []; } + unrolledAssistant[key]?.push(...(resolvedBlock[blockType] as any)); } const configResult: ConfigResult = { From b090f04b70f0b9279adb4e28e21affb66eec52c6 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:54:21 +0530 Subject: [PATCH 02/75] rendering mermaid diagrams basic mermaid js implementation add panzoom and change color theme variables --- gui/package.json | 2 + .../StyledMarkdownPreview/MermaidBlock.tsx | 178 ++++++++++++++++++ .../StyledMarkdownPreview/index.tsx | 5 + gui/src/components/find/FindWidget.tsx | 2 +- gui/src/components/find/useDebounce.ts | 34 +++- 5 files changed, 217 insertions(+), 4 deletions(-) create mode 100644 gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx diff --git a/gui/package.json b/gui/package.json index f98c4499f..ce5cbb29f 100644 --- a/gui/package.json +++ b/gui/package.json @@ -19,6 +19,7 @@ "@continuedev/config-yaml": "file:../packages/config-yaml", "@headlessui/react": "^2.2.0", "@heroicons/react": "^2.0.18", + "@panzoom/panzoom": "^4.6.0", "@reduxjs/toolkit": "^2.3.0", "@tiptap/core": "^2.3.2", "@tiptap/extension-document": "^2.3.2", @@ -43,6 +44,7 @@ "handlebars": "^4.7.8", "lodash": "^4.17.21", "lowlight": "^3.3.0", + "mermaid": "^11.6.0", "minisearch": "^7.0.2", "mustache": "^4.2.0", "posthog-js": "^1.130.1", diff --git a/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx b/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx new file mode 100644 index 000000000..662d730fe --- /dev/null +++ b/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx @@ -0,0 +1,178 @@ +import { + ArrowPathRoundedSquareIcon, + MagnifyingGlassMinusIcon, + MagnifyingGlassPlusIcon, +} from "@heroicons/react/24/outline"; +import Panzoom from "@panzoom/panzoom"; +import mermaid from "mermaid"; +import { useEffect, useId, useRef, useState } from "react"; +import { useDebouncedEffect } from "../find/useDebounce"; +import { ToolTip } from "../gui/Tooltip"; + +const MINIMUM_ZOOM_STEP = 0.05; + +const MERMAID_THEME_COLORS = { + background: "#1e1e1e", + primaryColor: "#4d8bf0", + primaryTextColor: "#ffffff", + primaryBorderColor: "#4d8bf0", + secondaryColor: "#3a6db3", + secondaryTextColor: "#ffffff", + secondaryBorderColor: "#3a6db3", + tertiaryColor: "#59bc89", + tertiaryTextColor: "#ffffff", + tertiaryBorderColor: "#59bc89", + noteBkgColor: "#2d2d2d", + noteTextColor: "#e6e6e6", + noteBorderColor: "#555555", + lineColor: "#8c8c8c", + textColor: "#e6e6e6", + mainBkg: "#252525", + errorBkgColor: "#f44336", + errorTextColor: "#ffffff", + nodeBorder: "#555555", + clusterBkg: "#2a2a2a", + clusterBorder: "#555555", + defaultLinkColor: "#8c8c8c", + titleColor: "#e6e6e6", + edgeLabelBackground: "#252525", + activeTaskBkgColor: "#4caf50", + activeTaskBorderColor: "#388e3c", + doneTaskBkgColor: "#388e3c", + doneTaskBorderColor: "#2e7d32", + critBkgColor: "#f44336", + critBorderColor: "#d32f2f", + taskTextColor: "#e6e6e6", + taskTextOutsideColor: "#e6e6e6", + taskTextLightColor: "#b3b3b3", + sectionBkgColor: "#2a2a2a", + altSectionBkgColor: "#303030", + sectionBkgColor2: "#252525", + excludeBkgColor: "#2d2d2d", + fillType0: "#264f78", + fillType1: "#3a6db3", + fillType2: "#59bc89", + fillType3: "#4d8bf0", + fillType4: "#3a6db3", + fillType5: "#264f78", + fillType6: "#59bc89", + fillType7: "#4d8bf0", +}; + +mermaid.initialize({ + startOnLoad: false, + securityLevel: "loose", + theme: "dark", + themeVariables: { + ...MERMAID_THEME_COLORS, + fontSize: "14px", + fontFamily: "var(--vscode-font-family)", + }, +}); + +export default function MermaidDiagram({ code }: { code: string }) { + const mermaidRenderContainerRef = useRef(null); + const zoomInButtonRef = useRef(null); + const zoomOutButtonRef = useRef(null); + const resetZoomButtonRef = useRef(null); + + const zoomInButtonId = useId(); + const zoomOutButtonId = useId(); + const resetZoomButtonId = useId(); + + const [isLoading, setIsLoading] = useState(false); + const [error, setError] = useState(""); + + useEffect(() => { + setIsLoading(true); + }, [code]); + + useDebouncedEffect( + () => { + if (mermaidRenderContainerRef.current) { + mermaidRenderContainerRef.current.innerHTML = ""; + } + const diagramId = `mermaid-id-${Math.random().toString(36).substring(2)}`; + mermaid + .parse(code) + .then(() => mermaid.render(diagramId, code)) + .then(({ svg }) => { + if (mermaidRenderContainerRef.current) { + mermaidRenderContainerRef.current.innerHTML = svg; + setError(""); + const panzoom = Panzoom(mermaidRenderContainerRef.current, { + step: MINIMUM_ZOOM_STEP, + }); + zoomInButtonRef.current?.addEventListener("click", () => + panzoom.zoomIn({ step: MINIMUM_ZOOM_STEP * 4 }), + ); + zoomOutButtonRef.current?.addEventListener("click", () => + panzoom.zoomOut({ step: MINIMUM_ZOOM_STEP * 4 }), + ); + resetZoomButtonRef.current?.addEventListener("click", () => + panzoom.reset(), + ); + mermaidRenderContainerRef.current.parentElement?.addEventListener( + "wheel", + (event) => { + if (!event.shiftKey) return; + panzoom.zoomWithWheel(event); + }, + ); + } + }) + .catch((err) => { + if (err.message) { + setError(err.message); + } else { + setError( + "Unknown error when parsing or rendering the Mermaid diagram.", + ); + } + }) + .finally(() => { + setIsLoading(false); + }); + }, + 500, + [code], + ); + + return ( + <> + {isLoading && ( +
Generating diagram...
+ )} + {!!error ? ( +
{error}
+ ) : ( +
+
+ + Zoom In + + Zoom Out + + Reset Zoom +
+
+
+ )} + + ); +} diff --git a/gui/src/components/StyledMarkdownPreview/index.tsx b/gui/src/components/StyledMarkdownPreview/index.tsx index 0f2d1af0d..a28e90675 100644 --- a/gui/src/components/StyledMarkdownPreview/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/index.tsx @@ -21,6 +21,7 @@ import { ToolTip } from "../gui/Tooltip"; import FilenameLink from "./FilenameLink"; import "./katex.css"; import "./markdown.css"; +import MermaidBlock from "./MermaidBlock"; import { rehypeHighlightPlugin } from "./rehypeHighlightPlugin"; import { StepContainerPreToolbar } from "./StepContainerPreToolbar"; import SymbolLink from "./SymbolLink"; @@ -331,6 +332,10 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( } } } + if (codeProps.className?.includes("language-mermaid")) { + const codeText = String(codeProps.children || ""); + return ; + } return {codeProps.children}; }, }, diff --git a/gui/src/components/find/FindWidget.tsx b/gui/src/components/find/FindWidget.tsx index f5badfe41..53376b9e6 100644 --- a/gui/src/components/find/FindWidget.tsx +++ b/gui/src/components/find/FindWidget.tsx @@ -18,7 +18,7 @@ import { SearchMatch, searchWithinContainer, } from "./findWidgetSearch"; -import useDebounceValue from "./useDebounce"; +import { useDebounceValue } from "./useDebounce"; import { useElementSize } from "./useElementSize"; interface HighlightOverlayProps { diff --git a/gui/src/components/find/useDebounce.ts b/gui/src/components/find/useDebounce.ts index 8a9898429..0ab483fd4 100644 --- a/gui/src/components/find/useDebounce.ts +++ b/gui/src/components/find/useDebounce.ts @@ -1,6 +1,6 @@ -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; -function useDebounceValue(value: T, delay: number = 500): T { +export function useDebounceValue(value: T, delay: number = 500): T { const [debouncedValue, setDebouncedValue] = useState(value); useEffect(() => { @@ -16,4 +16,32 @@ function useDebounceValue(value: T, delay: number = 500): T { return debouncedValue; } -export default useDebounceValue; +export function useDebouncedEffect( + effect: () => void, + delay: number, + deps: unknown[], +) { + const timeoutRef = useRef(null); + const callBackRef = useRef(() => {}); + + useEffect(() => { + // do not want the timeout to reset on effect dep change + callBackRef.current = effect; + }, [effect]); + + useEffect(() => { + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + } + + timeoutRef.current = setTimeout(() => { + callBackRef.current(); + }, delay); + + return () => { + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + } + }; + }, [delay, ...deps]); +} From 8e914b54bbe2af872657ace44786383c03a095e5 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Fri, 4 Jul 2025 17:54:25 -0700 Subject: [PATCH 03/75] Update packages/config-yaml/src/load/unroll.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- packages/config-yaml/src/load/unroll.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index a2f96dbac..7802be705 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -542,7 +542,7 @@ export async function unrollBlocks( if (!unrolledAssistant[key]) { unrolledAssistant[key] = []; } - unrolledAssistant[key]?.push(...(resolvedBlock[blockType] as any)); + unrolledAssistant[key]?.push(...((resolvedBlock[blockType] ?? []) as any)); } const configResult: ConfigResult = { From e3c9e489e347b81e6f50663336677edf0738b079 Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Fri, 4 Jul 2025 22:59:02 -0700 Subject: [PATCH 04/75] feat: :sparkles: Enhance searching for context providers --- gui/src/context/SubmenuContextProviders.tsx | 244 +++++++++++++++++++- 1 file changed, 241 insertions(+), 3 deletions(-) diff --git a/gui/src/context/SubmenuContextProviders.tsx b/gui/src/context/SubmenuContextProviders.tsx index cf3939c48..b3d8ca21f 100644 --- a/gui/src/context/SubmenuContextProviders.tsx +++ b/gui/src/context/SubmenuContextProviders.tsx @@ -29,6 +29,14 @@ const MINISEARCH_OPTIONS = { const MAX_LENGTH = 70; +// Enhanced search result interface for intelligent sorting +interface EnhancedSearchResult + extends SearchResult, + ContextSubmenuItemWithProvider { + sortPriority: number; + matchQuality: number; +} + interface SubtextContextProvidersContextType { getSubmenuContextItems: ( providerTitle: string | undefined, @@ -43,6 +51,91 @@ const initialContextProviders: SubtextContextProvidersContextType = { const SubmenuContextProvidersContext = createContext(initialContextProviders); +// Helper functions for intelligent file sorting +function hasExactWordMatch(text: string, query: string): boolean { + const words = text.split(/[^a-zA-Z0-9]+/); + return words.some((word) => word === query); +} + +function isCommonDevFile(fileName: string): boolean { + const commonExtensions = [ + ".ts", + ".tsx", + ".js", + ".jsx", + ".py", + ".java", + ".cpp", + ".c", + ".h", + ".vue", + ".svelte", + ]; + const commonNames = [ + "index", + "main", + "app", + "component", + "service", + "util", + "helper", + "config", + "types", + ]; + + const extension = fileName.substring(fileName.lastIndexOf(".")); + const baseName = fileName + .substring(0, fileName.lastIndexOf(".")) + .toLowerCase(); + + return commonExtensions.includes(extension) || commonNames.includes(baseName); +} + +function isInCommonDirectory(filePath: string): boolean { + const commonDirs = [ + "src/", + "lib/", + "components/", + "utils/", + "helpers/", + "services/", + "pages/", + "views/", + "hooks/", + "store/", + "types/", + "interfaces/", + "models/", + "api/", + ]; + return commonDirs.some((dir) => filePath.includes(dir)); +} + +function matchesCamelCaseOrAbbreviation( + fileName: string, + query: string, +): boolean { + // Extract capital letters for camel case matching + const capitals = fileName.match(/[A-Z]/g)?.join("").toLowerCase() || ""; + + // Check if query matches the capital letters pattern + if (capitals.length > 0 && capitals.includes(query)) { + return true; + } + + // Check for abbreviation matches (first letters of words) + const words = fileName.split(/[^a-zA-Z0-9]+/).filter((w) => w.length > 0); + if (words.length > 1) { + const abbreviation = words + .map((word) => word[0]) + .join("") + .toLowerCase(); + return abbreviation.includes(query); + } + + return false; +} + export const SubmenuContextProvidersProvider = ({ children, }: { @@ -128,6 +221,98 @@ export const SubmenuContextProvidersProvider = ({ new Map(), ).current; + const calculateFileSortPriority = useCallback( + ( + result: SearchResult & ContextSubmenuItemWithProvider, + query: string, + openFiles: ContextSubmenuItemWithProvider[], + ): number => { + const fileName = result.title.toLowerCase(); + const filePath = result.description.toLowerCase(); + const queryLower = query.toLowerCase(); + + // Priority 1: Exact filename match + if (fileName === queryLower) { + return 1; + } + + // Priority 2: Recently opened files + if (openFiles.some((f) => f.id === result.id)) { + return 2; + } + + // Priority 3: Filename starts with query + if (fileName.startsWith(queryLower)) { + return 3; + } + + // Priority 4: Exact word match in filename + if (hasExactWordMatch(fileName, queryLower)) { + return 4; + } + + // Priority 5: Common development files + if (isCommonDevFile(fileName)) { + return 5; + } + + // Priority 6: Files in common directories + if (isInCommonDirectory(filePath)) { + return 6; + } + + // Priority 7: CamelCase/abbreviation matches + if (matchesCamelCaseOrAbbreviation(fileName, queryLower)) { + return 7; + } + + // Priority 8: Path starts with query + if (filePath.startsWith(queryLower)) { + return 8; + } + + // Priority 9: Default + return 9; + }, + [], + ); + + const calculateMatchQuality = useCallback( + ( + result: SearchResult & ContextSubmenuItemWithProvider, + query: string, + ): number => { + const fileName = result.title.toLowerCase(); + const queryLower = query.toLowerCase(); + let quality = 0; + + // Exact match bonus + if (fileName === queryLower) quality += 100; + + // Prefix match bonus + if (fileName.startsWith(queryLower)) quality += 50; + + // Contains match bonus + if (fileName.includes(queryLower)) quality += 25; + + // Shorter filename bonus (prefer concise names) + quality += Math.max(0, 50 - fileName.length); + + // Extension preference (common dev files) + if ( + fileName.endsWith(".ts") || + fileName.endsWith(".tsx") || + fileName.endsWith(".js") || + fileName.endsWith(".jsx") + ) { + quality += 10; + } + + return quality; + }, + [], + ); + const getSubmenuContextItems = useCallback( ( providerTitle: string | undefined, @@ -168,9 +353,57 @@ export const SubmenuContextProvidersProvider = ({ }); } } - searchResults.sort((a, b) => b.score - a.score); - // 2. Add fallback results if no search results + // 2. Enhanced sorting for file provider + if ( + providerTitle === "file" || + (!providerTitle && + searchResults.some((r) => r.providerTitle === "file")) + ) { + const enhancedResults: EnhancedSearchResult[] = searchResults.map( + (result): EnhancedSearchResult => ({ + ...result, + id: result.id, + title: result.title, + description: result.description, + providerTitle: result.providerTitle, + sortPriority: calculateFileSortPriority( + result, + query, + lastOpenFilesRef.current, + ), + matchQuality: calculateMatchQuality(result, query), + }), + ); + + // Sort by multiple criteria + enhancedResults.sort((a, b) => { + // Primary: Sort priority (lower = better) + if (a.sortPriority !== b.sortPriority) { + return a.sortPriority - b.sortPriority; + } + + // Secondary: Match quality (higher = better) + if (a.matchQuality !== b.matchQuality) { + return b.matchQuality - a.matchQuality; + } + + // Tertiary: MiniSearch relevance score (higher = better) + if (a.score !== b.score) { + return b.score - a.score; + } + + // Quaternary: Path length (shorter = better) + return a.description.length - b.description.length; + }); + + searchResults = enhancedResults; + } else { + // Default sorting for non-file providers + searchResults.sort((a, b) => b.score - a.score); + } + + // 3. Add fallback results if no search results if (searchResults.length === 0) { const fallbackItems = ( providerTitle ? (fallbackResults[providerTitle] ?? []) : [] @@ -223,7 +456,12 @@ export const SubmenuContextProvidersProvider = ({ return []; } }, - [fallbackResults, minisearches], + [ + fallbackResults, + minisearches, + calculateFileSortPriority, + calculateMatchQuality, + ], ); const loadSubmenuItems = useCallback( From 687e56d8dcaee6b9b810e0baa55e169e564024f2 Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Sat, 5 Jul 2025 00:04:16 -0700 Subject: [PATCH 05/75] fixes --- gui/src/context/SubmenuContextProviders.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/context/SubmenuContextProviders.tsx b/gui/src/context/SubmenuContextProviders.tsx index b3d8ca21f..b82c36b6c 100644 --- a/gui/src/context/SubmenuContextProviders.tsx +++ b/gui/src/context/SubmenuContextProviders.tsx @@ -32,7 +32,7 @@ const MAX_LENGTH = 70; // Enhanced search result interface for intelligent sorting interface EnhancedSearchResult extends SearchResult, - ContextSubmenuItemWithProvider { + Omit { sortPriority: number; matchQuality: number; } From 2df6b1ee7dcd714c35222df5bf4cfb88cab4b3c6 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:10:46 -0700 Subject: [PATCH 06/75] encourage multiple find/replace blocks in the same tool call --- core/tools/definitions/searchAndReplaceInFile.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index b654f9c32..03b9defaf 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -56,7 +56,10 @@ Critical rules: * Include just the changing lines, and a few surrounding lines if needed for uniqueness. * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. -4. Special operations: +4. Avoid extra tool calls: + * When making multiple edits to the same file ALWAYS try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls + * If you need to make follow up edits, it is okay to perform additional tool calls +5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From 5b6b1d5609e217bd2aa95b5258f1afe1500a57a3 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:21:57 -0700 Subject: [PATCH 07/75] adjust instructions --- core/tools/definitions/searchAndReplaceInFile.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index 03b9defaf..46d92bfb2 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -57,8 +57,8 @@ Critical rules: * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. 4. Avoid extra tool calls: - * When making multiple edits to the same file ALWAYS try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls - * If you need to make follow up edits, it is okay to perform additional tool calls + * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls + * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls 5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From f16cd61d231411707ed0b1df2f419e5a082a9140 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:30:18 -0700 Subject: [PATCH 08/75] more adjustments --- core/tools/definitions/searchAndReplaceInFile.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index 46d92bfb2..90fe0a0e4 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -59,6 +59,7 @@ Critical rules: 4. Avoid extra tool calls: * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls + * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do 5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From 5f8b6eff2c5167770484e212856fcb651cb73c01 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:31:35 -0700 Subject: [PATCH 09/75] remove unused prop --- gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 1 - gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 27b093799..eee3a9bb3 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -6,7 +6,6 @@ type EditToolCallProps = { changes: string; historyIndex: number; toolCallId?: string; - expandCodeblocks?: boolean; }; export function EditFile(props: EditToolCallProps) { diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index c20f8f7d2..37c1911dc 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -36,7 +36,6 @@ function FunctionSpecificToolCallDiv({ case BuiltInToolNames.SearchAndReplaceInFile: return ( Date: Sat, 5 Jul 2025 10:36:40 -0700 Subject: [PATCH 10/75] more prompt adjustment --- core/tools/definitions/searchAndReplaceInFile.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index 90fe0a0e4..dc64e49fc 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -56,8 +56,8 @@ Critical rules: * Include just the changing lines, and a few surrounding lines if needed for uniqueness. * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. -4. Avoid extra tool calls: - * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple tool calls +4. Splitting up tool calls: + * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple separate tool calls * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do 5. Special operations: From c105ea1d1099911691bd69f1ee923a51333dfa2c Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:37:40 -0700 Subject: [PATCH 11/75] bump package.json --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 7d5c2a12a..5cff792dc 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.57", + "version": "1.1.58", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From e7d17e78a98fd6a10a91791d448e384d3a206cf9 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:42:34 -0700 Subject: [PATCH 12/75] fix tool use for claude-sonnet-4 --- core/llm/toolSupport.ts | 3 +++ extensions/vscode/package-lock.json | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index b578569cb..43b7e6dae 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -19,6 +19,7 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = "claude-3-7", "claude-3.7", "claude-sonnet-4", + "claude-4-sonnet", "gpt-4", "o3", "gemini", @@ -33,6 +34,7 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = "claude-3-7", "claude-3.7", "claude-sonnet-4", + "claude-4-sonnet", "claude-opus-4", ].some((part) => model.toLowerCase().startsWith(part)) ) { @@ -95,6 +97,7 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = "claude-3-7-sonnet", "claude-3.7-sonnet", "claude-sonnet-4", + "claude-4-sonnet", "claude-opus-4", ].some((part) => model.toLowerCase().includes(part)) ) { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 0f87e013c..d62caf298 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.55", + "version": "1.1.58", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.55", + "version": "1.1.58", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", From d868b901326a39f40f7e0f117c4820ec31fa0d8d Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 10:56:29 -0700 Subject: [PATCH 13/75] adjust prompt --- core/tools/definitions/searchAndReplaceInFile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts index dc64e49fc..f4c601009 100644 --- a/core/tools/definitions/searchAndReplaceInFile.ts +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -59,7 +59,7 @@ Critical rules: 4. Splitting up tool calls: * When making multiple closely related edits to the same file, you should try to use multiple SEARCH/REPLACE blocks in a single tool call, rather than making multiple separate tool calls * If you need to make follow up edits or group your work into logical segments, it is okay to perform additional tool calls - * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do + * DO NOT make back-to-back tool calls. Instead interleave with brief explanation of what each will do. For example, instead of [explanation, tool call, tool call] you should do [explanation, tool call, explanation, tool call] 5. Special operations: * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) * To delete code: Use empty REPLACE section From c11b17042e3be03554d700e978c8261eb79341e0 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Jul 2025 11:06:58 -0700 Subject: [PATCH 14/75] don't show extra text during find / replace tool call --- gui/src/pages/gui/ToolCallDiv/index.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gui/src/pages/gui/ToolCallDiv/index.tsx b/gui/src/pages/gui/ToolCallDiv/index.tsx index f573a45a0..158b653c3 100644 --- a/gui/src/pages/gui/ToolCallDiv/index.tsx +++ b/gui/src/pages/gui/ToolCallDiv/index.tsx @@ -85,6 +85,22 @@ export function ToolCallDiv(props: ToolCallDivProps) { ); } + // Trying this out while it's an experimental feature + // Obviously missing the truncate and args buttons + // All the info from args is displayed here + // But we'd need a nicer place to put the truncate button and the X icon when tool call fails + if ( + props.toolCall.function?.name === BuiltInToolNames.SearchAndReplaceInFile + ) { + return ( + + ); + } + return ( Date: Sat, 5 Jul 2025 11:17:21 -0700 Subject: [PATCH 15/75] optimize find / replace / edit tool call UI so it shows up earlier --- .../StyledMarkdownPreview/StepContainerPreToolbar/index.tsx | 1 - gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx index 1d252dbdb..03aa1c4f5 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx @@ -219,7 +219,6 @@ export function StepContainerPreToolbar({ if (isGeneratingCodeBlock) { return ( - {!isExpanded ? `${numLines} line${plural}` : "Generating"}{" "}
diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index eee3a9bb3..dae07c549 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -9,11 +9,11 @@ type EditToolCallProps = { }; export function EditFile(props: EditToolCallProps) { - if (!props.relativeFilePath || !props.changes) { + if (!props.relativeFilePath) { return null; } - const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath)} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; return ( Date: Sat, 5 Jul 2025 11:27:05 -0700 Subject: [PATCH 16/75] autoscroll to the first diff after apply --- .../vscode/src/diff/vertical/handler.ts | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/diff/vertical/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts index 68c3436e8..339f9e84b 100644 --- a/extensions/vscode/src/diff/vertical/handler.ts +++ b/extensions/vscode/src/diff/vertical/handler.ts @@ -174,9 +174,12 @@ export class VerticalDiffHandler implements vscode.Disposable { // Clear deletion buffer await this.insertDeletionBuffer(); - await this.reapplyWithMyersDiff(diffLines); + const myersDiffs = await this.reapplyWithMyersDiff(diffLines); - const range = new vscode.Range(this.startLine, 0, this.startLine, 0); + // Scroll to the first diff + const scrollToLine = + this.getFirstChangedLine(myersDiffs) ?? this.startLine; + const range = new vscode.Range(scrollToLine, 0, scrollToLine, 0); this.editor.revealRange(range, vscode.TextEditorRevealType.Default); this.options.onStatusUpdate( @@ -370,6 +373,8 @@ export class VerticalDiffHandler implements vscode.Disposable { this.editorToVerticalDiffCodeLens.set(this.fileUri, codeLensBlocks); this.refreshCodeLens(); + + return myersDiffs; } private async insertDeletionBuffer() { @@ -550,4 +555,17 @@ export class VerticalDiffHandler implements vscode.Disposable { this.refreshCodeLens(); } + + /** + * Gets the first line number that was changed in a diff + */ + private getFirstChangedLine(diff: DiffLine[]): number | null { + for (let i = 0; i < diff.length; i++) { + const item = diff[i]; + if (item.type === "old" || item.type === "new") { + return this.startLine + i; + } + } + return null; + } } From a41c1a001731812966f8a63a788f4b65ac63c5c6 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Thu, 12 Jun 2025 05:29:18 -0400 Subject: [PATCH 17/75] fix: enable parsing of qwen3 agent mode chat messages --- gui/src/redux/slices/sessionSlice.test.ts | 418 ++++++++++++++++++++++ gui/src/redux/slices/sessionSlice.ts | 169 ++++++--- 2 files changed, 542 insertions(+), 45 deletions(-) create mode 100644 gui/src/redux/slices/sessionSlice.test.ts diff --git a/gui/src/redux/slices/sessionSlice.test.ts b/gui/src/redux/slices/sessionSlice.test.ts new file mode 100644 index 000000000..f332d74cc --- /dev/null +++ b/gui/src/redux/slices/sessionSlice.test.ts @@ -0,0 +1,418 @@ +import { ChatMessage } from "core"; +import { renderChatMessage } from "core/util/messageContent"; +import { v4 as uuidv4 } from "uuid"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { addToolCallDeltaToState } from "../../util/toolCallState"; +import { ChatHistoryItemWithMessageId, sessionSlice } from "./sessionSlice"; + +// Mock dependencies +vi.mock("uuid"); +vi.mock("core/util/messageContent"); +vi.mock("../../util/toolCallState"); + +const mockUuidv4 = vi.mocked(uuidv4); +const mockRenderChatMessage = vi.mocked(renderChatMessage); +const mockAddToolCallDeltaToState = vi.mocked(addToolCallDeltaToState); + +describe("sessionSlice streamUpdate", () => { + beforeEach(() => { + // Reset mocks before each test + vi.clearAllMocks(); + + // Mock uuidv4 to return predictable values + let callCount = 0; + mockUuidv4.mockImplementation(() => `mock-uuid-${++callCount}`); + + // Mock renderChatMessage to return content as is + mockRenderChatMessage.mockImplementation((message: ChatMessage) => { + if (typeof message.content === "string") { + return message.content; + } + return ""; + }); + + // Mock addToolCallDeltaToState + mockAddToolCallDeltaToState.mockImplementation((delta, state) => { + return { + status: "generating" as const, + toolCall: { + id: delta.id || "mock-tool-id", + type: "function" as const, + function: { + name: delta.function?.name || "mock-function", + arguments: delta.function?.arguments || "{}", + }, + }, + toolCallId: delta.id || "mock-tool-id", + parsedArgs: {}, + }; + }); + }); + + const createInitialState = () => ({ + lastSessionId: undefined, + allSessionMetadata: [], + history: [ + { + message: { + role: "user" as const, + content: "This is a test.", + id: "initial-user-message", + }, + contextItems: [], + }, + ] as ChatHistoryItemWithMessageId[], + isStreaming: false, + title: "Test Session", + id: "test-session-id", + streamAborter: new AbortController(), + symbols: {}, + mode: "chat" as const, + isInEdit: false, + codeBlockApplyStates: { + states: [], + curIndex: 0, + }, + newestToolbarPreviewForInput: {}, + isSessionMetadataLoading: false, + }); + + describe("Basic Chat Message", () => { + it("should append assistant message to history", () => { + const initialState = createInitialState(); + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "Here is a response to your message without thinking.", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe( + "Here is a response to your message without thinking.", + ); + expect(newState.history[1].message.id).toBe("mock-uuid-1"); + expect(newState.history[1].contextItems).toEqual([]); + }); + }); + + describe("Chat Message With Thinking", () => { + it("should split thinking and assistant content correctly", () => { + const initialState = createInitialState(); + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: + "I should send the user a response. Here is a response to your message with thinking.", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + + // Check reasoning + expect(newState.history[0].reasoning?.text).toBe( + "I should send the user a response.", + ); + + // Check assistant message + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe( + "Here is a response to your message with thinking.", + ); + expect(newState.history[1].message.id).toBe("mock-uuid-1"); + }); + }); + + describe("Tool Call With Response", () => { + it("should handle tool call followed by tool response and assistant message", () => { + const initialState = createInitialState(); + const toolCallAction = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "I should use a tool call.", + toolCalls: [ + { + id: "1234", + type: "function" as const, + function: { + name: "builtin_ls", + arguments: '{"dirPath":".","recursive":false}', + }, + }, + ], + }, + ], + }; + + let newState = sessionSlice.reducer(initialState, toolCallAction); + expect(newState.history).toHaveLength(2); + + // Check reasoning + expect(newState.history[0].reasoning?.text).toBe( + "I should use a tool call.", + ); + + // Check generating message + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe(""); + expect(newState.history[1].toolCallState?.status).toBe("generating"); + expect(newState.history[1].toolCallState?.toolCallId).toBe("1234"); + + const toolResponseAction = { + type: "session/streamUpdate", + payload: [ + { + role: "tool" as const, + toolCallId: "1234", + content: "foo.txt\nbar.txt\nexample.php", + }, + { + role: "assistant" as const, + content: "I see, the tool found 3 files.", + }, + ], + }; + newState = sessionSlice.reducer(newState, toolResponseAction); + expect(newState.history).toHaveLength(4); + + // Check tool message + expect(newState.history[2].message.role).toBe("tool"); + expect(newState.history[2].message.content).toBe( + "foo.txt\nbar.txt\nexample.php", + ); + expect((newState.history[2].message as any).toolCallId).toBe("1234"); + + // Check final assistant message + expect(newState.history[3].message.role).toBe("assistant"); + expect(newState.history[3].message.content).toBe( + "I see, the tool found 3 files.", + ); + }); + }); + + describe("Tool Call With Streaming Response", () => { + it("should handle streaming assistant response after tool call", () => { + const initialState = createInitialState(); + const toolCallAction = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "I should use a tool call.", + toolCalls: [ + { + id: "1234", + type: "function" as const, + function: { + name: "builtin_ls", + arguments: '{"dirPath":".","recursive":false}', + }, + }, + ], + }, + ], + }; + + let newState = sessionSlice.reducer(initialState, toolCallAction); + expect(newState.history).toHaveLength(2); + + // Check reasoning + expect(newState.history[0].reasoning?.text).toBe( + "I should use a tool call.", + ); + + // Check generating message + expect(newState.history[1].message.role).toBe("assistant"); + expect(newState.history[1].message.content).toBe(""); + expect(newState.history[1].toolCallState?.status).toBe("generating"); + expect(newState.history[1].toolCallState?.toolCallId).toBe("1234"); + + const toolResponseAction = { + type: "session/streamUpdate", + payload: [ + { + role: "tool" as const, + toolCallId: "1234", + content: "foo.txt\nbar.txt\nexample.php", + }, + { + role: "assistant" as const, + content: "", + }, + { + role: "assistant" as const, + content: "Good, ", + }, + { + role: "assistant" as const, + content: "I received a list", + }, + { + role: "assistant" as const, + content: " of files.", + }, + { + role: "assistant" as const, + content: "", + }, + { + role: "assistant" as const, + content: "\n", + }, + { + role: "assistant" as const, + content: "I see, ", + }, + { + role: "assistant" as const, + content: "the tool ", + }, + { + role: "assistant" as const, + content: "found 3 ", + }, + { + role: "assistant" as const, + content: "files.", + }, + ], + }; + + newState = sessionSlice.reducer(newState, toolResponseAction); + + expect(newState.history).toHaveLength(4); + + // Check tool message + expect(newState.history[2].message.role).toBe("tool"); + expect(newState.history[2].message.content).toBe( + "foo.txt\nbar.txt\nexample.php", + ); + + // Check response message + expect(newState.history[3].message.role).toBe("assistant"); + expect(newState.history[3].message.content).toBe( + "I see, the tool found 3 files.", + ); + expect(newState.history[3].reasoning?.text).toBe( + "Good, I received a list of files.", + ); + expect(newState.history[3].reasoning?.active).toBe(false); + }); + }); + + describe("Edge Cases", () => { + it("should handle empty history gracefully", () => { + const initialState = createInitialState(); + initialState.history = []; + + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "Hello", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + // Should not crash and history should remain empty + expect(newState.history).toHaveLength(0); + }); + + it("should handle redacted thinking messages", () => { + const initialState = createInitialState(); + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "thinking" as const, + content: "This should be hidden", + redactedThinking: true, + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect(newState.history[1].message.role).toBe("thinking"); + expect(newState.history[1].message.content).toBe( + "internal reasoning is hidden due to safety reasons", + ); + expect((newState.history[1].message as any).redactedThinking).toBe(true); + }); + + it("should handle signature updates for thinking messages", () => { + const initialState = createInitialState(); + // First add a thinking message + initialState.history.push({ + message: { + role: "thinking", + content: "Some thinking", + id: "thinking-message", + }, + contextItems: [], + }); + + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "thinking" as const, + signature: "test-signature", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect((newState.history[1].message as any).signature).toBe( + "test-signature", + ); + }); + + it("should accumulate content for same role messages", () => { + const initialState = createInitialState(); + // Add an assistant message first + initialState.history.push({ + message: { + role: "assistant", + content: "Hello ", + id: "assistant-message", + }, + contextItems: [], + }); + + const action = { + type: "session/streamUpdate", + payload: [ + { + role: "assistant" as const, + content: "world!", + }, + ], + }; + + const newState = sessionSlice.reducer(initialState, action); + + expect(newState.history).toHaveLength(2); + expect(newState.history[1].message.content).toBe("Hello world!"); + }); + }); +}); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 45d68b456..8d1ef3e3e 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -8,6 +8,7 @@ import { import { JSONContent } from "@tiptap/react"; import { ApplyState, + AssistantChatMessage, ChatHistoryItem, ChatMessage, ContextItem, @@ -18,6 +19,7 @@ import { RuleWithSource, Session, SessionMetadata, + ThinkingChatMessage, Tool, } from "core"; import { NEW_SESSION_TITLE } from "core/util/constants"; @@ -330,12 +332,10 @@ export const sessionSlice = createSlice({ streamUpdate: (state, action: PayloadAction) => { if (state.history.length) { for (const message of action.payload) { - const lastItem = state.history[state.history.length - 1]; - const lastMessage = lastItem.message; + let lastItem = state.history[state.history.length - 1]; + let lastMessage = lastItem.message; if (message.role === "thinking" && message.redactedThinking) { - console.log("add redacted_thinking blocks"); - state.history.push({ message: { role: "thinking", @@ -348,6 +348,74 @@ export const sessionSlice = createSlice({ continue; } + const messageContent = message.content + ? renderChatMessage(message) + : ""; + + // OpenAI-compatible models in agent mode sometimes send + // all of their data in one message, so we handle that case early. + if (messageContent) { + const thinkMatches = messageContent.match( + /([\s\S]*)<\/think>([\s\S]*)/, + ); + if (thinkMatches) { + // The order that they seem to consistently use is: + // + // Thinking text + // Text to show to the user + + lastItem.reasoning = { + text: thinkMatches[1].trim(), + startAt: Date.now(), + endAt: Date.now(), + active: false, + }; + + // This is the chat message that we should show to the user. + // We always need to push this even if it is empty, + // because we cannot attach tool calls to a Thinking message. + // That would break `messageHasToolCallId`. + state.history.push({ + message: { + role: "assistant", + content: thinkMatches[2].trim(), + id: uuidv4(), + }, + contextItems: [], + }); + lastItem = state.history[state.history.length - 1]; + lastMessage = lastItem.message; + + if ( + (message.role === "assistant" || message.role === "thinking") && + message.toolCalls?.[0] + ) { + // Only support one tool call for now. + // There are further changes required throughout the system + // to support multiple tool calls in a single message from + // OpenAI-compatible providers. + const toolCallDelta = message.toolCalls[0]; + const newToolCallState = addToolCallDeltaToState( + toolCallDelta, + lastItem.toolCallState, + ); + lastItem.toolCallState = newToolCallState; + // We know this is one of these two types because we just added it + const curMessage = lastMessage as + | AssistantChatMessage + | ThinkingChatMessage; + if (curMessage.toolCalls) { + curMessage.toolCalls.push(newToolCallState.toolCall); + } else { + curMessage.toolCalls = [newToolCallState.toolCall]; + } + } + + return; + } + } + + // The remainder of this function handles streaming messages if ( lastMessage.role !== message.role || // This is for when a tool call comes immediately before/after tool call @@ -363,7 +431,7 @@ export const sessionSlice = createSlice({ const historyItem: ChatHistoryItemWithMessageId = { message: { ...message, - content: renderChatMessage(message), + content: "", id: uuidv4(), }, contextItems: [], @@ -376,51 +444,62 @@ export const sessionSlice = createSlice({ ); } state.history.push(historyItem); - } else { - // Add to the existing message - if (message.content) { - const messageContent = renderChatMessage(message); - if (messageContent.includes("")) { - lastItem.reasoning = { - startAt: Date.now(), - active: true, - text: messageContent.replace("", "").trim(), - }; - } else if ( - lastItem.reasoning?.active && - messageContent.includes("") + lastItem = state.history[state.history.length - 1]; + lastMessage = lastItem.message; + } + + // Add to the existing message + if (messageContent) { + if (messageContent.includes("")) { + lastItem.reasoning = { + startAt: Date.now(), + active: true, + text: messageContent.replace("", "").trim(), + }; + } else if ( + lastItem.reasoning?.active && + messageContent.includes("") + ) { + const [reasoningEnd, answerStart] = + messageContent.split(""); + lastItem.reasoning.text += reasoningEnd.trimEnd(); + lastItem.reasoning.active = false; + lastItem.reasoning.endAt = Date.now(); + lastMessage.content += answerStart.trimStart(); + } else if (lastItem.reasoning?.active) { + if ( + lastItem.reasoning.text.length > 0 || + messageContent.trim().length > 0 ) { - const [reasoningEnd, answerStart] = - messageContent.split(""); - lastItem.reasoning.text += reasoningEnd.trimEnd(); - lastItem.reasoning.active = false; - lastItem.reasoning.endAt = Date.now(); - lastMessage.content += answerStart.trimStart(); - } else if (lastItem.reasoning?.active) { lastItem.reasoning.text += messageContent; - } else { - // Note this only works because new message above - // was already rendered from parts to string + } + } else { + // Note this only works because new message above + // was already rendered from parts to string + if ( + lastMessage.content.length > 0 || + messageContent.trim().length > 0 + ) { lastMessage.content += messageContent; } - } else if (message.role === "thinking" && message.signature) { - if (lastMessage.role === "thinking") { - lastMessage.signature = message.signature; - } - } else if ( - message.role === "assistant" && - message.toolCalls?.[0] && - lastMessage.role === "assistant" - ) { - // Intentionally only supporting one tool call for now. - const toolCallDelta = message.toolCalls[0]; - const newToolCallState = addToolCallDeltaToState( - toolCallDelta, - lastItem.toolCallState, - ); - lastItem.toolCallState = newToolCallState; - lastMessage.toolCalls = [newToolCallState.toolCall]; } + } else if (message.role === "thinking" && message.signature) { + if (lastMessage.role === "thinking") { + lastMessage.signature = message.signature; + } + } else if ( + message.role === "assistant" && + message.toolCalls?.[0] && + lastMessage.role === "assistant" + ) { + // Intentionally only supporting one tool call for now. + const toolCallDelta = message.toolCalls[0]; + const newToolCallState = addToolCallDeltaToState( + toolCallDelta, + lastItem.toolCallState, + ); + lastItem.toolCallState = newToolCallState; + lastMessage.toolCalls = [newToolCallState.toolCall]; } } } From 8302ddc2bde644725c3f38d8e0c9e76e07916299 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 7 Jul 2025 11:13:52 +0530 Subject: [PATCH 18/75] package-lock update --- extensions/vscode/package-lock.json | 4 +- gui/package-lock.json | 1306 ++++++++++++++++++++++++++- 2 files changed, 1301 insertions(+), 9 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 0f87e013c..fce37e516 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.55", + "version": "1.1.57", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.55", + "version": "1.1.57", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", diff --git a/gui/package-lock.json b/gui/package-lock.json index 8c53ca7ce..8a7346691 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -10,6 +10,7 @@ "@continuedev/config-yaml": "file:../packages/config-yaml", "@headlessui/react": "^2.2.0", "@heroicons/react": "^2.0.18", + "@panzoom/panzoom": "^4.6.0", "@reduxjs/toolkit": "^2.3.0", "@tiptap/core": "^2.3.2", "@tiptap/extension-document": "^2.3.2", @@ -34,6 +35,7 @@ "handlebars": "^4.7.8", "lodash": "^4.17.21", "lowlight": "^3.3.0", + "mermaid": "^11.6.0", "minisearch": "^7.0.2", "mustache": "^4.2.0", "posthog-js": "^1.130.1", @@ -281,6 +283,34 @@ "node": ">=6.0.0" } }, + "node_modules/@antfu/install-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@antfu/install-pkg/-/install-pkg-1.1.0.tgz", + "integrity": "sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ==", + "license": "MIT", + "dependencies": { + "package-manager-detector": "^1.3.0", + "tinyexec": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@antfu/install-pkg/node_modules/tinyexec": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.1.tgz", + "integrity": "sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw==", + "license": "MIT" + }, + "node_modules/@antfu/utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@antfu/utils/-/utils-8.1.1.tgz", + "integrity": "sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/@babel/code-frame": { "version": "7.26.2", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", @@ -591,6 +621,51 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@braintree/sanitize-url": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-7.1.1.tgz", + "integrity": "sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw==", + "license": "MIT" + }, + "node_modules/@chevrotain/cst-dts-gen": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-11.0.3.tgz", + "integrity": "sha512-BvIKpRLeS/8UbfxXxgC33xOumsacaeCKAjAeLyOn7Pcp95HiRbrpl14S+9vaZLolnbssPIUuiUd8IvgkRyt6NQ==", + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/gast": "11.0.3", + "@chevrotain/types": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/@chevrotain/gast": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-11.0.3.tgz", + "integrity": "sha512-+qNfcoNk70PyS/uxmj3li5NiECO+2YKZZQMbmjTqRI3Qchu8Hig/Q9vgkHpI3alNjr7M+a2St5pw5w5F6NL5/Q==", + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/types": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/@chevrotain/regexp-to-ast": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/regexp-to-ast/-/regexp-to-ast-11.0.3.tgz", + "integrity": "sha512-1fMHaBZxLFvWI067AVbGJav1eRY7N8DDvYCTwGBiE/ytKBgP8azTdgyrKyWZ9Mfh09eHWb5PgTSO8wi7U824RA==", + "license": "Apache-2.0" + }, + "node_modules/@chevrotain/types": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-11.0.3.tgz", + "integrity": "sha512-gsiM3G8b58kZC2HaWR50gu6Y1440cHiJ+i3JUvcp/35JchYejb2+5MVeJK0iKThYpAa/P2PYFV4hoi44HD+aHQ==", + "license": "Apache-2.0" + }, + "node_modules/@chevrotain/utils": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-11.0.3.tgz", + "integrity": "sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==", + "license": "Apache-2.0" + }, "node_modules/@continuedev/config-yaml": { "resolved": "../packages/config-yaml", "link": true @@ -1279,6 +1354,57 @@ "deprecated": "Use @eslint/object-schema instead", "dev": true }, + "node_modules/@iconify/types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", + "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", + "license": "MIT" + }, + "node_modules/@iconify/utils": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.3.0.tgz", + "integrity": "sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA==", + "license": "MIT", + "dependencies": { + "@antfu/install-pkg": "^1.0.0", + "@antfu/utils": "^8.1.0", + "@iconify/types": "^2.0.0", + "debug": "^4.4.0", + "globals": "^15.14.0", + "kolorist": "^1.8.0", + "local-pkg": "^1.0.0", + "mlly": "^1.7.4" + } + }, + "node_modules/@iconify/utils/node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@iconify/utils/node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -1430,6 +1556,15 @@ "unist-util-is": "^3.0.0" } }, + "node_modules/@mermaid-js/parser": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@mermaid-js/parser/-/parser-0.6.0.tgz", + "integrity": "sha512-7DNESgpyZ5WG1SIkrYafVBhWmImtmQuoxOO1lawI3gQYWxBX3v1FW3IyuuRfKJAO06XrZR71W0Kif5VEGGd4VA==", + "license": "MIT", + "dependencies": { + "langium": "3.3.1" + } + }, "node_modules/@mole-inc/bin-wrapper": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/@mole-inc/bin-wrapper/-/bin-wrapper-8.0.1.tgz", @@ -1772,6 +1907,12 @@ "node": ">= 8" } }, + "node_modules/@panzoom/panzoom": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@panzoom/panzoom/-/panzoom-4.6.0.tgz", + "integrity": "sha512-3KxkY1lNKFn98fW5ZFR6vV0YzsXj3I4EQDyFWSXME6/cic86eSS7VjuqIjrA3PEpySo0r5fFtlX8eYCt4JPUFQ==", + "license": "MIT" + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -3137,6 +3278,259 @@ "@types/responselike": "^1.0.0" } }, + "node_modules/@types/d3": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz", + "integrity": "sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==", + "license": "MIT", + "dependencies": { + "@types/d3-array": "*", + "@types/d3-axis": "*", + "@types/d3-brush": "*", + "@types/d3-chord": "*", + "@types/d3-color": "*", + "@types/d3-contour": "*", + "@types/d3-delaunay": "*", + "@types/d3-dispatch": "*", + "@types/d3-drag": "*", + "@types/d3-dsv": "*", + "@types/d3-ease": "*", + "@types/d3-fetch": "*", + "@types/d3-force": "*", + "@types/d3-format": "*", + "@types/d3-geo": "*", + "@types/d3-hierarchy": "*", + "@types/d3-interpolate": "*", + "@types/d3-path": "*", + "@types/d3-polygon": "*", + "@types/d3-quadtree": "*", + "@types/d3-random": "*", + "@types/d3-scale": "*", + "@types/d3-scale-chromatic": "*", + "@types/d3-selection": "*", + "@types/d3-shape": "*", + "@types/d3-time": "*", + "@types/d3-time-format": "*", + "@types/d3-timer": "*", + "@types/d3-transition": "*", + "@types/d3-zoom": "*" + } + }, + "node_modules/@types/d3-array": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.1.tgz", + "integrity": "sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==", + "license": "MIT" + }, + "node_modules/@types/d3-axis": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.6.tgz", + "integrity": "sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-brush": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.6.tgz", + "integrity": "sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-chord": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.6.tgz", + "integrity": "sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", + "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", + "license": "MIT" + }, + "node_modules/@types/d3-contour": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-3.0.6.tgz", + "integrity": "sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==", + "license": "MIT", + "dependencies": { + "@types/d3-array": "*", + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==", + "license": "MIT" + }, + "node_modules/@types/d3-dispatch": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.6.tgz", + "integrity": "sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==", + "license": "MIT" + }, + "node_modules/@types/d3-drag": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.7.tgz", + "integrity": "sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-dsv": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.7.tgz", + "integrity": "sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==", + "license": "MIT" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", + "license": "MIT" + }, + "node_modules/@types/d3-fetch": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-3.0.7.tgz", + "integrity": "sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==", + "license": "MIT", + "dependencies": { + "@types/d3-dsv": "*" + } + }, + "node_modules/@types/d3-force": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.10.tgz", + "integrity": "sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==", + "license": "MIT" + }, + "node_modules/@types/d3-format": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.4.tgz", + "integrity": "sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==", + "license": "MIT" + }, + "node_modules/@types/d3-geo": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.1.0.tgz", + "integrity": "sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==", + "license": "MIT", + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-hierarchy": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.1.7.tgz", + "integrity": "sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg==", + "license": "MIT" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-polygon": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.2.tgz", + "integrity": "sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==", + "license": "MIT" + }, + "node_modules/@types/d3-quadtree": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz", + "integrity": "sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==", + "license": "MIT" + }, + "node_modules/@types/d3-random": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.3.tgz", + "integrity": "sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-scale-chromatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", + "integrity": "sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ==", + "license": "MIT" + }, + "node_modules/@types/d3-selection": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.11.tgz", + "integrity": "sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w==", + "license": "MIT" + }, + "node_modules/@types/d3-shape": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz", + "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", + "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", + "license": "MIT" + }, + "node_modules/@types/d3-time-format": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.3.tgz", + "integrity": "sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==", + "license": "MIT" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "license": "MIT" + }, + "node_modules/@types/d3-transition": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.9.tgz", + "integrity": "sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-zoom": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.8.tgz", + "integrity": "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==", + "license": "MIT", + "dependencies": { + "@types/d3-interpolate": "*", + "@types/d3-selection": "*" + } + }, "node_modules/@types/debug": { "version": "4.1.12", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", @@ -3168,6 +3562,12 @@ "@types/estree": "*" } }, + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" + }, "node_modules/@types/hast": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", @@ -3337,6 +3737,13 @@ "csstype": "^3.0.2" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", @@ -3702,7 +4109,6 @@ "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -4483,6 +4889,32 @@ "node": ">= 16" } }, + "node_modules/chevrotain": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.0.3.tgz", + "integrity": "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==", + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/cst-dts-gen": "11.0.3", + "@chevrotain/gast": "11.0.3", + "@chevrotain/regexp-to-ast": "11.0.3", + "@chevrotain/types": "11.0.3", + "@chevrotain/utils": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/chevrotain-allstar": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.3.1.tgz", + "integrity": "sha512-b7g+y9A0v4mxCW1qUhf3BSVPg+/NvGErk/dOkrDaHA0nQIQGAtrOjlX//9OQtRlSCy+x9rfB5N8yC71lH1nvMw==", + "license": "MIT", + "dependencies": { + "lodash-es": "^4.17.21" + }, + "peerDependencies": { + "chevrotain": "^11.0.0" + } + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -4572,6 +5004,12 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/confbox": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.2.tgz", + "integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==", + "license": "MIT" + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -4594,6 +5032,15 @@ "resolved": "../core", "link": true }, + "node_modules/cose-base": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cose-base/-/cose-base-1.0.3.tgz", + "integrity": "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg==", + "license": "MIT", + "dependencies": { + "layout-base": "^1.0.0" + } + }, "node_modules/crelt": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", @@ -4668,6 +5115,514 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, + "node_modules/cytoscape": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.32.0.tgz", + "integrity": "sha512-5JHBC9n75kz5851jeklCPmZWcg3hUe6sjqJvyk3+hVqFaKcHwHgxsjeN1yLmggoUc6STbtm9/NQyabQehfjvWQ==", + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/cytoscape-cose-bilkent": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz", + "integrity": "sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ==", + "license": "MIT", + "dependencies": { + "cose-base": "^1.0.0" + }, + "peerDependencies": { + "cytoscape": "^3.2.0" + } + }, + "node_modules/cytoscape-fcose": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cytoscape-fcose/-/cytoscape-fcose-2.2.0.tgz", + "integrity": "sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ==", + "license": "MIT", + "dependencies": { + "cose-base": "^2.2.0" + }, + "peerDependencies": { + "cytoscape": "^3.2.0" + } + }, + "node_modules/cytoscape-fcose/node_modules/cose-base": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cose-base/-/cose-base-2.2.0.tgz", + "integrity": "sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g==", + "license": "MIT", + "dependencies": { + "layout-base": "^2.0.0" + } + }, + "node_modules/cytoscape-fcose/node_modules/layout-base": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/layout-base/-/layout-base-2.0.1.tgz", + "integrity": "sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==", + "license": "MIT" + }, + "node_modules/d3": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/d3/-/d3-7.9.0.tgz", + "integrity": "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==", + "license": "ISC", + "dependencies": { + "d3-array": "3", + "d3-axis": "3", + "d3-brush": "3", + "d3-chord": "3", + "d3-color": "3", + "d3-contour": "4", + "d3-delaunay": "6", + "d3-dispatch": "3", + "d3-drag": "3", + "d3-dsv": "3", + "d3-ease": "3", + "d3-fetch": "3", + "d3-force": "3", + "d3-format": "3", + "d3-geo": "3", + "d3-hierarchy": "3", + "d3-interpolate": "3", + "d3-path": "3", + "d3-polygon": "3", + "d3-quadtree": "3", + "d3-random": "3", + "d3-scale": "4", + "d3-scale-chromatic": "3", + "d3-selection": "3", + "d3-shape": "3", + "d3-time": "3", + "d3-time-format": "4", + "d3-timer": "3", + "d3-transition": "3", + "d3-zoom": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-axis": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz", + "integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-brush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", + "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "3", + "d3-transition": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-chord": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz", + "integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==", + "license": "ISC", + "dependencies": { + "d3-path": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-contour": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.2.tgz", + "integrity": "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==", + "license": "ISC", + "dependencies": { + "d3-array": "^3.2.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", + "license": "ISC", + "dependencies": { + "delaunator": "5" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "license": "ISC", + "dependencies": { + "commander": "7", + "iconv-lite": "0.6", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json.js", + "csv2tsv": "bin/dsv2dsv.js", + "dsv2dsv": "bin/dsv2dsv.js", + "dsv2json": "bin/dsv2json.js", + "json2csv": "bin/json2dsv.js", + "json2dsv": "bin/json2dsv.js", + "json2tsv": "bin/json2dsv.js", + "tsv2csv": "bin/dsv2dsv.js", + "tsv2json": "bin/dsv2json.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-fetch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz", + "integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==", + "license": "ISC", + "dependencies": { + "d3-dsv": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-geo": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", + "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2.5.0 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-polygon": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz", + "integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-sankey": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/d3-sankey/-/d3-sankey-0.12.3.tgz", + "integrity": "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "1 - 2", + "d3-shape": "^1.2.0" + } + }, + "node_modules/d3-sankey/node_modules/d3-array": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", + "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", + "license": "BSD-3-Clause", + "dependencies": { + "internmap": "^1.0.0" + } + }, + "node_modules/d3-sankey/node_modules/d3-path": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz", + "integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==", + "license": "BSD-3-Clause" + }, + "node_modules/d3-sankey/node_modules/d3-shape": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz", + "integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-path": "1" + } + }, + "node_modules/d3-sankey/node_modules/internmap": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", + "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==", + "license": "ISC" + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale-chromatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", + "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "d3-selection": "2 - 3" + } + }, + "node_modules/d3-zoom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/dagre-d3-es": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/dagre-d3-es/-/dagre-d3-es-7.0.11.tgz", + "integrity": "sha512-tvlJLyQf834SylNKax8Wkzco/1ias1OPw8DcUMDE7oUIoSEW25riQVuiu/0OWEFqT0cxHT3Pa9/D82Jr47IONw==", + "license": "MIT", + "dependencies": { + "d3": "^7.9.0", + "lodash-es": "^4.17.21" + } + }, "node_modules/data-urls": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", @@ -4732,6 +5687,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/dayjs": { + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", + "license": "MIT" + }, "node_modules/debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", @@ -4856,6 +5817,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delaunator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz", + "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==", + "license": "ISC", + "dependencies": { + "robust-predicates": "^3.0.2" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -4928,9 +5898,13 @@ "dev": true }, "node_modules/dompurify": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz", - "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==" + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz", + "integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } }, "node_modules/downshift": { "version": "7.6.2", @@ -5749,6 +6723,12 @@ "node": ">=4" } }, + "node_modules/exsolve": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.7.tgz", + "integrity": "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw==", + "license": "MIT" + }, "node_modules/ext-list": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", @@ -6305,6 +7285,12 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/hachure-fill": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/hachure-fill/-/hachure-fill-0.5.2.tgz", + "integrity": "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==", + "license": "MIT" + }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", @@ -7000,7 +7986,6 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -7116,6 +8101,15 @@ "node": ">= 0.4" } }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, "node_modules/is-alphabetical": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", @@ -7855,6 +8849,39 @@ "json-buffer": "3.0.1" } }, + "node_modules/khroma": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/khroma/-/khroma-2.1.0.tgz", + "integrity": "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw==" + }, + "node_modules/kolorist": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.8.0.tgz", + "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==", + "license": "MIT" + }, + "node_modules/langium": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/langium/-/langium-3.3.1.tgz", + "integrity": "sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w==", + "license": "MIT", + "dependencies": { + "chevrotain": "~11.0.3", + "chevrotain-allstar": "~0.3.0", + "vscode-languageserver": "~9.0.1", + "vscode-languageserver-textdocument": "~1.0.11", + "vscode-uri": "~3.0.8" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/layout-base": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/layout-base/-/layout-base-1.0.2.tgz", + "integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==", + "license": "MIT" + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -7891,6 +8918,23 @@ "uc.micro": "^2.0.0" } }, + "node_modules/local-pkg": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-1.1.1.tgz", + "integrity": "sha512-WunYko2W1NcdfAFpuLUoucsgULmgDBRkdxHxWQ7mK0cQqwPiy8E1enjuRBrhLtZkB5iScJ1XIPdhVEFK8aOLSg==", + "license": "MIT", + "dependencies": { + "mlly": "^1.7.4", + "pkg-types": "^2.0.1", + "quansync": "^0.2.8" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -7911,6 +8955,12 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "license": "MIT" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -8050,6 +9100,18 @@ "markdown-it": "bin/markdown-it.mjs" } }, + "node_modules/marked": { + "version": "15.0.12", + "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.12.tgz", + "integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/mdast-util-definitions": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-4.0.0.tgz", @@ -8285,6 +9347,47 @@ "node": ">= 8" } }, + "node_modules/mermaid": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-11.8.0.tgz", + "integrity": "sha512-uAZUwnBiqREZcUrFw3G5iQ5Pj3hTYUP95EZc3ec/nGBzHddJZydzYGE09tGZDBS1VoSoDn0symZ85FmypSTo5g==", + "license": "MIT", + "dependencies": { + "@braintree/sanitize-url": "^7.0.4", + "@iconify/utils": "^2.1.33", + "@mermaid-js/parser": "^0.6.0", + "@types/d3": "^7.4.3", + "cytoscape": "^3.29.3", + "cytoscape-cose-bilkent": "^4.1.0", + "cytoscape-fcose": "^2.2.0", + "d3": "^7.9.0", + "d3-sankey": "^0.12.3", + "dagre-d3-es": "7.0.11", + "dayjs": "^1.11.13", + "dompurify": "^3.2.5", + "katex": "^0.16.9", + "khroma": "^2.1.0", + "lodash-es": "^4.17.21", + "marked": "^15.0.7", + "roughjs": "^4.6.6", + "stylis": "^4.3.6", + "ts-dedent": "^2.2.0", + "uuid": "^11.1.0" + } + }, + "node_modules/mermaid/node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, "node_modules/micromark": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.0.tgz", @@ -8832,6 +9935,41 @@ "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-7.1.0.tgz", "integrity": "sha512-tv7c/uefWdEhcu6hvrfTihflgeEi2tN6VV7HJnCjK6VxM75QQJh4t9FwJCsA2EsRS8LCnu3W87CuGPWMocOLCA==" }, + "node_modules/mlly": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz", + "integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.14.0", + "pathe": "^2.0.1", + "pkg-types": "^1.3.0", + "ufo": "^1.5.4" + } + }, + "node_modules/mlly/node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "license": "MIT" + }, + "node_modules/mlly/node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "license": "MIT" + }, + "node_modules/mlly/node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, "node_modules/mrmime": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", @@ -9182,6 +10320,12 @@ "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", "dev": true }, + "node_modules/package-manager-detector": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.3.0.tgz", + "integrity": "sha512-ZsEbbZORsyHuO00lY1kV3/t72yp6Ysay6Pd17ZAlNGuGwmWDLCJxFpRs0IzfXfj1o4icJOkUEioexFHzyPurSQ==", + "license": "MIT" + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -9229,6 +10373,12 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/path-data-parser": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/path-data-parser/-/path-data-parser-0.1.0.tgz", + "integrity": "sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w==", + "license": "MIT" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -9355,6 +10505,39 @@ "@napi-rs/nice": "^1.0.1" } }, + "node_modules/pkg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.2.0.tgz", + "integrity": "sha512-2SM/GZGAEkPp3KWORxQZns4M+WSeXbC2HEvmOIJe3Cmiv6ieAJvdVhDldtHqM5J1Y7MrR1XhkBT/rMlhh9FdqQ==", + "license": "MIT", + "dependencies": { + "confbox": "^0.2.2", + "exsolve": "^1.0.7", + "pathe": "^2.0.3" + } + }, + "node_modules/pkg-types/node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "license": "MIT" + }, + "node_modules/points-on-curve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/points-on-curve/-/points-on-curve-0.2.0.tgz", + "integrity": "sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A==", + "license": "MIT" + }, + "node_modules/points-on-path": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/points-on-path/-/points-on-path-0.2.1.tgz", + "integrity": "sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g==", + "license": "MIT", + "dependencies": { + "path-data-parser": "0.1.0", + "points-on-curve": "0.2.0" + } + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -9819,6 +11002,22 @@ "node": ">=6" } }, + "node_modules/quansync": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.10.tgz", + "integrity": "sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/antfu" + }, + { + "type": "individual", + "url": "https://github.com/sponsors/sxzz" + } + ], + "license": "MIT" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -10937,6 +12136,12 @@ "node": "*" } }, + "node_modules/robust-predicates": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", + "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==", + "license": "Unlicense" + }, "node_modules/rollup": { "version": "4.40.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.40.0.tgz", @@ -10981,6 +12186,18 @@ "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz", "integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==" }, + "node_modules/roughjs": { + "version": "4.6.6", + "resolved": "https://registry.npmjs.org/roughjs/-/roughjs-4.6.6.tgz", + "integrity": "sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==", + "license": "MIT", + "dependencies": { + "hachure-fill": "^0.5.2", + "path-data-parser": "^0.1.0", + "points-on-curve": "^0.2.0", + "points-on-path": "^0.2.1" + } + }, "node_modules/rrweb-cssom": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", @@ -11010,6 +12227,12 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", + "license": "BSD-3-Clause" + }, "node_modules/safe-array-concat": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", @@ -11068,8 +12291,7 @@ "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/saxes": { "version": "6.0.0", @@ -11648,6 +12870,12 @@ "react-is": ">= 16.8.0" } }, + "node_modules/stylis": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.6.tgz", + "integrity": "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==", + "license": "MIT" + }, "node_modules/sucrase": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", @@ -12050,6 +13278,15 @@ "typescript": ">=4.2.0" } }, + "node_modules/ts-dedent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", + "integrity": "sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==", + "license": "MIT", + "engines": { + "node": ">=6.10" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", @@ -12203,6 +13440,12 @@ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" }, + "node_modules/ufo": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", + "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", + "license": "MIT" + }, "node_modules/uglify-js": { "version": "3.19.3", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", @@ -13621,6 +14864,55 @@ } } }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageserver": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz", + "integrity": "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==", + "license": "MIT", + "dependencies": { + "vscode-languageserver-protocol": "3.17.5" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "license": "MIT", + "dependencies": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==", + "license": "MIT" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==", + "license": "MIT" + }, + "node_modules/vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==", + "license": "MIT" + }, "node_modules/w3c-keyname": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", From 714a41c1d8b43e1982d3201f701454743fe52e69 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:26:26 -0700 Subject: [PATCH 19/75] feat: add comprehensive PR compliance checks workflow --- .github/workflows/conventional-commit.yaml | 315 +++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 .github/workflows/conventional-commit.yaml diff --git a/.github/workflows/conventional-commit.yaml b/.github/workflows/conventional-commit.yaml new file mode 100644 index 000000000..92de63175 --- /dev/null +++ b/.github/workflows/conventional-commit.yaml @@ -0,0 +1,315 @@ +name: PR Compliance Checks + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: [main] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + conventional-commits: + name: Validate Conventional Commits (Warning Only) + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + continue-on-error: true + permissions: + pull-requests: write + issues: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate conventional commits + uses: wagoid/commitlint-github-action@v6 + with: + configFile: .commitlintrc.warning.json + continue-on-error: true + + - name: Add commit message guidance comment + if: failure() + uses: actions/github-script@v7 + with: + script: | + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('Conventional Commit Format') + ); + + if (!botComment) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: [ + "## ⚠️ Conventional Commit Format", + "", + "Your commit messages don't follow the conventional commit format, but **this won't block your PR from being merged**.", + "", + "### Expected Format:", + "```", + "[optional scope]: ", + "", + "[optional body]", + "", + "[optional footer(s)]", + "```", + "", + "### Examples:", + "- `feat: add changelog generation support`", + "- `fix: resolve login redirect issue`", + "- `docs: update README with new instructions`", + "- `chore: update dependencies`", + "", + "### Valid Types:", + "`feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`", + "", + "This helps with:", + "- 📝 Automatic changelog generation", + "- 🚀 Automated semantic versioning", + "- 📊 Better project history tracking", + "", + "*This is a non-blocking warning - your PR can still be merged without fixing this.*" + ].join('\n') + }); + } + + code-quality: + name: Code Quality Checks + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Run TypeScript type checking + run: npm run build + + - name: Debug environment + run: | + echo "Node version: $(node --version)" + echo "NPM version: $(npm --version)" + echo "Current directory: $(pwd)" + echo "Package.json type: $(node -p 'JSON.parse(require("fs").readFileSync("package.json", "utf8")).type')" + ls -la node_modules/@nivo/ || echo "@nivo not found" + ls -la node_modules/d3-interpolate/ || echo "d3-interpolate not found" + + - name: Run tests + run: npm test -- --coverage --passWithNoTests --reporter=verbose + env: + VITE_OPENAI_API_KEY: test-key-for-ci + NODE_OPTIONS: "--unhandled-rejections=strict" + + - name: Upload coverage reports + uses: codecov/codecov-action@v4 + with: + file: ./coverage/lcov.info + fail_ci_if_error: false + + security-audit: + name: Security Audit + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + permissions: + security-events: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Fix vulnerabilities + run: npm audit fix + + - name: Run npm audit + run: npm audit --audit-level=moderate + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: javascript + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + + bundle-size: + name: Bundle Size Impact + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Build application + run: npm run build:prod + + - name: Analyze bundle size + run: | + echo "## Bundle Size Analysis" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Get bundle sizes + if [ -d "dist" ]; then + echo "### JavaScript Bundles:" >> $GITHUB_STEP_SUMMARY + find dist -name "*.js" -not -name "*.map" -exec du -h {} \; | sort -hr | head -10 >> $GITHUB_STEP_SUMMARY + + echo "" >> $GITHUB_STEP_SUMMARY + echo "### CSS Bundles:" >> $GITHUB_STEP_SUMMARY + find dist -name "*.css" -exec du -h {} \; | sort -hr >> $GITHUB_STEP_SUMMARY + + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Total Size:" >> $GITHUB_STEP_SUMMARY + du -sh dist >> $GITHUB_STEP_SUMMARY + + # Check if bundle sizes are reasonable (warn if JS > 2MB) + total_js_size=$(find dist -name "*.js" -not -name "*.map" -exec stat -c%s {} \; | awk '{sum+=$1} END {print sum}') + if [ "$total_js_size" -gt 2097152 ]; then + echo "⚠️ **Warning**: Total JavaScript bundle size is $(( total_js_size / 1024 / 1024 ))MB" >> $GITHUB_STEP_SUMMARY + else + echo "✅ Bundle size looks good!" >> $GITHUB_STEP_SUMMARY + fi + else + echo "❌ No dist folder found" >> $GITHUB_STEP_SUMMARY + fi + + file-validation: + name: Required Files Check + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check required files + run: | + required_files=( + "package.json" + "README.md" + "LICENSE" + ".gitignore" + "tsconfig.json" + ) + + missing_files=() + for file in "${required_files[@]}"; do + if [[ ! -f "$file" ]]; then + missing_files+=("$file") + fi + done + + if [[ ${#missing_files[@]} -gt 0 ]]; then + echo "❌ Missing required files:" + printf '%s\n' "${missing_files[@]}" + exit 1 + else + echo "✅ All required files present" + fi + + pr-labels: + name: PR Label Management + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + permissions: + pull-requests: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Auto-label PR based on changes + uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/pr-labeler.yml + + compliance-summary: + name: Compliance Summary + runs-on: ubuntu-latest + needs: + [ + conventional-commits, + code-quality, + security-audit, + bundle-size, + file-validation, + pr-labels, + ] + if: always() && !github.event.pull_request.draft + steps: + - name: Check compliance status + run: | + echo "## 🔍 Compliance Check Results" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + if [[ "${{ needs.conventional-commits.result }}" == "success" ]]; then + echo "✅ Conventional Commits: PASSED" >> $GITHUB_STEP_SUMMARY + elif [[ "${{ needs.conventional-commits.result }}" == "failure" ]]; then + echo "⚠️ Conventional Commits: WARNING (non-blocking)" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Conventional Commits: SKIPPED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.code-quality.result }}" == "success" ]]; then + echo "✅ Code Quality: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Code Quality: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.security-audit.result }}" == "success" ]]; then + echo "✅ Security Audit: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Security Audit: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.bundle-size.result }}" == "success" ]]; then + echo "✅ Bundle Size: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Bundle Size: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + if [[ "${{ needs.file-validation.result }}" == "success" ]]; then + echo "✅ File Validation: PASSED" >> $GITHUB_STEP_SUMMARY + else + echo "❌ File Validation: FAILED" >> $GITHUB_STEP_SUMMARY + fi + + echo "" >> $GITHUB_STEP_SUMMARY + echo "📊 **Overall Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY From 8b8a8123e7515fb633e308085219315a26dd9fe5 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:37:36 -0700 Subject: [PATCH 20/75] update compliance.yaml --- ...nventional-commit.yaml => compliance.yaml} | 139 ++---------------- 1 file changed, 10 insertions(+), 129 deletions(-) rename .github/workflows/{conventional-commit.yaml => compliance.yaml} (58%) diff --git a/.github/workflows/conventional-commit.yaml b/.github/workflows/compliance.yaml similarity index 58% rename from .github/workflows/conventional-commit.yaml rename to .github/workflows/compliance.yaml index 92de63175..ad3828d7f 100644 --- a/.github/workflows/conventional-commit.yaml +++ b/.github/workflows/compliance.yaml @@ -86,47 +86,6 @@ jobs: }); } - code-quality: - name: Code Quality Checks - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Run TypeScript type checking - run: npm run build - - - name: Debug environment - run: | - echo "Node version: $(node --version)" - echo "NPM version: $(npm --version)" - echo "Current directory: $(pwd)" - echo "Package.json type: $(node -p 'JSON.parse(require("fs").readFileSync("package.json", "utf8")).type')" - ls -la node_modules/@nivo/ || echo "@nivo not found" - ls -la node_modules/d3-interpolate/ || echo "d3-interpolate not found" - - - name: Run tests - run: npm test -- --coverage --passWithNoTests --reporter=verbose - env: - VITE_OPENAI_API_KEY: test-key-for-ci - NODE_OPTIONS: "--unhandled-rejections=strict" - - - name: Upload coverage reports - uses: codecov/codecov-action@v4 - with: - file: ./coverage/lcov.info - fail_ci_if_error: false - security-audit: name: Security Audit runs-on: ubuntu-latest @@ -141,7 +100,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "20" + node-version-file: ".nvmrc" cache: "npm" - name: Install dependencies @@ -161,55 +120,8 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 - bundle-size: - name: Bundle Size Impact - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Build application - run: npm run build:prod - - - name: Analyze bundle size - run: | - echo "## Bundle Size Analysis" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - # Get bundle sizes - if [ -d "dist" ]; then - echo "### JavaScript Bundles:" >> $GITHUB_STEP_SUMMARY - find dist -name "*.js" -not -name "*.map" -exec du -h {} \; | sort -hr | head -10 >> $GITHUB_STEP_SUMMARY - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### CSS Bundles:" >> $GITHUB_STEP_SUMMARY - find dist -name "*.css" -exec du -h {} \; | sort -hr >> $GITHUB_STEP_SUMMARY - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Total Size:" >> $GITHUB_STEP_SUMMARY - du -sh dist >> $GITHUB_STEP_SUMMARY - - # Check if bundle sizes are reasonable (warn if JS > 2MB) - total_js_size=$(find dist -name "*.js" -not -name "*.map" -exec stat -c%s {} \; | awk '{sum+=$1} END {print sum}') - if [ "$total_js_size" -gt 2097152 ]; then - echo "⚠️ **Warning**: Total JavaScript bundle size is $(( total_js_size / 1024 / 1024 ))MB" >> $GITHUB_STEP_SUMMARY - else - echo "✅ Bundle size looks good!" >> $GITHUB_STEP_SUMMARY - fi - else - echo "❌ No dist folder found" >> $GITHUB_STEP_SUMMARY - fi - + # Use this for any files that we want to be certain exist + # Basically creates a forcing function to discuss were anyone to want to remove them file-validation: name: Required Files Check runs-on: ubuntu-latest @@ -222,10 +134,16 @@ jobs: run: | required_files=( "package.json" + "package-lock.json" "README.md" "LICENSE" ".gitignore" "tsconfig.json" + "SECURITY.md" + "CONTRIBUTING.md" + ".nvmrc" + ".prettierrc" + ".prettierignore" ) missing_files=() @@ -243,35 +161,10 @@ jobs: echo "✅ All required files present" fi - pr-labels: - name: PR Label Management - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - permissions: - pull-requests: write - contents: read - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Auto-label PR based on changes - uses: actions/labeler@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/pr-labeler.yml - compliance-summary: name: Compliance Summary runs-on: ubuntu-latest - needs: - [ - conventional-commits, - code-quality, - security-audit, - bundle-size, - file-validation, - pr-labels, - ] + needs: [conventional-commits, security-audit, file-validation] if: always() && !github.event.pull_request.draft steps: - name: Check compliance status @@ -287,24 +180,12 @@ jobs: echo "❌ Conventional Commits: SKIPPED" >> $GITHUB_STEP_SUMMARY fi - if [[ "${{ needs.code-quality.result }}" == "success" ]]; then - echo "✅ Code Quality: PASSED" >> $GITHUB_STEP_SUMMARY - else - echo "❌ Code Quality: FAILED" >> $GITHUB_STEP_SUMMARY - fi - if [[ "${{ needs.security-audit.result }}" == "success" ]]; then echo "✅ Security Audit: PASSED" >> $GITHUB_STEP_SUMMARY else echo "❌ Security Audit: FAILED" >> $GITHUB_STEP_SUMMARY fi - if [[ "${{ needs.bundle-size.result }}" == "success" ]]; then - echo "✅ Bundle Size: PASSED" >> $GITHUB_STEP_SUMMARY - else - echo "❌ Bundle Size: FAILED" >> $GITHUB_STEP_SUMMARY - fi - if [[ "${{ needs.file-validation.result }}" == "success" ]]; then echo "✅ File Validation: PASSED" >> $GITHUB_STEP_SUMMARY else From 2c8fd74cd13250295c55956ba7db6d7c02daaa15 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:46:02 -0700 Subject: [PATCH 21/75] fix: comment with guidance --- .github/workflows/compliance.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml index ad3828d7f..9875695ef 100644 --- a/.github/workflows/compliance.yaml +++ b/.github/workflows/compliance.yaml @@ -27,13 +27,14 @@ jobs: fetch-depth: 0 - name: Validate conventional commits + id: commitlint uses: wagoid/commitlint-github-action@v6 with: configFile: .commitlintrc.warning.json continue-on-error: true - name: Add commit message guidance comment - if: failure() + if: steps.commitlint.outcome == 'failure' uses: actions/github-script@v7 with: script: | From 81c80ebf52c199fc0aed8bd45d5724e9a00a8f33 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 12:49:03 -0700 Subject: [PATCH 22/75] ci: add link to recommended extension for conv commits --- .github/workflows/compliance.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml index 9875695ef..13dbdc9f3 100644 --- a/.github/workflows/compliance.yaml +++ b/.github/workflows/compliance.yaml @@ -57,7 +57,7 @@ jobs: body: [ "## ⚠️ Conventional Commit Format", "", - "Your commit messages don't follow the conventional commit format, but **this won't block your PR from being merged**.", + "Your commit messages don't follow the conventional commit format, but **this won't block your PR from being merged**. We recommend downloading [this extension](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits) if you are using VS Code.", "", "### Expected Format:", "```", From d92e198b0e473544a51f31b17a3b780c9b718aef Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 13:30:49 -0700 Subject: [PATCH 23/75] make find/replace tool available by default for claude --- core/tools/index.ts | 13 +++--- gui/src/redux/thunks/streamNormalInput.ts | 51 +++++++++++++++++++++-- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/core/tools/index.ts b/core/tools/index.ts index 198438eb1..95e0ac50f 100644 --- a/core/tools/index.ts +++ b/core/tools/index.ts @@ -39,14 +39,13 @@ export const getConfigDependentToolDefinitions = ( params: ConfigDependentToolParams, ): Tool[] => [ requestRuleTool(params), + // Search and replace is now generally available + searchAndReplaceInFileTool, + // Keep edit file tool available for models that need it + editFileTool, ...(params.enableExperimentalTools - ? [ - searchAndReplaceInFileTool, - viewRepoMapTool, - viewSubdirectoryTool, - codebaseTool, - ] - : [editFileTool]), + ? [viewRepoMapTool, viewSubdirectoryTool, codebaseTool] + : []), ]; export const getToolsForIde = async (ide: IDE): Promise => diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index c7c4de02d..ace25915e 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -1,7 +1,8 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; -import { LLMFullCompletionOptions } from "core"; +import { LLMFullCompletionOptions, ModelDescription, Tool } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; import { ToCoreProtocol } from "core/protocol"; +import { BuiltInToolNames } from "core/tools/builtIn"; import { selectActiveTools } from "../selectors/selectActiveTools"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { selectSelectedChatModel } from "../slices/configSlice"; @@ -21,6 +22,49 @@ import { } from "../util/constructMessages"; import { callCurrentTool } from "./callCurrentTool"; +/** + * Filters tools based on the selected model's capabilities. + * Returns either the edit file tool or search and replace tool, but not both. + */ +function filterToolsForModel( + tools: Tool[], + selectedModel: ModelDescription, +): Tool[] { + const editFileTool = tools.find( + (tool) => tool.function.name === BuiltInToolNames.EditExistingFile, + ); + const searchAndReplaceTool = tools.find( + (tool) => tool.function.name === BuiltInToolNames.SearchAndReplaceInFile, + ); + + // If we don't have both tools, return tools as-is + if (!editFileTool || !searchAndReplaceTool) { + return tools; + } + + // Determine which tool to use based on the model + const shouldUseFindReplace = shouldUseFindReplaceEdits(selectedModel); + + // Filter out the unwanted tool + return tools.filter((tool) => { + if (tool.function.name === BuiltInToolNames.EditExistingFile) { + return !shouldUseFindReplace; + } + if (tool.function.name === BuiltInToolNames.SearchAndReplaceInFile) { + return shouldUseFindReplace; + } + return true; + }); +} + +/** + * Determines whether to use search and replace tool instead of edit file + * Right now we only know that this is reliable with Claude models + */ +function shouldUseFindReplaceEdits(model: ModelDescription): boolean { + return model.model.includes("claude"); +} + export const streamNormalInput = createAsyncThunk< void, { @@ -37,8 +81,9 @@ export const streamNormalInput = createAsyncThunk< throw new Error("No chat model selected"); } - // Get tools - const activeTools = selectActiveTools(state); + // Get tools and filter them based on the selected model + const allActiveTools = selectActiveTools(state); + const activeTools = filterToolsForModel(allActiveTools, selectedChatModel); const toolsSupported = modelSupportsTools(selectedChatModel); // Construct completion options From ee12f2bd6598df009dab11cbc3f79ec5e2a3d5cb Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 14:56:30 -0700 Subject: [PATCH 24/75] WIP: bedrock openai adapter --- core/llm/llms/Bedrock.ts | 38 +- packages/openai-adapters/package-lock.json | 1428 ++++++++++++++++++ packages/openai-adapters/package.json | 1 + packages/openai-adapters/src/apis/Bedrock.ts | 705 +++++++++ packages/openai-adapters/src/index.ts | 3 + packages/openai-adapters/src/types.ts | 13 + 6 files changed, 2178 insertions(+), 10 deletions(-) create mode 100644 packages/openai-adapters/src/apis/Bedrock.ts diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 1c1c61ed3..cf13edd6a 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -21,6 +21,7 @@ import { import { safeParseToolCallArgs } from "../../tools/parseArgs.js"; import { renderChatMessage, stripImages } from "../../util/messageContent.js"; import { BaseLLM } from "../index.js"; +import { LlmApiRequestType } from "../openaiTypeConverters.js"; import { PROVIDER_TOOL_SUPPORT } from "../toolSupport.js"; import { getSecureID } from "../utils/getSecureID.js"; @@ -47,6 +48,7 @@ interface PromptCachingMetrics { } class Bedrock extends BaseLLM { + protected useOpenAIAdapterFor: (LlmApiRequestType | "*")[] = ["*"]; static providerName = "bedrock"; static defaultOptions: Partial = { region: "us-east-1", @@ -76,6 +78,7 @@ class Bedrock extends BaseLLM { } else { this.profile = "bedrock"; } + this.requestOptions = { region: options.region, headers: {}, @@ -609,17 +612,32 @@ class Bedrock extends BaseLLM { } private async _getCredentials() { - try { - return await fromNodeProviderChain({ - profile: this.profile, - ignoreCache: true, - })(); - } catch (e) { - console.warn( - `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, - ); - return await fromNodeProviderChain()(); + if (this.apiKey) { + const [accessKeyId, secretAccessKey] = this.apiKey.split(":"); + if (!accessKeyId || !secretAccessKey) { + throw new Error( + "Invalid Bedrock API key format. Expected format: accessKeyId:secretAccessKey", + ); + } + return { + accessKeyId, + secretAccessKey, + }; } + + if (this.profile) { + try { + return await fromNodeProviderChain({ + profile: this.profile, + ignoreCache: true, + })(); + } catch (e) { + console.warn( + `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, + ); + } + } + return await fromNodeProviderChain()(); } // EMBED // diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 0782d06d8..86228c0d9 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.44", "license": "Apache-2.0", "dependencies": { + "@aws-sdk/client-bedrock-runtime": "^3.842.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", @@ -42,6 +43,731 @@ "node": ">=6.0.0" } }, + "node_modules/@aws-crypto/crc32": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", + "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", + "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-js": "^5.2.0", + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/supports-web-crypto": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", + "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-bedrock-runtime": { + "version": "3.842.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.842.0.tgz", + "integrity": "sha512-CrGuU9YGqYZPm2hjjqJYC5+HMjky/HuvlUmboFDdpH96mwm/RrUQAO6sXYojeUPy9ceidUiHd3HskqvpiMTl2Q==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-node": "3.840.0", + "@aws-sdk/eventstream-handler-node": "3.840.0", + "@aws-sdk/middleware-eventstream": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/middleware-websocket": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/token-providers": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/eventstream-serde-browser": "^4.0.4", + "@smithy/eventstream-serde-config-resolver": "^4.1.2", + "@smithy/eventstream-serde-node": "^4.0.4", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-stream": "^4.2.2", + "@smithy/util-utf8": "^4.0.0", + "@types/uuid": "^9.0.1", + "tslib": "^2.6.2", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/client-bedrock-runtime/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@aws-sdk/client-sso": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.840.0.tgz", + "integrity": "sha512-3Zp+FWN2hhmKdpS0Ragi5V2ZPsZNScE3jlbgoJjzjI/roHZqO+e3/+XFN4TlM0DsPKYJNp+1TAjmhxN6rOnfYA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/core": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.840.0.tgz", + "integrity": "sha512-x3Zgb39tF1h2XpU+yA4OAAQlW6LVEfXNlSedSYJ7HGKXqA/E9h3rWQVpYfhXXVVsLdYXdNw5KBUkoAoruoZSZA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@aws-sdk/xml-builder": "3.821.0", + "@smithy/core": "^3.6.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/signature-v4": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-utf8": "^4.0.0", + "fast-xml-parser": "4.4.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.840.0.tgz", + "integrity": "sha512-EzF6VcJK7XvQ/G15AVEfJzN2mNXU8fcVpXo4bRyr1S6t2q5zx6UPH/XjDbn18xyUmOq01t+r8gG+TmHEVo18fA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.840.0.tgz", + "integrity": "sha512-wbnUiPGLVea6mXbUh04fu+VJmGkQvmToPeTYdHE8eRZq3NRDi3t3WltT+jArLBKD/4NppRpMjf2ju4coMCz91g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/util-stream": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.840.0.tgz", + "integrity": "sha512-7F290BsWydShHb+7InXd+IjJc3mlEIm9I0R57F/Pjl1xZB69MdkhVGCnuETWoBt4g53ktJd6NEjzm/iAhFXFmw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-env": "3.840.0", + "@aws-sdk/credential-provider-http": "3.840.0", + "@aws-sdk/credential-provider-process": "3.840.0", + "@aws-sdk/credential-provider-sso": "3.840.0", + "@aws-sdk/credential-provider-web-identity": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.840.0.tgz", + "integrity": "sha512-KufP8JnxA31wxklLm63evUPSFApGcH8X86z3mv9SRbpCm5ycgWIGVCTXpTOdgq6rPZrwT9pftzv2/b4mV/9clg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.840.0", + "@aws-sdk/credential-provider-http": "3.840.0", + "@aws-sdk/credential-provider-ini": "3.840.0", + "@aws-sdk/credential-provider-process": "3.840.0", + "@aws-sdk/credential-provider-sso": "3.840.0", + "@aws-sdk/credential-provider-web-identity": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.840.0.tgz", + "integrity": "sha512-HkDQWHy8tCI4A0Ps2NVtuVYMv9cB4y/IuD/TdOsqeRIAT12h8jDb98BwQPNLAImAOwOWzZJ8Cu0xtSpX7CQhMw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.840.0.tgz", + "integrity": "sha512-2qgdtdd6R0Z1y0KL8gzzwFUGmhBHSUx4zy85L2XV1CXhpRNwV71SVWJqLDVV5RVWVf9mg50Pm3AWrUC0xb0pcA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-sso": "3.840.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/token-providers": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.840.0.tgz", + "integrity": "sha512-dpEeVXG8uNZSmVXReE4WP0lwoioX2gstk4RnUgrdUE3YaPq8A+hJiVAyc3h+cjDeIqfbsQbZm9qFetKC2LF9dQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/eventstream-handler-node": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.840.0.tgz", + "integrity": "sha512-m/zVrSSAEHq+6h4sy0JUEBScB1pGgs/1+iRVhfzfbnf+/gTr4ut2jRq4tDiNEX9pQ1oFVvw+ntPua5qfquQeRQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/eventstream-codec": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-eventstream": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-eventstream/-/middleware-eventstream-3.840.0.tgz", + "integrity": "sha512-4khgf7AjJ4llh3aiNmZ+x4PGl4vkKNxRHn0xTgi6Iw1J3SChsF2mnNaLXK8hoXeydx756rw+JhqOuZH91i5l4w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-host-header": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.840.0.tgz", + "integrity": "sha512-ub+hXJAbAje94+Ya6c6eL7sYujoE8D4Bumu1NUI8TXjUhVVn0HzVWQjpRLshdLsUp1AW7XyeJaxyajRaJQ8+Xg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-logger": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.840.0.tgz", + "integrity": "sha512-lSV8FvjpdllpGaRspywss4CtXV8M7NNNH+2/j86vMH+YCOZ6fu2T/TyFd/tHwZ92vDfHctWkRbQxg0bagqwovA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.840.0.tgz", + "integrity": "sha512-Gu7lGDyfddyhIkj1Z1JtrY5NHb5+x/CRiB87GjaSrKxkDaydtX2CU977JIABtt69l9wLbcGDIQ+W0uJ5xPof7g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.840.0.tgz", + "integrity": "sha512-hiiMf7BP5ZkAFAvWRcK67Mw/g55ar7OCrvrynC92hunx/xhMkrgSLM0EXIZ1oTn3uql9kH/qqGF0nqsK6K555A==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@smithy/core": "^3.6.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-websocket": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-websocket/-/middleware-websocket-3.840.0.tgz", + "integrity": "sha512-v9jJD1zjKMUg8iEZlFP5TLY7+DdwKodLgkNtls34+LMRbW+7Bue+H3gPi1VML5sks2o/+PJ6fz58Wo3bXZ8XHA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-format-url": "3.840.0", + "@smithy/eventstream-codec": "^4.0.4", + "@smithy/eventstream-serde-browser": "^4.0.4", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/signature-v4": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@aws-sdk/nested-clients": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.840.0.tgz", + "integrity": "sha512-LXYYo9+n4hRqnRSIMXLBb+BLz+cEmjMtTudwK1BF6Bn2RfdDv29KuyeDRrPCS3TwKl7ZKmXUmE9n5UuHAPfBpA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/region-config-resolver": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.840.0.tgz", + "integrity": "sha512-Qjnxd/yDv9KpIMWr90ZDPtRj0v75AqGC92Lm9+oHXZ8p1MjG5JE2CW0HL8JRgK9iKzgKBL7pPQRXI8FkvEVfrA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "@smithy/util-config-provider": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/token-providers": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.840.0.tgz", + "integrity": "sha512-6BuTOLTXvmgwjK7ve7aTg9JaWFdM5UoMolLVPMyh3wTv9Ufalh8oklxYHUBIxsKkBGO2WiHXytveuxH6tAgTYg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/types": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.840.0.tgz", + "integrity": "sha512-xliuHaUFZxEx1NSXeLLZ9Dyu6+EJVQKEoD+yM+zqUo3YDZ7medKJWY6fIOKiPX/N7XbLdBYwajb15Q7IL8KkeA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-endpoints": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.840.0.tgz", + "integrity": "sha512-eqE9ROdg/Kk0rj3poutyRCFauPDXIf/WSvCqFiRDDVi6QOnCv/M0g2XW8/jSvkJlOyaXkNCptapIp6BeeFFGYw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "@smithy/util-endpoints": "^3.0.6", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-format-url": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-format-url/-/util-format-url-3.840.0.tgz", + "integrity": "sha512-VB1PWyI1TQPiPvg4w7tgUGGQER1xxXPNUqfh3baxUSFi1Oh8wHrDnFywkxLm3NMmgDmnLnSZ5Q326qAoyqKLSg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-locate-window": { + "version": "3.804.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.804.0.tgz", + "integrity": "sha512-zVoRfpmBVPodYlnMjgVjfGoEZagyRF5IPn3Uo6ZvOZp24chnW/FRstH7ESDHDDRga4z3V+ElUQHKpFDXWyBW5A==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.840.0.tgz", + "integrity": "sha512-JdyZM3EhhL4PqwFpttZu1afDpPJCCc3eyZOLi+srpX11LsGj6sThf47TYQN75HT1CarZ7cCdQHGzP2uy3/xHfQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.840.0.tgz", + "integrity": "sha512-Fy5JUEDQU1tPm2Yw/YqRYYc27W5+QD/J4mYvQvdWjUGZLB5q3eLFMGD35Uc28ZFoGMufPr4OCxK/bRfWROBRHQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/xml-builder": { + "version": "3.821.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.821.0.tgz", + "integrity": "sha512-DIIotRnefVL6DiaHtO6/21DhJ4JZnnIwdNbpwiAhdt/AVbttcE4yw925gsjur0OGv5BTYXQXU3YnANBYnZjuQA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", @@ -1022,6 +1748,656 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@smithy/abort-controller": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-4.0.4.tgz", + "integrity": "sha512-gJnEjZMvigPDQWHrW3oPrFhQtkrgqBkyjj3pCIdF3A5M6vsZODG93KNlfJprv6bp4245bdT32fsHK4kkH3KYDA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/config-resolver": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-4.1.4.tgz", + "integrity": "sha512-prmU+rDddxHOH0oNcwemL+SwnzcG65sBF2yXRO7aeXIn/xTlq2pX7JLVbkBnVLowHLg4/OL4+jBmv9hVrVGS+w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "@smithy/util-config-provider": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/core": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.6.0.tgz", + "integrity": "sha512-Pgvfb+TQ4wUNLyHzvgCP4aYZMh16y7GcfF59oirRHcgGgkH1e/s9C0nv/v3WP+Quymyr5je71HeFQCwh+44XLg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/middleware-serde": "^4.0.8", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-stream": "^4.2.2", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/credential-provider-imds": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-4.0.6.tgz", + "integrity": "sha512-hKMWcANhUiNbCJouYkZ9V3+/Qf9pteR1dnwgdyzR09R4ODEYx8BbUysHwRSyex4rZ9zapddZhLFTnT4ZijR4pw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-codec": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-4.0.4.tgz", + "integrity": "sha512-7XoWfZqWb/QoR/rAU4VSi0mWnO2vu9/ltS6JZ5ZSZv0eovLVfDfu0/AX4ub33RsJTOth3TiFWSHS5YdztvFnig==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/crc32": "5.2.0", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-browser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-4.0.4.tgz", + "integrity": "sha512-3fb/9SYaYqbpy/z/H3yIi0bYKyAa89y6xPmIqwr2vQiUT2St+avRt8UKwsWt9fEdEasc5d/V+QjrviRaX1JRFA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-config-resolver": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-4.1.2.tgz", + "integrity": "sha512-JGtambizrWP50xHgbzZI04IWU7LdI0nh/wGbqH3sJesYToMi2j/DcoElqyOcqEIG/D4tNyxgRuaqBXWE3zOFhQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-node": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-4.0.4.tgz", + "integrity": "sha512-RD6UwNZ5zISpOWPuhVgRz60GkSIp0dy1fuZmj4RYmqLVRtejFqQ16WmfYDdoSoAjlp1LX+FnZo+/hkdmyyGZ1w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-universal": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-4.0.4.tgz", + "integrity": "sha512-UeJpOmLGhq1SLox79QWw/0n2PFX+oPRE1ZyRMxPIaFEfCqWaqpB7BU9C8kpPOGEhLF7AwEqfFbtwNxGy4ReENA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-codec": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/fetch-http-handler": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-5.0.4.tgz", + "integrity": "sha512-AMtBR5pHppYMVD7z7G+OlHHAcgAN7v0kVKEpHuTO4Gb199Gowh0taYi9oDStFeUhetkeP55JLSVlTW1n9rFtUw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/hash-node": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-4.0.4.tgz", + "integrity": "sha512-qnbTPUhCVnCgBp4z4BUJUhOEkVwxiEi1cyFM+Zj6o+aY8OFGxUQleKWq8ltgp3dujuhXojIvJWdoqpm6dVO3lQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/invalid-dependency": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-4.0.4.tgz", + "integrity": "sha512-bNYMi7WKTJHu0gn26wg8OscncTt1t2b8KcsZxvOv56XA6cyXtOAAAaNP7+m45xfppXfOatXF3Sb1MNsLUgVLTw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/is-array-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-4.0.0.tgz", + "integrity": "sha512-saYhF8ZZNoJDTvJBEWgeBccCg+yvp1CX+ed12yORU3NilJScfc6gfch2oVb4QgxZrGUx3/ZJlb+c/dJbyupxlw==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-content-length": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-4.0.4.tgz", + "integrity": "sha512-F7gDyfI2BB1Kc+4M6rpuOLne5LOcEknH1n6UQB69qv+HucXBR1rkzXBnQTB2q46sFy1PM/zuSJOB532yc8bg3w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-endpoint": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-4.1.13.tgz", + "integrity": "sha512-xg3EHV/Q5ZdAO5b0UiIMj3RIOCobuS40pBBODguUDVdko6YK6QIzCVRrHTogVuEKglBWqWenRnZ71iZnLL3ZAQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.6.0", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-retry": { + "version": "4.1.14", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-4.1.14.tgz", + "integrity": "sha512-eoXaLlDGpKvdmvt+YBfRXE7HmIEtFF+DJCbTPwuLunP0YUnrydl+C4tS+vEM0+nyxXrX3PSUFqC+lP1+EHB1Tw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/protocol-http": "^5.1.2", + "@smithy/service-error-classification": "^4.0.6", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "tslib": "^2.6.2", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-retry/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@smithy/middleware-serde": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-4.0.8.tgz", + "integrity": "sha512-iSSl7HJoJaGyMIoNn2B7czghOVwJ9nD7TMvLhMWeSB5vt0TnEYyRRqPJu/TqW76WScaNvYYB8nRoiBHR9S1Ddw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-stack": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-4.0.4.tgz", + "integrity": "sha512-kagK5ggDrBUCCzI93ft6DjteNSfY8Ulr83UtySog/h09lTIOAJ/xUSObutanlPT0nhoHAkpmW9V5K8oPyLh+QA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-config-provider": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-4.1.3.tgz", + "integrity": "sha512-HGHQr2s59qaU1lrVH6MbLlmOBxadtzTsoO4c+bF5asdgVik3I8o7JIOzoeqWc5MjVa+vD36/LWE0iXKpNqooRw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-http-handler": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.0.6.tgz", + "integrity": "sha512-NqbmSz7AW2rvw4kXhKGrYTiJVDHnMsFnX4i+/FzcZAfbOBauPYs2ekuECkSbtqaxETLLTu9Rl/ex6+I2BKErPA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/abort-controller": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/property-provider": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-4.0.4.tgz", + "integrity": "sha512-qHJ2sSgu4FqF4U/5UUp4DhXNmdTrgmoAai6oQiM+c5RZ/sbDwJ12qxB1M6FnP+Tn/ggkPZf9ccn4jqKSINaquw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/protocol-http": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-5.1.2.tgz", + "integrity": "sha512-rOG5cNLBXovxIrICSBm95dLqzfvxjEmuZx4KK3hWwPFHGdW3lxY0fZNXfv2zebfRO7sJZ5pKJYHScsqopeIWtQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-builder": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-4.0.4.tgz", + "integrity": "sha512-SwREZcDnEYoh9tLNgMbpop+UTGq44Hl9tdj3rf+yeLcfH7+J8OXEBaMc2kDxtyRHu8BhSg9ADEx0gFHvpJgU8w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "@smithy/util-uri-escape": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-4.0.4.tgz", + "integrity": "sha512-6yZf53i/qB8gRHH/l2ZwUG5xgkPgQF15/KxH0DdXMDHjesA9MeZje/853ifkSY0x4m5S+dfDZ+c4x439PF0M2w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/service-error-classification": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-4.0.6.tgz", + "integrity": "sha512-RRoTDL//7xi4tn5FrN2NzH17jbgmnKidUqd4KvquT0954/i6CXXkh1884jBiunq24g9cGtPBEXlU40W6EpNOOg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/shared-ini-file-loader": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-4.0.4.tgz", + "integrity": "sha512-63X0260LoFBjrHifPDs+nM9tV0VMkOTl4JRMYNuKh/f5PauSjowTfvF3LogfkWdcPoxsA9UjqEOgjeYIbhb7Nw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/signature-v4": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-5.1.2.tgz", + "integrity": "sha512-d3+U/VpX7a60seHziWnVZOHuEgJlclufjkS6zhXvxcJgkJq4UWdH5eOBLzHRMx6gXjsdT9h6lfpmLzbrdupHgQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.0.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-uri-escape": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/smithy-client": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-4.4.5.tgz", + "integrity": "sha512-+lynZjGuUFJaMdDYSTMnP/uPBBXXukVfrJlP+1U/Dp5SFTEI++w6NMga8DjOENxecOF71V9Z2DllaVDYRnGlkg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.6.0", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-stream": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.3.1.tgz", + "integrity": "sha512-UqKOQBL2x6+HWl3P+3QqFD4ncKq0I8Nuz9QItGv5WuKuMHuuwlhvqcZCoXGfc+P1QmfJE7VieykoYYmrOoFJxA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/url-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-4.0.4.tgz", + "integrity": "sha512-eMkc144MuN7B0TDA4U2fKs+BqczVbk3W+qIvcoCY6D1JY3hnAdCuhCZODC+GAeaxj0p6Jroz4+XMUn3PCxQQeQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/querystring-parser": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-base64": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-4.0.0.tgz", + "integrity": "sha512-CvHfCmO2mchox9kjrtzoHkWHxjHZzaFojLc8quxXY7WAAMAg43nuxwv95tATVgQFNDwd4M9S1qFzj40Ul41Kmg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-4.0.0.tgz", + "integrity": "sha512-sNi3DL0/k64/LO3A256M+m3CDdG6V7WKWHdAiBBMUN8S3hK3aMPhwnPik2A/a2ONN+9doY9UxaLfgqsIRg69QA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-node": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-4.0.0.tgz", + "integrity": "sha512-q0iDP3VsZzqJyje8xJWEJCNIu3lktUGVoSy1KB0UWym2CL1siV3artm+u1DFYTLejpsrdGyCSWBdGNjJzfDPjg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-buffer-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-4.0.0.tgz", + "integrity": "sha512-9TOQ7781sZvddgO8nxueKi3+yGvkY35kotA0Y6BWRajAv8jjmigQ1sBwz0UX47pQMYXJPahSKEKYFgt+rXdcug==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-config-provider": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-4.0.0.tgz", + "integrity": "sha512-L1RBVzLyfE8OXH+1hsJ8p+acNUSirQnWQ6/EgpchV88G6zGBTDPdXiiExei6Z1wR2RxYvxY/XLw6AMNCCt8H3w==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-browser": { + "version": "4.0.21", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.21.tgz", + "integrity": "sha512-wM0jhTytgXu3wzJoIqpbBAG5U6BwiubZ6QKzSbP7/VbmF1v96xlAbX2Am/mz0Zep0NLvLh84JT0tuZnk3wmYQA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.0.4", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-node": { + "version": "4.0.21", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.21.tgz", + "integrity": "sha512-/F34zkoU0GzpUgLJydHY8Rxu9lBn8xQC/s/0M0U9lLBkYbA1htaAFjWYJzpzsbXPuri5D1H8gjp2jBum05qBrA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/config-resolver": "^4.1.4", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-endpoints": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-3.0.6.tgz", + "integrity": "sha512-YARl3tFL3WgPuLzljRUnrS2ngLiUtkwhQtj8PAL13XZSyUiNLQxwG3fBBq3QXFqGFUXepIN73pINp3y8c2nBmA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-hex-encoding": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-4.0.0.tgz", + "integrity": "sha512-Yk5mLhHtfIgW2W2WQZWSg5kuMZCVbvhFmC7rV4IO2QqnZdbEFPmQnCcGMAX2z/8Qj3B9hYYNjZOhWym+RwhePw==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-middleware": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-4.0.4.tgz", + "integrity": "sha512-9MLKmkBmf4PRb0ONJikCbCwORACcil6gUWojwARCClT7RmLzF04hUR4WdRprIXal7XVyrddadYNfp2eF3nrvtQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-retry": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-4.0.6.tgz", + "integrity": "sha512-+YekoF2CaSMv6zKrA6iI/N9yva3Gzn4L6n35Luydweu5MMPYpiGZlWqehPHDHyNbnyaYlz/WJyYAZnC+loBDZg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/service-error-classification": "^4.0.6", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-stream": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-4.2.2.tgz", + "integrity": "sha512-aI+GLi7MJoVxg24/3J1ipwLoYzgkB4kUfogZfnslcYlynj3xsQ0e7vk4TnTro9hhsS5PvX1mwmkRqqHQjwcU7w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-hex-encoding": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-uri-escape": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-4.0.0.tgz", + "integrity": "sha512-77yfbCbQMtgtTylO9itEAdpPXSog3ZxMe09AEhm0dU0NLTalV70ghDZFR+Nfi1C60jnJoh/Re4090/DuZh2Omg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-utf8": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-4.0.0.tgz", + "integrity": "sha512-b+zebfKCfRdgNJDknHCob3O7FpeYQN6ZG6YLExMcasDHsCXlsXCEuiPZeLnJLpwa5dvPetGlnGCiMHuLwGvFow==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", @@ -1173,6 +2549,12 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "node_modules/@types/uuid": { + "version": "9.0.8", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", + "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==", + "license": "MIT" + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -1446,6 +2828,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==", + "license": "MIT" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2004,6 +3392,28 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "node_modules/fast-xml-parser": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", + "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -3974,6 +5384,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strnum": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz", + "integrity": "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -4151,6 +5573,12 @@ } } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index ed24b5ef8..e3d6423df 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -12,6 +12,7 @@ "author": "Nate Sesti and Ty Dunn", "license": "Apache-2.0", "dependencies": { + "@aws-sdk/client-bedrock-runtime": "^3.842.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts new file mode 100644 index 000000000..ef27890b9 --- /dev/null +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -0,0 +1,705 @@ +import { + BedrockRuntimeClient, + ContentBlock, + ConversationRole, + ConverseStreamCommand, + ConverseStreamCommandInput, + ImageFormat, + Message, + ToolConfiguration, +} from "@aws-sdk/client-bedrock-runtime"; +import { OpenAI } from "openai/index"; +import { v4 as uuidv4 } from "uuid"; + +import { + ChatCompletion, + ChatCompletionChunk, + ChatCompletionCreateParams, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + ChatCompletionMessageToolCall, + Completion, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + CreateEmbeddingResponse, + EmbeddingCreateParams, + Model, +} from "openai/resources/index"; + +import { BedrockConfig } from "../types.js"; +import { chatChunk, chatChunkFromDelta } from "../util.js"; +import { safeParseArgs } from "../util/parseArgs.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; + +// Utility function to get or generate UUID for prompt caching +function getSecureID(): string { + // Adding a type declaration for the static property + if (!(getSecureID as any).uuid) { + (getSecureID as any).uuid = crypto.randomUUID(); + } + return ``; +} + +/** + * Interface for tool use state tracking + */ +interface ToolUseState { + toolUseId: string; + name: string; + input: string; +} + +export class BedrockApi implements BaseLlmApi { + private client: BedrockRuntimeClient; + private _currentToolResponse: Partial | null = null; + + constructor(protected config: BedrockConfig) { + if (!config.env?.region) { + throw new Error("region is required for Bedrock API"); + } + if (!config.apiKey) { + throw new Error( + "apiKey in the format accessKeyId:secretAccessKey is required for Bedrock API", + ); + } + + const [accessKeyId, secretAccessKey] = config.apiKey.split(":"); + if (!accessKeyId || !secretAccessKey) { + throw new Error( + "Bedrock apiKey must be in the format accessKeyId:secretAccessKey", + ); + } + + this.client = new BedrockRuntimeClient({ + region: config.env.region, + credentials: { + accessKeyId, + secretAccessKey, + }, + }); + } + + private _oaiPartToBedrockPart( + part: + | OpenAI.Chat.Completions.ChatCompletionContentPart + | OpenAI.Chat.Completions.ChatCompletionContentPartRefusal, + ): ContentBlock { + switch (part.type) { + case "refusal": + return { + text: part.refusal, + }; + case "text": + return { + text: part.text, + }; + case "input_audio": + throw new Error("Unsupported part type: input_audio"); + case "image_url": + default: + try { + const [mimeType, base64Data] = part.image_url.url.split(","); + const format = mimeType.split("/")[1]?.split(";")[0] || "jpeg"; + if ( + format === ImageFormat.JPEG || + format === ImageFormat.PNG || + format === ImageFormat.WEBP || + format === ImageFormat.GIF + ) { + return { + image: { + format, + source: { + bytes: Uint8Array.from(Buffer.from(base64Data, "base64")), + }, + }, + }; + } else { + console.warn( + `Bedrock: skipping unsupported image part format: ${format}`, + ); + return { text: "[Unsupported image format]" }; + } + } catch (error) { + console.warn("Bedrock: failed to process image part", error); + return { text: "[Failed to process image]" }; + } + } + } + + private _convertMessages( + oaiMessages: OpenAI.Chat.Completions.ChatCompletionMessageParam[], + availableTools: Set, + ): Message[] { + let currentRole: "user" | "assistant" = "user"; + let currentBlocks: ContentBlock[] = []; + const converted: Message[] = []; + const hasAddedToolCallIds = new Set(); + + const pushCurrentMessage = () => { + if (currentBlocks.length > 0) { + converted.push({ + role: currentRole, + content: currentBlocks, + }); + currentBlocks = []; + } + }; + + const nonSystemMessages = oaiMessages.filter((m) => m.role !== "system"); + + for (let idx = 0; idx < nonSystemMessages.length; idx++) { + const message = nonSystemMessages[idx]; + + if (message.role === "user" || message.role === "tool") { + // Detect conversational turn change + if (currentRole !== ConversationRole.USER) { + pushCurrentMessage(); + currentRole = ConversationRole.USER; + } + + // USER messages + if (message.role === "user") { + const content = message.content; + if (content) { + if (typeof content === "string") { + currentBlocks.push({ text: content }); + } else { + content.forEach((part) => { + currentBlocks.push(this._oaiPartToBedrockPart(part)); + }); + } + } + } + // TOOL messages + else if (message.role === "tool") { + const trimmedContent = + typeof message.content === "string" + ? message.content.trim() + : JSON.stringify(message.content); + + if (hasAddedToolCallIds.has(message.tool_call_id)) { + currentBlocks.push({ + toolResult: { + toolUseId: message.tool_call_id, + content: [ + { + text: trimmedContent || "No tool output", + }, + ], + }, + }); + } else { + currentBlocks.push({ + text: `Tool call output for Tool Call ID ${message.tool_call_id}:\n\n${trimmedContent || "No tool output"}`, + }); + } + } + } else if (message.role === "assistant") { + // Detect conversational turn change + if (currentRole !== ConversationRole.ASSISTANT) { + pushCurrentMessage(); + currentRole = ConversationRole.ASSISTANT; + } + + // ASSISTANT messages + const content = message.content; + if (content) { + if (typeof content === "string") { + currentBlocks.push({ text: content }); + } else { + content.forEach((part) => { + currentBlocks.push(this._oaiPartToBedrockPart(part)); + }); + } + } + + // TOOL CALLS + if (message.tool_calls) { + for (const toolCall of message.tool_calls) { + if (toolCall.id && toolCall.function?.name) { + if (availableTools.has(toolCall.function.name)) { + currentBlocks.push({ + toolUse: { + toolUseId: toolCall.id, + name: toolCall.function.name, + input: safeParseArgs( + toolCall.function.arguments, + `Call: ${toolCall.function.name} ${toolCall.id}`, + ), + }, + }); + hasAddedToolCallIds.add(toolCall.id); + } else { + const toolCallText = `Assistant tool call:\nTool name: ${toolCall.function.name}\nTool Call ID: ${toolCall.id}\nArguments: ${toolCall.function?.arguments ?? "{}"}`; + currentBlocks.push({ + text: toolCallText, + }); + } + } + } + } + } + } + + if (currentBlocks.length > 0) { + pushCurrentMessage(); + } + + // If caching is enabled, add cache points + // if (this.config.cacheBehavior?.cacheConversation) { + // this._addCachingToLastTwoUserMessages(converted); + // } + + return converted; + } + + private _addCachingToLastTwoUserMessages(converted: Message[]) { + let numCached = 0; + for (let i = converted.length - 1; i >= 0; i--) { + const message = converted[i]; + if (message.role === "user") { + message.content?.forEach((block) => { + if (block.text) { + block.text += getSecureID(); + } + }); + message.content?.push({ cachePoint: { type: "default" } }); + numCached++; + } + if (numCached === 2) { + break; + } + } + } + + private _convertBody( + oaiBody: ChatCompletionCreateParams, + ): ConverseStreamCommandInput { + // Extract system message + const systemMessage = + oaiBody.messages.find((msg) => msg.role === "system")?.content || ""; + + const systemMessageText = + typeof systemMessage === "string" + ? systemMessage + : systemMessage + .map((part) => + part.type === "text" ? part.text : "[Non-text content]", + ) + .join(" "); + + // Check for tools + const availableTools = new Set(); + let toolConfig: ToolConfiguration | undefined = undefined; + + if (oaiBody.tools && oaiBody.tools.length > 0) { + toolConfig = { + tools: oaiBody.tools.map((tool) => ({ + toolSpec: { + name: tool.function.name, + description: tool.function.description, + inputSchema: { + json: tool.function.parameters, + }, + }, + })), + } as ToolConfiguration; + + // Add cache point if needed + // if (this.config.cacheBehavior?.cacheSystemMessage) { + // toolConfig!.tools!.push({ cachePoint: { type: "default" } }); + // } + + oaiBody.tools.forEach((tool) => { + availableTools.add(tool.function.name); + }); + } + + // Convert messages + const convertedMessages = this._convertMessages( + oaiBody.messages, + availableTools, + ); + + // Build final request body + const body: any = { + modelId: oaiBody.model, + messages: convertedMessages, + inferenceConfig: { + temperature: oaiBody.temperature, + topP: oaiBody.top_p, + maxTokens: oaiBody.max_tokens, + stopSequences: Array.isArray(oaiBody.stop) + ? oaiBody.stop.filter((s) => s.trim() !== "").slice(0, 4) + : oaiBody.stop + ? [oaiBody.stop].filter((s) => s.trim() !== "") + : undefined, + }, + }; + + // Add system message if present + if (systemMessageText) { + body.system = false // this.config.cacheBehavior?.cacheSystemMessage // TODO + ? [{ text: systemMessageText }, { cachePoint: { type: "default" } }] + : [{ text: systemMessageText }]; + } + + // Add tool config if present + if (toolConfig) { + body.toolConfig = toolConfig; + } + + // Add reasoning if needed + // TODO REASONING + // if (this.c) { + // body.additionalModelRequestFields = { + // thinking: { + // type: "enabled", + // budget_tokens: + // oaiBody.additionalModelRequestFields.reasoningBudgetTokens, + // }, + // }; + // } + + return body; + } + + async chatCompletionNonStream( + body: ChatCompletionCreateParamsNonStreaming, + signal: AbortSignal, + ): Promise { + let completion = ""; + const toolCalls: ChatCompletionMessageToolCall[] = []; + + for await (const chunk of this.chatCompletionStream( + { + ...body, + stream: true, + }, + signal, + )) { + if (chunk.choices[0].delta.content) { + completion += chunk.choices[0].delta.content; + } + // TODO tool calls not supported + } + + return { + id: uuidv4(), + object: "chat.completion", + model: body.model, + created: Date.now(), + choices: [ + { + index: 0, + logprobs: null, + finish_reason: "stop", + message: { + role: "assistant", + content: completion, + tool_calls: toolCalls.length > 0 ? toolCalls : undefined, + refusal: null, + }, + }, + ], + usage: undefined, + }; + } + + async *chatCompletionStream( + body: ChatCompletionCreateParamsStreaming, + signal: AbortSignal, + ): AsyncGenerator { + const requestBody = this._convertBody(body); + + try { + const command = new ConverseStreamCommand({ + ...requestBody, + }); + + const response = await this.client.send(command, { abortSignal: signal }); + + if (!response?.stream) { + throw new Error("No stream received from Bedrock API"); + } + + this._currentToolResponse = null; + + for await (const chunk of response.stream) { + if (chunk.contentBlockDelta?.delta) { + const delta: any = chunk.contentBlockDelta.delta; + + // Handle text content + if (delta.text) { + yield chatChunk({ + content: delta.text, + model: body.model, + }); + continue; + } + + // Handle thinking content (if reasoning enabled) + if (delta.reasoningContent?.text) { + // TODO reasoning + // Reasoning is not directly supported in OpenAI format, + // but we could add it as a special message + continue; + } + + // Handle tool use + if (delta.toolUse?.input && this._currentToolResponse) { + if (this._currentToolResponse.input === undefined) { + this._currentToolResponse.input = ""; + } + this._currentToolResponse.input += delta.toolUse.input; + continue; + } + } + + if (chunk.contentBlockStart?.start) { + const start: any = chunk.contentBlockStart.start; + + // Handle tool start + const toolUse = start.toolUse; + if (toolUse?.toolUseId && toolUse?.name) { + this._currentToolResponse = { + toolUseId: toolUse.toolUseId, + name: toolUse.name, + input: "", + }; + } + continue; + } + + if (chunk.contentBlockStop) { + // End of a content block + if (this._currentToolResponse) { + yield chatChunkFromDelta({ + model: body.model, + delta: { + tool_calls: [ + { + index: 0, + id: this._currentToolResponse.toolUseId, + type: "function", + function: { + name: this._currentToolResponse.name, + arguments: this._currentToolResponse.input, + }, + }, + ], + }, + }); + this._currentToolResponse = null; + } + continue; + } + } + } catch (error) { + this._currentToolResponse = null; + if (error instanceof Error) { + if ("code" in error) { + throw new Error( + `AWS Bedrock stream error (${(error as any).code}): ${error.message}`, + ); + } + throw new Error(`Error processing Bedrock stream: ${error.message}`); + } + throw new Error( + "Error processing Bedrock stream: Unknown error occurred", + ); + } + } + + completionNonStream( + body: CompletionCreateParamsNonStreaming, + ): Promise { + throw new Error("Bedrock does not support completions API"); + } + + completionStream( + body: CompletionCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Bedrock does not support completions API"); + } + + fimStream( + body: FimCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Bedrock does not support FIM directly"); + } + + async embed(body: EmbeddingCreateParams): Promise { + throw new Error("Not implemented"); + // // Determine which embedding model is being used based on the model prefix + // const modelPrefix = this._getEmbeddingModelPrefix(body.model); + + // if (!modelPrefix) { + // throw new Error(`Unsupported embedding model: ${body.model}`); + // } + + // const inputs = Array.isArray(body.input) ? body.input : [body.input]; + + // try { + // const embeddings = await Promise.all( + // inputs.map(async (input) => { + // const payload = this._formatEmbeddingPayload(input, modelPrefix); + + // const response = await customFetch(this.config.requestOptions)( + // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, + // { + // method: "POST", + // body: JSON.stringify(payload), + // headers: { + // "Content-Type": "application/json", + // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", + // "X-Amz-Date": new Date() + // .toISOString() + // .replace(/[:-]|\.\d{3}/g, ""), + // }, + // aws: { + // region: this.config.region, + // service: "bedrock", + // credentials: { + // accessKeyId: this.config.accessKeyId, + // secretAccessKey: this.config.secretAccessKey, + // }, + // }, + // }, + // ); + + // const data = await response.json(); + // return this._extractEmbedding(data, modelPrefix); + // }), + // ); + + // return embedding({ + // model: body.model, + // usage: { + // total_tokens: inputs.reduce((sum, input) => sum + input.length, 0), + // prompt_tokens: inputs.reduce((sum, input) => sum + input.length, 0), + // }, + // data: embeddings, + // }); + // } catch (error) { + // if (error instanceof Error) { + // throw new Error(`Bedrock embedding error: ${error.message}`); + // } + // throw new Error("Unknown error in Bedrock embedding"); + // } + } + + private _getEmbeddingModelPrefix(model: string): string | undefined { + if (model.startsWith("cohere")) { + return "cohere"; + } + if (model.startsWith("amazon.titan-embed")) { + return "amazon.titan-embed"; + } + return undefined; + } + + private _formatEmbeddingPayload(text: string, modelPrefix: string): any { + if (modelPrefix === "cohere") { + return { + texts: [text], + input_type: "search_document", + truncate: "END", + }; + } + if (modelPrefix === "amazon.titan-embed") { + return { + inputText: text, + }; + } + throw new Error(`Unsupported model prefix: ${modelPrefix}`); + } + + private _extractEmbedding(data: any, modelPrefix: string): number[] { + if (modelPrefix === "cohere") { + return data.embeddings?.[0] || []; + } + if (modelPrefix === "amazon.titan-embed") { + return data.embedding || []; + } + return []; + } + + async rerank(body: RerankCreateParams): Promise { + throw new Error("Not implemented"); + // if (!body.query || !body.documents.length) { + // throw new Error("Query and documents must not be empty"); + // } + + // try { + // // Build the payload + // const payload: any = { + // query: body.query, + // documents: body.documents, + // top_n: body.documents.length, + // }; + + // // Add api_version for Cohere model + // if (body.model.startsWith("cohere.rerank")) { + // payload.api_version = 2; + // } + + // const response = await customFetch(this.config.requestOptions)( + // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, + // { + // method: "POST", + // body: JSON.stringify(payload), + // headers: { + // "Content-Type": "application/json", + // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", + // "X-Amz-Date": new Date().toISOString().replace(/[:-]|\.\d{3}/g, ""), + // }, + // aws: { + // region: this.config.region, + // service: "bedrock", + // credentials: { + // accessKeyId: this.config.accessKeyId, + // secretAccessKey: this.config.secretAccessKey, + // }, + // }, + // }, + // ); + + // const data = await response.json(); + + // // Process the response + // if (!data.results) { + // throw new Error("Invalid response format from Bedrock reranker"); + // } + + // // Return the results in a format compatible with OpenAI's reranker + // return { + // object: "list", + // model: body.model, + // data: data.results.map((result: any, index: number) => ({ + // document_index: result.index || index, + // relevance_score: result.relevance_score, + // text: body.documents[result.index || index], + // })), + // usage: { + // total_tokens: 0, // TODO + // }, + // }; + // } catch (error) { + // if (error instanceof Error) { + // throw new Error(`Bedrock rerank error: ${error.message}`); + // } + // throw new Error("Unknown error in Bedrock reranker"); + // } + } + + list(): Promise { + throw new Error("Method not implemented."); + } +} diff --git a/packages/openai-adapters/src/index.ts b/packages/openai-adapters/src/index.ts index b4254046e..2114f4f34 100644 --- a/packages/openai-adapters/src/index.ts +++ b/packages/openai-adapters/src/index.ts @@ -2,6 +2,7 @@ import dotenv from "dotenv"; import { z } from "zod"; import { AnthropicApi } from "./apis/Anthropic.js"; import { AzureApi } from "./apis/Azure.js"; +import { BedrockApi } from "./apis/Bedrock.js"; import { CohereApi } from "./apis/Cohere.js"; import { DeepSeekApi } from "./apis/DeepSeek.js"; import { GeminiApi } from "./apis/Gemini.js"; @@ -34,6 +35,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined { return new OpenAIApi(config); case "azure": return new AzureApi(config); + case "bedrock": + return new BedrockApi(config); case "cohere": return new CohereApi(config); case "anthropic": diff --git a/packages/openai-adapters/src/types.ts b/packages/openai-adapters/src/types.ts index 3c79db7bf..4d7521dde 100644 --- a/packages/openai-adapters/src/types.ts +++ b/packages/openai-adapters/src/types.ts @@ -71,6 +71,18 @@ export const DeepseekConfigSchema = OpenAIConfigSchema.extend({ }); export type DeepseekConfig = z.infer; +export const BedrockConfigSchema = OpenAIConfigSchema.extend({ + provider: z.literal("bedrock"), + // cacheBehavior: z.object({ + // cacheSystemMessage: z.boolean().optional(), + // cacheConversation: z.boolean().optional(), + // }).optional(), + env: z.object({ + region: z.string().optional(), + }), +}); +export type BedrockConfig = z.infer; + export const LlamastackConfigSchema = OpenAIConfigSchema.extend({ provider: z.literal("llamastack"), }); @@ -142,6 +154,7 @@ export type InceptionConfig = z.infer; // Discriminated union export const LLMConfigSchema = z.discriminatedUnion("provider", [ OpenAIConfigSchema, + BedrockConfigSchema, MoonshotConfigSchema, DeepseekConfigSchema, CohereConfigSchema, From 537d5439d09f57c031ed943bfffd0a757ae81907 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 15:29:33 -0700 Subject: [PATCH 25/75] fix empty message bedrock openai adapter bug --- packages/openai-adapters/src/apis/Bedrock.ts | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index ef27890b9..400d3e97e 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -181,7 +181,10 @@ export class BedrockApi implements BaseLlmApi { const trimmedContent = typeof message.content === "string" ? message.content.trim() - : JSON.stringify(message.content); + : message.content + .map((c) => c.text) + .join("\n") + .trim(); if (hasAddedToolCallIds.has(message.tool_call_id)) { currentBlocks.push({ @@ -208,15 +211,19 @@ export class BedrockApi implements BaseLlmApi { } // ASSISTANT messages - const content = message.content; - if (content) { - if (typeof content === "string") { - currentBlocks.push({ text: content }); - } else { - content.forEach((part) => { - currentBlocks.push(this._oaiPartToBedrockPart(part)); - }); + if (typeof message.content === "string") { + const trimmedText = message.content.trim(); + if (trimmedText) { + currentBlocks.push({ text: trimmedText }); } + } else { + message.content?.forEach((part) => { + const text = part.type === "text" ? part.text : part.refusal; + const trimmedText = text.trim(); + if (trimmedText) { + currentBlocks.push({ text: trimmedText }); + } + }); } // TOOL CALLS From 81860c60287346a4912fab3ceb86f0577ffa0295 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 18:17:55 -0700 Subject: [PATCH 26/75] rerank and embed functions --- packages/openai-adapters/src/apis/Bedrock.ts | 258 ++++++++----------- 1 file changed, 109 insertions(+), 149 deletions(-) diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index 400d3e97e..e34f65722 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -5,6 +5,7 @@ import { ConverseStreamCommand, ConverseStreamCommandInput, ImageFormat, + InvokeModelCommand, Message, ToolConfiguration, } from "@aws-sdk/client-bedrock-runtime"; @@ -27,7 +28,7 @@ import { } from "openai/resources/index"; import { BedrockConfig } from "../types.js"; -import { chatChunk, chatChunkFromDelta } from "../util.js"; +import { chatChunk, chatChunkFromDelta, embedding, rerank } from "../util.js"; import { safeParseArgs } from "../util/parseArgs.js"; import { BaseLlmApi, @@ -542,168 +543,127 @@ export class BedrockApi implements BaseLlmApi { throw new Error("Bedrock does not support FIM directly"); } + private async getInvokeModelResponseBody(model: string, jsonBody: object) { + const payload = { + body: JSON.stringify(jsonBody), + modelId: model, + accept: "*/*", + contentType: "application/json", + }; + const command = new InvokeModelCommand(payload); + const response = await this.client.send(command); + if (!response.body) { + throw new Error("No response body"); + } + const decoder = new TextDecoder(); + const decoded = decoder.decode(response.body); + return JSON.parse(decoded); + } + + private getEmbedTexts(body: EmbeddingCreateParams): string[] { + const texts: string[] = []; + if (typeof body.input === "string") { + texts.push(body.input); + } else if (body.input.length > 0) { + const firstVal = body.input[0]; + if (Array.isArray(firstVal)) { + throw new Error("Unsupported embeddings type received: number[][]"); + } + if (typeof firstVal === "string") { + texts.push(...(body.input as string[])); + } else { + throw new Error("Unsupported embeddings type received: number[]"); + } + } + return texts; + } + async embed(body: EmbeddingCreateParams): Promise { - throw new Error("Not implemented"); - // // Determine which embedding model is being used based on the model prefix - // const modelPrefix = this._getEmbeddingModelPrefix(body.model); + const texts = this.getEmbedTexts(body); - // if (!modelPrefix) { - // throw new Error(`Unsupported embedding model: ${body.model}`); - // } - - // const inputs = Array.isArray(body.input) ? body.input : [body.input]; - - // try { - // const embeddings = await Promise.all( - // inputs.map(async (input) => { - // const payload = this._formatEmbeddingPayload(input, modelPrefix); - - // const response = await customFetch(this.config.requestOptions)( - // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, - // { - // method: "POST", - // body: JSON.stringify(payload), - // headers: { - // "Content-Type": "application/json", - // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", - // "X-Amz-Date": new Date() - // .toISOString() - // .replace(/[:-]|\.\d{3}/g, ""), - // }, - // aws: { - // region: this.config.region, - // service: "bedrock", - // credentials: { - // accessKeyId: this.config.accessKeyId, - // secretAccessKey: this.config.secretAccessKey, - // }, - // }, - // }, - // ); - - // const data = await response.json(); - // return this._extractEmbedding(data, modelPrefix); - // }), - // ); - - // return embedding({ - // model: body.model, - // usage: { - // total_tokens: inputs.reduce((sum, input) => sum + input.length, 0), - // prompt_tokens: inputs.reduce((sum, input) => sum + input.length, 0), - // }, - // data: embeddings, - // }); - // } catch (error) { - // if (error instanceof Error) { - // throw new Error(`Bedrock embedding error: ${error.message}`); - // } - // throw new Error("Unknown error in Bedrock embedding"); - // } - } - - private _getEmbeddingModelPrefix(model: string): string | undefined { - if (model.startsWith("cohere")) { - return "cohere"; - } - if (model.startsWith("amazon.titan-embed")) { - return "amazon.titan-embed"; - } - return undefined; - } - - private _formatEmbeddingPayload(text: string, modelPrefix: string): any { - if (modelPrefix === "cohere") { - return { - texts: [text], + let embeddings: number[][]; + if (body.model.startsWith("cohere")) { + const payload = { + texts, input_type: "search_document", truncate: "END", }; + const output = await this.getInvokeModelResponseBody(body.model, payload); + embeddings = [output.embedding]; + } else if (body.model.startsWith("amazon.titan-embed")) { + embeddings = await Promise.all( + texts.map(async (text) => { + const payload = { + inputText: text, + }; + const output = await this.getInvokeModelResponseBody( + body.model, + payload, + ); + return output.embeddings || []; + }), + ); + } else { + throw new Error(`Unsupported model: ${body.model}`); } - if (modelPrefix === "amazon.titan-embed") { - return { - inputText: text, - }; - } - throw new Error(`Unsupported model prefix: ${modelPrefix}`); - } - private _extractEmbedding(data: any, modelPrefix: string): number[] { - if (modelPrefix === "cohere") { - return data.embeddings?.[0] || []; - } - if (modelPrefix === "amazon.titan-embed") { - return data.embedding || []; - } - return []; + return embedding({ + data: embeddings, + model: body.model, + usage: { + prompt_tokens: 0, + total_tokens: 0, + }, + }); } async rerank(body: RerankCreateParams): Promise { - throw new Error("Not implemented"); - // if (!body.query || !body.documents.length) { - // throw new Error("Query and documents must not be empty"); - // } + if (!body.query || !body.documents.length) { + throw new Error("Query and chunks must not be empty"); + } - // try { - // // Build the payload - // const payload: any = { - // query: body.query, - // documents: body.documents, - // top_n: body.documents.length, - // }; + // Base payload for both models + const payload: any = { + query: body.query, + documents: body.documents, + top_n: body.top_k ?? body.documents.length, + }; - // // Add api_version for Cohere model - // if (body.model.startsWith("cohere.rerank")) { - // payload.api_version = 2; - // } + // Add api_version for Cohere model + if (body.model.startsWith("cohere.rerank")) { + payload.api_version = 2; + } - // const response = await customFetch(this.config.requestOptions)( - // `https://bedrock-runtime.${this.config.region}.amazonaws.com/model/${body.model}/invoke`, - // { - // method: "POST", - // body: JSON.stringify(payload), - // headers: { - // "Content-Type": "application/json", - // "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD", - // "X-Amz-Date": new Date().toISOString().replace(/[:-]|\.\d{3}/g, ""), - // }, - // aws: { - // region: this.config.region, - // service: "bedrock", - // credentials: { - // accessKeyId: this.config.accessKeyId, - // secretAccessKey: this.config.secretAccessKey, - // }, - // }, - // }, - // ); + try { + const responseBody = await this.getInvokeModelResponseBody( + body.model, + payload, + ); + const scores = responseBody.results + .sort((a: any, b: any) => a.index - b.index) + .map((result: any) => result.relevance_score); - // const data = await response.json(); - - // // Process the response - // if (!data.results) { - // throw new Error("Invalid response format from Bedrock reranker"); - // } - - // // Return the results in a format compatible with OpenAI's reranker - // return { - // object: "list", - // model: body.model, - // data: data.results.map((result: any, index: number) => ({ - // document_index: result.index || index, - // relevance_score: result.relevance_score, - // text: body.documents[result.index || index], - // })), - // usage: { - // total_tokens: 0, // TODO - // }, - // }; - // } catch (error) { - // if (error instanceof Error) { - // throw new Error(`Bedrock rerank error: ${error.message}`); - // } - // throw new Error("Unknown error in Bedrock reranker"); - // } + return rerank({ + model: body.model, + usage: { + total_tokens: 0, + }, + data: scores, + }); + } catch (error) { + if (error instanceof Error) { + if ("code" in error) { + // AWS SDK specific errors + throw new Error( + `AWS Bedrock rerank error (${(error as any).code}): ${error.message}`, + ); + } + throw new Error(`Error in BedrockReranker.rerank: ${error.message}`); + } + throw new Error( + "Error in BedrockReranker.rerank: Unknown error occurred", + ); + } } list(): Promise { From 2b88e54e3799ad18b87bd21d17b9c1ded2cd81cc Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 18:47:37 -0700 Subject: [PATCH 27/75] support secretAccessKey and accessKeyId for bedrock --- core/config/yaml/models.ts | 6 ++ core/index.d.ts | 2 + core/llm/index.ts | 4 + core/llm/llms/Bedrock.ts | 39 +++----- extensions/vscode/config_schema.json | 22 ++++- packages/openai-adapters/package-lock.json | 97 ++++++++++++++++++++ packages/openai-adapters/package.json | 1 + packages/openai-adapters/src/apis/Bedrock.ts | 59 ++++++++---- packages/openai-adapters/src/types.ts | 3 + 9 files changed, 190 insertions(+), 43 deletions(-) diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index edb47f59e..200cfc221 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -126,6 +126,12 @@ async function modelConfigToBaseLLM({ if ("profile" in env && typeof env.profile === "string") { options.profile = env.profile; } + if ("accessKeyId" in env && typeof env.accessKeyId === "string") { + options.accessKeyId = env.accessKeyId; + } + if ("secretAccessKey" in env && typeof env.secretAccessKey === "string") { + options.secretAccessKey = env.secretAccessKey; + } if ("modelArn" in env && typeof env.modelArn === "string") { options.modelArn = env.modelArn; } diff --git a/core/index.d.ts b/core/index.d.ts index 3d6f1602c..57a4e222f 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -611,6 +611,8 @@ export interface LLMOptions { // AWS options profile?: string; modelArn?: string; + accessKeyId?: string; + secretAccessKey?: string; // AWS and VertexAI Options region?: string; diff --git a/core/llm/index.ts b/core/llm/index.ts index 47fdf8011..fe76acea7 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -172,6 +172,8 @@ export abstract class BaseLLM implements ILLM { accountId?: string; aiGatewaySlug?: string; profile?: string | undefined; + accessKeyId?: string; + secretAccessKey?: string; // For IBM watsonx deploymentId?: string; @@ -270,6 +272,8 @@ export abstract class BaseLLM implements ILLM { this.region = options.region; this.projectId = options.projectId; this.profile = options.profile; + this.accessKeyId = options.accessKeyId; + this.secretAccessKey = options.secretAccessKey; this.openaiAdapter = this.createOpenAiAdapter(); diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index cf13edd6a..21dda2288 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -73,11 +73,6 @@ class Bedrock extends BaseLLM { if (!options.apiBase) { this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; } - if (options.profile) { - this.profile = options.profile; - } else { - this.profile = "bedrock"; - } this.requestOptions = { region: options.region, @@ -612,30 +607,22 @@ class Bedrock extends BaseLLM { } private async _getCredentials() { - if (this.apiKey) { - const [accessKeyId, secretAccessKey] = this.apiKey.split(":"); - if (!accessKeyId || !secretAccessKey) { - throw new Error( - "Invalid Bedrock API key format. Expected format: accessKeyId:secretAccessKey", - ); - } + if (this.accessKeyId && this.secretAccessKey) { return { - accessKeyId, - secretAccessKey, + accessKeyId: this.accessKeyId, + secretAccessKey: this.secretAccessKey, }; } - - if (this.profile) { - try { - return await fromNodeProviderChain({ - profile: this.profile, - ignoreCache: true, - })(); - } catch (e) { - console.warn( - `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, - ); - } + const profile = this.profile ?? "bedrock"; + try { + return await fromNodeProviderChain({ + profile: profile, + ignoreCache: true, + })(); + } catch (e) { + console.warn( + `AWS profile with name ${profile} not found in ~/.aws/credentials, using default profile`, + ); } return await fromNodeProviderChain()(); } diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 29d882489..86675a1ac 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -359,8 +359,18 @@ "description": "The AWS security profile to use", "type": "string" }, + "accessKeyId": { + "title": "Access Key ID", + "description": "AWS access key id (can be used together with secretAccessKey in place of profile)", + "type": "string" + }, + "secretAccessKey": { + "title": "Secret Access Key", + "description": "AWS secret access key (can be used together with secretAccessKey in place of profile)", + "type": "string" + }, "modelArn": { - "title": "Profile", + "title": "Model ARN", "description": "The AWS arn for the imported model", "type": "string" }, @@ -2903,6 +2913,16 @@ "title": "Profile", "description": "The AWS security profile to use", "type": "string" + }, + "accessKeyId": { + "title": "Access Key ID", + "description": "AWS access key id (can be used together with secretAccessKey in place of profile)", + "type": "string" + }, + "secretAccessKey": { + "title": "Secret Access Key", + "description": "AWS secret access key (can be used together with secretAccessKey in place of profile)", + "type": "string" } }, "required": ["provider"], diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 86228c0d9..2c71d9e7f 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -10,6 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.842.0", + "@aws-sdk/credential-providers": "^3.840.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", @@ -255,6 +256,56 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/@aws-sdk/client-cognito-identity": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.840.0.tgz", + "integrity": "sha512-0sn/X63Xqqh5D1FYmdSHiS9SkDzTitoGO++/8IFik4xf/jpn4ZQkIoDPvpxFZcLvebMuUa6jAQs4ap4RusKGkg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-node": "3.840.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.840.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.840.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/fetch-http-handler": "^5.0.4", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.13", + "@smithy/middleware-retry": "^4.1.14", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.0.6", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.5", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.21", + "@smithy/util-defaults-mode-node": "^4.0.21", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@aws-sdk/client-sso": { "version": "3.840.0", "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.840.0.tgz", @@ -330,6 +381,22 @@ "node": ">=18.0.0" } }, + "node_modules/@aws-sdk/credential-provider-cognito-identity": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.840.0.tgz", + "integrity": "sha512-p1RaMVd6+6ruYjKsWRCZT/jWhrYfDKbXY+/ScIYTvcaOOf9ArMtVnhFk3egewrC7kPXFGRYhg2GPmxRotNYMng==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-cognito-identity": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@aws-sdk/credential-provider-env": { "version": "3.840.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.840.0.tgz", @@ -467,6 +534,36 @@ "node": ">=18.0.0" } }, + "node_modules/@aws-sdk/credential-providers": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.840.0.tgz", + "integrity": "sha512-+CxYdGd+uM4NZ9VUvFTU1c/H61qhDB4q362k8xKU+bz24g//LDQ5Mpwksv8OUD1en44v4fUwgZ4SthPZMs+eFQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-cognito-identity": "3.840.0", + "@aws-sdk/core": "3.840.0", + "@aws-sdk/credential-provider-cognito-identity": "3.840.0", + "@aws-sdk/credential-provider-env": "3.840.0", + "@aws-sdk/credential-provider-http": "3.840.0", + "@aws-sdk/credential-provider-ini": "3.840.0", + "@aws-sdk/credential-provider-node": "3.840.0", + "@aws-sdk/credential-provider-process": "3.840.0", + "@aws-sdk/credential-provider-sso": "3.840.0", + "@aws-sdk/credential-provider-web-identity": "3.840.0", + "@aws-sdk/nested-clients": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.6.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@aws-sdk/eventstream-handler-node": { "version": "3.840.0", "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.840.0.tgz", diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index e3d6423df..c5f98f556 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -13,6 +13,7 @@ "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.842.0", + "@aws-sdk/credential-providers": "^3.840.0", "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", "@continuedev/fetch": "^1.0.15", diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index e34f65722..67246aff4 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -27,6 +27,7 @@ import { Model, } from "openai/resources/index"; +import { fromNodeProviderChain } from "@aws-sdk/credential-providers"; import { BedrockConfig } from "../types.js"; import { chatChunk, chatChunkFromDelta, embedding, rerank } from "../util.js"; import { safeParseArgs } from "../util/parseArgs.js"; @@ -56,32 +57,56 @@ interface ToolUseState { } export class BedrockApi implements BaseLlmApi { - private client: BedrockRuntimeClient; private _currentToolResponse: Partial | null = null; constructor(protected config: BedrockConfig) { if (!config.env?.region) { throw new Error("region is required for Bedrock API"); } - if (!config.apiKey) { + + if (config.env?.accessKeyId || config?.env?.secretAccessKey) { + if (!config.env?.accessKeyId) { + throw new Error( + "accessKeyId is required for Bedrock API. Only found secretAccessKey", + ); + } + if (!config.env?.secretAccessKey) { + throw new Error( + "secretAccessKey is required for Bedrock API. Only found accessKeyId", + ); + } + } else if (!config.env?.profile) { throw new Error( - "apiKey in the format accessKeyId:secretAccessKey is required for Bedrock API", + "AWS credentials profile not found. Please provide accessKeyId and secretAccessKey or profile", ); } + } - const [accessKeyId, secretAccessKey] = config.apiKey.split(":"); - if (!accessKeyId || !secretAccessKey) { - throw new Error( - "Bedrock apiKey must be in the format accessKeyId:secretAccessKey", + async getCreds() { + if (this.config?.env?.accessKeyId && this.config?.env?.secretAccessKey) { + return { + accessKeyId: this.config.env.accessKeyId, + secretAccessKey: this.config.env.secretAccessKey, + }; + } + const profile = this.config.env.profile ?? "bedrock"; + try { + return await fromNodeProviderChain({ + profile: profile, + ignoreCache: true, + })(); + } catch (e) { + console.warn( + `AWS profile with name ${profile} not found in ~/.aws/credentials, using default profile`, ); } - - this.client = new BedrockRuntimeClient({ - region: config.env.region, - credentials: { - accessKeyId, - secretAccessKey, - }, + return await fromNodeProviderChain()(); + } + async getClient(): Promise { + const creds = await this.getCreds(); + return new BedrockRuntimeClient({ + region: this.config.env.region, + credentials: creds, }); } @@ -431,7 +456,8 @@ export class BedrockApi implements BaseLlmApi { ...requestBody, }); - const response = await this.client.send(command, { abortSignal: signal }); + const client = await this.getClient(); + const response = await client.send(command, { abortSignal: signal }); if (!response?.stream) { throw new Error("No stream received from Bedrock API"); @@ -551,7 +577,8 @@ export class BedrockApi implements BaseLlmApi { contentType: "application/json", }; const command = new InvokeModelCommand(payload); - const response = await this.client.send(command); + const client = await this.getClient(); + const response = await client.send(command); if (!response.body) { throw new Error("No response body"); } diff --git a/packages/openai-adapters/src/types.ts b/packages/openai-adapters/src/types.ts index 4d7521dde..7a6ce37cf 100644 --- a/packages/openai-adapters/src/types.ts +++ b/packages/openai-adapters/src/types.ts @@ -79,6 +79,9 @@ export const BedrockConfigSchema = OpenAIConfigSchema.extend({ // }).optional(), env: z.object({ region: z.string().optional(), + accessKeyId: z.string().optional(), + secretAccessKey: z.string().optional(), + profile: z.string().optional(), }), }); export type BedrockConfig = z.infer; From e389050dda369c23868b283ca13f126f38d82236 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 19:26:55 -0700 Subject: [PATCH 28/75] proxy missing env secrets --- core/config/load.ts | 1 + core/index.d.ts | 2 ++ core/llm/constants.ts | 1 + core/llm/index.ts | 2 ++ core/llm/llms/stubs/ContinueProxy.ts | 21 ++++++++++++--- gui/src/pages/config/ModelRoleSelector.tsx | 25 +++++++++++++----- packages/config-yaml/src/load/clientRender.ts | 26 +++++++++++++++++-- packages/config-yaml/src/schemas/models.ts | 6 +++-- .../typescript/src/createOpenAIClient.ts | 1 + 9 files changed, 71 insertions(+), 14 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index a084bbd38..18c3a72a0 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -650,6 +650,7 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription { roles: llm.roles, configurationStatus: llm.getConfigurationStatus(), apiKeyLocation: llm.apiKeyLocation, + envSecretLocations: llm.envSecretLocations, }; } diff --git a/core/index.d.ts b/core/index.d.ts index 57a4e222f..cb5d5871a 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -583,6 +583,7 @@ export interface LLMOptions { // continueProperties apiKeyLocation?: string; + envSecretLocations?: Record; apiBase?: string; orgScopeId?: string | null; @@ -1084,6 +1085,7 @@ export interface ModelDescription { apiBase?: string; apiKeyLocation?: string; + envSecretLocations?: Record; orgScopeId?: string | null; onPremProxyUrl?: string | null; diff --git a/core/llm/constants.ts b/core/llm/constants.ts index 0975fc142..90de5c64d 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -15,6 +15,7 @@ const DEFAULT_MAX_BATCH_SIZE = 64; export enum LLMConfigurationStatuses { VALID = "valid", MISSING_API_KEY = "missing-api-key", + MISSING_ENV_SECRET = "missing-env-secret", } export { diff --git a/core/llm/index.ts b/core/llm/index.ts index fe76acea7..ba10058a6 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -155,6 +155,7 @@ export abstract class BaseLLM implements ILLM { // continueProperties apiKeyLocation?: string; + envSecretLocations?: Record; apiBase?: string; orgScopeId?: string | null; @@ -248,6 +249,7 @@ export abstract class BaseLLM implements ILLM { // continueProperties this.apiKeyLocation = options.apiKeyLocation; + this.envSecretLocations = options.envSecretLocations; this.orgScopeId = options.orgScopeId; this.apiBase = options.apiBase; diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index b49d00548..d7f788a33 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -40,6 +40,7 @@ class ContinueProxy extends OpenAI { this.apiType = undefined; this.actualApiBase = options.apiBase; this.apiKeyLocation = options.apiKeyLocation; + this.envSecretLocations = options.envSecretLocations; this.orgScopeId = options.orgScopeId; this.onPremProxyUrl = options.onPremProxyUrl; if (this.onPremProxyUrl) { @@ -60,6 +61,7 @@ class ContinueProxy extends OpenAI { protected extraBodyProperties(): Record { const continueProperties: ContinueProperties = { apiKeyLocation: this.apiKeyLocation, + envSecretLocations: this.envSecretLocations, apiBase: this.actualApiBase, orgScopeId: this.orgScopeId ?? null, env: this.configEnv, @@ -70,13 +72,24 @@ class ContinueProxy extends OpenAI { } getConfigurationStatus() { - if (!this.apiKeyLocation) { + if (!this.apiKeyLocation && !this.envSecretLocations) { return LLMConfigurationStatuses.VALID; } - const secretLocation = decodeSecretLocation(this.apiKeyLocation); - if (secretLocation.secretType === SecretType.NotFound) { - return LLMConfigurationStatuses.MISSING_API_KEY; + if (this.apiKeyLocation) { + const secretLocation = decodeSecretLocation(this.apiKeyLocation); + if (secretLocation.secretType === SecretType.NotFound) { + return LLMConfigurationStatuses.MISSING_API_KEY; + } + } + + if (this.envSecretLocations) { + for (const secretLocation of Object.values(this.envSecretLocations)) { + const decoded = decodeSecretLocation(secretLocation); + if (decoded.secretType === SecretType.NotFound) { + return LLMConfigurationStatuses.MISSING_ENV_SECRET; + } + } } return LLMConfigurationStatuses.VALID; diff --git a/gui/src/pages/config/ModelRoleSelector.tsx b/gui/src/pages/config/ModelRoleSelector.tsx index 0065552a8..1b73751b9 100644 --- a/gui/src/pages/config/ModelRoleSelector.tsx +++ b/gui/src/pages/config/ModelRoleSelector.tsx @@ -119,19 +119,32 @@ const ModelRoleSelector = ({ {[...models] .sort((a, b) => a.title.localeCompare(b.title)) .map((option, idx) => { - const showMissingApiKeyMsg = + const isConfigInvalid = + option.configurationStatus !== + LLMConfigurationStatuses.VALID; + let invalidMessage = "(Invalid config)"; + if ( option.configurationStatus === - LLMConfigurationStatuses.MISSING_API_KEY; + LLMConfigurationStatuses.MISSING_ENV_SECRET + ) { + invalidMessage = "(Missing env secret)"; + } + if ( + option.configurationStatus === + LLMConfigurationStatuses.MISSING_API_KEY + ) { + invalidMessage = "(Missing API Key)"; + } return ( setHoveredIdx(idx)} onMouseLeave={() => setHoveredIdx(null)} onClick={(e: any) => - handleOptionClick(showMissingApiKeyMsg, e) + handleOptionClick(isConfigInvalid, e) } className="" > @@ -144,9 +157,9 @@ const ModelRoleSelector = ({ style={{ fontSize: fontSize(-3) }} > {option.title} - {showMissingApiKeyMsg && ( + {isConfigInvalid && ( - (Missing API key) + {invalidMessage} )}
diff --git a/packages/config-yaml/src/load/clientRender.ts b/packages/config-yaml/src/load/clientRender.ts index 46001b847..760ae48a6 100644 --- a/packages/config-yaml/src/load/clientRender.ts +++ b/packages/config-yaml/src/load/clientRender.ts @@ -133,7 +133,27 @@ export function useProxyForUnrenderedSecrets( const apiKeyLocation = getUnrenderedSecretLocation( config.models[i]?.apiKey, ); - if (apiKeyLocation) { + const encodedApiKeyLocation = apiKeyLocation + ? encodeSecretLocation(apiKeyLocation) + : undefined; + + let encodedEnvSecretLocations: Record | undefined = + undefined; + if (config.models[i]?.env) { + Object.entries(config.models[i]?.env!).forEach(([key, value]) => { + if (typeof value === "string") { + const secretLocation = getUnrenderedSecretLocation(value); + if (secretLocation) { + encodedEnvSecretLocations = { + ...encodedEnvSecretLocations, + [key]: encodeSecretLocation(secretLocation), + }; + } + } + }); + } + + if (encodedApiKeyLocation || encodedEnvSecretLocations) { config.models[i] = { ...config.models[i], name: config.models[i]?.name ?? "", @@ -143,7 +163,8 @@ export function useProxyForUnrenderedSecrets( config.models[i]?.provider ?? "", config.models[i]?.model ?? "", ), - apiKeyLocation: encodeSecretLocation(apiKeyLocation), + apiKeyLocation: encodedApiKeyLocation, + envSecretLocations: encodedEnvSecretLocations, orgScopeId, onPremProxyUrl, apiKey: undefined, @@ -158,6 +179,7 @@ export function useProxyForUnrenderedSecrets( /** The additional properties that are added to the otherwise OpenAI-compatible body when requesting a Continue proxy */ export const continuePropertiesSchema = z.object({ apiKeyLocation: z.string().optional(), + envSecretLocations: z.record(z.string(), z.string()).optional(), apiBase: z.string().optional(), orgScopeId: z.string().nullable(), env: z.record(z.string(), z.any()).optional(), diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 99d324ac2..96d295994 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -154,7 +154,8 @@ export const modelSchema = z.union([ z.object({ ...baseModelFields, provider: z.literal("continue-proxy"), - apiKeyLocation: z.string(), + apiKeyLocation: z.string().optional(), + envSecretLocations: z.record(z.string(), z.string()).optional(), orgScopeId: z.string().nullable(), onPremProxyUrl: z.string().nullable(), }), @@ -169,7 +170,8 @@ export const partialModelSchema = z.union([ .object({ ...baseModelFields, provider: z.literal("continue-proxy"), - apiKeyLocation: z.string(), + apiKeyLocation: z.string().optional(), + envSecretLocations: z.record(z.string(), z.string()).optional(), }) .partial(), z diff --git a/packages/continue-sdk/typescript/src/createOpenAIClient.ts b/packages/continue-sdk/typescript/src/createOpenAIClient.ts index cd3cd0ce5..d63e706ee 100644 --- a/packages/continue-sdk/typescript/src/createOpenAIClient.ts +++ b/packages/continue-sdk/typescript/src/createOpenAIClient.ts @@ -79,6 +79,7 @@ export function createOpenAIClient({ const continueProperties: ContinueProperties = { apiKeyLocation: modelConfig.apiKeyLocation, + envSecretLocations: modelConfig.envSecretLocations, orgScopeId: organizationId ?? null, }; From ed3217aaffc4613cc03a489b39623565a8c2420c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 19:53:50 -0700 Subject: [PATCH 29/75] remove extraneous bedrock load errors, don't force bedrock openai adapter --- core/llm/llms/Bedrock.ts | 2 -- packages/openai-adapters/src/apis/Bedrock.ts | 8 -------- 2 files changed, 10 deletions(-) diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 21dda2288..11d772b7b 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -21,7 +21,6 @@ import { import { safeParseToolCallArgs } from "../../tools/parseArgs.js"; import { renderChatMessage, stripImages } from "../../util/messageContent.js"; import { BaseLLM } from "../index.js"; -import { LlmApiRequestType } from "../openaiTypeConverters.js"; import { PROVIDER_TOOL_SUPPORT } from "../toolSupport.js"; import { getSecureID } from "../utils/getSecureID.js"; @@ -48,7 +47,6 @@ interface PromptCachingMetrics { } class Bedrock extends BaseLLM { - protected useOpenAIAdapterFor: (LlmApiRequestType | "*")[] = ["*"]; static providerName = "bedrock"; static defaultOptions: Partial = { region: "us-east-1", diff --git a/packages/openai-adapters/src/apis/Bedrock.ts b/packages/openai-adapters/src/apis/Bedrock.ts index 67246aff4..2a580456a 100644 --- a/packages/openai-adapters/src/apis/Bedrock.ts +++ b/packages/openai-adapters/src/apis/Bedrock.ts @@ -60,10 +60,6 @@ export class BedrockApi implements BaseLlmApi { private _currentToolResponse: Partial | null = null; constructor(protected config: BedrockConfig) { - if (!config.env?.region) { - throw new Error("region is required for Bedrock API"); - } - if (config.env?.accessKeyId || config?.env?.secretAccessKey) { if (!config.env?.accessKeyId) { throw new Error( @@ -75,10 +71,6 @@ export class BedrockApi implements BaseLlmApi { "secretAccessKey is required for Bedrock API. Only found accessKeyId", ); } - } else if (!config.env?.profile) { - throw new Error( - "AWS credentials profile not found. Please provide accessKeyId and secretAccessKey or profile", - ); } } From b3ed984e166716a60d7a3b8d7f4c87b74b431b7f Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 19:54:45 -0700 Subject: [PATCH 30/75] add env secret resolution for continue sdk --- packages/continue-sdk/typescript/src/createOpenAIClient.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/continue-sdk/typescript/src/createOpenAIClient.ts b/packages/continue-sdk/typescript/src/createOpenAIClient.ts index d63e706ee..6f693d8c9 100644 --- a/packages/continue-sdk/typescript/src/createOpenAIClient.ts +++ b/packages/continue-sdk/typescript/src/createOpenAIClient.ts @@ -71,9 +71,9 @@ export function createOpenAIClient({ ); } - if (!("apiKeyLocation" in modelConfig)) { + if (!("apiKeyLocation" in modelConfig) && !("envSecretLocations" in modelConfig)) { throw new Error( - `Model ${modelName} does not have an apiKeyLocation defined`, + `Model ${modelName} does not have an apiKeyLocation or envSecretLocations defined`, ); } From d02fa8593597b26441aa759f8e1b36673451253e Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 21:52:56 -0700 Subject: [PATCH 31/75] test: no longer check for context items peek after terminal tool call (we don't show it anymore) --- extensions/vscode/e2e/tests/GUI.test.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index a709266ec..3a540ee48 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -347,7 +347,7 @@ describe("GUI Test", () => { }); describe("Context providers", () => { - it("should successfully use the terminal context provider", async () => { + it.only("should successfully use the terminal context provider", async () => { await GUIActions.selectModelFromDropdown(view, "LAST MESSAGE MOCK LLM"); // Enter just the context provider in the input and send @@ -357,20 +357,6 @@ describe("GUI Test", () => { await messageInput.sendKeys(Key.ENTER); await messageInput.sendKeys(Key.ENTER); - // Open the context items peek - const contextItemsPeek = await GUISelectors.getContextItemsPeek(view); - await contextItemsPeek.click(); - - await TestUtils.waitForSuccess(async () => { - const firstContextItemInPeek = - await GUISelectors.getFirstContextItemsPeekItem(view); - await firstContextItemInPeek.click(); - - // Check that item is there with correct name - const description = await firstContextItemInPeek.getText(); - expect(description).to.include("Terminal"); - }); - // Check that the contents match what we expect (repeated back by the mock LLM) await TestUtils.waitForSuccess(() => { return GUISelectors.getThreadMessageByText( From cfa50c4d6e28e1d751ad42458f1275ef62cc560f Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 21:53:29 -0700 Subject: [PATCH 32/75] chore: bump package.json --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 5cff792dc..cb33e7a31 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.58", + "version": "1.1.59", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 87d0f94171c2c174a06cebba08ce1e3350cc97d5 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 21:57:49 -0700 Subject: [PATCH 33/75] add void to async functions --- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index b59abe665..781a3b633 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -100,11 +100,11 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { this.secretStorage = new SecretStorage(context); // Immediately refresh any existing sessions - this.refreshSessions(); + void this.refreshSessions(); // Set up a regular interval to refresh tokens this._refreshInterval = setInterval(() => { - this.refreshSessions(); + void this.refreshSessions(); }, WorkOsAuthProvider.REFRESH_INTERVAL_MS); } From d6713d88ddc3fee235562b72caa07f708e7aab60 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 8 Jul 2025 10:49:37 +0530 Subject: [PATCH 34/75] review fixes --- .../StyledMarkdownPreview/MermaidBlock.tsx | 65 +++++++++---------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx b/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx index 662d730fe..2846fffe9 100644 --- a/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx +++ b/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx @@ -93,35 +93,33 @@ export default function MermaidDiagram({ code }: { code: string }) { mermaidRenderContainerRef.current.innerHTML = ""; } const diagramId = `mermaid-id-${Math.random().toString(36).substring(2)}`; - mermaid - .parse(code) - .then(() => mermaid.render(diagramId, code)) - .then(({ svg }) => { - if (mermaidRenderContainerRef.current) { - mermaidRenderContainerRef.current.innerHTML = svg; - setError(""); - const panzoom = Panzoom(mermaidRenderContainerRef.current, { - step: MINIMUM_ZOOM_STEP, - }); - zoomInButtonRef.current?.addEventListener("click", () => - panzoom.zoomIn({ step: MINIMUM_ZOOM_STEP * 4 }), - ); - zoomOutButtonRef.current?.addEventListener("click", () => - panzoom.zoomOut({ step: MINIMUM_ZOOM_STEP * 4 }), - ); - resetZoomButtonRef.current?.addEventListener("click", () => - panzoom.reset(), - ); - mermaidRenderContainerRef.current.parentElement?.addEventListener( - "wheel", - (event) => { - if (!event.shiftKey) return; - panzoom.zoomWithWheel(event); - }, - ); - } - }) - .catch((err) => { + void (async () => { + if (!mermaidRenderContainerRef.current) return; + try { + await mermaid.parse(code); + const renderedSVG = await mermaid.render(diagramId, code); + mermaidRenderContainerRef.current.innerHTML = renderedSVG.svg; + setError(""); + const panzoom = Panzoom(mermaidRenderContainerRef.current, { + step: MINIMUM_ZOOM_STEP, + }); + zoomInButtonRef.current?.addEventListener("click", () => + panzoom.zoomIn({ step: MINIMUM_ZOOM_STEP * 4 }), + ); + zoomOutButtonRef.current?.addEventListener("click", () => + panzoom.zoomOut({ step: MINIMUM_ZOOM_STEP * 4 }), + ); + resetZoomButtonRef.current?.addEventListener("click", () => + panzoom.reset(), + ); + mermaidRenderContainerRef.current.parentElement?.addEventListener( + "wheel", + (event) => { + if (!event.shiftKey) return; + panzoom.zoomWithWheel(event); + }, + ); + } catch (err: any) { if (err.message) { setError(err.message); } else { @@ -129,10 +127,9 @@ export default function MermaidDiagram({ code }: { code: string }) { "Unknown error when parsing or rendering the Mermaid diagram.", ); } - }) - .finally(() => { - setIsLoading(false); - }); + } + setIsLoading(false); + })(); }, 500, [code], @@ -141,7 +138,7 @@ export default function MermaidDiagram({ code }: { code: string }) { return ( <> {isLoading && ( -
Generating diagram...
+
Generating diagram...
)} {!!error ? (
{error}
From 6bce891c871c1ea95bdaae9e36e41d406b5e3c08 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 22:52:35 -0700 Subject: [PATCH 35/75] chore: bump openai-adapters to 45 --- packages/openai-adapters/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index c5f98f556..f7c7d3133 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/openai-adapters", - "version": "1.0.44", + "version": "1.0.45", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", From 26cef4e4a1d35106a8e694236f43eadcf4618067 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 22:56:39 -0700 Subject: [PATCH 36/75] chore: config-yaml v96 --- packages/config-yaml/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index aaadfe13a..e0cb53693 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.95", + "version": "1.0.96", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", From ebfb1922f5ee1d20e6546ffdad2c7cc3779957fd Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 22:59:52 -0700 Subject: [PATCH 37/75] fix: always refresh with retries Even if an access token is expired, the refresh token could be valid. They don't expire until much longer --- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index 781a3b633..bdb94129f 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -198,12 +198,9 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { const finalSessions = []; for (const session of sessions) { try { - // For expired tokens, don't use retries - if refresh fails, we drop the session - const refreshMethod = this.jwtIsExpiredOrInvalid(session.accessToken) - ? this._refreshSession.bind(this) // Direct refresh for expired tokens - : this._refreshSessionWithRetry.bind(this); // Retry for valid tokens - - const newSession = await refreshMethod(session.refreshToken); + const newSession = await this._refreshSessionWithRetry( + session.refreshToken, + ); finalSessions.push({ ...session, accessToken: newSession.accessToken, From 1732ee9e8384c378fa259c36483248c1f97ccb3b Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 23:01:11 -0700 Subject: [PATCH 38/75] fix: exponential backoff refresh token fix don't set a limit to the max number of retries in token refresh. they are valid for a very long time --- .../vscode/src/stubs/WorkOsAuthProvider.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index bdb94129f..1cb0bcec3 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -229,7 +229,6 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { private async _refreshSessionWithRetry( refreshToken: string, attempt = 1, - maxAttempts = 3, baseDelay = 1000, ): Promise<{ accessToken: string; @@ -243,26 +242,22 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { if ( error.message?.includes("401") || error.message?.includes("Invalid refresh token") || - error.message?.includes("Unauthorized") || - attempt >= maxAttempts + error.message?.includes("Unauthorized") ) { throw error; } // For network errors or transient server issues, retry with backoff // Calculate exponential backoff delay with jitter - const delay = - baseDelay * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5); + const delay = Math.min( + baseDelay * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5), + 60 * 60 * 1000, // 1 hour in milliseconds + ); // Schedule retry after delay return new Promise((resolve, reject) => { setTimeout(() => { - this._refreshSessionWithRetry( - refreshToken, - attempt + 1, - maxAttempts, - baseDelay, - ) + this._refreshSessionWithRetry(refreshToken, attempt + 1, baseDelay) .then(resolve) .catch(reject); }, delay); @@ -357,7 +352,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { return session; } catch (e) { - window.showErrorMessage(`Sign in failed: ${e}`); + void window.showErrorMessage(`Sign in failed: ${e}`); throw e; } } From 73d44d75c7e968ee9b40fd7a9104daa7741b2116 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 23:26:01 -0700 Subject: [PATCH 39/75] fix: don't spawn infinite exponential backoff loops --- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index 1cb0bcec3..f8914f31e 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -77,6 +77,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { { promise: Promise; cancel: EventEmitter } >(); private _refreshInterval: NodeJS.Timeout | null = null; + private _isRefreshing = false; private static EXPIRATION_TIME_MS = 1000 * 60 * 15; // 15 minutes private static REFRESH_INTERVAL_MS = 1000 * 60 * 10; // 10 minutes @@ -182,10 +183,18 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { } async refreshSessions() { + // Prevent concurrent refresh operations + if (this._isRefreshing) { + return; + } + try { + this._isRefreshing = true; await this._refreshSessions(); } catch (e) { console.error(`Error refreshing sessions: ${e}`); + } finally { + this._isRefreshing = false; } } @@ -238,7 +247,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { try { return await this._refreshSession(refreshToken); } catch (error: any) { - // Don't retry for auth errors (401 Unauthorized) or if we've reached max attempts + // Don't retry for auth errors if ( error.message?.includes("401") || error.message?.includes("Invalid refresh token") || @@ -251,10 +260,9 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { // Calculate exponential backoff delay with jitter const delay = Math.min( baseDelay * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5), - 60 * 60 * 1000, // 1 hour in milliseconds + 2 * 60 * 1000, // 2 minutes ); - // Schedule retry after delay return new Promise((resolve, reject) => { setTimeout(() => { this._refreshSessionWithRetry(refreshToken, attempt + 1, baseDelay) From 672f782af2bf98fff7e425507907636933536376 Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Fri, 4 Jul 2025 22:35:56 +0200 Subject: [PATCH 40/75] fix: Queue messages sent to Continue binary This is motivated by my latest crash on Windows (from yesterday). I extracted an interface to describe two strategies of sending messages: standard input/output and TCP (for debugging). Now there is a handler that accepts this interface and safely queues messages. With this separation CoreMessenger now has fewer responsibilities. I tried to keep these changes as much local as possible. Using Channel has an additional advantage: we can queue messages directly from AWT. --- .../constants/MessageTypes.kt | 2 +- .../continue/CoreMessenger.kt | 197 ++---------------- .../continue/CoreMessengerManager.kt | 35 ++-- .../continue/process/ContinueBinaryProcess.kt | 61 ++++++ .../continue/process/ContinueProcess.kt | 13 ++ .../process/ContinueProcessHandler.kt | 57 +++++ .../continue/process/ContinueSocketProcess.kt | 16 ++ 7 files changed, 185 insertions(+), 196 deletions(-) create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt index 0d8e071e4..c53b4bc6e 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt @@ -2,7 +2,7 @@ package com.github.continuedev.continueintellijextension.constants class MessageTypes { companion object { - val ideMessageTypes = listOf( + val IDE_MESSAGE_TYPES = listOf( "readRangeInFile", "isTelemetryEnabled", "getUniqueId", diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt index d419e2f7c..8ccb07838 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt @@ -1,51 +1,40 @@ package com.github.continuedev.continueintellijextension.`continue` import com.github.continuedev.continueintellijextension.constants.MessageTypes -import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings +import com.github.continuedev.continueintellijextension.`continue`.process.ContinueBinaryProcess +import com.github.continuedev.continueintellijextension.`continue`.process.ContinueProcessHandler +import com.github.continuedev.continueintellijextension.`continue`.process.ContinueSocketProcess import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import com.github.continuedev.continueintellijextension.services.TelemetryService import com.github.continuedev.continueintellijextension.utils.uuid import com.google.gson.Gson import com.intellij.openapi.components.service import com.intellij.openapi.project.Project -import java.io.* -import java.net.Socket -import java.nio.charset.StandardCharsets -import java.nio.file.Files -import java.nio.file.Paths -import java.nio.file.attribute.PosixFilePermission import kotlinx.coroutines.* class CoreMessenger( private val project: Project, - continueCorePath: String, private val ideProtocolClient: IdeProtocolClient, - val coroutineScope: CoroutineScope + val coroutineScope: CoroutineScope, + private val onExit: () -> Unit ) { - private var writer: Writer? = null - private var reader: BufferedReader? = null - private var process: Process? = null private val gson = Gson() private val responseListeners = mutableMapOf Unit>() - private val useTcp: Boolean = System.getenv("USE_TCP")?.toBoolean() ?: false - - private fun write(message: String) { - try { - writer?.write(message + "\r\n") - writer?.flush() - } catch (e: Exception) { - println("Error writing to Continue core: $e") - } - } + private val process = startContinueProcess() fun request(messageType: String, data: Any?, messageId: String?, onResponse: (Any?) -> Unit) { val id = messageId ?: uuid() - val message = - gson.toJson(mapOf("messageId" to id, "messageType" to messageType, "data" to data)) + val message = gson.toJson(mapOf("messageId" to id, "messageType" to messageType, "data" to data)) responseListeners[id] = onResponse - coroutineScope.launch(Dispatchers.IO) { - write(message) - } + process.write(message) + } + + private fun startContinueProcess(): ContinueProcessHandler { + val isTcp = System.getenv("USE_TCP")?.toBoolean() ?: false + val process = if (isTcp) + ContinueSocketProcess() + else + ContinueBinaryProcess(onExit) + return ContinueProcessHandler(coroutineScope, process, ::handleMessage) } private fun handleMessage(json: String) { @@ -55,13 +44,10 @@ class CoreMessenger( val data = responseMap["data"] // IDE listeners - if (MessageTypes.ideMessageTypes.contains(messageType)) { + if (MessageTypes.IDE_MESSAGE_TYPES.contains(messageType)) { ideProtocolClient.handleMessage(json) { data -> - val message = - gson.toJson( - mapOf("messageId" to messageId, "messageType" to messageType, "data" to data) - ) - write(message) + val message = gson.toJson(mapOf("messageId" to messageId, "messageType" to messageType, "data" to data)) + process.write(message) } } @@ -82,148 +68,7 @@ class CoreMessenger( } } - private fun setPermissions(destination: String) { - val osName = System.getProperty("os.name").toLowerCase() - if (osName.contains("mac") || osName.contains("darwin")) { - ProcessBuilder("xattr", "-dr", "com.apple.quarantine", destination).start().waitFor() - setFilePermissions(destination, "rwxr-xr-x") - } else if (osName.contains("nix") || osName.contains("nux")) { - setFilePermissions(destination, "rwxr-xr-x") - } - } - - private fun setFilePermissions(path: String, posixPermissions: String) { - val perms = HashSet() - if (posixPermissions.contains("r")) perms.add(PosixFilePermission.OWNER_READ) - if (posixPermissions.contains("w")) perms.add(PosixFilePermission.OWNER_WRITE) - if (posixPermissions.contains("x")) perms.add(PosixFilePermission.OWNER_EXECUTE) - Files.setPosixFilePermissions(Paths.get(path), perms) - } - - private val exitCallbacks: MutableList<() -> Unit> = mutableListOf() - - fun onDidExit(callback: () -> Unit) { - exitCallbacks.add(callback) - } - - init { - if (useTcp) { - try { - val socket = Socket("127.0.0.1", 3000) - val writer = PrintWriter(socket.getOutputStream(), true) - this.writer = writer - val reader = BufferedReader(InputStreamReader(socket.getInputStream())) - this.reader = reader - - Thread { - try { - while (true) { - val line = reader.readLine() - if (line != null && line.isNotEmpty()) { - try { - handleMessage(line) - } catch (e: Exception) { - println("Error handling message: $line") - println(e) - } - } else { - Thread.sleep(100) - } - } - } catch (e: IOException) { - e.printStackTrace() - } finally { - try { - reader.close() - writer.close() - } catch (e: IOException) { - e.printStackTrace() - } - } - } - .start() - } catch (e: Exception) { - println("TCP Connection Error: Unable to connect to 127.0.0.1:3000") - println("Reason: ${e.message}") - e.printStackTrace() - } - } else { - // Set proper permissions synchronously - runBlocking(Dispatchers.IO) { - setPermissions(continueCorePath) - } - - // Start the subprocess - val processBuilder = - ProcessBuilder(continueCorePath).directory(File(continueCorePath).parentFile) - process = processBuilder.start() - - val outputStream = process!!.outputStream - val inputStream = process!!.inputStream - - writer = OutputStreamWriter(outputStream, StandardCharsets.UTF_8) - reader = BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8)) - - process!!.onExit().thenRun { - exitCallbacks.forEach { it() } - var err = process?.errorStream?.bufferedReader()?.readText()?.trim() - if (err != null) { - // There are often "⚡️Done in Xms" messages, and we want everything after the last one - val delimiter = "⚡ Done in" - val doneIndex = err.lastIndexOf(delimiter) - if (doneIndex != -1) { - err = err.substring(doneIndex + delimiter.length) - } - } - - println("Core process exited with output: $err") - - // Log the cause of the failure - val telemetryService = service() - telemetryService.capture("jetbrains_core_exit", mapOf("error" to err)) - - // Clean up all resources - writer?.close() - reader?.close() - process?.destroy() - } - - coroutineScope.launch(Dispatchers.IO) { - try { - while (true) { - val line = reader?.readLine() - if (line != null && line.isNotEmpty()) { - try { - handleMessage(line) - } catch (e: Exception) { - println("Error handling message: $line") - println(e) - } - } else { - delay(100) - } - } - } catch (e: IOException) { - e.printStackTrace() - } finally { - try { - reader?.close() - writer?.close() - outputStream.close() - inputStream.close() - process?.destroy() - } catch (e: IOException) { - e.printStackTrace() - } - } - } - } - } - fun killSubProcess() { - process?.isAlive?.let { - exitCallbacks.clear() - process?.destroy() - } + process.close() } } \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt index 7f1272dbf..1259818f6 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt @@ -2,11 +2,11 @@ package com.github.continuedev.continueintellijextension.`continue` import com.github.continuedev.continueintellijextension.services.TelemetryService import com.github.continuedev.continueintellijextension.utils.castNestedOrNull -import com.github.continuedev.continueintellijextension.utils.getContinueBinaryPath import com.github.continuedev.continueintellijextension.utils.getMachineUniqueID import com.intellij.openapi.components.service import com.intellij.openapi.project.Project -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch class CoreMessengerManager( private val project: Project, @@ -19,30 +19,27 @@ class CoreMessengerManager( init { coroutineScope.launch { - val continueBinaryPath = getContinueBinaryPath() - setupCoreMessenger(continueBinaryPath) + setupCoreMessenger() } } - private fun setupCoreMessenger(continueCorePath: String) { + private fun setupCoreMessenger() { try { - coreMessenger = CoreMessenger(project, continueCorePath, ideProtocolClient, coroutineScope) - - coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response -> - val allowAnonymousTelemetry = response.castNestedOrNull("content", "result", "config", "allowAnonymousTelemetry") - - val telemetryService = service() - if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) { - telemetryService.setup(getMachineUniqueID()) - } - } - - // On exit, use exponential backoff to create another CoreMessenger - coreMessenger?.onDidExit { + coreMessenger = CoreMessenger(project, ideProtocolClient, coroutineScope, onExit = { lastBackoffInterval *= 2 println("CoreMessenger exited, retrying in $lastBackoffInterval seconds") Thread.sleep((lastBackoffInterval * 1000).toLong()) - setupCoreMessenger(continueCorePath) + setupCoreMessenger() + }) + + coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response -> + val allowAnonymousTelemetry = + response.castNestedOrNull("content", "result", "config", "allowAnonymousTelemetry") + + val telemetryService = service() + if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) { + telemetryService.setup(getMachineUniqueID()) + } } } catch (err: Throwable) { val telemetryService = service() diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt new file mode 100644 index 000000000..3781283a3 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt @@ -0,0 +1,61 @@ +package com.github.continuedev.continueintellijextension.`continue`.process + +import com.github.continuedev.continueintellijextension.utils.OS +import com.github.continuedev.continueintellijextension.utils.getContinueBinaryPath +import com.github.continuedev.continueintellijextension.utils.getOS +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.runBlocking +import java.io.File +import java.io.InputStream +import java.io.OutputStream +import java.nio.file.Files +import java.nio.file.Paths +import java.nio.file.attribute.PosixFilePermission + +class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess { + + private val process = startBinaryProcess() + override val input: InputStream = process.inputStream + override val output: OutputStream = process.outputStream + + override fun close() = + process.destroy() + + private fun startBinaryProcess(): Process { + val path = getContinueBinaryPath() + runBlocking(Dispatchers.IO) { + setPermissions() + } + return ProcessBuilder(path).directory(File(path).parentFile) + .start() + .apply { onExit().thenRun(onExit) } + } + + private companion object { + + private fun setPermissions() { + val os = getOS() + when (os) { + OS.MAC -> setMacOsPermissions() + OS.WINDOWS -> {} + OS.LINUX -> elevatePermissions() + } + } + + private fun setMacOsPermissions() { + ProcessBuilder("xattr", "-dr", "com.apple.quarantine", getContinueBinaryPath()).start().waitFor() + elevatePermissions() + } + + private fun elevatePermissions() { + val path = getContinueBinaryPath() + val permissions = setOf( + PosixFilePermission.OWNER_READ, + PosixFilePermission.OWNER_WRITE, + PosixFilePermission.OWNER_EXECUTE + ) + Files.setPosixFilePermissions(Paths.get(path), permissions) + } + } + +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt new file mode 100644 index 000000000..94f58f37b --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt @@ -0,0 +1,13 @@ +package com.github.continuedev.continueintellijextension.`continue`.process + +import java.io.InputStream +import java.io.OutputStream + +interface ContinueProcess { + + val input: InputStream + val output: OutputStream + + fun close() + +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt new file mode 100644 index 000000000..f813f90f7 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt @@ -0,0 +1,57 @@ +package com.github.continuedev.continueintellijextension.`continue`.process + +import com.github.continuedev.continueintellijextension.error.ContinueErrorService +import com.intellij.openapi.components.service +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import java.io.BufferedReader +import java.io.InputStreamReader +import java.io.OutputStreamWriter + +class ContinueProcessHandler( + coroutineScope: CoroutineScope, + private val process: ContinueProcess, + handleMessage: (String) -> (Unit) +) { + private val pendingWrites = Channel(Channel.Factory.UNLIMITED) + private val writer = OutputStreamWriter(process.output) + private val reader = BufferedReader(InputStreamReader(process.input)) + + init { + coroutineScope.launch(Dispatchers.IO) { + while (true) { + if (reader.ready()) { + val line = reader.readLine() + if (line.isNotEmpty()) { + try { + handleMessage(line) + } catch (e: Exception) { + service().report(e, "Error handling message: $line") + } + } + } else + delay(100) + } + } + coroutineScope.launch(Dispatchers.IO) { + for (message in pendingWrites) { + writer.write(message) + writer.write("\r\n") + writer.flush() + } + } + } + + fun write(message: String) = + pendingWrites.trySend(message) + + fun close() { + reader.close() + writer.close() + process.close() + } + +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt new file mode 100644 index 000000000..7da67c405 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt @@ -0,0 +1,16 @@ +package com.github.continuedev.continueintellijextension.`continue`.process + +import java.io.InputStream +import java.io.OutputStream +import java.net.Socket + +class ContinueSocketProcess : ContinueProcess { + + private val socket = Socket("127.0.0.1", 3000) + override val input: InputStream = socket.inputStream + override val output: OutputStream = socket.outputStream + + override fun close() = + socket.close() + +} \ No newline at end of file From 48ecd0a92a41a135e752a7c209add6bf999eaec3 Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Mon, 7 Jul 2025 15:47:49 +0200 Subject: [PATCH 41/75] Add tests + better coroutine scope granularity and read/write coroutines can be cancelled --- .../process/ContinueProcessHandler.kt | 31 ++++++------ .../process/ContinueProcessHandlerTest.kt | 49 +++++++++++++++++++ 2 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandlerTest.kt diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt index f813f90f7..8d1e5a1a2 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt @@ -2,41 +2,43 @@ package com.github.continuedev.continueintellijextension.`continue`.process import com.github.continuedev.continueintellijextension.error.ContinueErrorService import com.intellij.openapi.components.service -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch import java.io.BufferedReader +import java.io.IOException import java.io.InputStreamReader import java.io.OutputStreamWriter class ContinueProcessHandler( - coroutineScope: CoroutineScope, + parentScope: CoroutineScope, private val process: ContinueProcess, handleMessage: (String) -> (Unit) ) { - private val pendingWrites = Channel(Channel.Factory.UNLIMITED) + private val innerJob = Job() + private val scope = CoroutineScope(parentScope.coroutineContext + innerJob) + private val pendingWrites = Channel(Channel.UNLIMITED) private val writer = OutputStreamWriter(process.output) private val reader = BufferedReader(InputStreamReader(process.input)) init { - coroutineScope.launch(Dispatchers.IO) { - while (true) { - if (reader.ready()) { + scope.launch(Dispatchers.IO) { + try { + while (isActive) { val line = reader.readLine() - if (line.isNotEmpty()) { + if (line != null && line.isNotEmpty()) { try { handleMessage(line) } catch (e: Exception) { service().report(e, "Error handling message: $line") } - } - } else - delay(100) + } else + delay(100) + } + } catch (e: IOException) { + service().report(e) } } - coroutineScope.launch(Dispatchers.IO) { + scope.launch(Dispatchers.IO) { for (message in pendingWrites) { writer.write(message) writer.write("\r\n") @@ -49,6 +51,7 @@ class ContinueProcessHandler( pendingWrites.trySend(message) fun close() { + innerJob.cancel() reader.close() writer.close() process.close() diff --git a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandlerTest.kt b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandlerTest.kt new file mode 100644 index 000000000..75aa1f0c5 --- /dev/null +++ b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandlerTest.kt @@ -0,0 +1,49 @@ +package com.github.continuedev.continueintellijextension.`continue`.process + +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.joinAll +import kotlinx.coroutines.launch +import kotlinx.coroutines.test.runTest +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.RepeatedTest +import java.io.InputStream +import java.io.OutputStream + +class ContinueProcessHandlerTest { + + @RepeatedTest(5) + fun `test concurrent writes with queue`() = runTest { + val process = StringContinueProcess() + val handler = ContinueProcessHandler(this, process) {} + + (0..100).map { i -> launch(Dispatchers.Default) { handler.write("message number $i") } } + .joinAll() + + handler.close() + + // assert all message lines are present (order not important) + val lines = process.string.split("\r\n").filter { it.isNotBlank() } + for (i in 0..100) + assertTrue(lines.contains("message number $i")) + + // note: this test will fail if the handler writes messages directly to the output stream + // this problem can be easily reproduced by removing the channel from the handler code + } + + class StringContinueProcess : ContinueProcess { + val string = StringBuilder() + override val input: InputStream = InputStream.nullInputStream() + override val output: OutputStream = object : OutputStream() { + override fun write(b: Int) { + string.append(b.toChar()) + } + + override fun write(b: ByteArray, off: Int, len: Int) { + string.append(String(b, off, len)) + } + } + + override fun close() { + } + } +} \ No newline at end of file From 3d1e2fd3e6f3ed131e295621f74571946655e04c Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Mon, 7 Jul 2025 16:01:28 +0200 Subject: [PATCH 42/75] Fix test package --- .../process => unit}/ContinueProcessHandlerTest.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/{continue/process => unit}/ContinueProcessHandlerTest.kt (80%) diff --git a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandlerTest.kt b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt similarity index 80% rename from extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandlerTest.kt rename to extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt index 75aa1f0c5..be99691b9 100644 --- a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandlerTest.kt +++ b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt @@ -1,10 +1,12 @@ -package com.github.continuedev.continueintellijextension.`continue`.process +package com.github.continuedev.continueintellijextension.unit +import com.github.continuedev.continueintellijextension.`continue`.process.ContinueProcess +import com.github.continuedev.continueintellijextension.`continue`.process.ContinueProcessHandler import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.joinAll import kotlinx.coroutines.launch import kotlinx.coroutines.test.runTest -import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.RepeatedTest import java.io.InputStream import java.io.OutputStream @@ -24,7 +26,7 @@ class ContinueProcessHandlerTest { // assert all message lines are present (order not important) val lines = process.string.split("\r\n").filter { it.isNotBlank() } for (i in 0..100) - assertTrue(lines.contains("message number $i")) + Assertions.assertTrue(lines.contains("message number $i")) // note: this test will fail if the handler writes messages directly to the output stream // this problem can be easily reproduced by removing the channel from the handler code From fe1823a5277387d4394f791d5fd61ed372bc62cc Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Mon, 7 Jul 2025 16:27:51 +0200 Subject: [PATCH 43/75] Close streams not on AWT --- .../continue/process/ContinueProcessHandler.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt index 8d1e5a1a2..2123b87b0 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt @@ -52,9 +52,10 @@ class ContinueProcessHandler( fun close() { innerJob.cancel() - reader.close() - writer.close() - process.close() + scope.launch(Dispatchers.IO) { + reader.close() + writer.close() + process.close() + } } - } \ No newline at end of file From 12745e5e76aee21e2b5799dc2cd0cb7642e3d6c7 Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Mon, 7 Jul 2025 17:57:58 +0200 Subject: [PATCH 44/75] Add missing telemetry --- .../continue/process/ContinueBinaryProcess.kt | 24 +++++++++++++++++-- .../continue/process/ContinueProcess.kt | 2 +- .../process/ContinueProcessHandler.kt | 2 +- .../continue/process/ContinueSocketProcess.kt | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt index 3781283a3..eb45cc4da 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt @@ -1,8 +1,10 @@ package com.github.continuedev.continueintellijextension.`continue`.process +import com.github.continuedev.continueintellijextension.services.TelemetryService import com.github.continuedev.continueintellijextension.utils.OS import com.github.continuedev.continueintellijextension.utils.getContinueBinaryPath import com.github.continuedev.continueintellijextension.utils.getOS +import com.intellij.openapi.components.service import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import java.io.File @@ -28,7 +30,25 @@ class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess { } return ProcessBuilder(path).directory(File(path).parentFile) .start() - .apply { onExit().thenRun(onExit) } + .apply { onExit().thenRun(onExit).thenRun { reportErrorTelemetry() } } + } + + + private fun reportErrorTelemetry() { + var err = process.errorStream?.bufferedReader()?.readText()?.trim() + if (err != null) { + // There are often "⚡️Done in Xms" messages, and we want everything after the last one + val delimiter = "⚡ Done in" + val doneIndex = err.lastIndexOf(delimiter) + if (doneIndex != -1) { + err = err.substring(doneIndex + delimiter.length) + } + } + + println("Core process exited with output: $err") + + val telemetryService = service() + telemetryService.capture("jetbrains_core_exit", mapOf("error" to err)) } private companion object { @@ -58,4 +78,4 @@ class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess { } } -} \ No newline at end of file +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt index 94f58f37b..3e80f6bc0 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcess.kt @@ -10,4 +10,4 @@ interface ContinueProcess { fun close() -} \ No newline at end of file +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt index 2123b87b0..68ec83bf6 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt @@ -58,4 +58,4 @@ class ContinueProcessHandler( process.close() } } -} \ No newline at end of file +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt index 7da67c405..343566841 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueSocketProcess.kt @@ -13,4 +13,4 @@ class ContinueSocketProcess : ContinueProcess { override fun close() = socket.close() -} \ No newline at end of file +} From 300e75c226bf3b27f47464c49f936c0da166be3b Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Tue, 8 Jul 2025 14:27:11 +0200 Subject: [PATCH 45/75] Add Restart action --- .../actions/ContinuePluginActions.kt | 6 +++ .../continue/CoreMessengerManager.kt | 50 +++++++++---------- .../src/main/resources/META-INF/plugin.xml | 7 +++ 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt index 863bbec56..c6df8eddd 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt @@ -7,6 +7,12 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.components.service import com.intellij.openapi.fileEditor.FileEditorManager +class RestartContinueProcess : AnAction() { + override fun actionPerformed(e: AnActionEvent) { + val pluginService = getContinuePluginService(e.project) ?: return + pluginService.coreMessengerManager?.restart() + } +} class AcceptDiffAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt index 1259818f6..9d9a2fb15 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt @@ -4,48 +4,44 @@ import com.github.continuedev.continueintellijextension.services.TelemetryServic import com.github.continuedev.continueintellijextension.utils.castNestedOrNull import com.github.continuedev.continueintellijextension.utils.getMachineUniqueID import com.intellij.openapi.components.service +import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch class CoreMessengerManager( private val project: Project, private val ideProtocolClient: IdeProtocolClient, private val coroutineScope: CoroutineScope ) { - - var coreMessenger: CoreMessenger? = null + var coreMessenger: CoreMessenger = createCoreMessenger() private var lastBackoffInterval = 0.5 + private val log = Logger.getInstance(CoreMessengerManager::class.java) init { - coroutineScope.launch { - setupCoreMessenger() + setupAnonymousTelemetry() + } + + fun restart() { + try { + coreMessenger.killSubProcess() + lastBackoffInterval *= 2 + log.warn("Continue process exited, retrying in $lastBackoffInterval seconds") + Thread.sleep((lastBackoffInterval * 1000).toLong()) + coreMessenger = createCoreMessenger() + } catch (e: Exception) { + service().capture("jetbrains_core_start_error", mapOf("error" to e)) } } - private fun setupCoreMessenger() { - try { - coreMessenger = CoreMessenger(project, ideProtocolClient, coroutineScope, onExit = { - lastBackoffInterval *= 2 - println("CoreMessenger exited, retrying in $lastBackoffInterval seconds") - Thread.sleep((lastBackoffInterval * 1000).toLong()) - setupCoreMessenger() - }) + private fun createCoreMessenger() = + CoreMessenger(project, ideProtocolClient, coroutineScope, ::restart) - coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response -> - val allowAnonymousTelemetry = - response.castNestedOrNull("content", "result", "config", "allowAnonymousTelemetry") - - val telemetryService = service() - if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) { - telemetryService.setup(getMachineUniqueID()) - } - } - } catch (err: Throwable) { - val telemetryService = service() - telemetryService.capture("jetbrains_core_start_error", mapOf("error" to err)) - - err.printStackTrace() + private fun setupAnonymousTelemetry() { + coreMessenger.request("config/getSerializedProfileInfo", null, null) { response -> + val allowAnonymousTelemetry = + response.castNestedOrNull("content", "result", "config", "allowAnonymousTelemetry") + if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) + service().setup(getMachineUniqueID()) } } } diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index aa9a81989..a0ec2afe7 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -70,6 +70,13 @@ + + + + From 1b28153c721c3a4931cd288e7a7b875eaefe0842 Mon Sep 17 00:00:00 2001 From: "Vignesh.V" Date: Tue, 8 Jul 2025 18:27:20 +0530 Subject: [PATCH 46/75] feat: add 'uri' for context items for http context provider --- core/context/providers/HttpContextProvider.ts | 4 +++ docs/docs/customize/custom-providers.mdx | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/core/context/providers/HttpContextProvider.ts b/core/context/providers/HttpContextProvider.ts index 7451fd461..5c879e064 100644 --- a/core/context/providers/HttpContextProvider.ts +++ b/core/context/providers/HttpContextProvider.ts @@ -72,6 +72,10 @@ class HttpContextProvider extends BaseContextProvider { description: item.description ?? "HTTP Context Item", content: item.content ?? "", name: item.name ?? this.options.title ?? "HTTP", + uri: { + type: item.uri.type, + value: item.uri.value, + }, }); return Array.isArray(json) diff --git a/docs/docs/customize/custom-providers.mdx b/docs/docs/customize/custom-providers.mdx index 1061ea12a..8ea5b7b7d 100644 --- a/docs/docs/customize/custom-providers.mdx +++ b/docs/docs/customize/custom-providers.mdx @@ -987,6 +987,33 @@ The response 200 OK should be a JSON object with the following structure: "description": "", "content": "" } + +// For response context items with hyperlinks + +[ + { + "name": "", + "description": "", + "content": "", + "uri": { + "type": "file" or "url", + "value": "file:///path/to/file" or "https://example.com", + } + } +] + +// OR + +{ + "name": "", + "description": "", + "content": "", + "uri": { + "type": "file" or "url", + "value": "file:///path/to/file" or "https://example.com", + } +} + ``` ### `@Commits` From ce2c3bf87e17c8539fe029944fdb7452b8040ba3 Mon Sep 17 00:00:00 2001 From: Keerthana Panyam Date: Mon, 7 Jul 2025 13:45:06 -0400 Subject: [PATCH 47/75] =?UTF-8?q?fix:=20prevent=20UI=20freeze=20when=20?= =?UTF-8?q?=E2=8C=98I=20pressed=20without=20active=20editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pressing ⌘I in chat mode to switch to edit mode when no editor is focused previously led to an unrecoverable error state in the secondary sidebar. this commit ensures that ⌘I action does nothing unless an editor is focused, preventing the ui from freezing and allowing normal interaction with the panel. --- .../components/mainInput/Lump/LumpToolbar/EditToolbar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx index b1424ffe4..a07c55c51 100644 --- a/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx +++ b/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx @@ -28,9 +28,11 @@ export function EditToolbar() { Back to {mode.charAt(0).toUpperCase() + mode.slice(1)} - Editing{" "} + Editing:{" "} - {getEditFilenameAndRangeText(codeToEdit)} + {codeToEdit + ? getEditFilenameAndRangeText(codeToEdit) + : "⚠️ No file selected"}
From f50862f3c0397eb5c3bad1f0f2662cba7638cdda Mon Sep 17 00:00:00 2001 From: Keerthana Panyam Date: Tue, 8 Jul 2025 10:03:42 -0400 Subject: [PATCH 48/75] fix: prevent entering edit mode without editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit previously, edit mode was triggered even without an active editor and the existing fallback mechanism failed silently if no active editor was available. this commit ensures that there is a validation check before entering edit mode to ensure codeToEdit exists. It shows a toast message when trying to switch to edit mode using '⌘I'. It also removes the fallback check that occurs after edit mode is already activated. --- .../mainInput/Lump/LumpToolbar/EditToolbar.tsx | 4 +--- gui/src/redux/thunks/edit.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx index a07c55c51..8e36e64cf 100644 --- a/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx +++ b/gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx @@ -30,9 +30,7 @@ export function EditToolbar() { Editing:{" "} - {codeToEdit - ? getEditFilenameAndRangeText(codeToEdit) - : "⚠️ No file selected"} + {getEditFilenameAndRangeText(codeToEdit)} diff --git a/gui/src/redux/thunks/edit.ts b/gui/src/redux/thunks/edit.ts index 806b88fa7..700d49d55 100644 --- a/gui/src/redux/thunks/edit.ts +++ b/gui/src/redux/thunks/edit.ts @@ -133,6 +133,14 @@ export const enterEdit = createAsyncThunk< return; } + if (!state.editModeState.codeToEdit[0]) { + extra.ideMessenger.post("showToast", [ + "info", + "Please open a file to use Edit mode", + ]); + return; + } + dispatch(setMainEditorContentTrigger({})); dispatch(setPreviousModeEditorContent(editorContent)); @@ -148,9 +156,5 @@ export const enterEdit = createAsyncThunk< ); dispatch(setIsInEdit(true)); - - if (!state.editModeState.codeToEdit[0]) { - extra.ideMessenger.post("edit/addCurrentSelection", undefined); - } }, ); From 06a25351a5961f8bf0a11767b1418dc47ab3a93c Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Tue, 8 Jul 2025 16:53:07 +0200 Subject: [PATCH 49/75] fix: restart on background --- .../continue/CoreMessengerManager.kt | 20 +++++++++++-------- .../unit/ContinueProcessHandlerTest.kt | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt index 9d9a2fb15..3dbf9c2d5 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt @@ -7,6 +7,8 @@ import com.intellij.openapi.components.service import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch class CoreMessengerManager( private val project: Project, @@ -22,14 +24,16 @@ class CoreMessengerManager( } fun restart() { - try { - coreMessenger.killSubProcess() - lastBackoffInterval *= 2 - log.warn("Continue process exited, retrying in $lastBackoffInterval seconds") - Thread.sleep((lastBackoffInterval * 1000).toLong()) - coreMessenger = createCoreMessenger() - } catch (e: Exception) { - service().capture("jetbrains_core_start_error", mapOf("error" to e)) + coroutineScope.launch { + try { + coreMessenger.killSubProcess() + lastBackoffInterval *= 2 + log.warn("Continue process exited, retrying in $lastBackoffInterval seconds") + delay((lastBackoffInterval * 1000).toLong()) + coreMessenger = createCoreMessenger() + } catch (e: Exception) { + service().capture("jetbrains_core_start_error", mapOf("error" to e)) + } } } diff --git a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt index be99691b9..09678ae43 100644 --- a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt +++ b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt @@ -23,7 +23,7 @@ class ContinueProcessHandlerTest { handler.close() - // assert all message lines are present (order not important) + // assert all message lines are present (order is not important) val lines = process.string.split("\r\n").filter { it.isNotBlank() } for (i in 0..100) Assertions.assertTrue(lines.contains("message number $i")) @@ -48,4 +48,4 @@ class ContinueProcessHandlerTest { override fun close() { } } -} \ No newline at end of file +} From 94b9782d72ed0afe2573b8959d926a31727db28c Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 08:28:13 -0700 Subject: [PATCH 50/75] fix: workosauthprovider test --- extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts index 55cac92df..f0a7b746d 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.vitest.ts @@ -641,7 +641,7 @@ it("should preserve valid tokens during network errors by retrying", async () => } }); -it("should remove expired tokens when refresh fails", async () => { +it("should remove expired tokens when refresh fails with a 401 error", async () => { // Mock Date.now to return a time that makes tokens appear expired const originalDateNow = Date.now; const futureTime = Date.now() + 7200000; // 2 hours in the future @@ -675,7 +675,7 @@ it("should remove expired tokens when refresh fails", async () => { global.setInterval = vi.fn().mockReturnValue(123 as any); // Refresh will fail with network error - fetchMock.mockRejectedValueOnce(new Error("Network error")); + fetchMock.mockRejectedValueOnce(new Error("401")); // Setup storage mockSecretStorageGet.mockResolvedValue(JSON.stringify([expiredSession])); From 330fa09aab864cb7aadf9e7045156c78f13b7641 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 8 Jul 2025 21:57:28 +0530 Subject: [PATCH 51/75] fix: autocomplete dev data timestamp as iso string --- core/autocomplete/CompletionProvider.ts | 2 +- core/autocomplete/util/types.ts | 2 +- packages/config-yaml/src/schemas/data/autocomplete/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index 749b44e25..e6111a508 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -254,7 +254,7 @@ export class CompletionProvider { completionId: helper.input.completionId, gitRepo: await this.ide.getRepoName(helper.filepath), uniqueId: await this.ide.getUniqueId(), - timestamp: Date.now(), + timestamp: new Date().toISOString(), ...helper.options, }; diff --git a/core/autocomplete/util/types.ts b/core/autocomplete/util/types.ts index 3959bff9c..bd385fb47 100644 --- a/core/autocomplete/util/types.ts +++ b/core/autocomplete/util/types.ts @@ -41,5 +41,5 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions { gitRepo?: string; completionId: string; uniqueId: string; - timestamp: number; + timestamp: string; } diff --git a/packages/config-yaml/src/schemas/data/autocomplete/index.ts b/packages/config-yaml/src/schemas/data/autocomplete/index.ts index 8ae073e2e..458473c3b 100644 --- a/packages/config-yaml/src/schemas/data/autocomplete/index.ts +++ b/packages/config-yaml/src/schemas/data/autocomplete/index.ts @@ -34,7 +34,7 @@ export const autocompleteEventAllSchema = baseDevDataAllSchema.extend({ gitRepo: z.string().optional(), completionId: z.string(), uniqueId: z.string(), - timestamp: z.number(), + timestamp: z.string(), // DEPRECATED - no more nested objects after v0.1.0, all flat values completionOptions: completionOptionsSchema.optional(), From 9a15213f63d4da546fa5c9be593144c5ae6d0d84 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 8 Jul 2025 09:35:13 -0700 Subject: [PATCH 52/75] fix: use correct styling on truncate btn --- .../ToolCallDiv/ToolTruncateHistoryIcon.tsx | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx index 12000042d..804dd2918 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx @@ -2,8 +2,8 @@ import { BarsArrowUpIcon } from "@heroicons/react/24/outline"; import { chatMessageIsEmpty } from "core/llm/messages"; import { findLastIndex } from "core/util/findLast"; import { useMemo } from "react"; +import { ToolTip } from "../../../components/gui/Tooltip"; import { useMainEditor } from "../../../components/mainInput/TipTapEditor"; -import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip"; import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; import { truncateHistoryToMessage } from "../../../redux/slices/sessionSlice"; @@ -19,27 +19,38 @@ export function ToolTruncateHistoryIcon({ }, [history]); const dispatch = useAppDispatch(); const { mainEditor } = useMainEditor(); + + const truncateTooltipId = useMemo(() => { + return "truncate-hover-" + historyIndex; + }, [historyIndex]); + if (historyIndex === lastMessageIndex) { return null; } + return ( - { - if (isStreaming) { - return; - } - dispatch( - truncateHistoryToMessage({ - index: historyIndex, - }), - ); - mainEditor?.commands.focus(); - }} - > - - + <> +
{ + e.stopPropagation(); + if (isStreaming) { + return; + } + dispatch( + truncateHistoryToMessage({ + index: historyIndex, + }), + ); + mainEditor?.commands.focus(); + }} + className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isStreaming ? "cursor-not-allowed opacity-50" : "bg-transparent"}`} + > + +
+ + {isStreaming ? "" : "Trim chat to this message"} + + ); } From 7205639dec58fb874e534d89a171181c2a674254 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 8 Jul 2025 09:38:57 -0700 Subject: [PATCH 53/75] fix: update toolbar btn stylings --- .../ToolbarButtonWithTooltip.tsx | 19 ++++---- .../pages/gui/ToolCallDiv/ToolCallArgs.tsx | 30 ++++-------- .../ToolCallDiv/ToolTruncateHistoryIcon.tsx | 47 ++++++++----------- 3 files changed, 37 insertions(+), 59 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx index 58f05ef0c..f8293cd50 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx @@ -1,6 +1,5 @@ import { ReactNode, useMemo } from "react"; -import { Tooltip } from "react-tooltip"; -import { getFontSize } from "../../../util"; +import { ToolTip } from "../../gui/Tooltip"; interface ToolbarButtonWithTooltipProps { onClick: () => void; @@ -22,20 +21,20 @@ export function ToolbarButtonWithTooltip({ return ( <> - - + + {tooltipContent} - + ); } diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx index 0c5c188e4..c1b1ec0c7 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx @@ -1,6 +1,5 @@ import { CodeBracketIcon } from "@heroicons/react/24/outline"; -import { useMemo } from "react"; -import { ToolTip } from "../../../components/gui/Tooltip"; +import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip"; interface ArgsToggleIconProps { isShowing: boolean; @@ -13,26 +12,15 @@ export const ArgsToggleIcon = ({ setIsShowing, toolCallId, }: ArgsToggleIconProps) => { - const argsTooltipId = useMemo(() => { - return "args-hover-" + toolCallId; - }, [toolCallId]); - return ( - <> -
{ - e.stopPropagation(); - setIsShowing(!isShowing); - }} - className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isShowing ? "bg-description-muted/30" : "bg-transparent"}`} - > - -
- - {isShowing ? "Hide args" : "Show args"} - - + { + setIsShowing(!isShowing); + }} + > + + ); }; diff --git a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx index 804dd2918..d28cd9328 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx @@ -2,8 +2,8 @@ import { BarsArrowUpIcon } from "@heroicons/react/24/outline"; import { chatMessageIsEmpty } from "core/llm/messages"; import { findLastIndex } from "core/util/findLast"; import { useMemo } from "react"; -import { ToolTip } from "../../../components/gui/Tooltip"; import { useMainEditor } from "../../../components/mainInput/TipTapEditor"; +import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip"; import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; import { truncateHistoryToMessage } from "../../../redux/slices/sessionSlice"; @@ -20,37 +20,28 @@ export function ToolTruncateHistoryIcon({ const dispatch = useAppDispatch(); const { mainEditor } = useMainEditor(); - const truncateTooltipId = useMemo(() => { - return "truncate-hover-" + historyIndex; - }, [historyIndex]); - if (historyIndex === lastMessageIndex) { return null; } return ( - <> -
{ - e.stopPropagation(); - if (isStreaming) { - return; - } - dispatch( - truncateHistoryToMessage({ - index: historyIndex, - }), - ); - mainEditor?.commands.focus(); - }} - className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isStreaming ? "cursor-not-allowed opacity-50" : "bg-transparent"}`} - > - -
- - {isStreaming ? "" : "Trim chat to this message"} - - + { + if (isStreaming) { + return; + } + dispatch( + truncateHistoryToMessage({ + index: historyIndex, + }), + ); + mainEditor?.commands.focus(); + }} + > + + ); } From 2e29e79ab1b6a178d50e04adc3d2a6ea58209fe1 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 09:45:53 -0700 Subject: [PATCH 54/75] chore: bump --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 7d5c2a12a..5cff792dc 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.57", + "version": "1.1.58", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From adc27ff10973076154ef154d918ddfd174886bbc Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 10:11:16 -0700 Subject: [PATCH 55/75] chore: remove .only --- extensions/vscode/e2e/tests/GUI.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 3a540ee48..8eae48307 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -347,7 +347,7 @@ describe("GUI Test", () => { }); describe("Context providers", () => { - it.only("should successfully use the terminal context provider", async () => { + it("should successfully use the terminal context provider", async () => { await GUIActions.selectModelFromDropdown(view, "LAST MESSAGE MOCK LLM"); // Enter just the context provider in the input and send From 3dc2711c53282ca0f5cd24d298a2c0e0baaa80ee Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Tue, 8 Jul 2025 10:59:17 -0700 Subject: [PATCH 56/75] fix: :bug: When a terminal command is moved to the background preserve existing output --- .../redux/thunks/moveTerminalProcessToBackground.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gui/src/redux/thunks/moveTerminalProcessToBackground.ts b/gui/src/redux/thunks/moveTerminalProcessToBackground.ts index c3f0a39d0..78a6510a4 100644 --- a/gui/src/redux/thunks/moveTerminalProcessToBackground.ts +++ b/gui/src/redux/thunks/moveTerminalProcessToBackground.ts @@ -10,9 +10,10 @@ import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall"; /** * This thunk is used to move a terminal command to the background - * when the user clicks the "Continue" button in the UI + * when the user clicks the "Move to background" link in the UI * - * It marks the command as visually complete without stopping + * It preserves all existing terminal output, marks the command as + * visually complete, and stops listening to further output from * the already running process */ export const moveTerminalProcessToBackground = createAsyncThunk< @@ -39,6 +40,12 @@ export const moveTerminalProcessToBackground = createAsyncThunk< return; } + // Find existing terminal output to preserve it + const existingOutput = toolCall.output?.find( + (item) => item.name === "Terminal", + ); + const existingContent = existingOutput?.content || ""; + const status = "Command moved to background. Further output will be ignored."; @@ -46,7 +53,7 @@ export const moveTerminalProcessToBackground = createAsyncThunk< { name: "Terminal", description: "Terminal command output", - content: "\n" + status, + content: existingContent + (existingContent ? "\n\n" : "") + status, status: status, }, ]; From f4ce2011fcbca9e12e38c3cade8224f283a80c6c Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Tue, 8 Jul 2025 11:07:11 -0700 Subject: [PATCH 57/75] fix: typo in core/llm/defaultSystemMessages.ts --- core/llm/defaultSystemMessages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/llm/defaultSystemMessages.ts b/core/llm/defaultSystemMessages.ts index a6b3afc6c..b4ecf8e91 100644 --- a/core/llm/defaultSystemMessages.ts +++ b/core/llm/defaultSystemMessages.ts @@ -51,7 +51,7 @@ export const DEFAULT_CHAT_SYSTEM_MESSAGE = `\ You are in chat mode. If the user asks to make changes to files offer that they can use the Apply Button on the code block, or switch to Agent Mode to make the suggested updates automatically. - If needed consisely explain to the user they can switch to agent mode using the Mode Selector dropdown and provide no other details. + If needed concisely explain to the user they can switch to agent mode using the Mode Selector dropdown and provide no other details. ${CODEBLOCK_FORMATTING_INSTRUCTIONS} ${EDIT_CODE_INSTRUCTIONS} From 94cd063fbf05facf5c4b6637896edbbd97bb7816 Mon Sep 17 00:00:00 2001 From: jhpiedrahitao Date: Tue, 8 Jul 2025 13:25:17 -0500 Subject: [PATCH 58/75] update sambanova logo --- gui/public/logos/sambanova.png | Bin 10780 -> 12593 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gui/public/logos/sambanova.png b/gui/public/logos/sambanova.png index 6f95c6a5859e839fd1f3b07ec0613dee73e39ac0..a3016db0b64966c1bd872c4599416e52fcb5f855 100644 GIT binary patch literal 12593 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 literal 10780 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 fod--3J-P+IKv1Z*DZfCqdjeDyH5D4 Date: Mon, 7 Jul 2025 01:24:28 +0100 Subject: [PATCH 59/75] change default mode to agent --- gui/src/redux/slices/sessionSlice.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 8d1ef3e3e..dbf019a22 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -74,7 +74,7 @@ const initialState: SessionState = { id: uuidv4(), streamAborter: new AbortController(), symbols: {}, - mode: "chat", + mode: "agent", isInEdit: false, codeBlockApplyStates: { states: [], From ca0938c6799e143fb6bff9e15331208a1772e201 Mon Sep 17 00:00:00 2001 From: Rohit Khanwani Date: Mon, 7 Jul 2025 01:26:58 +0100 Subject: [PATCH 60/75] change tests to check for agent mode as default --- gui/src/pages/gui/chat-tests/Chat.test.tsx | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gui/src/pages/gui/chat-tests/Chat.test.tsx b/gui/src/pages/gui/chat-tests/Chat.test.tsx index b0164a437..638d3538a 100644 --- a/gui/src/pages/gui/chat-tests/Chat.test.tsx +++ b/gui/src/pages/gui/chat-tests/Chat.test.tsx @@ -15,7 +15,7 @@ test("should render input box", async () => { test("should be able to toggle modes", async () => { await renderWithProviders(); - await getElementByText("Chat"); + await getElementByText("Agent"); // Simulate cmd+. keyboard shortcut to toggle modes act(() => { @@ -27,6 +27,18 @@ test("should be able to toggle modes", async () => { ); }); + // Check that it switched to Chat mode + await getElementByText("Chat"); + + act(() => { + document.dispatchEvent( + new KeyboardEvent("keydown", { + key: ".", + metaKey: true, // cmd key on Mac + }), + ); + }); + // Check that it switched to Plan mode await getElementByText("Plan"); @@ -39,19 +51,7 @@ test("should be able to toggle modes", async () => { ); }); - // Check that it switched to Agent mode await getElementByText("Agent"); - - act(() => { - document.dispatchEvent( - new KeyboardEvent("keydown", { - key: ".", - metaKey: true, // cmd key on Mac - }), - ); - }); - - await getElementByText("Chat"); }); test("should send a message and receive a response", async () => { From ea58b16ee1a91cbe62e6574fd707e634906459bf Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 13:38:04 -0700 Subject: [PATCH 61/75] Add dev data guide and expand editOutcome schema with code fields --- .continue/rules/dev-data-guide.md | 200 ++++++++++++++++++ .../src/schemas/data/editOutcome/v0.2.0.ts | 7 + 2 files changed, 207 insertions(+) create mode 100644 .continue/rules/dev-data-guide.md diff --git a/.continue/rules/dev-data-guide.md b/.continue/rules/dev-data-guide.md new file mode 100644 index 000000000..641ec040d --- /dev/null +++ b/.continue/rules/dev-data-guide.md @@ -0,0 +1,200 @@ +--- +alwaysApply: false +--- + +# Continue Development Data (Dev Data) Guide + +## Overview + +Development data (dev data) captures detailed information about how developers interact with LLM-aided development tools. Unlike basic telemetry, dev data includes lots of details into the complete software development workflow, including code context, user interactions, and development patterns. + +## Core Architecture + +### Primary Implementation Files + +- **`/core/data/log.ts`**: Main `DataLogger` class - singleton for event logging and remote transmission +- **`/packages/config-yaml/src/schemas/data/`**: Schema definitions for all event types + +### Storage Locations + +- **Default storage**: `~/.continue/dev_data/` +- **Event files**: `~/.continue/dev_data/{version}/{eventName}.jsonl` + +## Event Types and Schemas + +### Core Event Types + +1. **`tokensGenerated`**: LLM token usage tracking +2. **`autocomplete`**: Code completion interactions +3. **`chatInteraction`**: Chat-based development assistance +4. **`editInteraction`**: Code editing sessions +5. **`editOutcome`**: Results of edit operations +6. **`nextEditOutcome`**: Next Edit feature outcomes +7. **`chatFeedback`**: User feedback on AI responses +8. **`toolUsage`**: Tool interaction statistics +9. **`quickEdit`**: Quick edit functionality usage + +### Schema Versioning + +- **Version 0.1.0**: Initial schema implementation +- **Version 0.2.0**: Current schema with expanded fields and metadata +- **Schema files**: Located in `/packages/config-yaml/src/schemas/data/` + +### Base Schema Structure + +All events inherit from a base schema (`/packages/config-yaml/src/schemas/data/base.ts`): + +```typescript +{ + eventName: string, + schema: string, + timestamp: string, + userId: string, + userAgent: string, + selectedProfileId: string +} +``` + +## Key Integration Points + +### Autocomplete System + +- **File**: `/core/autocomplete/util/AutocompleteLoggingService.ts` +- **Purpose**: Tracks code completion acceptance/rejection, timing, and cache hits +- **Integration**: Called from autocomplete engine when completions are shown/accepted + +### Chat Interface + +- **Integration**: Chat interactions logged through `DataLogger.logDevData()` +- **Data**: Includes prompts, responses, context, and user feedback +- **Privacy**: Can be configured to exclude code content + +### Edit Features + +- **Files**: `/extensions/vscode/src/extension/EditOutcomeTracker.ts`, `/core/nextEdit/NextEditLoggingService.ts` +- **Purpose**: Track edit suggestions, acceptance rates, and outcomes +- **Integration**: Embedded in edit workflow to capture user decisions + +### LLM Token Tracking + +- **File**: `/core/llm/index.ts` +- **Purpose**: Track token usage across all LLM providers +- **Storage**: SQLite database for efficient querying and reporting + +## Configuration and Customization + +### Configuration Structure + +Dev data is configured through `data` blocks in your Continue config: + +```yaml +data: + - name: "Local Development Data" + destination: "file:///Users/developer/.continue/dev_data" + schema: "0.2.0" + level: "all" + events: ["autocomplete", "chatInteraction", "editOutcome"] + + - name: "Team Analytics" + destination: "https://analytics.yourcompany.com/api/events" + schema: "0.2.0" + level: "noCode" + apiKey: "your-api-key-here" + events: ["tokensGenerated", "toolUsage"] +``` + +### Configuration Options + +- **`destination`**: Where to send data (`file://` for local, `http://`/`https://` for remote) +- **`schema`**: Schema version to use (`"0.1.0"` or `"0.2.0"`) +- **`level`**: Data detail level (`"all"` includes code, `"noCode"` excludes code content) +- **`events`**: Array of event types to collect +- **`apiKey`**: Authentication for remote endpoints + +### Privacy Controls + +- **`"all"` level**: Includes code content (prefixes, suffixes, completions) +- **`"noCode"` level**: Excludes code content, only metadata and metrics +- **Local-first**: Data is always stored locally, remote transmission is optional + +## Making Changes to Dev Data + +### Adding New Event Types + +1. **Create schema**: Add new event schema in `/packages/config-yaml/src/schemas/data/` +2. **Update index**: Add to schema aggregator in `/packages/config-yaml/src/schemas/data/index.ts` +3. **Implement logging**: Add logging calls in relevant service files +4. **Update version**: Consider schema version bump if breaking changes + +### Modifying Existing Events + +1. **Schema changes**: Update schema files in `/packages/config-yaml/src/schemas/data/` +2. **Backward compatibility**: Ensure changes don't break existing data consumers +3. **Version management**: Increment schema version for breaking changes +4. **Test thoroughly**: Validate schema changes with existing data + +### Adding New Logging Points + +1. **Import DataLogger**: `import { DataLogger } from "core/data/log"` +2. **Log events**: Call `DataLogger.getInstance().logDevData(eventName, data)` +3. **Follow patterns**: Use existing logging services as examples +4. **Validate data**: Ensure logged data matches schema requirements + +### Debugging Dev Data Issues + +1. **Check local storage**: Verify files are being created in `~/.continue/dev_data/` +2. **Validate schemas**: Ensure event data matches expected schema format +3. **Review configuration**: Check `data` blocks in Continue config +4. **Test endpoints**: Verify remote endpoints are reachable and accepting data + +## Best Practices + +### When Adding New Events + +- Follow existing naming conventions for event types +- Include sufficient context for analysis without oversharing sensitive data +- Consider privacy implications and respect user configuration levels +- Add appropriate error handling and logging + +### When Modifying Schemas + +- Maintain backward compatibility when possible +- Document schema changes thoroughly +- Consider impact on existing data consumers +- Test with real development data + +### When Integrating Logging + +- Use the singleton pattern: `DataLogger.getInstance()` +- Log events at appropriate points in user workflow +- Respect user privacy settings and configuration +- Handle errors gracefully without disrupting user experience + +## Common Patterns + +### Service-Based Logging + +Most dev data logging follows a service pattern: + +```typescript +export class FeatureLoggingService { + private dataLogger = DataLogger.getInstance(); + + logFeatureUsage(data: FeatureUsageData) { + this.dataLogger.logDevData("featureUsage", data); + } +} +``` + +### Event-Driven Logging + +Events are typically logged at key interaction points: + +```typescript +// When user accepts autocomplete +onAutocompleteAccepted(completion: CompletionData) { + AutocompleteLoggingService.getInstance().logAutocompleteAccepted(completion); +} +``` + +This guide provides the foundation for understanding and working with Continue's dev data system. Always prioritize user privacy and follow established patterns when making changes. \ No newline at end of file diff --git a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts index 88d867fbd..1fdbfb967 100644 --- a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts @@ -15,10 +15,17 @@ export const editOutcomeEventSchema_0_2_0 = editOutcomeEventAllSchema.pick({ modelTitle: true, modelProvider: true, accepted: true, + previousCode: true, + newCode: true, + previousCodeLines: true, + newCodeLines: true, + lineChange: true, }); export const editOutcomeEventSchema_0_2_0_noCode = editOutcomeEventSchema_0_2_0.omit({ prompt: true, completion: true, + previousCode: true, + newCode: true, }); From 1d06c3b75699d65e842bc7335d13ed41c3562619 Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Tue, 8 Jul 2025 16:10:40 -0400 Subject: [PATCH 62/75] Fix: improved Documentation Indexing and Submenu Updates This patch significantly enhances how Continue responds to changes in the documentation configuration, providing a more consistent and user-friendly experience. Previously, Continue's handling of documentation configuration changes could lead to inconsistencies, requiring users to relaunch the application to see updates. This PR addresses these issues by improving the caching, indexing, and display of the documentation. Key Improvements: 1. Submenu items for the documentation now refresh automatically after retrieving the cache from S3. Before this fix, it won't show up in the submenu until we relaunch Continue. 2. The titles and favicons for cached documentation now correctly reflect the values defined in the docs configuration, rather than defaulting to the URL. 3. Deleting or commenting out a documentation entry in the configuration file will now automatically remove it from the submenu, ensuring consistency between the configuration and the displayed options. 4. If only the title or favicon of a document changes, Continue now efficiently updates the metadata in the SQLite database instead of performing a full reindexing. 5. Continue can now catch and apply changes to documentation titles and favicons even when the application is not actively running. Future Considerations: 1. The doc schema in the config-yaml should be updated to include maxDepth and useLocalCrawling parameters if we're planing to keep these parameters. Their values are always undefined now no matter what users set in config file. 2. If we do keep maxDepth and useLocalCrawling, we should consider adding maxDepth and useLocalCrawling to the SQLite metadata. This would allow the SQLite database to serve as a persistent store for each document's parameters, preventing edge cases where changes to the documentation configuration are missed when Continue is inactive. --- core/context/providers/DocsContextProvider.ts | 19 ++-- core/indexing/docs/DocsService.ts | 98 ++++++++++++++++--- 2 files changed, 100 insertions(+), 17 deletions(-) diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index 360e68670..0f87a3f61 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -145,6 +145,11 @@ class DocsContextProvider extends BaseContextProvider { async loadSubmenuItems( args: LoadSubmenuItemsArgs, ): Promise { + const { config } = args; + // This set is used to filter out the docs that is not in docs config but exist in sqlite metadata + const configDocsSet = new Set( + config.docs?.map((doc) => doc.startUrl) || [], + ); // Get docs service const docsService = DocsService.getSingleton(); if (!docsService) { @@ -159,12 +164,14 @@ class DocsContextProvider extends BaseContextProvider { // Get all indexed docs from the database const docs = (await docsService.listMetadata()) ?? []; for (const { startUrl, title, favicon } of docs) { - submenuItems.push({ - title, - id: startUrl, - description: new URL(startUrl).hostname, - icon: favicon, - }); + if (configDocsSet.has(startUrl)) { + submenuItems.push({ + title, + id: startUrl, + description: new URL(startUrl).hostname, + icon: favicon, + }); + } } // Sort alphabetically diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 7ea3d444e..0ccb4804e 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -107,6 +107,17 @@ const siteIndexingConfigsAreEqual = ( ); }; +const siteIndexingConfigsAreEqualExceptTitleAndFavicon = ( + config1: SiteIndexingConfig, + config2: SiteIndexingConfig, +) => { + return ( + config1.startUrl === config2.startUrl && + config1.maxDepth === config2.maxDepth && + config1.useLocalCrawling === config2.useLocalCrawling + ); +}; + /* General process: - On config update: @@ -395,6 +406,21 @@ export default class DocsService { siteIndexingConfig: SiteIndexingConfig, ): Promise { try { + // Set a initial status when retrieving cache + this.handleStatusUpdate({ + type: "docs", + id: startUrl, + embeddingsProviderId: embeddingId, + isReindexing: false, + title: siteIndexingConfig.title, + debugInfo: "Loaded from cache", + icon: siteIndexingConfig.faviconUrl, + url: startUrl, + progress: 0, + description: "Try to retrieve cache", + status: "indexing", + }); + const cacheHit = await this.tryFetchFromCache(startUrl, embeddingId); if (cacheHit) { @@ -429,7 +455,8 @@ export default class DocsService { siteIndexingConfig: SiteIndexingConfig, forceReindex: boolean = false, ): Promise { - const { startUrl, useLocalCrawling, maxDepth } = siteIndexingConfig; + const { startUrl, useLocalCrawling, maxDepth, faviconUrl } = + siteIndexingConfig; // First, if indexing is already in process, don't attempt // This queue is necessary because indexAndAdd is invoked circularly by config edits @@ -685,7 +712,9 @@ export default class DocsService { await this.deleteIndexes(startUrl); } - const favicon = await fetchFavicon(new URL(siteIndexingConfig.startUrl)); + const favicon = + faviconUrl || + (await fetchFavicon(new URL(siteIndexingConfig.startUrl))); if (this.shouldCancel(startUrl, startedWithEmbedder)) { return; @@ -718,10 +747,6 @@ export default class DocsService { void this.ide.showToast("info", `Successfully indexed ${startUrl}`); } - this.messenger?.send("refreshSubmenuItems", { - providers: ["docs"], - }); - removeFromFailedGlobalContext(siteIndexingConfig); } catch (e) { console.error( @@ -766,14 +791,22 @@ export default class DocsService { const siteEmbeddings = JSON.parse(data) as SiteIndexingResults; // Try to get a favicon for the site - const favicon = await fetchFavicon(new URL(startUrl)); + const favicon = + this.statuses.get(startUrl)?.icon || + (await fetchFavicon(new URL(startUrl))); + + // Always try to make the title match what users set in the config + const title = + this.statuses.get(startUrl)?.title || + siteEmbeddings.title || + new URL(startUrl).hostname; // Add the cached embeddings to our database await this.add({ favicon, siteIndexingConfig: { startUrl, - title: siteEmbeddings.title || new URL(startUrl).hostname, + title, }, chunks: siteEmbeddings.chunks, embeddings: siteEmbeddings.chunks.map((c) => c.embedding), @@ -910,6 +943,10 @@ export default class DocsService { ); if (cacheHit) { + // If cache hit, refresh the submenu items for docs + this.messenger?.send("refreshSubmenuItems", { + providers: ["docs"], + }); // If cache hit, retry the search once return await this.retrieveChunks(startUrl, vector, nRetrieve, true); } @@ -987,8 +1024,7 @@ export default class DocsService { const currentStartUrls = currentlyIndexedDocs.map((doc) => doc.startUrl); // Anything found in old config, new config, AND sqlite that doesn't match should be reindexed - // TODO if only favicon and title change, only update, don't embed - // Otherwise anything found in new config that isn't in sqlite should be added/indexed + // Anything found in new config that isn't in sqlite should be added/indexed const addedDocs: SiteIndexingConfig[] = []; const changedDocs: SiteIndexingConfig[] = []; for (const doc of newConfigDocs) { @@ -999,12 +1035,26 @@ export default class DocsService { (d) => d.startUrl === doc.startUrl, ); + // TODO: Changes to the docs config made while Continue isn't running won't be caught if (oldConfigDoc && !siteIndexingConfigsAreEqual(oldConfigDoc, doc)) { - changedDocs.push(doc); + // When only the title or faviconUrl changed, Update the sqlite metadate instead of reindexing + if ( + siteIndexingConfigsAreEqualExceptTitleAndFavicon( + oldConfigDoc, + doc, + ) + ) { + await this.updateMetadataInSqlite(doc); + } else { + changedDocs.push(doc); + } } else { if (forceReindex) { changedDocs.push(doc); } else { + // This is a temperary fix to catch the changes to the docs config that were made when Continue isn't running + // We only update title and faviconUrl here + await this.updateMetadataInSqlite(doc); // if get's here, not changed, no update needed, mark as complete this.handleStatusUpdate({ type: "docs", @@ -1036,6 +1086,10 @@ export default class DocsService { console.error("Error syncing docs index on config update", e); } finally { this.isSyncing = false; + // Refresh the submenu items for docs + this.messenger?.send("refreshSubmenuItems", { + providers: ["docs"], + }); } } @@ -1182,6 +1236,27 @@ export default class DocsService { ); } + private async updateMetadataInSqlite(siteIndexingConfig: SiteIndexingConfig) { + const { startUrl, title, faviconUrl } = siteIndexingConfig; + const favicon = faviconUrl || (await fetchFavicon(new URL(startUrl))); + if (!this.config.selectedModelByRole.embed) { + console.warn( + `Attempting to add metadata for ${startUrl} without embeddings provider specified`, + ); + return; + } + + const db = await this.getOrCreateSqliteDb(); + + await db.run( + `UPDATE ${DocsService.sqlitebTableName} SET title = ?, favicon = ? WHERE startUrl = ? AND embeddingsProviderId = ?`, + title, + favicon, + startUrl, + this.config.selectedModelByRole.embed.embeddingId, + ); + } + private addToConfig(siteIndexingConfig: SiteIndexingConfig) { // Handles the case where a user has manually added the doc to config.json // so it already exists in the file @@ -1286,5 +1361,6 @@ export default class DocsService { this.messenger?.send("refreshSubmenuItems", { providers: ["docs"], }); + this.statuses.delete(startUrl); } } From 094d548954a9b58d067c57d5d585498330ed7e71 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 8 Jul 2025 17:22:18 -0700 Subject: [PATCH 63/75] add apiKey/express mode support for vertex AI --- core/llm/llms/VertexAI.ts | 77 ++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 13 deletions(-) diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index 1a956cf76..b7a5e7ecf 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -28,11 +28,49 @@ class VertexAI extends BaseLLM { console.warn(`Failed to load credentials for Vertex AI: ${e.message}`); }); - private static getDefaultApiBaseFrom(options: LLMOptions) { - const { region, projectId } = options; + /* + Vertex Supports 3 different URL formats + 1. Express mode: e.g. https://aiplatform.googleapis.com/v1/publishers/google/models/{model}:streamGenerateContent?key={API_KEY} // see https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview + 2. Standard VertexAI: e.g. https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/publishers/google/models/{model}:streamGenerateContent + 3. Tuned model: e.g. https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/endpoints/{endpoint}:streamGenerateContent + + Authentication can be done using the following + 1. API Key (express mode), region and projectId will be ignored + 2. project id and region with Google Auth client + + In all cases we have defined apiBase to be up to everything including the location. + Express api base: https://aiplatform.googleapis.com/v1/ + Standard api base: https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/ + TODO endpoints is not currently supported (api base is same as standard but we don't have a way to add endpoint name yet + + Note that VertexAI uses the term "service endpoint" and "model", like: + {service-endpoint}/v1/{model}:streamGenerateContent + So "model" includes the project, location, publisher, etc + + Express mode has limited support + https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview#models + supported methods: countTokens, generateContent, and streamGenerateContent + supported models: gemini for now (updating quickly) + + */ + private getDefaultApiBaseFrom(options: LLMOptions) { + const { region, projectId, apiKey } = options; + if (apiKey) { + if (this.vertexProvider !== "gemini") { + throw new Error( + "VertexAI: only gemini models are supported in express (apiKey) mode. See https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview#models", + ); + } + if (region || projectId) { + console.warn( + "Region and projectId are ignored when using apiKey. See VertexAI Express Mode docs https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview", + ); + } + return `https://aiplatform.googleapis.com/v1/`; + } if (!region || !projectId) { throw new Error( - "region and projectId must be defined if apiBase is not provided", + "To authenticate VertexAI, either add your region and projectId, which will Google Cloud credientials, or add an apiKey (express mode)", ); } return `https://${region}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}/`; @@ -47,7 +85,7 @@ class VertexAI extends BaseLLM { ); } super(_options); - this.apiBase ??= VertexAI.getDefaultApiBaseFrom(_options); + this.apiBase ??= this.getDefaultApiBaseFrom(_options); this.vertexProvider = _options.model.includes("mistral") || _options.model.includes("codestral") || @@ -62,20 +100,27 @@ class VertexAI extends BaseLLM { this.geminiInstance = new Gemini(_options); } - async fetch(url: RequestInfo | URL, init?: RequestInit) { - const client = await this.clientPromise; - const result = await client?.getAccessToken(); - if (!result?.token) { - throw new Error( - "Could not get an access token. Set up your Google Application Default Credentials.", - ); + async fetch(url: URL, init?: RequestInit) { + const headers: Record = { + "Content-Type": "application/json", + }; + if (this.apiKey) { + url.searchParams.set("key", this.apiKey); + } else { + const client = await this.clientPromise; + const result = await client?.getAccessToken(); + if (!result?.token) { + throw new Error( + "Could not get an access token. Set up your Google Application Default Credentials.", + ); + } + headers.Authorization = `Bearer ${result.token}`; } return await super.fetch(url, { ...init, headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${result.token}`, ...init?.headers, + ...headers, }, }); } @@ -85,6 +130,10 @@ class VertexAI extends BaseLLM { const convertedArgs = this.anthropicInstance.convertArgs(options); // Remove the `model` property and add `anthropic_version` + // For claude 4 models + // anthropic_version is a required parameter and must be set to "vertex-2024-10-22". + + // const const { model, ...finalOptions } = convertedArgs; return { ...finalOptions, @@ -104,6 +153,8 @@ class VertexAI extends BaseLLM { this.cacheBehavior?.cacheSystemMessage && systemMessage ); + // /v1/publishers/anthropic/models/claude-3-5-sonnet-20240620:streamRawPredict + const apiURL = new URL( `publishers/anthropic/models/${options.model}:streamRawPredict`, this.apiBase, From 16755afc426c83cca57a210ede3df8aa0bf33c73 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 8 Jul 2025 17:27:04 -0700 Subject: [PATCH 64/75] docs: vertex express mode docs --- core/llm/llms/VertexAI.ts | 2 +- .../model-providers/top-level/vertexai.mdx | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index b7a5e7ecf..27351cf25 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -58,7 +58,7 @@ class VertexAI extends BaseLLM { if (apiKey) { if (this.vertexProvider !== "gemini") { throw new Error( - "VertexAI: only gemini models are supported in express (apiKey) mode. See https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview#models", + "VertexAI: only gemini models are supported in express (apiKey) mode. See https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview#models", ); } if (region || projectId) { diff --git a/docs/docs/customize/model-providers/top-level/vertexai.mdx b/docs/docs/customize/model-providers/top-level/vertexai.mdx index 2863acc31..383e404f1 100644 --- a/docs/docs/customize/model-providers/top-level/vertexai.mdx +++ b/docs/docs/customize/model-providers/top-level/vertexai.mdx @@ -114,3 +114,33 @@ We recommend configuring **text-embedding-004** as your embeddings model. Vertex AI currently does not offer any reranking models. [Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. + +## Express mode + +You can use VertexAI in [express mode](https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview) by only providing an API Key. Only some Gemini models are supported in express mode for now. + + + + ```yaml title="config.yaml" + models: + - name: Gemini 2.5 Flash - VertexAI + provider: vertexai + model: gemini-2.5-flash + apiKey: ${{ secrets.GOOGLE_CLOUD_API_KEY }} + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Gemini 2.5 Flash - VertexAI", + "provider": "vertexai", + "model": "gemini-2.5-flash", + "apiKey": "[YOUR_GOOGLE_CLOUD_API_KEY]", + } + ] + } + ``` + + From 7c39878ed8f0d7f9c60ad41ac62b765c74d1d17c Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 21:37:15 -0700 Subject: [PATCH 65/75] add applied rules to dev data --- core/llm/rules/getSystemMessageWithRules.ts | 4 ++++ gui/src/redux/thunks/streamNormalInput.ts | 5 +++++ .../config-yaml/src/schemas/data/chatInteraction/index.ts | 8 ++++++++ .../src/schemas/data/chatInteraction/v0.2.0.ts | 1 + 4 files changed, 18 insertions(+) diff --git a/core/llm/rules/getSystemMessageWithRules.ts b/core/llm/rules/getSystemMessageWithRules.ts index f017f24fd..39a30e34d 100644 --- a/core/llm/rules/getSystemMessageWithRules.ts +++ b/core/llm/rules/getSystemMessageWithRules.ts @@ -324,6 +324,10 @@ export const getApplicableRules = ( return applicableRules; }; +export function getRuleId(rule: RuleWithSource): string { + return rule.slug ?? rule.ruleFile ?? rule.name ?? rule.source; +} + export const getSystemMessageWithRules = ({ baseSystemMessage, userMessage, diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 37910c105..211f211c8 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -1,6 +1,7 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; import { LLMFullCompletionOptions, ModelDescription, Tool } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; +import { getRuleId } from "core/llm/rules/getSystemMessageWithRules"; import { ToCoreProtocol } from "core/protocol"; import { BuiltInToolNames } from "core/tools/builtIn"; import { selectActiveTools } from "../selectors/selectActiveTools"; @@ -171,6 +172,10 @@ export const streamNormalInput = createAsyncThunk< ...(!!activeTools.length && { tools: activeTools.map((tool) => tool.function.name), }), + rules: appliedRules.map((rule) => ({ + id: getRuleId(rule), + rule: rule.rule, + })), }, }); // else if (state.session.mode === "edit") { diff --git a/packages/config-yaml/src/schemas/data/chatInteraction/index.ts b/packages/config-yaml/src/schemas/data/chatInteraction/index.ts index 91cbbb1e7..f13b630af 100644 --- a/packages/config-yaml/src/schemas/data/chatInteraction/index.ts +++ b/packages/config-yaml/src/schemas/data/chatInteraction/index.ts @@ -8,4 +8,12 @@ export const chatInteractionEventAllSchema = baseDevDataAllSchema.extend({ completion: z.string(), sessionId: z.string(), tools: z.array(z.string()).optional(), + rules: z + .array( + z.object({ + id: z.string(), + rule: z.string(), + }), + ) + .optional(), }); diff --git a/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts b/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts index aec50a223..ce0983a75 100644 --- a/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts @@ -17,6 +17,7 @@ export const chatInteractionEventSchema_0_2_0 = modelProvider: true, sessionId: true, tools: true, + rules: true, }); export const chatInteractionEventSchema_0_2_0_noCode = From 5b17cb5d088641bf94301ee658ab8ec3dead9075 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 8 Jul 2025 23:06:41 -0700 Subject: [PATCH 66/75] vertexai json and keyFile support --- core/llm/llms/VertexAI.ts | 143 +++++++++++++++++++++++++++----------- 1 file changed, 101 insertions(+), 42 deletions(-) diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index 27351cf25..c428b9aa6 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -1,4 +1,4 @@ -import { GoogleAuth } from "google-auth-library"; +import { AuthClient, GoogleAuth, auth } from "google-auth-library"; import { streamResponse, streamSse } from "@continuedev/fetch"; import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js"; @@ -20,62 +20,33 @@ class VertexAI extends BaseLLM { region: "us-central1", }; - private clientPromise = new GoogleAuth({ - scopes: "https://www.googleapis.com/auth/cloud-platform", - }) - .getClient() - .catch((e) => { - console.warn(`Failed to load credentials for Vertex AI: ${e.message}`); - }); + private clientPromise: Promise; /* Vertex Supports 3 different URL formats - 1. Express mode: e.g. https://aiplatform.googleapis.com/v1/publishers/google/models/{model}:streamGenerateContent?key={API_KEY} // see https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview - 2. Standard VertexAI: e.g. https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/publishers/google/models/{model}:streamGenerateContent - 3. Tuned model: e.g. https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/endpoints/{endpoint}:streamGenerateContent + 1. Standard VertexAI: e.g. https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/publishers/google/models/{model}:streamGenerateContent + 2. Tuned model: e.g. https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/endpoints/{endpoint}:streamGenerateContent + 3. Express mode: e.g. https://aiplatform.googleapis.com/v1/publishers/google/models/{model}:streamGenerateContent?key={API_KEY} // see https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview Authentication can be done using the following + 2. Access token obtained using Google Auth client, passed to endpoint that includes full model path with project id and region 1. API Key (express mode), region and projectId will be ignored - 2. project id and region with Google Auth client In all cases we have defined apiBase to be up to everything including the location. - Express api base: https://aiplatform.googleapis.com/v1/ Standard api base: https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/ + Express api base: https://aiplatform.googleapis.com/v1/ TODO endpoints is not currently supported (api base is same as standard but we don't have a way to add endpoint name yet Note that VertexAI uses the term "service endpoint" and "model", like: {service-endpoint}/v1/{model}:streamGenerateContent So "model" includes the project, location, publisher, etc - Express mode has limited support + Express mode has limited support + and CRITICALLY is only available to NEW users who had NOT used cloud services before. + However it is pretty common as gemini becomes more popular. + Only Gemini models are supported for now https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview#models - supported methods: countTokens, generateContent, and streamGenerateContent - supported models: gemini for now (updating quickly) - - */ - private getDefaultApiBaseFrom(options: LLMOptions) { - const { region, projectId, apiKey } = options; - if (apiKey) { - if (this.vertexProvider !== "gemini") { - throw new Error( - "VertexAI: only gemini models are supported in express (apiKey) mode. See https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview#models", - ); - } - if (region || projectId) { - console.warn( - "Region and projectId are ignored when using apiKey. See VertexAI Express Mode docs https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview", - ); - } - return `https://aiplatform.googleapis.com/v1/`; - } - if (!region || !projectId) { - throw new Error( - "To authenticate VertexAI, either add your region and projectId, which will Google Cloud credientials, or add an apiKey (express mode)", - ); - } - return `https://${region}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}/`; - } - + */ constructor(_options: LLMOptions) { if (_options.region !== "us-central1") { // Any region outside of us-central1 has a max batch size of 5. @@ -85,7 +56,7 @@ class VertexAI extends BaseLLM { ); } super(_options); - this.apiBase ??= this.getDefaultApiBaseFrom(_options); + this.vertexProvider = _options.model.includes("mistral") || _options.model.includes("codestral") || @@ -96,6 +67,93 @@ class VertexAI extends BaseLLM { : _options.model.includes("gemini") ? "gemini" : "unknown"; + + // Validate inputs + const { apiKey, region, projectId, env } = _options; + const keyFile = env?.keyFile; + const keyJson = env?.keyJson; + + // Acceptable setup: + // apiKey only + // region and projectId AND (keyFile OR keyJson OR nothing) + + if (apiKey) { + // Consider warning here instead of throwing error + if (region || projectId || keyFile || keyJson) { + throw new Error( + "Vertex in express mode (api key only) cannot be configured with region, projectId, keyFile, or keyJson", + ); + // console.warn( + // "Region, projectId, and key path/file are ignored when apiKey is set. See VertexAI Express Mode docs https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview", + // ); + } + if (this.vertexProvider !== "gemini") { + throw new Error( + "VertexAI: only gemini models are supported in express (apiKey) mode. See https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview#models", + ); + } + } else { + if (region && projectId) { + throw new Error( + "region and projectId are required for VertexAI (when not using express/apiKey mode)", + ); + } + if (keyFile && keyJson) { + throw new Error( + "VertexAI credentials can be configured with either keyFile or keyJson but not both", + ); + } + } + + if (!this.apiBase) { + if (apiKey) { + this.apiBase = `https://aiplatform.googleapis.com/v1/`; + } else { + this.apiBase = `https://${region}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}/`; + } + } + + const scopes = "https://www.googleapis.com/auth/cloud-platform"; + if (keyJson) { + // Loading keys from manually set JSON + if (typeof keyJson !== "string") { + throw new Error("VertexAI: keyJson must be a JSON string"); + } + try { + const parsed = JSON.parse(keyJson); + this.clientPromise = Promise.resolve(auth.fromJSON(parsed)); + } catch (e) { + throw new Error("VertexAI: Failed to parse keyJson"); + } + } else if (keyFile) { + // Loading keys from manually set file path + if (typeof keyFile !== "string") { + throw new Error("VertexAI: keyFile must be a string"); + } + this.clientPromise = new GoogleAuth({ + scopes, + keyFile, + }) + .getClient() + .catch((e) => { + console.warn( + `Failed to load credentials for Vertex AI: ${e.message}`, + ); + }); + } else { + // Loading keys from local credentials or environment variable + this.clientPromise = new GoogleAuth({ + scopes, + }) + .getClient() + .catch((e) => { + console.warn( + `Failed to load credentials for Vertex AI: ${e.message}`, + ); + }); + } + + // Uses instances of other LLMs since underlying functionality is the same this.anthropicInstance = new Anthropic(_options); this.geminiInstance = new Gemini(_options); } @@ -116,6 +174,7 @@ class VertexAI extends BaseLLM { } headers.Authorization = `Bearer ${result.token}`; } + return await super.fetch(url, { ...init, headers: { From 74b1bc9131ff20d207568142d39bfbe64c4a115e Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 23:24:54 -0700 Subject: [PATCH 67/75] Fix build script path in JetBrains release workflow --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 920ed808b..473d04c52 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -168,7 +168,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - name: Build packages (Unix) - run: ./scripts/build-packages.sh + run: ../../scripts/build-packages.sh # npm install core - name: Install core node_modules From 702d60bd8a0cb77369e598549843ec024c067d63 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 8 Jul 2025 23:35:04 -0700 Subject: [PATCH 68/75] Fix build script path in JetBrains release workflow --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 473d04c52..956d249c4 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -168,7 +168,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - name: Build packages (Unix) - run: ../../scripts/build-packages.sh + run: cd ../.. && ./scripts/build-packages.sh # npm install core - name: Install core node_modules From 02678858ea90d839801f3f9c0906bf5400df7553 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 9 Jul 2025 00:48:39 -0700 Subject: [PATCH 69/75] feat: add keyFile and keyJson auth methods for vertexAI --- core/llm/llms/VertexAI.ts | 44 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index c428b9aa6..c3c2c9bf4 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -1,4 +1,4 @@ -import { AuthClient, GoogleAuth, auth } from "google-auth-library"; +import { AuthClient, GoogleAuth, JWT, auth } from "google-auth-library"; import { streamResponse, streamSse } from "@continuedev/fetch"; import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js"; @@ -14,6 +14,7 @@ class VertexAI extends BaseLLM { declare vertexProvider: "mistral" | "anthropic" | "gemini" | "unknown"; declare anthropicInstance: Anthropic; declare geminiInstance: Gemini; + static AUTH_SCOPES = "https://www.googleapis.com/auth/cloud-platform"; static defaultOptions: Partial | undefined = { maxEmbeddingBatchSize: 250, @@ -68,12 +69,12 @@ class VertexAI extends BaseLLM { ? "gemini" : "unknown"; - // Validate inputs + // Set client authentication promise const { apiKey, region, projectId, env } = _options; const keyFile = env?.keyFile; const keyJson = env?.keyJson; - // Acceptable setup: + // Acceptable authentication methods: // apiKey only // region and projectId AND (keyFile OR keyJson OR nothing) @@ -93,7 +94,7 @@ class VertexAI extends BaseLLM { ); } } else { - if (region && projectId) { + if (!region && !projectId) { throw new Error( "region and projectId are required for VertexAI (when not using express/apiKey mode)", ); @@ -105,15 +106,6 @@ class VertexAI extends BaseLLM { } } - if (!this.apiBase) { - if (apiKey) { - this.apiBase = `https://aiplatform.googleapis.com/v1/`; - } else { - this.apiBase = `https://${region}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}/`; - } - } - - const scopes = "https://www.googleapis.com/auth/cloud-platform"; if (keyJson) { // Loading keys from manually set JSON if (typeof keyJson !== "string") { @@ -121,7 +113,17 @@ class VertexAI extends BaseLLM { } try { const parsed = JSON.parse(keyJson); - this.clientPromise = Promise.resolve(auth.fromJSON(parsed)); + if (!parsed?.private_key) { + throw new Error("VertexAI: keyJson must contain a valid private key"); + } + parsed.private_key = parsed.private_key.replace(/\\n/g, "\n"); + const jsonClient = auth.fromJSON(parsed); + if (jsonClient instanceof JWT) { + jsonClient.scopes = [VertexAI.AUTH_SCOPES]; + } else { + throw new Error("VertexAI: keyJson must be a valid JWT"); + } + this.clientPromise = Promise.resolve(jsonClient); } catch (e) { throw new Error("VertexAI: Failed to parse keyJson"); } @@ -131,7 +133,7 @@ class VertexAI extends BaseLLM { throw new Error("VertexAI: keyFile must be a string"); } this.clientPromise = new GoogleAuth({ - scopes, + scopes: VertexAI.AUTH_SCOPES, keyFile, }) .getClient() @@ -143,7 +145,7 @@ class VertexAI extends BaseLLM { } else { // Loading keys from local credentials or environment variable this.clientPromise = new GoogleAuth({ - scopes, + scopes: VertexAI.AUTH_SCOPES, }) .getClient() .catch((e) => { @@ -153,6 +155,16 @@ class VertexAI extends BaseLLM { }); } + // Set api base + if (!this.apiBase) { + if (apiKey) { + // Express mode + this.apiBase = `https://aiplatform.googleapis.com/v1/`; + } else { + this.apiBase = `https://${region}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}/`; + } + } + // Uses instances of other LLMs since underlying functionality is the same this.anthropicInstance = new Anthropic(_options); this.geminiInstance = new Gemini(_options); From d0b8eee0ab8cce5fdeded0cbb43a809101bdd675 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 9 Jul 2025 12:16:12 -0700 Subject: [PATCH 70/75] Update mcp-tools.mdx (#6491) * Update mcp-tools.mdx * Update mcp-tools.mdx --- docs/docs/customization/mcp-tools.mdx | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/docs/docs/customization/mcp-tools.mdx b/docs/docs/customization/mcp-tools.mdx index 098835c59..9b4d35519 100644 --- a/docs/docs/customization/mcp-tools.mdx +++ b/docs/docs/customization/mcp-tools.mdx @@ -19,22 +19,3 @@ Model Context Protocol servers provide specialized functionality: ## Learn More Learn more in the [MCP deep dive](../customize/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. -description: Model Context Protocol servers provide specialized functionality -keywords: [mcp, blocks, model context protocol, integrations, tools] -sidebar_position: 4 - ---- - -Model Context Protocol servers provide specialized functionality: - -- Enable integration with external tools and systems -- Create extensible interfaces for custom capabilities -- Support more complex interactions with your development environment -- Allow partners to contribute specialized functionality -- Database Connectors: Understand schema and data models during development - -![MCP Blocks Overview](/img/mcp-blocks-overview.png) - -## Learn More - -Learn more in the [MCP deep dive](../customize/deep-dives/mcp.mdx), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. From c7cea2ebc81a36c459b9e295afd7aa109fc49ac6 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 9 Jul 2025 14:13:56 -0700 Subject: [PATCH 71/75] prettier format --- .continue/rules/dev-data-guide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.continue/rules/dev-data-guide.md b/.continue/rules/dev-data-guide.md index 641ec040d..7321b93c0 100644 --- a/.continue/rules/dev-data-guide.md +++ b/.continue/rules/dev-data-guide.md @@ -94,7 +94,7 @@ data: schema: "0.2.0" level: "all" events: ["autocomplete", "chatInteraction", "editOutcome"] - + - name: "Team Analytics" destination: "https://analytics.yourcompany.com/api/events" schema: "0.2.0" @@ -179,7 +179,7 @@ Most dev data logging follows a service pattern: ```typescript export class FeatureLoggingService { private dataLogger = DataLogger.getInstance(); - + logFeatureUsage(data: FeatureUsageData) { this.dataLogger.logDevData("featureUsage", data); } @@ -197,4 +197,4 @@ onAutocompleteAccepted(completion: CompletionData) { } ``` -This guide provides the foundation for understanding and working with Continue's dev data system. Always prioritize user privacy and follow established patterns when making changes. \ No newline at end of file +This guide provides the foundation for understanding and working with Continue's dev data system. Always prioritize user privacy and follow established patterns when making changes. From 92d1df24427889ac7dc8d7d055652c526542e2d2 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 9 Jul 2025 14:58:15 -0700 Subject: [PATCH 72/75] Revert "chore: terminate all tasks after debug" --- .vscode/launch.json | 1 - .vscode/tasks.json | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 346714e94..53632f8d2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -19,7 +19,6 @@ "pauseForSourceMap": false, "outFiles": ["${workspaceFolder}/extensions/vscode/out/extension.js"], "preLaunchTask": "vscode-extension:build", - "postDebugTask": "Terminate All Tasks", "env": { // "CONTROL_PLANE_ENV": "local", "CONTINUE_GLOBAL_DIR": "${workspaceFolder}/extensions/.continue-debug" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0ea873978..5b0636368 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -223,19 +223,6 @@ ], "type": "shell", "problemMatcher": [] - }, - { - "label": "Terminate All Tasks", - "command": "${input:terminate}", - "type": "shell" - } - ], - "inputs": [ - { - "id": "terminate", - "type": "command", - "command": "workbench.action.tasks.terminate", - "args": "terminateAll" } ] } From 1527345c712c5e3939eecd9da7a0cf37dc041857 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 9 Jul 2025 15:38:33 -0700 Subject: [PATCH 73/75] handle different arg streaming styles --- core/llm/autodetect.ts | 3 +- gui/src/util/toolCallState.test.ts | 100 +++++++++++++++++++++++++++++ gui/src/util/toolCallState.ts | 21 ++++-- 3 files changed, 117 insertions(+), 7 deletions(-) diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 9a3d37af9..91d14bfdc 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -46,7 +46,8 @@ import { PROVIDER_TOOL_SUPPORT } from "./toolSupport.js"; const PROVIDER_HANDLES_TEMPLATING: string[] = [ "lmstudio", "openai", - "ollama", + "nvidia", + "ollama", "together", "novita", "msty", diff --git a/gui/src/util/toolCallState.test.ts b/gui/src/util/toolCallState.test.ts index 3207b606a..486f26c66 100644 --- a/gui/src/util/toolCallState.test.ts +++ b/gui/src/util/toolCallState.test.ts @@ -479,4 +479,104 @@ describe("addToolCallDeltaToState", () => { ); expect(currentState.parsedArgs).toEqual({ location: "Paris, France" }); }); + + it("should handle arguments streamed in full progressive chunks", () => { + // Test case where model streams args progressively but includes full prefix each time + // e.g. '{"query":"te' -> '{"query":"tes' -> '{"query":"test"}' + const currentState: ToolCallState = { + status: "generating", + toolCall: { + id: "call123", + type: "function", + function: { + name: "searchFiles", + arguments: '{"query":"te', + }, + }, + toolCallId: "call123", + parsedArgs: { query: "te" }, + }; + + const delta: ToolCallDelta = { + function: { + arguments: '{"query":"tes', + }, + }; + + const result = addToolCallDeltaToState(delta, currentState); + expect(result.toolCall.function.arguments).toBe('{"query":"tes'); + expect(result.parsedArgs).toEqual({ query: "tes" }); + + // Continue the streaming + const nextDelta: ToolCallDelta = { + function: { + arguments: '{"query":"test"}', + }, + }; + + const finalResult = addToolCallDeltaToState(nextDelta, result); + expect(finalResult.toolCall.function.arguments).toBe('{"query":"test"}'); + expect(finalResult.parsedArgs).toEqual({ query: "test" }); + }); + + it("should handle when args delta is a superset of current args", () => { + // Test case where model sends a subset of the current arguments + // This can happen in certain LLM implementations + const currentState: ToolCallState = { + status: "generating", + toolCall: { + id: "call123", + type: "function", + function: { + name: "searchFiles", + arguments: '{"query":"test"', + }, + }, + toolCallId: "call123", + parsedArgs: { query: "test" }, + }; + + const delta: ToolCallDelta = { + function: { + arguments: '{"query":"test","limit":10}', + }, + }; + + // The subset should be ignored, keeping the current state + const result = addToolCallDeltaToState(delta, currentState); + expect(result.toolCall.function.arguments).toBe( + '{"query":"test","limit":10}', + ); + expect(result.parsedArgs).toEqual({ query: "test", limit: 10 }); + }); + + it("should handle when args are complete JSON and new deltas arrive", () => { + // When args are already a valid JSON object, new deltas should not modify it + const currentState: ToolCallState = { + status: "generating", + toolCall: { + id: "call123", + type: "function", + function: { + name: "searchFiles", + arguments: '{"query":"test","limit":10}', + }, + }, + toolCallId: "call123", + parsedArgs: { query: "test", limit: 10 }, + }; + + const delta: ToolCallDelta = { + function: { + arguments: ',"sort":"asc"}', + }, + }; + + // The complete JSON should not be modified + const result = addToolCallDeltaToState(delta, currentState); + expect(result.toolCall.function.arguments).toBe( + '{"query":"test","limit":10}', + ); + expect(result.parsedArgs).toEqual({ query: "test", limit: 10 }); + }); }); diff --git a/gui/src/util/toolCallState.ts b/gui/src/util/toolCallState.ts index e42ac6430..dab9b87b4 100644 --- a/gui/src/util/toolCallState.ts +++ b/gui/src/util/toolCallState.ts @@ -34,15 +34,24 @@ export function addToolCallDeltaToState( if (nameDelta.startsWith(currentName)) { // Case where model progresssively streams name but full name each time e.g. "readFi" -> "readFil" -> "readFile" mergedName = nameDelta; - } else if (currentName.startsWith(nameDelta)) { - // Case where model streams in full name each time e.g. readFile -> readFile -> readFile - // do nothing - } else { - // Case where model streams in name in parts e.g. "read" -> "File" + } else if (!currentName.startsWith(nameDelta)) { mergedName = currentName + nameDelta; } - const mergedArgs = currentArgs + argsDelta; + // Similar logic for args, with an extra JSON check + let mergedArgs = currentArgs; + try { + // If args is JSON parseable, it is complete, don't add to it + JSON.parse(currentArgs); + } catch (e) { + if (argsDelta.startsWith(currentArgs)) { + // Case where model progresssively streams args but full args each time e.g. "{"file": "file1"}" -> "{"file": "file1", "line": 1}" + mergedArgs = argsDelta; + } else if (!currentArgs.startsWith(argsDelta)) { + // Case where model streams in args in parts e.g. "{"file": "file1"" -> ", "line": 1}" + mergedArgs = currentArgs + argsDelta; + } + } const [_, parsedArgs] = incrementalParseJson(mergedArgs || "{}"); From eea1b13e403835030067c7ed25abe8f73ba3c26f Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 9 Jul 2025 15:45:54 -0700 Subject: [PATCH 74/75] fix autodetect prettier --- core/llm/autodetect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 91d14bfdc..a220b5dbd 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -47,7 +47,7 @@ const PROVIDER_HANDLES_TEMPLATING: string[] = [ "lmstudio", "openai", "nvidia", - "ollama", + "ollama", "together", "novita", "msty", From 8d71186214fcb4c15b996796c90b6b1035aae21e Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Wed, 9 Jul 2025 21:37:17 -0700 Subject: [PATCH 75/75] docs: return autocomplete setup (#6536) * docs: return autocomplete setup * fix broken links * adds redirects * adds missing files and redirect * fix build --- docs/docs/customize/deep-dives/mcp.mdx | 2 +- .../docs/features/agent/context-selection.mdx | 3 ++ docs/docs/features/agent/how-to-customize.mdx | 27 ++++++++++ docs/docs/features/agent/model-setup.mdx | 14 ++++++ .../autocomplete/context-selection.mdx | 19 +++++++ .../autocomplete/how-to-customize.mdx | 5 ++ .../features/autocomplete/model-setup.mdx | 29 +++++++++++ docs/docs/features/chat/context-selection.mdx | 39 +++++++++++++++ docs/docs/features/chat/how-to-customize.mdx | 7 +++ docs/docs/features/chat/model-setup.mdx | 19 +++++++ docs/docs/features/edit/context-selection.mdx | 11 +++++ docs/docs/features/edit/how-to-customize.mdx | 9 ++++ docs/docs/features/edit/model-setup.mdx | 14 ++++++ docs/docusaurus.config.js | 49 +++++++++++++++++++ 14 files changed, 246 insertions(+), 1 deletion(-) create mode 100644 docs/docs/features/agent/context-selection.mdx create mode 100644 docs/docs/features/agent/how-to-customize.mdx create mode 100644 docs/docs/features/agent/model-setup.mdx create mode 100644 docs/docs/features/autocomplete/context-selection.mdx create mode 100644 docs/docs/features/autocomplete/how-to-customize.mdx create mode 100644 docs/docs/features/autocomplete/model-setup.mdx create mode 100644 docs/docs/features/chat/context-selection.mdx create mode 100644 docs/docs/features/chat/how-to-customize.mdx create mode 100644 docs/docs/features/chat/model-setup.mdx create mode 100644 docs/docs/features/edit/context-selection.mdx create mode 100644 docs/docs/features/edit/how-to-customize.mdx create mode 100644 docs/docs/features/edit/model-setup.mdx diff --git a/docs/docs/customize/deep-dives/mcp.mdx b/docs/docs/customize/deep-dives/mcp.mdx index 589b04798..eb95d66f5 100644 --- a/docs/docs/customize/deep-dives/mcp.mdx +++ b/docs/docs/customize/deep-dives/mcp.mdx @@ -140,7 +140,7 @@ mcpServers: - "@modelcontextprotocol/server-sqlite" - "./database.db" cwd: "/path/to/project" - + - name: Local Project Server command: npm args: diff --git a/docs/docs/features/agent/context-selection.mdx b/docs/docs/features/agent/context-selection.mdx new file mode 100644 index 000000000..57efd4711 --- /dev/null +++ b/docs/docs/features/agent/context-selection.mdx @@ -0,0 +1,3 @@ +You can use the same methods to manually add context as [Chat](/features/chat/context-selection). + +Tool call responses are automatically included as context items. This enables Agent mode to see the result of the previous action and decide what to do next. diff --git a/docs/docs/features/agent/how-to-customize.mdx b/docs/docs/features/agent/how-to-customize.mdx new file mode 100644 index 000000000..a912292d2 --- /dev/null +++ b/docs/docs/features/agent/how-to-customize.mdx @@ -0,0 +1,27 @@ +## Add Rules Blocks + +Adding Rules can be done in your assistant locally or in the Hub. You can explore Rules on the Continue Hub and refer to the [Rules deep dive](/customize/deep-dives/rules) for more details. + +## Add MCP Tools + +You can add MCP servers to your assistant to give Agent access to more tools. Explore [MCP Servers on the Hub](https://hub.continue.dev) and consult the [MCP guide](/customize/deep-dives/mcp) for more details. + +## Tool Policies + +You can adjust the Agent's tool usage behavior to three options: + +- **Ask First (default)**: Request user permission with "Cancel" and "Continue" buttons +- **Automatic**: Automatically call the tool without requesting permission +- **Excluded**: Do not send the tool to the model + +:::warning +Be careful setting tools to "automatic" if their behavior is not read-only. +::: + +To manage tool policies: + +1. Click the tools icon in the input toolbar +2. View and change policies by clicking on the policy text +3. You can also toggle groups of tools on/off + +Tool policies are stored locally per user. diff --git a/docs/docs/features/agent/model-setup.mdx b/docs/docs/features/agent/model-setup.mdx new file mode 100644 index 000000000..c4a30c526 --- /dev/null +++ b/docs/docs/features/agent/model-setup.mdx @@ -0,0 +1,14 @@ +We recommend **Claude 3.5 Sonnet** from Anthropic for the best Agent experience. + +- [Add Claude 3.5 Sonnet to your assistant from the hub](https://hub.continue.dev/anthropic/claude-3-5-sonnet-20241022) +- Get your API key from the [Anthropic console](https://console.anthropic.com/) + +## Other recommended models + +- [Claude Sonnet 4 from Anthropic](https://hub.continue.dev/anthropic) +- [GPT-4o from OpenAI](https://hub.continue.dev/openai/gpt-4o) +- [Gemini 2.0 Pro from Google](https://hub.continue.dev/google/gemini-2.0-pro) + +Agent can be used with models that support tool use through Continue. The best chat models generally support tool use. + +For more information on models, check out [our recommended chat models](/features/chat/model-setup). diff --git a/docs/docs/features/autocomplete/context-selection.mdx b/docs/docs/features/autocomplete/context-selection.mdx new file mode 100644 index 000000000..66cd4694e --- /dev/null +++ b/docs/docs/features/autocomplete/context-selection.mdx @@ -0,0 +1,19 @@ +# Context Selection + +Autocomplete will automatically determine context based on the current cursor position. We use the following techniques to determine what to include in the prompt: + +## File prefix/suffix + +We will always include the code from your file prior to and after the cursor position. + +## Definitions from the Language Server Protocol + +Similar to how you can use cmd/ctrl + click in your editor, we use the same tool (the LSP) to power "go to definition". For example, if you are typing out a function call, we will include the function definition. Or, if you are writing code inside of a method, we will include the type definitions for any parameters or the return type. + +## Imported files + +Because there are often many imports, we can't include all of them. Instead, we look for symbols around your cursor that have matching imports and use that as context. + +## Recent files + +We automatically consider recently opened or edited files and include snippets that are relevant to the current completion. diff --git a/docs/docs/features/autocomplete/how-to-customize.mdx b/docs/docs/features/autocomplete/how-to-customize.mdx new file mode 100644 index 000000000..ddd028933 --- /dev/null +++ b/docs/docs/features/autocomplete/how-to-customize.mdx @@ -0,0 +1,5 @@ +# How to Customize Autocomplete + +Continue offers a handful of settings to customize autocomplete behavior. Visit the [User Settings Page](/customize/settings) to manage these settings. + +For a comprehensive guide on all configuration options and their impacts, see the [Autocomplete deep dive](/customize/deep-dives/autocomplete). diff --git a/docs/docs/features/autocomplete/model-setup.mdx b/docs/docs/features/autocomplete/model-setup.mdx new file mode 100644 index 000000000..9acece878 --- /dev/null +++ b/docs/docs/features/autocomplete/model-setup.mdx @@ -0,0 +1,29 @@ +# Autocomplete Model Setup + +Setting up the right model for autocomplete is crucial for a smooth coding experience. Here are our top recommendations: + +## Recommended Models + +### Hosted-Based (Best Performance) + +For the highest quality autocomplete suggestions, we recommend **[Codestral](https://hub.continue.dev/mistral/codestral)** from Mistral. This model is specifically designed for code completion and offers excellent performance across multiple programming languages. + +**Quick Setup:** + +1. [Add Codestral from the hub](https://hub.continue.dev/mistral/codestral) +2. Get your API key from the [Mistral Platform](https://console.mistral.ai/codestral) +3. Configure it in your Continue settings + +### Local/Offline (Privacy First) + +For a fully local autocomplete experience that doesn't send your code to external servers, we recommend **[Qwen 2.5 Coder 1.5B](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b)** running on Ollama. This model provides good suggestions while keeping your code completely private. + +**Quick Setup:** + +1. Install [Ollama](https://ollama.ai/) +2. [Add Qwen 2.5 Coder from the hub](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b) +3. Configure it in your Continue settings + +## Need Help? + +If you're not seeing any completions or need more detailed configuration options, check out our comprehensive [autocomplete deep dive guide](/customize/deep-dives/autocomplete). diff --git a/docs/docs/features/chat/context-selection.mdx b/docs/docs/features/chat/context-selection.mdx new file mode 100644 index 000000000..04041b689 --- /dev/null +++ b/docs/docs/features/chat/context-selection.mdx @@ -0,0 +1,39 @@ +## Input + +Typing a question or instructions into the input box is the only required context. + +## Highlighted Code + +The highlighted code you've selected by pressing cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains) will be included in your prompt. + +## Active File + +You can include the currently open file as context by pressing opt/alt + enter when you send your request. + +## Specific File + +You can include a specific file in your current workspace by typing '@Files' and selecting the file. + +## Specific Folder + +You can include a folder in your current workspace by typing '@Folder' and selecting the directory. + +## Codebase Search + +You can automatically include relevant files from your codebase by typing '@Codebase'. + +## Documentation Site + +You can include a documentation site as context by typing '@Docs' and selecting the site. + +## Terminal Contents + +You can include the contents of the terminal in your IDE by typing '@Terminal'. + +## Git Diff + +You can include all of the changes you've made to your current branch by typing '@Git Diff'. + +## Other Context + +You can see a full list of built-in context providers [here](/customize/custom-providers) and learn about how to create your own context provider [here](/guides/build-your-own-context-provider). diff --git a/docs/docs/features/chat/how-to-customize.mdx b/docs/docs/features/chat/how-to-customize.mdx new file mode 100644 index 000000000..2692f7837 --- /dev/null +++ b/docs/docs/features/chat/how-to-customize.mdx @@ -0,0 +1,7 @@ +There are a number of different ways to customize Chat: + +- Add a `rules` block to give the model persistent instructions through the system prompt +- Configure `@Codebase` +- Configure `@Docs` +- [Build your own context provider](/guides/build-your-own-context-provider) +- [Create a custom code RAG](/guides/custom-code-rag) diff --git a/docs/docs/features/chat/model-setup.mdx b/docs/docs/features/chat/model-setup.mdx new file mode 100644 index 000000000..2b762ec64 --- /dev/null +++ b/docs/docs/features/chat/model-setup.mdx @@ -0,0 +1,19 @@ +We recommend setting up a model for the best experience. + +## Recommended Models + +Here's our primary model recommendation: + +**Claude 3.5 Sonnet** from Anthropic + +- [Add Claude 3.5 Sonnet to your assistant from the hub](https://hub.continue.dev/anthropic/claude-3-5-sonnet-20241022) +- Get your API key from the [Anthropic console](https://console.anthropic.com/) + +Other top models to consider: + +- [GPT-4o from OpenAI](https://hub.continue.dev/openai/gpt-4o) +- [Grok-2 from xAI](https://hub.continue.dev/xai/grok-2) +- [Gemini 2.0 Flash from Google](https://hub.continue.dev/google/gemini-2.0-flash) +- [Llama 3.1 8b from Meta (local)](https://hub.continue.dev/ollama/llama3.1) + +For more detailed setup instructions, see [here](/getting-started/install#setup-your-first-model). diff --git a/docs/docs/features/edit/context-selection.mdx b/docs/docs/features/edit/context-selection.mdx new file mode 100644 index 000000000..a7c3459c9 --- /dev/null +++ b/docs/docs/features/edit/context-selection.mdx @@ -0,0 +1,11 @@ +## Input + +The input you provide is included in the prompt. + +## Code to Edit + +The **entire contents** of each file (the current file for Jetbrains inline Edit, the `Code to Edit` item for VS Code Edit mode) are included in the prompt for context. The model will only attempt to edit the highlighted/specified ranges. + +## Context Providers + +In VS Code Edit mode, you can use `@` to add context using [Context Providers](/customize/custom-providers), similar to [Chat](/features/chat/context-selection). Some context providers may be disabled in Edit mode. diff --git a/docs/docs/features/edit/how-to-customize.mdx b/docs/docs/features/edit/how-to-customize.mdx new file mode 100644 index 000000000..1375d7b9d --- /dev/null +++ b/docs/docs/features/edit/how-to-customize.mdx @@ -0,0 +1,9 @@ +## Setting active Edit/Apply model + +You can configure particular models from your Assistant to be used for Edit and Apply requests. + +1. Click the 3 dots above the main input +2. Click the cube icon to expand the "Models" section +3. Use the dropdowns to select models for Edit and Apply + +Learn more about the [Edit role](/customize/model-roles/edit) and [Apply role](/customize/model-roles/apply). diff --git a/docs/docs/features/edit/model-setup.mdx b/docs/docs/features/edit/model-setup.mdx new file mode 100644 index 000000000..05160853b --- /dev/null +++ b/docs/docs/features/edit/model-setup.mdx @@ -0,0 +1,14 @@ +By default, Edit uses the same model as Chat. We recommend **Claude 3.5 Sonnet** from Anthropic. + +[Explore other Edit models on the Continue Hub →](https://hub.continue.dev) + +## Apply Model + +We also recommend setting up an Apply model for the best Edit experience. + +**Recommended Apply models:** + +- [Morph v0 Fast Apply](https://hub.continue.dev) +- [Relace Instant Apply](https://hub.continue.dev) + +[Explore other Apply models on the Continue Hub →](https://hub.continue.dev) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index a48bd4707..3e146343d 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -636,6 +636,18 @@ const config = { to: "/features/autocomplete/how-it-works", from: "/autocomplete/how-it-works", }, + { + to: "/features/autocomplete/model-setup", + from: "/autocomplete/model-setup", + }, + { + to: "/features/autocomplete/how-to-customize", + from: "/autocomplete/how-to-customize", + }, + { + to: "/features/autocomplete/context-selection", + from: "/autocomplete/context-selection", + }, { to: "/features/edit/how-it-works", from: "/edit/how-it-works", @@ -656,6 +668,43 @@ const config = { to: "/customize/json-reference", from: ["/json-reference", "/advanced/json-reference"], }, + // New feature page redirects + { + to: "/features/chat/model-setup", + from: "/chat/model-setup", + }, + { + to: "/features/chat/how-to-customize", + from: "/chat/how-to-customize", + }, + { + to: "/features/chat/context-selection", + from: "/chat/context-selection", + }, + { + to: "/features/edit/model-setup", + from: "/edit/model-setup", + }, + { + to: "/features/edit/how-to-customize", + from: "/edit/how-to-customize", + }, + { + to: "/features/edit/context-selection", + from: "/edit/context-selection", + }, + { + to: "/features/agent/model-setup", + from: "/agent/model-setup", + }, + { + to: "/features/agent/how-to-customize", + from: "/agent/how-to-customize", + }, + { + to: "/features/agent/context-selection", + from: "/agent/context-selection", + }, ], }, ],