@bastani/atomic 0.9.0-alpha.1 → 0.9.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/builtin/cursor/CHANGELOG.md +6 -0
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +19 -0
- package/dist/builtin/workflows/README.md +189 -122
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +30 -27
- package/dist/builtin/workflows/builtin/goal-ledger.ts +2 -0
- package/dist/builtin/workflows/builtin/goal-reports.ts +5 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +17 -20
- package/dist/builtin/workflows/builtin/goal-types.ts +2 -0
- package/dist/builtin/workflows/builtin/goal.d.ts +1 -0
- package/dist/builtin/workflows/builtin/goal.ts +40 -44
- package/dist/builtin/workflows/builtin/index.d.ts +1 -0
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +16 -17
- package/dist/builtin/workflows/builtin/open-claude-design.d.ts +1 -0
- package/dist/builtin/workflows/builtin/open-claude-design.ts +42 -50
- package/dist/builtin/workflows/builtin/prompt-refinement.ts +102 -0
- package/dist/builtin/workflows/builtin/ralph-core.ts +6 -4
- package/dist/builtin/workflows/builtin/ralph-runner.ts +22 -24
- package/dist/builtin/workflows/builtin/ralph.d.ts +2 -0
- package/dist/builtin/workflows/builtin/ralph.ts +46 -41
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/authoring/typebox-defaults.d.ts +41 -0
- package/dist/builtin/workflows/src/authoring/typebox-defaults.ts +217 -0
- package/dist/builtin/workflows/src/authoring/workflow.ts +184 -0
- package/dist/builtin/workflows/src/authoring.d.ts +14 -66
- package/dist/builtin/workflows/src/engine/graph-inference.ts +100 -0
- package/dist/builtin/workflows/src/engine/options.ts +40 -0
- package/dist/builtin/workflows/src/engine/primitives/chain.ts +29 -0
- package/dist/builtin/workflows/src/engine/primitives/exit.ts +2 -0
- package/dist/builtin/workflows/src/engine/primitives/parallel.ts +47 -0
- package/dist/builtin/workflows/src/engine/primitives/task.ts +108 -0
- package/dist/builtin/workflows/src/engine/primitives/ui.ts +41 -0
- package/dist/builtin/workflows/src/engine/primitives/workflow.ts +159 -0
- package/dist/builtin/workflows/src/engine/replay.ts +8 -0
- package/dist/builtin/workflows/src/engine/run.ts +356 -0
- package/dist/builtin/workflows/src/engine/runtime.ts +160 -0
- package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +9 -3
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +3 -1
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +0 -18
- package/dist/builtin/workflows/src/index.ts +0 -2
- package/dist/builtin/workflows/src/runs/background/runner.ts +6 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +3 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-child-helpers.ts +4 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-child-workflow.ts +1 -158
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-outputs.ts +2 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-run.ts +1 -359
- package/dist/builtin/workflows/src/runs/foreground/executor-scheduler.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +2 -5
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +12 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +4 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +9 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-task-context.ts +2 -132
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +2 -2
- package/dist/builtin/workflows/src/runs/shared/graph-inference.ts +2 -100
- package/dist/builtin/workflows/src/sdk-surface.ts +6 -9
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +9 -3
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +17 -3
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +3 -33
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +9 -81
- package/dist/builtin/workflows/src/shared/types.ts +25 -8
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +49 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +84 -0
- package/dist/builtin/workflows/src/workflows/registry.ts +7 -3
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +6 -1
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +0 -5
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +0 -2
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +0 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +0 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +0 -2
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +0 -2
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +0 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +0 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +1 -1
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts +1 -3
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +13 -6
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts +7 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +34 -2
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +2 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +2 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +0 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-registry-builtins.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.js +6 -0
- package/dist/core/model-registry-builtins.js.map +1 -1
- package/dist/core/model-registry-schemas.d.ts +65 -13
- package/dist/core/model-registry-schemas.d.ts.map +1 -1
- package/dist/core/model-registry-schemas.js +10 -0
- package/dist/core/model-registry-schemas.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +1 -0
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +2 -0
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.js +3 -3
- package/dist/core/resource-loader-extensions.js.map +1 -1
- package/dist/core/resource-loader-internals.d.ts +1 -0
- package/dist/core/resource-loader-internals.d.ts.map +1 -1
- package/dist/core/resource-loader-internals.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +6 -2
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/sdk-exports.d.ts +1 -1
- package/dist/core/sdk-exports.d.ts.map +1 -1
- package/dist/core/sdk-exports.js.map +1 -1
- package/dist/core/sdk-types.d.ts +0 -3
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +0 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +2 -1
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +0 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +0 -5
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +10 -11
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff-preserve.d.ts +18 -0
- package/dist/core/tools/edit-diff-preserve.d.ts.map +1 -0
- package/dist/core/tools/edit-diff-preserve.js +85 -0
- package/dist/core/tools/edit-diff-preserve.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +3 -2
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +15 -18
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/index.d.ts +0 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +0 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/model-search.d.ts +5 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -1
- package/dist/modes/interactive/model-search.js +9 -0
- package/dist/modes/interactive/model-search.js.map +1 -1
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +12 -5
- package/dist/utils/shell.js.map +1 -1
- package/docs/custom-provider.md +4 -3
- package/docs/models.md +3 -2
- package/docs/packages.md +2 -2
- package/docs/quickstart.md +1 -1
- package/docs/sdk.md +2 -40
- package/docs/security.md +1 -1
- package/docs/workflows.md +991 -176
- package/package.json +5 -5
- package/dist/builtin/workflows/src/workflows/define-workflow.ts +0 -277
- package/dist/core/tools/bash-policy-compile.d.ts +0 -5
- package/dist/core/tools/bash-policy-compile.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-compile.js +0 -241
- package/dist/core/tools/bash-policy-compile.js.map +0 -1
- package/dist/core/tools/bash-policy-evaluate.d.ts +0 -3
- package/dist/core/tools/bash-policy-evaluate.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-evaluate.js +0 -92
- package/dist/core/tools/bash-policy-evaluate.js.map +0 -1
- package/dist/core/tools/bash-policy-format.d.ts +0 -5
- package/dist/core/tools/bash-policy-format.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-format.js +0 -49
- package/dist/core/tools/bash-policy-format.js.map +0 -1
- package/dist/core/tools/bash-policy-parser.d.ts +0 -4
- package/dist/core/tools/bash-policy-parser.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-parser.js +0 -155
- package/dist/core/tools/bash-policy-parser.js.map +0 -1
- package/dist/core/tools/bash-policy-segment.d.ts +0 -3
- package/dist/core/tools/bash-policy-segment.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-segment.js +0 -275
- package/dist/core/tools/bash-policy-segment.js.map +0 -1
- package/dist/core/tools/bash-policy-shell.d.ts +0 -11
- package/dist/core/tools/bash-policy-shell.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-shell.js +0 -267
- package/dist/core/tools/bash-policy-shell.js.map +0 -1
- package/dist/core/tools/bash-policy-types.d.ts +0 -146
- package/dist/core/tools/bash-policy-types.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-types.js +0 -2
- package/dist/core/tools/bash-policy-types.js.map +0 -1
- package/dist/core/tools/bash-policy.d.ts +0 -6
- package/dist/core/tools/bash-policy.d.ts.map +0 -1
- package/dist/core/tools/bash-policy.js +0 -5
- package/dist/core/tools/bash-policy.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-registry-builtins.js","sourceRoot":"","sources":["../../src/core/model-registry-builtins.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EACT,YAAY,GAIZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAI1E,MAAM,iCAAiC,GAAG,sBAAsB,CAAC;AACjE,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEhD,SAAS,SAAS,CAAC,OAA2C,EAAE,UAAkB;IACjF,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,oBAAoB,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,oBAAoB,CAAC,CAAC;AACvF,CAAC;AAED,MAAM,UAAU,iCAAiC,CAChD,KAAiB,EACjB,OAA2C;IAE3C,IAAI,KAAK,CAAC,QAAQ,KAAK,gBAAgB,IAAI,SAAS,CAAC,OAAO,EAAE,iCAAiC,CAAC,EAAE,CAAC;QAClG,OAAO,OAAO,CAAC;IAChB,CAAC;IACD,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC,iCAAiC,CAAC,EAAE,0BAA0B,EAAE,C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MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;iBAC1D,CAAC;YACH,CAAC;YAED,KAAK,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,aAAa,GAAG,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACnD,OAAO,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACzE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,aAA2B,EAAE,YAA0B;IACxF,MAAM,MAAM,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;IAClC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACxC,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,WAAW,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9G,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;QACrC,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import {\n\ttype Api,\n\tgetModels,\n\tgetProviders,\n\ttype KnownProvider,\n\ttype Model,\n\ttype OpenAICompletionsCompat,\n} from \"@earendil-works/pi-ai\";\nimport { normalizeContextWindowOptions, withContextWindowOptions } from \"./context-window.ts\";\nimport { getActiveCopilotModelCatalog } from \"./copilot-model-catalog.ts\";\nimport type { ModelOverride } from \"./model-registry-schemas.ts\";\nimport type { ProviderCompat, ProviderOverride } from \"./model-registry-types.ts\";\n\nconst GITHUB_COPILOT_API_VERSION_HEADER = \"X-GitHub-Api-Version\";\nconst GITHUB_COPILOT_API_VERSION = \"2026-06-01\";\n\nfunction hasHeader(headers: Record<string, string> | undefined, headerName: string): boolean {\n\tif (!headers) return false;\n\tconst normalizedHeaderName = headerName.toLowerCase();\n\treturn Object.keys(headers).some((key) => key.toLowerCase() === normalizedHeaderName);\n}\n\nexport function withGitHubCopilotApiVersionHeader(\n\tmodel: Model<Api>,\n\theaders: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n\tif (model.provider !== \"github-copilot\" || hasHeader(headers, GITHUB_COPILOT_API_VERSION_HEADER)) {\n\t\treturn headers;\n\t}\n\treturn { ...(headers ?? {}), [GITHUB_COPILOT_API_VERSION_HEADER]: GITHUB_COPILOT_API_VERSION };\n}\n\nfunction withCopilotContextWindowOptions(model: Model<Api>): Model<Api> {\n\tif (model.provider !== \"github-copilot\") return model;\n\tconst context = getActiveCopilotModelCatalog().get(model.id);\n\tif (!context) return model;\n\tconst base = { ...model, contextWindow: context.contextWindow, maxInputTokens: context.maxInputTokens };\n\tif (context.contextWindowOptions && context.contextWindowOptions.length > 1) {\n\t\treturn withContextWindowOptions(base, context.contextWindowOptions);\n\t}\n\treturn base;\n}\n\nexport function mergeCompat(\n\tbaseCompat: Model<Api>[\"compat\"],\n\toverrideCompat: ModelOverride[\"compat\"] | Model<Api>[\"compat\"],\n): Model<Api>[\"compat\"] | undefined {\n\tif (!overrideCompat) return baseCompat;\n\n\tconst base = baseCompat as ProviderCompat | undefined;\n\tconst override = overrideCompat as ProviderCompat;\n\tconst merged = { ...base, ...override } as ProviderCompat;\n\n\tconst baseCompletions = base as OpenAICompletionsCompat | undefined;\n\tconst overrideCompletions = override as OpenAICompletionsCompat;\n\tconst mergedCompletions = merged as OpenAICompletionsCompat;\n\n\tif (baseCompletions?.openRouterRouting || overrideCompletions.openRouterRouting) {\n\t\tmergedCompletions.openRouterRouting = {\n\t\t\t...baseCompletions?.openRouterRouting,\n\t\t\t...overrideCompletions.openRouterRouting,\n\t\t};\n\t}\n\n\tif (baseCompletions?.vercelGatewayRouting || overrideCompletions.vercelGatewayRouting) {\n\t\tmergedCompletions.vercelGatewayRouting = {\n\t\t\t...baseCompletions?.vercelGatewayRouting,\n\t\t\t...overrideCompletions.vercelGatewayRouting,\n\t\t};\n\t}\n\n\treturn merged as Model<Api>[\"compat\"];\n}\n\nexport function applyModelOverride(model: Model<Api>, override: ModelOverride): Model<Api> {\n\tconst result = { ...model };\n\n\tif (override.name !== undefined) result.name = override.name;\n\tif (override.reasoning !== undefined) result.reasoning = override.reasoning;\n\tif (override.thinkingLevelMap !== undefined) {\n\t\tresult.thinkingLevelMap = { ...model.thinkingLevelMap, ...override.thinkingLevelMap };\n\t}\n\tif (override.input !== undefined) result.input = override.input as (\"text\" | \"image\")[];\n\tif (override.contextWindow !== undefined) {\n\t\tresult.contextWindow = override.contextWindow;\n\t\tresult.defaultContextWindow = override.contextWindow;\n\t\tif (override.contextWindowOptions === undefined) {\n\t\t\tresult.contextWindowOptions = undefined;\n\t\t}\n\t}\n\tif (override.contextWindowOptions !== undefined) {\n\t\tresult.contextWindowOptions = normalizeContextWindowOptions(override.contextWindowOptions);\n\t}\n\tif (override.maxTokens !== undefined) result.maxTokens = override.maxTokens;\n\n\tif (override.cost) {\n\t\tresult.cost = {\n\t\t\tinput: override.cost.input ?? model.cost.input,\n\t\t\toutput: override.cost.output ?? model.cost.output,\n\t\t\tcacheRead: override.cost.cacheRead ?? model.cost.cacheRead,\n\t\t\tcacheWrite: override.cost.cacheWrite ?? model.cost.cacheWrite,\n\t\t};\n\t}\n\n\tresult.compat = mergeCompat(model.compat, override.compat);\n\treturn result;\n}\n\nexport function loadBuiltInModels(\n\toverrides: Map<string, ProviderOverride>,\n\tmodelOverrides: Map<string, Map<string, ModelOverride>>,\n): Model<Api>[] {\n\treturn getProviders().flatMap((provider) => {\n\t\tconst models = getModels(provider as KnownProvider) as Model<Api>[];\n\t\tconst providerOverride = overrides.get(provider);\n\t\tconst perModelOverrides = modelOverrides.get(provider);\n\n\t\treturn models.map((m) => {\n\t\t\tlet model = m;\n\n\t\t\tif (providerOverride) {\n\t\t\t\tmodel = {\n\t\t\t\t\t...model,\n\t\t\t\t\tbaseUrl: providerOverride.baseUrl ?? model.baseUrl,\n\t\t\t\t\tcompat: mergeCompat(model.compat, providerOverride.compat),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tmodel = withCopilotContextWindowOptions(model);\n\t\t\tconst modelOverride = perModelOverrides?.get(m.id);\n\t\t\treturn modelOverride ? applyModelOverride(model, modelOverride) : model;\n\t\t});\n\t});\n}\n\nexport function mergeCustomModels(builtInModels: Model<Api>[], customModels: Model<Api>[]): Model<Api>[] {\n\tconst merged = [...builtInModels];\n\tfor (const customModel of customModels) {\n\t\tconst existingIndex = merged.findIndex((m) => m.provider === customModel.provider && m.id === customModel.id);\n\t\tif (existingIndex >= 0) {\n\t\t\tmerged[existingIndex] = customModel;\n\t\t} else {\n\t\t\tmerged.push(customModel);\n\t\t}\n\t}\n\treturn merged;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model-registry-builtins.js","sourceRoot":"","sources":["../../src/core/model-registry-builtins.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EACT,YAAY,GAIZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAI1E,MAAM,iCAAiC,GAAG,sBAAsB,CAAC;AACjE,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEhD,SAAS,SAAS,CAAC,OAA2C,EAAE,UAAkB;IACjF,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,oBAAoB,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,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AAE,KAAK,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9G,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;QACrC,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import {\n\ttype Api,\n\tgetModels,\n\tgetProviders,\n\ttype KnownProvider,\n\ttype Model,\n\ttype OpenAICompletionsCompat,\n} from \"@earendil-works/pi-ai\";\nimport { normalizeContextWindowOptions, withContextWindowOptions } from \"./context-window.ts\";\nimport { getActiveCopilotModelCatalog } from \"./copilot-model-catalog.ts\";\nimport type { ModelOverride } from \"./model-registry-schemas.ts\";\nimport type { ProviderCompat, ProviderOverride } from \"./model-registry-types.ts\";\n\nconst GITHUB_COPILOT_API_VERSION_HEADER = \"X-GitHub-Api-Version\";\nconst GITHUB_COPILOT_API_VERSION = \"2026-06-01\";\n\nfunction hasHeader(headers: Record<string, string> | undefined, headerName: string): boolean {\n\tif (!headers) return false;\n\tconst normalizedHeaderName = headerName.toLowerCase();\n\treturn Object.keys(headers).some((key) => key.toLowerCase() === normalizedHeaderName);\n}\n\nexport function withGitHubCopilotApiVersionHeader(\n\tmodel: Model<Api>,\n\theaders: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n\tif (model.provider !== \"github-copilot\" || hasHeader(headers, GITHUB_COPILOT_API_VERSION_HEADER)) {\n\t\treturn headers;\n\t}\n\treturn { ...(headers ?? {}), [GITHUB_COPILOT_API_VERSION_HEADER]: GITHUB_COPILOT_API_VERSION };\n}\n\nfunction withCopilotContextWindowOptions(model: Model<Api>): Model<Api> {\n\tif (model.provider !== \"github-copilot\") return model;\n\tconst context = getActiveCopilotModelCatalog().get(model.id);\n\tif (!context) return model;\n\tconst base = { ...model, contextWindow: context.contextWindow, maxInputTokens: context.maxInputTokens };\n\tif (context.contextWindowOptions && context.contextWindowOptions.length > 1) {\n\t\treturn withContextWindowOptions(base, context.contextWindowOptions);\n\t}\n\treturn base;\n}\n\nexport function mergeCompat(\n\tbaseCompat: Model<Api>[\"compat\"],\n\toverrideCompat: ModelOverride[\"compat\"] | Model<Api>[\"compat\"],\n): Model<Api>[\"compat\"] | undefined {\n\tif (!overrideCompat) return baseCompat;\n\n\tconst base = baseCompat as ProviderCompat | undefined;\n\tconst override = overrideCompat as ProviderCompat;\n\tconst merged = { ...base, ...override } as ProviderCompat;\n\n\tconst baseCompletions = base as OpenAICompletionsCompat | undefined;\n\tconst overrideCompletions = override as OpenAICompletionsCompat;\n\tconst mergedCompletions = merged as OpenAICompletionsCompat;\n\n\tif (baseCompletions?.openRouterRouting || overrideCompletions.openRouterRouting) {\n\t\tmergedCompletions.openRouterRouting = {\n\t\t\t...baseCompletions?.openRouterRouting,\n\t\t\t...overrideCompletions.openRouterRouting,\n\t\t};\n\t}\n\n\tif (baseCompletions?.vercelGatewayRouting || overrideCompletions.vercelGatewayRouting) {\n\t\tmergedCompletions.vercelGatewayRouting = {\n\t\t\t...baseCompletions?.vercelGatewayRouting,\n\t\t\t...overrideCompletions.vercelGatewayRouting,\n\t\t};\n\t}\n\n\tif (baseCompletions?.chatTemplateKwargs || overrideCompletions.chatTemplateKwargs) {\n\t\tmergedCompletions.chatTemplateKwargs = {\n\t\t\t...baseCompletions?.chatTemplateKwargs,\n\t\t\t...overrideCompletions.chatTemplateKwargs,\n\t\t};\n\t}\n\n\treturn merged as Model<Api>[\"compat\"];\n}\n\nexport function applyModelOverride(model: Model<Api>, override: ModelOverride): Model<Api> {\n\tconst result = { ...model };\n\n\tif (override.name !== undefined) result.name = override.name;\n\tif (override.reasoning !== undefined) result.reasoning = override.reasoning;\n\tif (override.thinkingLevelMap !== undefined) {\n\t\tresult.thinkingLevelMap = { ...model.thinkingLevelMap, ...override.thinkingLevelMap };\n\t}\n\tif (override.input !== undefined) result.input = override.input as (\"text\" | \"image\")[];\n\tif (override.contextWindow !== undefined) {\n\t\tresult.contextWindow = override.contextWindow;\n\t\tresult.defaultContextWindow = override.contextWindow;\n\t\tif (override.contextWindowOptions === undefined) {\n\t\t\tresult.contextWindowOptions = undefined;\n\t\t}\n\t}\n\tif (override.contextWindowOptions !== undefined) {\n\t\tresult.contextWindowOptions = normalizeContextWindowOptions(override.contextWindowOptions);\n\t}\n\tif (override.maxTokens !== undefined) result.maxTokens = override.maxTokens;\n\n\tif (override.cost) {\n\t\tresult.cost = {\n\t\t\tinput: override.cost.input ?? model.cost.input,\n\t\t\toutput: override.cost.output ?? model.cost.output,\n\t\t\tcacheRead: override.cost.cacheRead ?? model.cost.cacheRead,\n\t\t\tcacheWrite: override.cost.cacheWrite ?? model.cost.cacheWrite,\n\t\t};\n\t}\n\n\tresult.compat = mergeCompat(model.compat, override.compat);\n\treturn result;\n}\n\nexport function loadBuiltInModels(\n\toverrides: Map<string, ProviderOverride>,\n\tmodelOverrides: Map<string, Map<string, ModelOverride>>,\n): Model<Api>[] {\n\treturn getProviders().flatMap((provider) => {\n\t\tconst models = getModels(provider as KnownProvider) as Model<Api>[];\n\t\tconst providerOverride = overrides.get(provider);\n\t\tconst perModelOverrides = modelOverrides.get(provider);\n\n\t\treturn models.map((m) => {\n\t\t\tlet model = m;\n\n\t\t\tif (providerOverride) {\n\t\t\t\tmodel = {\n\t\t\t\t\t...model,\n\t\t\t\t\tbaseUrl: providerOverride.baseUrl ?? model.baseUrl,\n\t\t\t\t\tcompat: mergeCompat(model.compat, providerOverride.compat),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tmodel = withCopilotContextWindowOptions(model);\n\t\t\tconst modelOverride = perModelOverrides?.get(m.id);\n\t\t\treturn modelOverride ? applyModelOverride(model, modelOverride) : model;\n\t\t});\n\t});\n}\n\nexport function mergeCustomModels(builtInModels: Model<Api>[], customModels: Model<Api>[]): Model<Api>[] {\n\tconst merged = [...builtInModels];\n\tfor (const customModel of customModels) {\n\t\tconst existingIndex = merged.findIndex((m) => m.provider === customModel.provider && m.id === customModel.id);\n\t\tif (existingIndex >= 0) {\n\t\t\tmerged[existingIndex] = customModel;\n\t\t} else {\n\t\t\tmerged.push(customModel);\n\t\t}\n\t}\n\treturn merged;\n}\n"]}
|
|
@@ -32,7 +32,11 @@ declare const ModelOverrideSchema: Type.TObject<{
|
|
|
32
32
|
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
33
33
|
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
34
34
|
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
35
|
-
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"qwen-chat-template">]>>;
|
|
35
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
36
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull]>, Type.TObject<{
|
|
37
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">]>;
|
|
38
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
39
|
+
}>]>>>;
|
|
36
40
|
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
37
41
|
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
38
42
|
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
@@ -104,7 +108,11 @@ declare const ModelsConfigSchema: Type.TObject<{
|
|
|
104
108
|
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
105
109
|
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
106
110
|
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
107
|
-
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"qwen-chat-template">]>>;
|
|
111
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
112
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull]>, Type.TObject<{
|
|
113
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">]>;
|
|
114
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
115
|
+
}>]>>>;
|
|
108
116
|
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
109
117
|
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
110
118
|
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
@@ -193,7 +201,11 @@ declare const ModelsConfigSchema: Type.TObject<{
|
|
|
193
201
|
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
194
202
|
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
195
203
|
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
196
|
-
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"qwen-chat-template">]>>;
|
|
204
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
205
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull]>, Type.TObject<{
|
|
206
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">]>;
|
|
207
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
208
|
+
}>]>>>;
|
|
197
209
|
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
198
210
|
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
199
211
|
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
@@ -279,7 +291,11 @@ declare const ModelsConfigSchema: Type.TObject<{
|
|
|
279
291
|
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
280
292
|
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
281
293
|
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
282
|
-
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"qwen-chat-template">]>>;
|
|
294
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
295
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull]>, Type.TObject<{
|
|
296
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">]>;
|
|
297
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
298
|
+
}>]>>>;
|
|
283
299
|
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
284
300
|
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
285
301
|
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
@@ -352,7 +368,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
352
368
|
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
353
369
|
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
354
370
|
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
355
|
-
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"qwen-chat-template">]>>;
|
|
371
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
372
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull]>, Type.TObject<{
|
|
373
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">]>;
|
|
374
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
375
|
+
}>]>>>;
|
|
356
376
|
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
357
377
|
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
358
378
|
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
@@ -441,7 +461,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
441
461
|
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
442
462
|
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
443
463
|
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
444
|
-
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"qwen-chat-template">]>>;
|
|
464
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
465
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull]>, Type.TObject<{
|
|
466
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">]>;
|
|
467
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
468
|
+
}>]>>>;
|
|
445
469
|
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
446
470
|
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
447
471
|
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
@@ -527,7 +551,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
527
551
|
requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;
|
|
528
552
|
requiresThinkingAsText: Type.TOptional<Type.TBoolean>;
|
|
529
553
|
requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;
|
|
530
|
-
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"qwen-chat-template">]>>;
|
|
554
|
+
thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"together">, Type.TLiteral<"deepseek">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;
|
|
555
|
+
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull]>, Type.TObject<{
|
|
556
|
+
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">]>;
|
|
557
|
+
omitWhenOff: Type.TOptional<Type.TBoolean>;
|
|
558
|
+
}>]>>>;
|
|
531
559
|
cacheControlFormat: Type.TOptional<Type.TLiteral<"anthropic">>;
|
|
532
560
|
openRouterRouting: Type.TOptional<Type.TObject<{
|
|
533
561
|
allow_fallbacks: Type.TOptional<Type.TBoolean>;
|
|
@@ -599,7 +627,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
599
627
|
requiresAssistantAfterToolResult?: boolean | undefined;
|
|
600
628
|
requiresThinkingAsText?: boolean | undefined;
|
|
601
629
|
requiresReasoningContentOnAssistantMessages?: boolean | undefined;
|
|
602
|
-
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "together" | "zai" | undefined;
|
|
630
|
+
thinkingFormat?: "ant-ling" | "chat-template" | "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "string-thinking" | "together" | "zai" | undefined;
|
|
631
|
+
chatTemplateKwargs?: Record<string, string | number | boolean | {
|
|
632
|
+
$var: "thinking.effort" | "thinking.enabled";
|
|
633
|
+
omitWhenOff?: boolean | undefined;
|
|
634
|
+
} | null> | undefined;
|
|
603
635
|
cacheControlFormat?: "anthropic" | undefined;
|
|
604
636
|
openRouterRouting?: {
|
|
605
637
|
allow_fallbacks?: boolean | undefined;
|
|
@@ -688,7 +720,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
688
720
|
requiresAssistantAfterToolResult?: boolean | undefined;
|
|
689
721
|
requiresThinkingAsText?: boolean | undefined;
|
|
690
722
|
requiresReasoningContentOnAssistantMessages?: boolean | undefined;
|
|
691
|
-
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "together" | "zai" | undefined;
|
|
723
|
+
thinkingFormat?: "ant-ling" | "chat-template" | "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "string-thinking" | "together" | "zai" | undefined;
|
|
724
|
+
chatTemplateKwargs?: Record<string, string | number | boolean | {
|
|
725
|
+
$var: "thinking.effort" | "thinking.enabled";
|
|
726
|
+
omitWhenOff?: boolean | undefined;
|
|
727
|
+
} | null> | undefined;
|
|
692
728
|
cacheControlFormat?: "anthropic" | undefined;
|
|
693
729
|
openRouterRouting?: {
|
|
694
730
|
allow_fallbacks?: boolean | undefined;
|
|
@@ -774,7 +810,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
774
810
|
requiresAssistantAfterToolResult?: boolean | undefined;
|
|
775
811
|
requiresThinkingAsText?: boolean | undefined;
|
|
776
812
|
requiresReasoningContentOnAssistantMessages?: boolean | undefined;
|
|
777
|
-
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "together" | "zai" | undefined;
|
|
813
|
+
thinkingFormat?: "ant-ling" | "chat-template" | "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "string-thinking" | "together" | "zai" | undefined;
|
|
814
|
+
chatTemplateKwargs?: Record<string, string | number | boolean | {
|
|
815
|
+
$var: "thinking.effort" | "thinking.enabled";
|
|
816
|
+
omitWhenOff?: boolean | undefined;
|
|
817
|
+
} | null> | undefined;
|
|
778
818
|
cacheControlFormat?: "anthropic" | undefined;
|
|
779
819
|
openRouterRouting?: {
|
|
780
820
|
allow_fallbacks?: boolean | undefined;
|
|
@@ -846,7 +886,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
846
886
|
requiresAssistantAfterToolResult?: boolean | undefined;
|
|
847
887
|
requiresThinkingAsText?: boolean | undefined;
|
|
848
888
|
requiresReasoningContentOnAssistantMessages?: boolean | undefined;
|
|
849
|
-
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "together" | "zai" | undefined;
|
|
889
|
+
thinkingFormat?: "ant-ling" | "chat-template" | "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "string-thinking" | "together" | "zai" | undefined;
|
|
890
|
+
chatTemplateKwargs?: Record<string, string | number | boolean | {
|
|
891
|
+
$var: "thinking.effort" | "thinking.enabled";
|
|
892
|
+
omitWhenOff?: boolean | undefined;
|
|
893
|
+
} | null> | undefined;
|
|
850
894
|
cacheControlFormat?: "anthropic" | undefined;
|
|
851
895
|
openRouterRouting?: {
|
|
852
896
|
allow_fallbacks?: boolean | undefined;
|
|
@@ -935,7 +979,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
935
979
|
requiresAssistantAfterToolResult?: boolean | undefined;
|
|
936
980
|
requiresThinkingAsText?: boolean | undefined;
|
|
937
981
|
requiresReasoningContentOnAssistantMessages?: boolean | undefined;
|
|
938
|
-
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "together" | "zai" | undefined;
|
|
982
|
+
thinkingFormat?: "ant-ling" | "chat-template" | "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "string-thinking" | "together" | "zai" | undefined;
|
|
983
|
+
chatTemplateKwargs?: Record<string, string | number | boolean | {
|
|
984
|
+
$var: "thinking.effort" | "thinking.enabled";
|
|
985
|
+
omitWhenOff?: boolean | undefined;
|
|
986
|
+
} | null> | undefined;
|
|
939
987
|
cacheControlFormat?: "anthropic" | undefined;
|
|
940
988
|
openRouterRouting?: {
|
|
941
989
|
allow_fallbacks?: boolean | undefined;
|
|
@@ -1021,7 +1069,11 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
|
|
|
1021
1069
|
requiresAssistantAfterToolResult?: boolean | undefined;
|
|
1022
1070
|
requiresThinkingAsText?: boolean | undefined;
|
|
1023
1071
|
requiresReasoningContentOnAssistantMessages?: boolean | undefined;
|
|
1024
|
-
thinkingFormat?: "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "together" | "zai" | undefined;
|
|
1072
|
+
thinkingFormat?: "ant-ling" | "chat-template" | "deepseek" | "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "string-thinking" | "together" | "zai" | undefined;
|
|
1073
|
+
chatTemplateKwargs?: Record<string, string | number | boolean | {
|
|
1074
|
+
$var: "thinking.effort" | "thinking.enabled";
|
|
1075
|
+
omitWhenOff?: boolean | undefined;
|
|
1076
|
+
} | null> | undefined;
|
|
1025
1077
|
cacheControlFormat?: "anthropic" | undefined;
|
|
1026
1078
|
openRouterRouting?: {
|
|
1027
1079
|
allow_fallbacks?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-registry-schemas.d.ts","sourceRoot":"","sources":["../../src/core/model-registry-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAgI/D,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBvB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAc/D,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEtB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8B,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,MAAM,CAW7E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\nimport type { TLocalizedValidationError } from \"typebox/error\";\n\nconst PercentileCutoffsSchema = Type.Object({\n\tp50: Type.Optional(Type.Number()),\n\tp75: Type.Optional(Type.Number()),\n\tp90: Type.Optional(Type.Number()),\n\tp99: Type.Optional(Type.Number()),\n});\n\nconst OpenRouterRoutingSchema = Type.Object({\n\tallow_fallbacks: Type.Optional(Type.Boolean()),\n\trequire_parameters: Type.Optional(Type.Boolean()),\n\tdata_collection: Type.Optional(Type.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")])),\n\tzdr: Type.Optional(Type.Boolean()),\n\tenforce_distillable_text: Type.Optional(Type.Boolean()),\n\torder: Type.Optional(Type.Array(Type.String())),\n\tonly: Type.Optional(Type.Array(Type.String())),\n\tignore: Type.Optional(Type.Array(Type.String())),\n\tquantizations: Type.Optional(Type.Array(Type.String())),\n\tsort: Type.Optional(\n\t\tType.Union([\n\t\t\tType.String(),\n\t\t\tType.Object({\n\t\t\t\tby: Type.Optional(Type.String()),\n\t\t\t\tpartition: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n\t\t\t}),\n\t\t]),\n\t),\n\tmax_price: Type.Optional(\n\t\tType.Object({\n\t\t\tprompt: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\tcompletion: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\taudio: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\trequest: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t}),\n\t),\n\tpreferred_min_throughput: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n\tpreferred_max_latency: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n});\n\nconst VercelGatewayRoutingSchema = Type.Object({\n\tonly: Type.Optional(Type.Array(Type.String())),\n\torder: Type.Optional(Type.Array(Type.String())),\n});\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nconst ThinkingLevelMapSchema = Type.Object({\n\toff: Type.Optional(ThinkingLevelMapValueSchema),\n\tminimal: Type.Optional(ThinkingLevelMapValueSchema),\n\tlow: Type.Optional(ThinkingLevelMapValueSchema),\n\tmedium: Type.Optional(ThinkingLevelMapValueSchema),\n\thigh: Type.Optional(ThinkingLevelMapValueSchema),\n\txhigh: Type.Optional(ThinkingLevelMapValueSchema),\n});\nconst ContextWindowOptionsSchema = Type.Array(Type.Number());\n\nconst OpenAICompletionsCompatSchema = Type.Object({\n\tsupportsStore: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsReasoningEffort: Type.Optional(Type.Boolean()),\n\tsupportsUsageInStreaming: Type.Optional(Type.Boolean()),\n\tmaxTokensField: Type.Optional(Type.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")])),\n\trequiresToolResultName: Type.Optional(Type.Boolean()),\n\trequiresAssistantAfterToolResult: Type.Optional(Type.Boolean()),\n\trequiresThinkingAsText: Type.Optional(Type.Boolean()),\n\trequiresReasoningContentOnAssistantMessages: Type.Optional(Type.Boolean()),\n\tthinkingFormat: Type.Optional(\n\t\tType.Union([\n\t\t\tType.Literal(\"openai\"),\n\t\t\tType.Literal(\"openrouter\"),\n\t\t\tType.Literal(\"together\"),\n\t\t\tType.Literal(\"deepseek\"),\n\t\t\tType.Literal(\"zai\"),\n\t\t\tType.Literal(\"qwen\"),\n\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t]),\n\t),\n\tcacheControlFormat: Type.Optional(Type.Literal(\"anthropic\")),\n\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst OpenAIResponsesCompatSchema = Type.Object({\n\tsendSessionIdHeader: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst AnthropicMessagesCompatSchema = Type.Object({\n\tsupportsEagerToolInputStreaming: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tsupportsCacheControlOnTools: Type.Optional(Type.Boolean()),\n\tforceAdaptiveThinking: Type.Optional(Type.Boolean()),\n});\n\nconst ProviderCompatSchema = Type.Union([\n\tOpenAICompletionsCompatSchema,\n\tOpenAIResponsesCompatSchema,\n\tAnthropicMessagesCompatSchema,\n]);\n\nconst ModelDefinitionSchema = Type.Object({\n\tid: Type.String({ minLength: 1 }),\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Number(),\n\t\t\toutput: Type.Number(),\n\t\t\tcacheRead: Type.Number(),\n\t\t\tcacheWrite: Type.Number(),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ModelOverrideSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Optional(Type.Number()),\n\t\t\toutput: Type.Optional(Type.Number()),\n\t\t\tcacheRead: Type.Optional(Type.Number()),\n\t\t\tcacheWrite: Type.Optional(Type.Number()),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nexport type ModelOverride = Static<typeof ModelOverrideSchema>;\n\nconst ProviderConfigSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\tapiKey: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n\tauthHeader: Type.Optional(Type.Boolean()),\n\tmodels: Type.Optional(Type.Array(ModelDefinitionSchema)),\n\tmodelOverrides: Type.Optional(Type.Record(Type.String(), ModelOverrideSchema)),\n});\n\nconst ModelsConfigSchema = Type.Object({\n\tproviders: Type.Record(Type.String(), ProviderConfigSchema),\n});\n\nexport const validateModelsConfig = Compile(ModelsConfigSchema);\n\nexport type ModelsConfig = Static<typeof ModelsConfigSchema>;\n\nexport function formatValidationPath(error: TLocalizedValidationError): string {\n\tif (error.keyword === \"required\") {\n\t\tconst requiredProperties = (error.params as { requiredProperties?: string[] }).requiredProperties;\n\t\tconst requiredProperty = requiredProperties?.[0];\n\t\tif (requiredProperty) {\n\t\t\tconst basePath = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\t\t\treturn basePath ? `${basePath}.${requiredProperty}` : requiredProperty;\n\t\t}\n\t}\n\tconst path = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\treturn path || \"root\";\n}\n\nexport function stripJsonComments(input: string): string {\n\treturn input\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|\\/\\/[^\\n]*/g, (m) => (m[0] === '\"' ? m : \"\"))\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|,(\\s*[}\\]])/g, (m, tail) => tail ?? (m[0] === '\"' ? m : \"\"));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model-registry-schemas.d.ts","sourceRoot":"","sources":["../../src/core/model-registry-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8B,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,MAAM,CAW7E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\nimport type { TLocalizedValidationError } from \"typebox/error\";\n\nconst PercentileCutoffsSchema = Type.Object({\n\tp50: Type.Optional(Type.Number()),\n\tp75: Type.Optional(Type.Number()),\n\tp90: Type.Optional(Type.Number()),\n\tp99: Type.Optional(Type.Number()),\n});\n\nconst OpenRouterRoutingSchema = Type.Object({\n\tallow_fallbacks: Type.Optional(Type.Boolean()),\n\trequire_parameters: Type.Optional(Type.Boolean()),\n\tdata_collection: Type.Optional(Type.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")])),\n\tzdr: Type.Optional(Type.Boolean()),\n\tenforce_distillable_text: Type.Optional(Type.Boolean()),\n\torder: Type.Optional(Type.Array(Type.String())),\n\tonly: Type.Optional(Type.Array(Type.String())),\n\tignore: Type.Optional(Type.Array(Type.String())),\n\tquantizations: Type.Optional(Type.Array(Type.String())),\n\tsort: Type.Optional(\n\t\tType.Union([\n\t\t\tType.String(),\n\t\t\tType.Object({\n\t\t\t\tby: Type.Optional(Type.String()),\n\t\t\t\tpartition: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n\t\t\t}),\n\t\t]),\n\t),\n\tmax_price: Type.Optional(\n\t\tType.Object({\n\t\t\tprompt: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\tcompletion: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\taudio: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\trequest: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t}),\n\t),\n\tpreferred_min_throughput: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n\tpreferred_max_latency: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n});\n\nconst VercelGatewayRoutingSchema = Type.Object({\n\tonly: Type.Optional(Type.Array(Type.String())),\n\torder: Type.Optional(Type.Array(Type.String())),\n});\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nconst ThinkingLevelMapSchema = Type.Object({\n\toff: Type.Optional(ThinkingLevelMapValueSchema),\n\tminimal: Type.Optional(ThinkingLevelMapValueSchema),\n\tlow: Type.Optional(ThinkingLevelMapValueSchema),\n\tmedium: Type.Optional(ThinkingLevelMapValueSchema),\n\thigh: Type.Optional(ThinkingLevelMapValueSchema),\n\txhigh: Type.Optional(ThinkingLevelMapValueSchema),\n});\nconst ContextWindowOptionsSchema = Type.Array(Type.Number());\nconst ChatTemplateKwargScalarSchema = Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()]);\nconst ChatTemplateKwargVariableSchema = Type.Object({\n\t$var: Type.Union([Type.Literal(\"thinking.enabled\"), Type.Literal(\"thinking.effort\")]),\n\tomitWhenOff: Type.Optional(Type.Boolean()),\n});\nconst ChatTemplateKwargSchema = Type.Union([ChatTemplateKwargScalarSchema, ChatTemplateKwargVariableSchema]);\n\nconst OpenAICompletionsCompatSchema = Type.Object({\n\tsupportsStore: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsReasoningEffort: Type.Optional(Type.Boolean()),\n\tsupportsUsageInStreaming: Type.Optional(Type.Boolean()),\n\tmaxTokensField: Type.Optional(Type.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")])),\n\trequiresToolResultName: Type.Optional(Type.Boolean()),\n\trequiresAssistantAfterToolResult: Type.Optional(Type.Boolean()),\n\trequiresThinkingAsText: Type.Optional(Type.Boolean()),\n\trequiresReasoningContentOnAssistantMessages: Type.Optional(Type.Boolean()),\n\tthinkingFormat: Type.Optional(\n\t\tType.Union([\n\t\t\tType.Literal(\"openai\"),\n\t\t\tType.Literal(\"openrouter\"),\n\t\t\tType.Literal(\"together\"),\n\t\t\tType.Literal(\"deepseek\"),\n\t\t\tType.Literal(\"zai\"),\n\t\t\tType.Literal(\"qwen\"),\n\t\t\tType.Literal(\"chat-template\"),\n\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t\tType.Literal(\"string-thinking\"),\n\t\t\tType.Literal(\"ant-ling\"),\n\t\t]),\n\t),\n\tchatTemplateKwargs: Type.Optional(Type.Record(Type.String(), ChatTemplateKwargSchema)),\n\tcacheControlFormat: Type.Optional(Type.Literal(\"anthropic\")),\n\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst OpenAIResponsesCompatSchema = Type.Object({\n\tsendSessionIdHeader: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst AnthropicMessagesCompatSchema = Type.Object({\n\tsupportsEagerToolInputStreaming: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tsupportsCacheControlOnTools: Type.Optional(Type.Boolean()),\n\tforceAdaptiveThinking: Type.Optional(Type.Boolean()),\n});\n\nconst ProviderCompatSchema = Type.Union([\n\tOpenAICompletionsCompatSchema,\n\tOpenAIResponsesCompatSchema,\n\tAnthropicMessagesCompatSchema,\n]);\n\nconst ModelDefinitionSchema = Type.Object({\n\tid: Type.String({ minLength: 1 }),\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Number(),\n\t\t\toutput: Type.Number(),\n\t\t\tcacheRead: Type.Number(),\n\t\t\tcacheWrite: Type.Number(),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ModelOverrideSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Optional(Type.Number()),\n\t\t\toutput: Type.Optional(Type.Number()),\n\t\t\tcacheRead: Type.Optional(Type.Number()),\n\t\t\tcacheWrite: Type.Optional(Type.Number()),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nexport type ModelOverride = Static<typeof ModelOverrideSchema>;\n\nconst ProviderConfigSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\tapiKey: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n\tauthHeader: Type.Optional(Type.Boolean()),\n\tmodels: Type.Optional(Type.Array(ModelDefinitionSchema)),\n\tmodelOverrides: Type.Optional(Type.Record(Type.String(), ModelOverrideSchema)),\n});\n\nconst ModelsConfigSchema = Type.Object({\n\tproviders: Type.Record(Type.String(), ProviderConfigSchema),\n});\n\nexport const validateModelsConfig = Compile(ModelsConfigSchema);\n\nexport type ModelsConfig = Static<typeof ModelsConfigSchema>;\n\nexport function formatValidationPath(error: TLocalizedValidationError): string {\n\tif (error.keyword === \"required\") {\n\t\tconst requiredProperties = (error.params as { requiredProperties?: string[] }).requiredProperties;\n\t\tconst requiredProperty = requiredProperties?.[0];\n\t\tif (requiredProperty) {\n\t\t\tconst basePath = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\t\t\treturn basePath ? `${basePath}.${requiredProperty}` : requiredProperty;\n\t\t}\n\t}\n\tconst path = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\treturn path || \"root\";\n}\n\nexport function stripJsonComments(input: string): string {\n\treturn input\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|\\/\\/[^\\n]*/g, (m) => (m[0] === '\"' ? m : \"\"))\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|,(\\s*[}\\]])/g, (m, tail) => tail ?? (m[0] === '\"' ? m : \"\"));\n}\n"]}
|
|
@@ -47,6 +47,12 @@ const ThinkingLevelMapSchema = Type.Object({
|
|
|
47
47
|
xhigh: Type.Optional(ThinkingLevelMapValueSchema),
|
|
48
48
|
});
|
|
49
49
|
const ContextWindowOptionsSchema = Type.Array(Type.Number());
|
|
50
|
+
const ChatTemplateKwargScalarSchema = Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()]);
|
|
51
|
+
const ChatTemplateKwargVariableSchema = Type.Object({
|
|
52
|
+
$var: Type.Union([Type.Literal("thinking.enabled"), Type.Literal("thinking.effort")]),
|
|
53
|
+
omitWhenOff: Type.Optional(Type.Boolean()),
|
|
54
|
+
});
|
|
55
|
+
const ChatTemplateKwargSchema = Type.Union([ChatTemplateKwargScalarSchema, ChatTemplateKwargVariableSchema]);
|
|
50
56
|
const OpenAICompletionsCompatSchema = Type.Object({
|
|
51
57
|
supportsStore: Type.Optional(Type.Boolean()),
|
|
52
58
|
supportsDeveloperRole: Type.Optional(Type.Boolean()),
|
|
@@ -64,8 +70,12 @@ const OpenAICompletionsCompatSchema = Type.Object({
|
|
|
64
70
|
Type.Literal("deepseek"),
|
|
65
71
|
Type.Literal("zai"),
|
|
66
72
|
Type.Literal("qwen"),
|
|
73
|
+
Type.Literal("chat-template"),
|
|
67
74
|
Type.Literal("qwen-chat-template"),
|
|
75
|
+
Type.Literal("string-thinking"),
|
|
76
|
+
Type.Literal("ant-ling"),
|
|
68
77
|
])),
|
|
78
|
+
chatTemplateKwargs: Type.Optional(Type.Record(Type.String(), ChatTemplateKwargSchema)),
|
|
69
79
|
cacheControlFormat: Type.Optional(Type.Literal("anthropic")),
|
|
70
80
|
openRouterRouting: Type.Optional(OpenRouterRoutingSchema),
|
|
71
81
|
vercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-registry-schemas.js","sourceRoot":"","sources":["../../src/core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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACxE,OAAO,CAAC,gCAAgC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\nimport type { TLocalizedValidationError } from \"typebox/error\";\n\nconst PercentileCutoffsSchema = Type.Object({\n\tp50: Type.Optional(Type.Number()),\n\tp75: Type.Optional(Type.Number()),\n\tp90: Type.Optional(Type.Number()),\n\tp99: Type.Optional(Type.Number()),\n});\n\nconst OpenRouterRoutingSchema = Type.Object({\n\tallow_fallbacks: Type.Optional(Type.Boolean()),\n\trequire_parameters: Type.Optional(Type.Boolean()),\n\tdata_collection: Type.Optional(Type.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")])),\n\tzdr: Type.Optional(Type.Boolean()),\n\tenforce_distillable_text: Type.Optional(Type.Boolean()),\n\torder: Type.Optional(Type.Array(Type.String())),\n\tonly: Type.Optional(Type.Array(Type.String())),\n\tignore: Type.Optional(Type.Array(Type.String())),\n\tquantizations: Type.Optional(Type.Array(Type.String())),\n\tsort: Type.Optional(\n\t\tType.Union([\n\t\t\tType.String(),\n\t\t\tType.Object({\n\t\t\t\tby: Type.Optional(Type.String()),\n\t\t\t\tpartition: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n\t\t\t}),\n\t\t]),\n\t),\n\tmax_price: Type.Optional(\n\t\tType.Object({\n\t\t\tprompt: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\tcompletion: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\taudio: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\trequest: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t}),\n\t),\n\tpreferred_min_throughput: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n\tpreferred_max_latency: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n});\n\nconst VercelGatewayRoutingSchema = Type.Object({\n\tonly: Type.Optional(Type.Array(Type.String())),\n\torder: Type.Optional(Type.Array(Type.String())),\n});\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nconst ThinkingLevelMapSchema = Type.Object({\n\toff: Type.Optional(ThinkingLevelMapValueSchema),\n\tminimal: Type.Optional(ThinkingLevelMapValueSchema),\n\tlow: Type.Optional(ThinkingLevelMapValueSchema),\n\tmedium: Type.Optional(ThinkingLevelMapValueSchema),\n\thigh: Type.Optional(ThinkingLevelMapValueSchema),\n\txhigh: Type.Optional(ThinkingLevelMapValueSchema),\n});\nconst ContextWindowOptionsSchema = Type.Array(Type.Number());\n\nconst OpenAICompletionsCompatSchema = Type.Object({\n\tsupportsStore: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsReasoningEffort: Type.Optional(Type.Boolean()),\n\tsupportsUsageInStreaming: Type.Optional(Type.Boolean()),\n\tmaxTokensField: Type.Optional(Type.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")])),\n\trequiresToolResultName: Type.Optional(Type.Boolean()),\n\trequiresAssistantAfterToolResult: Type.Optional(Type.Boolean()),\n\trequiresThinkingAsText: Type.Optional(Type.Boolean()),\n\trequiresReasoningContentOnAssistantMessages: Type.Optional(Type.Boolean()),\n\tthinkingFormat: Type.Optional(\n\t\tType.Union([\n\t\t\tType.Literal(\"openai\"),\n\t\t\tType.Literal(\"openrouter\"),\n\t\t\tType.Literal(\"together\"),\n\t\t\tType.Literal(\"deepseek\"),\n\t\t\tType.Literal(\"zai\"),\n\t\t\tType.Literal(\"qwen\"),\n\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t]),\n\t),\n\tcacheControlFormat: Type.Optional(Type.Literal(\"anthropic\")),\n\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst OpenAIResponsesCompatSchema = Type.Object({\n\tsendSessionIdHeader: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst AnthropicMessagesCompatSchema = Type.Object({\n\tsupportsEagerToolInputStreaming: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tsupportsCacheControlOnTools: Type.Optional(Type.Boolean()),\n\tforceAdaptiveThinking: Type.Optional(Type.Boolean()),\n});\n\nconst ProviderCompatSchema = Type.Union([\n\tOpenAICompletionsCompatSchema,\n\tOpenAIResponsesCompatSchema,\n\tAnthropicMessagesCompatSchema,\n]);\n\nconst ModelDefinitionSchema = Type.Object({\n\tid: Type.String({ minLength: 1 }),\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Number(),\n\t\t\toutput: Type.Number(),\n\t\t\tcacheRead: Type.Number(),\n\t\t\tcacheWrite: Type.Number(),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ModelOverrideSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Optional(Type.Number()),\n\t\t\toutput: Type.Optional(Type.Number()),\n\t\t\tcacheRead: Type.Optional(Type.Number()),\n\t\t\tcacheWrite: Type.Optional(Type.Number()),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nexport type ModelOverride = Static<typeof ModelOverrideSchema>;\n\nconst ProviderConfigSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\tapiKey: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n\tauthHeader: Type.Optional(Type.Boolean()),\n\tmodels: Type.Optional(Type.Array(ModelDefinitionSchema)),\n\tmodelOverrides: Type.Optional(Type.Record(Type.String(), ModelOverrideSchema)),\n});\n\nconst ModelsConfigSchema = Type.Object({\n\tproviders: Type.Record(Type.String(), ProviderConfigSchema),\n});\n\nexport const validateModelsConfig = Compile(ModelsConfigSchema);\n\nexport type ModelsConfig = Static<typeof ModelsConfigSchema>;\n\nexport function formatValidationPath(error: TLocalizedValidationError): string {\n\tif (error.keyword === \"required\") {\n\t\tconst requiredProperties = (error.params as { requiredProperties?: string[] }).requiredProperties;\n\t\tconst requiredProperty = requiredProperties?.[0];\n\t\tif (requiredProperty) {\n\t\t\tconst basePath = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\t\t\treturn basePath ? `${basePath}.${requiredProperty}` : requiredProperty;\n\t\t}\n\t}\n\tconst path = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\treturn path || \"root\";\n}\n\nexport function stripJsonComments(input: string): string {\n\treturn input\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|\\/\\/[^\\n]*/g, (m) => (m[0] === '\"' ? m : \"\"))\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|,(\\s*[}\\]])/g, (m, tail) => tail ?? (m[0] === '\"' ? m : \"\"));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model-registry-schemas.js","sourceRoot":"","sources":["../../src/core/model-registry-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACjC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACjC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACjC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3C,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,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CAAC,CAAC;IACvE,OAAO,IAAI,IAAI,MAAM,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC9C,OAAO,KAAK;SACV,OAAO,CAAC,+BAA+B,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACxE,OAAO,CAAC,gCAAgC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\nimport type { TLocalizedValidationError } from \"typebox/error\";\n\nconst PercentileCutoffsSchema = Type.Object({\n\tp50: Type.Optional(Type.Number()),\n\tp75: Type.Optional(Type.Number()),\n\tp90: Type.Optional(Type.Number()),\n\tp99: Type.Optional(Type.Number()),\n});\n\nconst OpenRouterRoutingSchema = Type.Object({\n\tallow_fallbacks: Type.Optional(Type.Boolean()),\n\trequire_parameters: Type.Optional(Type.Boolean()),\n\tdata_collection: Type.Optional(Type.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")])),\n\tzdr: Type.Optional(Type.Boolean()),\n\tenforce_distillable_text: Type.Optional(Type.Boolean()),\n\torder: Type.Optional(Type.Array(Type.String())),\n\tonly: Type.Optional(Type.Array(Type.String())),\n\tignore: Type.Optional(Type.Array(Type.String())),\n\tquantizations: Type.Optional(Type.Array(Type.String())),\n\tsort: Type.Optional(\n\t\tType.Union([\n\t\t\tType.String(),\n\t\t\tType.Object({\n\t\t\t\tby: Type.Optional(Type.String()),\n\t\t\t\tpartition: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n\t\t\t}),\n\t\t]),\n\t),\n\tmax_price: Type.Optional(\n\t\tType.Object({\n\t\t\tprompt: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\tcompletion: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\taudio: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\trequest: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t}),\n\t),\n\tpreferred_min_throughput: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n\tpreferred_max_latency: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n});\n\nconst VercelGatewayRoutingSchema = Type.Object({\n\tonly: Type.Optional(Type.Array(Type.String())),\n\torder: Type.Optional(Type.Array(Type.String())),\n});\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nconst ThinkingLevelMapSchema = Type.Object({\n\toff: Type.Optional(ThinkingLevelMapValueSchema),\n\tminimal: Type.Optional(ThinkingLevelMapValueSchema),\n\tlow: Type.Optional(ThinkingLevelMapValueSchema),\n\tmedium: Type.Optional(ThinkingLevelMapValueSchema),\n\thigh: Type.Optional(ThinkingLevelMapValueSchema),\n\txhigh: Type.Optional(ThinkingLevelMapValueSchema),\n});\nconst ContextWindowOptionsSchema = Type.Array(Type.Number());\nconst ChatTemplateKwargScalarSchema = Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()]);\nconst ChatTemplateKwargVariableSchema = Type.Object({\n\t$var: Type.Union([Type.Literal(\"thinking.enabled\"), Type.Literal(\"thinking.effort\")]),\n\tomitWhenOff: Type.Optional(Type.Boolean()),\n});\nconst ChatTemplateKwargSchema = Type.Union([ChatTemplateKwargScalarSchema, ChatTemplateKwargVariableSchema]);\n\nconst OpenAICompletionsCompatSchema = Type.Object({\n\tsupportsStore: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsReasoningEffort: Type.Optional(Type.Boolean()),\n\tsupportsUsageInStreaming: Type.Optional(Type.Boolean()),\n\tmaxTokensField: Type.Optional(Type.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")])),\n\trequiresToolResultName: Type.Optional(Type.Boolean()),\n\trequiresAssistantAfterToolResult: Type.Optional(Type.Boolean()),\n\trequiresThinkingAsText: Type.Optional(Type.Boolean()),\n\trequiresReasoningContentOnAssistantMessages: Type.Optional(Type.Boolean()),\n\tthinkingFormat: Type.Optional(\n\t\tType.Union([\n\t\t\tType.Literal(\"openai\"),\n\t\t\tType.Literal(\"openrouter\"),\n\t\t\tType.Literal(\"together\"),\n\t\t\tType.Literal(\"deepseek\"),\n\t\t\tType.Literal(\"zai\"),\n\t\t\tType.Literal(\"qwen\"),\n\t\t\tType.Literal(\"chat-template\"),\n\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t\tType.Literal(\"string-thinking\"),\n\t\t\tType.Literal(\"ant-ling\"),\n\t\t]),\n\t),\n\tchatTemplateKwargs: Type.Optional(Type.Record(Type.String(), ChatTemplateKwargSchema)),\n\tcacheControlFormat: Type.Optional(Type.Literal(\"anthropic\")),\n\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst OpenAIResponsesCompatSchema = Type.Object({\n\tsendSessionIdHeader: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst AnthropicMessagesCompatSchema = Type.Object({\n\tsupportsEagerToolInputStreaming: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tsupportsCacheControlOnTools: Type.Optional(Type.Boolean()),\n\tforceAdaptiveThinking: Type.Optional(Type.Boolean()),\n});\n\nconst ProviderCompatSchema = Type.Union([\n\tOpenAICompletionsCompatSchema,\n\tOpenAIResponsesCompatSchema,\n\tAnthropicMessagesCompatSchema,\n]);\n\nconst ModelDefinitionSchema = Type.Object({\n\tid: Type.String({ minLength: 1 }),\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Number(),\n\t\t\toutput: Type.Number(),\n\t\t\tcacheRead: Type.Number(),\n\t\t\tcacheWrite: Type.Number(),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ModelOverrideSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Optional(Type.Number()),\n\t\t\toutput: Type.Optional(Type.Number()),\n\t\t\tcacheRead: Type.Optional(Type.Number()),\n\t\t\tcacheWrite: Type.Optional(Type.Number()),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tcontextWindowOptions: Type.Optional(ContextWindowOptionsSchema),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nexport type ModelOverride = Static<typeof ModelOverrideSchema>;\n\nconst ProviderConfigSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\tapiKey: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\tcompat: Type.Optional(ProviderCompatSchema),\n\tauthHeader: Type.Optional(Type.Boolean()),\n\tmodels: Type.Optional(Type.Array(ModelDefinitionSchema)),\n\tmodelOverrides: Type.Optional(Type.Record(Type.String(), ModelOverrideSchema)),\n});\n\nconst ModelsConfigSchema = Type.Object({\n\tproviders: Type.Record(Type.String(), ProviderConfigSchema),\n});\n\nexport const validateModelsConfig = Compile(ModelsConfigSchema);\n\nexport type ModelsConfig = Static<typeof ModelsConfigSchema>;\n\nexport function formatValidationPath(error: TLocalizedValidationError): string {\n\tif (error.keyword === \"required\") {\n\t\tconst requiredProperties = (error.params as { requiredProperties?: string[] }).requiredProperties;\n\t\tconst requiredProperty = requiredProperties?.[0];\n\t\tif (requiredProperty) {\n\t\t\tconst basePath = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\t\t\treturn basePath ? `${basePath}.${requiredProperty}` : requiredProperty;\n\t\t}\n\t}\n\tconst path = error.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\");\n\treturn path || \"root\";\n}\n\nexport function stripJsonComments(input: string): string {\n\treturn input\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|\\/\\/[^\\n]*/g, (m) => (m[0] === '\"' ? m : \"\"))\n\t\t.replace(/\"(?:\\\\.|[^\"\\\\])*\"|,(\\s*[}\\]])/g, (m, tail) => tail ?? (m[0] === '\"' ? m : \"\"));\n}\n"]}
|
|
@@ -49,6 +49,7 @@ export declare class DefaultResourceLoader implements ResourceLoader {
|
|
|
49
49
|
private extensionThemeSourceInfos;
|
|
50
50
|
private lastPromptPaths;
|
|
51
51
|
private lastThemePaths;
|
|
52
|
+
private loaded;
|
|
52
53
|
constructor(options: DefaultResourceLoaderOptions);
|
|
53
54
|
getExtensions(): LoadExtensionsResult;
|
|
54
55
|
getSkills(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-loader-core.d.ts","sourceRoot":"","sources":["../../src/core/resource-loader-core.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAoB,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAWjE,OAAO,KAAK,EACX,wCAAwC,EACxC,4BAA4B,EAC5B,sBAAsB,EACtB,cAAc,EACd,2BAA2B,EAC3B,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,qBAAsB,YAAW,cAAc;IAC3D,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,wBAAwB,CAAW;IAC3C,OAAO,CAAC,oBAAoB,CAAW;IACvC,OAAO,CAAC,6BAA6B,CAAW;IAChD,OAAO,CAAC,oBAAoB,CAAW;IACvC,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,YAAY,CAAU;I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CAAA;KAAE,CAElE;IAED,UAAU,IAAI;QAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QAAC,WAAW,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAE7E;IAED,SAAS,IAAI;QAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,WAAW,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAElE;IAED,cAAc,IAAI;QAAE,WAAW,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAE1E;IAED,eAAe,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,qBAAqB,IAAI,MAAM,EAAE,CAEhC;IAED,oBAAoB,IAAI,gBAAgB,EAAE,CAEzC;IAED,sBAAsB,IAAI,wCAAwC,CAoBjE;IAEK,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAO5D;IAED,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAoBnD;IAEK,0BAA0B,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAEhE;IAEK,MAAM,CAAC,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;IAED,OAAO,CAAC,2BAA2B;CAenC","sourcesContent":["import { resolvePath } from \"../utils/paths.ts\";\nimport { createEventBus, type EventBus } from \"./event-bus.ts\";\nimport { createExtensionRuntime } from \"./extensions/loader.ts\";\nimport type { ExtensionFactory, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { DefaultPackageManager, type ResolvedResource } from \"./package-manager.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport { SettingsManager, type PackageSource } from \"./settings-manager.ts\";\nimport type { Skill } from \"./skills.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { Theme } from \"../modes/interactive/theme/theme.ts\";\nimport { updatePromptsFromPaths, updateSkillsFromPaths, updateThemesFromPaths } from \"./resource-loader-assets.ts\";\nimport { clonePackageSources, mergeInheritedStrings } from \"./resource-loader-helpers.ts\";\nimport {\n\tcollectWorkflowResources,\n\tnormalizeExtensionPaths,\n\trecordExtensionSourceInfo,\n\tresolvePackageResourcePaths,\n} from \"./resource-loader-package-resources.ts\";\nimport { mergeResourcePaths } from \"./resource-loader-paths.ts\";\nimport { loadProjectTrustExtensions, reloadDefaultResourceLoader } from \"./resource-loader-reload.ts\";\nimport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tDefaultResourceLoaderOptions,\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n} from \"./resource-loader-types.ts\";\n\nexport class DefaultResourceLoader implements ResourceLoader {\n\tprivate cwd: string;\n\tprivate agentDir: string;\n\tprivate settingsManager: SettingsManager;\n\tprivate eventBus: EventBus;\n\tprivate packageManager: DefaultPackageManager;\n\tprivate additionalExtensionPaths: string[];\n\tprivate additionalSkillPaths: string[];\n\tprivate additionalPromptTemplatePaths: string[];\n\tprivate additionalThemePaths: string[];\n\tprivate builtinPackagePaths: PackageSource[];\n\tprivate extensionFactories: ExtensionFactory[];\n\tprivate noExtensions: boolean;\n\tprivate noSkills: boolean;\n\tprivate noPromptTemplates: boolean;\n\tprivate noThemes: boolean;\n\tprivate noContextFiles: boolean;\n\tprivate systemPromptSource?: string;\n\tprivate appendSystemPromptSource?: string[];\n\tprivate extensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tprivate skillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate promptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate themesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate agentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tprivate systemPromptOverride?: (base: string | undefined) => string | undefined;\n\tprivate appendSystemPromptOverride?: (base: string[]) => string[];\n\tprivate extensionsResult: LoadExtensionsResult;\n\tprivate skills: Skill[];\n\tprivate skillDiagnostics: ResourceDiagnostic[];\n\tprivate prompts: PromptTemplate[];\n\tprivate promptDiagnostics: ResourceDiagnostic[];\n\tprivate themes: Theme[];\n\tprivate themeDiagnostics: ResourceDiagnostic[];\n\tprivate agentsFiles: Array<{ path: string; content: string }>;\n\tprivate systemPrompt?: string;\n\tprivate appendSystemPrompt: string[];\n\tprivate workflowResources: ResolvedResource[];\n\tprivate trustedBorrowedProjectLocalSources?: Set<string>;\n\tprivate lastSkillPaths: string[];\n\tprivate extensionSkillSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionPromptSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionThemeSourceInfos: Map<string, SourceInfo>;\n\tprivate lastPromptPaths: string[];\n\tprivate lastThemePaths: string[];\n\n\tconstructor(options: DefaultResourceLoaderOptions) {\n\t\tconst inheritanceSnapshot = options.resourceLoaderInheritanceSnapshot;\n\t\tconst inheritedSettingsOptions = inheritanceSnapshot?.projectTrusted === undefined\n\t\t\t? undefined\n\t\t\t: { projectTrusted: inheritanceSnapshot.projectTrusted };\n\t\tthis.cwd = resolvePath(options.cwd);\n\t\tthis.agentDir = resolvePath(options.agentDir);\n\t\tthis.settingsManager = options.settingsManager ?? SettingsManager.create(\n\t\t\tthis.cwd,\n\t\t\tthis.agentDir,\n\t\t\tinheritedSettingsOptions,\n\t\t);\n\t\tthis.eventBus = options.eventBus ?? createEventBus();\n\t\tthis.packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tthis.additionalExtensionPaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalExtensionPaths,\n\t\t\toptions.additionalExtensionPaths,\n\t\t);\n\t\tthis.additionalSkillPaths = mergeInheritedStrings(inheritanceSnapshot?.additionalSkillPaths, options.additionalSkillPaths);\n\t\tthis.additionalPromptTemplatePaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalPromptTemplatePaths,\n\t\t\toptions.additionalPromptTemplatePaths,\n\t\t);\n\t\tthis.additionalThemePaths = mergeInheritedStrings(inheritanceSnapshot?.additionalThemePaths, options.additionalThemePaths);\n\t\tthis.builtinPackagePaths = options.builtinPackagePaths !== undefined\n\t\t\t? clonePackageSources(options.builtinPackagePaths)\n\t\t\t: clonePackageSources(inheritanceSnapshot?.builtinPackagePaths);\n\t\tthis.extensionFactories = [...(inheritanceSnapshot?.extensionFactories ?? []), ...(options.extensionFactories ?? [])];\n\t\tthis.noExtensions = options.noExtensions ?? inheritanceSnapshot?.noExtensions ?? false;\n\t\tthis.noSkills = options.noSkills ?? inheritanceSnapshot?.noSkills ?? false;\n\t\tthis.noPromptTemplates = options.noPromptTemplates ?? inheritanceSnapshot?.noPromptTemplates ?? false;\n\t\tthis.noThemes = options.noThemes ?? inheritanceSnapshot?.noThemes ?? false;\n\t\tthis.noContextFiles = options.noContextFiles ?? inheritanceSnapshot?.noContextFiles ?? false;\n\t\tthis.systemPromptSource = options.systemPrompt ?? inheritanceSnapshot?.systemPrompt;\n\t\tthis.appendSystemPromptSource = options.appendSystemPrompt !== undefined\n\t\t\t? [...options.appendSystemPrompt]\n\t\t\t: inheritanceSnapshot?.appendSystemPrompt === undefined\n\t\t\t\t? undefined\n\t\t\t\t: [...inheritanceSnapshot.appendSystemPrompt];\n\t\tthis.extensionsOverride = options.extensionsOverride;\n\t\tthis.skillsOverride = options.skillsOverride;\n\t\tthis.promptsOverride = options.promptsOverride;\n\t\tthis.themesOverride = options.themesOverride;\n\t\tthis.agentsFilesOverride = options.agentsFilesOverride;\n\t\tthis.systemPromptOverride = options.systemPromptOverride;\n\t\tthis.appendSystemPromptOverride = options.appendSystemPromptOverride;\n\t\tthis.extensionsResult = { extensions: [], errors: [], runtime: createExtensionRuntime() };\n\t\tthis.skills = [];\n\t\tthis.skillDiagnostics = [];\n\t\tthis.prompts = [];\n\t\tthis.promptDiagnostics = [];\n\t\tthis.themes = [];\n\t\tthis.themeDiagnostics = [];\n\t\tthis.agentsFiles = [];\n\t\tthis.appendSystemPrompt = [];\n\t\tthis.workflowResources = [];\n\t\tthis.trustedBorrowedProjectLocalSources = inheritanceSnapshot?.trustedBorrowedProjectLocalSources === undefined\n\t\t\t? undefined\n\t\t\t: new Set(inheritanceSnapshot.trustedBorrowedProjectLocalSources);\n\t\tthis.lastSkillPaths = [];\n\t\tthis.extensionSkillSourceInfos = new Map();\n\t\tthis.extensionPromptSourceInfos = new Map();\n\t\tthis.extensionThemeSourceInfos = new Map();\n\t\tthis.lastPromptPaths = [];\n\t\tthis.lastThemePaths = [];\n\t\tthis.touchInternalFieldsForSplit();\n\t}\n\n\tgetExtensions(): LoadExtensionsResult {\n\t\treturn this.extensionsResult;\n\t}\n\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { skills: this.skills, diagnostics: this.skillDiagnostics };\n\t}\n\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { prompts: this.prompts, diagnostics: this.promptDiagnostics };\n\t}\n\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { themes: this.themes, diagnostics: this.themeDiagnostics };\n\t}\n\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> } {\n\t\treturn { agentsFiles: this.agentsFiles };\n\t}\n\n\tgetSystemPrompt(): string | undefined {\n\t\treturn this.systemPrompt;\n\t}\n\n\tgetAppendSystemPrompt(): string[] {\n\t\treturn this.appendSystemPrompt;\n\t}\n\n\tgetWorkflowResources(): ResolvedResource[] {\n\t\treturn [...this.workflowResources];\n\t}\n\n\tgetInheritanceSnapshot(): DefaultResourceLoaderInheritanceSnapshot {\n\t\treturn {\n\t\t\tprojectTrusted: this.settingsManager.isProjectTrusted(),\n\t\t\tadditionalExtensionPaths: [...this.additionalExtensionPaths],\n\t\t\tadditionalSkillPaths: [...this.additionalSkillPaths],\n\t\t\tadditionalPromptTemplatePaths: [...this.additionalPromptTemplatePaths],\n\t\t\tadditionalThemePaths: [...this.additionalThemePaths],\n\t\t\tbuiltinPackagePaths: clonePackageSources(this.builtinPackagePaths),\n\t\t\textensionFactories: [...this.extensionFactories],\n\t\t\tnoExtensions: this.noExtensions,\n\t\t\tnoSkills: this.noSkills,\n\t\t\tnoPromptTemplates: this.noPromptTemplates,\n\t\t\tnoThemes: this.noThemes,\n\t\t\tnoContextFiles: this.noContextFiles,\n\t\t\t...(this.systemPromptSource === undefined ? {} : { systemPrompt: this.systemPromptSource }),\n\t\t\t...(this.appendSystemPromptSource === undefined ? {} : { appendSystemPrompt: [...this.appendSystemPromptSource] }),\n\t\t\t...(this.trustedBorrowedProjectLocalSources === undefined\n\t\t\t\t? {}\n\t\t\t\t: { trustedBorrowedProjectLocalSources: [...this.trustedBorrowedProjectLocalSources] }),\n\t\t};\n\t}\n\n\tasync refreshWorkflowResources(): Promise<ResolvedResource[]> {\n\t\tconst { resolvedPaths, cliExtensionPaths, builtinPackagePaths } = await resolvePackageResourcePaths(this, {\n\t\t\ttrustedBorrowedProjectLocalSources: this.trustedBorrowedProjectLocalSources,\n\t\t});\n\t\tconst workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);\n\t\tthis.workflowResources = workflowResources;\n\t\treturn [...this.workflowResources];\n\t}\n\n\textendResources(paths: ResourceExtensionPaths): void {\n\t\tconst skillPaths = normalizeExtensionPaths(this, paths.skillPaths ?? []);\n\t\tconst promptPaths = normalizeExtensionPaths(this, paths.promptPaths ?? []);\n\t\tconst themePaths = normalizeExtensionPaths(this, paths.themePaths ?? []);\n\t\trecordExtensionSourceInfo(this, skillPaths, \"skill\");\n\t\trecordExtensionSourceInfo(this, promptPaths, \"prompt\");\n\t\trecordExtensionSourceInfo(this, themePaths, \"theme\");\n\n\t\tif (skillPaths.length > 0) {\n\t\t\tthis.lastSkillPaths = mergeResourcePaths(this.cwd, this.lastSkillPaths, skillPaths.map((entry) => entry.path));\n\t\t\tupdateSkillsFromPaths(this, this.lastSkillPaths);\n\t\t}\n\t\tif (promptPaths.length > 0) {\n\t\t\tthis.lastPromptPaths = mergeResourcePaths(this.cwd, this.lastPromptPaths, promptPaths.map((entry) => entry.path));\n\t\t\tupdatePromptsFromPaths(this, this.lastPromptPaths);\n\t\t}\n\t\tif (themePaths.length > 0) {\n\t\t\tthis.lastThemePaths = mergeResourcePaths(this.cwd, this.lastThemePaths, themePaths.map((entry) => entry.path));\n\t\t\tupdateThemesFromPaths(this, this.lastThemePaths);\n\t\t}\n\t}\n\n\tasync loadProjectTrustExtensions(): Promise<LoadExtensionsResult> {\n\t\treturn loadProjectTrustExtensions(this);\n\t}\n\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\treturn reloadDefaultResourceLoader(this, options);\n\t}\n\n\tprivate touchInternalFieldsForSplit(): void {\n\t\tvoid this.eventBus;\n\t\tvoid this.packageManager;\n\t\tvoid this.noContextFiles;\n\t\tvoid this.extensionsOverride;\n\t\tvoid this.skillsOverride;\n\t\tvoid this.promptsOverride;\n\t\tvoid this.themesOverride;\n\t\tvoid this.agentsFilesOverride;\n\t\tvoid this.systemPromptOverride;\n\t\tvoid this.appendSystemPromptOverride;\n\t\tvoid this.extensionSkillSourceInfos;\n\t\tvoid this.extensionPromptSourceInfos;\n\t\tvoid this.extensionThemeSourceInfos;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resource-loader-core.d.ts","sourceRoot":"","sources":["../../src/core/resource-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AE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAE1E;IAED,eAAe,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,qBAAqB,IAAI,MAAM,EAAE,CAEhC;IAED,oBAAoB,IAAI,gBAAgB,EAAE,CAEzC;IAED,sBAAsB,IAAI,wCAAwC,CAoBjE;IAEK,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAO5D;IAED,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAoBnD;IAEK,0BAA0B,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAEhE;IAEK,MAAM,CAAC,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;IAED,OAAO,CAAC,2BAA2B;CAgBnC","sourcesContent":["import { resolvePath } from \"../utils/paths.ts\";\nimport { createEventBus, type EventBus } from \"./event-bus.ts\";\nimport { createExtensionRuntime } from \"./extensions/loader.ts\";\nimport type { ExtensionFactory, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { DefaultPackageManager, type ResolvedResource } from \"./package-manager.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport { SettingsManager, type PackageSource } from \"./settings-manager.ts\";\nimport type { Skill } from \"./skills.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { Theme } from \"../modes/interactive/theme/theme.ts\";\nimport { updatePromptsFromPaths, updateSkillsFromPaths, updateThemesFromPaths } from \"./resource-loader-assets.ts\";\nimport { clonePackageSources, mergeInheritedStrings } from \"./resource-loader-helpers.ts\";\nimport {\n\tcollectWorkflowResources,\n\tnormalizeExtensionPaths,\n\trecordExtensionSourceInfo,\n\tresolvePackageResourcePaths,\n} from \"./resource-loader-package-resources.ts\";\nimport { mergeResourcePaths } from \"./resource-loader-paths.ts\";\nimport { loadProjectTrustExtensions, reloadDefaultResourceLoader } from \"./resource-loader-reload.ts\";\nimport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tDefaultResourceLoaderOptions,\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n} from \"./resource-loader-types.ts\";\n\nexport class DefaultResourceLoader implements ResourceLoader {\n\tprivate cwd: string;\n\tprivate agentDir: string;\n\tprivate settingsManager: SettingsManager;\n\tprivate eventBus: EventBus;\n\tprivate packageManager: DefaultPackageManager;\n\tprivate additionalExtensionPaths: string[];\n\tprivate additionalSkillPaths: string[];\n\tprivate additionalPromptTemplatePaths: string[];\n\tprivate additionalThemePaths: string[];\n\tprivate builtinPackagePaths: PackageSource[];\n\tprivate extensionFactories: ExtensionFactory[];\n\tprivate noExtensions: boolean;\n\tprivate noSkills: boolean;\n\tprivate noPromptTemplates: boolean;\n\tprivate noThemes: boolean;\n\tprivate noContextFiles: boolean;\n\tprivate systemPromptSource?: string;\n\tprivate appendSystemPromptSource?: string[];\n\tprivate extensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tprivate skillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate promptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate themesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate agentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tprivate systemPromptOverride?: (base: string | undefined) => string | undefined;\n\tprivate appendSystemPromptOverride?: (base: string[]) => string[];\n\tprivate extensionsResult: LoadExtensionsResult;\n\tprivate skills: Skill[];\n\tprivate skillDiagnostics: ResourceDiagnostic[];\n\tprivate prompts: PromptTemplate[];\n\tprivate promptDiagnostics: ResourceDiagnostic[];\n\tprivate themes: Theme[];\n\tprivate themeDiagnostics: ResourceDiagnostic[];\n\tprivate agentsFiles: Array<{ path: string; content: string }>;\n\tprivate systemPrompt?: string;\n\tprivate appendSystemPrompt: string[];\n\tprivate workflowResources: ResolvedResource[];\n\tprivate trustedBorrowedProjectLocalSources?: Set<string>;\n\tprivate lastSkillPaths: string[];\n\tprivate extensionSkillSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionPromptSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionThemeSourceInfos: Map<string, SourceInfo>;\n\tprivate lastPromptPaths: string[];\n\tprivate lastThemePaths: string[];\n\tprivate loaded: boolean;\n\n\tconstructor(options: DefaultResourceLoaderOptions) {\n\t\tconst inheritanceSnapshot = options.resourceLoaderInheritanceSnapshot;\n\t\tconst inheritedSettingsOptions = inheritanceSnapshot?.projectTrusted === undefined\n\t\t\t? undefined\n\t\t\t: { projectTrusted: inheritanceSnapshot.projectTrusted };\n\t\tthis.cwd = resolvePath(options.cwd);\n\t\tthis.agentDir = resolvePath(options.agentDir);\n\t\tthis.settingsManager = options.settingsManager ?? SettingsManager.create(\n\t\t\tthis.cwd,\n\t\t\tthis.agentDir,\n\t\t\tinheritedSettingsOptions,\n\t\t);\n\t\tthis.eventBus = options.eventBus ?? createEventBus();\n\t\tthis.packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tthis.additionalExtensionPaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalExtensionPaths,\n\t\t\toptions.additionalExtensionPaths,\n\t\t);\n\t\tthis.additionalSkillPaths = mergeInheritedStrings(inheritanceSnapshot?.additionalSkillPaths, options.additionalSkillPaths);\n\t\tthis.additionalPromptTemplatePaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalPromptTemplatePaths,\n\t\t\toptions.additionalPromptTemplatePaths,\n\t\t);\n\t\tthis.additionalThemePaths = mergeInheritedStrings(inheritanceSnapshot?.additionalThemePaths, options.additionalThemePaths);\n\t\tthis.builtinPackagePaths = options.builtinPackagePaths !== undefined\n\t\t\t? clonePackageSources(options.builtinPackagePaths)\n\t\t\t: clonePackageSources(inheritanceSnapshot?.builtinPackagePaths);\n\t\tthis.extensionFactories = [...(inheritanceSnapshot?.extensionFactories ?? []), ...(options.extensionFactories ?? [])];\n\t\tthis.noExtensions = options.noExtensions ?? inheritanceSnapshot?.noExtensions ?? false;\n\t\tthis.noSkills = options.noSkills ?? inheritanceSnapshot?.noSkills ?? false;\n\t\tthis.noPromptTemplates = options.noPromptTemplates ?? inheritanceSnapshot?.noPromptTemplates ?? false;\n\t\tthis.noThemes = options.noThemes ?? inheritanceSnapshot?.noThemes ?? false;\n\t\tthis.noContextFiles = options.noContextFiles ?? inheritanceSnapshot?.noContextFiles ?? false;\n\t\tthis.systemPromptSource = options.systemPrompt ?? inheritanceSnapshot?.systemPrompt;\n\t\tthis.appendSystemPromptSource = options.appendSystemPrompt !== undefined\n\t\t\t? [...options.appendSystemPrompt]\n\t\t\t: inheritanceSnapshot?.appendSystemPrompt === undefined\n\t\t\t\t? undefined\n\t\t\t\t: [...inheritanceSnapshot.appendSystemPrompt];\n\t\tthis.extensionsOverride = options.extensionsOverride;\n\t\tthis.skillsOverride = options.skillsOverride;\n\t\tthis.promptsOverride = options.promptsOverride;\n\t\tthis.themesOverride = options.themesOverride;\n\t\tthis.agentsFilesOverride = options.agentsFilesOverride;\n\t\tthis.systemPromptOverride = options.systemPromptOverride;\n\t\tthis.appendSystemPromptOverride = options.appendSystemPromptOverride;\n\t\tthis.extensionsResult = { extensions: [], errors: [], runtime: createExtensionRuntime() };\n\t\tthis.skills = [];\n\t\tthis.skillDiagnostics = [];\n\t\tthis.prompts = [];\n\t\tthis.promptDiagnostics = [];\n\t\tthis.themes = [];\n\t\tthis.themeDiagnostics = [];\n\t\tthis.agentsFiles = [];\n\t\tthis.appendSystemPrompt = [];\n\t\tthis.workflowResources = [];\n\t\tthis.trustedBorrowedProjectLocalSources = inheritanceSnapshot?.trustedBorrowedProjectLocalSources === undefined\n\t\t\t? undefined\n\t\t\t: new Set(inheritanceSnapshot.trustedBorrowedProjectLocalSources);\n\t\tthis.lastSkillPaths = [];\n\t\tthis.extensionSkillSourceInfos = new Map();\n\t\tthis.extensionPromptSourceInfos = new Map();\n\t\tthis.extensionThemeSourceInfos = new Map();\n\t\tthis.lastPromptPaths = [];\n\t\tthis.lastThemePaths = [];\n\t\tthis.loaded = false;\n\t\tthis.touchInternalFieldsForSplit();\n\t}\n\n\tgetExtensions(): LoadExtensionsResult {\n\t\treturn this.extensionsResult;\n\t}\n\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { skills: this.skills, diagnostics: this.skillDiagnostics };\n\t}\n\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { prompts: this.prompts, diagnostics: this.promptDiagnostics };\n\t}\n\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { themes: this.themes, diagnostics: this.themeDiagnostics };\n\t}\n\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> } {\n\t\treturn { agentsFiles: this.agentsFiles };\n\t}\n\n\tgetSystemPrompt(): string | undefined {\n\t\treturn this.systemPrompt;\n\t}\n\n\tgetAppendSystemPrompt(): string[] {\n\t\treturn this.appendSystemPrompt;\n\t}\n\n\tgetWorkflowResources(): ResolvedResource[] {\n\t\treturn [...this.workflowResources];\n\t}\n\n\tgetInheritanceSnapshot(): DefaultResourceLoaderInheritanceSnapshot {\n\t\treturn {\n\t\t\tprojectTrusted: this.settingsManager.isProjectTrusted(),\n\t\t\tadditionalExtensionPaths: [...this.additionalExtensionPaths],\n\t\t\tadditionalSkillPaths: [...this.additionalSkillPaths],\n\t\t\tadditionalPromptTemplatePaths: [...this.additionalPromptTemplatePaths],\n\t\t\tadditionalThemePaths: [...this.additionalThemePaths],\n\t\t\tbuiltinPackagePaths: clonePackageSources(this.builtinPackagePaths),\n\t\t\textensionFactories: [...this.extensionFactories],\n\t\t\tnoExtensions: this.noExtensions,\n\t\t\tnoSkills: this.noSkills,\n\t\t\tnoPromptTemplates: this.noPromptTemplates,\n\t\t\tnoThemes: this.noThemes,\n\t\t\tnoContextFiles: this.noContextFiles,\n\t\t\t...(this.systemPromptSource === undefined ? {} : { systemPrompt: this.systemPromptSource }),\n\t\t\t...(this.appendSystemPromptSource === undefined ? {} : { appendSystemPrompt: [...this.appendSystemPromptSource] }),\n\t\t\t...(this.trustedBorrowedProjectLocalSources === undefined\n\t\t\t\t? {}\n\t\t\t\t: { trustedBorrowedProjectLocalSources: [...this.trustedBorrowedProjectLocalSources] }),\n\t\t};\n\t}\n\n\tasync refreshWorkflowResources(): Promise<ResolvedResource[]> {\n\t\tconst { resolvedPaths, cliExtensionPaths, builtinPackagePaths } = await resolvePackageResourcePaths(this, {\n\t\t\ttrustedBorrowedProjectLocalSources: this.trustedBorrowedProjectLocalSources,\n\t\t});\n\t\tconst workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);\n\t\tthis.workflowResources = workflowResources;\n\t\treturn [...this.workflowResources];\n\t}\n\n\textendResources(paths: ResourceExtensionPaths): void {\n\t\tconst skillPaths = normalizeExtensionPaths(this, paths.skillPaths ?? []);\n\t\tconst promptPaths = normalizeExtensionPaths(this, paths.promptPaths ?? []);\n\t\tconst themePaths = normalizeExtensionPaths(this, paths.themePaths ?? []);\n\t\trecordExtensionSourceInfo(this, skillPaths, \"skill\");\n\t\trecordExtensionSourceInfo(this, promptPaths, \"prompt\");\n\t\trecordExtensionSourceInfo(this, themePaths, \"theme\");\n\n\t\tif (skillPaths.length > 0) {\n\t\t\tthis.lastSkillPaths = mergeResourcePaths(this.cwd, this.lastSkillPaths, skillPaths.map((entry) => entry.path));\n\t\t\tupdateSkillsFromPaths(this, this.lastSkillPaths);\n\t\t}\n\t\tif (promptPaths.length > 0) {\n\t\t\tthis.lastPromptPaths = mergeResourcePaths(this.cwd, this.lastPromptPaths, promptPaths.map((entry) => entry.path));\n\t\t\tupdatePromptsFromPaths(this, this.lastPromptPaths);\n\t\t}\n\t\tif (themePaths.length > 0) {\n\t\t\tthis.lastThemePaths = mergeResourcePaths(this.cwd, this.lastThemePaths, themePaths.map((entry) => entry.path));\n\t\t\tupdateThemesFromPaths(this, this.lastThemePaths);\n\t\t}\n\t}\n\n\tasync loadProjectTrustExtensions(): Promise<LoadExtensionsResult> {\n\t\treturn loadProjectTrustExtensions(this);\n\t}\n\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\treturn reloadDefaultResourceLoader(this, options);\n\t}\n\n\tprivate touchInternalFieldsForSplit(): void {\n\t\tvoid this.eventBus;\n\t\tvoid this.packageManager;\n\t\tvoid this.noContextFiles;\n\t\tvoid this.extensionsOverride;\n\t\tvoid this.skillsOverride;\n\t\tvoid this.promptsOverride;\n\t\tvoid this.themesOverride;\n\t\tvoid this.agentsFilesOverride;\n\t\tvoid this.systemPromptOverride;\n\t\tvoid this.appendSystemPromptOverride;\n\t\tvoid this.extensionSkillSourceInfos;\n\t\tvoid this.extensionPromptSourceInfos;\n\t\tvoid this.extensionThemeSourceInfos;\n\t\tvoid this.loaded;\n\t}\n}\n"]}
|
|
@@ -68,6 +68,7 @@ export class DefaultResourceLoader {
|
|
|
68
68
|
this.extensionThemeSourceInfos = new Map();
|
|
69
69
|
this.lastPromptPaths = [];
|
|
70
70
|
this.lastThemePaths = [];
|
|
71
|
+
this.loaded = false;
|
|
71
72
|
this.touchInternalFieldsForSplit();
|
|
72
73
|
}
|
|
73
74
|
getExtensions() {
|
|
@@ -163,6 +164,7 @@ export class DefaultResourceLoader {
|
|
|
163
164
|
void this.extensionSkillSourceInfos;
|
|
164
165
|
void this.extensionPromptSourceInfos;
|
|
165
166
|
void this.extensionThemeSourceInfos;
|
|
167
|
+
void this.loaded;
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
//# sourceMappingURL=resource-loader-core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-loader-core.js","sourceRoot":"","sources":["../../src/core/resource-loader-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAyB,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EAAE,eAAe,EAAsB,MAAM,uBAAuB,CAAC;AAK5E,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACnH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EACN,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,GAC3B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAStG,MAAM,OAAO,qBAAqB;IAwDjC,YAAY,OAAqC;QAChD,MAAM,mBAAmB,GAAG,OAAO,CAAC,iCAAiC,CAAC;QACtE,MAAM,wBAAwB,GAAG,mBAAmB,EAAE,cAAc,KAAK,SAAS;YACjF,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,cAAc,EAAE,mBAAmB,CAAC,cAAc,EAAE,CAAC;QAC1D,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACpC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QAClC,KAAK,IAAI,CAAC,QAAQ,CAAC;QACnB,KAAK,IAAI,CAAC,cAAc,CAAC;QACzB,KAAK,IAAI,CAAC,cAAc,CAAC;QACzB,KAAK,IAAI,CAAC,kBAAkB,CAAC;QAC7B,KAAK,IAAI,CAAC,cAAc,CAAC;QACzB,KAAK,IAAI,CAAC,eAAe,CAAC;QAC1B,KAAK,IAAI,CAAC,cAAc,CAAC;QACzB,KAAK,IAAI,CAAC,mBAAmB,CAAC;QAC9B,KAAK,IAAI,CAAC,oBAAoB,CAAC;QAC/B,KAAK,IAAI,CAAC,0BAA0B,CAAC;QACrC,KAAK,IAAI,CAAC,yBAAyB,CAAC;QACpC,KAAK,IAAI,CAAC,0BAA0B,CAAC;QACrC,KAAK,IAAI,CAAC,yBAAyB,CAAC;IACrC,CAAC;CACD","sourcesContent":["import { resolvePath } from \"../utils/paths.ts\";\nimport { createEventBus, type EventBus } from \"./event-bus.ts\";\nimport { createExtensionRuntime } from \"./extensions/loader.ts\";\nimport type { ExtensionFactory, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { DefaultPackageManager, type ResolvedResource } from \"./package-manager.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport { SettingsManager, type PackageSource } from \"./settings-manager.ts\";\nimport type { Skill } from \"./skills.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { Theme } from \"../modes/interactive/theme/theme.ts\";\nimport { updatePromptsFromPaths, updateSkillsFromPaths, updateThemesFromPaths } from \"./resource-loader-assets.ts\";\nimport { clonePackageSources, mergeInheritedStrings } from \"./resource-loader-helpers.ts\";\nimport {\n\tcollectWorkflowResources,\n\tnormalizeExtensionPaths,\n\trecordExtensionSourceInfo,\n\tresolvePackageResourcePaths,\n} from \"./resource-loader-package-resources.ts\";\nimport { mergeResourcePaths } from \"./resource-loader-paths.ts\";\nimport { loadProjectTrustExtensions, reloadDefaultResourceLoader } from \"./resource-loader-reload.ts\";\nimport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tDefaultResourceLoaderOptions,\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n} from \"./resource-loader-types.ts\";\n\nexport class DefaultResourceLoader implements ResourceLoader {\n\tprivate cwd: string;\n\tprivate agentDir: string;\n\tprivate settingsManager: SettingsManager;\n\tprivate eventBus: EventBus;\n\tprivate packageManager: DefaultPackageManager;\n\tprivate additionalExtensionPaths: string[];\n\tprivate additionalSkillPaths: string[];\n\tprivate additionalPromptTemplatePaths: string[];\n\tprivate additionalThemePaths: string[];\n\tprivate builtinPackagePaths: PackageSource[];\n\tprivate extensionFactories: ExtensionFactory[];\n\tprivate noExtensions: boolean;\n\tprivate noSkills: boolean;\n\tprivate noPromptTemplates: boolean;\n\tprivate noThemes: boolean;\n\tprivate noContextFiles: boolean;\n\tprivate systemPromptSource?: string;\n\tprivate appendSystemPromptSource?: string[];\n\tprivate extensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tprivate skillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate promptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate themesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate agentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tprivate systemPromptOverride?: (base: string | undefined) => string | undefined;\n\tprivate appendSystemPromptOverride?: (base: string[]) => string[];\n\tprivate extensionsResult: LoadExtensionsResult;\n\tprivate skills: Skill[];\n\tprivate skillDiagnostics: ResourceDiagnostic[];\n\tprivate prompts: PromptTemplate[];\n\tprivate promptDiagnostics: ResourceDiagnostic[];\n\tprivate themes: Theme[];\n\tprivate themeDiagnostics: ResourceDiagnostic[];\n\tprivate agentsFiles: Array<{ path: string; content: string }>;\n\tprivate systemPrompt?: string;\n\tprivate appendSystemPrompt: string[];\n\tprivate workflowResources: ResolvedResource[];\n\tprivate trustedBorrowedProjectLocalSources?: Set<string>;\n\tprivate lastSkillPaths: string[];\n\tprivate extensionSkillSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionPromptSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionThemeSourceInfos: Map<string, SourceInfo>;\n\tprivate lastPromptPaths: string[];\n\tprivate lastThemePaths: string[];\n\n\tconstructor(options: DefaultResourceLoaderOptions) {\n\t\tconst inheritanceSnapshot = options.resourceLoaderInheritanceSnapshot;\n\t\tconst inheritedSettingsOptions = inheritanceSnapshot?.projectTrusted === undefined\n\t\t\t? undefined\n\t\t\t: { projectTrusted: inheritanceSnapshot.projectTrusted };\n\t\tthis.cwd = resolvePath(options.cwd);\n\t\tthis.agentDir = resolvePath(options.agentDir);\n\t\tthis.settingsManager = options.settingsManager ?? SettingsManager.create(\n\t\t\tthis.cwd,\n\t\t\tthis.agentDir,\n\t\t\tinheritedSettingsOptions,\n\t\t);\n\t\tthis.eventBus = options.eventBus ?? createEventBus();\n\t\tthis.packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tthis.additionalExtensionPaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalExtensionPaths,\n\t\t\toptions.additionalExtensionPaths,\n\t\t);\n\t\tthis.additionalSkillPaths = mergeInheritedStrings(inheritanceSnapshot?.additionalSkillPaths, options.additionalSkillPaths);\n\t\tthis.additionalPromptTemplatePaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalPromptTemplatePaths,\n\t\t\toptions.additionalPromptTemplatePaths,\n\t\t);\n\t\tthis.additionalThemePaths = mergeInheritedStrings(inheritanceSnapshot?.additionalThemePaths, options.additionalThemePaths);\n\t\tthis.builtinPackagePaths = options.builtinPackagePaths !== undefined\n\t\t\t? clonePackageSources(options.builtinPackagePaths)\n\t\t\t: clonePackageSources(inheritanceSnapshot?.builtinPackagePaths);\n\t\tthis.extensionFactories = [...(inheritanceSnapshot?.extensionFactories ?? []), ...(options.extensionFactories ?? [])];\n\t\tthis.noExtensions = options.noExtensions ?? inheritanceSnapshot?.noExtensions ?? false;\n\t\tthis.noSkills = options.noSkills ?? inheritanceSnapshot?.noSkills ?? false;\n\t\tthis.noPromptTemplates = options.noPromptTemplates ?? inheritanceSnapshot?.noPromptTemplates ?? false;\n\t\tthis.noThemes = options.noThemes ?? inheritanceSnapshot?.noThemes ?? false;\n\t\tthis.noContextFiles = options.noContextFiles ?? inheritanceSnapshot?.noContextFiles ?? false;\n\t\tthis.systemPromptSource = options.systemPrompt ?? inheritanceSnapshot?.systemPrompt;\n\t\tthis.appendSystemPromptSource = options.appendSystemPrompt !== undefined\n\t\t\t? [...options.appendSystemPrompt]\n\t\t\t: inheritanceSnapshot?.appendSystemPrompt === undefined\n\t\t\t\t? undefined\n\t\t\t\t: [...inheritanceSnapshot.appendSystemPrompt];\n\t\tthis.extensionsOverride = options.extensionsOverride;\n\t\tthis.skillsOverride = options.skillsOverride;\n\t\tthis.promptsOverride = options.promptsOverride;\n\t\tthis.themesOverride = options.themesOverride;\n\t\tthis.agentsFilesOverride = options.agentsFilesOverride;\n\t\tthis.systemPromptOverride = options.systemPromptOverride;\n\t\tthis.appendSystemPromptOverride = options.appendSystemPromptOverride;\n\t\tthis.extensionsResult = { extensions: [], errors: [], runtime: createExtensionRuntime() };\n\t\tthis.skills = [];\n\t\tthis.skillDiagnostics = [];\n\t\tthis.prompts = [];\n\t\tthis.promptDiagnostics = [];\n\t\tthis.themes = [];\n\t\tthis.themeDiagnostics = [];\n\t\tthis.agentsFiles = [];\n\t\tthis.appendSystemPrompt = [];\n\t\tthis.workflowResources = [];\n\t\tthis.trustedBorrowedProjectLocalSources = inheritanceSnapshot?.trustedBorrowedProjectLocalSources === undefined\n\t\t\t? undefined\n\t\t\t: new Set(inheritanceSnapshot.trustedBorrowedProjectLocalSources);\n\t\tthis.lastSkillPaths = [];\n\t\tthis.extensionSkillSourceInfos = new Map();\n\t\tthis.extensionPromptSourceInfos = new Map();\n\t\tthis.extensionThemeSourceInfos = new Map();\n\t\tthis.lastPromptPaths = [];\n\t\tthis.lastThemePaths = [];\n\t\tthis.touchInternalFieldsForSplit();\n\t}\n\n\tgetExtensions(): LoadExtensionsResult {\n\t\treturn this.extensionsResult;\n\t}\n\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { skills: this.skills, diagnostics: this.skillDiagnostics };\n\t}\n\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { prompts: this.prompts, diagnostics: this.promptDiagnostics };\n\t}\n\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { themes: this.themes, diagnostics: this.themeDiagnostics };\n\t}\n\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> } {\n\t\treturn { agentsFiles: this.agentsFiles };\n\t}\n\n\tgetSystemPrompt(): string | undefined {\n\t\treturn this.systemPrompt;\n\t}\n\n\tgetAppendSystemPrompt(): string[] {\n\t\treturn this.appendSystemPrompt;\n\t}\n\n\tgetWorkflowResources(): ResolvedResource[] {\n\t\treturn [...this.workflowResources];\n\t}\n\n\tgetInheritanceSnapshot(): DefaultResourceLoaderInheritanceSnapshot {\n\t\treturn {\n\t\t\tprojectTrusted: this.settingsManager.isProjectTrusted(),\n\t\t\tadditionalExtensionPaths: [...this.additionalExtensionPaths],\n\t\t\tadditionalSkillPaths: [...this.additionalSkillPaths],\n\t\t\tadditionalPromptTemplatePaths: [...this.additionalPromptTemplatePaths],\n\t\t\tadditionalThemePaths: [...this.additionalThemePaths],\n\t\t\tbuiltinPackagePaths: clonePackageSources(this.builtinPackagePaths),\n\t\t\textensionFactories: [...this.extensionFactories],\n\t\t\tnoExtensions: this.noExtensions,\n\t\t\tnoSkills: this.noSkills,\n\t\t\tnoPromptTemplates: this.noPromptTemplates,\n\t\t\tnoThemes: this.noThemes,\n\t\t\tnoContextFiles: this.noContextFiles,\n\t\t\t...(this.systemPromptSource === undefined ? {} : { systemPrompt: this.systemPromptSource }),\n\t\t\t...(this.appendSystemPromptSource === undefined ? {} : { appendSystemPrompt: [...this.appendSystemPromptSource] }),\n\t\t\t...(this.trustedBorrowedProjectLocalSources === undefined\n\t\t\t\t? {}\n\t\t\t\t: { trustedBorrowedProjectLocalSources: [...this.trustedBorrowedProjectLocalSources] }),\n\t\t};\n\t}\n\n\tasync refreshWorkflowResources(): Promise<ResolvedResource[]> {\n\t\tconst { resolvedPaths, cliExtensionPaths, builtinPackagePaths } = await resolvePackageResourcePaths(this, {\n\t\t\ttrustedBorrowedProjectLocalSources: this.trustedBorrowedProjectLocalSources,\n\t\t});\n\t\tconst workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);\n\t\tthis.workflowResources = workflowResources;\n\t\treturn [...this.workflowResources];\n\t}\n\n\textendResources(paths: ResourceExtensionPaths): void {\n\t\tconst skillPaths = normalizeExtensionPaths(this, paths.skillPaths ?? []);\n\t\tconst promptPaths = normalizeExtensionPaths(this, paths.promptPaths ?? []);\n\t\tconst themePaths = normalizeExtensionPaths(this, paths.themePaths ?? []);\n\t\trecordExtensionSourceInfo(this, skillPaths, \"skill\");\n\t\trecordExtensionSourceInfo(this, promptPaths, \"prompt\");\n\t\trecordExtensionSourceInfo(this, themePaths, \"theme\");\n\n\t\tif (skillPaths.length > 0) {\n\t\t\tthis.lastSkillPaths = mergeResourcePaths(this.cwd, this.lastSkillPaths, skillPaths.map((entry) => entry.path));\n\t\t\tupdateSkillsFromPaths(this, this.lastSkillPaths);\n\t\t}\n\t\tif (promptPaths.length > 0) {\n\t\t\tthis.lastPromptPaths = mergeResourcePaths(this.cwd, this.lastPromptPaths, promptPaths.map((entry) => entry.path));\n\t\t\tupdatePromptsFromPaths(this, this.lastPromptPaths);\n\t\t}\n\t\tif (themePaths.length > 0) {\n\t\t\tthis.lastThemePaths = mergeResourcePaths(this.cwd, this.lastThemePaths, themePaths.map((entry) => entry.path));\n\t\t\tupdateThemesFromPaths(this, this.lastThemePaths);\n\t\t}\n\t}\n\n\tasync loadProjectTrustExtensions(): Promise<LoadExtensionsResult> {\n\t\treturn loadProjectTrustExtensions(this);\n\t}\n\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\treturn reloadDefaultResourceLoader(this, options);\n\t}\n\n\tprivate touchInternalFieldsForSplit(): void {\n\t\tvoid this.eventBus;\n\t\tvoid this.packageManager;\n\t\tvoid this.noContextFiles;\n\t\tvoid this.extensionsOverride;\n\t\tvoid this.skillsOverride;\n\t\tvoid this.promptsOverride;\n\t\tvoid this.themesOverride;\n\t\tvoid this.agentsFilesOverride;\n\t\tvoid this.systemPromptOverride;\n\t\tvoid this.appendSystemPromptOverride;\n\t\tvoid this.extensionSkillSourceInfos;\n\t\tvoid this.extensionPromptSourceInfos;\n\t\tvoid this.extensionThemeSourceInfos;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resource-loader-core.js","sourceRoot":"","sources":["../../src/core/resource-loader-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAyB,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EAAE,eAAe,EAAsB,MAAM,uBAAuB,CAAC;AAK5E,OAAO,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AAI,CAAC,MAAM,CAAC;IAClB,CAAC;CACD","sourcesContent":["import { resolvePath } from \"../utils/paths.ts\";\nimport { createEventBus, type EventBus } from \"./event-bus.ts\";\nimport { createExtensionRuntime } from \"./extensions/loader.ts\";\nimport type { ExtensionFactory, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { DefaultPackageManager, type ResolvedResource } from \"./package-manager.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport { SettingsManager, type PackageSource } from \"./settings-manager.ts\";\nimport type { Skill } from \"./skills.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { Theme } from \"../modes/interactive/theme/theme.ts\";\nimport { updatePromptsFromPaths, updateSkillsFromPaths, updateThemesFromPaths } from \"./resource-loader-assets.ts\";\nimport { clonePackageSources, mergeInheritedStrings } from \"./resource-loader-helpers.ts\";\nimport {\n\tcollectWorkflowResources,\n\tnormalizeExtensionPaths,\n\trecordExtensionSourceInfo,\n\tresolvePackageResourcePaths,\n} from \"./resource-loader-package-resources.ts\";\nimport { mergeResourcePaths } from \"./resource-loader-paths.ts\";\nimport { loadProjectTrustExtensions, reloadDefaultResourceLoader } from \"./resource-loader-reload.ts\";\nimport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tDefaultResourceLoaderOptions,\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n} from \"./resource-loader-types.ts\";\n\nexport class DefaultResourceLoader implements ResourceLoader {\n\tprivate cwd: string;\n\tprivate agentDir: string;\n\tprivate settingsManager: SettingsManager;\n\tprivate eventBus: EventBus;\n\tprivate packageManager: DefaultPackageManager;\n\tprivate additionalExtensionPaths: string[];\n\tprivate additionalSkillPaths: string[];\n\tprivate additionalPromptTemplatePaths: string[];\n\tprivate additionalThemePaths: string[];\n\tprivate builtinPackagePaths: PackageSource[];\n\tprivate extensionFactories: ExtensionFactory[];\n\tprivate noExtensions: boolean;\n\tprivate noSkills: boolean;\n\tprivate noPromptTemplates: boolean;\n\tprivate noThemes: boolean;\n\tprivate noContextFiles: boolean;\n\tprivate systemPromptSource?: string;\n\tprivate appendSystemPromptSource?: string[];\n\tprivate extensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tprivate skillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate promptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate themesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tprivate agentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tprivate systemPromptOverride?: (base: string | undefined) => string | undefined;\n\tprivate appendSystemPromptOverride?: (base: string[]) => string[];\n\tprivate extensionsResult: LoadExtensionsResult;\n\tprivate skills: Skill[];\n\tprivate skillDiagnostics: ResourceDiagnostic[];\n\tprivate prompts: PromptTemplate[];\n\tprivate promptDiagnostics: ResourceDiagnostic[];\n\tprivate themes: Theme[];\n\tprivate themeDiagnostics: ResourceDiagnostic[];\n\tprivate agentsFiles: Array<{ path: string; content: string }>;\n\tprivate systemPrompt?: string;\n\tprivate appendSystemPrompt: string[];\n\tprivate workflowResources: ResolvedResource[];\n\tprivate trustedBorrowedProjectLocalSources?: Set<string>;\n\tprivate lastSkillPaths: string[];\n\tprivate extensionSkillSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionPromptSourceInfos: Map<string, SourceInfo>;\n\tprivate extensionThemeSourceInfos: Map<string, SourceInfo>;\n\tprivate lastPromptPaths: string[];\n\tprivate lastThemePaths: string[];\n\tprivate loaded: boolean;\n\n\tconstructor(options: DefaultResourceLoaderOptions) {\n\t\tconst inheritanceSnapshot = options.resourceLoaderInheritanceSnapshot;\n\t\tconst inheritedSettingsOptions = inheritanceSnapshot?.projectTrusted === undefined\n\t\t\t? undefined\n\t\t\t: { projectTrusted: inheritanceSnapshot.projectTrusted };\n\t\tthis.cwd = resolvePath(options.cwd);\n\t\tthis.agentDir = resolvePath(options.agentDir);\n\t\tthis.settingsManager = options.settingsManager ?? SettingsManager.create(\n\t\t\tthis.cwd,\n\t\t\tthis.agentDir,\n\t\t\tinheritedSettingsOptions,\n\t\t);\n\t\tthis.eventBus = options.eventBus ?? createEventBus();\n\t\tthis.packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tthis.additionalExtensionPaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalExtensionPaths,\n\t\t\toptions.additionalExtensionPaths,\n\t\t);\n\t\tthis.additionalSkillPaths = mergeInheritedStrings(inheritanceSnapshot?.additionalSkillPaths, options.additionalSkillPaths);\n\t\tthis.additionalPromptTemplatePaths = mergeInheritedStrings(\n\t\t\tinheritanceSnapshot?.additionalPromptTemplatePaths,\n\t\t\toptions.additionalPromptTemplatePaths,\n\t\t);\n\t\tthis.additionalThemePaths = mergeInheritedStrings(inheritanceSnapshot?.additionalThemePaths, options.additionalThemePaths);\n\t\tthis.builtinPackagePaths = options.builtinPackagePaths !== undefined\n\t\t\t? clonePackageSources(options.builtinPackagePaths)\n\t\t\t: clonePackageSources(inheritanceSnapshot?.builtinPackagePaths);\n\t\tthis.extensionFactories = [...(inheritanceSnapshot?.extensionFactories ?? []), ...(options.extensionFactories ?? [])];\n\t\tthis.noExtensions = options.noExtensions ?? inheritanceSnapshot?.noExtensions ?? false;\n\t\tthis.noSkills = options.noSkills ?? inheritanceSnapshot?.noSkills ?? false;\n\t\tthis.noPromptTemplates = options.noPromptTemplates ?? inheritanceSnapshot?.noPromptTemplates ?? false;\n\t\tthis.noThemes = options.noThemes ?? inheritanceSnapshot?.noThemes ?? false;\n\t\tthis.noContextFiles = options.noContextFiles ?? inheritanceSnapshot?.noContextFiles ?? false;\n\t\tthis.systemPromptSource = options.systemPrompt ?? inheritanceSnapshot?.systemPrompt;\n\t\tthis.appendSystemPromptSource = options.appendSystemPrompt !== undefined\n\t\t\t? [...options.appendSystemPrompt]\n\t\t\t: inheritanceSnapshot?.appendSystemPrompt === undefined\n\t\t\t\t? undefined\n\t\t\t\t: [...inheritanceSnapshot.appendSystemPrompt];\n\t\tthis.extensionsOverride = options.extensionsOverride;\n\t\tthis.skillsOverride = options.skillsOverride;\n\t\tthis.promptsOverride = options.promptsOverride;\n\t\tthis.themesOverride = options.themesOverride;\n\t\tthis.agentsFilesOverride = options.agentsFilesOverride;\n\t\tthis.systemPromptOverride = options.systemPromptOverride;\n\t\tthis.appendSystemPromptOverride = options.appendSystemPromptOverride;\n\t\tthis.extensionsResult = { extensions: [], errors: [], runtime: createExtensionRuntime() };\n\t\tthis.skills = [];\n\t\tthis.skillDiagnostics = [];\n\t\tthis.prompts = [];\n\t\tthis.promptDiagnostics = [];\n\t\tthis.themes = [];\n\t\tthis.themeDiagnostics = [];\n\t\tthis.agentsFiles = [];\n\t\tthis.appendSystemPrompt = [];\n\t\tthis.workflowResources = [];\n\t\tthis.trustedBorrowedProjectLocalSources = inheritanceSnapshot?.trustedBorrowedProjectLocalSources === undefined\n\t\t\t? undefined\n\t\t\t: new Set(inheritanceSnapshot.trustedBorrowedProjectLocalSources);\n\t\tthis.lastSkillPaths = [];\n\t\tthis.extensionSkillSourceInfos = new Map();\n\t\tthis.extensionPromptSourceInfos = new Map();\n\t\tthis.extensionThemeSourceInfos = new Map();\n\t\tthis.lastPromptPaths = [];\n\t\tthis.lastThemePaths = [];\n\t\tthis.loaded = false;\n\t\tthis.touchInternalFieldsForSplit();\n\t}\n\n\tgetExtensions(): LoadExtensionsResult {\n\t\treturn this.extensionsResult;\n\t}\n\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { skills: this.skills, diagnostics: this.skillDiagnostics };\n\t}\n\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { prompts: this.prompts, diagnostics: this.promptDiagnostics };\n\t}\n\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] } {\n\t\treturn { themes: this.themes, diagnostics: this.themeDiagnostics };\n\t}\n\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> } {\n\t\treturn { agentsFiles: this.agentsFiles };\n\t}\n\n\tgetSystemPrompt(): string | undefined {\n\t\treturn this.systemPrompt;\n\t}\n\n\tgetAppendSystemPrompt(): string[] {\n\t\treturn this.appendSystemPrompt;\n\t}\n\n\tgetWorkflowResources(): ResolvedResource[] {\n\t\treturn [...this.workflowResources];\n\t}\n\n\tgetInheritanceSnapshot(): DefaultResourceLoaderInheritanceSnapshot {\n\t\treturn {\n\t\t\tprojectTrusted: this.settingsManager.isProjectTrusted(),\n\t\t\tadditionalExtensionPaths: [...this.additionalExtensionPaths],\n\t\t\tadditionalSkillPaths: [...this.additionalSkillPaths],\n\t\t\tadditionalPromptTemplatePaths: [...this.additionalPromptTemplatePaths],\n\t\t\tadditionalThemePaths: [...this.additionalThemePaths],\n\t\t\tbuiltinPackagePaths: clonePackageSources(this.builtinPackagePaths),\n\t\t\textensionFactories: [...this.extensionFactories],\n\t\t\tnoExtensions: this.noExtensions,\n\t\t\tnoSkills: this.noSkills,\n\t\t\tnoPromptTemplates: this.noPromptTemplates,\n\t\t\tnoThemes: this.noThemes,\n\t\t\tnoContextFiles: this.noContextFiles,\n\t\t\t...(this.systemPromptSource === undefined ? {} : { systemPrompt: this.systemPromptSource }),\n\t\t\t...(this.appendSystemPromptSource === undefined ? {} : { appendSystemPrompt: [...this.appendSystemPromptSource] }),\n\t\t\t...(this.trustedBorrowedProjectLocalSources === undefined\n\t\t\t\t? {}\n\t\t\t\t: { trustedBorrowedProjectLocalSources: [...this.trustedBorrowedProjectLocalSources] }),\n\t\t};\n\t}\n\n\tasync refreshWorkflowResources(): Promise<ResolvedResource[]> {\n\t\tconst { resolvedPaths, cliExtensionPaths, builtinPackagePaths } = await resolvePackageResourcePaths(this, {\n\t\t\ttrustedBorrowedProjectLocalSources: this.trustedBorrowedProjectLocalSources,\n\t\t});\n\t\tconst workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);\n\t\tthis.workflowResources = workflowResources;\n\t\treturn [...this.workflowResources];\n\t}\n\n\textendResources(paths: ResourceExtensionPaths): void {\n\t\tconst skillPaths = normalizeExtensionPaths(this, paths.skillPaths ?? []);\n\t\tconst promptPaths = normalizeExtensionPaths(this, paths.promptPaths ?? []);\n\t\tconst themePaths = normalizeExtensionPaths(this, paths.themePaths ?? []);\n\t\trecordExtensionSourceInfo(this, skillPaths, \"skill\");\n\t\trecordExtensionSourceInfo(this, promptPaths, \"prompt\");\n\t\trecordExtensionSourceInfo(this, themePaths, \"theme\");\n\n\t\tif (skillPaths.length > 0) {\n\t\t\tthis.lastSkillPaths = mergeResourcePaths(this.cwd, this.lastSkillPaths, skillPaths.map((entry) => entry.path));\n\t\t\tupdateSkillsFromPaths(this, this.lastSkillPaths);\n\t\t}\n\t\tif (promptPaths.length > 0) {\n\t\t\tthis.lastPromptPaths = mergeResourcePaths(this.cwd, this.lastPromptPaths, promptPaths.map((entry) => entry.path));\n\t\t\tupdatePromptsFromPaths(this, this.lastPromptPaths);\n\t\t}\n\t\tif (themePaths.length > 0) {\n\t\t\tthis.lastThemePaths = mergeResourcePaths(this.cwd, this.lastThemePaths, themePaths.map((entry) => entry.path));\n\t\t\tupdateThemesFromPaths(this, this.lastThemePaths);\n\t\t}\n\t}\n\n\tasync loadProjectTrustExtensions(): Promise<LoadExtensionsResult> {\n\t\treturn loadProjectTrustExtensions(this);\n\t}\n\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\treturn reloadDefaultResourceLoader(this, options);\n\t}\n\n\tprivate touchInternalFieldsForSplit(): void {\n\t\tvoid this.eventBus;\n\t\tvoid this.packageManager;\n\t\tvoid this.noContextFiles;\n\t\tvoid this.extensionsOverride;\n\t\tvoid this.skillsOverride;\n\t\tvoid this.promptsOverride;\n\t\tvoid this.themesOverride;\n\t\tvoid this.agentsFilesOverride;\n\t\tvoid this.systemPromptOverride;\n\t\tvoid this.appendSystemPromptOverride;\n\t\tvoid this.extensionSkillSourceInfos;\n\t\tvoid this.extensionPromptSourceInfos;\n\t\tvoid this.extensionThemeSourceInfos;\n\t\tvoid this.loaded;\n\t}\n}\n"]}
|