@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
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
export class HookDeniedError extends Error {
|
|
2
|
+
vote;
|
|
3
|
+
hookName;
|
|
4
|
+
constructor(vote, hookName) {
|
|
5
|
+
super(vote.reason ?? `Plugin hook ${hookName} denied the operation`);
|
|
6
|
+
this.vote = vote;
|
|
7
|
+
this.hookName = hookName;
|
|
8
|
+
this.name = 'HookDeniedError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function requireHookApproval(vote, hookName) {
|
|
12
|
+
if (vote.decision !== 'allow')
|
|
13
|
+
throw new HookDeniedError(vote, hookName);
|
|
14
|
+
}
|
|
15
|
+
function isVote(value) {
|
|
16
|
+
if (value === null || typeof value !== 'object' || !('decision' in value))
|
|
17
|
+
return false;
|
|
18
|
+
const decision = value.decision;
|
|
19
|
+
return decision === 'allow' || decision === 'deny' || decision === 'require_approval';
|
|
20
|
+
}
|
|
21
|
+
function failureMessage(error) {
|
|
22
|
+
return error instanceof Error ? error.message : String(error);
|
|
23
|
+
}
|
|
24
|
+
function isParams(value) {
|
|
25
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
/** Adapts effective plugin registrations to explicit cardinality operations. */
|
|
28
|
+
export class PluginHookAdapter {
|
|
29
|
+
host;
|
|
30
|
+
constructor(host) {
|
|
31
|
+
this.host = host;
|
|
32
|
+
}
|
|
33
|
+
async observe(name, event) {
|
|
34
|
+
for (const entry of this.entries(name, 'single')) {
|
|
35
|
+
await this.execute(entry, event, 'observe', async () => {
|
|
36
|
+
await entry.handler(event);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async collect(name, event) {
|
|
41
|
+
const contributions = [];
|
|
42
|
+
for (const entry of this.entries(name, 'single')) {
|
|
43
|
+
await this.execute(entry, event, 'collect', async () => {
|
|
44
|
+
const result = await entry.handler(event);
|
|
45
|
+
if (result === undefined)
|
|
46
|
+
return;
|
|
47
|
+
const value = typeof result === 'string' ? { text: result } : result;
|
|
48
|
+
if (!value || typeof value.text !== 'string') {
|
|
49
|
+
throw new Error('before_prompt_build must return text or {text}');
|
|
50
|
+
}
|
|
51
|
+
if (!value.text.trim())
|
|
52
|
+
return;
|
|
53
|
+
contributions.push({ pluginId: entry.pluginId, value: { text: value.text } });
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return { contributions };
|
|
57
|
+
}
|
|
58
|
+
hasHooks(name, phase) {
|
|
59
|
+
return this.host.getHooks()
|
|
60
|
+
.some((entry) => entry.hookName === name && (phase === undefined || entry.phase === phase));
|
|
61
|
+
}
|
|
62
|
+
async transform(name, event, initial) {
|
|
63
|
+
let value = initial;
|
|
64
|
+
const changes = [];
|
|
65
|
+
for (const entry of this.entries(name, 'single')) {
|
|
66
|
+
const currentEvent = this.transformEvent(name, event, value);
|
|
67
|
+
try {
|
|
68
|
+
const next = await this.invoke(entry, currentEvent);
|
|
69
|
+
if (next !== undefined && next !== null) {
|
|
70
|
+
value = this.transformedValue(name, value, next);
|
|
71
|
+
changes.push({ pluginId: entry.pluginId, value });
|
|
72
|
+
}
|
|
73
|
+
await this.record(entry, name, currentEvent, 'transform', 'ok');
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
await this.record(entry, name, currentEvent, 'transform', this.outcome(error), failureMessage(error));
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { value, changes };
|
|
81
|
+
}
|
|
82
|
+
async vote(name, event) {
|
|
83
|
+
let final = { decision: 'allow' };
|
|
84
|
+
for (const entry of this.entries(name, 'single')) {
|
|
85
|
+
const vote = await this.invokeVote(entry, event);
|
|
86
|
+
if (vote.decision === 'require_approval') {
|
|
87
|
+
final = { decision: 'deny', pluginId: entry.pluginId, reason: `${name} does not support approval votes` };
|
|
88
|
+
await this.record(entry, name, event, 'vote', 'denied', final.reason);
|
|
89
|
+
}
|
|
90
|
+
else if (vote.decision === 'deny') {
|
|
91
|
+
final = vote;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return final;
|
|
95
|
+
}
|
|
96
|
+
async override(name, event) {
|
|
97
|
+
const entries = this.entries(name, 'single');
|
|
98
|
+
if (entries.length === 0)
|
|
99
|
+
return undefined;
|
|
100
|
+
if (entries.length > 1) {
|
|
101
|
+
const error = new Error(`Override hook ${name} has multiple owners: ${entries.map((entry) => entry.pluginId).join(', ')}`);
|
|
102
|
+
await Promise.all(entries.map((entry) => this.record(entry, name, event, 'override', 'error', error.message)));
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
const entry = entries[0];
|
|
106
|
+
try {
|
|
107
|
+
const result = await this.invoke(entry, event);
|
|
108
|
+
if (result !== undefined && result !== null) {
|
|
109
|
+
const message = result;
|
|
110
|
+
if (!isParams(result) || message.role !== 'assistant') {
|
|
111
|
+
throw new Error('before_agent_reply must return an assistant Message');
|
|
112
|
+
}
|
|
113
|
+
if (message.toolCalls?.length) {
|
|
114
|
+
throw new Error('before_agent_reply must not return toolCalls (no tool results would follow)');
|
|
115
|
+
}
|
|
116
|
+
if (typeof message.content !== 'string' && !Array.isArray(message.content)) {
|
|
117
|
+
throw new Error('before_agent_reply must return text or block-array content');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
await this.record(entry, name, event, 'override', 'ok');
|
|
121
|
+
return (result ?? undefined);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
await this.record(entry, name, event, 'override', this.outcome(error), failureMessage(error));
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async transformBeforeToolCall(event) {
|
|
129
|
+
let params = { ...event.params };
|
|
130
|
+
const changes = [];
|
|
131
|
+
for (const entry of this.entries('before_tool_call', 'transform')) {
|
|
132
|
+
const current = { ...event, params: { ...params } };
|
|
133
|
+
try {
|
|
134
|
+
const result = await this.invoke(entry, current);
|
|
135
|
+
if (result !== undefined && result !== null) {
|
|
136
|
+
if (!isParams(result))
|
|
137
|
+
throw new Error('before_tool_call Transform must return a parameter object');
|
|
138
|
+
params = { ...result };
|
|
139
|
+
changes.push({ pluginId: entry.pluginId, value: { ...params } });
|
|
140
|
+
}
|
|
141
|
+
await this.record(entry, 'before_tool_call', current, 'transform', 'ok', undefined, {
|
|
142
|
+
toolName: event.toolName,
|
|
143
|
+
callId: event.call.id,
|
|
144
|
+
originalParams: current.params,
|
|
145
|
+
finalParams: { ...params },
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
await this.record(entry, 'before_tool_call', current, 'transform', this.outcome(error), failureMessage(error), {
|
|
150
|
+
toolName: event.toolName,
|
|
151
|
+
callId: event.call.id,
|
|
152
|
+
originalParams: event.params,
|
|
153
|
+
});
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return { value: params, changes };
|
|
158
|
+
}
|
|
159
|
+
async voteBeforeToolCall(event, originalParams) {
|
|
160
|
+
const pending = [];
|
|
161
|
+
let denied;
|
|
162
|
+
for (const entry of this.entries('before_tool_call', 'vote')) {
|
|
163
|
+
const vote = await this.invokeVote(entry, event, {
|
|
164
|
+
toolName: event.toolName,
|
|
165
|
+
callId: event.call.id,
|
|
166
|
+
originalParams,
|
|
167
|
+
params: event.params,
|
|
168
|
+
});
|
|
169
|
+
pending.push({ entry, vote });
|
|
170
|
+
if (vote.decision === 'deny')
|
|
171
|
+
denied = vote;
|
|
172
|
+
}
|
|
173
|
+
// A deny from any participant wins without prompting for an unnecessary approval.
|
|
174
|
+
if (denied)
|
|
175
|
+
return denied;
|
|
176
|
+
let final = { decision: 'allow' };
|
|
177
|
+
for (const { entry, vote } of pending) {
|
|
178
|
+
if (vote.decision !== 'require_approval')
|
|
179
|
+
continue;
|
|
180
|
+
if (!vote.approval) {
|
|
181
|
+
const reason = 'require_approval requires an approval request';
|
|
182
|
+
await this.record(entry, 'before_tool_call', event, 'vote', 'denied', reason);
|
|
183
|
+
return { decision: 'deny', pluginId: entry.pluginId, reason };
|
|
184
|
+
}
|
|
185
|
+
const approved = await this.host.approveToolCall(event, vote.approval, entry.pluginId);
|
|
186
|
+
const denyReason = approved.denyDetail
|
|
187
|
+
?? (approved.timedOut ? 'Host approval timed out' : 'Host approval was not granted');
|
|
188
|
+
await this.record(entry, 'before_tool_call', event, 'vote', approved.allowed ? 'ok' : 'denied', approved.allowed ? undefined : denyReason, {
|
|
189
|
+
approval: vote.approval,
|
|
190
|
+
toolName: event.toolName,
|
|
191
|
+
callId: event.call.id,
|
|
192
|
+
hitlDecision: approved.decision,
|
|
193
|
+
...(approved.timedOut ? { timedOut: true } : {}),
|
|
194
|
+
...(approved.denyReason === undefined ? {} : { denyReason: approved.denyReason }),
|
|
195
|
+
});
|
|
196
|
+
if (!approved.allowed) {
|
|
197
|
+
return { decision: 'deny', pluginId: entry.pluginId, reason: denyReason };
|
|
198
|
+
}
|
|
199
|
+
// The Host decision resolved this Vote: approved means allow, not "still pending".
|
|
200
|
+
final = { decision: 'allow', pluginId: entry.pluginId };
|
|
201
|
+
}
|
|
202
|
+
return final;
|
|
203
|
+
}
|
|
204
|
+
async beforeIteration(event) {
|
|
205
|
+
const transform = {};
|
|
206
|
+
const snapshotContributions = [];
|
|
207
|
+
for (const entry of this.entries('before_iteration', 'transform')) {
|
|
208
|
+
const current = {
|
|
209
|
+
...event,
|
|
210
|
+
model: transform.model ?? event.model,
|
|
211
|
+
thinking: transform.thinking ?? event.thinking,
|
|
212
|
+
};
|
|
213
|
+
try {
|
|
214
|
+
const result = await this.invoke(entry, current);
|
|
215
|
+
if (result) {
|
|
216
|
+
if (typeof result.snapshot === 'string') {
|
|
217
|
+
transform.snapshot = [transform.snapshot, result.snapshot].filter(Boolean).join('\n\n');
|
|
218
|
+
if (result.snapshot.trim())
|
|
219
|
+
snapshotContributions.push({ pluginId: entry.pluginId, value: result.snapshot });
|
|
220
|
+
}
|
|
221
|
+
if (result.model)
|
|
222
|
+
transform.model = { ...result.model };
|
|
223
|
+
if (result.thinking !== undefined)
|
|
224
|
+
transform.thinking = result.thinking;
|
|
225
|
+
}
|
|
226
|
+
await this.record(entry, 'before_iteration', current, 'transform', 'ok', undefined, {
|
|
227
|
+
model: transform.model,
|
|
228
|
+
thinking: transform.thinking,
|
|
229
|
+
snapshotPluginIds: snapshotContributions.map((contribution) => contribution.pluginId),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
await this.record(entry, 'before_iteration', current, 'transform', this.outcome(error), failureMessage(error));
|
|
234
|
+
throw error;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
let final = { decision: 'allow' };
|
|
238
|
+
const finalEvent = {
|
|
239
|
+
...event,
|
|
240
|
+
model: transform.model ?? event.model,
|
|
241
|
+
thinking: transform.thinking ?? event.thinking,
|
|
242
|
+
};
|
|
243
|
+
for (const entry of this.entries('before_iteration', 'vote')) {
|
|
244
|
+
const vote = await this.invokeVote(entry, finalEvent);
|
|
245
|
+
if (vote.decision === 'deny')
|
|
246
|
+
final = vote;
|
|
247
|
+
else if (vote.decision === 'require_approval') {
|
|
248
|
+
final = { decision: 'deny', pluginId: entry.pluginId, reason: 'before_iteration does not support approval votes' };
|
|
249
|
+
await this.record(entry, 'before_iteration', finalEvent, 'vote', 'denied', final.reason);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return { transform, snapshotContributions: [...snapshotContributions], vote: final };
|
|
253
|
+
}
|
|
254
|
+
async approveToolCall(event, request, pluginId) {
|
|
255
|
+
return this.host.approveToolCall(event, request, pluginId);
|
|
256
|
+
}
|
|
257
|
+
entries(name, phase) {
|
|
258
|
+
return this.host.getHooks()
|
|
259
|
+
.map((entry, index) => ({ entry, index }))
|
|
260
|
+
.filter(({ entry }) => entry.hookName === name && entry.phase === phase)
|
|
261
|
+
.sort((a, b) => b.entry.priority - a.entry.priority || a.index - b.index)
|
|
262
|
+
.map(({ entry }) => entry);
|
|
263
|
+
}
|
|
264
|
+
async invokeVote(entry, event, details) {
|
|
265
|
+
let vote;
|
|
266
|
+
let failure;
|
|
267
|
+
try {
|
|
268
|
+
const result = await this.invoke(entry, event);
|
|
269
|
+
if (result !== undefined && result !== null && !isVote(result)) {
|
|
270
|
+
throw new Error('Vote hook must return {decision}');
|
|
271
|
+
}
|
|
272
|
+
vote = result === undefined || result === null
|
|
273
|
+
? { decision: 'allow', pluginId: entry.pluginId }
|
|
274
|
+
: { ...result, pluginId: entry.pluginId };
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
// Fail-closed to deny, but the audit must not relabel a handler failure as a
|
|
278
|
+
// human/policy deny — record the real cause class and keep the message.
|
|
279
|
+
failure = this.outcome(error);
|
|
280
|
+
vote = { decision: 'deny', pluginId: entry.pluginId, reason: failureMessage(error) };
|
|
281
|
+
}
|
|
282
|
+
await this.record(entry, entry.hookName, event, 'vote', failure ?? (vote.decision === 'deny' ? 'denied' : 'ok'), vote.reason, details);
|
|
283
|
+
return vote;
|
|
284
|
+
}
|
|
285
|
+
transformEvent(name, event, value) {
|
|
286
|
+
if (name === 'agent_turn_prepare')
|
|
287
|
+
return { ...event, prompt: value };
|
|
288
|
+
if (name === 'before_model_resolve')
|
|
289
|
+
return { ...event, current: value };
|
|
290
|
+
if (name === 'before_agent_finalize')
|
|
291
|
+
return { ...event, reply: value };
|
|
292
|
+
throw new Error(`${name} is not a Transform hook`);
|
|
293
|
+
}
|
|
294
|
+
transformedValue(name, previous, next) {
|
|
295
|
+
if (name === 'agent_turn_prepare') {
|
|
296
|
+
if (typeof next !== 'string')
|
|
297
|
+
throw new Error('agent_turn_prepare must return a prompt string');
|
|
298
|
+
return next;
|
|
299
|
+
}
|
|
300
|
+
if (name === 'before_agent_finalize') {
|
|
301
|
+
const value = typeof next === 'string'
|
|
302
|
+
? { ...previous, content: next }
|
|
303
|
+
: next;
|
|
304
|
+
if (!isParams(value) || value.role !== 'assistant') {
|
|
305
|
+
throw new Error('before_agent_finalize must return an assistant Message or string');
|
|
306
|
+
}
|
|
307
|
+
const message = value;
|
|
308
|
+
if (message.toolCalls?.length) {
|
|
309
|
+
throw new Error('before_agent_finalize must not add toolCalls to the final reply');
|
|
310
|
+
}
|
|
311
|
+
if (typeof message.content !== 'string' && !Array.isArray(message.content)) {
|
|
312
|
+
throw new Error('before_agent_finalize must keep text or block-array content');
|
|
313
|
+
}
|
|
314
|
+
return value;
|
|
315
|
+
}
|
|
316
|
+
if (name === 'before_model_resolve') {
|
|
317
|
+
if (!isParams(next) || typeof next.provider !== 'string' || !next.provider ||
|
|
318
|
+
typeof next.model !== 'string' || !next.model) {
|
|
319
|
+
throw new Error('before_model_resolve must return non-empty provider/model strings');
|
|
320
|
+
}
|
|
321
|
+
return { provider: next.provider, model: next.model };
|
|
322
|
+
}
|
|
323
|
+
throw new Error(`${name} is not a Transform hook`);
|
|
324
|
+
}
|
|
325
|
+
async invoke(entry, event) {
|
|
326
|
+
const parent = event.signal;
|
|
327
|
+
if (parent?.aborted)
|
|
328
|
+
throw new Error('Hook aborted before handler start');
|
|
329
|
+
const controller = new AbortController();
|
|
330
|
+
const timeoutMs = this.host.getPluginConfig(entry.pluginId)?.hooks?.timeouts?.[entry.hookName]
|
|
331
|
+
?? this.host.getPluginConfig(entry.pluginId)?.hooks?.timeoutMs
|
|
332
|
+
?? entry.timeoutMs ?? 30_000;
|
|
333
|
+
let timedOut = false;
|
|
334
|
+
let settled = false;
|
|
335
|
+
const abort = () => controller.abort(parent?.reason);
|
|
336
|
+
parent?.addEventListener('abort', abort, { once: true });
|
|
337
|
+
const timer = setTimeout(() => {
|
|
338
|
+
timedOut = true;
|
|
339
|
+
controller.abort(new Error(`Hook handler timed out after ${timeoutMs}ms`));
|
|
340
|
+
}, timeoutMs);
|
|
341
|
+
try {
|
|
342
|
+
return await new Promise((resolve, reject) => {
|
|
343
|
+
const finish = (fn) => {
|
|
344
|
+
if (settled)
|
|
345
|
+
return;
|
|
346
|
+
settled = true;
|
|
347
|
+
fn();
|
|
348
|
+
};
|
|
349
|
+
controller.signal.addEventListener('abort', () => {
|
|
350
|
+
finish(() => reject(timedOut
|
|
351
|
+
? new Error(`Hook handler timed out after ${timeoutMs}ms`)
|
|
352
|
+
: new Error('Hook handler aborted')));
|
|
353
|
+
}, { once: true });
|
|
354
|
+
Promise.resolve().then(() => entry.handler({ ...event, signal: controller.signal })).then((result) => finish(() => resolve(result)), (error) => finish(() => reject(error)));
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
finally {
|
|
358
|
+
settled = true;
|
|
359
|
+
clearTimeout(timer);
|
|
360
|
+
parent?.removeEventListener('abort', abort);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
outcome(error) {
|
|
364
|
+
const message = failureMessage(error);
|
|
365
|
+
return message.includes('timed out') ? 'timeout' : message.includes('aborted') ? 'aborted' : 'error';
|
|
366
|
+
}
|
|
367
|
+
async execute(entry, event, phase, fn) {
|
|
368
|
+
try {
|
|
369
|
+
await fn();
|
|
370
|
+
await this.record(entry, entry.hookName, event, phase, 'ok');
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
// Observe and optional Collect explicitly fail open; their audit records the failure.
|
|
374
|
+
await this.record(entry, entry.hookName, event, phase, this.outcome(error), failureMessage(error));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
async record(entry, name, event, phase, outcome, reason, details) {
|
|
378
|
+
try {
|
|
379
|
+
await this.host.recordHook({
|
|
380
|
+
pluginId: entry.pluginId,
|
|
381
|
+
hookName: name,
|
|
382
|
+
phase,
|
|
383
|
+
outcome,
|
|
384
|
+
sessionId: event.sessionId,
|
|
385
|
+
agentId: event.agentId,
|
|
386
|
+
...(event.runId === undefined ? {} : { runId: event.runId }),
|
|
387
|
+
...(event.principal === undefined ? {} : { principal: event.principal }),
|
|
388
|
+
...(reason === undefined ? {} : { reason }),
|
|
389
|
+
...(details === undefined ? {} : { details }),
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
// Audit is an observability sink here, not an authorization grant; retain the original decision.
|
|
394
|
+
console.error(`[PluginHookAdapter] audit failed for ${entry.pluginId}/${name}:`, error);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CompactEngine, CompactOptions, CompactOutcome } from '../../../context/capabilities/compact/index.js';
|
|
2
|
+
import type { ExtensionHookPort } from './types.js';
|
|
3
|
+
/** Keep Hook admission outside compaction algorithms and the E4 state transition. */
|
|
4
|
+
export declare class HookedCompactEngine implements CompactEngine {
|
|
5
|
+
private readonly inner;
|
|
6
|
+
private readonly port;
|
|
7
|
+
private readonly identity;
|
|
8
|
+
constructor(inner: CompactEngine, port: ExtensionHookPort, identity: {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
agentId?: string;
|
|
11
|
+
});
|
|
12
|
+
/** Text compaction is not a Session compaction event. */
|
|
13
|
+
compactText(text: string, options?: CompactOptions): Promise<CompactOutcome>;
|
|
14
|
+
/** Vote before any summary work; observe the actual success/degraded/fresh result. */
|
|
15
|
+
compactMessages(messages: Parameters<CompactEngine['compactMessages']>[0], options: CompactOptions): Promise<CompactOutcome>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getRunScope } from '../../../run/run-scope.js';
|
|
2
|
+
import { HeuristicTokenEstimator } from '../../../context/token-estimator.js';
|
|
3
|
+
/** Keep Hook admission outside compaction algorithms and the E4 state transition. */
|
|
4
|
+
export class HookedCompactEngine {
|
|
5
|
+
inner;
|
|
6
|
+
port;
|
|
7
|
+
identity;
|
|
8
|
+
constructor(inner, port, identity) {
|
|
9
|
+
this.inner = inner;
|
|
10
|
+
this.port = port;
|
|
11
|
+
this.identity = identity;
|
|
12
|
+
}
|
|
13
|
+
/** Text compaction is not a Session compaction event. */
|
|
14
|
+
compactText(text, options) {
|
|
15
|
+
return this.inner.compactText(text, options);
|
|
16
|
+
}
|
|
17
|
+
/** Vote before any summary work; observe the actual success/degraded/fresh result. */
|
|
18
|
+
async compactMessages(messages, options) {
|
|
19
|
+
const scope = getRunScope();
|
|
20
|
+
const event = {
|
|
21
|
+
// Explicit caller identity wins: a manual compaction must not be attributed
|
|
22
|
+
// to whatever Run happens to hold the async context.
|
|
23
|
+
sessionId: options.sessionId ?? scope?.sessionId ?? this.identity.sessionId,
|
|
24
|
+
agentId: options.agentId ?? scope?.agentId ?? this.identity.agentId ?? 'default',
|
|
25
|
+
...(scope?.runId === undefined ? {} : { runId: scope.runId }),
|
|
26
|
+
...(scope?.principal === undefined ? {} : { principal: scope.principal }),
|
|
27
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
28
|
+
mode: options.mode ?? 'auto',
|
|
29
|
+
previousSummary: options.previousSummary,
|
|
30
|
+
};
|
|
31
|
+
const vote = await this.port.vote('before_compaction', event);
|
|
32
|
+
if (vote.decision !== 'allow') {
|
|
33
|
+
return {
|
|
34
|
+
ok: true,
|
|
35
|
+
summary: options.previousSummary,
|
|
36
|
+
compacted: false,
|
|
37
|
+
reason: `denied:${vote.reason ?? 'before_compaction'}`,
|
|
38
|
+
tokensBefore: options.estimator?.estimateMessages(messages)
|
|
39
|
+
?? new HeuristicTokenEstimator().estimateMessages(messages),
|
|
40
|
+
summarizeAttempted: false,
|
|
41
|
+
fresh: false,
|
|
42
|
+
view: [...messages],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const outcome = await this.inner.compactMessages(messages, options);
|
|
47
|
+
await this.port.observe('after_compaction', {
|
|
48
|
+
...event,
|
|
49
|
+
coveredMessageCount: options.foldRange?.replacedCount,
|
|
50
|
+
compacted: outcome.compacted,
|
|
51
|
+
fresh: outcome.fresh,
|
|
52
|
+
reason: outcome.reason,
|
|
53
|
+
});
|
|
54
|
+
return outcome;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
await this.port.observe('after_compaction', {
|
|
58
|
+
...event,
|
|
59
|
+
compacted: false,
|
|
60
|
+
fresh: false,
|
|
61
|
+
error: error instanceof Error ? error.message : String(error),
|
|
62
|
+
});
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { PluginHookAdapter, HookDeniedError, requireHookApproval } from './adapter.js';
|
|
2
|
+
export type { HookExecutionHost, RegisteredHook } from './adapter.js';
|
|
3
|
+
export { HookAuditJournal } from './journal.js';
|
|
4
|
+
export type { ExtensionHookContext, ExtensionHookHandler, ExtensionHookMap, ExtensionHookPort, HookAuditRecord, HookCollectResult, HookContribution, HookEvent, HookIterationEvent, HookIterationTransform, HookModelSelection, HookResult, HookSemantics, HookServiceRegistration, HookToolApproval, HookToolEvent, HookTransformResult, HookVote, } from './types.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LLMMessage } from '@octopi-agent/core/interfaces/model-provider.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build a Run/Iteration-only view. The authoritative turn_start remains byte-frozen.
|
|
4
|
+
* No system role is added and plugin content cannot masquerade as a user stimulus.
|
|
5
|
+
*/
|
|
6
|
+
export declare function projectPluginIterationSnapshot(messages: LLMMessage[], contributions: readonly {
|
|
7
|
+
pluginId: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}[], tokenBudget: number): Promise<LLMMessage[]>;
|
|
10
|
+
/** Apply the configured token budget before the snapshot reaches a model request. */
|
|
11
|
+
export declare function iterationSnapshotTokenBudget(configured: number | undefined, contextWindow: number | undefined): number;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { formatTurnContextXml, formatTurnStartContent, joinSlotXml, parseTurnEnvelope, } from '../../../context/turn-envelope.js';
|
|
2
|
+
import { PluginRuntimeSnapshotLayer } from '../../../context/layers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build a Run/Iteration-only view. The authoritative turn_start remains byte-frozen.
|
|
5
|
+
* No system role is added and plugin content cannot masquerade as a user stimulus.
|
|
6
|
+
*/
|
|
7
|
+
export async function projectPluginIterationSnapshot(messages, contributions, tokenBudget) {
|
|
8
|
+
if (contributions.length === 0)
|
|
9
|
+
return messages;
|
|
10
|
+
const layer = new PluginRuntimeSnapshotLayer(contributions.map(({ pluginId, text }) => ({ pluginId, value: { text } })));
|
|
11
|
+
const projected = await layer.assemble({
|
|
12
|
+
sessionId: 'run',
|
|
13
|
+
messages: [],
|
|
14
|
+
tokenBudget: Math.max(1, tokenBudget),
|
|
15
|
+
systemBudget: 0,
|
|
16
|
+
});
|
|
17
|
+
if (!projected)
|
|
18
|
+
return messages;
|
|
19
|
+
const index = messages.findLastIndex((message) => parseTurnEnvelope(message.content) !== null);
|
|
20
|
+
if (index < 0)
|
|
21
|
+
throw new Error('before_iteration snapshot requires a current turn_start envelope');
|
|
22
|
+
const original = messages[index];
|
|
23
|
+
const parsed = parseTurnEnvelope(original.content);
|
|
24
|
+
if (!parsed.turnId || !parsed.at || !parsed.hasUserMessage) {
|
|
25
|
+
throw new Error('before_iteration snapshot cannot rewrite an incomplete turn envelope');
|
|
26
|
+
}
|
|
27
|
+
const slots = parsed.slots.map((slot) => ({ tag: slot.tag, body: slot.body }));
|
|
28
|
+
const runtime = slots.find((slot) => slot.tag === 'runtime_snapshot');
|
|
29
|
+
if (runtime)
|
|
30
|
+
runtime.body = [runtime.body, projected.text].filter(Boolean).join('\n\n');
|
|
31
|
+
else
|
|
32
|
+
slots.unshift({ tag: 'runtime_snapshot', body: projected.text });
|
|
33
|
+
const content = formatTurnStartContent({
|
|
34
|
+
turnId: parsed.turnId,
|
|
35
|
+
at: parsed.at,
|
|
36
|
+
turnContextXml: formatTurnContextXml({ turnId: parsed.turnId, slotsXml: joinSlotXml(slots) }),
|
|
37
|
+
userText: parsed.userText,
|
|
38
|
+
});
|
|
39
|
+
const copy = { ...original };
|
|
40
|
+
if (typeof original.content === 'string' || original.content == null)
|
|
41
|
+
copy.content = content;
|
|
42
|
+
else if (Array.isArray(original.content)) {
|
|
43
|
+
copy.content = [
|
|
44
|
+
{ type: 'text', text: content },
|
|
45
|
+
...original.content.filter((block) => block.type !== 'text'),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
return [...messages.slice(0, index), copy, ...messages.slice(index + 1)];
|
|
49
|
+
}
|
|
50
|
+
/** Apply the configured token budget before the snapshot reaches a model request. */
|
|
51
|
+
export function iterationSnapshotTokenBudget(configured, contextWindow) {
|
|
52
|
+
const cap = Math.max(1, Math.floor((contextWindow ?? 8192) * 0.1));
|
|
53
|
+
return Math.max(1, Math.min(configured ?? 4096, cap));
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HookAuditRecord } from './types.js';
|
|
2
|
+
/** Append-only hook audit; not a tamper-evident ledger or a sandbox. */
|
|
3
|
+
export declare class HookAuditJournal {
|
|
4
|
+
private readonly rootDir;
|
|
5
|
+
private tail;
|
|
6
|
+
constructor(rootDir: () => string);
|
|
7
|
+
/** Serialize appends per journal instance and surface write failures to the Host. */
|
|
8
|
+
append(record: HookAuditRecord): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { appendFile, mkdir } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
/** Append-only hook audit; not a tamper-evident ledger or a sandbox. */
|
|
4
|
+
export class HookAuditJournal {
|
|
5
|
+
rootDir;
|
|
6
|
+
tail = Promise.resolve();
|
|
7
|
+
constructor(rootDir) {
|
|
8
|
+
this.rootDir = rootDir;
|
|
9
|
+
}
|
|
10
|
+
/** Serialize appends per journal instance and surface write failures to the Host. */
|
|
11
|
+
append(record) {
|
|
12
|
+
const task = this.tail.then(async () => {
|
|
13
|
+
const directory = join(this.rootDir(), 'hooks');
|
|
14
|
+
await mkdir(directory, { recursive: true });
|
|
15
|
+
const day = new Date().toISOString().slice(0, 10);
|
|
16
|
+
const entry = { timestamp: Date.now(), ...record };
|
|
17
|
+
await appendFile(join(directory, `${day}.jsonl`), `${JSON.stringify(entry)}\n`, 'utf8');
|
|
18
|
+
});
|
|
19
|
+
this.tail = task.catch(() => undefined);
|
|
20
|
+
return task;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const terminalMarker: unique symbol;
|
|
2
|
+
/** A Host-controlled extension failure must not enter the model transport retry policy. */
|
|
3
|
+
export declare class ExtensionTerminalError extends Error {
|
|
4
|
+
readonly cause: unknown;
|
|
5
|
+
readonly [terminalMarker] = true;
|
|
6
|
+
constructor(cause: unknown);
|
|
7
|
+
}
|
|
8
|
+
/** This is a Host/reliability policy, not a Core or Plugin contract. */
|
|
9
|
+
export declare function shouldAbortWithoutRetry(error: unknown): boolean;
|
|
10
|
+
/** Restore the extension failure to the normal Agent error-event surface. */
|
|
11
|
+
export declare function unwrapExtensionTerminalError(error: unknown): unknown;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const terminalMarker = Symbol('octopi.extension-terminal');
|
|
2
|
+
/** A Host-controlled extension failure must not enter the model transport retry policy. */
|
|
3
|
+
export class ExtensionTerminalError extends Error {
|
|
4
|
+
cause;
|
|
5
|
+
[terminalMarker] = true;
|
|
6
|
+
constructor(cause) {
|
|
7
|
+
super(cause instanceof Error ? cause.message : String(cause));
|
|
8
|
+
this.cause = cause;
|
|
9
|
+
this.name = 'ExtensionTerminalError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** This is a Host/reliability policy, not a Core or Plugin contract. */
|
|
13
|
+
export function shouldAbortWithoutRetry(error) {
|
|
14
|
+
return typeof error === 'object' && error !== null && terminalMarker in error;
|
|
15
|
+
}
|
|
16
|
+
/** Restore the extension failure to the normal Agent error-event surface. */
|
|
17
|
+
export function unwrapExtensionTerminalError(error) {
|
|
18
|
+
return error instanceof ExtensionTerminalError ? error.cause : error;
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AgentContext, AgentLoopConfig, BeforeToolCallContext } from '@octopi-agent/core/loop/types.js';
|
|
2
|
+
import type { RunScope } from '../../../run/run-scope.js';
|
|
3
|
+
import type { HarnessLoopEvent } from '../../../run/reliability/harness-events.js';
|
|
4
|
+
import type { ExtensionHookPort } from './types.js';
|
|
5
|
+
export interface AgentExtensionHookIntegration {
|
|
6
|
+
prepareToolArguments: AgentLoopConfig['prepareToolArguments'];
|
|
7
|
+
onToolCallComplete: AgentLoopConfig['onToolCallComplete'];
|
|
8
|
+
beforeStep: AgentLoopConfig['beforeStep'];
|
|
9
|
+
onStepComplete: AgentLoopConfig['onStepComplete'];
|
|
10
|
+
}
|
|
11
|
+
/** Per-Run mutable projections shared with Core's existing config callbacks. */
|
|
12
|
+
export declare class AgentExtensionHookState {
|
|
13
|
+
private readonly port;
|
|
14
|
+
private readonly scope;
|
|
15
|
+
readonly originalToolParams: WeakMap<import("@octopi-agent/core").ToolCall, Readonly<Record<string, unknown>>>;
|
|
16
|
+
private iterationSnapshots;
|
|
17
|
+
private readonly originalOnStepComplete;
|
|
18
|
+
private readonly originalBeforeStep;
|
|
19
|
+
private readonly originalTransformLlmMessages;
|
|
20
|
+
constructor(port: ExtensionHookPort, scope: () => RunScope, config: AgentLoopConfig);
|
|
21
|
+
/** Project only the normalized Provider request, never the Run's message workspace. */
|
|
22
|
+
transformLlmMessages(messages: import('@octopi-agent/core/interfaces/model-provider.js').LLMMessage[]): Promise<import('@octopi-agent/core/interfaces/model-provider.js').LLMMessage[]>;
|
|
23
|
+
callbacks(): AgentExtensionHookIntegration;
|
|
24
|
+
private context;
|
|
25
|
+
private prepareToolArguments;
|
|
26
|
+
private onToolCallComplete;
|
|
27
|
+
private beforeStep;
|
|
28
|
+
private prepareStep;
|
|
29
|
+
private onStepComplete;
|
|
30
|
+
}
|
|
31
|
+
/** Enriches Loop config with per-Run hook callbacks; no plugin type enters Core. */
|
|
32
|
+
export declare function integrateAgentHooks(port: ExtensionHookPort | undefined, config: AgentLoopConfig, scope: () => RunScope): AgentExtensionHookState | undefined;
|
|
33
|
+
/** Host Run-level Vote/Override/Observe, outside the reliability loop. */
|
|
34
|
+
export declare function withAgentRunHooks(port: ExtensionHookPort | undefined, scope: RunScope, context: AgentContext, signal: AbortSignal | undefined, gen: AsyncGenerator<HarnessLoopEvent>): AsyncGenerator<HarnessLoopEvent>;
|
|
35
|
+
/** Build the Host Run tool Vote after SecurityGuard and before raw execution. */
|
|
36
|
+
export declare function voteAgentToolCall(port: ExtensionHookPort | undefined, ctx: BeforeToolCallContext, originalParams: WeakMap<BeforeToolCallContext['toolCall'], Readonly<Record<string, unknown>>>, signal?: AbortSignal): Promise<import('@octopi-agent/core/loop/types.js').BeforeToolCallResult | undefined>;
|