Changesets · Branches · Tags · Compare
| Changeset | 5cf29b825e2d0d3248ecf88786e4281abb186dde304e9c8f37aebcc3eb398938 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-07-21 21:55 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-21 21:55 -07:00 |
| Parents | 81b34840d2fe, b3aa08a95d3b |
22 files changed
modified core/commands/slash/customSlashCommand.ts +1 −0
| @@ -11,5 +11,6 @@ | ||
| 11 | 11 | description: customCommand.description ?? "", |
| 12 | 12 | prompt: customCommand.prompt, |
| 13 | 13 | source: "json-custom-command", |
| 14 | + promptFile: customCommand.sourceFile, // TODO refactor promptFile to align with sourceFile | |
| 14 | 15 | }; |
| 15 | 16 | } |
modified core/commands/slash/promptBlockSlashCommand.ts +1 −0
| @@ -9,5 +9,6 @@ | ||
| 9 | 9 | description: prompt.description ?? "", |
| 10 | 10 | prompt: prompt.prompt, |
| 11 | 11 | source: "yaml-prompt-block", |
| 12 | + promptFile: prompt.sourceFile, // Align with the sourceFile property | |
| 12 | 13 | }; |
| 13 | 14 | } |
modified core/config/ConfigHandler.ts +7 −2
| @@ -522,7 +522,10 @@ | ||
| 522 | 522 | return config; |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - async openConfigProfile(profileId?: string) { | |
| 525 | + async openConfigProfile( | |
| 526 | + profileId?: string, | |
| 527 | + element?: { sourceFile?: string }, | |
| 528 | + ) { | |
| 526 | 529 | let openProfileId = profileId || this.currentProfile?.profileDescription.id; |
| 527 | 530 | if (!openProfileId) { |
| 528 | 531 | return; |
| @@ -530,8 +533,10 @@ | ||
| 530 | 533 | const profile = this.currentOrg.profiles.find( |
| 531 | 534 | (p) => p.profileDescription.id === openProfileId, |
| 532 | 535 | ); |
| 536 | + | |
| 533 | 537 | if (profile?.profileDescription.profileType === "local") { |
| 534 | - await this.ide.openFile(profile.profileDescription.uri); | |
| 538 | + const configFile = element?.sourceFile ?? profile.profileDescription.uri; | |
| 539 | + await this.ide.openFile(configFile); | |
| 535 | 540 | } else { |
| 536 | 541 | const env = await getControlPlaneEnv(this.ide.getIdeSettings()); |
| 537 | 542 | await this.ide.openUrl(`${env.APP_URL}${openProfileId}`); |
modified core/config/load.ts +1 −0
| @@ -652,6 +652,7 @@ | ||
| 652 | 652 | configurationStatus: llm.getConfigurationStatus(), |
| 653 | 653 | apiKeyLocation: llm.apiKeyLocation, |
| 654 | 654 | envSecretLocations: llm.envSecretLocations, |
| 655 | + sourceFile: llm.sourceFile, | |
| 655 | 656 | }; |
| 656 | 657 | } |
| 657 | 658 |
modified core/config/yaml/loadYaml.ts +3 −0
| @@ -56,6 +56,7 @@ | ||
| 56 | 56 | rule: rule.rule, |
| 57 | 57 | globs: rule.globs, |
| 58 | 58 | name: rule.name, |
| 59 | + ruleFile: rule.sourceFile, | |
| 59 | 60 | }; |
| 60 | 61 | } |
| 61 | 62 | } |
| @@ -237,6 +238,7 @@ | ||
| 237 | 238 | faviconUrl: doc.faviconUrl, |
| 238 | 239 | maxDepth: doc.maxDepth, |
| 239 | 240 | useLocalCrawling: doc.useLocalCrawling, |
| 241 | + sourceFile: doc.sourceFile, | |
| 240 | 242 | })); |
| 241 | 243 | |
| 242 | 244 | config.mcpServers?.forEach((mcpServer) => { |
| @@ -429,6 +431,7 @@ | ||
| 429 | 431 | (config.mcpServers ?? []).map((server) => ({ |
| 430 | 432 | id: server.name, |
| 431 | 433 | name: server.name, |
| 434 | + sourceFile: server.sourceFile, | |
| 432 | 435 | transport: { |
| 433 | 436 | type: "stdio", |
| 434 | 437 | args: [], |
modified core/core.ts +4 −1
| @@ -349,7 +349,10 @@ | ||
| 349 | 349 | }); |
| 350 | 350 | |
| 351 | 351 | on("config/openProfile", async (msg) => { |
| 352 | - await this.configHandler.openConfigProfile(msg.data.profileId); | |
| 352 | + await this.configHandler.openConfigProfile( | |
| 353 | + msg.data.profileId, | |
| 354 | + msg.data?.element, | |
| 355 | + ); | |
| 353 | 356 | }); |
| 354 | 357 | |
| 355 | 358 | on("config/reload", async (msg) => { |
modified core/index.d.ts +7 −0
| @@ -237,6 +237,7 @@ | ||
| 237 | 237 | maxDepth?: number; |
| 238 | 238 | faviconUrl?: string; |
| 239 | 239 | useLocalCrawling?: boolean; |
| 240 | + sourceFile?: string; | |
| 240 | 241 | } |
| 241 | 242 | |
| 242 | 243 | export interface DocsIndexingDetails { |
| @@ -660,6 +661,8 @@ | ||
| 660 | 661 | deploymentId?: string; |
| 661 | 662 | |
| 662 | 663 | env?: Record<string, string | number | boolean>; |
| 664 | + | |
| 665 | + sourceFile?: string; | |
| 663 | 666 | } |
| 664 | 667 | |
| 665 | 668 | type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick< |
| @@ -1037,6 +1040,7 @@ | ||
| 1037 | 1040 | name: string; |
| 1038 | 1041 | prompt: string; |
| 1039 | 1042 | description?: string; |
| 1043 | + sourceFile?: string; | |
| 1040 | 1044 | } |
| 1041 | 1045 | |
| 1042 | 1046 | export interface Prediction { |
| @@ -1154,6 +1158,8 @@ | ||
| 1154 | 1158 | capabilities?: ModelCapability; |
| 1155 | 1159 | roles?: ModelRole[]; |
| 1156 | 1160 | configurationStatus?: LLMConfigurationStatuses; |
| 1161 | + | |
| 1162 | + sourceFile?: string; | |
| 1157 | 1163 | } |
| 1158 | 1164 | |
| 1159 | 1165 | export interface JSONEmbedOptions { |
| @@ -1309,6 +1315,7 @@ | ||
| 1309 | 1315 | tools: MCPTool[]; |
| 1310 | 1316 | resources: MCPResource[]; |
| 1311 | 1317 | resourceTemplates: MCPResourceTemplate[]; |
| 1318 | + sourceFile?: string; | |
| 1312 | 1319 | } |
| 1313 | 1320 | |
| 1314 | 1321 | export interface ContinueUIConfig { |
modified core/llm/index.ts +4 −0
| @@ -187,6 +187,9 @@ | ||
| 187 | 187 | maxEmbeddingChunkSize: number; |
| 188 | 188 | maxEmbeddingBatchSize: number; |
| 189 | 189 | |
| 190 | + //URI to local block defining this LLM | |
| 191 | + sourceFile?: string; | |
| 192 | + | |
| 190 | 193 | private _llmOptions: LLMOptions; |
| 191 | 194 | |
| 192 | 195 | protected openaiAdapter?: BaseLlmApi; |
| @@ -290,6 +293,7 @@ | ||
| 290 | 293 | this.embeddingId = `${this.constructor.name}::${this.model}::${this.maxEmbeddingChunkSize}`; |
| 291 | 294 | |
| 292 | 295 | this.autocompleteOptions = options.autocompleteOptions; |
| 296 | + this.sourceFile = options.sourceFile; | |
| 293 | 297 | } |
| 294 | 298 | |
| 295 | 299 | getConfigurationStatus() { |
modified core/protocol/core.ts +4 −1
| @@ -102,7 +102,10 @@ | ||
| 102 | 102 | ), |
| 103 | 103 | void, |
| 104 | 104 | ]; |
| 105 | - "config/openProfile": [{ profileId: string | undefined }, void]; | |
| 105 | + "config/openProfile": [ | |
| 106 | + { profileId: string | undefined; element?: { sourceFile?: string } }, | |
| 107 | + void, | |
| 108 | + ]; | |
| 106 | 109 | "config/updateSharedConfig": [SharedConfigSchema, SharedConfigSchema]; |
| 107 | 110 | "config/updateSelectedModel": [ |
| 108 | 111 | { |
modified gui/src/components/mainInput/Lump/EditBlockButton.tsx +3 −0
| @@ -13,6 +13,7 @@ | ||
| 13 | 13 | blockType: T; |
| 14 | 14 | block?: NonNullable<ConfigYaml[T]>[number]; |
| 15 | 15 | className?: string; |
| 16 | + sourceFile?: string; | |
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | function isUsesBlock(block: any): block is { uses: string } { |
| @@ -23,6 +24,7 @@ | ||
| 23 | 24 | block, |
| 24 | 25 | blockType, |
| 25 | 26 | className = "", |
| 27 | + sourceFile, | |
| 26 | 28 | }: EditBlockButtonProps<T>) { |
| 27 | 29 | const ideMessenger = useContext(IdeMessengerContext); |
| 28 | 30 | const { selectedProfile } = useAuth(); |
| @@ -37,6 +39,7 @@ | ||
| 37 | 39 | if (selectedProfile?.profileType === "local") { |
| 38 | 40 | ideMessenger.post("config/openProfile", { |
| 39 | 41 | profileId: undefined, |
| 42 | + element: { sourceFile }, | |
| 40 | 43 | }); |
| 41 | 44 | } else if (block && isUsesBlock(block)) { |
| 42 | 45 | openUrl(`${block.uses}/new-version`); |
modified gui/src/components/mainInput/Lump/sections/PromptsSection.tsx +1 −1
| @@ -121,6 +121,7 @@ | ||
| 121 | 121 | } else { |
| 122 | 122 | ideMessenger.post("config/openProfile", { |
| 123 | 123 | profileId: undefined, |
| 124 | + element: { sourceFile: (prompt as any).sourceFile }, | |
| 124 | 125 | }); |
| 125 | 126 | } |
| 126 | 127 | }; |
| @@ -149,7 +150,6 @@ | ||
| 149 | 150 | index = index + 1; |
| 150 | 151 | } |
| 151 | 152 | } |
| 152 | - | |
| 153 | 153 | return promptsWithSlug.sort((a, b) => { |
| 154 | 154 | const aBookmarked = isCommandBookmarked(a.name); |
| 155 | 155 | const bBookmarked = isCommandBookmarked(b.name); |
modified gui/src/components/mainInput/Lump/sections/RulesSection.tsx +1 −0
| @@ -60,6 +60,7 @@ | ||
| 60 | 60 | } else { |
| 61 | 61 | ideMessenger.post("config/openProfile", { |
| 62 | 62 | profileId: undefined, |
| 63 | + element: { sourceFile: (rule as any).sourceFile }, | |
| 63 | 64 | }); |
| 64 | 65 | } |
| 65 | 66 | }; |
modified gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx +5 −1
| @@ -123,7 +123,11 @@ | ||
| 123 | 123 | /> |
| 124 | 124 | )} |
| 125 | 125 | |
| 126 | - <EditBlockButton blockType="docs" block={docFromYaml} /> | |
| 126 | + <EditBlockButton | |
| 127 | + blockType="docs" | |
| 128 | + block={docFromYaml} | |
| 129 | + sourceFile={docConfig.sourceFile} | |
| 130 | + /> | |
| 127 | 131 | |
| 128 | 132 | {["aborted", "complete", "failed"].includes( |
| 129 | 133 | status?.status ?? "", |
modified gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +5 −1
| @@ -132,7 +132,11 @@ | ||
| 132 | 132 | |
| 133 | 133 | {/* Refresh button */} |
| 134 | 134 | <div className="flex items-center gap-2"> |
| 135 | - <EditBlockButton blockType={"mcpServers"} block={serverFromYaml} /> | |
| 135 | + <EditBlockButton | |
| 136 | + blockType={"mcpServers"} | |
| 137 | + block={serverFromYaml} | |
| 138 | + sourceFile={server.sourceFile} | |
| 139 | + /> | |
| 136 | 140 | <div |
| 137 | 141 | className="text-lightgray flex cursor-pointer items-center hover:opacity-80" |
| 138 | 142 | onClick={onRefresh} |
modified gui/src/components/modelSelection/ModelSelect.tsx +3 −2
| @@ -37,6 +37,7 @@ | ||
| 37 | 37 | value: string; |
| 38 | 38 | title: string; |
| 39 | 39 | apiKey?: string; |
| 40 | + sourceFile?: string; | |
| 40 | 41 | } |
| 41 | 42 | |
| 42 | 43 | function modelSelectTitle(model: any): string { |
| @@ -56,8 +57,6 @@ | ||
| 56 | 57 | showMissingApiKeyMsg, |
| 57 | 58 | isSelected, |
| 58 | 59 | }: ModelOptionProps) { |
| 59 | - const ideMessenger = useContext(IdeMessengerContext); | |
| 60 | - | |
| 61 | 60 | function handleOptionClick(e: any) { |
| 62 | 61 | if (showMissingApiKeyMsg) { |
| 63 | 62 | e.preventDefault(); |
| @@ -132,6 +131,7 @@ | ||
| 132 | 131 | value: model.title, |
| 133 | 132 | title: modelSelectTitle(model), |
| 134 | 133 | apiKey: model.apiKey, |
| 134 | + sourceFile: model.sourceFile, | |
| 135 | 135 | }; |
| 136 | 136 | }), |
| 137 | 137 | ); |
| @@ -230,6 +230,7 @@ | ||
| 230 | 230 | onClick={() => |
| 231 | 231 | ideMessenger.post("config/openProfile", { |
| 232 | 232 | profileId: undefined, |
| 233 | + element: { sourceFile: selectedModel?.sourceFile }, | |
| 233 | 234 | }) |
| 234 | 235 | } |
| 235 | 236 | /> |
modified gui/src/pages/config/ModelRoleSelector.tsx +8 −3
| @@ -48,10 +48,13 @@ | ||
| 48 | 48 | onSelect(models.find((m) => m.title === title) ?? null); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - function onClickGear(e: MouseEvent<SVGSVGElement>) { | |
| 51 | + function onClickGear(e: MouseEvent<SVGSVGElement>, model: ModelDescription) { | |
| 52 | 52 | e.stopPropagation(); |
| 53 | 53 | e.preventDefault(); |
| 54 | - ideMessenger.post("config/openProfile", { profileId: undefined }); | |
| 54 | + ideMessenger.post("config/openProfile", { | |
| 55 | + profileId: undefined, | |
| 56 | + element: model, | |
| 57 | + }); | |
| 55 | 58 | } |
| 56 | 59 | |
| 57 | 60 | function handleOptionClick( |
| @@ -169,7 +172,9 @@ | ||
| 169 | 172 | {hoveredIdx === idx && ( |
| 170 | 173 | <Cog6ToothIcon |
| 171 | 174 | className="h-3 w-3 flex-shrink-0" |
| 172 | - onClick={onClickGear} | |
| 175 | + onClick={(e: MouseEvent<SVGSVGElement>) => | |
| 176 | + onClickGear(e, option) | |
| 177 | + } | |
| 173 | 178 | /> |
| 174 | 179 | )} |
| 175 | 180 | {option.title === selectedModel?.title && ( |
modified gui/src/pages/gui/StreamError.tsx +1 −0
| @@ -77,6 +77,7 @@ | ||
| 77 | 77 | onClick={() => { |
| 78 | 78 | ideMessenger.post("config/openProfile", { |
| 79 | 79 | profileId: undefined, |
| 80 | + element: selectedModel ?? undefined, | |
| 80 | 81 | }); |
| 81 | 82 | }} |
| 82 | 83 | > |
modified packages/config-types/src/index.ts +1 −0
| @@ -210,6 +210,7 @@ | ||
| 210 | 210 | maxDepth: z.number().optional(), |
| 211 | 211 | faviconUrl: z.string().optional(), |
| 212 | 212 | useLocalCrawling: z.boolean().optional(), |
| 213 | + sourceFile: z.string().optional(), | |
| 213 | 214 | }); |
| 214 | 215 | |
| 215 | 216 | export const controlPlaneConfigSchema = z.object({ |
modified packages/config-yaml/src/load/unroll.ts +59 −4
| @@ -452,7 +452,15 @@ | ||
| 452 | 452 | registry, |
| 453 | 453 | ); |
| 454 | 454 | |
| 455 | - return { blockType, resolvedBlock, error: null }; | |
| 455 | + return { | |
| 456 | + blockType, | |
| 457 | + resolvedBlock, | |
| 458 | + source: | |
| 459 | + injectBlock.uriType === "file" | |
| 460 | + ? injectBlock.filePath | |
| 461 | + : undefined, | |
| 462 | + error: null, | |
| 463 | + }; | |
| 456 | 464 | } catch (err) { |
| 457 | 465 | let msg = ""; |
| 458 | 466 | if (injectBlock.uriType === "file") { |
| @@ -475,7 +483,11 @@ | ||
| 475 | 483 | |
| 476 | 484 | const injectedResults = await Promise.all(injectedBlockPromises); |
| 477 | 485 | const injectedErrors: ConfigValidationError[] = []; |
| 478 | - const injectedBlocks: { blockType: string; resolvedBlock: any }[] = []; | |
| 486 | + const injectedBlocks: { | |
| 487 | + blockType: string; | |
| 488 | + resolvedBlock: any; | |
| 489 | + source?: string; | |
| 490 | + }[] = []; | |
| 479 | 491 | |
| 480 | 492 | for (const result of injectedResults) { |
| 481 | 493 | if (result.error) { |
| @@ -484,6 +496,7 @@ | ||
| 484 | 496 | injectedBlocks.push({ |
| 485 | 497 | blockType: result.blockType, |
| 486 | 498 | resolvedBlock: result.resolvedBlock, |
| 499 | + source: result.source, | |
| 487 | 500 | }); |
| 488 | 501 | } |
| 489 | 502 | } |
| @@ -521,12 +534,21 @@ | ||
| 521 | 534 | } |
| 522 | 535 | |
| 523 | 536 | // Add injected blocks |
| 524 | - for (const { blockType, resolvedBlock } of injectedResult.injectedBlocks) { | |
| 537 | + for (const { | |
| 538 | + blockType, | |
| 539 | + resolvedBlock, | |
| 540 | + source, | |
| 541 | + } of injectedResult.injectedBlocks) { | |
| 525 | 542 | const key = blockType as BlockType; |
| 526 | 543 | if (!unrolledAssistant[key]) { |
| 527 | 544 | unrolledAssistant[key] = []; |
| 528 | 545 | } |
| 529 | - unrolledAssistant[key]?.push(...((resolvedBlock[blockType] ?? []) as any)); | |
| 546 | + const blocksWithSourceFiles = injectLocalSourceFile( | |
| 547 | + key, | |
| 548 | + resolvedBlock, | |
| 549 | + source, | |
| 550 | + ); | |
| 551 | + unrolledAssistant[key]?.push(...blocksWithSourceFiles); | |
| 530 | 552 | } |
| 531 | 553 | |
| 532 | 554 | const configResult: ConfigResult<AssistantUnrolled> = { |
| @@ -541,6 +563,39 @@ | ||
| 541 | 563 | return configResult; |
| 542 | 564 | } |
| 543 | 565 | |
| 566 | +function injectLocalSourceFile( | |
| 567 | + blockType: BlockType, | |
| 568 | + resolvedBlock: any, | |
| 569 | + source?: string, | |
| 570 | +): (any & { source?: string })[] { | |
| 571 | + const blocks: any[] = resolvedBlock[blockType] ?? []; | |
| 572 | + if (source === undefined) { | |
| 573 | + // If no source is provided, return blocks as is | |
| 574 | + return blocks; | |
| 575 | + } | |
| 576 | + if (blockType === "rules") { | |
| 577 | + // For rules, we need to ensure they are wrapped in an object with a `source | |
| 578 | + return blocks.map((block) => { | |
| 579 | + if (typeof block === "string") { | |
| 580 | + const rule = { | |
| 581 | + sourceFile: source, | |
| 582 | + name: block, | |
| 583 | + rule: block, | |
| 584 | + } as Rule; | |
| 585 | + return rule; | |
| 586 | + } else if (typeof block === "object") { | |
| 587 | + block.sourceFile = source; | |
| 588 | + } | |
| 589 | + return block; | |
| 590 | + }); | |
| 591 | + } | |
| 592 | + // For other block types, we can directly inject the source file | |
| 593 | + return blocks.map((block) => ({ | |
| 594 | + ...block, | |
| 595 | + sourceFile: source, | |
| 596 | + })); | |
| 597 | +} | |
| 598 | + | |
| 544 | 599 | export async function resolveBlock( |
| 545 | 600 | id: PackageIdentifier, |
| 546 | 601 | inputs: Record<string, string> | undefined, |
modified packages/config-yaml/src/markdown/markdownToRule.ts +1 −0
| @@ -112,5 +112,6 @@ | ||
| 112 | 112 | regex: frontmatter.regex, |
| 113 | 113 | description: frontmatter.description, |
| 114 | 114 | alwaysApply: frontmatter.alwaysApply, |
| 115 | + sourceFile: id.uriType === "file" ? id.filePath : undefined, | |
| 115 | 116 | }; |
| 116 | 117 | } |
modified packages/config-yaml/src/schemas/index.ts +4 −0
| @@ -25,6 +25,7 @@ | ||
| 25 | 25 | cwd: z.string().optional(), |
| 26 | 26 | connectionTimeout: z.number().gt(0).optional(), |
| 27 | 27 | requestOptions: requestOptionsSchema.optional(), |
| 28 | + sourceFile: z.string().optional(), | |
| 28 | 29 | }); |
| 29 | 30 | |
| 30 | 31 | export type MCPServer = z.infer<typeof mcpServerSchema>; |
| @@ -33,6 +34,7 @@ | ||
| 33 | 34 | name: z.string(), |
| 34 | 35 | description: z.string().optional(), |
| 35 | 36 | prompt: z.string(), |
| 37 | + sourceFile: z.string().optional(), | |
| 36 | 38 | }); |
| 37 | 39 | |
| 38 | 40 | export type Prompt = z.infer<typeof promptSchema>; |
| @@ -44,6 +46,7 @@ | ||
| 44 | 46 | faviconUrl: z.string().optional(), |
| 45 | 47 | maxDepth: z.number().optional(), |
| 46 | 48 | useLocalCrawling: z.boolean().optional(), |
| 49 | + sourceFile: z.string().optional(), | |
| 47 | 50 | }); |
| 48 | 51 | |
| 49 | 52 | export type DocsConfig = z.infer<typeof docSchema>; |
| @@ -55,6 +58,7 @@ | ||
| 55 | 58 | globs: z.union([z.string(), z.array(z.string())]).optional(), |
| 56 | 59 | regex: z.union([z.string(), z.array(z.string())]).optional(), |
| 57 | 60 | alwaysApply: z.boolean().optional(), |
| 61 | + sourceFile: z.string().optional(), //TODO refactor RuleWithSource.ruleFile to align with sourceFile | |
| 58 | 62 | }); |
| 59 | 63 | const ruleSchema = z.union([z.string(), ruleObjectSchema]); |
| 60 | 64 |
modified packages/config-yaml/src/schemas/models.ts +1 −0
| @@ -163,6 +163,7 @@ | ||
| 163 | 163 | z.object({ |
| 164 | 164 | ...baseModelFields, |
| 165 | 165 | provider: z.string().refine((val) => val !== "continue-proxy"), |
| 166 | + sourceFile: z.string().optional(), | |
| 166 | 167 | }), |
| 167 | 168 | ]); |
| 168 | 169 |