@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
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { Message } from '@octopi-agent/core/types.js';
|
|
12
12
|
import type { ToolFileEffects } from '@octopi-agent/core/types/tools.js';
|
|
13
|
+
import type { ToolPolicy } from '@octopi-agent/core/types/agent-definition.js';
|
|
13
14
|
import type { ToolIsolationMode } from '../extension/execution-environment/isolation.js';
|
|
14
15
|
/** 工具执行时可见的 Run 运行时上下文 */
|
|
15
16
|
export interface RunToolRuntime {
|
|
@@ -42,6 +43,8 @@ export interface RunToolRuntime {
|
|
|
42
43
|
homeWrite?: boolean;
|
|
43
44
|
/** Run-level securityDegraded hook */
|
|
44
45
|
noteSecurityDegraded?: (reason: string) => void;
|
|
46
|
+
/** 人类输入等待回传(预算 wall-clock 扣减);由 run-agent 挂接 per-run Budget */
|
|
47
|
+
noteHumanWait?: (ms: number) => void;
|
|
45
48
|
/** ops 审计回传(ops P2):动作/越权写入 → 统一审计账本 */
|
|
46
49
|
recordOpsEvent?: (record: {
|
|
47
50
|
event: string;
|
|
@@ -104,10 +107,7 @@ export interface RunToolRuntime {
|
|
|
104
107
|
*/
|
|
105
108
|
sessionRights?: import('../governance/session-acl/types.js').EffectiveSessionRights;
|
|
106
109
|
/** SEC-2 static agent tool policy (agents[].tools) */
|
|
107
|
-
agentToolPolicy?:
|
|
108
|
-
allow?: string[];
|
|
109
|
-
deny?: string[];
|
|
110
|
-
};
|
|
110
|
+
agentToolPolicy?: ToolPolicy;
|
|
111
111
|
}
|
|
112
112
|
/** 一次 Run 的作用域身份(I1) */
|
|
113
113
|
export interface RunScope {
|
|
@@ -118,8 +118,35 @@ export interface RunScope {
|
|
|
118
118
|
* 由 Runner 在组装 RunScope 时生成;Observer/审计共用,不另造第二套 ID。
|
|
119
119
|
*/
|
|
120
120
|
runId?: string;
|
|
121
|
+
/** Read-only Host Principal; supplied by the caller, never by a plugin. */
|
|
122
|
+
principal?: {
|
|
123
|
+
actorId?: string;
|
|
124
|
+
actorType?: string;
|
|
125
|
+
tenantId?: string;
|
|
126
|
+
};
|
|
127
|
+
/** Current effective input, used by extension attribution and collection. */
|
|
128
|
+
prompt?: string;
|
|
129
|
+
/** Host-owned per-Run model snapshot; plugin transforms must use the Host resolver. */
|
|
130
|
+
resolvedModel?: import('./model/types.js').ResolvedModel;
|
|
131
|
+
/** Host-only allowlist resolver for iteration model transforms. */
|
|
132
|
+
resolveConfiguredModel?: (selection: {
|
|
133
|
+
provider: string;
|
|
134
|
+
model: string;
|
|
135
|
+
}) => import('./model/types.js').ResolvedModel | null;
|
|
136
|
+
thinkingLevel?: import('@octopi-agent/core/types.js').ThinkingLevel;
|
|
137
|
+
extensionSnapshotBudgetTokens?: number;
|
|
138
|
+
iteration?: number;
|
|
121
139
|
/** 本轮 systemPrompt 装配结果;供 convertToLlm / 层装配 */
|
|
122
140
|
systemPrompt?: string;
|
|
141
|
+
/**
|
|
142
|
+
* 本 Run 实际发送的工具清单(与 loop 的 toolDefs 同源 = run 级 AgentContext.tools)。
|
|
143
|
+
* 估算与请求必须量同一集合(F1-B3「尺子与作用域同源」):convertToLlm 若回退
|
|
144
|
+
* 实例级 agent.context.tools,会话过滤面不同会产出系统性错位估算(2026-11-07:
|
|
145
|
+
* 委派子会话首步实测 23,811 / 估算 5,643,毒对进台账后被锚外推放大 5.4×)。
|
|
146
|
+
* M-6:实现须**活读**(getter 读 run context 当前 tools)——beforeStep 可替换
|
|
147
|
+
* tools 数组,快照会让估算与请求在 run 中途分叉;回退链止于「无 tools = 0 个」。
|
|
148
|
+
*/
|
|
149
|
+
tools?: import('@octopi-agent/core/loop/types.js').AgentTool[];
|
|
123
150
|
/**
|
|
124
151
|
* turn 级 Knowledge grounding(arch/knowledge-layer.md §4.4)。
|
|
125
152
|
* 内容命中不进 system;消息侧插槽 source='knowledgeGrounding'。
|
|
@@ -135,6 +162,12 @@ export interface RunScope {
|
|
|
135
162
|
toolRuntime?: RunToolRuntime;
|
|
136
163
|
/** Agent 模板 revision(Reserved:AgentRevision 绑 Run) */
|
|
137
164
|
agentRevision?: string;
|
|
165
|
+
/**
|
|
166
|
+
* 交接式摘要素材的活来源(F8R-05):惰性渲染当前会话 task 快照。
|
|
167
|
+
* 装配/摘要时现取——session.tasks 与 SessionTaskService attachSession 是同一
|
|
168
|
+
* 内存对象,run 内任务变更即刻可见;避免自动压缩用注入历史里的旧副本。
|
|
169
|
+
*/
|
|
170
|
+
taskSnapshot?: () => string;
|
|
138
171
|
}
|
|
139
172
|
/**
|
|
140
173
|
* 生成与 RunScope 对齐的 runId(含 sessionId/agentId,可读且可排序)
|
|
@@ -159,6 +192,17 @@ export declare function withRunScope<T>(scope: RunScope, gen: AsyncGenerator<T>)
|
|
|
159
192
|
* @returns 当前作用域;不在 run 中时 undefined
|
|
160
193
|
*/
|
|
161
194
|
export declare function getRunScope(): RunScope | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* 在既有 RunScope 上下文中执行 fn。
|
|
197
|
+
*
|
|
198
|
+
* 供 ALS 边界之外的回调(CDP/事件回调等 socket 驱动路径)重入运行期上下文——
|
|
199
|
+
* 否则宿主 `confirmEffect` 这类按 `getRunScope()` 定界的能力在回调里拿不到 scope。
|
|
200
|
+
*
|
|
201
|
+
* @param scope - 本 run 的作用域身份(handler 执行期捕获)
|
|
202
|
+
* @param fn - 在该作用域内执行的函数(同步调用其内部的 scope 读取即可)
|
|
203
|
+
* @returns fn 的返回值
|
|
204
|
+
*/
|
|
205
|
+
export declare function runInScope<T>(scope: RunScope, fn: () => T): T;
|
|
162
206
|
/**
|
|
163
207
|
* 读取当前 run 的 sessionId
|
|
164
208
|
*
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @module harness/run/run-scope
|
|
10
10
|
*/
|
|
11
11
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
12
|
+
import { randomBytes } from 'node:crypto';
|
|
12
13
|
let runIdSeq = 0;
|
|
13
14
|
/**
|
|
14
15
|
* 生成与 RunScope 对齐的 runId(含 sessionId/agentId,可读且可排序)
|
|
@@ -20,7 +21,11 @@ let runIdSeq = 0;
|
|
|
20
21
|
*/
|
|
21
22
|
export function createRunId(sessionId, agentId, at = Date.now()) {
|
|
22
23
|
runIdSeq += 1;
|
|
23
|
-
|
|
24
|
+
// 随机后缀:seq 是进程内计数(重启归零),同毫秒 + 同会话 + 重启的极端序列
|
|
25
|
+
// 曾可碰撞并 run——runId 自 v0.120.5 起是老化 run 边界的语义载体,碰撞会把
|
|
26
|
+
// 两个 run 并成一个保护域;随机后缀消掉这条理论路径(评审 del-5ca70159 P3-11)
|
|
27
|
+
const rand = randomBytes(4).readUInt32BE(0).toString(36);
|
|
28
|
+
return `run_${at.toString(36)}_${runIdSeq.toString(36)}_${rand}_${sessionId}_${agentId}`;
|
|
24
29
|
}
|
|
25
30
|
const runScopeStorage = new AsyncLocalStorage();
|
|
26
31
|
/**
|
|
@@ -47,6 +52,19 @@ export async function* withRunScope(scope, gen) {
|
|
|
47
52
|
export function getRunScope() {
|
|
48
53
|
return runScopeStorage.getStore();
|
|
49
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* 在既有 RunScope 上下文中执行 fn。
|
|
57
|
+
*
|
|
58
|
+
* 供 ALS 边界之外的回调(CDP/事件回调等 socket 驱动路径)重入运行期上下文——
|
|
59
|
+
* 否则宿主 `confirmEffect` 这类按 `getRunScope()` 定界的能力在回调里拿不到 scope。
|
|
60
|
+
*
|
|
61
|
+
* @param scope - 本 run 的作用域身份(handler 执行期捕获)
|
|
62
|
+
* @param fn - 在该作用域内执行的函数(同步调用其内部的 scope 读取即可)
|
|
63
|
+
* @returns fn 的返回值
|
|
64
|
+
*/
|
|
65
|
+
export function runInScope(scope, fn) {
|
|
66
|
+
return runScopeStorage.run(scope, fn);
|
|
67
|
+
}
|
|
50
68
|
/**
|
|
51
69
|
* 读取当前 run 的 sessionId
|
|
52
70
|
*
|
|
@@ -18,7 +18,45 @@ type TypedSessionStore = SessionStore<SessionData>;
|
|
|
18
18
|
import type { Agent } from './agent/index.js';
|
|
19
19
|
import type { HarnessLoopEvent } from './reliability/harness-events.js';
|
|
20
20
|
import type { ReliabilityHarness } from './reliability/run-agent.js';
|
|
21
|
+
import { collectToolAgers, collectToolArgAgers } from '../context/tool-result-aging.js';
|
|
22
|
+
import { type OpsAuditEvent } from '../extension/execution-environment/ops-audit.js';
|
|
21
23
|
import type { SessionTaskService } from '../session/tasks/service.js';
|
|
24
|
+
/** Runner 压缩执行选项(compactSession / requestInRunCompact 共用形状;禁手抄) */
|
|
25
|
+
export type CompactSessionOptions = {
|
|
26
|
+
compactStructural: (input: {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
agentId: string;
|
|
29
|
+
messages: Message[];
|
|
30
|
+
summarize?: import('../context/types.js').SummarizeFunction;
|
|
31
|
+
compactTargetTokens?: number;
|
|
32
|
+
/** task 快照:交接式摘要指令尾部注入 */
|
|
33
|
+
taskSnapshot?: string;
|
|
34
|
+
/** 请求口径计量原料(2026-11-08 B1):与会话下一请求同源的 system/tools */
|
|
35
|
+
systemPrompt?: string;
|
|
36
|
+
tools?: import('@octopi-agent/core/interfaces/model-provider.js').LLMToolDefinition[];
|
|
37
|
+
/** 旧压缩快照读口(迁移输入) */
|
|
38
|
+
loadCompactState?: (sessionId: string) => Promise<import('../context/types.js').ContextCompactSnapshot | undefined> | import('../context/types.js').ContextCompactSnapshot | undefined;
|
|
39
|
+
toolAgers?: ReturnType<typeof collectToolAgers>;
|
|
40
|
+
toolArgAgers?: ReturnType<typeof collectToolArgAgers>;
|
|
41
|
+
/** run 中止信号(in-run 路):摘要/压缩调用随 run abort 取消 */
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
}) => Promise<import('../context/capabilities/compact/types.js').CompactOutcome>;
|
|
44
|
+
summarize?: import('../context/types.js').SummarizeFunction;
|
|
45
|
+
compactTargetTokens?: number;
|
|
46
|
+
/** 请求口径计量原料(2026-11-08 B1):透传给 compactStructural */
|
|
47
|
+
systemPrompt?: string;
|
|
48
|
+
tools?: import('@octopi-agent/core/interfaces/model-provider.js').LLMToolDefinition[];
|
|
49
|
+
/** 老化策略:摘要前缀必须与会话请求同形(缺它 → 默认指针 → 前缀分叉) */
|
|
50
|
+
toolAgers?: ReturnType<typeof collectToolAgers>;
|
|
51
|
+
toolArgAgers?: ReturnType<typeof collectToolArgAgers>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* in-run 压缩不可承接(无活跃 run / run 已收尾)——调用方(RunHost)应落回
|
|
55
|
+
* compactSession 锁路径执行。抛此类 = 语义化的 fallback 信号,不是故障。
|
|
56
|
+
*/
|
|
57
|
+
export declare class InRunCompactUnavailable extends Error {
|
|
58
|
+
constructor(message: string);
|
|
59
|
+
}
|
|
22
60
|
import type { SessionInboxEntry, SessionInboxBinding } from '../activation/inbox.js';
|
|
23
61
|
import { type ToolIsolationMode } from '../extension/execution-environment/isolation.js';
|
|
24
62
|
import { type SessionLease } from './concurrency/session-lease.js';
|
|
@@ -146,14 +184,23 @@ export interface SessionAwareRunnerConfig {
|
|
|
146
184
|
effectPolicy?: import("../extension/execution-environment/effect-policy.js").EffectPolicyConfig;
|
|
147
185
|
/** credentials.requireBindings(SEC-3c):无绑定凭证不可 resolve */
|
|
148
186
|
requireCredentialBindings?: boolean;
|
|
187
|
+
/** 归属租户(arch/multi-tenancy.md §4):RunScope.principal.tenantId 缺省锚(凭证域解析/归属);缺省 = 宿主面语义 */
|
|
188
|
+
tenantId?: string;
|
|
149
189
|
confirmEffect?: import("../extension/execution-environment/effect-policy.js").ConfirmEffect;
|
|
190
|
+
/** 附件轻量意图分流的默认 provider(仅无 Gateway 模型快照时回退)。 */
|
|
191
|
+
defaultIntentProvider?: import('@octopi-agent/core/interfaces/model-provider.js').ModelProvider;
|
|
150
192
|
/** 附件注入参数(knowledge.attachments.inject;缺省用内建默认) */
|
|
151
193
|
sessionAttachmentInject?: {
|
|
152
194
|
fullTextMaxChars?: number;
|
|
195
|
+
recallTopK?: number;
|
|
153
196
|
intent?: 'llm' | 'off';
|
|
154
197
|
intentTimeoutMs?: number;
|
|
155
198
|
emptyMessagePrompt?: string;
|
|
156
199
|
};
|
|
200
|
+
/** Budget for plugin Runtime snapshot contributions; never part of systemPrompt. */
|
|
201
|
+
extensionSnapshotBudgetTokens?: number;
|
|
202
|
+
/** Host-owned narrow extension boundary; no plugin registry enters Runner. */
|
|
203
|
+
extensionHooks?: import('../extension/plugin-ecosystem/hooks/types.js').ExtensionHookPort;
|
|
157
204
|
/**
|
|
158
205
|
* 事件旁路(Telemetry)。每条适配后事件调用(含 llm_stream_delta),
|
|
159
206
|
* 不改变 yield 语义。由 Builder 注入 RunTelemetry.onEvent。
|
|
@@ -164,7 +211,7 @@ export interface SessionAwareRunnerConfig {
|
|
|
164
211
|
}) => void;
|
|
165
212
|
}
|
|
166
213
|
/**
|
|
167
|
-
* 失败凭证消息中附带残句的截断上限(显示用途;完整残句在带 error 标记的
|
|
214
|
+
* 失败凭证消息中附带残句的截断上限(显示用途;完整残句在带 error 标记的 step 账本)
|
|
168
215
|
*
|
|
169
216
|
* 展示型截断,与 wire-dump 的消息截断同性质——不是部署可变参数,故不进配置。
|
|
170
217
|
*/
|
|
@@ -180,10 +227,11 @@ export interface RunConfig {
|
|
|
180
227
|
model?: string;
|
|
181
228
|
/** model 为裸名时的 provider 缺省 */
|
|
182
229
|
modelProvider?: string;
|
|
183
|
-
temperature?: number;
|
|
184
230
|
cwd?: string;
|
|
185
231
|
/** 本次 Run 的工具隔离覆盖(缺省用 Runner 配置 / DEFAULT_TOOL_ISOLATION) */
|
|
186
232
|
toolIsolation?: ToolIsolationMode;
|
|
233
|
+
/** Caller identity forwarded from the real RunRequest; not a plugin-provided claim. */
|
|
234
|
+
principal?: import('../extension/plugin-ecosystem/hooks/types.js').ExtensionHookContext['principal'];
|
|
187
235
|
/** Agent 模板 revision 绑 Run(Reserved:AgentRevision);写入 RunScope / 审计 */
|
|
188
236
|
agentRevision?: string;
|
|
189
237
|
contextWindow?: number;
|
|
@@ -223,9 +271,9 @@ export declare function adaptLoopEvent(event: HarnessLoopEvent, meta: {
|
|
|
223
271
|
* 失败轮的正文只能来自这里——不得回落到上一次调用的完整回复冒充本次输出。
|
|
224
272
|
*/
|
|
225
273
|
callStreamedContent?: string;
|
|
226
|
-
/** 最近一次 turn_end 的正文快照与错误标记,供 runner 落
|
|
227
|
-
|
|
228
|
-
|
|
274
|
+
/** 最近一次 turn_end 的正文快照与错误标记,供 runner 落 step 账本 */
|
|
275
|
+
lastStepContent?: string;
|
|
276
|
+
lastStepError?: boolean;
|
|
229
277
|
/** `agent_end.reason='error'` 时的错误文本,收口落失败凭证 */
|
|
230
278
|
errorMessage?: string;
|
|
231
279
|
lastUserContent?: string;
|
|
@@ -295,6 +343,12 @@ export declare class SessionAwareRunner {
|
|
|
295
343
|
private config;
|
|
296
344
|
/** Session 状态机缓存 */
|
|
297
345
|
private stateMachines;
|
|
346
|
+
/** 活跃 handle 会话(in-run 压缩承接判定;sessionId → run 归属 agentId,E4 键校验用) */
|
|
347
|
+
private readonly activeHandleSessions;
|
|
348
|
+
/** in-flight 压缩执行(key = sessionId\\0agentId):执行期间的请求 join 当前执行(coalesce 跨缝,评审 del-d0830117 F5) */
|
|
349
|
+
private readonly inFlightCompacts;
|
|
350
|
+
/** in-run 压缩请求槽(sessionId → 队列;消息缝 drain,见 requestInRunCompact) */
|
|
351
|
+
private readonly inRunCompactRequests;
|
|
298
352
|
/** 自主子系统运行时 */
|
|
299
353
|
private _subsystemRuntime?;
|
|
300
354
|
private _backfillTrigger?;
|
|
@@ -303,6 +357,8 @@ export declare class SessionAwareRunner {
|
|
|
303
357
|
private _events?;
|
|
304
358
|
/** 产品 Observer Hub(Run 现场;可选) */
|
|
305
359
|
private _observerHub?;
|
|
360
|
+
/** 观测专属事件出口(跨进程桥;见 setObservedEventSink) */
|
|
361
|
+
private _observedEventSink?;
|
|
306
362
|
/** 工具运行时上下文提供者 */
|
|
307
363
|
private toolContextProvider?;
|
|
308
364
|
/** 文件式 persona 的 run 时解析器;每次 handle 前解析,实现热更新 */
|
|
@@ -319,6 +375,8 @@ export declare class SessionAwareRunner {
|
|
|
319
375
|
private groundingAssembler?;
|
|
320
376
|
/** 模型快照解析器(Gateway 注入;每 run 只调一次) */
|
|
321
377
|
private resolveModelOverride?;
|
|
378
|
+
/** 无 Gateway 快照时,附件轻量意图分流回退到 Builder 的当前会话 provider。 */
|
|
379
|
+
private defaultIntentProvider?;
|
|
322
380
|
constructor(agent: Agent, harness: ReliabilityHarness, store: TypedSessionStore, config?: SessionAwareRunnerConfig & {
|
|
323
381
|
events?: import('@octopi-agent/core/primitives/event-bus.js').EventBus;
|
|
324
382
|
});
|
|
@@ -330,8 +388,24 @@ export declare class SessionAwareRunner {
|
|
|
330
388
|
*
|
|
331
389
|
* @param event - §7 事件词表
|
|
332
390
|
* @param data - 事件载荷(hash 走 canonicalJson,键序无关)
|
|
391
|
+
* @param opts.ignoreRunOverride - true = 忽略 run 级 effectOpsAudit 粘滞值
|
|
392
|
+
* (准入拒绝发生在 run 起点之前,不受上一轮 run 的 opsAudit:'off' 影响)
|
|
333
393
|
*/
|
|
334
394
|
private recordOpsAudit;
|
|
395
|
+
/**
|
|
396
|
+
* 对外 ops 记账口(账本 + 观测双写)——run 准入拒绝等发生在 Runner 执行流之外、
|
|
397
|
+
* 但属同一 ops 语义面的事件(如 gateway 侧 knowledge.required 闸门)用它对齐
|
|
398
|
+
* `ops.config.security_changed` / `ops.kill_switch.tripped` 的三件套待遇。
|
|
399
|
+
* (不叫 recordOpsEvent:与工具上下文的同名回调(仅账本)区分。)
|
|
400
|
+
*
|
|
401
|
+
* @param event - §7 事件词表
|
|
402
|
+
* @param data - 事件载荷(hash 走 canonicalJson,入账本)
|
|
403
|
+
* @param origin - 触发者锚点(观测事件的 agentId/sessionId;账本锚未落定时补锚)
|
|
404
|
+
*/
|
|
405
|
+
recordAdmissionRefusal(event: OpsAuditEvent, data: Record<string, unknown>, origin: {
|
|
406
|
+
agentId: string;
|
|
407
|
+
sessionId: string;
|
|
408
|
+
}): void;
|
|
335
409
|
/** 外送收口(懒建;仅配置了宿主侧收口路径时启用) */
|
|
336
410
|
private resolveOpsExporter;
|
|
337
411
|
/**
|
|
@@ -346,7 +420,23 @@ export declare class SessionAwareRunner {
|
|
|
346
420
|
*/
|
|
347
421
|
setObserverHub(hub: import('../observability/observer/hub.js').ObserverHub | undefined): void;
|
|
348
422
|
/**
|
|
349
|
-
*
|
|
423
|
+
* 注入观测专属事件出口(跨进程桥:run 实例 → gateway)。
|
|
424
|
+
*
|
|
425
|
+
* emitObserved 事件分两类:loop adapted 事件(已进 execute 流 yield,`streamed` 标记)
|
|
426
|
+
* 与观测专属事件(context.layers.assembled / tool.exec.update / run.timing 等,
|
|
427
|
+
* 只进 Hub+EventBus、不进事件 yield 流)。进程内 EventBus 的可见性在 run/gateway
|
|
428
|
+
* 拆分后不再跨进程,专属事件经此 sink 转 notify('session_event') 过网线;
|
|
429
|
+
* streamed 事件已在 execute 流中,不得重复过线。
|
|
430
|
+
*
|
|
431
|
+
* @param sink - 专属事件回调(异常 fail-open,不中断 run)
|
|
432
|
+
*/
|
|
433
|
+
setObservedEventSink(sink: ((event: import('@octopi-agent/core/primitives/event-bus.js').AgentEvent) => void) | undefined): void;
|
|
434
|
+
/**
|
|
435
|
+
* 发射事件:先采 Observer Hub,再进 EventBus(协调总线)。
|
|
436
|
+
*
|
|
437
|
+
* @param event - §7 事件词表
|
|
438
|
+
* @param opts.streamed - 事件已经 execute 流 yield(loop adapted);此时不再走
|
|
439
|
+
* observedEventSink,防跨进程桥重复过线
|
|
350
440
|
*/
|
|
351
441
|
private emitObserved;
|
|
352
442
|
/**
|
|
@@ -460,6 +550,54 @@ export declare class SessionAwareRunner {
|
|
|
460
550
|
* @yields AgentEvent 事件流(向后兼容格式)
|
|
461
551
|
*/
|
|
462
552
|
handle(sessionId: string, input: Message, runConfig: RunConfig, signal?: AbortSignal, inboxBinding?: SessionInboxBinding, initialInboxEntry?: SessionInboxEntry): AsyncGenerator<import('@octopi-agent/core/primitives/event-bus.js').AgentEvent>;
|
|
553
|
+
/**
|
|
554
|
+
* 某会话的 LLM 工具面(wire 面)——「无 run」调用方(manual 压缩)的单一来源。
|
|
555
|
+
*
|
|
556
|
+
* 与 run 内组装(`runContext.tools`)同式:`agent.toolsForSession` ∩ `agentToolPolicy`
|
|
557
|
+
* ∩ session ACL `toolRights`(SEC-2 同一漏斗,禁手抄)。摘要请求要吃到前缀缓存,
|
|
558
|
+
* 它的 tools 必须与下一主请求逐字节相同——多一个少一个,前缀就从第一字节断开。
|
|
559
|
+
*
|
|
560
|
+
* 差异如实声明(不假装等价):run 内还能叠 per-run `rightsCeiling` 与 run 启动时的
|
|
561
|
+
* 工具集快照;这里取不到 run,只能取配置级天花板。ACL 拒绝时不抛——压缩是用户显式
|
|
562
|
+
* 操作,不应因参与者授权不可用而整体失效——但要打日志(fail loud,不静默)。
|
|
563
|
+
*
|
|
564
|
+
* @param sessionId - 会话 id
|
|
565
|
+
* @param agentId - 归属 agent(ACL 授权主体)
|
|
566
|
+
* @returns provider 格式工具定义(顺序与会话面一致)
|
|
567
|
+
*/
|
|
568
|
+
resolveSessionLlmTools(sessionId: string, agentId: string): Promise<import('@octopi-agent/core/interfaces/model-provider.js').LLMToolDefinition[]>;
|
|
569
|
+
/**
|
|
570
|
+
* 会话工具面的唯一过滤点(SEC-2 漏斗,禁手抄)
|
|
571
|
+
*
|
|
572
|
+
* `resolveSessionLlmTools`(只要 wire 定义)与 `resolveSessionToolSurface`
|
|
573
|
+
* (wire 定义 + 老化策略)都必须经过这里——**不允许各自复述一遍过滤链**。
|
|
574
|
+
* 2026-11-13 的前缀分叉正是因为两条路径各自手抄参数表,改一边忘另一边。
|
|
575
|
+
*
|
|
576
|
+
* @param sessionId - 会话 id
|
|
577
|
+
* @param agentId - 归属 agent(ACL 授权主体)
|
|
578
|
+
* @returns 经 ACL/策略过滤后的 AgentTool 集合
|
|
579
|
+
*/
|
|
580
|
+
private resolveSessionToolSet;
|
|
581
|
+
/**
|
|
582
|
+
* 某会话的 wire 工具面 **同时**带出老化策略(manual 压缩专用)
|
|
583
|
+
*
|
|
584
|
+
* 为什么必须成对返回:摘要请求的 messages 前缀要与会话请求逐字节相同,
|
|
585
|
+
* 而 messages 老化依赖 toolAgers。只给 tools(wire 定义)不给 agers,
|
|
586
|
+
* 摘要视图就会退回默认机械指针 —— 2026-11-13 生产实测:678 个共同工具结果中
|
|
587
|
+
* 515 个(76%)形态不同 → 前缀从第 2 条消息起就分叉,缓存 0 命中。
|
|
588
|
+
*
|
|
589
|
+
* 单一漏斗:内部仍走 {@link resolveSessionLlmTools} 的同一过滤(`toolsForSession`
|
|
590
|
+
* ∩ `agentToolPolicy` ∩ session ACL),两边不可能出现两份工具集。
|
|
591
|
+
*
|
|
592
|
+
* @param sessionId - 会话 id
|
|
593
|
+
* @param agentId - 归属 agent
|
|
594
|
+
* @returns wire 工具定义(顺序与会话面一致)与按名索引的老化器
|
|
595
|
+
*/
|
|
596
|
+
resolveSessionToolSurface(sessionId: string, agentId: string): Promise<{
|
|
597
|
+
tools: import('@octopi-agent/core/interfaces/model-provider.js').LLMToolDefinition[];
|
|
598
|
+
toolAgers: ReturnType<typeof collectToolAgers>;
|
|
599
|
+
toolArgAgers: ReturnType<typeof collectToolArgAgers>;
|
|
600
|
+
}>;
|
|
463
601
|
/**
|
|
464
602
|
* Session compact under the same session lock as handle (E1/E4).
|
|
465
603
|
*
|
|
@@ -472,39 +610,42 @@ export declare class SessionAwareRunner {
|
|
|
472
610
|
* @param options - structural compact engine callback + summarize params
|
|
473
611
|
* @returns compact result
|
|
474
612
|
*/
|
|
475
|
-
compactSession(sessionId: string, agentId: string, options:
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
613
|
+
compactSession(sessionId: string, agentId: string, options: CompactSessionOptions): Promise<import('../context/capabilities/compact/types.js').CompactTransportOutcome>;
|
|
614
|
+
/**
|
|
615
|
+
* 压缩执行核心(**无锁**):两个入口共用——compactSession(锁路径,store 快照)与
|
|
616
|
+
* in-run 消息缝(run 持锁中,传 handle 内活 session,见 requestInRunCompact)。
|
|
617
|
+
* 锁语义(E1/E4 单写者)由入口负责,本方法不得再抢锁(自抢即死锁)。
|
|
618
|
+
*
|
|
619
|
+
* @param sessionId - 会话 id
|
|
620
|
+
* @param agentId - compact 视图归属 agent(E4 键)
|
|
621
|
+
* @param session - 会话数据(消息/任务/compact 快照读口的来源)
|
|
622
|
+
* @param options - 压缩执行选项(compactStructural 等,已解析)
|
|
623
|
+
* @param signal - run 中止信号(in-run 路透传至摘要/压缩调用;锁路径不传)
|
|
624
|
+
* @returns 压缩结果
|
|
625
|
+
*/
|
|
626
|
+
private runCompactCore;
|
|
627
|
+
/**
|
|
628
|
+
* mid-run 手动压缩(方案 A,2026-11-20 拍板):请求交**活跃 run** 在下一个消息缝
|
|
629
|
+
* 执行同一条 compact 路径(同保护/同摘要/同 transform 记录),不抢 session 锁
|
|
630
|
+
* (run 持锁中,自抢即死锁)。同 (sessionId, agentId) 的并发请求 coalesce 到
|
|
631
|
+
* 同一次缝执行。无活跃 run / run 已收尾 → 抛 InRunCompactUnavailable,
|
|
632
|
+
* 调用方落回 compactSession 锁路径(FIFO 立即执行)。
|
|
633
|
+
*
|
|
634
|
+
* @param sessionId - 会话 id
|
|
635
|
+
* @param agentId - compact 视图归属 agent(E4 键)
|
|
636
|
+
* @param options - 与 compactSession 同形的解析结果(compactStructural 等)
|
|
637
|
+
* @returns 压缩结果(下一个消息缝执行完成后 resolve)
|
|
638
|
+
* @throws {InRunCompactUnavailable} 无活跃 run 可承接(调用方 fallback 锁路径)
|
|
639
|
+
*/
|
|
640
|
+
requestInRunCompact(sessionId: string, agentId: string, options: CompactSessionOptions): Promise<import('../context/capabilities/compact/types.js').CompactTransportOutcome>;
|
|
641
|
+
/**
|
|
642
|
+
* 消息缝执行 in-run 压缩队列(consumeMessages 缝上调用;run 持锁,单写者)。
|
|
643
|
+
* 逐条执行、逐条结算;单条失败只 reject 该条,不拖垮队列。
|
|
644
|
+
*
|
|
645
|
+
* @param sessionId - 会话 id
|
|
646
|
+
* @param session - handle 内活 session(消息/任务最新视图)
|
|
647
|
+
*/
|
|
648
|
+
private drainInRunCompacts;
|
|
508
649
|
/**
|
|
509
650
|
* 获取 Session 锁(经 SessionLease;E2 键 = sessionId)
|
|
510
651
|
*
|
|
@@ -536,6 +677,7 @@ export declare class SessionAwareRunner {
|
|
|
536
677
|
* @param userMessage - 本 turn 用户消息对象(session.messages 中的同一引用)
|
|
537
678
|
* @param turnId - 会话内单调 turn id
|
|
538
679
|
* @param turnContextXml - `<turn_context>…</turn_context>` 整段
|
|
680
|
+
* @param runId - 本 run 归因(`metadata.runId`,tool-result-aging 的 run 起点边界用)
|
|
539
681
|
* @throws 若已定形(禁止二次改写)
|
|
540
682
|
*/
|
|
541
683
|
private bakeTurnStart;
|