@ai-agent-forge/agent-forge 0.88.0 → 0.88.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/bundled-plugins/agent-loop-policy/agent-forge.json +19 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.d.ts +28 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.js +69 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts +199 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.js +208 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts +17 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js +18 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/plugin.json +7 -0
- package/bundled-plugins/coding-tools/agent-forge.json +19 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.d.ts +5 -44
- package/bundled-plugins/coding-tools/dist/bash.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.js +15 -119
- package/bundled-plugins/coding-tools/dist/bash.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/capability.d.ts +25 -0
- package/bundled-plugins/coding-tools/dist/capability.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/capability.js +98 -0
- package/bundled-plugins/coding-tools/dist/capability.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/config.d.ts +8 -0
- package/bundled-plugins/coding-tools/dist/config.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/config.js +8 -0
- package/bundled-plugins/coding-tools/dist/config.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/edit.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.js +12 -10
- package/bundled-plugins/coding-tools/dist/edit.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/entry.d.ts +14 -0
- package/bundled-plugins/coding-tools/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/entry.js +23 -0
- package/bundled-plugins/coding-tools/dist/entry.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.d.ts +4 -4
- package/bundled-plugins/coding-tools/dist/find.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.js +10 -8
- package/bundled-plugins/coding-tools/dist/find.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/grep.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.js +10 -8
- package/bundled-plugins/coding-tools/dist/grep.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/index.d.ts +17 -0
- package/bundled-plugins/coding-tools/dist/index.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/index.js +17 -0
- package/bundled-plugins/coding-tools/dist/index.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/ls.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js +8 -6
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js.map +1 -1
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.d.ts +2 -1
- package/bundled-plugins/coding-tools/dist/powershell.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.js +6 -3
- package/bundled-plugins/coding-tools/dist/powershell.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/read.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.js +15 -13
- package/bundled-plugins/coding-tools/dist/read.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/types.d.ts +74 -0
- package/bundled-plugins/coding-tools/dist/types.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/types.js +28 -0
- package/bundled-plugins/coding-tools/dist/types.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.d.ts +2 -2
- package/bundled-plugins/coding-tools/dist/write.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.js +11 -9
- package/bundled-plugins/coding-tools/dist/write.js.map +1 -0
- package/bundled-plugins/coding-tools/plugin.json +10 -0
- package/bundled-plugins/compaction-policy/agent-forge.json +19 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts +6 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js +19 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js.map +1 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts +6 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.js +38 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.js.map +1 -0
- package/bundled-plugins/compaction-policy/dist/entry.d.ts +13 -0
- package/bundled-plugins/compaction-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/entry.js +23 -0
- package/bundled-plugins/compaction-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/compaction-policy/plugin.json +10 -0
- package/bundled-plugins/mcp-http/dist/index.d.ts +8 -0
- package/bundled-plugins/mcp-http/dist/index.d.ts.map +1 -0
- package/bundled-plugins/mcp-http/dist/index.js +8 -0
- package/bundled-plugins/mcp-http/dist/index.js.map +1 -0
- package/bundled-plugins/mcp-http/dist/mcp-http.d.ts.map +1 -0
- package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.js +1 -1
- package/bundled-plugins/mcp-http/dist/mcp-http.js.map +1 -0
- package/bundled-plugins/overflow-policy/agent-forge.json +19 -0
- package/bundled-plugins/overflow-policy/dist/entry.d.ts +16 -0
- package/bundled-plugins/overflow-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/overflow-policy/dist/entry.js +35 -0
- package/bundled-plugins/overflow-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/overflow-policy/plugin.json +10 -0
- package/bundled-plugins/provider-failover/agent-forge.json +19 -0
- package/bundled-plugins/provider-failover/dist/entry.d.ts +8 -0
- package/bundled-plugins/provider-failover/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/provider-failover/dist/entry.js +8 -0
- package/bundled-plugins/provider-failover/dist/entry.js.map +1 -0
- package/bundled-plugins/provider-failover/dist/provider-failover.d.ts +122 -0
- package/bundled-plugins/provider-failover/dist/provider-failover.d.ts.map +1 -0
- package/{dist/core/extensions → bundled-plugins/provider-failover/dist}/provider-failover.js +143 -56
- package/bundled-plugins/provider-failover/dist/provider-failover.js.map +1 -0
- package/bundled-plugins/provider-failover/plugin.json +7 -0
- package/bundled-plugins/retry-policy/agent-forge.json +19 -0
- package/bundled-plugins/retry-policy/dist/entry.d.ts +16 -0
- package/bundled-plugins/retry-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/retry-policy/dist/entry.js +34 -0
- package/bundled-plugins/retry-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/retry-policy/plugin.json +10 -0
- package/dist/bundle/.build-manifest.json +61 -117
- package/dist/bundle/chunks/{anthropic-messages-ALDZBUKI.js → anthropic-messages-PLAKXR73.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-A2WJWZFB.js → azure-openai-responses-OUWQ2AZD.js} +1 -1
- package/dist/bundle/chunks/{chunk-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
- package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
- package/dist/bundle/chunks/chunk-AQLNTW2B.js +664 -0
- package/dist/bundle/chunks/chunk-D3ARGZFR.js +13 -0
- package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
- package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
- package/dist/bundle/chunks/chunk-LZOEQITZ.js +855 -0
- package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
- package/dist/bundle/chunks/chunk-Z72JWUZ4.js +4 -0
- package/dist/bundle/chunks/{google-generative-ai-NIB4WONV.js → google-generative-ai-DLII6DAT.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-DCPYUEUO.js → google-vertex-G7BZL7GM.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +2 -2
- package/dist/bundle/chunks/{mistral-conversations-OC6LA5XL.js → mistral-conversations-JXUK24ID.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-IO2X4Y7L.js → openai-codex-responses-5GSGFIPG.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-XYQQHETU.js → openai-completions-EI2I6DTG.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-DLIRN3CI.js → openai-responses-AUJQ3NWT.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-E6RRYBO7.js → pi-messages-PWU2VJMR.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-WF6WRHP7.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +3 -3
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/capabilities/builtin.d.ts +1 -1
- package/dist/capabilities/builtin.d.ts.map +1 -1
- package/dist/capabilities/builtin.js +5 -0
- package/dist/capabilities/builtin.js.map +1 -1
- package/dist/cli/plugin-command.d.ts.map +1 -1
- package/dist/cli/plugin-command.js +17 -1
- package/dist/cli/plugin-command.js.map +1 -1
- package/dist/config.d.ts +2 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -4
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +1 -1
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +14 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-internal.d.ts +1 -1
- package/dist/core/agent-session-internal.d.ts.map +1 -1
- package/dist/core/agent-session-internal.js.map +1 -1
- package/dist/core/agent-session-loop.d.ts +4 -3
- package/dist/core/agent-session-loop.d.ts.map +1 -1
- package/dist/core/agent-session-loop.js +9 -6
- package/dist/core/agent-session-loop.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +32 -3
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +30 -9
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tools.d.ts.map +1 -1
- package/dist/core/agent-session-tools.js +5 -1
- package/dist/core/agent-session-tools.js.map +1 -1
- package/dist/core/agent-session.d.ts +12 -13
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +56 -34
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
- package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
- package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
- package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
- package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -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 +42 -6
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/index.d.ts +12 -5
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +12 -5
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +65 -0
- 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.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.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 +3 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
- package/dist/core/sdk.d.ts +10 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +263 -77
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/tools/bash-operations.d.ts +41 -0
- package/dist/core/tools/bash-operations.d.ts.map +1 -0
- package/dist/core/tools/bash-operations.js +113 -0
- package/dist/core/tools/bash-operations.js.map +1 -0
- package/dist/core/tools/index.d.ts +12 -36
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -117
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/readme-path.d.ts +3 -0
- package/dist/core/tools/readme-path.d.ts.map +1 -0
- package/dist/core/tools/readme-path.js +15 -0
- package/dist/core/tools/readme-path.js.map +1 -0
- package/dist/index.d.ts +3 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -39
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -25
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
- package/dist/plugins/ecosystem/cli.js +14 -2
- package/dist/plugins/ecosystem/cli.js.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
- package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
- package/dist/profiles/builtin-suites.d.ts +5 -1
- package/dist/profiles/builtin-suites.d.ts.map +1 -1
- package/dist/profiles/builtin-suites.js +6 -1
- package/dist/profiles/builtin-suites.js.map +1 -1
- package/examples/extensions/bash-spawn-hook/index.ts +7 -2
- package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
- package/examples/extensions/minimal-mode/index.ts +2 -2
- package/examples/extensions/truncated-tool/index.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/package.json +3 -2
- package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
- package/dist/bundle/chunks/chunk-HLJEVRWP.js +0 -13
- package/dist/bundle/chunks/chunk-YGHQME4V.js +0 -1456
- package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
- package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-compaction-policy.js +0 -48
- package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
- package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
- package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
- package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-tools.js +0 -36
- package/dist/core/extensions/bootstrap-tools.js.map +0 -1
- package/dist/core/extensions/provider-failover.d.ts +0 -110
- package/dist/core/extensions/provider-failover.d.ts.map +0 -1
- package/dist/core/extensions/provider-failover.js.map +0 -1
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/powershell.d.ts.map +0 -1
- package/dist/core/tools/powershell.js.map +0 -1
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js.map +0 -1
- package/dist/plugins/mcp-http.d.ts.map +0 -1
- package/dist/plugins/mcp-http.js.map +0 -1
- package/dist/profile/child-facade.d.ts +0 -44
- package/dist/profile/child-facade.d.ts.map +0 -1
- package/dist/profile/child-facade.js +0 -56
- package/dist/profile/child-facade.js.map +0 -1
- package/dist/profile/dependency-wiring.d.ts +0 -48
- package/dist/profile/dependency-wiring.d.ts.map +0 -1
- package/dist/profile/dependency-wiring.js +0 -56
- package/dist/profile/dependency-wiring.js.map +0 -1
- package/dist/profile/domain-recovery.d.ts +0 -60
- package/dist/profile/domain-recovery.d.ts.map +0 -1
- package/dist/profile/domain-recovery.js +0 -94
- package/dist/profile/domain-recovery.js.map +0 -1
- package/dist/profile/first-roles.d.ts +0 -30
- package/dist/profile/first-roles.d.ts.map +0 -1
- package/dist/profile/first-roles.js +0 -83
- package/dist/profile/first-roles.js.map +0 -1
- package/dist/profile/goal-plugin.d.ts +0 -38
- package/dist/profile/goal-plugin.d.ts.map +0 -1
- package/dist/profile/goal-plugin.js +0 -132
- package/dist/profile/goal-plugin.js.map +0 -1
- package/dist/profile/plan-plugin.d.ts +0 -44
- package/dist/profile/plan-plugin.d.ts.map +0 -1
- package/dist/profile/plan-plugin.js +0 -157
- package/dist/profile/plan-plugin.js.map +0 -1
- package/dist/profile/policy-manifest.d.ts +0 -53
- package/dist/profile/policy-manifest.d.ts.map +0 -1
- package/dist/profile/policy-manifest.js +0 -53
- package/dist/profile/policy-manifest.js.map +0 -1
- package/dist/profile/role-assembly.d.ts +0 -47
- package/dist/profile/role-assembly.d.ts.map +0 -1
- package/dist/profile/role-assembly.js +0 -31
- package/dist/profile/role-assembly.js.map +0 -1
- package/dist/profile/role-catalog.d.ts +0 -43
- package/dist/profile/role-catalog.d.ts.map +0 -1
- package/dist/profile/role-catalog.js +0 -132
- package/dist/profile/role-catalog.js.map +0 -1
- package/dist/profile/role-orchestrator.d.ts +0 -123
- package/dist/profile/role-orchestrator.d.ts.map +0 -1
- package/dist/profile/role-orchestrator.js +0 -195
- package/dist/profile/role-orchestrator.js.map +0 -1
- package/dist/profile/role-runner.d.ts +0 -99
- package/dist/profile/role-runner.d.ts.map +0 -1
- package/dist/profile/role-runner.js +0 -79
- package/dist/profile/role-runner.js.map +0 -1
- package/dist/profile/root-facade.d.ts +0 -36
- package/dist/profile/root-facade.d.ts.map +0 -1
- package/dist/profile/root-facade.js +0 -49
- package/dist/profile/root-facade.js.map +0 -1
- package/dist/profile/skill-discovery-wiring.d.ts +0 -58
- package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
- package/dist/profile/skill-discovery-wiring.js +0 -80
- package/dist/profile/skill-discovery-wiring.js.map +0 -1
- package/dist/profile/state-store.d.ts +0 -62
- package/dist/profile/state-store.d.ts.map +0 -1
- package/dist/profile/state-store.js +0 -144
- package/dist/profile/state-store.js.map +0 -1
- package/dist/profile/todo-plugin.d.ts +0 -37
- package/dist/profile/todo-plugin.d.ts.map +0 -1
- package/dist/profile/todo-plugin.js +0 -137
- package/dist/profile/todo-plugin.js.map +0 -1
- /package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.d.ts +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile dependency wiring (2.5a) — resolves every resolved plugin's
|
|
3
|
-
* capability references (Skill/tool/MCP-capability IDs) against the host's
|
|
4
|
-
* available capability registry BEFORE a session is created.
|
|
5
|
-
*
|
|
6
|
-
* Resolution is exact-version: a reference is satisfied only when the
|
|
7
|
-
* registry offers the same capability ID at exactly the requested version.
|
|
8
|
-
* Missing or version-mismatched capabilities produce a structured `missing`
|
|
9
|
-
* result so session creation can fail up front — never a half-wired session.
|
|
10
|
-
* Plugins listed in `disabledPluginIds` are skipped as a whole (their
|
|
11
|
-
* references are reported as `skipped_disabled`), which lets a profile drop
|
|
12
|
-
* a plugin without touching the kernel or the other plugins. The same input
|
|
13
|
-
* always resolves identically.
|
|
14
|
-
*/
|
|
15
|
-
import type { ResolvedPluginManifestV1 } from "./identity.ts";
|
|
16
|
-
export interface AvailableCapabilityV1 {
|
|
17
|
-
readonly id: string;
|
|
18
|
-
readonly version: number;
|
|
19
|
-
}
|
|
20
|
-
export interface WiredCapabilityV1 {
|
|
21
|
-
readonly id: string;
|
|
22
|
-
readonly version: number;
|
|
23
|
-
}
|
|
24
|
-
export interface PluginWiringResultV1 {
|
|
25
|
-
readonly pluginId: string;
|
|
26
|
-
readonly pluginVersion: string;
|
|
27
|
-
readonly status: "wired" | "skipped_disabled";
|
|
28
|
-
readonly wired: readonly WiredCapabilityV1[];
|
|
29
|
-
}
|
|
30
|
-
export interface MissingDependencyV1 {
|
|
31
|
-
readonly pluginId: string;
|
|
32
|
-
readonly capabilityId: string;
|
|
33
|
-
readonly requestedVersion: number;
|
|
34
|
-
/** Undefined when the capability is entirely absent from the registry. */
|
|
35
|
-
readonly availableVersion?: number;
|
|
36
|
-
readonly reason: "missing" | "version_mismatch";
|
|
37
|
-
}
|
|
38
|
-
export interface ProfileDependencyWiringV1 {
|
|
39
|
-
readonly status: "wired" | "missing";
|
|
40
|
-
readonly plugins: readonly PluginWiringResultV1[];
|
|
41
|
-
readonly missing: readonly MissingDependencyV1[];
|
|
42
|
-
}
|
|
43
|
-
export declare function wireProfileDependencies(input: {
|
|
44
|
-
readonly resolvedPlugins: readonly ResolvedPluginManifestV1[];
|
|
45
|
-
readonly availableCapabilities: readonly AvailableCapabilityV1[];
|
|
46
|
-
readonly disabledPluginIds?: readonly string[];
|
|
47
|
-
}): ProfileDependencyWiringV1;
|
|
48
|
-
//# sourceMappingURL=dependency-wiring.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-wiring.d.ts","sourceRoot":"","sources":["../../src/profile/dependency-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,kBAAkB,CAAC;CAChD;AAED,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACjD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC9C,QAAQ,CAAC,eAAe,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC9D,QAAQ,CAAC,qBAAqB,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACjE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/C,GAAG,yBAAyB,CAuD5B","sourcesContent":["/**\n * Profile dependency wiring (2.5a) — resolves every resolved plugin's\n * capability references (Skill/tool/MCP-capability IDs) against the host's\n * available capability registry BEFORE a session is created.\n *\n * Resolution is exact-version: a reference is satisfied only when the\n * registry offers the same capability ID at exactly the requested version.\n * Missing or version-mismatched capabilities produce a structured `missing`\n * result so session creation can fail up front — never a half-wired session.\n * Plugins listed in `disabledPluginIds` are skipped as a whole (their\n * references are reported as `skipped_disabled`), which lets a profile drop\n * a plugin without touching the kernel or the other plugins. The same input\n * always resolves identically.\n */\nimport type { ResolvedPluginManifestV1 } from \"./identity.ts\";\n\nexport interface AvailableCapabilityV1 {\n\treadonly id: string;\n\treadonly version: number;\n}\n\nexport interface WiredCapabilityV1 {\n\treadonly id: string;\n\treadonly version: number;\n}\n\nexport interface PluginWiringResultV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly status: \"wired\" | \"skipped_disabled\";\n\treadonly wired: readonly WiredCapabilityV1[];\n}\n\nexport interface MissingDependencyV1 {\n\treadonly pluginId: string;\n\treadonly capabilityId: string;\n\treadonly requestedVersion: number;\n\t/** Undefined when the capability is entirely absent from the registry. */\n\treadonly availableVersion?: number;\n\treadonly reason: \"missing\" | \"version_mismatch\";\n}\n\nexport interface ProfileDependencyWiringV1 {\n\treadonly status: \"wired\" | \"missing\";\n\treadonly plugins: readonly PluginWiringResultV1[];\n\treadonly missing: readonly MissingDependencyV1[];\n}\n\nexport function wireProfileDependencies(input: {\n\treadonly resolvedPlugins: readonly ResolvedPluginManifestV1[];\n\treadonly availableCapabilities: readonly AvailableCapabilityV1[];\n\treadonly disabledPluginIds?: readonly string[];\n}): ProfileDependencyWiringV1 {\n\tconst registry = new Map<string, number>();\n\tfor (const capability of input.availableCapabilities) {\n\t\tregistry.set(capability.id, capability.version);\n\t}\n\tconst disabled = new Set(input.disabledPluginIds ?? []);\n\n\tconst plugins: PluginWiringResultV1[] = [];\n\tconst missing: MissingDependencyV1[] = [];\n\n\tfor (const plugin of input.resolvedPlugins) {\n\t\tif (disabled.has(plugin.pluginId)) {\n\t\t\tplugins.push({\n\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\tpluginVersion: plugin.pluginVersion,\n\t\t\t\tstatus: \"skipped_disabled\",\n\t\t\t\twired: [],\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst wired: WiredCapabilityV1[] = [];\n\t\tfor (const reference of plugin.capabilityRefs) {\n\t\t\tconst availableVersion = registry.get(reference.id);\n\t\t\tif (availableVersion === undefined) {\n\t\t\t\tmissing.push({\n\t\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\t\tcapabilityId: reference.id,\n\t\t\t\t\trequestedVersion: reference.version,\n\t\t\t\t\treason: \"missing\",\n\t\t\t\t});\n\t\t\t} else if (availableVersion !== reference.version) {\n\t\t\t\tmissing.push({\n\t\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\t\tcapabilityId: reference.id,\n\t\t\t\t\trequestedVersion: reference.version,\n\t\t\t\t\tavailableVersion,\n\t\t\t\t\treason: \"version_mismatch\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\twired.push({ id: reference.id, version: reference.version });\n\t\t\t}\n\t\t}\n\t\tplugins.push({\n\t\t\tpluginId: plugin.pluginId,\n\t\t\tpluginVersion: plugin.pluginVersion,\n\t\t\tstatus: \"wired\",\n\t\t\twired,\n\t\t});\n\t}\n\n\treturn {\n\t\tstatus: missing.length > 0 ? \"missing\" : \"wired\",\n\t\tplugins,\n\t\tmissing,\n\t};\n}\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export function wireProfileDependencies(input) {
|
|
2
|
-
const registry = new Map();
|
|
3
|
-
for (const capability of input.availableCapabilities) {
|
|
4
|
-
registry.set(capability.id, capability.version);
|
|
5
|
-
}
|
|
6
|
-
const disabled = new Set(input.disabledPluginIds ?? []);
|
|
7
|
-
const plugins = [];
|
|
8
|
-
const missing = [];
|
|
9
|
-
for (const plugin of input.resolvedPlugins) {
|
|
10
|
-
if (disabled.has(plugin.pluginId)) {
|
|
11
|
-
plugins.push({
|
|
12
|
-
pluginId: plugin.pluginId,
|
|
13
|
-
pluginVersion: plugin.pluginVersion,
|
|
14
|
-
status: "skipped_disabled",
|
|
15
|
-
wired: [],
|
|
16
|
-
});
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
const wired = [];
|
|
20
|
-
for (const reference of plugin.capabilityRefs) {
|
|
21
|
-
const availableVersion = registry.get(reference.id);
|
|
22
|
-
if (availableVersion === undefined) {
|
|
23
|
-
missing.push({
|
|
24
|
-
pluginId: plugin.pluginId,
|
|
25
|
-
capabilityId: reference.id,
|
|
26
|
-
requestedVersion: reference.version,
|
|
27
|
-
reason: "missing",
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
else if (availableVersion !== reference.version) {
|
|
31
|
-
missing.push({
|
|
32
|
-
pluginId: plugin.pluginId,
|
|
33
|
-
capabilityId: reference.id,
|
|
34
|
-
requestedVersion: reference.version,
|
|
35
|
-
availableVersion,
|
|
36
|
-
reason: "version_mismatch",
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
wired.push({ id: reference.id, version: reference.version });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
plugins.push({
|
|
44
|
-
pluginId: plugin.pluginId,
|
|
45
|
-
pluginVersion: plugin.pluginVersion,
|
|
46
|
-
status: "wired",
|
|
47
|
-
wired,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
status: missing.length > 0 ? "missing" : "wired",
|
|
52
|
-
plugins,
|
|
53
|
-
missing,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=dependency-wiring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-wiring.js","sourceRoot":"","sources":["../../src/profile/dependency-wiring.ts"],"names":[],"mappings":"AAgDA,MAAM,UAAU,uBAAuB,CAAC,KAIvC,EAA6B;IAC7B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,qBAAqB,EAAE,CAAC;QACtD,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAExD,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,MAAM,OAAO,GAA0B,EAAE,CAAC;IAE1C,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QAC5C,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC;gBACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,MAAM,EAAE,kBAAkB;gBAC1B,KAAK,EAAE,EAAE;aACT,CAAC,CAAC;YACH,SAAS;QACV,CAAC;QACD,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC/C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YACpD,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACpC,OAAO,CAAC,IAAI,CAAC;oBACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,YAAY,EAAE,SAAS,CAAC,EAAE;oBAC1B,gBAAgB,EAAE,SAAS,CAAC,OAAO;oBACnC,MAAM,EAAE,SAAS;iBACjB,CAAC,CAAC;YACJ,CAAC;iBAAM,IAAI,gBAAgB,KAAK,SAAS,CAAC,OAAO,EAAE,CAAC;gBACnD,OAAO,CAAC,IAAI,CAAC;oBACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,YAAY,EAAE,SAAS,CAAC,EAAE;oBAC1B,gBAAgB,EAAE,SAAS,CAAC,OAAO;oBACnC,gBAAgB;oBAChB,MAAM,EAAE,kBAAkB;iBAC1B,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,CAAC;QACF,CAAC;QACD,OAAO,CAAC,IAAI,CAAC;YACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,MAAM,EAAE,OAAO;YACf,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IAED,OAAO;QACN,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;QAChD,OAAO;QACP,OAAO;KACP,CAAC;AAAA,CACF","sourcesContent":["/**\n * Profile dependency wiring (2.5a) — resolves every resolved plugin's\n * capability references (Skill/tool/MCP-capability IDs) against the host's\n * available capability registry BEFORE a session is created.\n *\n * Resolution is exact-version: a reference is satisfied only when the\n * registry offers the same capability ID at exactly the requested version.\n * Missing or version-mismatched capabilities produce a structured `missing`\n * result so session creation can fail up front — never a half-wired session.\n * Plugins listed in `disabledPluginIds` are skipped as a whole (their\n * references are reported as `skipped_disabled`), which lets a profile drop\n * a plugin without touching the kernel or the other plugins. The same input\n * always resolves identically.\n */\nimport type { ResolvedPluginManifestV1 } from \"./identity.ts\";\n\nexport interface AvailableCapabilityV1 {\n\treadonly id: string;\n\treadonly version: number;\n}\n\nexport interface WiredCapabilityV1 {\n\treadonly id: string;\n\treadonly version: number;\n}\n\nexport interface PluginWiringResultV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly status: \"wired\" | \"skipped_disabled\";\n\treadonly wired: readonly WiredCapabilityV1[];\n}\n\nexport interface MissingDependencyV1 {\n\treadonly pluginId: string;\n\treadonly capabilityId: string;\n\treadonly requestedVersion: number;\n\t/** Undefined when the capability is entirely absent from the registry. */\n\treadonly availableVersion?: number;\n\treadonly reason: \"missing\" | \"version_mismatch\";\n}\n\nexport interface ProfileDependencyWiringV1 {\n\treadonly status: \"wired\" | \"missing\";\n\treadonly plugins: readonly PluginWiringResultV1[];\n\treadonly missing: readonly MissingDependencyV1[];\n}\n\nexport function wireProfileDependencies(input: {\n\treadonly resolvedPlugins: readonly ResolvedPluginManifestV1[];\n\treadonly availableCapabilities: readonly AvailableCapabilityV1[];\n\treadonly disabledPluginIds?: readonly string[];\n}): ProfileDependencyWiringV1 {\n\tconst registry = new Map<string, number>();\n\tfor (const capability of input.availableCapabilities) {\n\t\tregistry.set(capability.id, capability.version);\n\t}\n\tconst disabled = new Set(input.disabledPluginIds ?? []);\n\n\tconst plugins: PluginWiringResultV1[] = [];\n\tconst missing: MissingDependencyV1[] = [];\n\n\tfor (const plugin of input.resolvedPlugins) {\n\t\tif (disabled.has(plugin.pluginId)) {\n\t\t\tplugins.push({\n\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\tpluginVersion: plugin.pluginVersion,\n\t\t\t\tstatus: \"skipped_disabled\",\n\t\t\t\twired: [],\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst wired: WiredCapabilityV1[] = [];\n\t\tfor (const reference of plugin.capabilityRefs) {\n\t\t\tconst availableVersion = registry.get(reference.id);\n\t\t\tif (availableVersion === undefined) {\n\t\t\t\tmissing.push({\n\t\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\t\tcapabilityId: reference.id,\n\t\t\t\t\trequestedVersion: reference.version,\n\t\t\t\t\treason: \"missing\",\n\t\t\t\t});\n\t\t\t} else if (availableVersion !== reference.version) {\n\t\t\t\tmissing.push({\n\t\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\t\tcapabilityId: reference.id,\n\t\t\t\t\trequestedVersion: reference.version,\n\t\t\t\t\tavailableVersion,\n\t\t\t\t\treason: \"version_mismatch\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\twired.push({ id: reference.id, version: reference.version });\n\t\t\t}\n\t\t}\n\t\tplugins.push({\n\t\t\tpluginId: plugin.pluginId,\n\t\t\tpluginVersion: plugin.pluginVersion,\n\t\t\tstatus: \"wired\",\n\t\t\twired,\n\t\t});\n\t}\n\n\treturn {\n\t\tstatus: missing.length > 0 ? \"missing\" : \"wired\",\n\t\tplugins,\n\t\tmissing,\n\t};\n}\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain recovery for branches and restarts (5.2a/5.2b).
|
|
3
|
-
*
|
|
4
|
-
* Branch recovery (5.2a): plans are bound to a branch via the 2.3c plugin;
|
|
5
|
-
* recovering a session on branch B must touch ONLY plans whose branch is B
|
|
6
|
-
* — other-branch plans stay ledgered but are reported as skipped and never
|
|
7
|
-
* written to. Restart recovery (5.2b): replaying a domain's history into a
|
|
8
|
-
* fresh store restores revision, evidence, and terminal state exactly; the
|
|
9
|
-
* recovery report records the before/after facts so a restart is auditable.
|
|
10
|
-
* Multi-Agent scheduling is out of scope.
|
|
11
|
-
*/
|
|
12
|
-
import type { GoalPluginV1, GoalV1 } from "./goal-plugin.ts";
|
|
13
|
-
import type { PlanPluginV1, PlanV1 } from "./plan-plugin.ts";
|
|
14
|
-
import type { TodoPluginV1, TodoV1 } from "./todo-plugin.ts";
|
|
15
|
-
export interface PlanBranchRecoveryEntryV1 {
|
|
16
|
-
readonly planId: string;
|
|
17
|
-
readonly outcome: "recovered" | "terminal_kept" | "skipped_other_branch";
|
|
18
|
-
readonly branch: string;
|
|
19
|
-
readonly statusBefore: string;
|
|
20
|
-
}
|
|
21
|
-
export interface PlanBranchRecoveryReportV1 {
|
|
22
|
-
readonly currentBranch: string;
|
|
23
|
-
readonly entries: readonly PlanBranchRecoveryEntryV1[];
|
|
24
|
-
}
|
|
25
|
-
export interface DomainRestartRecordV1 {
|
|
26
|
-
readonly domain: "goal" | "plan" | "todo";
|
|
27
|
-
readonly entityId: string;
|
|
28
|
-
readonly statusAfter: string;
|
|
29
|
-
readonly revisionAfter: number;
|
|
30
|
-
readonly evidenceCount: number;
|
|
31
|
-
readonly terminal: boolean;
|
|
32
|
-
}
|
|
33
|
-
export interface DomainRestartReportV1 {
|
|
34
|
-
readonly records: readonly DomainRestartRecordV1[];
|
|
35
|
-
/** True when every restored entity matches the state it had before the restart. */
|
|
36
|
-
readonly identical: boolean;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 5.2a — recovers plans for the current branch. Plans on other branches are
|
|
40
|
-
* reported and left untouched (no scans, no writes). Terminal plans on the
|
|
41
|
-
* current branch are kept as-is; draft/active plans are recovered through
|
|
42
|
-
* the plugin's own ledger-derived state (no shadow writes).
|
|
43
|
-
*/
|
|
44
|
-
export declare function recoverPlansForBranch(plans: readonly PlanV1[], currentBranch: string): PlanBranchRecoveryReportV1;
|
|
45
|
-
/**
|
|
46
|
-
* 5.2b — restores goal/plan/todo state after a restart by replaying each
|
|
47
|
-
* entity's history into a fresh store (the caller performs the replay via
|
|
48
|
-
* the plugin attached to the rebuilt store) and comparing against the
|
|
49
|
-
* pre-restart snapshots.
|
|
50
|
-
*/
|
|
51
|
-
export declare function buildRestartReport(snapshots: {
|
|
52
|
-
readonly goal?: readonly GoalV1[];
|
|
53
|
-
readonly plan?: readonly PlanV1[];
|
|
54
|
-
readonly todo?: readonly TodoV1[];
|
|
55
|
-
}, restored: {
|
|
56
|
-
readonly goals: GoalPluginV1;
|
|
57
|
-
readonly plans: PlanPluginV1;
|
|
58
|
-
readonly todos: TodoPluginV1;
|
|
59
|
-
}, owner: string): DomainRestartReportV1;
|
|
60
|
-
//# sourceMappingURL=domain-recovery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domain-recovery.d.ts","sourceRoot":"","sources":["../../src/profile/domain-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,GAAG,sBAAsB,CAAC;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B;AAMD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,0BAA0B,CAmBjH;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE;IACV,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,EACD,QAAQ,EAAE;IACT,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC7B,EACD,KAAK,EAAE,MAAM,GACX,qBAAqB,CA4FvB","sourcesContent":["/**\n * Domain recovery for branches and restarts (5.2a/5.2b).\n *\n * Branch recovery (5.2a): plans are bound to a branch via the 2.3c plugin;\n * recovering a session on branch B must touch ONLY plans whose branch is B\n * — other-branch plans stay ledgered but are reported as skipped and never\n * written to. Restart recovery (5.2b): replaying a domain's history into a\n * fresh store restores revision, evidence, and terminal state exactly; the\n * recovery report records the before/after facts so a restart is auditable.\n * Multi-Agent scheduling is out of scope.\n */\nimport type { GoalPluginV1, GoalV1 } from \"./goal-plugin.ts\";\nimport type { PlanPluginV1, PlanV1 } from \"./plan-plugin.ts\";\nimport type { TodoPluginV1, TodoV1 } from \"./todo-plugin.ts\";\n\nexport interface PlanBranchRecoveryEntryV1 {\n\treadonly planId: string;\n\treadonly outcome: \"recovered\" | \"terminal_kept\" | \"skipped_other_branch\";\n\treadonly branch: string;\n\treadonly statusBefore: string;\n}\n\nexport interface PlanBranchRecoveryReportV1 {\n\treadonly currentBranch: string;\n\treadonly entries: readonly PlanBranchRecoveryEntryV1[];\n}\n\nexport interface DomainRestartRecordV1 {\n\treadonly domain: \"goal\" | \"plan\" | \"todo\";\n\treadonly entityId: string;\n\treadonly statusAfter: string;\n\treadonly revisionAfter: number;\n\treadonly evidenceCount: number;\n\treadonly terminal: boolean;\n}\n\nexport interface DomainRestartReportV1 {\n\treadonly records: readonly DomainRestartRecordV1[];\n\t/** True when every restored entity matches the state it had before the restart. */\n\treadonly identical: boolean;\n}\n\nconst GOAL_TERMINAL = new Set([\"achieved\", \"archived\"]);\nconst PLAN_TERMINAL = new Set([\"completed\", \"discarded\"]);\nconst TODO_TERMINAL = new Set([\"completed\", \"cancelled\"]);\n\n/**\n * 5.2a — recovers plans for the current branch. Plans on other branches are\n * reported and left untouched (no scans, no writes). Terminal plans on the\n * current branch are kept as-is; draft/active plans are recovered through\n * the plugin's own ledger-derived state (no shadow writes).\n */\nexport function recoverPlansForBranch(plans: readonly PlanV1[], currentBranch: string): PlanBranchRecoveryReportV1 {\n\tconst entries = plans.map((plan): PlanBranchRecoveryEntryV1 => {\n\t\tconst terminal = PLAN_TERMINAL.has(plan.status);\n\t\tif (plan.branch !== currentBranch) {\n\t\t\treturn {\n\t\t\t\tplanId: plan.planId,\n\t\t\t\toutcome: \"skipped_other_branch\",\n\t\t\t\tbranch: plan.branch,\n\t\t\t\tstatusBefore: plan.status,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tplanId: plan.planId,\n\t\t\toutcome: terminal ? \"terminal_kept\" : \"recovered\",\n\t\t\tbranch: plan.branch,\n\t\t\tstatusBefore: plan.status,\n\t\t};\n\t});\n\treturn { currentBranch, entries: Object.freeze(entries) };\n}\n\n/**\n * 5.2b — restores goal/plan/todo state after a restart by replaying each\n * entity's history into a fresh store (the caller performs the replay via\n * the plugin attached to the rebuilt store) and comparing against the\n * pre-restart snapshots.\n */\nexport function buildRestartReport(\n\tsnapshots: {\n\t\treadonly goal?: readonly GoalV1[];\n\t\treadonly plan?: readonly PlanV1[];\n\t\treadonly todo?: readonly TodoV1[];\n\t},\n\trestored: {\n\t\treadonly goals: GoalPluginV1;\n\t\treadonly plans: PlanPluginV1;\n\t\treadonly todos: TodoPluginV1;\n\t},\n\towner: string,\n): DomainRestartReportV1 {\n\tconst records: DomainRestartRecordV1[] = [];\n\tlet identical = true;\n\tconst compare = (\n\t\tdomain: \"goal\" | \"plan\" | \"todo\",\n\t\tentityId: string,\n\t\tstatusAfter: string,\n\t\trevisionAfter: number,\n\t\tevidenceCount: number,\n\t\tterminal: boolean,\n\t\tstatusBefore: string,\n\t\trevisionBefore: number,\n\t): void => {\n\t\tif (statusAfter !== statusBefore || revisionAfter !== revisionBefore) identical = false;\n\t\trecords.push({ domain, entityId, statusAfter, revisionAfter, evidenceCount, terminal });\n\t};\n\tfor (const goal of snapshots.goal ?? []) {\n\t\tconst after = restored.goals.get(goal.goalId, owner);\n\t\tif (!after) {\n\t\t\tidentical = false;\n\t\t\trecords.push({\n\t\t\t\tdomain: \"goal\",\n\t\t\t\tentityId: goal.goalId,\n\t\t\t\tstatusAfter: \"missing\",\n\t\t\t\trevisionAfter: 0,\n\t\t\t\tevidenceCount: 0,\n\t\t\t\tterminal: false,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tcompare(\n\t\t\t\"goal\",\n\t\t\tgoal.goalId,\n\t\t\tafter.status,\n\t\t\tafter.revision,\n\t\t\tafter.evidence.length,\n\t\t\tGOAL_TERMINAL.has(after.status),\n\t\t\tgoal.status,\n\t\t\tgoal.revision,\n\t\t);\n\t}\n\tfor (const plan of snapshots.plan ?? []) {\n\t\tconst after = restored.plans.get(plan.planId, owner);\n\t\tif (!after) {\n\t\t\tidentical = false;\n\t\t\trecords.push({\n\t\t\t\tdomain: \"plan\",\n\t\t\t\tentityId: plan.planId,\n\t\t\t\tstatusAfter: \"missing\",\n\t\t\t\trevisionAfter: 0,\n\t\t\t\tevidenceCount: 0,\n\t\t\t\tterminal: false,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tcompare(\n\t\t\t\"plan\",\n\t\t\tplan.planId,\n\t\t\tafter.status,\n\t\t\tafter.revisionNo,\n\t\t\tafter.evidence.length,\n\t\t\tPLAN_TERMINAL.has(after.status),\n\t\t\tplan.status,\n\t\t\tplan.revisionNo,\n\t\t);\n\t}\n\tfor (const todo of snapshots.todo ?? []) {\n\t\tconst after = restored.todos.get(todo.todoId, owner);\n\t\tif (!after) {\n\t\t\tidentical = false;\n\t\t\trecords.push({\n\t\t\t\tdomain: \"todo\",\n\t\t\t\tentityId: todo.todoId,\n\t\t\t\tstatusAfter: \"missing\",\n\t\t\t\trevisionAfter: 0,\n\t\t\t\tevidenceCount: 0,\n\t\t\t\tterminal: false,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tcompare(\n\t\t\t\"todo\",\n\t\t\ttodo.todoId,\n\t\t\tafter.status,\n\t\t\tafter.revision,\n\t\t\tafter.evidence.length,\n\t\t\tTODO_TERMINAL.has(after.status),\n\t\t\ttodo.status,\n\t\t\ttodo.revision,\n\t\t);\n\t}\n\treturn { records: Object.freeze(records), identical };\n}\n"]}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
const GOAL_TERMINAL = new Set(["achieved", "archived"]);
|
|
2
|
-
const PLAN_TERMINAL = new Set(["completed", "discarded"]);
|
|
3
|
-
const TODO_TERMINAL = new Set(["completed", "cancelled"]);
|
|
4
|
-
/**
|
|
5
|
-
* 5.2a — recovers plans for the current branch. Plans on other branches are
|
|
6
|
-
* reported and left untouched (no scans, no writes). Terminal plans on the
|
|
7
|
-
* current branch are kept as-is; draft/active plans are recovered through
|
|
8
|
-
* the plugin's own ledger-derived state (no shadow writes).
|
|
9
|
-
*/
|
|
10
|
-
export function recoverPlansForBranch(plans, currentBranch) {
|
|
11
|
-
const entries = plans.map((plan) => {
|
|
12
|
-
const terminal = PLAN_TERMINAL.has(plan.status);
|
|
13
|
-
if (plan.branch !== currentBranch) {
|
|
14
|
-
return {
|
|
15
|
-
planId: plan.planId,
|
|
16
|
-
outcome: "skipped_other_branch",
|
|
17
|
-
branch: plan.branch,
|
|
18
|
-
statusBefore: plan.status,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
planId: plan.planId,
|
|
23
|
-
outcome: terminal ? "terminal_kept" : "recovered",
|
|
24
|
-
branch: plan.branch,
|
|
25
|
-
statusBefore: plan.status,
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
return { currentBranch, entries: Object.freeze(entries) };
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 5.2b — restores goal/plan/todo state after a restart by replaying each
|
|
32
|
-
* entity's history into a fresh store (the caller performs the replay via
|
|
33
|
-
* the plugin attached to the rebuilt store) and comparing against the
|
|
34
|
-
* pre-restart snapshots.
|
|
35
|
-
*/
|
|
36
|
-
export function buildRestartReport(snapshots, restored, owner) {
|
|
37
|
-
const records = [];
|
|
38
|
-
let identical = true;
|
|
39
|
-
const compare = (domain, entityId, statusAfter, revisionAfter, evidenceCount, terminal, statusBefore, revisionBefore) => {
|
|
40
|
-
if (statusAfter !== statusBefore || revisionAfter !== revisionBefore)
|
|
41
|
-
identical = false;
|
|
42
|
-
records.push({ domain, entityId, statusAfter, revisionAfter, evidenceCount, terminal });
|
|
43
|
-
};
|
|
44
|
-
for (const goal of snapshots.goal ?? []) {
|
|
45
|
-
const after = restored.goals.get(goal.goalId, owner);
|
|
46
|
-
if (!after) {
|
|
47
|
-
identical = false;
|
|
48
|
-
records.push({
|
|
49
|
-
domain: "goal",
|
|
50
|
-
entityId: goal.goalId,
|
|
51
|
-
statusAfter: "missing",
|
|
52
|
-
revisionAfter: 0,
|
|
53
|
-
evidenceCount: 0,
|
|
54
|
-
terminal: false,
|
|
55
|
-
});
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
compare("goal", goal.goalId, after.status, after.revision, after.evidence.length, GOAL_TERMINAL.has(after.status), goal.status, goal.revision);
|
|
59
|
-
}
|
|
60
|
-
for (const plan of snapshots.plan ?? []) {
|
|
61
|
-
const after = restored.plans.get(plan.planId, owner);
|
|
62
|
-
if (!after) {
|
|
63
|
-
identical = false;
|
|
64
|
-
records.push({
|
|
65
|
-
domain: "plan",
|
|
66
|
-
entityId: plan.planId,
|
|
67
|
-
statusAfter: "missing",
|
|
68
|
-
revisionAfter: 0,
|
|
69
|
-
evidenceCount: 0,
|
|
70
|
-
terminal: false,
|
|
71
|
-
});
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
compare("plan", plan.planId, after.status, after.revisionNo, after.evidence.length, PLAN_TERMINAL.has(after.status), plan.status, plan.revisionNo);
|
|
75
|
-
}
|
|
76
|
-
for (const todo of snapshots.todo ?? []) {
|
|
77
|
-
const after = restored.todos.get(todo.todoId, owner);
|
|
78
|
-
if (!after) {
|
|
79
|
-
identical = false;
|
|
80
|
-
records.push({
|
|
81
|
-
domain: "todo",
|
|
82
|
-
entityId: todo.todoId,
|
|
83
|
-
statusAfter: "missing",
|
|
84
|
-
revisionAfter: 0,
|
|
85
|
-
evidenceCount: 0,
|
|
86
|
-
terminal: false,
|
|
87
|
-
});
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
compare("todo", todo.todoId, after.status, after.revision, after.evidence.length, TODO_TERMINAL.has(after.status), todo.status, todo.revision);
|
|
91
|
-
}
|
|
92
|
-
return { records: Object.freeze(records), identical };
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=domain-recovery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domain-recovery.js","sourceRoot":"","sources":["../../src/profile/domain-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AAM,CAAC,EAC/B,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,QAAQ,CACb,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;AAAA,CACtD","sourcesContent":["/**\n * Domain recovery for branches and restarts (5.2a/5.2b).\n *\n * Branch recovery (5.2a): plans are bound to a branch via the 2.3c plugin;\n * recovering a session on branch B must touch ONLY plans whose branch is B\n * — other-branch plans stay ledgered but are reported as skipped and never\n * written to. Restart recovery (5.2b): replaying a domain's history into a\n * fresh store restores revision, evidence, and terminal state exactly; the\n * recovery report records the before/after facts so a restart is auditable.\n * Multi-Agent scheduling is out of scope.\n */\nimport type { GoalPluginV1, GoalV1 } from \"./goal-plugin.ts\";\nimport type { PlanPluginV1, PlanV1 } from \"./plan-plugin.ts\";\nimport type { TodoPluginV1, TodoV1 } from \"./todo-plugin.ts\";\n\nexport interface PlanBranchRecoveryEntryV1 {\n\treadonly planId: string;\n\treadonly outcome: \"recovered\" | \"terminal_kept\" | \"skipped_other_branch\";\n\treadonly branch: string;\n\treadonly statusBefore: string;\n}\n\nexport interface PlanBranchRecoveryReportV1 {\n\treadonly currentBranch: string;\n\treadonly entries: readonly PlanBranchRecoveryEntryV1[];\n}\n\nexport interface DomainRestartRecordV1 {\n\treadonly domain: \"goal\" | \"plan\" | \"todo\";\n\treadonly entityId: string;\n\treadonly statusAfter: string;\n\treadonly revisionAfter: number;\n\treadonly evidenceCount: number;\n\treadonly terminal: boolean;\n}\n\nexport interface DomainRestartReportV1 {\n\treadonly records: readonly DomainRestartRecordV1[];\n\t/** True when every restored entity matches the state it had before the restart. */\n\treadonly identical: boolean;\n}\n\nconst GOAL_TERMINAL = new Set([\"achieved\", \"archived\"]);\nconst PLAN_TERMINAL = new Set([\"completed\", \"discarded\"]);\nconst TODO_TERMINAL = new Set([\"completed\", \"cancelled\"]);\n\n/**\n * 5.2a — recovers plans for the current branch. Plans on other branches are\n * reported and left untouched (no scans, no writes). Terminal plans on the\n * current branch are kept as-is; draft/active plans are recovered through\n * the plugin's own ledger-derived state (no shadow writes).\n */\nexport function recoverPlansForBranch(plans: readonly PlanV1[], currentBranch: string): PlanBranchRecoveryReportV1 {\n\tconst entries = plans.map((plan): PlanBranchRecoveryEntryV1 => {\n\t\tconst terminal = PLAN_TERMINAL.has(plan.status);\n\t\tif (plan.branch !== currentBranch) {\n\t\t\treturn {\n\t\t\t\tplanId: plan.planId,\n\t\t\t\toutcome: \"skipped_other_branch\",\n\t\t\t\tbranch: plan.branch,\n\t\t\t\tstatusBefore: plan.status,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tplanId: plan.planId,\n\t\t\toutcome: terminal ? \"terminal_kept\" : \"recovered\",\n\t\t\tbranch: plan.branch,\n\t\t\tstatusBefore: plan.status,\n\t\t};\n\t});\n\treturn { currentBranch, entries: Object.freeze(entries) };\n}\n\n/**\n * 5.2b — restores goal/plan/todo state after a restart by replaying each\n * entity's history into a fresh store (the caller performs the replay via\n * the plugin attached to the rebuilt store) and comparing against the\n * pre-restart snapshots.\n */\nexport function buildRestartReport(\n\tsnapshots: {\n\t\treadonly goal?: readonly GoalV1[];\n\t\treadonly plan?: readonly PlanV1[];\n\t\treadonly todo?: readonly TodoV1[];\n\t},\n\trestored: {\n\t\treadonly goals: GoalPluginV1;\n\t\treadonly plans: PlanPluginV1;\n\t\treadonly todos: TodoPluginV1;\n\t},\n\towner: string,\n): DomainRestartReportV1 {\n\tconst records: DomainRestartRecordV1[] = [];\n\tlet identical = true;\n\tconst compare = (\n\t\tdomain: \"goal\" | \"plan\" | \"todo\",\n\t\tentityId: string,\n\t\tstatusAfter: string,\n\t\trevisionAfter: number,\n\t\tevidenceCount: number,\n\t\tterminal: boolean,\n\t\tstatusBefore: string,\n\t\trevisionBefore: number,\n\t): void => {\n\t\tif (statusAfter !== statusBefore || revisionAfter !== revisionBefore) identical = false;\n\t\trecords.push({ domain, entityId, statusAfter, revisionAfter, evidenceCount, terminal });\n\t};\n\tfor (const goal of snapshots.goal ?? []) {\n\t\tconst after = restored.goals.get(goal.goalId, owner);\n\t\tif (!after) {\n\t\t\tidentical = false;\n\t\t\trecords.push({\n\t\t\t\tdomain: \"goal\",\n\t\t\t\tentityId: goal.goalId,\n\t\t\t\tstatusAfter: \"missing\",\n\t\t\t\trevisionAfter: 0,\n\t\t\t\tevidenceCount: 0,\n\t\t\t\tterminal: false,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tcompare(\n\t\t\t\"goal\",\n\t\t\tgoal.goalId,\n\t\t\tafter.status,\n\t\t\tafter.revision,\n\t\t\tafter.evidence.length,\n\t\t\tGOAL_TERMINAL.has(after.status),\n\t\t\tgoal.status,\n\t\t\tgoal.revision,\n\t\t);\n\t}\n\tfor (const plan of snapshots.plan ?? []) {\n\t\tconst after = restored.plans.get(plan.planId, owner);\n\t\tif (!after) {\n\t\t\tidentical = false;\n\t\t\trecords.push({\n\t\t\t\tdomain: \"plan\",\n\t\t\t\tentityId: plan.planId,\n\t\t\t\tstatusAfter: \"missing\",\n\t\t\t\trevisionAfter: 0,\n\t\t\t\tevidenceCount: 0,\n\t\t\t\tterminal: false,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tcompare(\n\t\t\t\"plan\",\n\t\t\tplan.planId,\n\t\t\tafter.status,\n\t\t\tafter.revisionNo,\n\t\t\tafter.evidence.length,\n\t\t\tPLAN_TERMINAL.has(after.status),\n\t\t\tplan.status,\n\t\t\tplan.revisionNo,\n\t\t);\n\t}\n\tfor (const todo of snapshots.todo ?? []) {\n\t\tconst after = restored.todos.get(todo.todoId, owner);\n\t\tif (!after) {\n\t\t\tidentical = false;\n\t\t\trecords.push({\n\t\t\t\tdomain: \"todo\",\n\t\t\t\tentityId: todo.todoId,\n\t\t\t\tstatusAfter: \"missing\",\n\t\t\t\trevisionAfter: 0,\n\t\t\t\tevidenceCount: 0,\n\t\t\t\tterminal: false,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tcompare(\n\t\t\t\"todo\",\n\t\t\ttodo.todoId,\n\t\t\tafter.status,\n\t\t\tafter.revision,\n\t\t\tafter.evidence.length,\n\t\t\tTODO_TERMINAL.has(after.status),\n\t\t\ttodo.status,\n\t\t\ttodo.revision,\n\t\t);\n\t}\n\treturn { records: Object.freeze(records), identical };\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* First-batch role vertical slices (2.2c): 架构/实现/测试.
|
|
3
|
-
*
|
|
4
|
-
* Each role is a `RoleMetadataV1` registered in the role catalog plus a
|
|
5
|
-
* deterministic runner that only consumes the public facade — no private
|
|
6
|
-
* session access. These are the first vertical slices proving that a role can
|
|
7
|
-
* be declared, discovered, and executed end to end.
|
|
8
|
-
*/
|
|
9
|
-
import type { RoleCatalogV1, RoleMetadataV1 } from "./role-catalog.ts";
|
|
10
|
-
export interface FirstBatchRoleV1 {
|
|
11
|
-
readonly metadata: RoleMetadataV1;
|
|
12
|
-
readonly run: (input: {
|
|
13
|
-
readonly spec: string;
|
|
14
|
-
}) => Promise<{
|
|
15
|
-
readonly result: string;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
export declare const FIRST_BATCH_ROLES: readonly {
|
|
19
|
-
readonly metadata: RoleMetadataV1;
|
|
20
|
-
readonly run: FirstBatchRoleV1["run"];
|
|
21
|
-
}[];
|
|
22
|
-
/** Registers and returns the first-batch role vertical slices. */
|
|
23
|
-
export declare function createFirstBatchRoleSlices(catalog: RoleCatalogV1): {
|
|
24
|
-
readonly roles: readonly FirstBatchRoleV1[];
|
|
25
|
-
run(roleId: string, spec: string): Promise<{
|
|
26
|
-
readonly roleId: string;
|
|
27
|
-
readonly result: string;
|
|
28
|
-
}>;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=first-roles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"first-roles.d.ts","sourceRoot":"","sources":["../../src/profile/first-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGvE,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzF;AAsCD,eAAO,MAAM,iBAAiB,EAAE,SAAS;IACxC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;CACtC,EAmBA,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG;IACnE,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC5C,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjG,CAeA","sourcesContent":["/**\n * First-batch role vertical slices (2.2c): 架构/实现/测试.\n *\n * Each role is a `RoleMetadataV1` registered in the role catalog plus a\n * deterministic runner that only consumes the public facade — no private\n * session access. These are the first vertical slices proving that a role can\n * be declared, discovered, and executed end to end.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\nimport type { RoleCatalogV1, RoleMetadataV1 } from \"./role-catalog.ts\";\nimport { validateRoleMetadataV1 } from \"./role-catalog.ts\";\n\nexport interface FirstBatchRoleV1 {\n\treadonly metadata: RoleMetadataV1;\n\treadonly run: (input: { readonly spec: string }) => Promise<{ readonly result: string }>;\n}\n\nconst ARCHITECTURE_ROLE: RoleMetadataV1 = {\n\troleId: \"architecture-analyst\",\n\ttitle: \"Architecture Analyst\",\n\tinput: { schemaId: \"role/architecture-input@1\", schemaVersion: 1 },\n\toutput: { schemaId: \"role/architecture-output@1\", schemaVersion: 1 },\n\tcapabilityDependencies: [{ capabilityId: \"tool.read\", capabilityVersion: 1, required: true }],\n\twritableScopes: [\"session\"],\n\tconcurrency: \"parallel\",\n\tcompletionCriteria: \"module structure findings recorded\",\n};\n\nconst IMPLEMENTER_ROLE: RoleMetadataV1 = {\n\troleId: \"implementer\",\n\ttitle: \"Implementer\",\n\tinput: { schemaId: \"role/implement-input@1\", schemaVersion: 1 },\n\toutput: { schemaId: \"role/implement-output@1\", schemaVersion: 1 },\n\tcapabilityDependencies: [\n\t\t{ capabilityId: \"tool.edit\", capabilityVersion: 1, required: true },\n\t\t{ capabilityId: \"tool.write\", capabilityVersion: 1, required: false },\n\t],\n\twritableScopes: [\"session\", \"cycle\"],\n\tconcurrency: \"single\",\n\tcompletionCriteria: \"patch produced for the requested spec\",\n};\n\nconst TEST_DESIGNER_ROLE: RoleMetadataV1 = {\n\troleId: \"test-designer\",\n\ttitle: \"Test Designer\",\n\tinput: { schemaId: \"role/test-input@1\", schemaVersion: 1 },\n\toutput: { schemaId: \"role/test-output@1\", schemaVersion: 1 },\n\tcapabilityDependencies: [{ capabilityId: \"tool.read\", capabilityVersion: 1, required: true }],\n\twritableScopes: [\"session\"],\n\tconcurrency: \"parallel\",\n\tcompletionCriteria: \"test cases derived from the spec\",\n};\n\nexport const FIRST_BATCH_ROLES: readonly {\n\treadonly metadata: RoleMetadataV1;\n\treadonly run: FirstBatchRoleV1[\"run\"];\n}[] = [\n\t{\n\t\tmetadata: ARCHITECTURE_ROLE,\n\t\trun: async (input) => ({\n\t\t\tresult: `architecture findings for: ${input.spec.slice(0, 64)}`,\n\t\t}),\n\t},\n\t{\n\t\tmetadata: IMPLEMENTER_ROLE,\n\t\trun: async (input) => ({\n\t\t\tresult: `patch for: ${input.spec.slice(0, 64)}`,\n\t\t}),\n\t},\n\t{\n\t\tmetadata: TEST_DESIGNER_ROLE,\n\t\trun: async (input) => ({\n\t\t\tresult: `test cases for: ${input.spec.slice(0, 64)}`,\n\t\t}),\n\t},\n];\n\n/** Registers and returns the first-batch role vertical slices. */\nexport function createFirstBatchRoleSlices(catalog: RoleCatalogV1): {\n\treadonly roles: readonly FirstBatchRoleV1[];\n\trun(roleId: string, spec: string): Promise<{ readonly roleId: string; readonly result: string }>;\n} {\n\tconst roles = FIRST_BATCH_ROLES.map((role) => ({\n\t\tmetadata: validateRoleMetadataV1(role.metadata),\n\t\trun: role.run,\n\t}));\n\tfor (const role of roles) catalog.register(role.metadata);\n\tconst runners = new Map(roles.map((role) => [role.metadata.roleId, role.run]));\n\treturn {\n\t\troles,\n\t\tasync run(roleId, spec) {\n\t\t\tconst run = runners.get(roleId);\n\t\t\tif (!run) throw new Error(t(\"Unknown first-batch role: {roleId}\", { roleId }));\n\t\t\treturn { roleId, result: (await run({ spec })).result };\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* First-batch role vertical slices (2.2c): 架构/实现/测试.
|
|
3
|
-
*
|
|
4
|
-
* Each role is a `RoleMetadataV1` registered in the role catalog plus a
|
|
5
|
-
* deterministic runner that only consumes the public facade — no private
|
|
6
|
-
* session access. These are the first vertical slices proving that a role can
|
|
7
|
-
* be declared, discovered, and executed end to end.
|
|
8
|
-
*/
|
|
9
|
-
import { t } from "../core/i18n/index.js";
|
|
10
|
-
import { validateRoleMetadataV1 } from "./role-catalog.js";
|
|
11
|
-
const ARCHITECTURE_ROLE = {
|
|
12
|
-
roleId: "architecture-analyst",
|
|
13
|
-
title: "Architecture Analyst",
|
|
14
|
-
input: { schemaId: "role/architecture-input@1", schemaVersion: 1 },
|
|
15
|
-
output: { schemaId: "role/architecture-output@1", schemaVersion: 1 },
|
|
16
|
-
capabilityDependencies: [{ capabilityId: "tool.read", capabilityVersion: 1, required: true }],
|
|
17
|
-
writableScopes: ["session"],
|
|
18
|
-
concurrency: "parallel",
|
|
19
|
-
completionCriteria: "module structure findings recorded",
|
|
20
|
-
};
|
|
21
|
-
const IMPLEMENTER_ROLE = {
|
|
22
|
-
roleId: "implementer",
|
|
23
|
-
title: "Implementer",
|
|
24
|
-
input: { schemaId: "role/implement-input@1", schemaVersion: 1 },
|
|
25
|
-
output: { schemaId: "role/implement-output@1", schemaVersion: 1 },
|
|
26
|
-
capabilityDependencies: [
|
|
27
|
-
{ capabilityId: "tool.edit", capabilityVersion: 1, required: true },
|
|
28
|
-
{ capabilityId: "tool.write", capabilityVersion: 1, required: false },
|
|
29
|
-
],
|
|
30
|
-
writableScopes: ["session", "cycle"],
|
|
31
|
-
concurrency: "single",
|
|
32
|
-
completionCriteria: "patch produced for the requested spec",
|
|
33
|
-
};
|
|
34
|
-
const TEST_DESIGNER_ROLE = {
|
|
35
|
-
roleId: "test-designer",
|
|
36
|
-
title: "Test Designer",
|
|
37
|
-
input: { schemaId: "role/test-input@1", schemaVersion: 1 },
|
|
38
|
-
output: { schemaId: "role/test-output@1", schemaVersion: 1 },
|
|
39
|
-
capabilityDependencies: [{ capabilityId: "tool.read", capabilityVersion: 1, required: true }],
|
|
40
|
-
writableScopes: ["session"],
|
|
41
|
-
concurrency: "parallel",
|
|
42
|
-
completionCriteria: "test cases derived from the spec",
|
|
43
|
-
};
|
|
44
|
-
export const FIRST_BATCH_ROLES = [
|
|
45
|
-
{
|
|
46
|
-
metadata: ARCHITECTURE_ROLE,
|
|
47
|
-
run: async (input) => ({
|
|
48
|
-
result: `architecture findings for: ${input.spec.slice(0, 64)}`,
|
|
49
|
-
}),
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
metadata: IMPLEMENTER_ROLE,
|
|
53
|
-
run: async (input) => ({
|
|
54
|
-
result: `patch for: ${input.spec.slice(0, 64)}`,
|
|
55
|
-
}),
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
metadata: TEST_DESIGNER_ROLE,
|
|
59
|
-
run: async (input) => ({
|
|
60
|
-
result: `test cases for: ${input.spec.slice(0, 64)}`,
|
|
61
|
-
}),
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
/** Registers and returns the first-batch role vertical slices. */
|
|
65
|
-
export function createFirstBatchRoleSlices(catalog) {
|
|
66
|
-
const roles = FIRST_BATCH_ROLES.map((role) => ({
|
|
67
|
-
metadata: validateRoleMetadataV1(role.metadata),
|
|
68
|
-
run: role.run,
|
|
69
|
-
}));
|
|
70
|
-
for (const role of roles)
|
|
71
|
-
catalog.register(role.metadata);
|
|
72
|
-
const runners = new Map(roles.map((role) => [role.metadata.roleId, role.run]));
|
|
73
|
-
return {
|
|
74
|
-
roles,
|
|
75
|
-
async run(roleId, spec) {
|
|
76
|
-
const run = runners.get(roleId);
|
|
77
|
-
if (!run)
|
|
78
|
-
throw new Error(t("Unknown first-batch role: {roleId}", { roleId }));
|
|
79
|
-
return { roleId, result: (await run({ spec })).result };
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=first-roles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"first-roles.js","sourceRoot":"","sources":["../../src/profile/first-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAO3D,MAAM,iBAAiB,GAAmB;IACzC,MAAM,EAAE,sBAAsB;IAC9B,KAAK,EAAE,sBAAsB;IAC7B,KAAK,EAAE,EAAE,QAAQ,EAAE,2BAA2B,EAAE,aAAa,EAAE,CAAC,EAAE;IAClE,MAAM,EAAE,EAAE,QAAQ,EAAE,4BAA4B,EAAE,aAAa,EAAE,CAAC,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GAAG,CAAC,MAAM,EAAE,IAAI,EAAE;YACvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,GAAG;gBAAE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAAA,CACxD;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * First-batch role vertical slices (2.2c): 架构/实现/测试.\n *\n * Each role is a `RoleMetadataV1` registered in the role catalog plus a\n * deterministic runner that only consumes the public facade — no private\n * session access. These are the first vertical slices proving that a role can\n * be declared, discovered, and executed end to end.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\nimport type { RoleCatalogV1, RoleMetadataV1 } from \"./role-catalog.ts\";\nimport { validateRoleMetadataV1 } from \"./role-catalog.ts\";\n\nexport interface FirstBatchRoleV1 {\n\treadonly metadata: RoleMetadataV1;\n\treadonly run: (input: { readonly spec: string }) => Promise<{ readonly result: string }>;\n}\n\nconst ARCHITECTURE_ROLE: RoleMetadataV1 = {\n\troleId: \"architecture-analyst\",\n\ttitle: \"Architecture Analyst\",\n\tinput: { schemaId: \"role/architecture-input@1\", schemaVersion: 1 },\n\toutput: { schemaId: \"role/architecture-output@1\", schemaVersion: 1 },\n\tcapabilityDependencies: [{ capabilityId: \"tool.read\", capabilityVersion: 1, required: true }],\n\twritableScopes: [\"session\"],\n\tconcurrency: \"parallel\",\n\tcompletionCriteria: \"module structure findings recorded\",\n};\n\nconst IMPLEMENTER_ROLE: RoleMetadataV1 = {\n\troleId: \"implementer\",\n\ttitle: \"Implementer\",\n\tinput: { schemaId: \"role/implement-input@1\", schemaVersion: 1 },\n\toutput: { schemaId: \"role/implement-output@1\", schemaVersion: 1 },\n\tcapabilityDependencies: [\n\t\t{ capabilityId: \"tool.edit\", capabilityVersion: 1, required: true },\n\t\t{ capabilityId: \"tool.write\", capabilityVersion: 1, required: false },\n\t],\n\twritableScopes: [\"session\", \"cycle\"],\n\tconcurrency: \"single\",\n\tcompletionCriteria: \"patch produced for the requested spec\",\n};\n\nconst TEST_DESIGNER_ROLE: RoleMetadataV1 = {\n\troleId: \"test-designer\",\n\ttitle: \"Test Designer\",\n\tinput: { schemaId: \"role/test-input@1\", schemaVersion: 1 },\n\toutput: { schemaId: \"role/test-output@1\", schemaVersion: 1 },\n\tcapabilityDependencies: [{ capabilityId: \"tool.read\", capabilityVersion: 1, required: true }],\n\twritableScopes: [\"session\"],\n\tconcurrency: \"parallel\",\n\tcompletionCriteria: \"test cases derived from the spec\",\n};\n\nexport const FIRST_BATCH_ROLES: readonly {\n\treadonly metadata: RoleMetadataV1;\n\treadonly run: FirstBatchRoleV1[\"run\"];\n}[] = [\n\t{\n\t\tmetadata: ARCHITECTURE_ROLE,\n\t\trun: async (input) => ({\n\t\t\tresult: `architecture findings for: ${input.spec.slice(0, 64)}`,\n\t\t}),\n\t},\n\t{\n\t\tmetadata: IMPLEMENTER_ROLE,\n\t\trun: async (input) => ({\n\t\t\tresult: `patch for: ${input.spec.slice(0, 64)}`,\n\t\t}),\n\t},\n\t{\n\t\tmetadata: TEST_DESIGNER_ROLE,\n\t\trun: async (input) => ({\n\t\t\tresult: `test cases for: ${input.spec.slice(0, 64)}`,\n\t\t}),\n\t},\n];\n\n/** Registers and returns the first-batch role vertical slices. */\nexport function createFirstBatchRoleSlices(catalog: RoleCatalogV1): {\n\treadonly roles: readonly FirstBatchRoleV1[];\n\trun(roleId: string, spec: string): Promise<{ readonly roleId: string; readonly result: string }>;\n} {\n\tconst roles = FIRST_BATCH_ROLES.map((role) => ({\n\t\tmetadata: validateRoleMetadataV1(role.metadata),\n\t\trun: role.run,\n\t}));\n\tfor (const role of roles) catalog.register(role.metadata);\n\tconst runners = new Map(roles.map((role) => [role.metadata.roleId, role.run]));\n\treturn {\n\t\troles,\n\t\tasync run(roleId, spec) {\n\t\t\tconst run = runners.get(roleId);\n\t\t\tif (!run) throw new Error(t(\"Unknown first-batch role: {roleId}\", { roleId }));\n\t\t\treturn { roleId, result: (await run({ spec })).result };\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Goal plugin (2.3b) — Goal schema, evidence, and recovery on top of the 2.3a
|
|
3
|
-
* transition store.
|
|
4
|
-
*
|
|
5
|
-
* Status graph: null → draft → active → achieved, and draft/active → archived.
|
|
6
|
-
* `achieve` requires at least one evidence reference. The plugin holds NO
|
|
7
|
-
* shadow state: every read derives status, revision, title, and evidence from
|
|
8
|
-
* the transition history, so recovery is exactly a store replay.
|
|
9
|
-
*/
|
|
10
|
-
import type { TransitionEvidenceRefV1, TransitionStoreV1 } from "./state-store.ts";
|
|
11
|
-
export type GoalStatusV1 = "draft" | "active" | "achieved" | "archived";
|
|
12
|
-
export interface GoalV1 {
|
|
13
|
-
readonly goalId: string;
|
|
14
|
-
readonly owner: string;
|
|
15
|
-
readonly title: string;
|
|
16
|
-
readonly status: GoalStatusV1;
|
|
17
|
-
readonly evidence: readonly TransitionEvidenceRefV1[];
|
|
18
|
-
readonly revision: number;
|
|
19
|
-
}
|
|
20
|
-
export interface GoalPluginV1 {
|
|
21
|
-
createGoal(input: {
|
|
22
|
-
readonly goalId: string;
|
|
23
|
-
readonly owner: string;
|
|
24
|
-
readonly title: string;
|
|
25
|
-
}): GoalV1;
|
|
26
|
-
activate(goalId: string, owner: string, options?: {
|
|
27
|
-
readonly operationId?: string;
|
|
28
|
-
}): GoalV1;
|
|
29
|
-
achieve(goalId: string, owner: string, evidence: readonly TransitionEvidenceRefV1[], options?: {
|
|
30
|
-
readonly operationId?: string;
|
|
31
|
-
}): GoalV1;
|
|
32
|
-
archive(goalId: string, owner: string): GoalV1;
|
|
33
|
-
get(goalId: string, owner: string): GoalV1 | undefined;
|
|
34
|
-
}
|
|
35
|
-
export declare function createGoalPlugin(options: {
|
|
36
|
-
readonly transitions: TransitionStoreV1;
|
|
37
|
-
}): GoalPluginV1;
|
|
38
|
-
//# sourceMappingURL=goal-plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"goal-plugin.d.ts","sourceRoot":"","sources":["../../src/profile/goal-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAExE,MAAM,WAAW,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC5B,UAAU,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IACvG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAC7F,OAAO,CACN,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,uBAAuB,EAAE,EAC5C,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GACzC,MAAM,CAAC;IACV,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/C,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACvD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAA;CAAE,GAAG,YAAY,CA8InG","sourcesContent":["/**\n * Goal plugin (2.3b) — Goal schema, evidence, and recovery on top of the 2.3a\n * transition store.\n *\n * Status graph: null → draft → active → achieved, and draft/active → archived.\n * `achieve` requires at least one evidence reference. The plugin holds NO\n * shadow state: every read derives status, revision, title, and evidence from\n * the transition history, so recovery is exactly a store replay.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\nimport type { TransitionEvidenceRefV1, TransitionStoreV1 } from \"./state-store.ts\";\n\nexport type GoalStatusV1 = \"draft\" | \"active\" | \"achieved\" | \"archived\";\n\nexport interface GoalV1 {\n\treadonly goalId: string;\n\treadonly owner: string;\n\treadonly title: string;\n\treadonly status: GoalStatusV1;\n\treadonly evidence: readonly TransitionEvidenceRefV1[];\n\treadonly revision: number;\n}\n\nexport interface GoalPluginV1 {\n\tcreateGoal(input: { readonly goalId: string; readonly owner: string; readonly title: string }): GoalV1;\n\tactivate(goalId: string, owner: string, options?: { readonly operationId?: string }): GoalV1;\n\tachieve(\n\t\tgoalId: string,\n\t\towner: string,\n\t\tevidence: readonly TransitionEvidenceRefV1[],\n\t\toptions?: { readonly operationId?: string },\n\t): GoalV1;\n\tarchive(goalId: string, owner: string): GoalV1;\n\tget(goalId: string, owner: string): GoalV1 | undefined;\n}\n\nexport function createGoalPlugin(options: { readonly transitions: TransitionStoreV1 }): GoalPluginV1 {\n\tconst transitions = options.transitions;\n\n\tconst goalHistory = (goalId: string, owner: string) =>\n\t\ttransitions.history(goalId).filter((record) => record.domain === \"goal\" && record.owner === owner);\n\n\tconst current = (goalId: string, owner: string): { status: GoalStatusV1; revision: number } | undefined => {\n\t\tconst state = transitions.currentStatus(\"goal\", goalId);\n\t\tif (state === undefined || goalHistory(goalId, owner).length === 0) return undefined;\n\t\treturn { status: state.status as GoalStatusV1, revision: state.revision };\n\t};\n\n\tconst titleOf = (goalId: string, owner: string): string => {\n\t\tfor (const record of goalHistory(goalId, owner)) {\n\t\t\tif (record.fromStatus !== null) continue;\n\t\t\tconst payload = record.payload;\n\t\t\tif (payload !== null && typeof payload === \"object\" && !Array.isArray(payload)) {\n\t\t\t\tconst title = (payload as Record<string, unknown>).title;\n\t\t\t\tif (typeof title === \"string\") return title;\n\t\t\t}\n\t\t}\n\t\treturn goalId;\n\t};\n\n\tconst goalGet = (goalId: string, owner: string): GoalV1 | undefined => {\n\t\tconst state = current(goalId, owner);\n\t\tif (!state) return undefined;\n\t\tconst history = goalHistory(goalId, owner);\n\t\tconst lastEvidence = [...history].reverse().find((record) => record.evidence.length > 0)?.evidence ?? [];\n\t\treturn {\n\t\t\tgoalId,\n\t\t\towner,\n\t\t\ttitle: titleOf(goalId, owner),\n\t\t\tstatus: state.status,\n\t\t\tevidence: lastEvidence,\n\t\t\trevision: state.revision,\n\t\t};\n\t};\n\n\t/** A retried transition with an already-applied operationId returns the existing state instead of conflicting. */\n\tconst replayedGoal = (\n\t\tgoalId: string,\n\t\towner: string,\n\t\ttoStatus: GoalStatusV1,\n\t\toperationId?: string,\n\t): GoalV1 | undefined => {\n\t\tif (!operationId) return undefined;\n\t\tconst applied = goalHistory(goalId, owner).some(\n\t\t\t(record) => record.toStatus === toStatus && record.operationId === operationId,\n\t\t);\n\t\treturn applied ? goalGet(goalId, owner) : undefined;\n\t};\n\n\tconst transitionGoal = (\n\t\tgoalId: string,\n\t\towner: string,\n\t\tfromStatus: GoalStatusV1 | null,\n\t\ttoStatus: GoalStatusV1,\n\t\tgoalOptions: {\n\t\t\treadonly evidence?: readonly TransitionEvidenceRefV1[];\n\t\t\treadonly payload?: { readonly title: string };\n\t\t\treadonly operationId?: string;\n\t\t},\n\t): GoalV1 => {\n\t\ttransitions.transition({\n\t\t\tdomain: \"goal\",\n\t\t\tentityId: goalId,\n\t\t\towner,\n\t\t\tfromStatus,\n\t\t\ttoStatus,\n\t\t\toperationId: goalOptions.operationId ?? `${toStatus}:${goalId}`,\n\t\t\tevidence: goalOptions.evidence,\n\t\t\tpayload: goalOptions.payload,\n\t\t});\n\t\tconst state = transitions.currentStatus(\"goal\", goalId);\n\t\treturn {\n\t\t\tgoalId,\n\t\t\towner,\n\t\t\ttitle: titleOf(goalId, owner),\n\t\t\tstatus: state?.status as GoalStatusV1,\n\t\t\tevidence: goalOptions.evidence ?? [],\n\t\t\t// v8 ignore next -- transition 刚写入 currentStatus,必可读到 revision\n\t\t\trevision: state?.revision ?? 0,\n\t\t};\n\t};\n\n\treturn {\n\t\tcreateGoal({ goalId, owner, title }) {\n\t\t\tif (title.trim().length === 0) throw new Error(t(\"Goal title must be a non-empty string\"));\n\t\t\treturn transitionGoal(goalId, owner, null, \"draft\", {\n\t\t\t\tpayload: { title },\n\t\t\t\toperationId: `create:${goalId}`,\n\t\t\t});\n\t\t},\n\t\tactivate(goalId, owner, activateOptions) {\n\t\t\tconst replayed = replayedGoal(goalId, owner, \"active\", activateOptions?.operationId);\n\t\t\tif (replayed) return replayed;\n\t\t\tconst existing = current(goalId, owner);\n\t\t\tif (existing?.status !== \"draft\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Goal {goalId} must be in draft status to activate (current: {status})\", {\n\t\t\t\t\t\tgoalId,\n\t\t\t\t\t\tstatus: existing?.status ?? \"missing\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn transitionGoal(goalId, owner, \"draft\", \"active\", { operationId: activateOptions?.operationId });\n\t\t},\n\t\tachieve(goalId, owner, evidence, achieveOptions) {\n\t\t\tconst replayed = replayedGoal(goalId, owner, \"achieved\", achieveOptions?.operationId);\n\t\t\tif (replayed) return replayed;\n\t\t\tconst existing = current(goalId, owner);\n\t\t\tif (existing?.status !== \"active\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Goal {goalId} must be active to achieve (current: {status})\", {\n\t\t\t\t\t\tgoalId,\n\t\t\t\t\t\tstatus: existing?.status ?? \"missing\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (evidence.length === 0) throw new Error(t(\"Achieving a goal requires at least one evidence reference\"));\n\t\t\treturn transitionGoal(goalId, owner, \"active\", \"achieved\", {\n\t\t\t\tevidence,\n\t\t\t\toperationId: achieveOptions?.operationId,\n\t\t\t});\n\t\t},\n\t\tarchive(goalId, owner) {\n\t\t\tconst existing = current(goalId, owner);\n\t\t\tif (!existing || existing.status === \"achieved\" || existing.status === \"archived\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Goal {goalId} cannot be archived from status {status}\", {\n\t\t\t\t\t\tgoalId,\n\t\t\t\t\t\tstatus: existing?.status ?? \"missing\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn transitionGoal(goalId, owner, existing.status, \"archived\", {});\n\t\t},\n\t\tget(goalId, owner) {\n\t\t\treturn goalGet(goalId, owner);\n\t\t},\n\t};\n}\n"]}
|