@octopi-agent/engine 0.98.4 → 0.121.10
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/dist/builtin-model-info.js +28 -7
- package/dist/config-admin/agent-presets.d.ts +32 -0
- package/dist/config-admin/agent-presets.js +133 -0
- package/dist/config-admin/discover.d.ts +33 -4
- package/dist/config-admin/discover.js +101 -6
- package/dist/config-admin/env.d.ts +11 -0
- package/dist/config-admin/env.js +41 -0
- package/dist/config-admin/error-copy.d.ts +106 -0
- package/dist/config-admin/error-copy.js +287 -0
- package/dist/config-admin/i18n.d.ts +21 -0
- package/dist/config-admin/i18n.js +19 -0
- package/dist/config-admin/index.d.ts +6 -2
- package/dist/config-admin/index.js +3 -1
- package/dist/config-admin/model-presets.d.ts +14 -0
- package/dist/config-admin/model-presets.js +595 -70
- package/dist/config-admin/onboarding-apply.d.ts +71 -0
- package/dist/config-admin/onboarding-apply.js +235 -0
- package/dist/config-admin/onboarding.d.ts +154 -0
- package/dist/config-admin/onboarding.js +270 -0
- package/dist/config-admin/redact.d.ts +42 -9
- package/dist/config-admin/redact.js +69 -5
- package/dist/config-schema/agent.d.ts +40 -6
- package/dist/config-schema/agent.js +44 -6
- package/dist/config-schema/browser.d.ts +62 -0
- package/dist/config-schema/browser.js +89 -0
- package/dist/config-schema/context.d.ts +12 -37
- package/dist/config-schema/context.js +10 -31
- package/dist/config-schema/engine.d.ts +140 -164
- package/dist/config-schema/engine.js +10 -7
- package/dist/config-schema/governance.d.ts +20 -2
- package/dist/config-schema/governance.js +18 -3
- package/dist/config-schema/models.d.ts +10 -12
- package/dist/config-schema/models.js +16 -3
- package/dist/config-schema/run.d.ts +6 -2
- package/dist/config-schema/run.js +12 -2
- package/dist/config-schema/shared.d.ts +1 -3
- package/dist/config-schema/shared.js +4 -4
- package/dist/config-schema/substrate.d.ts +19 -88
- package/dist/config-schema/substrate.js +30 -107
- package/dist/config.d.ts +161 -123
- package/dist/config.js +109 -7
- package/dist/file-mode.d.ts +67 -0
- package/dist/file-mode.js +182 -0
- package/dist/fork-child.d.ts +82 -0
- package/dist/fork-child.js +123 -0
- package/dist/harness/activation/delegated-run.d.ts +42 -0
- package/dist/harness/activation/delegated-run.js +71 -0
- package/dist/harness/activation/dispatcher.js +11 -0
- package/dist/harness/activation/inbox.d.ts +3 -3
- package/dist/harness/activation/inbox.js +3 -3
- package/dist/harness/activation/index.d.ts +1 -0
- package/dist/harness/activation/run-backend.d.ts +92 -0
- package/dist/harness/activation/run-backend.js +16 -0
- package/dist/harness/activation/run-protocol.d.ts +392 -0
- package/dist/harness/activation/run-protocol.js +19 -0
- package/dist/harness/activation/runtime.d.ts +33 -0
- package/dist/harness/activation/runtime.js +130 -31
- package/dist/harness/activation/types.d.ts +20 -3
- package/dist/harness/agent/builder.d.ts +36 -3
- package/dist/harness/agent/builder.js +206 -46
- package/dist/harness/agent/config-bridge.d.ts +10 -1
- package/dist/harness/agent/config-bridge.js +24 -5
- package/dist/harness/agent/config-integrity.js +19 -2
- package/dist/harness/agent/registered-tool-adapter.d.ts +27 -0
- package/dist/harness/agent/registered-tool-adapter.js +67 -0
- package/dist/harness/agent/wire-agent-builder.d.ts +13 -3
- package/dist/harness/agent/wire-agent-builder.js +35 -9
- package/dist/harness/capabilities/document/backends/plain.js +2 -1
- package/dist/harness/capabilities/document/factory.d.ts +5 -0
- package/dist/harness/capabilities/document/factory.js +1 -0
- package/dist/harness/capabilities/document/legacy/factory.js +3 -2
- package/dist/harness/capabilities/document/port.js +6 -3
- package/dist/harness/capabilities/document/types.d.ts +5 -0
- package/dist/harness/collaboration/autonomous-subsystem/audit/reader.d.ts +17 -0
- package/dist/harness/collaboration/autonomous-subsystem/audit/reader.js +66 -36
- package/dist/harness/collaboration/autonomous-subsystem/audit/writer.d.ts +6 -2
- package/dist/harness/collaboration/autonomous-subsystem/audit/writer.js +27 -7
- package/dist/harness/collaboration/autonomous-subsystem/boundary/validator.js +13 -0
- package/dist/harness/collaboration/autonomous-subsystem/loader.js +2 -1
- package/dist/harness/collaboration/autonomous-subsystem/runtime.d.ts +11 -0
- package/dist/harness/collaboration/autonomous-subsystem/runtime.js +17 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/engine.d.ts +14 -4
- package/dist/harness/collaboration/autonomous-subsystem/sense/engine.js +50 -41
- package/dist/harness/collaboration/autonomous-subsystem/sense/input-builder.js +4 -4
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.d.ts +2 -2
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.js +2 -2
- package/dist/harness/collaboration/autonomous-subsystem/signal/bus.d.ts +6 -0
- package/dist/harness/collaboration/autonomous-subsystem/signal/bus.js +25 -4
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +4 -1
- package/dist/harness/collaboration/autonomous-subsystem/types.d.ts +7 -3
- package/dist/harness/collaboration/delegation/child-run.d.ts +10 -1
- package/dist/harness/collaboration/delegation/child-run.js +38 -6
- package/dist/harness/collaboration/delegation/index.d.ts +1 -1
- package/dist/harness/collaboration/delegation/index.js +1 -1
- package/dist/harness/collaboration/delegation/notifier.d.ts +6 -1
- package/dist/harness/collaboration/delegation/notifier.js +8 -1
- package/dist/harness/collaboration/delegation/registry-types.d.ts +2 -0
- package/dist/harness/collaboration/delegation/service.d.ts +11 -4
- package/dist/harness/collaboration/delegation/service.js +35 -13
- package/dist/harness/collaboration/delegation/store.d.ts +4 -0
- package/dist/harness/collaboration/delegation/store.js +3 -1
- package/dist/harness/collaboration/delegation/types.d.ts +34 -2
- package/dist/harness/collaboration/delegation/types.js +22 -0
- package/dist/harness/collaboration/delegation/wiring.d.ts +2 -0
- package/dist/harness/collaboration/delegation/wiring.js +12 -1
- package/dist/harness/context/budget-allocator.d.ts +26 -18
- package/dist/harness/context/budget-allocator.js +67 -32
- package/dist/harness/context/capabilities/compact/engine.d.ts +44 -11
- package/dist/harness/context/capabilities/compact/engine.js +296 -160
- package/dist/harness/context/capabilities/compact/handover.d.ts +5 -3
- package/dist/harness/context/capabilities/compact/handover.js +7 -5
- package/dist/harness/context/capabilities/compact/index.d.ts +7 -2
- package/dist/harness/context/capabilities/compact/index.js +5 -1
- package/dist/harness/context/capabilities/compact/mechanical.d.ts +130 -0
- package/dist/harness/context/capabilities/compact/mechanical.js +268 -0
- package/dist/harness/context/capabilities/compact/messages.d.ts +60 -0
- package/dist/harness/context/capabilities/compact/messages.js +91 -0
- package/dist/harness/context/capabilities/compact/types.d.ts +134 -19
- package/dist/harness/context/capabilities/compact/types.js +11 -1
- package/dist/harness/context/capabilities/compact/view-split.d.ts +36 -0
- package/dist/harness/context/capabilities/compact/view-split.js +72 -0
- package/dist/harness/context/capabilities/summary/gate.d.ts +19 -2
- package/dist/harness/context/capabilities/summary/gate.js +53 -6
- package/dist/harness/context/capabilities/summary/port.js +0 -1
- package/dist/harness/context/capabilities/summary/registry.js +20 -0
- package/dist/harness/context/capabilities/summary/resolver.d.ts +1 -1
- package/dist/harness/context/capabilities/summary/resolver.js +1 -6
- package/dist/harness/context/capabilities/summary/tool-binding.d.ts +1 -1
- package/dist/harness/context/capabilities/summary/tool-binding.js +16 -12
- package/dist/harness/context/capabilities/summary/tool-bindings.d.ts +13 -0
- package/dist/harness/context/capabilities/summary/tool-bindings.js +22 -0
- package/dist/harness/context/capabilities/summary/types.d.ts +19 -6
- package/dist/harness/context/constitution/default-agents.md +85 -0
- package/dist/harness/context/context-size-ledger.d.ts +143 -0
- package/dist/harness/context/context-size-ledger.js +243 -0
- package/dist/harness/context/default-context-engine.d.ts +290 -120
- package/dist/harness/context/default-context-engine.js +1555 -764
- package/dist/harness/context/index.d.ts +3 -2
- package/dist/harness/context/index.js +2 -1
- package/dist/harness/context/layer-health.d.ts +4 -0
- package/dist/harness/context/layer-health.js +4 -0
- package/dist/harness/context/layer-types.d.ts +72 -0
- package/dist/harness/context/layer-types.js +87 -2
- package/dist/harness/context/layers.d.ts +17 -15
- package/dist/harness/context/layers.js +54 -17
- package/dist/harness/context/message-selector.d.ts +10 -8
- package/dist/harness/context/message-selector.js +49 -27
- package/dist/harness/context/prefix-fingerprint.d.ts +46 -0
- package/dist/harness/context/prefix-fingerprint.js +52 -0
- package/dist/harness/context/summarize.d.ts +2 -2
- package/dist/harness/context/summarize.js +27 -2
- package/dist/harness/context/system-prompt-assembler.d.ts +4 -0
- package/dist/harness/context/system-prompt-assembler.js +7 -3
- package/dist/harness/context/token-constants.d.ts +8 -6
- package/dist/harness/context/token-constants.js +8 -7
- package/dist/harness/context/token-estimate-fns.d.ts +37 -27
- package/dist/harness/context/token-estimate-fns.js +85 -66
- package/dist/harness/context/token-estimator.d.ts +27 -12
- package/dist/harness/context/token-estimator.js +120 -66
- package/dist/harness/context/token-segments.d.ts +88 -0
- package/dist/harness/context/token-segments.js +103 -0
- package/dist/harness/context/tool-result-aging.d.ts +109 -16
- package/dist/harness/context/tool-result-aging.js +220 -55
- package/dist/harness/context/tool-result-body.js +2 -0
- package/dist/harness/context/transform/anchors.d.ts +66 -0
- package/dist/harness/context/transform/anchors.js +125 -0
- package/dist/harness/context/transform/fold.d.ts +56 -0
- package/dist/harness/context/transform/fold.js +135 -0
- package/dist/harness/context/transform/migrate.d.ts +41 -0
- package/dist/harness/context/transform/migrate.js +69 -0
- package/dist/harness/context/transform/types.d.ts +129 -0
- package/dist/harness/context/transform/types.js +19 -0
- package/dist/harness/context/turn-envelope.d.ts +6 -3
- package/dist/harness/context/types.d.ts +196 -119
- package/dist/harness/context/types.js +25 -1
- package/dist/harness/extension/execution-environment/effect-policy.d.ts +4 -3
- package/dist/harness/extension/execution-environment/effect-policy.js +2 -2
- package/dist/harness/extension/execution-environment/ops-audit.d.ts +1 -1
- package/dist/harness/extension/execution-environment/privileged-exec.js +4 -1
- package/dist/harness/extension/execution-environment/resource-limits.d.ts +1 -1
- package/dist/harness/extension/execution-environment/resource-limits.js +1 -1
- package/dist/harness/extension/execution-environment/workspace.js +1 -1
- package/dist/harness/extension/plugin-ecosystem/channel-types.d.ts +28 -2
- package/dist/harness/extension/plugin-ecosystem/channel-types.js +11 -2
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.d.ts +12 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.js +25 -0
- package/dist/harness/extension/plugin-ecosystem/commands/builtin.js +28 -1
- package/dist/harness/extension/plugin-ecosystem/commands/index.d.ts +3 -1
- package/dist/harness/extension/plugin-ecosystem/commands/index.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/commands/plugin-bridge.d.ts +12 -1
- package/dist/harness/extension/plugin-ecosystem/commands/plugin-bridge.js +14 -4
- package/dist/harness/extension/plugin-ecosystem/commands/router.d.ts +5 -4
- package/dist/harness/extension/plugin-ecosystem/commands/router.js +23 -14
- package/dist/harness/extension/plugin-ecosystem/commands/types.d.ts +8 -1
- package/dist/harness/extension/plugin-ecosystem/commands/types.js +2 -1
- package/dist/harness/extension/plugin-ecosystem/hooks/adapter.d.ts +54 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/adapter.js +397 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/compaction-integration.d.ts +16 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/compaction-integration.js +66 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/index.d.ts +4 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/index.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/iteration-snapshot.d.ts +11 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/iteration-snapshot.js +54 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/journal.d.ts +9 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/journal.js +22 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/policy-error.d.ts +12 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/policy-error.js +19 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/run-integration.d.ts +36 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/run-integration.js +338 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/services.d.ts +24 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/services.js +139 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/types.d.ts +229 -0
- package/dist/harness/extension/plugin-ecosystem/hooks/types.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/index.d.ts +1 -0
- package/dist/harness/extension/plugin-ecosystem/index.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/api.d.ts +223 -222
- package/dist/harness/extension/plugin-ecosystem/plugins/api.js +218 -203
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-instances.d.ts +95 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-instances.js +170 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-kinds.d.ts +178 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-kinds.js +314 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-registry.d.ts +78 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-registry.js +80 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/engine-compatibility.d.ts +4 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/engine-compatibility.js +18 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.d.ts +7 -85
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.js +8 -50
- package/dist/harness/extension/plugin-ecosystem/plugins/index.d.ts +6 -23
- package/dist/harness/extension/plugin-ecosystem/plugins/index.js +3 -23
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.d.ts +57 -114
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.js +279 -282
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.d.ts +46 -484
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.js +123 -345
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.d.ts +50 -223
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.js +144 -20
- package/dist/harness/extension/plugin-ecosystem/plugins/staging.d.ts +17 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/staging.js +15 -0
- package/dist/harness/extension/plugin-ecosystem/skills/manager.d.ts +6 -1
- package/dist/harness/extension/plugin-ecosystem/skills/manager.js +17 -1
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.d.ts +3 -0
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.js +46 -21
- package/dist/harness/extension/plugin-ecosystem/tools/browser-types.d.ts +333 -0
- package/dist/harness/extension/plugin-ecosystem/tools/browser-types.js +16 -0
- package/dist/harness/extension/plugin-ecosystem/tools/browser.d.ts +64 -0
- package/dist/harness/extension/plugin-ecosystem/tools/browser.js +692 -0
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.d.ts +0 -37
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +108 -4
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.js +36 -8
- package/dist/harness/extension/plugin-ecosystem/tools/file-edit.js +34 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.d.ts +0 -6
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.js +57 -4
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.js +81 -13
- package/dist/harness/extension/plugin-ecosystem/tools/http.js +5 -0
- package/dist/harness/extension/plugin-ecosystem/tools/knowledge.js +13 -7
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.js +126 -14
- package/dist/harness/extension/plugin-ecosystem/tools/platform.d.ts +1 -1
- package/dist/harness/extension/plugin-ecosystem/tools/platform.js +44 -5
- package/dist/harness/extension/plugin-ecosystem/tools/plugin-tool.d.ts +11 -0
- package/dist/harness/extension/plugin-ecosystem/tools/plugin-tool.js +39 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.d.ts +1 -1
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.js +19 -24
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.d.ts +7 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.js +4 -0
- package/dist/harness/governance/accounting/usage-ledger.d.ts +13 -1
- package/dist/harness/governance/accounting/usage-ledger.js +23 -1
- package/dist/harness/governance/credentials/db.d.ts +9 -0
- package/dist/harness/governance/credentials/db.js +122 -31
- package/dist/harness/governance/credentials/store.d.ts +68 -7
- package/dist/harness/governance/credentials/store.js +177 -64
- package/dist/harness/governance/credentials/types.d.ts +13 -2
- package/dist/harness/governance/human-in-the-loop/decision-cache.d.ts +3 -3
- package/dist/harness/governance/human-in-the-loop/decision-cache.js +2 -2
- package/dist/harness/governance/index.d.ts +1 -0
- package/dist/harness/governance/index.js +1 -0
- package/dist/harness/governance/registry/db.d.ts +32 -0
- package/dist/harness/governance/registry/db.js +142 -0
- package/dist/harness/governance/registry/index.d.ts +9 -0
- package/dist/harness/governance/registry/index.js +9 -0
- package/dist/harness/governance/registry/service.d.ts +381 -0
- package/dist/harness/governance/registry/service.js +825 -0
- package/dist/harness/governance/registry/types.d.ts +77 -0
- package/dist/harness/governance/registry/types.js +7 -0
- package/dist/harness/governance/security/capability-enforcer.js +1 -2
- package/dist/harness/governance/security/default-security-guard.d.ts +3 -0
- package/dist/harness/governance/security/default-security-guard.js +12 -1
- package/dist/harness/governance/security/risk-evaluator.d.ts +13 -3
- package/dist/harness/governance/security/risk-evaluator.js +307 -21
- package/dist/harness/governance/security/shell-parser-treesitter.js +12 -4
- package/dist/harness/governance/session-acl/tool-rights.d.ts +1 -0
- package/dist/harness/index.d.ts +17 -15
- package/dist/harness/index.js +9 -9
- package/dist/harness/knowledge/boot-config.d.ts +57 -0
- package/dist/harness/knowledge/boot-config.js +52 -0
- package/dist/harness/knowledge/catalog-types.d.ts +2 -0
- package/dist/harness/knowledge/client.d.ts +77 -9
- package/dist/harness/knowledge/client.js +95 -24
- package/dist/harness/knowledge/db.d.ts +16 -0
- package/dist/harness/knowledge/db.js +112 -41
- package/dist/harness/knowledge/describe-sample.d.ts +23 -0
- package/dist/harness/knowledge/describe-sample.js +58 -0
- package/dist/harness/knowledge/describe.d.ts +8 -0
- package/dist/harness/knowledge/describe.js +18 -2
- package/dist/harness/knowledge/engine-thread.js +11 -7
- package/dist/harness/knowledge/grounding.js +7 -2
- package/dist/harness/knowledge/http-app.d.ts +15 -0
- package/dist/harness/knowledge/http-app.js +117 -25
- package/dist/harness/knowledge/http-bridge.d.ts +15 -0
- package/dist/harness/knowledge/http-bridge.js +19 -0
- package/dist/harness/knowledge/http-params.d.ts +18 -0
- package/dist/harness/knowledge/http-params.js +24 -0
- package/dist/harness/knowledge/index.d.ts +2 -0
- package/dist/harness/knowledge/index.js +1 -0
- package/dist/harness/knowledge/knowledge-serve-child.js +5 -3
- package/dist/harness/knowledge/purge.js +5 -2
- package/dist/harness/knowledge/query-service.d.ts +25 -4
- package/dist/harness/knowledge/query-service.js +79 -43
- package/dist/harness/knowledge/query-worker-client.d.ts +14 -2
- package/dist/harness/knowledge/query-worker-client.js +8 -3
- package/dist/harness/knowledge/query-worker.js +9 -5
- package/dist/harness/knowledge/read-http.d.ts +2 -0
- package/dist/harness/knowledge/read-http.js +14 -3
- package/dist/harness/knowledge/retriever.d.ts +1 -1
- package/dist/harness/knowledge/retriever.js +1 -2
- package/dist/harness/knowledge/serve.d.ts +14 -8
- package/dist/harness/knowledge/serve.js +14 -6
- package/dist/harness/knowledge/source-store.d.ts +101 -5
- package/dist/harness/knowledge/source-store.js +323 -74
- package/dist/harness/knowledge/start-service-process.d.ts +41 -14
- package/dist/harness/knowledge/start-service-process.js +67 -96
- package/dist/harness/knowledge/tenant-gate.d.ts +81 -0
- package/dist/harness/knowledge/tenant-gate.js +167 -0
- package/dist/harness/knowledge/types.d.ts +7 -0
- package/dist/harness/knowledge/writer-service.d.ts +55 -11
- package/dist/harness/knowledge/writer-service.js +200 -30
- package/dist/harness/knowledge/writer-worker-client.d.ts +19 -11
- package/dist/harness/knowledge/writer-worker-client.js +40 -5
- package/dist/harness/knowledge/writer-worker.js +20 -5
- package/dist/harness/memory/backfill-trigger.d.ts +10 -3
- package/dist/harness/memory/backfill-trigger.js +19 -19
- package/dist/harness/memory/cognition-seeds.d.ts +45 -0
- package/dist/harness/memory/cognition-seeds.js +67 -0
- package/dist/harness/memory/cognition.d.ts +12 -3
- package/dist/harness/memory/cognition.js +55 -35
- package/dist/harness/memory/conceptualizer.d.ts +11 -1
- package/dist/harness/memory/conceptualizer.js +10 -1
- package/dist/harness/memory/context-slice.d.ts +42 -0
- package/dist/harness/memory/context-slice.js +197 -0
- package/dist/harness/memory/health-probe.d.ts +8 -2
- package/dist/harness/memory/health-probe.js +10 -13
- package/dist/harness/memory/index.d.ts +5 -1
- package/dist/harness/memory/index.js +3 -1
- package/dist/harness/memory/sqlite/agent-db.d.ts +1 -0
- package/dist/harness/memory/sqlite/agent-db.js +9 -8
- package/dist/harness/memory/sqlite/cognition-store.d.ts +26 -3
- package/dist/harness/memory/sqlite/cognition-store.js +103 -45
- package/dist/harness/memory/sqlite/memory-store.js +4 -0
- package/dist/harness/memory/sqlite/sqlite-vec.d.ts +24 -1
- package/dist/harness/memory/sqlite/sqlite-vec.js +37 -1
- package/dist/harness/memory/sqlite/wisdom-store.js +35 -10
- package/dist/harness/memory/types.d.ts +24 -6
- package/dist/harness/memory/wisdom-formation.d.ts +14 -3
- package/dist/harness/memory/wisdom-formation.js +85 -22
- package/dist/harness/memory/wisdom-gates.d.ts +14 -0
- package/dist/harness/memory/wisdom-gates.js +59 -19
- package/dist/harness/memory/wisdom.js +9 -0
- package/dist/harness/observability/observer/hub.d.ts +10 -0
- package/dist/harness/observability/observer/hub.js +120 -17
- package/dist/harness/observability/observer/types.d.ts +10 -6
- package/dist/harness/run/agent/agent.d.ts +40 -21
- package/dist/harness/run/agent/agent.js +67 -13
- package/dist/harness/run/agent/index.d.ts +1 -1
- package/dist/harness/run/budget/budget.d.ts +28 -10
- package/dist/harness/run/budget/budget.js +38 -15
- package/dist/harness/run/concurrency/tool-validator.js +4 -3
- package/dist/harness/run/model/index.d.ts +3 -1
- package/dist/harness/run/model/index.js +2 -1
- package/dist/harness/run/model/resolver.d.ts +4 -1
- package/dist/harness/run/model/resolver.js +36 -2
- package/dist/harness/run/model/run-scope.d.ts +2 -0
- package/dist/harness/run/model/run-scope.js +7 -0
- package/dist/harness/run/model/types.d.ts +22 -5
- package/dist/harness/run/model/types.js +3 -2
- package/dist/harness/run/model/window-truth.d.ts +37 -0
- package/dist/harness/run/model/window-truth.js +39 -0
- package/dist/harness/run/reliability/context-length-feedback.d.ts +77 -0
- package/dist/harness/run/reliability/context-length-feedback.js +128 -0
- package/dist/harness/run/reliability/harness-events.d.ts +3 -3
- package/dist/harness/run/reliability/model-error-policy.js +4 -0
- package/dist/harness/run/reliability/run-agent.d.ts +32 -4
- package/dist/harness/run/reliability/run-agent.js +216 -63
- package/dist/harness/run/reliability/run-metrics-collector.d.ts +19 -8
- package/dist/harness/run/reliability/run-metrics-collector.js +38 -23
- package/dist/harness/run/run-guard/default-run-guard.js +8 -8
- package/dist/harness/run/run-host.d.ts +302 -0
- package/dist/harness/run/run-host.js +978 -0
- package/dist/harness/run/run-scope.d.ts +48 -4
- package/dist/harness/run/run-scope.js +19 -1
- package/dist/harness/run/runner.d.ts +181 -39
- package/dist/harness/run/runner.js +654 -119
- package/dist/harness/session/attachments/index.d.ts +1 -0
- package/dist/harness/session/attachments/index.js +1 -0
- package/dist/harness/session/attachments/inject.d.ts +21 -10
- package/dist/harness/session/attachments/inject.js +76 -24
- package/dist/harness/session/attachments/recall-index.d.ts +70 -0
- package/dist/harness/session/attachments/recall-index.js +219 -0
- package/dist/harness/session/attachments/service.d.ts +21 -0
- package/dist/harness/session/attachments/service.js +258 -139
- package/dist/harness/session/attachments/types.d.ts +6 -0
- package/dist/harness/session/in-memory-store.js +13 -1
- package/dist/harness/session/schedules/service.d.ts +10 -2
- package/dist/harness/session/schedules/service.js +13 -2
- package/dist/harness/session/tasks/tools.js +12 -0
- package/dist/harness/session/transform-store.d.ts +136 -0
- package/dist/harness/session/transform-store.js +302 -0
- package/dist/harness/session/types.d.ts +11 -15
- package/dist/harness/shared/events/agent-event-map.d.ts +75 -13
- package/dist/harness/shared/events/agent-event-map.js +3 -2
- package/dist/harness/shared/events/scenario-events.d.ts +6 -6
- package/dist/harness/shared/types/agent-definition.d.ts +7 -2
- package/dist/index.d.ts +16 -18
- package/dist/index.js +9 -10
- package/dist/integration/agent-runtime/channel-message-source.d.ts +3 -1
- package/dist/integration/agent-runtime/channel-message-source.js +4 -3
- package/dist/integration/browser/camoufox.d.ts +40 -0
- package/dist/integration/browser/camoufox.js +80 -0
- package/dist/integration/browser/index.d.ts +91 -0
- package/dist/integration/browser/index.js +110 -0
- package/dist/integration/browser/install.d.ts +47 -0
- package/dist/integration/browser/install.js +214 -0
- package/dist/integration/browser/playwright.d.ts +224 -0
- package/dist/integration/browser/playwright.js +925 -0
- package/dist/integration/browser/service.d.ts +41 -0
- package/dist/integration/browser/service.js +181 -0
- package/dist/integration/browser/stealth.d.ts +42 -0
- package/dist/integration/browser/stealth.js +104 -0
- package/dist/integration/observability/metrics.d.ts +6 -6
- package/dist/integration/observability/metrics.js +13 -13
- package/dist/integration/observability/observer-bridge.js +2 -2
- package/dist/integration/observability/trace-collector.d.ts +5 -5
- package/dist/integration/observability/trace-collector.js +34 -35
- package/dist/integration/observability/trace-events.d.ts +3 -3
- package/dist/integration/observability/trace-events.js +3 -3
- package/dist/integration/providers/anthropic-message-normalize.d.ts +20 -0
- package/dist/integration/providers/anthropic-message-normalize.js +48 -0
- package/dist/integration/providers/anthropic.js +41 -3
- package/dist/integration/providers/fetch-timeout.d.ts +17 -0
- package/dist/integration/providers/fetch-timeout.js +24 -0
- package/dist/integration/providers/openai.d.ts +8 -0
- package/dist/integration/providers/openai.js +48 -2
- package/dist/integration/providers/usage.d.ts +1 -1
- package/dist/integration/providers/wire-dump-diff.js +2 -1
- package/dist/integration/providers/wire-dump.d.ts +57 -3
- package/dist/integration/providers/wire-dump.js +119 -6
- package/dist/integration/storage/archive-manager.d.ts +20 -2
- package/dist/integration/storage/archive-manager.js +34 -8
- package/dist/integration/storage/atomic-tmp.d.ts +12 -0
- package/dist/integration/storage/atomic-tmp.js +36 -0
- package/dist/integration/storage/jsonl.d.ts +10 -1
- package/dist/integration/storage/jsonl.js +155 -54
- package/dist/integration/storage/session-index.d.ts +5 -0
- package/dist/integration/storage/session-index.js +25 -4
- package/dist/integration/tools/assemble.d.ts +50 -0
- package/dist/integration/tools/assemble.js +137 -0
- package/dist/paths.d.ts +18 -0
- package/dist/paths.js +36 -0
- package/dist/subsystems/cognition-steward/conceptualize/config.yaml +3 -1
- package/dist/subsystems/cognition-steward/conceptualize/handler.js +74 -5
- package/dist/subsystems/cognition-steward/consolidate/SUBSYSTEM.md +3 -2
- package/dist/subsystems/cognition-steward/consolidate/config.yaml +11 -2
- package/dist/subsystems/cognition-steward/consolidate/handler.d.ts +6 -3
- package/dist/subsystems/cognition-steward/consolidate/handler.js +266 -28
- package/dist/subsystems/memory-steward/backfill/handler.js +3 -2
- package/dist/subsystems/memory-steward/govern/config.yaml +6 -1
- package/dist/subsystems/wisdom-steward/attribute/config.yaml +5 -1
- package/dist/subsystems/wisdom-steward/formation/SUBSYSTEM.md +8 -1
- package/dist/subsystems/wisdom-steward/formation/config.yaml +4 -0
- package/dist/subsystems/wisdom-steward/formation/handler.js +27 -5
- package/dist/subsystems/wisdom-steward/govern/config.yaml +6 -1
- package/package.json +14 -15
- package/dist/harness/context/hybrid-compressor.d.ts +0 -41
- package/dist/harness/context/hybrid-compressor.js +0 -159
- package/dist/harness/context/llm-summarizer.d.ts +0 -46
- package/dist/harness/context/llm-summarizer.js +0 -249
- package/dist/harness/context/smart-router.d.ts +0 -75
- package/dist/harness/context/smart-router.js +0 -118
- package/dist/harness/context/truncate-compressor.d.ts +0 -28
- package/dist/harness/context/truncate-compressor.js +0 -107
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.d.ts +0 -97
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.js +0 -155
- package/dist/harness/extension/plugin-ecosystem/plugins/hooks.d.ts +0 -7
- package/dist/harness/extension/plugin-ecosystem/plugins/hooks.js +0 -7
- package/dist/harness/extension/plugin-ecosystem/plugins/lifecycle.d.ts +0 -86
- package/dist/harness/extension/plugin-ecosystem/plugins/lifecycle.js +0 -139
|
@@ -154,6 +154,31 @@ export class ClientToolRegistry {
|
|
|
154
154
|
}
|
|
155
155
|
return false;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* 快照枚举:live provider 覆盖的 (session, tool) 对。
|
|
159
|
+
* 可见性谓词数据化(ClientToolVisibilitySnapshot)的数据源;run 侧本地求值。
|
|
160
|
+
*
|
|
161
|
+
* @param toolNames - 关心的工具名(通常是已安装客户端工具全集)
|
|
162
|
+
* @param now - 可选时间点(测试用)
|
|
163
|
+
* @returns live 对列表
|
|
164
|
+
*/
|
|
165
|
+
livePairs(toolNames, now) {
|
|
166
|
+
const ts = this.at(now);
|
|
167
|
+
this.expireStaleProviders(ts);
|
|
168
|
+
const wanted = new Set(toolNames);
|
|
169
|
+
const pairs = [];
|
|
170
|
+
for (const [sessionId, providers] of this.bySession) {
|
|
171
|
+
for (const p of providers.values()) {
|
|
172
|
+
if (!this.isLive(p, ts))
|
|
173
|
+
continue;
|
|
174
|
+
for (const d of p.descriptors) {
|
|
175
|
+
if (wanted.has(d.name))
|
|
176
|
+
pairs.push({ sessionId, toolName: d.name });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return pairs;
|
|
181
|
+
}
|
|
157
182
|
/** 全局是否仍有任一 live provider(决定能否 uninstall) */
|
|
158
183
|
hasAnyProvider(name, now) {
|
|
159
184
|
const ts = this.at(now);
|
|
@@ -153,7 +153,34 @@ export function createBuiltinCommands(host) {
|
|
|
153
153
|
};
|
|
154
154
|
},
|
|
155
155
|
};
|
|
156
|
-
|
|
156
|
+
const compact = {
|
|
157
|
+
name: 'compact',
|
|
158
|
+
description: 'Compress conversation context (during an active run: executes at the next message seam)',
|
|
159
|
+
usage: '/compact',
|
|
160
|
+
kind: 'control',
|
|
161
|
+
source: 'builtin',
|
|
162
|
+
risk: 'low',
|
|
163
|
+
// preempt =「run 在途可立即执行」(router 语义,默认仅 /stop):/compact 的主场景
|
|
164
|
+
// 恰是 run 进行中(方案 A),但它不中断 run——只提交压缩请求,由活跃 run 在下一个
|
|
165
|
+
// 消息缝执行。与 /stop 同为 run 在途控制命令。
|
|
166
|
+
preempt: true,
|
|
167
|
+
async execute(_ctx) {
|
|
168
|
+
return {
|
|
169
|
+
status: 'ok',
|
|
170
|
+
display: {
|
|
171
|
+
type: 'text',
|
|
172
|
+
// 结果播报由 op 执行后回填(gateway applySessionOps case 'compact')——
|
|
173
|
+
// 本条只在执行面缺席时兜底;不承诺时序(评审 del-d0830117 F8)
|
|
174
|
+
text: '🗜️ Compact requested.',
|
|
175
|
+
},
|
|
176
|
+
// 与压缩按钮同通道(SessionOp case 'compact'):run 进行中走 in-run 缝执行,
|
|
177
|
+
// 空闲走锁路径(方案 A,2026-11-20)
|
|
178
|
+
sessionOps: [{ op: 'compact' }],
|
|
179
|
+
effects: [{ kind: 'compact', summary: 'requested' }],
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
return [help, stop, newSession, model, status, issues, compact];
|
|
157
184
|
}
|
|
158
185
|
/** UI 本地命令目录项(执行仍在 Client,文案与 catalog 同源) */
|
|
159
186
|
export function createClientCatalogCommand() {
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 保留导出面:CommandRouter / parse / builtin / skill-bridge。
|
|
5
5
|
*/
|
|
6
|
-
export type { ArgSpec, CommandCatalogItem, CommandConflict, CommandConflictCandidate, CommandContext, CommandDefinition, CommandEffect, CommandInvoker, CommandKind, CommandRegisterResult, CommandResult, CommandRisk, CommandSource, ConflictPolicy, DisplayPayload, ExpandedMessages, PrincipalRef, SessionOp, SessionReadView, } from './types.js';
|
|
6
|
+
export type { ArgSpec, CommandCatalogItem, CommandConflict, CommandConflictCandidate, CommandContext, CommandDefinition, CommandEffect, CommandExecutionSource, CommandInvoker, CommandKind, CommandRegisterResult, CommandResult, CommandRisk, CommandSource, ConflictPolicy, DisplayPayload, ExpandedMessages, PrincipalRef, SessionOp, SessionReadView, } from './types.js';
|
|
7
7
|
export { normalizeCommandName, parseCommand, unescapeLiteralSlash, } from './parse.js';
|
|
8
8
|
export type { ParsedCommand } from './parse.js';
|
|
9
|
+
export { COMMAND_INVOKERS } from './types.js';
|
|
9
10
|
export { CommandRouter } from './router.js';
|
|
10
11
|
export type { CommandRouterOptions, ExecuteCommandInput, ExecuteCommandOutcome, } from './router.js';
|
|
11
12
|
export { createBuiltinCommands, createClientCatalogCommand, issuesFromRegistry, } from './builtin.js';
|
|
@@ -13,3 +14,4 @@ export type { BuiltinHost } from './builtin.js';
|
|
|
13
14
|
export { isValidCommandFieldName, skillCommandsFromManager, } from './skill-bridge.js';
|
|
14
15
|
export { loadUserCommandDefs } from './user-source.js';
|
|
15
16
|
export { pluginCommandsFromManager } from './plugin-bridge.js';
|
|
17
|
+
export type { PluginCommandBridge } from './plugin-bridge.js';
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* 保留导出面:CommandRouter / parse / builtin / skill-bridge。
|
|
5
5
|
*/
|
|
6
6
|
export { normalizeCommandName, parseCommand, unescapeLiteralSlash, } from './parse.js';
|
|
7
|
+
export { COMMAND_INVOKERS } from './types.js';
|
|
7
8
|
export { CommandRouter } from './router.js';
|
|
8
9
|
export { createBuiltinCommands, createClientCatalogCommand, issuesFromRegistry, } from './builtin.js';
|
|
9
10
|
export { isValidCommandFieldName, skillCommandsFromManager, } from './skill-bridge.js';
|
|
@@ -3,4 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { PluginManager } from '../plugins/manager.js';
|
|
5
5
|
import type { CommandDefinition } from './types.js';
|
|
6
|
-
export
|
|
6
|
+
export interface PluginCommandBridge {
|
|
7
|
+
definition: CommandDefinition;
|
|
8
|
+
ref: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Mount effective plugin contributions without replacing author-declared metadata.
|
|
12
|
+
* The ref is Host-assigned plugin identity; it is not supplied by the handler.
|
|
13
|
+
*
|
|
14
|
+
* @param pm - Manager whose effective contribution registry has been published
|
|
15
|
+
* @returns Command definitions and stable plugin registration references
|
|
16
|
+
*/
|
|
17
|
+
export declare function pluginCommandsFromManager(pm: PluginManager): PluginCommandBridge[];
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Plugin registerCommand → CommandRouter 桥接
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Mount effective plugin contributions without replacing author-declared metadata.
|
|
6
|
+
* The ref is Host-assigned plugin identity; it is not supplied by the handler.
|
|
7
|
+
*
|
|
8
|
+
* @param pm - Manager whose effective contribution registry has been published
|
|
9
|
+
* @returns Command definitions and stable plugin registration references
|
|
10
|
+
*/
|
|
4
11
|
export function pluginCommandsFromManager(pm) {
|
|
5
12
|
return pm.getCommands().map((cmd) => {
|
|
6
13
|
const rawName = cmd.name.replace(/^\/+/, '');
|
|
7
|
-
|
|
14
|
+
const definition = {
|
|
8
15
|
name: rawName,
|
|
9
16
|
description: cmd.description ?? rawName,
|
|
10
17
|
usage: `/${rawName}`,
|
|
11
|
-
kind: 'control',
|
|
18
|
+
kind: cmd.kind ?? 'control',
|
|
12
19
|
source: 'plugin',
|
|
13
|
-
risk:
|
|
14
|
-
invocableBy:
|
|
20
|
+
...(cmd.risk === undefined ? {} : { risk: cmd.risk }),
|
|
21
|
+
...(cmd.invocableBy === undefined ? {} : { invocableBy: cmd.invocableBy }),
|
|
22
|
+
...(cmd.args === undefined ? {} : { args: cmd.args }),
|
|
23
|
+
...(cmd.preempt === undefined ? {} : { preempt: cmd.preempt }),
|
|
15
24
|
async execute(ctx) {
|
|
16
25
|
try {
|
|
17
26
|
const out = (await cmd.handler({
|
|
@@ -45,5 +54,6 @@ export function pluginCommandsFromManager(pm) {
|
|
|
45
54
|
}
|
|
46
55
|
},
|
|
47
56
|
};
|
|
57
|
+
return { definition, ref: cmd.pluginId };
|
|
48
58
|
});
|
|
49
59
|
}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 冲突策略(§6.0):
|
|
5
5
|
* - 保留名:非 builtin 不得占用(可选 allowReservedOverride + prefer-source 显式胜出)
|
|
6
|
-
* - 同 (source, ref) 重复注册 = upsert
|
|
6
|
+
* - 同 (source, ref, name) 重复注册 = upsert;ref 可同时承载一个插件的多个 Command
|
|
7
7
|
* - 同名多候选(≥2)= reject-all:无一 active,候选保留至收敛到 1
|
|
8
8
|
* - 永不因 reject-all 删除已注册 builtin
|
|
9
9
|
* - Run 在途:仅 preempt 命令立即执行(默认仅 /stop)
|
|
10
10
|
*/
|
|
11
11
|
import type { IssueRegistry } from '../../../observability/diagnostics/registry.js';
|
|
12
|
-
import type { CommandCatalogItem, CommandConflict, CommandDefinition, CommandRegisterResult, CommandResult, CommandSource, ConflictPolicy, PrincipalRef, SessionOp, SessionReadView } from './types.js';
|
|
12
|
+
import type { CommandCatalogItem, CommandConflict, CommandDefinition, CommandExecutionSource, CommandRegisterResult, CommandResult, CommandSource, ConflictPolicy, PrincipalRef, SessionOp, SessionReadView } from './types.js';
|
|
13
13
|
export interface CommandRouterOptions {
|
|
14
14
|
issueRegistry?: IssueRegistry;
|
|
15
15
|
conflictPolicy?: ConflictPolicy;
|
|
@@ -31,6 +31,7 @@ export type ExecuteCommandOutcome = {
|
|
|
31
31
|
kind: 'command';
|
|
32
32
|
result: CommandResult;
|
|
33
33
|
definition?: CommandDefinition;
|
|
34
|
+
executionSource?: CommandExecutionSource;
|
|
34
35
|
conflict?: CommandConflict;
|
|
35
36
|
};
|
|
36
37
|
export declare class CommandRouter {
|
|
@@ -46,10 +47,10 @@ export declare class CommandRouter {
|
|
|
46
47
|
private sourcePriority;
|
|
47
48
|
constructor(options?: CommandRouterOptions);
|
|
48
49
|
/**
|
|
49
|
-
* 注册命令。同 (source, ref) 为 upsert;按 name 候选数重算 active。
|
|
50
|
+
* 注册命令。同 (source, ref, name) 为 upsert;按 name 候选数重算 active。
|
|
50
51
|
*/
|
|
51
52
|
register(definition: CommandDefinition, ref?: string): CommandRegisterResult;
|
|
52
|
-
/** 按 (source, ref) 注销候选并重算 */
|
|
53
|
+
/** 按 (source, ref, name) 注销候选并重算 */
|
|
53
54
|
unregister(source: CommandSource, ref: string, name: string): void;
|
|
54
55
|
get(name: string): CommandDefinition | null;
|
|
55
56
|
listDefinitions(): CommandDefinition[];
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 冲突策略(§6.0):
|
|
5
5
|
* - 保留名:非 builtin 不得占用(可选 allowReservedOverride + prefer-source 显式胜出)
|
|
6
|
-
* - 同 (source, ref) 重复注册 = upsert
|
|
6
|
+
* - 同 (source, ref, name) 重复注册 = upsert;ref 可同时承载一个插件的多个 Command
|
|
7
7
|
* - 同名多候选(≥2)= reject-all:无一 active,候选保留至收敛到 1
|
|
8
8
|
* - 永不因 reject-all 删除已注册 builtin
|
|
9
9
|
* - Run 在途:仅 preempt 命令立即执行(默认仅 /stop)
|
|
10
10
|
*/
|
|
11
11
|
import { parseCommand, normalizeCommandName, unescapeLiteralSlash } from './parse.js';
|
|
12
12
|
const DEFAULT_PRIORITY = ['builtin', 'plugin', 'user', 'skill'];
|
|
13
|
-
function candidateKey(source, ref) {
|
|
14
|
-
return source
|
|
13
|
+
function candidateKey(source, ref, name) {
|
|
14
|
+
return `${source}\0${ref}\0${name}`;
|
|
15
15
|
}
|
|
16
16
|
export class CommandRouter {
|
|
17
17
|
/** 全部候选(含冲突中未激活的) */
|
|
@@ -31,7 +31,7 @@ export class CommandRouter {
|
|
|
31
31
|
this.sourcePriority = options.sourcePriority ?? DEFAULT_PRIORITY;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* 注册命令。同 (source, ref) 为 upsert;按 name 候选数重算 active。
|
|
34
|
+
* 注册命令。同 (source, ref, name) 为 upsert;按 name 候选数重算 active。
|
|
35
35
|
*/
|
|
36
36
|
register(definition, ref) {
|
|
37
37
|
const name = normalizeCommandName(definition.name);
|
|
@@ -50,16 +50,16 @@ export class CommandRouter {
|
|
|
50
50
|
this.rejectName(name, conflict, `命令 /${name} 未加载`, `保留名 /${name} 不可被 ${definition.source}(${sourceRef})占用。`, `commands:command.reserved_denied:${name}`);
|
|
51
51
|
return { ok: false, reason: 'conflict', conflict };
|
|
52
52
|
}
|
|
53
|
-
this.candidates.set(candidateKey(definition.source, sourceRef), {
|
|
53
|
+
this.candidates.set(candidateKey(definition.source, sourceRef, name), {
|
|
54
54
|
definition: normalized,
|
|
55
55
|
ref: sourceRef,
|
|
56
56
|
name,
|
|
57
57
|
});
|
|
58
58
|
return this.recompute(name);
|
|
59
59
|
}
|
|
60
|
-
/** 按 (source, ref) 注销候选并重算 */
|
|
60
|
+
/** 按 (source, ref, name) 注销候选并重算 */
|
|
61
61
|
unregister(source, ref, name) {
|
|
62
|
-
this.candidates.delete(candidateKey(source, ref));
|
|
62
|
+
this.candidates.delete(candidateKey(source, ref, normalizeCommandName(name) ?? name));
|
|
63
63
|
this.recompute(normalizeCommandName(name) ?? name);
|
|
64
64
|
}
|
|
65
65
|
get(name) {
|
|
@@ -129,10 +129,12 @@ export class CommandRouter {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
const def = entry.definition;
|
|
132
|
+
const executionSource = { source: def.source, ref: entry.ref };
|
|
132
133
|
if (!this.isInvokedBy(def, principal)) {
|
|
133
134
|
return {
|
|
134
135
|
kind: 'command',
|
|
135
136
|
definition: def,
|
|
137
|
+
executionSource,
|
|
136
138
|
result: {
|
|
137
139
|
status: 'denied',
|
|
138
140
|
display: textDisplay(`命令 /${def.name} 不允许当前调用方使用。`),
|
|
@@ -144,6 +146,7 @@ export class CommandRouter {
|
|
|
144
146
|
return {
|
|
145
147
|
kind: 'command',
|
|
146
148
|
definition: def,
|
|
149
|
+
executionSource,
|
|
147
150
|
result: {
|
|
148
151
|
status: 'error',
|
|
149
152
|
display: textDisplay('Agent 正在运行——可发送 /stop 中止后再试。'),
|
|
@@ -157,6 +160,7 @@ export class CommandRouter {
|
|
|
157
160
|
return {
|
|
158
161
|
kind: 'command',
|
|
159
162
|
definition: def,
|
|
163
|
+
executionSource,
|
|
160
164
|
result: {
|
|
161
165
|
status: 'ok',
|
|
162
166
|
display: textDisplay(`已展开 /${def.name}`),
|
|
@@ -167,12 +171,13 @@ export class CommandRouter {
|
|
|
167
171
|
};
|
|
168
172
|
}
|
|
169
173
|
const result = await def.execute(ctx);
|
|
170
|
-
return { kind: 'command', definition: def, result };
|
|
174
|
+
return { kind: 'command', definition: def, executionSource, result };
|
|
171
175
|
}
|
|
172
176
|
catch (err) {
|
|
173
177
|
return {
|
|
174
178
|
kind: 'command',
|
|
175
179
|
definition: def,
|
|
180
|
+
executionSource,
|
|
176
181
|
result: {
|
|
177
182
|
status: 'error',
|
|
178
183
|
display: textDisplay(`命令 /${def.name} 执行失败:${err instanceof Error ? err.message : String(err)}`),
|
|
@@ -262,13 +267,17 @@ export class CommandRouter {
|
|
|
262
267
|
}
|
|
263
268
|
isInvokedBy(def, principal) {
|
|
264
269
|
const allowed = def.invocableBy ?? ['principal'];
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
+
switch (principal.actorType ?? 'user') {
|
|
271
|
+
case 'host':
|
|
272
|
+
case 'user':
|
|
273
|
+
case 'timer':
|
|
274
|
+
return allowed.includes('principal');
|
|
275
|
+
case 'agent':
|
|
276
|
+
return allowed.includes('agent');
|
|
277
|
+
case 'service':
|
|
278
|
+
case 'subsystem':
|
|
279
|
+
return allowed.includes('service');
|
|
270
280
|
}
|
|
271
|
-
return allowed.includes('principal');
|
|
272
281
|
}
|
|
273
282
|
higherSource(a, b) {
|
|
274
283
|
return this.sourcePriority.indexOf(a) <= this.sourcePriority.indexOf(b);
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
export type CommandKind = 'client' | 'control' | 'prompt';
|
|
8
8
|
export type CommandSource = 'builtin' | 'plugin' | 'user' | 'skill';
|
|
9
9
|
export type CommandRisk = 'low' | 'medium' | 'high';
|
|
10
|
-
|
|
10
|
+
/** Invoker categories expressible by PrincipalRef; source="plugin" is not caller identity. */
|
|
11
|
+
export declare const COMMAND_INVOKERS: readonly ["principal", "agent", "service"];
|
|
12
|
+
export type CommandInvoker = (typeof COMMAND_INVOKERS)[number];
|
|
11
13
|
export type SessionOp = {
|
|
12
14
|
op: 'abort_run';
|
|
13
15
|
reason?: string;
|
|
@@ -111,6 +113,11 @@ export interface CommandConflictCandidate {
|
|
|
111
113
|
ref: string;
|
|
112
114
|
action: 'registered' | 'rejected' | 'shadowed';
|
|
113
115
|
}
|
|
116
|
+
/** Host-assigned identity of the mounted definition; never accepted from a handler. */
|
|
117
|
+
export interface CommandExecutionSource {
|
|
118
|
+
source: CommandSource;
|
|
119
|
+
ref: string;
|
|
120
|
+
}
|
|
114
121
|
export interface CommandConflict {
|
|
115
122
|
name: string;
|
|
116
123
|
candidates: CommandConflictCandidate[];
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
* 归属:plugin-ecosystem/commands(调用面,与 tools/ 对偶)。
|
|
5
5
|
* 效应经 sessionOps 由 Host 落地;handler 不直接改 session/model(I1/I6)。
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
/** Invoker categories expressible by PrincipalRef; source="plugin" is not caller identity. */
|
|
8
|
+
export const COMMAND_INVOKERS = ['principal', 'agent', 'service'];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ExtensionHookPort, HookAuditRecord, HookCollectResult, HookContribution, HookEvent, HookIterationEvent, HookIterationTransform, HookPromptBuildEvent, HookPromptContribution, HookToolApproval, HookToolEvent, HookTransformResult, HookVote } from './types.js';
|
|
2
|
+
import type { PluginHookName } from '../plugins/manifest.js';
|
|
3
|
+
import type { PluginEntryConfig } from '../plugins/loader.js';
|
|
4
|
+
import type { HitlOutcome } from '../../../governance/human-in-the-loop/decision-cache.js';
|
|
5
|
+
import type { Message } from '@octopi-agent/core/types.js';
|
|
6
|
+
export interface RegisteredHook {
|
|
7
|
+
pluginId: string;
|
|
8
|
+
hookName: PluginHookName;
|
|
9
|
+
/** Explicit phase for dual-phase events; ordinary events use single. */
|
|
10
|
+
phase: 'single' | 'transform' | 'vote';
|
|
11
|
+
priority: number;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
handler: (event: never) => unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface HookExecutionHost {
|
|
16
|
+
getHooks(): RegisteredHook[];
|
|
17
|
+
getPluginConfig(pluginId: string): PluginEntryConfig | undefined;
|
|
18
|
+
recordHook(record: HookAuditRecord): void | Promise<void>;
|
|
19
|
+
/** Resolved Host HITL decision (engine cache included); ask errors must not escape as allow. */
|
|
20
|
+
approveToolCall(event: HookToolEvent, request: Readonly<HookToolApproval>, pluginId: string): Promise<HitlOutcome>;
|
|
21
|
+
}
|
|
22
|
+
export declare class HookDeniedError extends Error {
|
|
23
|
+
readonly vote: HookVote;
|
|
24
|
+
readonly hookName: PluginHookName;
|
|
25
|
+
constructor(vote: HookVote, hookName: PluginHookName);
|
|
26
|
+
}
|
|
27
|
+
export declare function requireHookApproval(vote: HookVote, hookName: PluginHookName): void;
|
|
28
|
+
/** Adapts effective plugin registrations to explicit cardinality operations. */
|
|
29
|
+
export declare class PluginHookAdapter implements ExtensionHookPort {
|
|
30
|
+
private readonly host;
|
|
31
|
+
constructor(host: HookExecutionHost);
|
|
32
|
+
observe<K extends PluginHookName>(name: K, event: HookEvent<K>): Promise<void>;
|
|
33
|
+
collect(name: 'before_prompt_build', event: HookPromptBuildEvent): Promise<HookCollectResult<HookPromptContribution>>;
|
|
34
|
+
hasHooks(name: PluginHookName, phase?: 'single' | 'transform' | 'vote'): boolean;
|
|
35
|
+
transform<K extends PluginHookName>(name: K, event: HookEvent<K>, initial: unknown): Promise<HookTransformResult<unknown>>;
|
|
36
|
+
vote<K extends PluginHookName>(name: K, event: HookEvent<K>): Promise<HookVote>;
|
|
37
|
+
override(name: 'before_agent_reply', event: Parameters<ExtensionHookPort['override']>[1]): Promise<Message | undefined>;
|
|
38
|
+
transformBeforeToolCall(event: HookToolEvent): Promise<HookTransformResult<Record<string, unknown>>>;
|
|
39
|
+
voteBeforeToolCall(event: HookToolEvent, originalParams: Readonly<Record<string, unknown>>): Promise<HookVote>;
|
|
40
|
+
beforeIteration(event: HookIterationEvent): Promise<{
|
|
41
|
+
transform: HookIterationTransform;
|
|
42
|
+
snapshotContributions: HookContribution<string>[];
|
|
43
|
+
vote: HookVote;
|
|
44
|
+
}>;
|
|
45
|
+
approveToolCall(event: HookToolEvent, request: Readonly<HookToolApproval>, pluginId: string): Promise<HitlOutcome>;
|
|
46
|
+
private entries;
|
|
47
|
+
private invokeVote;
|
|
48
|
+
private transformEvent;
|
|
49
|
+
private transformedValue;
|
|
50
|
+
private invoke;
|
|
51
|
+
private outcome;
|
|
52
|
+
private execute;
|
|
53
|
+
private record;
|
|
54
|
+
}
|