@ai-agent-forge/agent-forge 0.88.2 → 0.88.4
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 +33 -0
- package/README.md +1 -1
- package/bundled-plugins/agent-loop-policy/agent-forge.json +1 -1
- package/bundled-plugins/agent-loop-policy/plugin.json +1 -1
- package/bundled-plugins/coding-tools/agent-forge.json +1 -1
- package/bundled-plugins/coding-tools/plugin.json +1 -1
- package/bundled-plugins/compaction-policy/agent-forge.json +1 -1
- package/bundled-plugins/compaction-policy/plugin.json +1 -1
- package/bundled-plugins/overflow-policy/agent-forge.json +1 -1
- package/bundled-plugins/overflow-policy/plugin.json +1 -1
- package/bundled-plugins/provider-failover/agent-forge.json +1 -1
- package/bundled-plugins/provider-failover/plugin.json +1 -1
- package/bundled-plugins/retry-policy/agent-forge.json +1 -1
- package/bundled-plugins/retry-policy/plugin.json +1 -1
- package/dist/artifacts/paged-read.d.ts +6 -1
- package/dist/artifacts/paged-read.d.ts.map +1 -1
- package/dist/artifacts/paged-read.js.map +1 -1
- package/dist/bundle/.build-manifest.json +244 -234
- package/dist/bundle/chunks/{anthropic-messages-PLAKXR73.js → anthropic-messages-3FJHRAJL.js} +2 -2
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-OUWQ2AZD.js → azure-openai-responses-GCL47IDS.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-6F5JWGKE.js → chunk-32YDZI4J.js} +1 -1
- package/dist/bundle/chunks/{chunk-LSP24WNH.js → chunk-755VNWIF.js} +12 -12
- package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-BVVSHK6W.js} +1 -1
- package/dist/bundle/chunks/{chunk-HTC5K5SM.js → chunk-HEL6TAWE.js} +95 -90
- package/dist/bundle/chunks/{chunk-6R7UI4IY.js → chunk-QDLOMKF6.js} +1 -1
- package/dist/bundle/chunks/{chunk-44I47ACN.js → chunk-V3ACW7VD.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-DLII6DAT.js → google-generative-ai-6BMXWA44.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-G7BZL7GM.js → google-vertex-6H7NLRTK.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{mistral-conversations-JXUK24ID.js → mistral-conversations-IXUHSFSJ.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-5GSGFIPG.js → openai-codex-responses-YHUAEVCM.js} +1 -1
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/{openai-completions-EI2I6DTG.js → openai-completions-ULQCFC72.js} +1 -1
- package/dist/bundle/chunks/openai-responses-NLLAJDPS.js +2 -0
- package/dist/bundle/chunks/{openrouter-images-G4GQRUSG.js → openrouter-images-GZZQZXMS.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +1 -1
- package/dist/bundle/chunks/{pi-messages-PWU2VJMR.js → pi-messages-EJTI2EJ3.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-TQWEGNNZ.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +0 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -4
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/experimental/cli.d.ts +3 -3
- package/dist/cli/experimental/cli.d.ts.map +1 -1
- package/dist/cli/experimental/cli.js +2 -2
- package/dist/cli/experimental/cli.js.map +1 -1
- package/dist/cli/experimental/commands/agent-forge.d.ts +15 -0
- package/dist/cli/experimental/commands/agent-forge.d.ts.map +1 -0
- package/dist/cli/experimental/commands/{pi.js → agent-forge.js} +4 -4
- package/dist/cli/experimental/commands/agent-forge.js.map +1 -0
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -7
- package/dist/config.js.map +1 -1
- package/dist/core/agent-forge-manifest.d.ts +7 -0
- package/dist/core/agent-forge-manifest.d.ts.map +1 -0
- package/dist/core/{pi-manifest.js → agent-forge-manifest.js} +4 -4
- package/dist/core/agent-forge-manifest.js.map +1 -0
- package/dist/core/agent-session-compaction.d.ts +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +3 -3
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-lifecycle.d.ts.map +1 -1
- package/dist/core/agent-session-lifecycle.js +12 -1
- package/dist/core/agent-session-lifecycle.js.map +1 -1
- package/dist/core/agent-session-projection.d.ts.map +1 -1
- package/dist/core/agent-session-projection.js +3 -3
- package/dist/core/agent-session-projection.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +1 -3
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/extensions/capability-plugin.d.ts.map +1 -1
- package/dist/core/extensions/capability-plugin.js +15 -8
- package/dist/core/extensions/capability-plugin.js.map +1 -1
- package/dist/core/extensions/capability-runtime-store.d.ts +20 -1
- package/dist/core/extensions/capability-runtime-store.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-store.js +67 -0
- package/dist/core/extensions/capability-runtime-store.js.map +1 -1
- package/dist/core/extensions/capability-runtime-types.d.ts +14 -0
- package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-types.js +7 -1
- package/dist/core/extensions/capability-runtime-types.js.map +1 -1
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime.js +144 -42
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +12 -4
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +1 -1
- package/dist/core/facade/coding-agent-facade.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js +3 -3
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +2 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +4 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-resource-collection.d.ts.map +1 -1
- package/dist/core/package-resource-collection.js +5 -5
- package/dist/core/package-resource-collection.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +3 -3
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +6 -7
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +4 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +5 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +1 -3
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition.d.ts +1 -1
- package/dist/core/tools/tool-definition.d.ts.map +1 -1
- package/dist/core/tools/tool-definition.js.map +1 -1
- package/dist/core/trace-retention.d.ts +16 -1
- package/dist/core/trace-retention.d.ts.map +1 -1
- package/dist/core/trace-retention.js +43 -20
- package/dist/core/trace-retention.js.map +1 -1
- package/dist/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/export-html/ansi-to-html.js.map +1 -0
- package/dist/{core/export-html → export-html}/index.d.ts +1 -1
- package/dist/export-html/index.d.ts.map +1 -0
- package/dist/{core/export-html → export-html}/index.js +5 -5
- package/dist/export-html/index.js.map +1 -0
- package/dist/{core/export-html → export-html}/tool-renderer.d.ts +2 -2
- package/dist/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/export-html/tool-renderer.js.map +1 -0
- package/dist/{modes/interactive → host}/model-catalog-refresh.d.ts +1 -1
- package/dist/host/model-catalog-refresh.d.ts.map +1 -0
- package/dist/{modes/interactive → host}/model-catalog-refresh.js +1 -1
- package/dist/host/model-catalog-refresh.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +25 -14
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/agents-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/agents-view.js +1 -1
- package/dist/modes/interactive/components/agents-view.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +3 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +83 -24
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.js +1 -1
- package/dist/modes/interactive/components/dialog-editor.js.map +1 -1
- package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-input.js +1 -1
- package/dist/modes/interactive/components/dialog-input.js.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.js +1 -1
- package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +1 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +1 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.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/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.js +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.js +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.js +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -1
- package/dist/modes/interactive/components/render-types.d.ts +1 -1
- package/dist/modes/interactive/components/render-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/render-types.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +2 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +1 -1
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +1 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +1 -1
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +1 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +1 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +96 -4
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-run-group.js +1 -1
- package/dist/modes/interactive/components/tool-run-group.js.map +1 -1
- package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-list.js +1 -1
- package/dist/modes/interactive/components/tree-list.js.map +1 -1
- package/dist/modes/interactive/components/tree-render.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-render.js +1 -1
- package/dist/modes/interactive/components/tree-render.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/workflow-view.js +1 -1
- package/dist/modes/interactive/components/workflow-view.js.map +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth.js +1 -1
- package/dist/modes/interactive/interactive-auth.js.map +1 -1
- package/dist/modes/interactive/interactive-commands.d.ts +123 -6
- package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-commands.js +691 -4
- package/dist/modes/interactive/interactive-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-events.d.ts +174 -0
- package/dist/modes/interactive/interactive-events.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-events.js +704 -0
- package/dist/modes/interactive/interactive-events.js.map +1 -0
- package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-format.js +1 -1
- package/dist/modes/interactive/interactive-format.js.map +1 -1
- package/dist/modes/interactive/interactive-lifecycle.d.ts +94 -0
- package/dist/modes/interactive/interactive-lifecycle.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-lifecycle.js +177 -0
- package/dist/modes/interactive/interactive-lifecycle.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +240 -133
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +251 -2159
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-queues.d.ts +96 -0
- package/dist/modes/interactive/interactive-queues.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-queues.js +183 -0
- package/dist/modes/interactive/interactive-queues.js.map +1 -0
- package/dist/modes/interactive/interactive-selectors.d.ts +95 -5
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +517 -6
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/startup-services.d.ts +31 -0
- package/dist/modes/interactive/startup-services.d.ts.map +1 -0
- package/dist/modes/interactive/startup-services.js +123 -0
- package/dist/modes/interactive/startup-services.js.map +1 -0
- package/dist/modes/memory-preheat.d.ts +11 -0
- package/dist/modes/memory-preheat.d.ts.map +1 -0
- package/dist/modes/memory-preheat.js +20 -0
- package/dist/modes/memory-preheat.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.d.ts +9 -1
- package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.js +79 -0
- package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -1
- package/dist/remote/server-assembly.d.ts.map +1 -1
- package/dist/remote/server-assembly.js +7 -2
- package/dist/remote/server-assembly.js.map +1 -1
- package/dist/suites/builtin-suites.d.ts.map +1 -0
- package/dist/suites/builtin-suites.js.map +1 -0
- package/dist/suites/resolved-agent-profile.d.ts.map +1 -0
- package/dist/suites/resolved-agent-profile.js.map +1 -0
- package/dist/suites/suite-lifecycle.d.ts.map +1 -0
- package/dist/suites/suite-lifecycle.js.map +1 -0
- package/dist/suites/suite-loader.d.ts.map +1 -0
- package/dist/suites/suite-loader.js.map +1 -0
- package/dist/{modes/interactive/theme → theme}/dark.json +1 -1
- package/dist/{modes/interactive/theme → theme}/light.json +1 -1
- package/dist/{modes/interactive/theme → theme}/theme-controller.d.ts +1 -1
- package/dist/theme/theme-controller.d.ts.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme-controller.js +1 -1
- package/dist/theme/theme-controller.js.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme.d.ts +1 -1
- package/dist/theme/theme.d.ts.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme.js +5 -5
- package/dist/theme/theme.js.map +1 -0
- package/docs/compaction.md +7 -7
- package/docs/environment-variables.md +10 -4
- package/docs/keybindings.md +3 -3
- package/docs/models.md +17 -17
- package/docs/packages.md +1 -1
- package/docs/prompt-templates.md +1 -1
- package/docs/rpc.md +2 -2
- package/docs/sdk.md +5 -5
- package/docs/session-format.md +3 -3
- package/docs/settings.md +15 -1
- package/docs/shell-aliases.md +1 -1
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +17 -17
- package/docs/themes.md +5 -5
- package/docs/tmux.md +4 -4
- package/docs/tui.md +1 -1
- package/docs/usage.md +292 -292
- package/docs/windows.md +1 -1
- package/examples/extensions/bash-spawn-hook/index.ts +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/mcp-stdio/index.d.ts +64 -0
- package/examples/extensions/mcp-stdio/index.d.ts.map +1 -0
- package/examples/extensions/mcp-stdio/index.js +292 -0
- package/examples/extensions/mcp-stdio/index.js.map +1 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -6
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/package.json +2 -2
- package/dist/bundle/chunks/openai-responses-AUJQ3NWT.js +0 -2
- package/dist/bundle/chunks/virtual-modules-MRXD3RWG.js +0 -5
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
- package/dist/core/export-html/ansi-to-html.js.map +0 -1
- package/dist/core/export-html/index.d.ts.map +0 -1
- package/dist/core/export-html/index.js.map +0 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
- package/dist/core/export-html/tool-renderer.js.map +0 -1
- package/dist/core/pi-manifest.d.ts +0 -7
- package/dist/core/pi-manifest.d.ts.map +0 -1
- package/dist/core/pi-manifest.js.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/profiles/builtin-suites.d.ts.map +0 -1
- package/dist/profiles/builtin-suites.js.map +0 -1
- package/dist/profiles/resolved-agent-profile.d.ts.map +0 -1
- package/dist/profiles/resolved-agent-profile.js.map +0 -1
- package/dist/profiles/suite-lifecycle.d.ts.map +0 -1
- package/dist/profiles/suite-lifecycle.js.map +0 -1
- package/dist/profiles/suite-loader.d.ts.map +0 -1
- package/dist/profiles/suite-loader.js.map +0 -1
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- package/dist/utils/deprecation.js.map +0 -1
- /package/dist/{core/export-html → export-html}/ansi-to-html.d.ts +0 -0
- /package/dist/{core/export-html → export-html}/ansi-to-html.js +0 -0
- /package/dist/{core/export-html → export-html}/template.css +0 -0
- /package/dist/{core/export-html → export-html}/template.html +0 -0
- /package/dist/{core/export-html → export-html}/template.js +0 -0
- /package/dist/{core/export-html → export-html}/tool-renderer.js +0 -0
- /package/dist/{core/export-html → export-html}/vendor/highlight.min.js +0 -0
- /package/dist/{core/export-html → export-html}/vendor/marked.min.js +0 -0
- /package/dist/{profiles → suites}/builtin-suites.d.ts +0 -0
- /package/dist/{profiles → suites}/builtin-suites.js +0 -0
- /package/dist/{profiles → suites}/resolved-agent-profile.d.ts +0 -0
- /package/dist/{profiles → suites}/resolved-agent-profile.js +0 -0
- /package/dist/{profiles → suites}/suite-lifecycle.d.ts +0 -0
- /package/dist/{profiles → suites}/suite-lifecycle.js +0 -0
- /package/dist/{profiles → suites}/suite-loader.d.ts +0 -0
- /package/dist/{profiles → suites}/suite-loader.js +0 -0
- /package/dist/{modes/interactive/theme → theme}/theme-schema.json +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suite-loader.d.ts","sourceRoot":"","sources":["../../src/profiles/suite-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,KAAK,EACX,gCAAgC,EAChC,wBAAwB,EACxB,gCAAgC,EAChC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAG/F,OAAO,EAEN,gBAAgB,EAQhB,KAAK,eAAe,EAEpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,uBAAuB,eAAe,CAAC;AACpD,eAAO,MAAM,wBAAwB,cAAc,CAAC;AACpD,eAAO,MAAM,yBAAyB,eAAe,CAAC;AACtD,eAAO,MAAM,a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C;CACxC;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC/C,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,gCAAgC,CAAC;IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC5B,GAAG,sBAAsB,CA6BzB","sourcesContent":["/**\n * Suite workspace location, lazy provisioning, and assembly (方案系统设计.md v2\n * §4/§5/§8/§9/§11/§12, M1a).\n *\n * The loader is the assembler layer of the suite system: it resolves the\n * active suite id (explicit > AGENT_FORGE_SUITE > project settings > global\n * settings > \"assistant\"), provisions the builtin suite workspaces under\n * `<agentDir>/suites/<id>/`, assembles the agents.md three-level chain\n * (system -> suite -> project, 设计 §8), gates the global SYSTEM.md/\n * APPEND_SYSTEM.md system prompt channel by inheritSystemAgentsMd (设计 §4:\n * the project-level `<cwd>/.agent-forge/` layer always passes), and bridges\n * the assembled suite onto the existing ProfileIdentityV1/ProfileLock\n * mechanisms. The project level of the chain is delegated to the existing\n * resource loader — the ancestor chain logic itself is never reimplemented\n * here.\n */\n\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join, resolve, sep } from \"node:path\";\nimport type { JsonValue } from \"@agent-forge/ai\";\nimport { CONFIG_DIR_NAME } from \"../config.ts\";\nimport type { ResourceDiagnostic } from \"../core/diagnostics.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { SettingsManager } from \"../core/settings-manager.ts\";\nimport type { Skill } from \"../core/skills.ts\";\nimport { loadSkills } from \"../core/skills.ts\";\nimport type { HostFactsV1 } from \"../plugins/ecosystem/types.ts\";\nimport type { ProfileIdentityV1 } from \"../profile/identity.ts\";\nimport { buildProfileIdentityV1, stableJsonDigest } from \"../profile/identity.ts\";\nimport type { ProfileLockV1, ProfileLockVerificationV1 } from \"../profile/lock.ts\";\nimport { createProfileLock, verifyProfileLock } from \"../profile/lock.ts\";\nimport type {\n\tBuiltinPluginManifestOverridesV1,\n\tBuiltinPluginProfileIdV1,\n\tBuiltinPluginProfileResolutionV1,\n} from \"../profile/plugin-profiles.ts\";\nimport { resolveBuiltinPluginProfileV1 } from \"../profile/plugin-profiles.ts\";\nimport type { VerifiedToolPluginV1 } from \"../profile/profile-assembly.ts\";\nimport type { RegistryProfileEntryV1, RegistrySourceV1 } from \"../profile/profile-registry.ts\";\nimport { createProfileRegistry } from \"../profile/profile-registry.ts\";\nimport { stripBom } from \"../utils/text.ts\";\nimport {\n\tBUILTIN_SUITES,\n\tDEFAULT_SUITE_ID,\n\tFACTORY_CONTENTS_VERSION,\n\tgetBuiltinSuite,\n\tisBuiltinSuiteId,\n\tisValidSuiteId,\n\tORIENTATION_PROMPTS,\n\tparseSuiteJson,\n\tSUITE_SCHEMA_VERSION,\n\ttype SuiteDefinition,\n\tserializeSuiteJson,\n} from \"./builtin-suites.ts\";\n\nexport { DEFAULT_SUITE_ID };\n\nexport const SUITES_DIR_NAME = \"suites\";\nexport const SUITE_MANIFEST_FILENAME = \"suite.json\";\nexport const SUITE_AGENTS_MD_FILENAME = \"agents.md\";\nexport const SUITE_PERSONA_MD_FILENAME = \"persona.md\";\nexport const SUITE_ENV_VAR = \"AGENT_FORGE_SUITE\";\n/** customType of the session custom entry recording the suite a session was created with (设计 §10.1). */\nexport const SUITE_SESSION_ENTRY_TYPE = \"suite\";\n/** Persisted suite profile lock inside the suite workspace (M4, 设计 §12). */\nexport const SUITE_LOCK_FILENAME = \".profile-lock.json\";\n\nexport function getSuitesRootDir(agentDir: string): string {\n\treturn join(agentDir, SUITES_DIR_NAME);\n}\n\nexport function getSuiteWorkspaceDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuitesRootDir(agentDir), suiteId);\n}\n\n/** The suite-local skill layer directory (统一修复轮 B): `<suiteDir>/skills`. */\nexport function getSuiteLocalSkillsDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuiteWorkspaceDir(agentDir, suiteId), \"skills\");\n}\n\n/** The suite-local capability-plugin layer directory (统一修复轮 B): `<suiteDir>/plugins`. */\nexport function getSuiteLocalPluginsDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuiteWorkspaceDir(agentDir, suiteId), \"plugins\");\n}\n\n/** Structured error for unknown suite ids; lists the available ids (设计 §9). */\nexport class SuiteResolutionError extends Error {\n\treadonly requestedId: string;\n\treadonly availableSuiteIds: readonly string[];\n\n\tconstructor(requestedId: string, availableSuiteIds: readonly string[]) {\n\t\tsuper(`Unknown suite \"${requestedId}\". Available suites: ${availableSuiteIds.join(\", \")}`);\n\t\tthis.name = \"SuiteResolutionError\";\n\t\tthis.requestedId = requestedId;\n\t\tthis.availableSuiteIds = Object.freeze([...availableSuiteIds]);\n\t}\n}\n\n/** Structured error for resuming a session under a suite it is not bound to. */\nexport class SuiteRebindError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"SuiteRebindError\";\n\t}\n}\n\n/**\n * Every suite id resolvable on this host: the builtin pair plus user\n * workspaces that already contain a suite.json.\n */\nexport function listSuiteIds(agentDir: string): string[] {\n\tconst ids = new Set(BUILTIN_SUITES.map((suite) => suite.id));\n\tconst rootDir = getSuitesRootDir(agentDir);\n\tif (existsSync(rootDir)) {\n\t\tfor (const entry of readdirSync(rootDir, { withFileTypes: true })) {\n\t\t\tif (!entry.isDirectory()) continue;\n\t\t\tif (!existsSync(join(rootDir, entry.name, SUITE_MANIFEST_FILENAME))) continue;\n\t\t\tids.add(entry.name);\n\t\t}\n\t}\n\treturn [...ids].sort();\n}\n\nexport interface ResolveSuiteIdOptions {\n\t/** Explicit suite id (SDK/CLI parameter); highest priority. */\n\texplicit?: string;\n\t/** Raw AGENT_FORGE_SUITE value; callers pass process.env[SUITE_ENV_VAR]. */\n\tenvSuite?: string;\n\t/** Settings source for the project/global `suite` keys. */\n\tsettings?: Pick<SettingsManager, \"getProjectSettings\" | \"getGlobalSettings\">;\n\t/** Agent dir used for workspace discovery and available-id listing. */\n\tagentDir: string;\n}\n\nfunction normalizeCandidate(value: unknown): string | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\tconst trimmed = value.trim();\n\treturn trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Resolves the active suite id: explicit > env AGENT_FORGE_SUITE > project\n * settings `suite` > global settings `suite` > \"coding\" (设计 §9). The\n * first configured value wins; an unknown or malformed value is a structured\n * error, never a silent fallback.\n */\nexport function resolveSuiteId(options: ResolveSuiteIdOptions): string {\n\tconst candidate =\n\t\tnormalizeCandidate(options.explicit) ??\n\t\tnormalizeCandidate(options.envSuite) ??\n\t\t(options.settings === undefined ? undefined : normalizeCandidate(options.settings.getProjectSettings().suite)) ??\n\t\t(options.settings === undefined ? undefined : normalizeCandidate(options.settings.getGlobalSettings().suite));\n\tif (candidate === undefined) return DEFAULT_SUITE_ID;\n\tif (!isValidSuiteId(candidate)) throw new SuiteResolutionError(candidate, listSuiteIds(options.agentDir));\n\tif (!isBuiltinSuiteId(candidate)) {\n\t\tconst workspaceManifest = join(getSuiteWorkspaceDir(options.agentDir, candidate), SUITE_MANIFEST_FILENAME);\n\t\tif (!existsSync(workspaceManifest)) throw new SuiteResolutionError(candidate, listSuiteIds(options.agentDir));\n\t}\n\treturn candidate;\n}\n\nexport interface SuiteWorkspace {\n\treadonly suite: SuiteDefinition;\n\treadonly suiteDir: string;\n\treadonly suiteJsonPath: string;\n\treadonly agentsMdPath: string;\n\t/**\n\t * The resolved orientation persona text (设计 §6.2/§6.3): the compiled\n\t * ORIENTATION_PROMPTS text for assistant/coding, the workspace persona.md\n\t * content for custom; a missing or unreadable file degrades to \"\" with a\n\t * diagnostic.\n\t */\n\treadonly orientationPersona: string;\n\treadonly diagnostics: readonly string[];\n\t/** Persisted lock file path inside the workspace (M4). */\n\treadonly lockPath: string;\n\t/**\n\t * The suite profile lock (设计 §12): the persisted lock when one existed, a\n\t * fresh lock frozen over the current identity otherwise.\n\t */\n\treadonly lock: ProfileLockV1;\n\t/** Current resolved identity, including any selected optional domain Profile. */\n\treadonly identity: ProfileIdentityV1;\n\t/** Verify result against the persisted lock; absent when none existed. */\n\treadonly lockVerification?: ProfileLockVerificationV1;\n}\n\n/**\n * Serializes a ProfileLockV1 to the canonical `.profile-lock.json` text\n * (stable field order, trailing newline). Round-trips through\n * parseSuiteProfileLockFile.\n */\nexport function serializeSuiteProfileLockFile(lock: ProfileLockV1): string {\n\tconst ordered = {\n\t\tidentity: {\n\t\t\tprofileId: lock.identity.profileId,\n\t\t\tprofileVersion: lock.identity.profileVersion,\n\t\t\tmanifestDigest: lock.identity.manifestDigest,\n\t\t\tcapabilityVersions: lock.identity.capabilityVersions.map((ref) => ({ id: ref.id, version: ref.version })),\n\t\t},\n\t\tlockedAt: lock.lockedAt,\n\t\tlockedBy: lock.lockedBy,\n\t\tgeneration: lock.generation,\n\t};\n\treturn `${JSON.stringify(ordered, null, 2)}\\n`;\n}\n\n/**\n * Parses `.profile-lock.json` text back into a ProfileLockV1. Throws on any\n * structural mismatch so callers can apply their corruption policy.\n */\nexport function parseSuiteProfileLockFile(text: string): ProfileLockV1 {\n\tconst value: unknown = JSON.parse(text);\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(t(\".profile-lock.json must be a JSON object\"));\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst identityRecord = record.identity;\n\tif (identityRecord === null || typeof identityRecord !== \"object\" || Array.isArray(identityRecord)) {\n\t\tthrow new Error(t(\".profile-lock.json identity must be a JSON object\"));\n\t}\n\tconst identity = identityRecord as Record<string, unknown>;\n\tif (\n\t\ttypeof identity.profileId !== \"string\" ||\n\t\ttypeof identity.profileVersion !== \"string\" ||\n\t\ttypeof identity.manifestDigest !== \"string\" ||\n\t\t!Array.isArray(identity.capabilityVersions)\n\t) {\n\t\tthrow new Error(\n\t\t\tt(\".profile-lock.json identity must carry profileId/profileVersion/manifestDigest/capabilityVersions\"),\n\t\t);\n\t}\n\tconst capabilityVersions = identity.capabilityVersions.map((entry) => {\n\t\tif (entry === null || typeof entry !== \"object\" || Array.isArray(entry)) {\n\t\t\tthrow new Error(t(\".profile-lock.json identity.capabilityVersions entries must be objects\"));\n\t\t}\n\t\tconst capability = entry as Record<string, unknown>;\n\t\tif (typeof capability.id !== \"string\" || typeof capability.version !== \"number\") {\n\t\t\tthrow new Error(t(\".profile-lock.json identity.capabilityVersions entries must carry id/version\"));\n\t\t}\n\t\treturn { id: capability.id, version: capability.version };\n\t});\n\tif (\n\t\ttypeof record.lockedAt !== \"number\" ||\n\t\ttypeof record.lockedBy !== \"string\" ||\n\t\ttypeof record.generation !== \"number\"\n\t) {\n\t\tthrow new Error(t(\".profile-lock.json must carry lockedAt/lockedBy/generation\"));\n\t}\n\treturn Object.freeze({\n\t\tidentity: Object.freeze({\n\t\t\tprofileId: identity.profileId,\n\t\t\tprofileVersion: identity.profileVersion,\n\t\t\tmanifestDigest: identity.manifestDigest,\n\t\t\tcapabilityVersions: Object.freeze(capabilityVersions.map((ref) => Object.freeze({ ...ref }))),\n\t\t}),\n\t\tlockedAt: record.lockedAt,\n\t\tlockedBy: record.lockedBy,\n\t\tgeneration: record.generation,\n\t});\n}\n\n/**\n * Locates and lazily provisions `<agentDir>/suites/<id>/`: the builtin pair\n * gets its factory suite.json plus an empty agents.md skeleton on first start\n * (设计 §5). Corruption policy (设计 §9): builtin suites fall back to factory\n * content with diagnostics; user suites fail fast with the file path.\n */\nexport function loadSuiteWorkspace(options: {\n\tagentDir: string;\n\tsuiteId: string;\n\tpluginProfile?: BuiltinPluginProfileResolutionV1;\n}): SuiteWorkspace {\n\tconst { agentDir, suiteId } = options;\n\tconst suiteDir = getSuiteWorkspaceDir(agentDir, suiteId);\n\tconst suiteJsonPath = join(suiteDir, SUITE_MANIFEST_FILENAME);\n\tconst agentsMdPath = join(suiteDir, SUITE_AGENTS_MD_FILENAME);\n\tconst diagnostics: string[] = [];\n\n\tlet suite: SuiteDefinition;\n\tif (!existsSync(suiteJsonPath)) {\n\t\tconst builtin = getBuiltinSuite(suiteId);\n\t\tif (builtin === undefined) throw new SuiteResolutionError(suiteId, listSuiteIds(agentDir));\n\t\tmkdirSync(suiteDir, { recursive: true });\n\t\twriteFileSync(suiteJsonPath, serializeSuiteJson(builtin), \"utf8\");\n\t\t// D-075 S4 第三批:首启不再预种角色文件——种子移到 subagent-delegate 插件\n\t\t// 注册期(entry 的幂等 seedFactoryRoleCatalog 补缺),插件安装并注册时\n\t\t// `<agentDir>/roles/{explore,reviewer}.json` 自然到位。\n\t\tsuite = builtin;\n\t} else {\n\t\tconst parsed = parseSuiteJson(readFileSync(suiteJsonPath, \"utf8\"), {\n\t\t\texpectedBuiltin: getBuiltinSuite(suiteId) !== undefined,\n\t\t\texpectedId: suiteId,\n\t\t});\n\t\tconst builtin = getBuiltinSuite(suiteId);\n\t\tif (parsed.valid && parsed.suite) {\n\t\t\tsuite = parsed.suite;\n\t\t} else if (builtin !== undefined) {\n\t\t\t// Builtin corruption policy (设计 §9): fall back to factory content\n\t\t\t// with diagnostics instead of locking the user out. The file on disk\n\t\t\t// is left untouched; recovery (reset) is an explicit M4 flow.\n\t\t\tsuite = builtin;\n\t\t\tdiagnostics.push(\n\t\t\t\t`suite.json at ${suiteJsonPath} is invalid; falling back to the factory content for builtin suite \"${suiteId}\". Errors: ${parsed.errors.join(\"; \")}`,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\tt(\n\t\t\t\t\t\"Invalid suite.json at {path}: {errors}. Fix the file, or delete the suite workspace directory {dir} and recreate it.\",\n\t\t\t\t\t{ path: suiteJsonPath, errors: parsed.errors.join(\"; \"), dir: suiteDir },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!existsSync(agentsMdPath)) {\n\t\twriteFileSync(agentsMdPath, \"\", \"utf8\");\n\t}\n\n\t// Suite profile lock persistence (M4, 设计 §12): an existing lock file is\n\t// verified against the current identity (drift/migration recorded, never\n\t// blocking and never silently replaced); without one a fresh lock is frozen\n\t// and persisted. A lock file that cannot be parsed is recreated with a\n\t// diagnostic — it carries no openable identity, so nothing is silently\n\t// replaced.\n\tconst lockPath = join(suiteDir, SUITE_LOCK_FILENAME);\n\tlet previousLock: ProfileLockV1 | undefined;\n\tif (existsSync(lockPath)) {\n\t\ttry {\n\t\t\tpreviousLock = parseSuiteProfileLockFile(readFileSync(lockPath, \"utf8\"));\n\t\t} catch (error) {\n\t\t\tdiagnostics.push(\n\t\t\t\t`Profile lock at ${lockPath} is unreadable; recreating it over the current suite identity. Errors: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst bridge = bridgeSuiteProfileLock({\n\t\tsuite,\n\t\t...(options.pluginProfile === undefined ? {} : { pluginProfile: options.pluginProfile }),\n\t\t...(previousLock === undefined ? {} : { previousLock }),\n\t\tlockedBy: \"suite-loader\",\n\t});\n\tdiagnostics.push(...bridge.diagnostics);\n\tif (previousLock === undefined) {\n\t\ttry {\n\t\t\twriteFileSync(lockPath, serializeSuiteProfileLockFile(bridge.lock), \"utf8\");\n\t\t} catch (error) {\n\t\t\tdiagnostics.push(\n\t\t\t\t`Failed to persist the suite profile lock at ${lockPath}: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// Orientation persona resolution (设计 §6.3): assistant/coding use the\n\t// compiled persona texts; custom reads the workspace persona.md verbatim\n\t// (BOM stripped, never trimmed), degrading to an empty persona with a\n\t// diagnostic instead of silently falling back to a builtin persona.\n\tconst personaPath = join(suiteDir, SUITE_PERSONA_MD_FILENAME);\n\tlet orientationPersona: string;\n\tif (suite.orientation !== \"custom\") {\n\t\torientationPersona = ORIENTATION_PROMPTS[suite.orientation];\n\t} else if (!existsSync(personaPath)) {\n\t\torientationPersona = \"\";\n\t\tdiagnostics.push(\n\t\t\t`Suite \"${suiteId}\" orientation is \"custom\" but ${personaPath} is missing; the orientation prompt stays empty until the file is created`,\n\t\t);\n\t} else {\n\t\ttry {\n\t\t\torientationPersona = stripBom(readFileSync(personaPath, \"utf8\"));\n\t\t} catch (error) {\n\t\t\torientationPersona = \"\";\n\t\t\tdiagnostics.push(\n\t\t\t\t`Persona file at ${personaPath} is unreadable; the orientation prompt stays empty. Errors: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn {\n\t\tsuite,\n\t\tsuiteDir,\n\t\tsuiteJsonPath,\n\t\tagentsMdPath,\n\t\torientationPersona,\n\t\tdiagnostics: Object.freeze(diagnostics),\n\t\tlockPath,\n\t\tlock: bridge.lock,\n\t\tidentity: bridge.identity,\n\t\t...(bridge.verification === undefined ? {} : { lockVerification: bridge.verification }),\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// agents.md three-level chain (设计 §8)\n// ---------------------------------------------------------------------------\n\nexport type SuiteAgentsMdSource = \"system\" | \"suite\" | \"project\";\n\nexport interface SuiteAgentsMdEntry {\n\treadonly source: SuiteAgentsMdSource;\n\treadonly path: string;\n\treadonly content: string;\n}\n\nexport interface SuiteAgentsMdAssembly {\n\treadonly chain: readonly SuiteAgentsMdEntry[];\n\treadonly diagnostics: readonly string[];\n}\n\nexport interface AssembleSuiteAgentsMdChainOptions {\n\treadonly suite: SuiteDefinition;\n\treadonly agentDir: string;\n\treadonly suiteJsonPath: string;\n\treadonly suiteAgentsMdPath: string;\n\t/**\n\t * Project-level context files exactly as produced by the existing resource\n\t * loader (`ResourceLoader.getAgentsFiles()`: agentDir global entry first,\n\t * then the AGENTS.md/CLAUDE.md ancestor chain). The ancestor chain logic is\n\t * delegated, never reimplemented; entries under agentDir are classified as\n\t * system-layer candidates.\n\t */\n\treadonly projectAgentsFiles: ReadonlyArray<{ path: string; content: string }>;\n}\n\nfunction readContextFile(path: string): string {\n\ttry {\n\t\treturn stripBom(readFileSync(path, \"utf8\"));\n\t} catch {\n\t\treturn \"\";\n\t}\n}\n\nfunction isUnderDir(path: string, dir: string): boolean {\n\tconst resolvedPath = resolve(path);\n\tconst resolvedDir = resolve(dir);\n\tconst prefix = resolvedDir.endsWith(sep) ? resolvedDir : `${resolvedDir}${sep}`;\n\treturn resolvedPath.startsWith(prefix);\n}\n\n/**\n * Assembles the agents.md three-level chain (设计 §8): system layer (the\n * agentDir context file the resource loader's agentsFiles already carries,\n * e.g. AGENTS.md, gated by inheritSystemAgentsMd) -> suite layer\n * (`suites/<id>/agents.md`) -> project layer (existing ancestor chain, passed\n * in unchanged). The global SYSTEM.md/APPEND_SYSTEM.md never ride the chain:\n * they keep their native system prompt channel and are gated there by\n * createSuiteSystemPromptGate, so both channels stay single-sourced. Every\n * entry carries its source label; missing layers are skipped. Diagnostics\n * record a blocked system layer (one-time migration hint) and the empty\n * association counts (设计 §11.3: 惰性 + 可观测).\n */\nexport function assembleSuiteAgentsMdChain(options: AssembleSuiteAgentsMdChainOptions): SuiteAgentsMdAssembly {\n\tconst { suite, agentDir, suiteJsonPath, suiteAgentsMdPath, projectAgentsFiles } = options;\n\tconst diagnostics: string[] = [];\n\n\t// System-layer candidates are the agentDir entries already present in the\n\t// loader's agentsFiles; they are never read from disk here again.\n\tconst systemCandidates = projectAgentsFiles\n\t\t.filter((entry) => isUnderDir(entry.path, agentDir))\n\t\t.map((entry) => ({ path: entry.path, content: entry.content }));\n\tconst projectEntries = projectAgentsFiles.filter((entry) => !isUnderDir(entry.path, agentDir));\n\n\tconst chain: SuiteAgentsMdEntry[] = [];\n\tif (suite.inheritSystemAgentsMd) {\n\t\tfor (const candidate of systemCandidates) {\n\t\t\tchain.push({ source: \"system\", path: candidate.path, content: candidate.content });\n\t\t}\n\t} else if (systemCandidates.length > 0) {\n\t\tdiagnostics.push(\n\t\t\t`Suite \"${suite.id}\" does not inherit the system agents.md layer (inheritSystemAgentsMd=false); system-layer file(s) kept out of the suite chain: ${systemCandidates\n\t\t\t\t.map((candidate) => candidate.path)\n\t\t\t\t.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}. Migrate them into ${suiteAgentsMdPath} or set \"inheritSystemAgentsMd\": true in ${suiteJsonPath}.`,\n\t\t);\n\t}\n\n\tchain.push({ source: \"suite\", path: suiteAgentsMdPath, content: readContextFile(suiteAgentsMdPath) });\n\tfor (const entry of projectEntries) {\n\t\tchain.push({ source: \"project\", path: entry.path, content: entry.content });\n\t}\n\n\t// Plugin associations are wired since M3 (the sdk filters the external\n\t// capability plugin pool by associations.plugins); mcp stays\n\t// declaration-only until M4.\n\tdiagnostics.push(\n\t\t`Suite \"${suite.id}\" mcp associations are declaration-only until M4; MCP association filtering is unwired.`,\n\t);\n\n\treturn { chain: Object.freeze(chain), diagnostics: Object.freeze(diagnostics) };\n}\n\n/**\n * Merges the assembled chain with the resource loader's own agentsFiles for\n * the contextFiles injection channel: chain entries are prepended unless they\n * are empty or already present in the base. Entries with empty content inject\n * nothing, so a fresh factory skeleton changes no prompt bytes. Base entries\n * under agentDir are dropped unconditionally (设计 §8): with\n * inheritSystemAgentsMd=false the switch blocks the system layer, with true\n * the chain already carries it at the head — keeping it in the base too would\n * duplicate it and pin it after the suite layer, breaking the\n * system -> suite -> project order.\n */\nexport function mergeSuiteAgentsFiles(\n\tchain: readonly SuiteAgentsMdEntry[],\n\tbase: ReadonlyArray<{ path: string; content: string }>,\n\toptions: { agentDir: string },\n): Array<{ path: string; content: string }> {\n\tconst retainedBase = base.filter((entry) => !isUnderDir(entry.path, options.agentDir));\n\tconst basePathSet = new Set(retainedBase.map((entry) => resolve(entry.path)));\n\tconst merged: Array<{ path: string; content: string }> = [];\n\tfor (const entry of chain) {\n\t\tif (entry.content.trim().length === 0) continue;\n\t\tif (basePathSet.has(resolve(entry.path))) continue;\n\t\tmerged.push({ path: entry.path, content: entry.content });\n\t}\n\tmerged.push(...retainedBase.map((entry) => ({ path: entry.path, content: entry.content })));\n\treturn merged;\n}\n\nexport interface SuiteSystemPromptGate {\n\t/** Gates the loader's main system prompt: the discovered file's content, or undefined. */\n\treadonly systemPromptOverride: (base: string | undefined) => string | undefined;\n\t/** Gates the loader's append system prompt: the discovered file's content array. */\n\treadonly appendSystemPromptOverride: (base: string[]) => string[];\n\t/** Blocked global system-layer files; filled as the overrides run, deduplicated. */\n\treadonly diagnostics: readonly string[];\n}\n\n/**\n * Gates the global SYSTEM.md/APPEND_SYSTEM.md system prompt channel by\n * inheritSystemAgentsMd (设计 §8: the switch governs the whole system layer,\n * not just the agents.md chain). The resource loader feeds both overrides with\n * the resolved content of exactly one discovered file — project-level\n * `<cwd>/.agent-forge/<name>` first, else global `<agentDir>/<name>` — with no\n * path attached, so project-level existence identifies the base origin:\n * present means the project layer, which per 设计 §4 is the third level and\n * always passes the switch; absent means a global source, which passes only\n * when the suite inherits the system layer. Blocked global files are recorded\n * in diagnostics with their paths (one-time migration hint, 设计 §11.3).\n */\nexport function createSuiteSystemPromptGate(\n\tsuite: SuiteDefinition,\n\toptions: { cwd: string; agentDir: string },\n): SuiteSystemPromptGate {\n\tconst diagnostics: string[] = [];\n\tconst passes = (filename: string): boolean => {\n\t\tconst projectPath = join(options.cwd, CONFIG_DIR_NAME, filename);\n\t\tif (existsSync(projectPath)) return true;\n\t\tif (suite.inheritSystemAgentsMd) return true;\n\t\tconst message =\n\t\t\t`Suite \"${suite.id}\" does not inherit the global system layer (inheritSystemAgentsMd=false); ` +\n\t\t\t`global file kept out of the model context: ${join(options.agentDir, filename)}. Move it to the ` +\n\t\t\t`project level (${projectPath}) or set \"inheritSystemAgentsMd\": true in the suite.json.`;\n\t\tif (!diagnostics.includes(message)) diagnostics.push(message);\n\t\treturn false;\n\t};\n\treturn {\n\t\tsystemPromptOverride: (base) => (base === undefined || passes(\"SYSTEM.md\") ? base : undefined),\n\t\tappendSystemPromptOverride: (base) => (base.length === 0 || passes(\"APPEND_SYSTEM.md\") ? base : []),\n\t\tdiagnostics,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Association filtering (设计 §3/§4/§11.3, M1b)\n// ---------------------------------------------------------------------------\n\nexport type SuiteAssociationKind = \"skills\" | \"plugins\" | \"capabilities\";\n\nexport interface SuiteAssociationFilterResult<T> {\n\t/** Entries that pass the filter, in input order. */\n\treadonly kept: T[];\n\t/** Association names that matched no discovered entry (设计 §11.3 dangling). */\n\treadonly dangling: readonly string[];\n}\n\n/**\n * Single-sourced dangling-association diagnostic text (设计 §11.3): reported\n * through the suiteDiagnostics channel, never thrown.\n */\nexport function suiteDanglingAssociationDiagnostic(suiteId: string, kind: SuiteAssociationKind, name: string): string {\n\treturn `Suite \"${suiteId}\" dangling association \"${name}\" (${kind}): not found in the discovered registry; ignored.`;\n}\n\n/**\n * Filters the discovered skills down to the suite's skill associations (设计\n * §3: the filter lives in the assembler; discovery stays untouched). Project\n * scope (`<cwd>/.agent-forge/`) is the third layer (设计 §4) and always passes;\n * every other entry is kept only when its `Skill.name` exactly matches an\n * `associations.skills` entry. Association names that match no discovered\n * skill — including case mismatches — are reported as dangling.\n *\n * `options.localSkillsDir` is the suite-local skill layer (统一修复轮 B:\n * `<agentDir>/suites/<id>/skills`): its entries live inside the active suite\n * workspace, so suite activation is their association and they pass the filter\n * by path — the suite-local layer exemption — instead of requiring an\n * association entry.\n */\nexport function filterSuiteSkills(\n\tsuite: SuiteDefinition,\n\tskills: ReadonlyArray<Skill>,\n\toptions?: { localSkillsDir?: string },\n): SuiteAssociationFilterResult<Skill> {\n\tconst associated = new Set(suite.associations.skills);\n\tconst discovered = new Set(skills.map((skill) => skill.name));\n\tconst dangling = suite.associations.skills.filter((name) => !discovered.has(name));\n\tconst localSkillsDir = options?.localSkillsDir;\n\tconst kept = skills.filter(\n\t\t(skill) =>\n\t\t\tskill.sourceInfo.scope === \"project\" ||\n\t\t\t(localSkillsDir !== undefined && isUnderDir(skill.filePath, localSkillsDir)) ||\n\t\t\tassociated.has(skill.name),\n\t);\n\treturn { kept, dangling: Object.freeze(dangling) };\n}\n\n// ---------------------------------------------------------------------------\n// Capability plugin pool filtering (设计 §10.4, M3)\n// ---------------------------------------------------------------------------\n\n/** One external capability plugin manifest discovered below a plugin pool root. */\nexport interface SuiteCapabilityPluginCandidate {\n\t/** Exact manifest id (`PluginManifest.id`). */\n\treadonly manifestId: string;\n\t/** Resolved manifest path, as it will be reported in diagnostics. */\n\treadonly manifestPath: string;\n}\n\nexport interface SuiteCapabilityPluginDecision {\n\treadonly keep: boolean;\n\t/** Diagnostic for a filtered-out plugin; absent when the plugin passes. */\n\treadonly diagnostic?: string;\n}\n\n/**\n * Decides one external capability plugin manifest against the suite's\n * `associations.plugins` (方案设计 §10.4, M3 双键语义: associations.plugins\n * governs only the external capability plugin pool; suite.capabilities governs\n * the compiled builtin ids). The project-level pool\n * (`<cwd>/.agent-forge/plugins`) is the third layer (设计 §4) and always\n * passes; every other manifest is kept only when its id matches an\n * association exactly. Filtered plugins surface as diagnostics, never as\n * errors.\n */\nexport function decideSuiteCapabilityPlugin(\n\tsuite: SuiteDefinition,\n\tcandidate: SuiteCapabilityPluginCandidate,\n\toptions: { cwd: string },\n): SuiteCapabilityPluginDecision {\n\tif (isUnderDir(candidate.manifestPath, join(options.cwd, CONFIG_DIR_NAME, \"plugins\"))) return { keep: true };\n\tif (suite.associations.plugins.includes(candidate.manifestId)) return { keep: true };\n\treturn {\n\t\tkeep: false,\n\t\tdiagnostic: `Suite \"${suite.id}\" capability plugin \"${candidate.manifestId}\" at ${candidate.manifestPath} is not associated; not loaded.`,\n\t};\n}\n\n/**\n * Dangling `associations.plugins` entries: association ids that matched no\n * candidate capability plugin manifest (设计 §11.3), single-sourced through\n * the shared dangling diagnostic text. The caller decides what counts as a\n * candidate: the sdk assembler passes every manifest id it loads, so explicit\n * capabilityPluginPaths count toward satisfying an association even though\n * they bypass the keep filter; only manifests absent from the passed ids\n * surface as dangling.\n */\nexport function suiteDanglingPluginAssociations(\n\tsuite: SuiteDefinition,\n\tdiscoveredManifestIds: readonly string[],\n): readonly string[] {\n\tconst discovered = new Set(discoveredManifestIds);\n\treturn suite.associations.plugins\n\t\t.filter((id) => !discovered.has(id))\n\t\t.map((id) => suiteDanglingAssociationDiagnostic(suite.id, \"plugins\", id));\n}\n\n// ---------------------------------------------------------------------------\n// Shared suite loader assembly (设计 §3/§4/§8, M2)\n// ---------------------------------------------------------------------------\n\n/**\n * The DefaultResourceLoader override subset that wires a resolved suite into a\n * loader: the agents.md three-level chain, the skill/extension association\n * filters, and the inheritSystemAgentsMd gate on the global SYSTEM.md/\n * APPEND_SYSTEM.md prompt channel. Structurally compatible with the matching\n * DefaultResourceLoaderOptions fields.\n */\nexport interface SuiteLoaderOverrides {\n\tagentsFilesOverride: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tskillsOverride: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tsystemPromptOverride: (base: string | undefined) => string | undefined;\n\tappendSystemPromptOverride: (base: string[]) => string[];\n}\n\nexport interface SuiteAssembly {\n\treadonly workspace: SuiteWorkspace;\n\t/** Optional domain plugin profile selected for this suite. */\n\treadonly pluginProfile?: BuiltinPluginProfileResolutionV1;\n\t/** Spread into DefaultResourceLoader options to wire the suite in. */\n\treadonly loaderOverrides: SuiteLoaderOverrides;\n\t/**\n\t * The suite-local skill layer directory (统一修复轮 B) when it exists on\n\t * disk; inject it into the loader's skill paths so suites/<id>/skills load\n\t * with the suite itself. Undefined when the directory is absent, so empty\n\t * and missing directories both contribute nothing.\n\t */\n\treadonly localSkillsDir?: string;\n\t/**\n\t * The suite-local capability-plugin layer directory (统一修复轮 B) when it\n\t * exists on disk; discover its manifests into the session's capability\n\t * plugin candidates. Undefined when the directory is absent.\n\t */\n\treadonly localPluginsDir?: string;\n\t/**\n\t * Snapshot of every suite assembly diagnostic collected so far — workspace\n\t * provisioning, agents.md chain, extension/skill filters, system prompt\n\t * gate, context budget — in the canonical suiteDiagnostics order. Overrides\n\t * that have not run yet contribute nothing (the budget line needs the\n\t * assembled agents.md chain).\n\t */\n\tcollectDiagnostics(): readonly string[];\n}\n\n/**\n * Single-sourced assembly-layer context budget estimate (统一修复轮 B): pure\n * chars/4 arithmetic over the assembled agents.md chain (per source layer),\n * the orientation persona text, plus the count of suite-local workspace\n * skills. Diagnostic-only: it never blocks, gates, or degrades anything.\n */\nexport function suiteContextBudgetDiagnostic(\n\tsuiteId: string,\n\tchain: ReadonlyArray<SuiteAgentsMdEntry>,\n\toptions: { personaChars: number; workspaceSkillCount: number },\n): string {\n\tconst layerChars: Record<SuiteAgentsMdSource, number> = { system: 0, suite: 0, project: 0 };\n\tfor (const entry of chain) {\n\t\tlayerChars[entry.source] += entry.content.length;\n\t}\n\tconst tokens = (chars: number): number => Math.round(chars / 4);\n\tconst system = tokens(layerChars.system);\n\tconst suiteLayer = tokens(layerChars.suite);\n\tconst project = tokens(layerChars.project);\n\treturn `Suite \"${suiteId}\" context budget: agents.md ~${system + suiteLayer + project} tok (system ${system}/suite ${suiteLayer}/project ${project}), persona ~${tokens(options.personaChars)} tok, workspace skills ${options.workspaceSkillCount}`;\n}\n\n/**\n * Plugin-profile diagnostics in the canonical suiteDiagnostics order.\n *\n * D-075 S2 soft degradation: a resolved Profile renders structured per-plugin\n * misses (e.g. `manifest_missing` for a package-distributed plugin without an\n * installed active version) as readable diagnostics, so the session keeps\n * starting without the missing plugin's tools and the miss stays visible.\n * Blocked resolutions already render every plugin diagnostic through\n * `resolution.diagnostics`; the per-plugin lines are additive for the\n * non-blocked branches only.\n */\nfunction pluginProfileDiagnosticsV1(profile: BuiltinPluginProfileResolutionV1): readonly string[] {\n\tif (profile.status === \"not_found\") return [`Plugin profile unavailable: ${profile.profileId}`];\n\tif (profile.status === \"host_facts_required\") return [`Plugin profile host facts required: ${profile.profileId}`];\n\tif (profile.status === \"invalid_selection\")\n\t\treturn [\n\t\t\t`Plugin profile invalid selection: ${profile.profileId} (unknown: ${profile.unknownPluginIds.join(\", \") || \"none\"}; duplicates: ${profile.duplicatePluginIds.join(\", \") || \"none\"})`,\n\t\t];\n\tconst pluginMisses =\n\t\tprofile.resolution.status === \"blocked\"\n\t\t\t? []\n\t\t\t: profile.resolution.plugins\n\t\t\t\t\t.filter((plugin) => plugin.status !== \"installed-ready\")\n\t\t\t\t\t.flatMap((plugin) =>\n\t\t\t\t\t\tplugin.diagnostics.map(\n\t\t\t\t\t\t\t(diagnostic) =>\n\t\t\t\t\t\t\t\t`Plugin profile plugin unavailable: ${plugin.pluginId} (${diagnostic.code}): ${diagnostic.message}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\tif (profile.resolution.status === \"blocked\")\n\t\treturn profile.resolution.diagnostics.map((diagnostic) => `Plugin profile blocked: ${diagnostic.message}`);\n\tif (profile.assembly?.status === \"unverified\")\n\t\treturn [\n\t\t\t...profile.assembly.unverified.map(\n\t\t\t\t(plugin) => `Plugin profile unverified: ${plugin.pluginId}@${plugin.pluginVersion}`,\n\t\t\t),\n\t\t\t...pluginMisses,\n\t\t];\n\treturn pluginMisses;\n}\n\n/**\n * The single suite assembly used by both first-party entry paths (sdk.ts\n * self-built loader and agent-session-services `suiteAssembly`), so the two\n * cannot drift. Loads the suite workspace, builds the system prompt gate, and\n * returns the loader overrides plus a diagnostics collection channel.\n */\nexport function createSuiteAssembly(options: {\n\tcwd: string;\n\tagentDir: string;\n\tsuiteId: string;\n\tpluginProfileId?: BuiltinPluginProfileIdV1;\n\tselectedPluginIds?: readonly string[];\n\tdisabledPluginIds?: readonly string[];\n\tpluginHost?: HostFactsV1;\n\tverifiedPlugins?: readonly VerifiedToolPluginV1[];\n\t/** Explicit host-owned active installed manifests; never discovered implicitly. */\n\tmanifestOverrides?: BuiltinPluginManifestOverridesV1;\n\tpluginProfile?: BuiltinPluginProfileResolutionV1;\n}): SuiteAssembly {\n\tconst { cwd, agentDir, suiteId } = options;\n\tlet pluginProfile = options.pluginProfile;\n\tif (pluginProfile === undefined && options.pluginProfileId !== undefined) {\n\t\tpluginProfile =\n\t\t\toptions.pluginHost === undefined\n\t\t\t\t? ({ status: \"host_facts_required\", profileId: options.pluginProfileId } as const)\n\t\t\t\t: resolveBuiltinPluginProfileV1({\n\t\t\t\t\t\tprofileId: options.pluginProfileId,\n\t\t\t\t\t\tselectedPluginIds: options.selectedPluginIds,\n\t\t\t\t\t\tdisabledPluginIds: options.disabledPluginIds,\n\t\t\t\t\t\thost: options.pluginHost,\n\t\t\t\t\t\tverifiedPlugins: options.verifiedPlugins,\n\t\t\t\t\t\tmanifestOverrides: options.manifestOverrides,\n\t\t\t\t\t});\n\t}\n\tconst workspace = loadSuiteWorkspace({\n\t\tagentDir,\n\t\tsuiteId,\n\t\t...(pluginProfile === undefined ? {} : { pluginProfile }),\n\t});\n\tconst gate = createSuiteSystemPromptGate(workspace.suite, { cwd, agentDir });\n\t// Suite-local asset layer (统一修复轮 B): present directories only, so\n\t// missing and empty directories both contribute nothing.\n\tconst localSkillsDir = getSuiteLocalSkillsDir(agentDir, suiteId);\n\tconst localPluginsDir = getSuiteLocalPluginsDir(agentDir, suiteId);\n\tconst hasLocalSkillsDir = existsSync(localSkillsDir);\n\tconst hasLocalPluginsDir = existsSync(localPluginsDir);\n\tconst workspaceSkillCount = hasLocalSkillsDir\n\t\t? loadSkills({ cwd, agentDir, skillPaths: [localSkillsDir], includeDefaults: false }).skills.length\n\t\t: 0;\n\tlet chainDiagnostics: readonly string[] = [];\n\tlet skillDiagnostics: readonly string[] = [];\n\t// The assembled chain as far as the agentsFilesOverride has run; the budget\n\t// line is only honest once the real chain is known.\n\tlet assembledChain: readonly SuiteAgentsMdEntry[] | undefined;\n\t// Factory upgrade proposal (M4, 设计 §9 升级合并): an unbounded registry\n\t// resolve only proposes when the factory source wins, i.e. its revision is\n\t// strictly greater than the disk revision. Daily assembly keeps the disk\n\t// contents; adoption is an explicit --suite-reset.\n\tconst upgrade = detectSuiteFactoryUpgrade(workspace.suite);\n\tconst proposalDiagnostics = upgrade === undefined ? [] : [suiteFactoryUpgradeDiagnostic(suiteId, upgrade)];\n\tconst budgetDiagnostics = (): readonly string[] => {\n\t\tif (assembledChain === undefined) return [];\n\t\treturn [\n\t\t\tsuiteContextBudgetDiagnostic(suiteId, assembledChain, {\n\t\t\t\tpersonaChars: workspace.orientationPersona.length,\n\t\t\t\tworkspaceSkillCount,\n\t\t\t}),\n\t\t];\n\t};\n\treturn {\n\t\tworkspace,\n\t\t...(pluginProfile === undefined ? {} : { pluginProfile }),\n\t\t...(hasLocalSkillsDir ? { localSkillsDir } : {}),\n\t\t...(hasLocalPluginsDir ? { localPluginsDir } : {}),\n\t\tloaderOverrides: {\n\t\t\tagentsFilesOverride: (base) => {\n\t\t\t\tconst assembly = assembleSuiteAgentsMdChain({\n\t\t\t\t\tsuite: workspace.suite,\n\t\t\t\t\tagentDir,\n\t\t\t\t\tsuiteJsonPath: workspace.suiteJsonPath,\n\t\t\t\t\tsuiteAgentsMdPath: workspace.agentsMdPath,\n\t\t\t\t\tprojectAgentsFiles: base.agentsFiles,\n\t\t\t\t});\n\t\t\t\tchainDiagnostics = assembly.diagnostics;\n\t\t\t\tassembledChain = assembly.chain;\n\t\t\t\treturn { agentsFiles: mergeSuiteAgentsFiles(assembly.chain, base.agentsFiles, { agentDir }) };\n\t\t\t},\n\t\t\tskillsOverride: (base) => {\n\t\t\t\tconst filtered = filterSuiteSkills(workspace.suite, base.skills, { localSkillsDir });\n\t\t\t\tskillDiagnostics = filtered.dangling.map((name) =>\n\t\t\t\t\tsuiteDanglingAssociationDiagnostic(suiteId, \"skills\", name),\n\t\t\t\t);\n\t\t\t\treturn { skills: filtered.kept, diagnostics: base.diagnostics };\n\t\t\t},\n\t\t\tsystemPromptOverride: gate.systemPromptOverride,\n\t\t\tappendSystemPromptOverride: gate.appendSystemPromptOverride,\n\t\t},\n\t\tcollectDiagnostics: () =>\n\t\t\tObject.freeze([\n\t\t\t\t...workspace.diagnostics,\n\t\t\t\t...(pluginProfile === undefined ? [] : pluginProfileDiagnosticsV1(pluginProfile)),\n\t\t\t\t...proposalDiagnostics,\n\t\t\t\t...chainDiagnostics,\n\t\t\t\t...skillDiagnostics,\n\t\t\t\t...budgetDiagnostics(),\n\t\t\t\t...gate.diagnostics,\n\t\t\t]),\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Session suite binding reader (设计 §10.1, 统一修复轮 B)\n// ---------------------------------------------------------------------------\n\n/**\n * Reads the suite binding recorded as session protocol data (设计 §10.1): the\n * suiteId of the latest `SUITE_SESSION_ENTRY_TYPE` custom entry. Undefined\n * when the session carries no binding — pre-suite sessions, entries without a\n * data payload, or payloads without a non-empty string suiteId.\n */\nexport function readSessionSuiteId(\n\tentries: ReadonlyArray<{ type: string; customType?: string; data?: unknown }>,\n): string | undefined {\n\treturn readSessionSuiteBinding(entries)?.suiteId;\n}\n\nexport interface SessionSuiteBindingV1 {\n\treadonly suiteId: string;\n\treadonly profileIdentity?: ProfileIdentityV1;\n}\n\nfunction sessionProfileIdentity(value: unknown): ProfileIdentityV1 | undefined {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\ttypeof record.profileId !== \"string\" ||\n\t\trecord.profileId.trim() === \"\" ||\n\t\ttypeof record.profileVersion !== \"string\" ||\n\t\trecord.profileVersion.trim() === \"\" ||\n\t\ttypeof record.manifestDigest !== \"string\" ||\n\t\trecord.manifestDigest.trim() === \"\" ||\n\t\t!Array.isArray(record.capabilityVersions)\n\t) {\n\t\treturn undefined;\n\t}\n\tconst capabilityVersions: { id: string; version: number }[] = [];\n\tfor (const entry of record.capabilityVersions) {\n\t\tif (entry === null || typeof entry !== \"object\" || Array.isArray(entry)) return undefined;\n\t\tconst capability = entry as Record<string, unknown>;\n\t\tif (\n\t\t\ttypeof capability.id !== \"string\" ||\n\t\t\tcapability.id.trim() === \"\" ||\n\t\t\ttypeof capability.version !== \"number\" ||\n\t\t\t!Number.isSafeInteger(capability.version) ||\n\t\t\tcapability.version < 1\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tcapabilityVersions.push({ id: capability.id, version: capability.version });\n\t}\n\treturn Object.freeze({\n\t\tprofileId: record.profileId,\n\t\tprofileVersion: record.profileVersion,\n\t\tmanifestDigest: record.manifestDigest,\n\t\tcapabilityVersions: Object.freeze(capabilityVersions) as readonly {\n\t\t\treadonly id: string;\n\t\t\treadonly version: number;\n\t\t}[],\n\t});\n}\n\n/** Reads the latest suite and optional Profile identity bound to a session. */\nexport function readSessionSuiteBinding(\n\tentries: ReadonlyArray<{ type: string; customType?: string; data?: unknown }>,\n): SessionSuiteBindingV1 | undefined {\n\tfor (let index = entries.length - 1; index >= 0; index--) {\n\t\tconst entry = entries[index];\n\t\tif (entry.type !== \"custom\" || entry.customType !== SUITE_SESSION_ENTRY_TYPE) continue;\n\t\tconst data = entry.data;\n\t\tif (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n\t\t\tconst suiteId = (data as { suiteId?: unknown }).suiteId;\n\t\t\tif (typeof suiteId === \"string\" && suiteId.length > 0) {\n\t\t\t\tconst profileIdentity = sessionProfileIdentity((data as { profileIdentity?: unknown }).profileIdentity);\n\t\t\t\treturn Object.freeze({\n\t\t\t\t\tsuiteId,\n\t\t\t\t\t...(profileIdentity === undefined ? {} : { profileIdentity }),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Suite -> ProfileIdentityV1 -> lock bridge (设计 §12)\n// ---------------------------------------------------------------------------\n\nfunction suiteToJsonValue(suite: SuiteDefinition): JsonValue {\n\treturn {\n\t\tschemaVersion: suite.schemaVersion,\n\t\tid: suite.id,\n\t\tname: suite.name,\n\t\tbuiltin: suite.builtin,\n\t\ttools: [...suite.tools],\n\t\tcapabilities: [...suite.capabilities],\n\t\tassociations: {\n\t\t\tskills: [...suite.associations.skills],\n\t\t\tmcp: [...suite.associations.mcp],\n\t\t\tplugins: [...suite.associations.plugins],\n\t\t},\n\t\tinheritSystemAgentsMd: suite.inheritSystemAgentsMd,\n\t\tmemory: suite.memory,\n\t\torientation: suite.orientation,\n\t\tmodel: suite.model,\n\t\tthinking: suite.thinking,\n\t\tclonedFrom: suite.clonedFrom\n\t\t\t? { id: suite.clonedFrom.id, digest: suite.clonedFrom.digest, at: suite.clonedFrom.at }\n\t\t\t: null,\n\t\t...(suite.factoryRevision === undefined ? {} : { factoryRevision: suite.factoryRevision }),\n\t};\n}\n\n/** The stable suite.json digest that rides as the suite profile manifest digest. */\nexport function suiteManifestDigest(suite: SuiteDefinition): string {\n\treturn stableJsonDigest(suiteToJsonValue(suite));\n}\n\n/**\n * Builds the ProfileIdentityV1 for an assembled suite. The identity is a pure\n * function of suite.json: the stable suite.json digest rides as the single\n * resolved \"manifest\", and the declared capabilities map to capability\n * references at version 1. No new identity/lock mechanism is introduced.\n */\nexport function buildSuiteProfileIdentity(\n\tsuite: SuiteDefinition,\n\tpluginProfile?: BuiltinPluginProfileResolutionV1,\n): ProfileIdentityV1 {\n\tconst fingerprint = suiteManifestDigest(suite);\n\tconst suiteCapabilityRefs = suite.capabilities.map((id) => ({ id, version: 1 }));\n\tconst pluginRefs =\n\t\tpluginProfile?.status === \"resolved\" && pluginProfile.resolution.status === \"ready\"\n\t\t\t? pluginProfile.resolution.resolvedManifest.plugins\n\t\t\t: [];\n\tconst capabilityRefs = [...suiteCapabilityRefs, ...pluginRefs.flatMap((plugin) => plugin.capabilityRefs)].sort(\n\t\t(left, right) => left.id.localeCompare(right.id) || left.version - right.version,\n\t);\n\treturn buildProfileIdentityV1({\n\t\tprofileId: suiteProfileId(suite.id),\n\t\tprofileVersion: `${SUITE_SCHEMA_VERSION}`,\n\t\tresolvedPlugins: [\n\t\t\t{\n\t\t\t\tpluginId: `${suite.id}/suite.json`,\n\t\t\t\tpluginVersion: fingerprint,\n\t\t\t\tcapabilityRefs: suiteCapabilityRefs,\n\t\t\t},\n\t\t\t...(pluginProfile?.status === \"resolved\" && pluginProfile.resolution.status === \"ready\"\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpluginId: `profile:${pluginProfile.profile.id}`,\n\t\t\t\t\t\t\tpluginVersion: pluginProfile.profile.version,\n\t\t\t\t\t\t\tcapabilityRefs: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...pluginRefs,\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t],\n\t\tcapabilityVersions: capabilityRefs,\n\t});\n}\n\n// ---------------------------------------------------------------------------\n// ProfileRegistryV1 hookup: factory/disk sources and upgrade proposals (M4)\n// ---------------------------------------------------------------------------\n\n/** Registry profileId namespace for suites (设计 §12). */\nexport function suiteProfileId(suiteId: string): string {\n\treturn `suite:${suiteId}`;\n}\n\nexport const SUITE_FACTORY_REGISTRY_SOURCE_ID = \"suite-factory\";\nexport const SUITE_DISK_REGISTRY_SOURCE_ID = \"suite-disk\";\n/** Lower priority wins same-version ties: the disk contents beat the factory. */\nconst SUITE_FACTORY_REGISTRY_PRIORITY = 10;\nconst SUITE_DISK_REGISTRY_PRIORITY = 0;\n\n/** The effective on-disk revision: absent key means FACTORY_CONTENTS_VERSION. */\nfunction suiteDiskRevision(suite: SuiteDefinition): number {\n\treturn suite.factoryRevision ?? FACTORY_CONTENTS_VERSION;\n}\n\n/** Builds the registry entry of one suite definition (version = factoryRevision). */\nexport function buildSuiteRegistryEntry(suite: SuiteDefinition): RegistryProfileEntryV1 {\n\treturn {\n\t\tprofileId: suiteProfileId(suite.id),\n\t\tprofileVersion: String(suiteDiskRevision(suite)),\n\t\tmanifestDigest: suiteManifestDigest(suite),\n\t};\n}\n\n/** Factory source over the builtin declarations (priority 10). */\nexport function buildSuiteFactoryRegistrySource(): RegistrySourceV1 {\n\treturn {\n\t\tsourceId: SUITE_FACTORY_REGISTRY_SOURCE_ID,\n\t\tpriority: SUITE_FACTORY_REGISTRY_PRIORITY,\n\t\tprofiles: BUILTIN_SUITES.map(buildSuiteRegistryEntry),\n\t};\n}\n\n/** Disk source over workspace-effective definitions (priority 0; wins ties). */\nexport function buildSuiteDiskRegistrySource(suites: readonly SuiteDefinition[]): RegistrySourceV1 {\n\treturn {\n\t\tsourceId: SUITE_DISK_REGISTRY_SOURCE_ID,\n\t\tpriority: SUITE_DISK_REGISTRY_PRIORITY,\n\t\tprofiles: suites.map(buildSuiteRegistryEntry),\n\t};\n}\n\nexport interface SuiteFactoryUpgrade {\n\t/** Revision the factory builtin declaration carries. */\n\treadonly factoryRevision: number;\n\t/** Revision effective on disk. */\n\treadonly diskRevision: number;\n}\n\n/** Single-sourced upgrade-proposal diagnostic text (设计 §9 升级合并). */\nexport function suiteFactoryUpgradeDiagnostic(suiteId: string, upgrade: SuiteFactoryUpgrade): string {\n\treturn `Suite \"${suiteId}\": factory revision ${upgrade.factoryRevision} available (disk has ${upgrade.diskRevision}); run \"--suite-reset ${suiteId}\" to review and adopt.`;\n}\n\n/**\n * Detects a factory upgrade proposal for one disk-effective suite: an\n * unbounded registry resolve over the factory source (all builtins) plus a\n * disk source carrying exactly the effective definition. The factory source\n * wins only when its revision is strictly greater — same-version resolves\n * keep the disk contents (priority 0), so no proposal is emitted for\n * unchanged suites, and user suites (no factory entry) never resolve to the\n * factory. Pure function; the caller decides what to do with the proposal.\n */\nexport function detectSuiteFactoryUpgrade(diskSuite: SuiteDefinition): SuiteFactoryUpgrade | undefined {\n\tconst registry = createProfileRegistry();\n\tregistry.registerSource(buildSuiteFactoryRegistrySource());\n\tregistry.registerSource(buildSuiteDiskRegistrySource([diskSuite]));\n\tconst resolution = registry.resolve({ profileId: suiteProfileId(diskSuite.id) });\n\tif (resolution.status !== \"resolved\" || resolution.sourceId !== SUITE_FACTORY_REGISTRY_SOURCE_ID) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tfactoryRevision: Number.parseInt(resolution.profileVersion, 10),\n\t\tdiskRevision: suiteDiskRevision(diskSuite),\n\t};\n}\n\nexport interface SuiteProfileLockBridge {\n\treadonly identity: ProfileIdentityV1;\n\t/**\n\t * The lock for this assembly. When a previous lock exists it is kept as-is\n\t * (a lock is never silently replaced); without one, a fresh lock freezes\n\t * the current identity.\n\t */\n\treadonly lock: ProfileLockV1;\n\treadonly verification?: ProfileLockVerificationV1;\n\t/** Drift/migration findings; recorded, never blocking in M1a (设计 §12). */\n\treadonly diagnostics: readonly string[];\n}\n\n/** Bridges an assembled suite onto the existing lock create/verify trio. */\nexport function bridgeSuiteProfileLock(options: {\n\treadonly suite: SuiteDefinition;\n\treadonly pluginProfile?: BuiltinPluginProfileResolutionV1;\n\treadonly previousLock?: ProfileLockV1;\n\treadonly lockedBy?: string;\n\treadonly now?: () => number;\n}): SuiteProfileLockBridge {\n\tconst identity = buildSuiteProfileIdentity(options.suite, options.pluginProfile);\n\tconst diagnostics: string[] = [];\n\tlet verification: ProfileLockVerificationV1 | undefined;\n\tif (options.previousLock !== undefined) {\n\t\tverification = verifyProfileLock(options.previousLock, identity);\n\t\tif (verification.status === \"drift\") {\n\t\t\t// 2026-10-01 dogfood finding: the bare drift reason left no recovery\n\t\t\t// path. Deleting the lock file and restarting rebuilds it from the\n\t\t\t// resolved manifest (loadSuiteWorkspace re-freezes a fresh lock).\n\t\t\tdiagnostics.push(\n\t\t\t\t`Suite \"${options.suite.id}\" profile lock drift: ${verification.reason}; to recover, delete <agentDir>/suites/${options.suite.id}/${SUITE_LOCK_FILENAME} and restart (the lock rebuilds from the resolved manifest)`,\n\t\t\t);\n\t\t} else if (verification.status === \"migration_required\") {\n\t\t\tdiagnostics.push(`Suite \"${options.suite.id}\" profile lock migration required: ${verification.reason}`);\n\t\t}\n\t}\n\tconst lock =\n\t\toptions.previousLock ??\n\t\tcreateProfileLock(identity, {\n\t\t\tlockedBy: options.lockedBy ?? \"suite-loader\",\n\t\t\t...(options.now === undefined ? {} : { now: options.now }),\n\t\t});\n\treturn {\n\t\tidentity,\n\t\tlock,\n\t\t...(verification === undefined ? {} : { verification }),\n\t\tdiagnostics: Object.freeze(diagnostics),\n\t};\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suite-loader.js","sourceRoot":"","sources":["../../src/profiles/suite-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAG9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EAEpB,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AACpD,MAAM,C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EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;SAC1D,CAAC,CAAC;IACJ,OAAO;QACN,QAAQ;QACR,IAAI;QACJ,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;QACvD,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;KACvC,CAAC;AAAA,CACF","sourcesContent":["/**\n * Suite workspace location, lazy provisioning, and assembly (方案系统设计.md v2\n * §4/§5/§8/§9/§11/§12, M1a).\n *\n * The loader is the assembler layer of the suite system: it resolves the\n * active suite id (explicit > AGENT_FORGE_SUITE > project settings > global\n * settings > \"assistant\"), provisions the builtin suite workspaces under\n * `<agentDir>/suites/<id>/`, assembles the agents.md three-level chain\n * (system -> suite -> project, 设计 §8), gates the global SYSTEM.md/\n * APPEND_SYSTEM.md system prompt channel by inheritSystemAgentsMd (设计 §4:\n * the project-level `<cwd>/.agent-forge/` layer always passes), and bridges\n * the assembled suite onto the existing ProfileIdentityV1/ProfileLock\n * mechanisms. The project level of the chain is delegated to the existing\n * resource loader — the ancestor chain logic itself is never reimplemented\n * here.\n */\n\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join, resolve, sep } from \"node:path\";\nimport type { JsonValue } from \"@agent-forge/ai\";\nimport { CONFIG_DIR_NAME } from \"../config.ts\";\nimport type { ResourceDiagnostic } from \"../core/diagnostics.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { SettingsManager } from \"../core/settings-manager.ts\";\nimport type { Skill } from \"../core/skills.ts\";\nimport { loadSkills } from \"../core/skills.ts\";\nimport type { HostFactsV1 } from \"../plugins/ecosystem/types.ts\";\nimport type { ProfileIdentityV1 } from \"../profile/identity.ts\";\nimport { buildProfileIdentityV1, stableJsonDigest } from \"../profile/identity.ts\";\nimport type { ProfileLockV1, ProfileLockVerificationV1 } from \"../profile/lock.ts\";\nimport { createProfileLock, verifyProfileLock } from \"../profile/lock.ts\";\nimport type {\n\tBuiltinPluginManifestOverridesV1,\n\tBuiltinPluginProfileIdV1,\n\tBuiltinPluginProfileResolutionV1,\n} from \"../profile/plugin-profiles.ts\";\nimport { resolveBuiltinPluginProfileV1 } from \"../profile/plugin-profiles.ts\";\nimport type { VerifiedToolPluginV1 } from \"../profile/profile-assembly.ts\";\nimport type { RegistryProfileEntryV1, RegistrySourceV1 } from \"../profile/profile-registry.ts\";\nimport { createProfileRegistry } from \"../profile/profile-registry.ts\";\nimport { stripBom } from \"../utils/text.ts\";\nimport {\n\tBUILTIN_SUITES,\n\tDEFAULT_SUITE_ID,\n\tFACTORY_CONTENTS_VERSION,\n\tgetBuiltinSuite,\n\tisBuiltinSuiteId,\n\tisValidSuiteId,\n\tORIENTATION_PROMPTS,\n\tparseSuiteJson,\n\tSUITE_SCHEMA_VERSION,\n\ttype SuiteDefinition,\n\tserializeSuiteJson,\n} from \"./builtin-suites.ts\";\n\nexport { DEFAULT_SUITE_ID };\n\nexport const SUITES_DIR_NAME = \"suites\";\nexport const SUITE_MANIFEST_FILENAME = \"suite.json\";\nexport const SUITE_AGENTS_MD_FILENAME = \"agents.md\";\nexport const SUITE_PERSONA_MD_FILENAME = \"persona.md\";\nexport const SUITE_ENV_VAR = \"AGENT_FORGE_SUITE\";\n/** customType of the session custom entry recording the suite a session was created with (设计 §10.1). */\nexport const SUITE_SESSION_ENTRY_TYPE = \"suite\";\n/** Persisted suite profile lock inside the suite workspace (M4, 设计 §12). */\nexport const SUITE_LOCK_FILENAME = \".profile-lock.json\";\n\nexport function getSuitesRootDir(agentDir: string): string {\n\treturn join(agentDir, SUITES_DIR_NAME);\n}\n\nexport function getSuiteWorkspaceDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuitesRootDir(agentDir), suiteId);\n}\n\n/** The suite-local skill layer directory (统一修复轮 B): `<suiteDir>/skills`. */\nexport function getSuiteLocalSkillsDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuiteWorkspaceDir(agentDir, suiteId), \"skills\");\n}\n\n/** The suite-local capability-plugin layer directory (统一修复轮 B): `<suiteDir>/plugins`. */\nexport function getSuiteLocalPluginsDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuiteWorkspaceDir(agentDir, suiteId), \"plugins\");\n}\n\n/** Structured error for unknown suite ids; lists the available ids (设计 §9). */\nexport class SuiteResolutionError extends Error {\n\treadonly requestedId: string;\n\treadonly availableSuiteIds: readonly string[];\n\n\tconstructor(requestedId: string, availableSuiteIds: readonly string[]) {\n\t\tsuper(`Unknown suite \"${requestedId}\". Available suites: ${availableSuiteIds.join(\", \")}`);\n\t\tthis.name = \"SuiteResolutionError\";\n\t\tthis.requestedId = requestedId;\n\t\tthis.availableSuiteIds = Object.freeze([...availableSuiteIds]);\n\t}\n}\n\n/** Structured error for resuming a session under a suite it is not bound to. */\nexport class SuiteRebindError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"SuiteRebindError\";\n\t}\n}\n\n/**\n * Every suite id resolvable on this host: the builtin pair plus user\n * workspaces that already contain a suite.json.\n */\nexport function listSuiteIds(agentDir: string): string[] {\n\tconst ids = new Set(BUILTIN_SUITES.map((suite) => suite.id));\n\tconst rootDir = getSuitesRootDir(agentDir);\n\tif (existsSync(rootDir)) {\n\t\tfor (const entry of readdirSync(rootDir, { withFileTypes: true })) {\n\t\t\tif (!entry.isDirectory()) continue;\n\t\t\tif (!existsSync(join(rootDir, entry.name, SUITE_MANIFEST_FILENAME))) continue;\n\t\t\tids.add(entry.name);\n\t\t}\n\t}\n\treturn [...ids].sort();\n}\n\nexport interface ResolveSuiteIdOptions {\n\t/** Explicit suite id (SDK/CLI parameter); highest priority. */\n\texplicit?: string;\n\t/** Raw AGENT_FORGE_SUITE value; callers pass process.env[SUITE_ENV_VAR]. */\n\tenvSuite?: string;\n\t/** Settings source for the project/global `suite` keys. */\n\tsettings?: Pick<SettingsManager, \"getProjectSettings\" | \"getGlobalSettings\">;\n\t/** Agent dir used for workspace discovery and available-id listing. */\n\tagentDir: string;\n}\n\nfunction normalizeCandidate(value: unknown): string | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\tconst trimmed = value.trim();\n\treturn trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Resolves the active suite id: explicit > env AGENT_FORGE_SUITE > project\n * settings `suite` > global settings `suite` > \"coding\" (设计 §9). The\n * first configured value wins; an unknown or malformed value is a structured\n * error, never a silent fallback.\n */\nexport function resolveSuiteId(options: ResolveSuiteIdOptions): string {\n\tconst candidate =\n\t\tnormalizeCandidate(options.explicit) ??\n\t\tnormalizeCandidate(options.envSuite) ??\n\t\t(options.settings === undefined ? undefined : normalizeCandidate(options.settings.getProjectSettings().suite)) ??\n\t\t(options.settings === undefined ? undefined : normalizeCandidate(options.settings.getGlobalSettings().suite));\n\tif (candidate === undefined) return DEFAULT_SUITE_ID;\n\tif (!isValidSuiteId(candidate)) throw new SuiteResolutionError(candidate, listSuiteIds(options.agentDir));\n\tif (!isBuiltinSuiteId(candidate)) {\n\t\tconst workspaceManifest = join(getSuiteWorkspaceDir(options.agentDir, candidate), SUITE_MANIFEST_FILENAME);\n\t\tif (!existsSync(workspaceManifest)) throw new SuiteResolutionError(candidate, listSuiteIds(options.agentDir));\n\t}\n\treturn candidate;\n}\n\nexport interface SuiteWorkspace {\n\treadonly suite: SuiteDefinition;\n\treadonly suiteDir: string;\n\treadonly suiteJsonPath: string;\n\treadonly agentsMdPath: string;\n\t/**\n\t * The resolved orientation persona text (设计 §6.2/§6.3): the compiled\n\t * ORIENTATION_PROMPTS text for assistant/coding, the workspace persona.md\n\t * content for custom; a missing or unreadable file degrades to \"\" with a\n\t * diagnostic.\n\t */\n\treadonly orientationPersona: string;\n\treadonly diagnostics: readonly string[];\n\t/** Persisted lock file path inside the workspace (M4). */\n\treadonly lockPath: string;\n\t/**\n\t * The suite profile lock (设计 §12): the persisted lock when one existed, a\n\t * fresh lock frozen over the current identity otherwise.\n\t */\n\treadonly lock: ProfileLockV1;\n\t/** Current resolved identity, including any selected optional domain Profile. */\n\treadonly identity: ProfileIdentityV1;\n\t/** Verify result against the persisted lock; absent when none existed. */\n\treadonly lockVerification?: ProfileLockVerificationV1;\n}\n\n/**\n * Serializes a ProfileLockV1 to the canonical `.profile-lock.json` text\n * (stable field order, trailing newline). Round-trips through\n * parseSuiteProfileLockFile.\n */\nexport function serializeSuiteProfileLockFile(lock: ProfileLockV1): string {\n\tconst ordered = {\n\t\tidentity: {\n\t\t\tprofileId: lock.identity.profileId,\n\t\t\tprofileVersion: lock.identity.profileVersion,\n\t\t\tmanifestDigest: lock.identity.manifestDigest,\n\t\t\tcapabilityVersions: lock.identity.capabilityVersions.map((ref) => ({ id: ref.id, version: ref.version })),\n\t\t},\n\t\tlockedAt: lock.lockedAt,\n\t\tlockedBy: lock.lockedBy,\n\t\tgeneration: lock.generation,\n\t};\n\treturn `${JSON.stringify(ordered, null, 2)}\\n`;\n}\n\n/**\n * Parses `.profile-lock.json` text back into a ProfileLockV1. Throws on any\n * structural mismatch so callers can apply their corruption policy.\n */\nexport function parseSuiteProfileLockFile(text: string): ProfileLockV1 {\n\tconst value: unknown = JSON.parse(text);\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(t(\".profile-lock.json must be a JSON object\"));\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst identityRecord = record.identity;\n\tif (identityRecord === null || typeof identityRecord !== \"object\" || Array.isArray(identityRecord)) {\n\t\tthrow new Error(t(\".profile-lock.json identity must be a JSON object\"));\n\t}\n\tconst identity = identityRecord as Record<string, unknown>;\n\tif (\n\t\ttypeof identity.profileId !== \"string\" ||\n\t\ttypeof identity.profileVersion !== \"string\" ||\n\t\ttypeof identity.manifestDigest !== \"string\" ||\n\t\t!Array.isArray(identity.capabilityVersions)\n\t) {\n\t\tthrow new Error(\n\t\t\tt(\".profile-lock.json identity must carry profileId/profileVersion/manifestDigest/capabilityVersions\"),\n\t\t);\n\t}\n\tconst capabilityVersions = identity.capabilityVersions.map((entry) => {\n\t\tif (entry === null || typeof entry !== \"object\" || Array.isArray(entry)) {\n\t\t\tthrow new Error(t(\".profile-lock.json identity.capabilityVersions entries must be objects\"));\n\t\t}\n\t\tconst capability = entry as Record<string, unknown>;\n\t\tif (typeof capability.id !== \"string\" || typeof capability.version !== \"number\") {\n\t\t\tthrow new Error(t(\".profile-lock.json identity.capabilityVersions entries must carry id/version\"));\n\t\t}\n\t\treturn { id: capability.id, version: capability.version };\n\t});\n\tif (\n\t\ttypeof record.lockedAt !== \"number\" ||\n\t\ttypeof record.lockedBy !== \"string\" ||\n\t\ttypeof record.generation !== \"number\"\n\t) {\n\t\tthrow new Error(t(\".profile-lock.json must carry lockedAt/lockedBy/generation\"));\n\t}\n\treturn Object.freeze({\n\t\tidentity: Object.freeze({\n\t\t\tprofileId: identity.profileId,\n\t\t\tprofileVersion: identity.profileVersion,\n\t\t\tmanifestDigest: identity.manifestDigest,\n\t\t\tcapabilityVersions: Object.freeze(capabilityVersions.map((ref) => Object.freeze({ ...ref }))),\n\t\t}),\n\t\tlockedAt: record.lockedAt,\n\t\tlockedBy: record.lockedBy,\n\t\tgeneration: record.generation,\n\t});\n}\n\n/**\n * Locates and lazily provisions `<agentDir>/suites/<id>/`: the builtin pair\n * gets its factory suite.json plus an empty agents.md skeleton on first start\n * (设计 §5). Corruption policy (设计 §9): builtin suites fall back to factory\n * content with diagnostics; user suites fail fast with the file path.\n */\nexport function loadSuiteWorkspace(options: {\n\tagentDir: string;\n\tsuiteId: string;\n\tpluginProfile?: BuiltinPluginProfileResolutionV1;\n}): SuiteWorkspace {\n\tconst { agentDir, suiteId } = options;\n\tconst suiteDir = getSuiteWorkspaceDir(agentDir, suiteId);\n\tconst suiteJsonPath = join(suiteDir, SUITE_MANIFEST_FILENAME);\n\tconst agentsMdPath = join(suiteDir, SUITE_AGENTS_MD_FILENAME);\n\tconst diagnostics: string[] = [];\n\n\tlet suite: SuiteDefinition;\n\tif (!existsSync(suiteJsonPath)) {\n\t\tconst builtin = getBuiltinSuite(suiteId);\n\t\tif (builtin === undefined) throw new SuiteResolutionError(suiteId, listSuiteIds(agentDir));\n\t\tmkdirSync(suiteDir, { recursive: true });\n\t\twriteFileSync(suiteJsonPath, serializeSuiteJson(builtin), \"utf8\");\n\t\t// D-075 S4 第三批:首启不再预种角色文件——种子移到 subagent-delegate 插件\n\t\t// 注册期(entry 的幂等 seedFactoryRoleCatalog 补缺),插件安装并注册时\n\t\t// `<agentDir>/roles/{explore,reviewer}.json` 自然到位。\n\t\tsuite = builtin;\n\t} else {\n\t\tconst parsed = parseSuiteJson(readFileSync(suiteJsonPath, \"utf8\"), {\n\t\t\texpectedBuiltin: getBuiltinSuite(suiteId) !== undefined,\n\t\t\texpectedId: suiteId,\n\t\t});\n\t\tconst builtin = getBuiltinSuite(suiteId);\n\t\tif (parsed.valid && parsed.suite) {\n\t\t\tsuite = parsed.suite;\n\t\t} else if (builtin !== undefined) {\n\t\t\t// Builtin corruption policy (设计 §9): fall back to factory content\n\t\t\t// with diagnostics instead of locking the user out. The file on disk\n\t\t\t// is left untouched; recovery (reset) is an explicit M4 flow.\n\t\t\tsuite = builtin;\n\t\t\tdiagnostics.push(\n\t\t\t\t`suite.json at ${suiteJsonPath} is invalid; falling back to the factory content for builtin suite \"${suiteId}\". Errors: ${parsed.errors.join(\"; \")}`,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\tt(\n\t\t\t\t\t\"Invalid suite.json at {path}: {errors}. Fix the file, or delete the suite workspace directory {dir} and recreate it.\",\n\t\t\t\t\t{ path: suiteJsonPath, errors: parsed.errors.join(\"; \"), dir: suiteDir },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!existsSync(agentsMdPath)) {\n\t\twriteFileSync(agentsMdPath, \"\", \"utf8\");\n\t}\n\n\t// Suite profile lock persistence (M4, 设计 §12): an existing lock file is\n\t// verified against the current identity (drift/migration recorded, never\n\t// blocking and never silently replaced); without one a fresh lock is frozen\n\t// and persisted. A lock file that cannot be parsed is recreated with a\n\t// diagnostic — it carries no openable identity, so nothing is silently\n\t// replaced.\n\tconst lockPath = join(suiteDir, SUITE_LOCK_FILENAME);\n\tlet previousLock: ProfileLockV1 | undefined;\n\tif (existsSync(lockPath)) {\n\t\ttry {\n\t\t\tpreviousLock = parseSuiteProfileLockFile(readFileSync(lockPath, \"utf8\"));\n\t\t} catch (error) {\n\t\t\tdiagnostics.push(\n\t\t\t\t`Profile lock at ${lockPath} is unreadable; recreating it over the current suite identity. Errors: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst bridge = bridgeSuiteProfileLock({\n\t\tsuite,\n\t\t...(options.pluginProfile === undefined ? {} : { pluginProfile: options.pluginProfile }),\n\t\t...(previousLock === undefined ? {} : { previousLock }),\n\t\tlockedBy: \"suite-loader\",\n\t});\n\tdiagnostics.push(...bridge.diagnostics);\n\tif (previousLock === undefined) {\n\t\ttry {\n\t\t\twriteFileSync(lockPath, serializeSuiteProfileLockFile(bridge.lock), \"utf8\");\n\t\t} catch (error) {\n\t\t\tdiagnostics.push(\n\t\t\t\t`Failed to persist the suite profile lock at ${lockPath}: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// Orientation persona resolution (设计 §6.3): assistant/coding use the\n\t// compiled persona texts; custom reads the workspace persona.md verbatim\n\t// (BOM stripped, never trimmed), degrading to an empty persona with a\n\t// diagnostic instead of silently falling back to a builtin persona.\n\tconst personaPath = join(suiteDir, SUITE_PERSONA_MD_FILENAME);\n\tlet orientationPersona: string;\n\tif (suite.orientation !== \"custom\") {\n\t\torientationPersona = ORIENTATION_PROMPTS[suite.orientation];\n\t} else if (!existsSync(personaPath)) {\n\t\torientationPersona = \"\";\n\t\tdiagnostics.push(\n\t\t\t`Suite \"${suiteId}\" orientation is \"custom\" but ${personaPath} is missing; the orientation prompt stays empty until the file is created`,\n\t\t);\n\t} else {\n\t\ttry {\n\t\t\torientationPersona = stripBom(readFileSync(personaPath, \"utf8\"));\n\t\t} catch (error) {\n\t\t\torientationPersona = \"\";\n\t\t\tdiagnostics.push(\n\t\t\t\t`Persona file at ${personaPath} is unreadable; the orientation prompt stays empty. Errors: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn {\n\t\tsuite,\n\t\tsuiteDir,\n\t\tsuiteJsonPath,\n\t\tagentsMdPath,\n\t\torientationPersona,\n\t\tdiagnostics: Object.freeze(diagnostics),\n\t\tlockPath,\n\t\tlock: bridge.lock,\n\t\tidentity: bridge.identity,\n\t\t...(bridge.verification === undefined ? {} : { lockVerification: bridge.verification }),\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// agents.md three-level chain (设计 §8)\n// ---------------------------------------------------------------------------\n\nexport type SuiteAgentsMdSource = \"system\" | \"suite\" | \"project\";\n\nexport interface SuiteAgentsMdEntry {\n\treadonly source: SuiteAgentsMdSource;\n\treadonly path: string;\n\treadonly content: string;\n}\n\nexport interface SuiteAgentsMdAssembly {\n\treadonly chain: readonly SuiteAgentsMdEntry[];\n\treadonly diagnostics: readonly string[];\n}\n\nexport interface AssembleSuiteAgentsMdChainOptions {\n\treadonly suite: SuiteDefinition;\n\treadonly agentDir: string;\n\treadonly suiteJsonPath: string;\n\treadonly suiteAgentsMdPath: string;\n\t/**\n\t * Project-level context files exactly as produced by the existing resource\n\t * loader (`ResourceLoader.getAgentsFiles()`: agentDir global entry first,\n\t * then the AGENTS.md/CLAUDE.md ancestor chain). The ancestor chain logic is\n\t * delegated, never reimplemented; entries under agentDir are classified as\n\t * system-layer candidates.\n\t */\n\treadonly projectAgentsFiles: ReadonlyArray<{ path: string; content: string }>;\n}\n\nfunction readContextFile(path: string): string {\n\ttry {\n\t\treturn stripBom(readFileSync(path, \"utf8\"));\n\t} catch {\n\t\treturn \"\";\n\t}\n}\n\nfunction isUnderDir(path: string, dir: string): boolean {\n\tconst resolvedPath = resolve(path);\n\tconst resolvedDir = resolve(dir);\n\tconst prefix = resolvedDir.endsWith(sep) ? resolvedDir : `${resolvedDir}${sep}`;\n\treturn resolvedPath.startsWith(prefix);\n}\n\n/**\n * Assembles the agents.md three-level chain (设计 §8): system layer (the\n * agentDir context file the resource loader's agentsFiles already carries,\n * e.g. AGENTS.md, gated by inheritSystemAgentsMd) -> suite layer\n * (`suites/<id>/agents.md`) -> project layer (existing ancestor chain, passed\n * in unchanged). The global SYSTEM.md/APPEND_SYSTEM.md never ride the chain:\n * they keep their native system prompt channel and are gated there by\n * createSuiteSystemPromptGate, so both channels stay single-sourced. Every\n * entry carries its source label; missing layers are skipped. Diagnostics\n * record a blocked system layer (one-time migration hint) and the empty\n * association counts (设计 §11.3: 惰性 + 可观测).\n */\nexport function assembleSuiteAgentsMdChain(options: AssembleSuiteAgentsMdChainOptions): SuiteAgentsMdAssembly {\n\tconst { suite, agentDir, suiteJsonPath, suiteAgentsMdPath, projectAgentsFiles } = options;\n\tconst diagnostics: string[] = [];\n\n\t// System-layer candidates are the agentDir entries already present in the\n\t// loader's agentsFiles; they are never read from disk here again.\n\tconst systemCandidates = projectAgentsFiles\n\t\t.filter((entry) => isUnderDir(entry.path, agentDir))\n\t\t.map((entry) => ({ path: entry.path, content: entry.content }));\n\tconst projectEntries = projectAgentsFiles.filter((entry) => !isUnderDir(entry.path, agentDir));\n\n\tconst chain: SuiteAgentsMdEntry[] = [];\n\tif (suite.inheritSystemAgentsMd) {\n\t\tfor (const candidate of systemCandidates) {\n\t\t\tchain.push({ source: \"system\", path: candidate.path, content: candidate.content });\n\t\t}\n\t} else if (systemCandidates.length > 0) {\n\t\tdiagnostics.push(\n\t\t\t`Suite \"${suite.id}\" does not inherit the system agents.md layer (inheritSystemAgentsMd=false); system-layer file(s) kept out of the suite chain: ${systemCandidates\n\t\t\t\t.map((candidate) => candidate.path)\n\t\t\t\t.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}. Migrate them into ${suiteAgentsMdPath} or set \"inheritSystemAgentsMd\": true in ${suiteJsonPath}.`,\n\t\t);\n\t}\n\n\tchain.push({ source: \"suite\", path: suiteAgentsMdPath, content: readContextFile(suiteAgentsMdPath) });\n\tfor (const entry of projectEntries) {\n\t\tchain.push({ source: \"project\", path: entry.path, content: entry.content });\n\t}\n\n\t// Plugin associations are wired since M3 (the sdk filters the external\n\t// capability plugin pool by associations.plugins); mcp stays\n\t// declaration-only until M4.\n\tdiagnostics.push(\n\t\t`Suite \"${suite.id}\" mcp associations are declaration-only until M4; MCP association filtering is unwired.`,\n\t);\n\n\treturn { chain: Object.freeze(chain), diagnostics: Object.freeze(diagnostics) };\n}\n\n/**\n * Merges the assembled chain with the resource loader's own agentsFiles for\n * the contextFiles injection channel: chain entries are prepended unless they\n * are empty or already present in the base. Entries with empty content inject\n * nothing, so a fresh factory skeleton changes no prompt bytes. Base entries\n * under agentDir are dropped unconditionally (设计 §8): with\n * inheritSystemAgentsMd=false the switch blocks the system layer, with true\n * the chain already carries it at the head — keeping it in the base too would\n * duplicate it and pin it after the suite layer, breaking the\n * system -> suite -> project order.\n */\nexport function mergeSuiteAgentsFiles(\n\tchain: readonly SuiteAgentsMdEntry[],\n\tbase: ReadonlyArray<{ path: string; content: string }>,\n\toptions: { agentDir: string },\n): Array<{ path: string; content: string }> {\n\tconst retainedBase = base.filter((entry) => !isUnderDir(entry.path, options.agentDir));\n\tconst basePathSet = new Set(retainedBase.map((entry) => resolve(entry.path)));\n\tconst merged: Array<{ path: string; content: string }> = [];\n\tfor (const entry of chain) {\n\t\tif (entry.content.trim().length === 0) continue;\n\t\tif (basePathSet.has(resolve(entry.path))) continue;\n\t\tmerged.push({ path: entry.path, content: entry.content });\n\t}\n\tmerged.push(...retainedBase.map((entry) => ({ path: entry.path, content: entry.content })));\n\treturn merged;\n}\n\nexport interface SuiteSystemPromptGate {\n\t/** Gates the loader's main system prompt: the discovered file's content, or undefined. */\n\treadonly systemPromptOverride: (base: string | undefined) => string | undefined;\n\t/** Gates the loader's append system prompt: the discovered file's content array. */\n\treadonly appendSystemPromptOverride: (base: string[]) => string[];\n\t/** Blocked global system-layer files; filled as the overrides run, deduplicated. */\n\treadonly diagnostics: readonly string[];\n}\n\n/**\n * Gates the global SYSTEM.md/APPEND_SYSTEM.md system prompt channel by\n * inheritSystemAgentsMd (设计 §8: the switch governs the whole system layer,\n * not just the agents.md chain). The resource loader feeds both overrides with\n * the resolved content of exactly one discovered file — project-level\n * `<cwd>/.agent-forge/<name>` first, else global `<agentDir>/<name>` — with no\n * path attached, so project-level existence identifies the base origin:\n * present means the project layer, which per 设计 §4 is the third level and\n * always passes the switch; absent means a global source, which passes only\n * when the suite inherits the system layer. Blocked global files are recorded\n * in diagnostics with their paths (one-time migration hint, 设计 §11.3).\n */\nexport function createSuiteSystemPromptGate(\n\tsuite: SuiteDefinition,\n\toptions: { cwd: string; agentDir: string },\n): SuiteSystemPromptGate {\n\tconst diagnostics: string[] = [];\n\tconst passes = (filename: string): boolean => {\n\t\tconst projectPath = join(options.cwd, CONFIG_DIR_NAME, filename);\n\t\tif (existsSync(projectPath)) return true;\n\t\tif (suite.inheritSystemAgentsMd) return true;\n\t\tconst message =\n\t\t\t`Suite \"${suite.id}\" does not inherit the global system layer (inheritSystemAgentsMd=false); ` +\n\t\t\t`global file kept out of the model context: ${join(options.agentDir, filename)}. Move it to the ` +\n\t\t\t`project level (${projectPath}) or set \"inheritSystemAgentsMd\": true in the suite.json.`;\n\t\tif (!diagnostics.includes(message)) diagnostics.push(message);\n\t\treturn false;\n\t};\n\treturn {\n\t\tsystemPromptOverride: (base) => (base === undefined || passes(\"SYSTEM.md\") ? base : undefined),\n\t\tappendSystemPromptOverride: (base) => (base.length === 0 || passes(\"APPEND_SYSTEM.md\") ? base : []),\n\t\tdiagnostics,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Association filtering (设计 §3/§4/§11.3, M1b)\n// ---------------------------------------------------------------------------\n\nexport type SuiteAssociationKind = \"skills\" | \"plugins\" | \"capabilities\";\n\nexport interface SuiteAssociationFilterResult<T> {\n\t/** Entries that pass the filter, in input order. */\n\treadonly kept: T[];\n\t/** Association names that matched no discovered entry (设计 §11.3 dangling). */\n\treadonly dangling: readonly string[];\n}\n\n/**\n * Single-sourced dangling-association diagnostic text (设计 §11.3): reported\n * through the suiteDiagnostics channel, never thrown.\n */\nexport function suiteDanglingAssociationDiagnostic(suiteId: string, kind: SuiteAssociationKind, name: string): string {\n\treturn `Suite \"${suiteId}\" dangling association \"${name}\" (${kind}): not found in the discovered registry; ignored.`;\n}\n\n/**\n * Filters the discovered skills down to the suite's skill associations (设计\n * §3: the filter lives in the assembler; discovery stays untouched). Project\n * scope (`<cwd>/.agent-forge/`) is the third layer (设计 §4) and always passes;\n * every other entry is kept only when its `Skill.name` exactly matches an\n * `associations.skills` entry. Association names that match no discovered\n * skill — including case mismatches — are reported as dangling.\n *\n * `options.localSkillsDir` is the suite-local skill layer (统一修复轮 B:\n * `<agentDir>/suites/<id>/skills`): its entries live inside the active suite\n * workspace, so suite activation is their association and they pass the filter\n * by path — the suite-local layer exemption — instead of requiring an\n * association entry.\n */\nexport function filterSuiteSkills(\n\tsuite: SuiteDefinition,\n\tskills: ReadonlyArray<Skill>,\n\toptions?: { localSkillsDir?: string },\n): SuiteAssociationFilterResult<Skill> {\n\tconst associated = new Set(suite.associations.skills);\n\tconst discovered = new Set(skills.map((skill) => skill.name));\n\tconst dangling = suite.associations.skills.filter((name) => !discovered.has(name));\n\tconst localSkillsDir = options?.localSkillsDir;\n\tconst kept = skills.filter(\n\t\t(skill) =>\n\t\t\tskill.sourceInfo.scope === \"project\" ||\n\t\t\t(localSkillsDir !== undefined && isUnderDir(skill.filePath, localSkillsDir)) ||\n\t\t\tassociated.has(skill.name),\n\t);\n\treturn { kept, dangling: Object.freeze(dangling) };\n}\n\n// ---------------------------------------------------------------------------\n// Capability plugin pool filtering (设计 §10.4, M3)\n// ---------------------------------------------------------------------------\n\n/** One external capability plugin manifest discovered below a plugin pool root. */\nexport interface SuiteCapabilityPluginCandidate {\n\t/** Exact manifest id (`PluginManifest.id`). */\n\treadonly manifestId: string;\n\t/** Resolved manifest path, as it will be reported in diagnostics. */\n\treadonly manifestPath: string;\n}\n\nexport interface SuiteCapabilityPluginDecision {\n\treadonly keep: boolean;\n\t/** Diagnostic for a filtered-out plugin; absent when the plugin passes. */\n\treadonly diagnostic?: string;\n}\n\n/**\n * Decides one external capability plugin manifest against the suite's\n * `associations.plugins` (方案设计 §10.4, M3 双键语义: associations.plugins\n * governs only the external capability plugin pool; suite.capabilities governs\n * the compiled builtin ids). The project-level pool\n * (`<cwd>/.agent-forge/plugins`) is the third layer (设计 §4) and always\n * passes; every other manifest is kept only when its id matches an\n * association exactly. Filtered plugins surface as diagnostics, never as\n * errors.\n */\nexport function decideSuiteCapabilityPlugin(\n\tsuite: SuiteDefinition,\n\tcandidate: SuiteCapabilityPluginCandidate,\n\toptions: { cwd: string },\n): SuiteCapabilityPluginDecision {\n\tif (isUnderDir(candidate.manifestPath, join(options.cwd, CONFIG_DIR_NAME, \"plugins\"))) return { keep: true };\n\tif (suite.associations.plugins.includes(candidate.manifestId)) return { keep: true };\n\treturn {\n\t\tkeep: false,\n\t\tdiagnostic: `Suite \"${suite.id}\" capability plugin \"${candidate.manifestId}\" at ${candidate.manifestPath} is not associated; not loaded.`,\n\t};\n}\n\n/**\n * Dangling `associations.plugins` entries: association ids that matched no\n * candidate capability plugin manifest (设计 §11.3), single-sourced through\n * the shared dangling diagnostic text. The caller decides what counts as a\n * candidate: the sdk assembler passes every manifest id it loads, so explicit\n * capabilityPluginPaths count toward satisfying an association even though\n * they bypass the keep filter; only manifests absent from the passed ids\n * surface as dangling.\n */\nexport function suiteDanglingPluginAssociations(\n\tsuite: SuiteDefinition,\n\tdiscoveredManifestIds: readonly string[],\n): readonly string[] {\n\tconst discovered = new Set(discoveredManifestIds);\n\treturn suite.associations.plugins\n\t\t.filter((id) => !discovered.has(id))\n\t\t.map((id) => suiteDanglingAssociationDiagnostic(suite.id, \"plugins\", id));\n}\n\n// ---------------------------------------------------------------------------\n// Shared suite loader assembly (设计 §3/§4/§8, M2)\n// ---------------------------------------------------------------------------\n\n/**\n * The DefaultResourceLoader override subset that wires a resolved suite into a\n * loader: the agents.md three-level chain, the skill/extension association\n * filters, and the inheritSystemAgentsMd gate on the global SYSTEM.md/\n * APPEND_SYSTEM.md prompt channel. Structurally compatible with the matching\n * DefaultResourceLoaderOptions fields.\n */\nexport interface SuiteLoaderOverrides {\n\tagentsFilesOverride: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tskillsOverride: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tsystemPromptOverride: (base: string | undefined) => string | undefined;\n\tappendSystemPromptOverride: (base: string[]) => string[];\n}\n\nexport interface SuiteAssembly {\n\treadonly workspace: SuiteWorkspace;\n\t/** Optional domain plugin profile selected for this suite. */\n\treadonly pluginProfile?: BuiltinPluginProfileResolutionV1;\n\t/** Spread into DefaultResourceLoader options to wire the suite in. */\n\treadonly loaderOverrides: SuiteLoaderOverrides;\n\t/**\n\t * The suite-local skill layer directory (统一修复轮 B) when it exists on\n\t * disk; inject it into the loader's skill paths so suites/<id>/skills load\n\t * with the suite itself. Undefined when the directory is absent, so empty\n\t * and missing directories both contribute nothing.\n\t */\n\treadonly localSkillsDir?: string;\n\t/**\n\t * The suite-local capability-plugin layer directory (统一修复轮 B) when it\n\t * exists on disk; discover its manifests into the session's capability\n\t * plugin candidates. Undefined when the directory is absent.\n\t */\n\treadonly localPluginsDir?: string;\n\t/**\n\t * Snapshot of every suite assembly diagnostic collected so far — workspace\n\t * provisioning, agents.md chain, extension/skill filters, system prompt\n\t * gate, context budget — in the canonical suiteDiagnostics order. Overrides\n\t * that have not run yet contribute nothing (the budget line needs the\n\t * assembled agents.md chain).\n\t */\n\tcollectDiagnostics(): readonly string[];\n}\n\n/**\n * Single-sourced assembly-layer context budget estimate (统一修复轮 B): pure\n * chars/4 arithmetic over the assembled agents.md chain (per source layer),\n * the orientation persona text, plus the count of suite-local workspace\n * skills. Diagnostic-only: it never blocks, gates, or degrades anything.\n */\nexport function suiteContextBudgetDiagnostic(\n\tsuiteId: string,\n\tchain: ReadonlyArray<SuiteAgentsMdEntry>,\n\toptions: { personaChars: number; workspaceSkillCount: number },\n): string {\n\tconst layerChars: Record<SuiteAgentsMdSource, number> = { system: 0, suite: 0, project: 0 };\n\tfor (const entry of chain) {\n\t\tlayerChars[entry.source] += entry.content.length;\n\t}\n\tconst tokens = (chars: number): number => Math.round(chars / 4);\n\tconst system = tokens(layerChars.system);\n\tconst suiteLayer = tokens(layerChars.suite);\n\tconst project = tokens(layerChars.project);\n\treturn `Suite \"${suiteId}\" context budget: agents.md ~${system + suiteLayer + project} tok (system ${system}/suite ${suiteLayer}/project ${project}), persona ~${tokens(options.personaChars)} tok, workspace skills ${options.workspaceSkillCount}`;\n}\n\n/**\n * Plugin-profile diagnostics in the canonical suiteDiagnostics order.\n *\n * D-075 S2 soft degradation: a resolved Profile renders structured per-plugin\n * misses (e.g. `manifest_missing` for a package-distributed plugin without an\n * installed active version) as readable diagnostics, so the session keeps\n * starting without the missing plugin's tools and the miss stays visible.\n * Blocked resolutions already render every plugin diagnostic through\n * `resolution.diagnostics`; the per-plugin lines are additive for the\n * non-blocked branches only.\n */\nfunction pluginProfileDiagnosticsV1(profile: BuiltinPluginProfileResolutionV1): readonly string[] {\n\tif (profile.status === \"not_found\") return [`Plugin profile unavailable: ${profile.profileId}`];\n\tif (profile.status === \"host_facts_required\") return [`Plugin profile host facts required: ${profile.profileId}`];\n\tif (profile.status === \"invalid_selection\")\n\t\treturn [\n\t\t\t`Plugin profile invalid selection: ${profile.profileId} (unknown: ${profile.unknownPluginIds.join(\", \") || \"none\"}; duplicates: ${profile.duplicatePluginIds.join(\", \") || \"none\"})`,\n\t\t];\n\tconst pluginMisses =\n\t\tprofile.resolution.status === \"blocked\"\n\t\t\t? []\n\t\t\t: profile.resolution.plugins\n\t\t\t\t\t.filter((plugin) => plugin.status !== \"installed-ready\")\n\t\t\t\t\t.flatMap((plugin) =>\n\t\t\t\t\t\tplugin.diagnostics.map(\n\t\t\t\t\t\t\t(diagnostic) =>\n\t\t\t\t\t\t\t\t`Plugin profile plugin unavailable: ${plugin.pluginId} (${diagnostic.code}): ${diagnostic.message}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\tif (profile.resolution.status === \"blocked\")\n\t\treturn profile.resolution.diagnostics.map((diagnostic) => `Plugin profile blocked: ${diagnostic.message}`);\n\tif (profile.assembly?.status === \"unverified\")\n\t\treturn [\n\t\t\t...profile.assembly.unverified.map(\n\t\t\t\t(plugin) => `Plugin profile unverified: ${plugin.pluginId}@${plugin.pluginVersion}`,\n\t\t\t),\n\t\t\t...pluginMisses,\n\t\t];\n\treturn pluginMisses;\n}\n\n/**\n * The single suite assembly used by both first-party entry paths (sdk.ts\n * self-built loader and agent-session-services `suiteAssembly`), so the two\n * cannot drift. Loads the suite workspace, builds the system prompt gate, and\n * returns the loader overrides plus a diagnostics collection channel.\n */\nexport function createSuiteAssembly(options: {\n\tcwd: string;\n\tagentDir: string;\n\tsuiteId: string;\n\tpluginProfileId?: BuiltinPluginProfileIdV1;\n\tselectedPluginIds?: readonly string[];\n\tdisabledPluginIds?: readonly string[];\n\tpluginHost?: HostFactsV1;\n\tverifiedPlugins?: readonly VerifiedToolPluginV1[];\n\t/** Explicit host-owned active installed manifests; never discovered implicitly. */\n\tmanifestOverrides?: BuiltinPluginManifestOverridesV1;\n\tpluginProfile?: BuiltinPluginProfileResolutionV1;\n}): SuiteAssembly {\n\tconst { cwd, agentDir, suiteId } = options;\n\tlet pluginProfile = options.pluginProfile;\n\tif (pluginProfile === undefined && options.pluginProfileId !== undefined) {\n\t\tpluginProfile =\n\t\t\toptions.pluginHost === undefined\n\t\t\t\t? ({ status: \"host_facts_required\", profileId: options.pluginProfileId } as const)\n\t\t\t\t: resolveBuiltinPluginProfileV1({\n\t\t\t\t\t\tprofileId: options.pluginProfileId,\n\t\t\t\t\t\tselectedPluginIds: options.selectedPluginIds,\n\t\t\t\t\t\tdisabledPluginIds: options.disabledPluginIds,\n\t\t\t\t\t\thost: options.pluginHost,\n\t\t\t\t\t\tverifiedPlugins: options.verifiedPlugins,\n\t\t\t\t\t\tmanifestOverrides: options.manifestOverrides,\n\t\t\t\t\t});\n\t}\n\tconst workspace = loadSuiteWorkspace({\n\t\tagentDir,\n\t\tsuiteId,\n\t\t...(pluginProfile === undefined ? {} : { pluginProfile }),\n\t});\n\tconst gate = createSuiteSystemPromptGate(workspace.suite, { cwd, agentDir });\n\t// Suite-local asset layer (统一修复轮 B): present directories only, so\n\t// missing and empty directories both contribute nothing.\n\tconst localSkillsDir = getSuiteLocalSkillsDir(agentDir, suiteId);\n\tconst localPluginsDir = getSuiteLocalPluginsDir(agentDir, suiteId);\n\tconst hasLocalSkillsDir = existsSync(localSkillsDir);\n\tconst hasLocalPluginsDir = existsSync(localPluginsDir);\n\tconst workspaceSkillCount = hasLocalSkillsDir\n\t\t? loadSkills({ cwd, agentDir, skillPaths: [localSkillsDir], includeDefaults: false }).skills.length\n\t\t: 0;\n\tlet chainDiagnostics: readonly string[] = [];\n\tlet skillDiagnostics: readonly string[] = [];\n\t// The assembled chain as far as the agentsFilesOverride has run; the budget\n\t// line is only honest once the real chain is known.\n\tlet assembledChain: readonly SuiteAgentsMdEntry[] | undefined;\n\t// Factory upgrade proposal (M4, 设计 §9 升级合并): an unbounded registry\n\t// resolve only proposes when the factory source wins, i.e. its revision is\n\t// strictly greater than the disk revision. Daily assembly keeps the disk\n\t// contents; adoption is an explicit --suite-reset.\n\tconst upgrade = detectSuiteFactoryUpgrade(workspace.suite);\n\tconst proposalDiagnostics = upgrade === undefined ? [] : [suiteFactoryUpgradeDiagnostic(suiteId, upgrade)];\n\tconst budgetDiagnostics = (): readonly string[] => {\n\t\tif (assembledChain === undefined) return [];\n\t\treturn [\n\t\t\tsuiteContextBudgetDiagnostic(suiteId, assembledChain, {\n\t\t\t\tpersonaChars: workspace.orientationPersona.length,\n\t\t\t\tworkspaceSkillCount,\n\t\t\t}),\n\t\t];\n\t};\n\treturn {\n\t\tworkspace,\n\t\t...(pluginProfile === undefined ? {} : { pluginProfile }),\n\t\t...(hasLocalSkillsDir ? { localSkillsDir } : {}),\n\t\t...(hasLocalPluginsDir ? { localPluginsDir } : {}),\n\t\tloaderOverrides: {\n\t\t\tagentsFilesOverride: (base) => {\n\t\t\t\tconst assembly = assembleSuiteAgentsMdChain({\n\t\t\t\t\tsuite: workspace.suite,\n\t\t\t\t\tagentDir,\n\t\t\t\t\tsuiteJsonPath: workspace.suiteJsonPath,\n\t\t\t\t\tsuiteAgentsMdPath: workspace.agentsMdPath,\n\t\t\t\t\tprojectAgentsFiles: base.agentsFiles,\n\t\t\t\t});\n\t\t\t\tchainDiagnostics = assembly.diagnostics;\n\t\t\t\tassembledChain = assembly.chain;\n\t\t\t\treturn { agentsFiles: mergeSuiteAgentsFiles(assembly.chain, base.agentsFiles, { agentDir }) };\n\t\t\t},\n\t\t\tskillsOverride: (base) => {\n\t\t\t\tconst filtered = filterSuiteSkills(workspace.suite, base.skills, { localSkillsDir });\n\t\t\t\tskillDiagnostics = filtered.dangling.map((name) =>\n\t\t\t\t\tsuiteDanglingAssociationDiagnostic(suiteId, \"skills\", name),\n\t\t\t\t);\n\t\t\t\treturn { skills: filtered.kept, diagnostics: base.diagnostics };\n\t\t\t},\n\t\t\tsystemPromptOverride: gate.systemPromptOverride,\n\t\t\tappendSystemPromptOverride: gate.appendSystemPromptOverride,\n\t\t},\n\t\tcollectDiagnostics: () =>\n\t\t\tObject.freeze([\n\t\t\t\t...workspace.diagnostics,\n\t\t\t\t...(pluginProfile === undefined ? [] : pluginProfileDiagnosticsV1(pluginProfile)),\n\t\t\t\t...proposalDiagnostics,\n\t\t\t\t...chainDiagnostics,\n\t\t\t\t...skillDiagnostics,\n\t\t\t\t...budgetDiagnostics(),\n\t\t\t\t...gate.diagnostics,\n\t\t\t]),\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Session suite binding reader (设计 §10.1, 统一修复轮 B)\n// ---------------------------------------------------------------------------\n\n/**\n * Reads the suite binding recorded as session protocol data (设计 §10.1): the\n * suiteId of the latest `SUITE_SESSION_ENTRY_TYPE` custom entry. Undefined\n * when the session carries no binding — pre-suite sessions, entries without a\n * data payload, or payloads without a non-empty string suiteId.\n */\nexport function readSessionSuiteId(\n\tentries: ReadonlyArray<{ type: string; customType?: string; data?: unknown }>,\n): string | undefined {\n\treturn readSessionSuiteBinding(entries)?.suiteId;\n}\n\nexport interface SessionSuiteBindingV1 {\n\treadonly suiteId: string;\n\treadonly profileIdentity?: ProfileIdentityV1;\n}\n\nfunction sessionProfileIdentity(value: unknown): ProfileIdentityV1 | undefined {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\ttypeof record.profileId !== \"string\" ||\n\t\trecord.profileId.trim() === \"\" ||\n\t\ttypeof record.profileVersion !== \"string\" ||\n\t\trecord.profileVersion.trim() === \"\" ||\n\t\ttypeof record.manifestDigest !== \"string\" ||\n\t\trecord.manifestDigest.trim() === \"\" ||\n\t\t!Array.isArray(record.capabilityVersions)\n\t) {\n\t\treturn undefined;\n\t}\n\tconst capabilityVersions: { id: string; version: number }[] = [];\n\tfor (const entry of record.capabilityVersions) {\n\t\tif (entry === null || typeof entry !== \"object\" || Array.isArray(entry)) return undefined;\n\t\tconst capability = entry as Record<string, unknown>;\n\t\tif (\n\t\t\ttypeof capability.id !== \"string\" ||\n\t\t\tcapability.id.trim() === \"\" ||\n\t\t\ttypeof capability.version !== \"number\" ||\n\t\t\t!Number.isSafeInteger(capability.version) ||\n\t\t\tcapability.version < 1\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tcapabilityVersions.push({ id: capability.id, version: capability.version });\n\t}\n\treturn Object.freeze({\n\t\tprofileId: record.profileId,\n\t\tprofileVersion: record.profileVersion,\n\t\tmanifestDigest: record.manifestDigest,\n\t\tcapabilityVersions: Object.freeze(capabilityVersions) as readonly {\n\t\t\treadonly id: string;\n\t\t\treadonly version: number;\n\t\t}[],\n\t});\n}\n\n/** Reads the latest suite and optional Profile identity bound to a session. */\nexport function readSessionSuiteBinding(\n\tentries: ReadonlyArray<{ type: string; customType?: string; data?: unknown }>,\n): SessionSuiteBindingV1 | undefined {\n\tfor (let index = entries.length - 1; index >= 0; index--) {\n\t\tconst entry = entries[index];\n\t\tif (entry.type !== \"custom\" || entry.customType !== SUITE_SESSION_ENTRY_TYPE) continue;\n\t\tconst data = entry.data;\n\t\tif (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n\t\t\tconst suiteId = (data as { suiteId?: unknown }).suiteId;\n\t\t\tif (typeof suiteId === \"string\" && suiteId.length > 0) {\n\t\t\t\tconst profileIdentity = sessionProfileIdentity((data as { profileIdentity?: unknown }).profileIdentity);\n\t\t\t\treturn Object.freeze({\n\t\t\t\t\tsuiteId,\n\t\t\t\t\t...(profileIdentity === undefined ? {} : { profileIdentity }),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Suite -> ProfileIdentityV1 -> lock bridge (设计 §12)\n// ---------------------------------------------------------------------------\n\nfunction suiteToJsonValue(suite: SuiteDefinition): JsonValue {\n\treturn {\n\t\tschemaVersion: suite.schemaVersion,\n\t\tid: suite.id,\n\t\tname: suite.name,\n\t\tbuiltin: suite.builtin,\n\t\ttools: [...suite.tools],\n\t\tcapabilities: [...suite.capabilities],\n\t\tassociations: {\n\t\t\tskills: [...suite.associations.skills],\n\t\t\tmcp: [...suite.associations.mcp],\n\t\t\tplugins: [...suite.associations.plugins],\n\t\t},\n\t\tinheritSystemAgentsMd: suite.inheritSystemAgentsMd,\n\t\tmemory: suite.memory,\n\t\torientation: suite.orientation,\n\t\tmodel: suite.model,\n\t\tthinking: suite.thinking,\n\t\tclonedFrom: suite.clonedFrom\n\t\t\t? { id: suite.clonedFrom.id, digest: suite.clonedFrom.digest, at: suite.clonedFrom.at }\n\t\t\t: null,\n\t\t...(suite.factoryRevision === undefined ? {} : { factoryRevision: suite.factoryRevision }),\n\t};\n}\n\n/** The stable suite.json digest that rides as the suite profile manifest digest. */\nexport function suiteManifestDigest(suite: SuiteDefinition): string {\n\treturn stableJsonDigest(suiteToJsonValue(suite));\n}\n\n/**\n * Builds the ProfileIdentityV1 for an assembled suite. The identity is a pure\n * function of suite.json: the stable suite.json digest rides as the single\n * resolved \"manifest\", and the declared capabilities map to capability\n * references at version 1. No new identity/lock mechanism is introduced.\n */\nexport function buildSuiteProfileIdentity(\n\tsuite: SuiteDefinition,\n\tpluginProfile?: BuiltinPluginProfileResolutionV1,\n): ProfileIdentityV1 {\n\tconst fingerprint = suiteManifestDigest(suite);\n\tconst suiteCapabilityRefs = suite.capabilities.map((id) => ({ id, version: 1 }));\n\tconst pluginRefs =\n\t\tpluginProfile?.status === \"resolved\" && pluginProfile.resolution.status === \"ready\"\n\t\t\t? pluginProfile.resolution.resolvedManifest.plugins\n\t\t\t: [];\n\tconst capabilityRefs = [...suiteCapabilityRefs, ...pluginRefs.flatMap((plugin) => plugin.capabilityRefs)].sort(\n\t\t(left, right) => left.id.localeCompare(right.id) || left.version - right.version,\n\t);\n\treturn buildProfileIdentityV1({\n\t\tprofileId: suiteProfileId(suite.id),\n\t\tprofileVersion: `${SUITE_SCHEMA_VERSION}`,\n\t\tresolvedPlugins: [\n\t\t\t{\n\t\t\t\tpluginId: `${suite.id}/suite.json`,\n\t\t\t\tpluginVersion: fingerprint,\n\t\t\t\tcapabilityRefs: suiteCapabilityRefs,\n\t\t\t},\n\t\t\t...(pluginProfile?.status === \"resolved\" && pluginProfile.resolution.status === \"ready\"\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpluginId: `profile:${pluginProfile.profile.id}`,\n\t\t\t\t\t\t\tpluginVersion: pluginProfile.profile.version,\n\t\t\t\t\t\t\tcapabilityRefs: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...pluginRefs,\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t],\n\t\tcapabilityVersions: capabilityRefs,\n\t});\n}\n\n// ---------------------------------------------------------------------------\n// ProfileRegistryV1 hookup: factory/disk sources and upgrade proposals (M4)\n// ---------------------------------------------------------------------------\n\n/** Registry profileId namespace for suites (设计 §12). */\nexport function suiteProfileId(suiteId: string): string {\n\treturn `suite:${suiteId}`;\n}\n\nexport const SUITE_FACTORY_REGISTRY_SOURCE_ID = \"suite-factory\";\nexport const SUITE_DISK_REGISTRY_SOURCE_ID = \"suite-disk\";\n/** Lower priority wins same-version ties: the disk contents beat the factory. */\nconst SUITE_FACTORY_REGISTRY_PRIORITY = 10;\nconst SUITE_DISK_REGISTRY_PRIORITY = 0;\n\n/** The effective on-disk revision: absent key means FACTORY_CONTENTS_VERSION. */\nfunction suiteDiskRevision(suite: SuiteDefinition): number {\n\treturn suite.factoryRevision ?? FACTORY_CONTENTS_VERSION;\n}\n\n/** Builds the registry entry of one suite definition (version = factoryRevision). */\nexport function buildSuiteRegistryEntry(suite: SuiteDefinition): RegistryProfileEntryV1 {\n\treturn {\n\t\tprofileId: suiteProfileId(suite.id),\n\t\tprofileVersion: String(suiteDiskRevision(suite)),\n\t\tmanifestDigest: suiteManifestDigest(suite),\n\t};\n}\n\n/** Factory source over the builtin declarations (priority 10). */\nexport function buildSuiteFactoryRegistrySource(): RegistrySourceV1 {\n\treturn {\n\t\tsourceId: SUITE_FACTORY_REGISTRY_SOURCE_ID,\n\t\tpriority: SUITE_FACTORY_REGISTRY_PRIORITY,\n\t\tprofiles: BUILTIN_SUITES.map(buildSuiteRegistryEntry),\n\t};\n}\n\n/** Disk source over workspace-effective definitions (priority 0; wins ties). */\nexport function buildSuiteDiskRegistrySource(suites: readonly SuiteDefinition[]): RegistrySourceV1 {\n\treturn {\n\t\tsourceId: SUITE_DISK_REGISTRY_SOURCE_ID,\n\t\tpriority: SUITE_DISK_REGISTRY_PRIORITY,\n\t\tprofiles: suites.map(buildSuiteRegistryEntry),\n\t};\n}\n\nexport interface SuiteFactoryUpgrade {\n\t/** Revision the factory builtin declaration carries. */\n\treadonly factoryRevision: number;\n\t/** Revision effective on disk. */\n\treadonly diskRevision: number;\n}\n\n/** Single-sourced upgrade-proposal diagnostic text (设计 §9 升级合并). */\nexport function suiteFactoryUpgradeDiagnostic(suiteId: string, upgrade: SuiteFactoryUpgrade): string {\n\treturn `Suite \"${suiteId}\": factory revision ${upgrade.factoryRevision} available (disk has ${upgrade.diskRevision}); run \"--suite-reset ${suiteId}\" to review and adopt.`;\n}\n\n/**\n * Detects a factory upgrade proposal for one disk-effective suite: an\n * unbounded registry resolve over the factory source (all builtins) plus a\n * disk source carrying exactly the effective definition. The factory source\n * wins only when its revision is strictly greater — same-version resolves\n * keep the disk contents (priority 0), so no proposal is emitted for\n * unchanged suites, and user suites (no factory entry) never resolve to the\n * factory. Pure function; the caller decides what to do with the proposal.\n */\nexport function detectSuiteFactoryUpgrade(diskSuite: SuiteDefinition): SuiteFactoryUpgrade | undefined {\n\tconst registry = createProfileRegistry();\n\tregistry.registerSource(buildSuiteFactoryRegistrySource());\n\tregistry.registerSource(buildSuiteDiskRegistrySource([diskSuite]));\n\tconst resolution = registry.resolve({ profileId: suiteProfileId(diskSuite.id) });\n\tif (resolution.status !== \"resolved\" || resolution.sourceId !== SUITE_FACTORY_REGISTRY_SOURCE_ID) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tfactoryRevision: Number.parseInt(resolution.profileVersion, 10),\n\t\tdiskRevision: suiteDiskRevision(diskSuite),\n\t};\n}\n\nexport interface SuiteProfileLockBridge {\n\treadonly identity: ProfileIdentityV1;\n\t/**\n\t * The lock for this assembly. When a previous lock exists it is kept as-is\n\t * (a lock is never silently replaced); without one, a fresh lock freezes\n\t * the current identity.\n\t */\n\treadonly lock: ProfileLockV1;\n\treadonly verification?: ProfileLockVerificationV1;\n\t/** Drift/migration findings; recorded, never blocking in M1a (设计 §12). */\n\treadonly diagnostics: readonly string[];\n}\n\n/** Bridges an assembled suite onto the existing lock create/verify trio. */\nexport function bridgeSuiteProfileLock(options: {\n\treadonly suite: SuiteDefinition;\n\treadonly pluginProfile?: BuiltinPluginProfileResolutionV1;\n\treadonly previousLock?: ProfileLockV1;\n\treadonly lockedBy?: string;\n\treadonly now?: () => number;\n}): SuiteProfileLockBridge {\n\tconst identity = buildSuiteProfileIdentity(options.suite, options.pluginProfile);\n\tconst diagnostics: string[] = [];\n\tlet verification: ProfileLockVerificationV1 | undefined;\n\tif (options.previousLock !== undefined) {\n\t\tverification = verifyProfileLock(options.previousLock, identity);\n\t\tif (verification.status === \"drift\") {\n\t\t\t// 2026-10-01 dogfood finding: the bare drift reason left no recovery\n\t\t\t// path. Deleting the lock file and restarting rebuilds it from the\n\t\t\t// resolved manifest (loadSuiteWorkspace re-freezes a fresh lock).\n\t\t\tdiagnostics.push(\n\t\t\t\t`Suite \"${options.suite.id}\" profile lock drift: ${verification.reason}; to recover, delete <agentDir>/suites/${options.suite.id}/${SUITE_LOCK_FILENAME} and restart (the lock rebuilds from the resolved manifest)`,\n\t\t\t);\n\t\t} else if (verification.status === \"migration_required\") {\n\t\t\tdiagnostics.push(`Suite \"${options.suite.id}\" profile lock migration required: ${verification.reason}`);\n\t\t}\n\t}\n\tconst lock =\n\t\toptions.previousLock ??\n\t\tcreateProfileLock(identity, {\n\t\t\tlockedBy: options.lockedBy ?? \"suite-loader\",\n\t\t\t...(options.now === undefined ? {} : { now: options.now }),\n\t\t});\n\treturn {\n\t\tidentity,\n\t\tlock,\n\t\t...(verification === undefined ? {} : { verification }),\n\t\tdiagnostics: Object.freeze(diagnostics),\n\t};\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,2DAA2D;AAC3D,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD","sourcesContent":["import chalk from \"chalk\";\n\nconst emittedDeprecationWarnings = new Set<string>();\n\nexport function warnDeprecation(message: string): void {\n\tif (emittedDeprecationWarnings.has(message)) return;\n\temittedDeprecationWarnings.add(message);\n\tconsole.warn(chalk.yellow(`Deprecation warning: ${message}`));\n}\n\n/** Clear deprecation warning state. Exported for tests. */\nexport function clearDeprecationWarningsForTests(): void {\n\temittedDeprecationWarnings.clear();\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
const emittedDeprecationWarnings = new Set();
|
|
3
|
-
export function warnDeprecation(message) {
|
|
4
|
-
if (emittedDeprecationWarnings.has(message))
|
|
5
|
-
return;
|
|
6
|
-
emittedDeprecationWarnings.add(message);
|
|
7
|
-
console.warn(chalk.yellow(`Deprecation warning: ${message}`));
|
|
8
|
-
}
|
|
9
|
-
/** Clear deprecation warning state. Exported for tests. */
|
|
10
|
-
export function clearDeprecationWarningsForTests() {
|
|
11
|
-
emittedDeprecationWarnings.clear();
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=deprecation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.js","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAAU,CAAC;AAErD,MAAM,UAAU,eAAe,CAAC,OAAe,EAAQ;IACtD,IAAI,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO;IACpD,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC,CAAC;AAAA,CAC9D;AAED,2DAA2D;AAC3D,MAAM,UAAU,gCAAgC,GAAS;IACxD,0BAA0B,CAAC,KAAK,EAAE,CAAC;AAAA,CACnC","sourcesContent":["import chalk from \"chalk\";\n\nconst emittedDeprecationWarnings = new Set<string>();\n\nexport function warnDeprecation(message: string): void {\n\tif (emittedDeprecationWarnings.has(message)) return;\n\temittedDeprecationWarnings.add(message);\n\tconsole.warn(chalk.yellow(`Deprecation warning: ${message}`));\n}\n\n/** Clear deprecation warning state. Exported for tests. */\nexport function clearDeprecationWarningsForTests(): void {\n\temittedDeprecationWarnings.clear();\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|