@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
|
@@ -89,11 +89,28 @@ export function computeSecurityConfigFingerprint(config) {
|
|
|
89
89
|
...pickFields(config.effectPolicy ?? {}, EFFECT_POLICY_SECURITY_KEYS, 'effectPolicy.'),
|
|
90
90
|
...pickFields(config.security ?? {}, SECURITY_CONFIG_SECURITY_KEYS, 'security.'),
|
|
91
91
|
};
|
|
92
|
-
// per-agent
|
|
92
|
+
// per-agent 覆盖与工具面/插件加载授权都是安全面。
|
|
93
93
|
if (config.agents !== undefined)
|
|
94
94
|
fields['agents'] = config.agents;
|
|
95
95
|
if (config.plugins !== undefined && Object.keys(config.plugins).length > 0) {
|
|
96
|
-
|
|
96
|
+
const pluginFields = pickFields(config.plugins, ['loadPaths', 'allowList', 'blockList'], 'plugins.');
|
|
97
|
+
const entries = config.plugins.entries;
|
|
98
|
+
if (typeof entries === 'object' && entries !== null && !Array.isArray(entries)) {
|
|
99
|
+
const enabled = {};
|
|
100
|
+
for (const [id, entry] of Object.entries(entries)) {
|
|
101
|
+
if (typeof entry === 'object' && entry !== null && !Array.isArray(entry)) {
|
|
102
|
+
const value = entry.enabled;
|
|
103
|
+
if (value !== undefined)
|
|
104
|
+
enabled[id] = value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
pluginFields['plugins.entries.enabled'] = enabled;
|
|
108
|
+
}
|
|
109
|
+
// Business config is hashed, never copied into the diagnostic field projection.
|
|
110
|
+
if (config.plugins.configs !== undefined) {
|
|
111
|
+
pluginFields['plugins.legacyConfigsHash'] = createHash('sha256').update(stableStringify(config.plugins.configs)).digest('hex');
|
|
112
|
+
}
|
|
113
|
+
fields['plugins'] = pluginFields;
|
|
97
114
|
}
|
|
98
115
|
return {
|
|
99
116
|
fingerprint: createHash('sha256').update(stableStringify(fields)).digest('hex'),
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RegisteredTool → AgentTool 适配(热更新已 build Agent 的 client tool)。
|
|
3
|
+
*
|
|
4
|
+
* 将 RegisteredTool 转换为 Loop AgentTool(与 builder.convertToAgentTool、
|
|
5
|
+
* think.buildAgentTools 同构)。原居 gateway.ts,P0b 随客户端工具面迁 run 侧时
|
|
6
|
+
* 归位 engine(其全部依赖本就在 engine)。导出供测试覆盖三处映射的
|
|
7
|
+
* executionMode 透传一致性。
|
|
8
|
+
*/
|
|
9
|
+
import type { RegisteredTool } from '@octopi-agent/core/types.js';
|
|
10
|
+
export declare function registeredToolToAgentTool(tool: RegisteredTool): {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
executionMode?: 'parallel' | 'sequential';
|
|
14
|
+
source?: import('@octopi-agent/core/types.js').ToolSource;
|
|
15
|
+
parameters?: Record<string, unknown>;
|
|
16
|
+
execute: (toolCallId: string, args: unknown, signal?: AbortSignal, onUpdate?: (partial: {
|
|
17
|
+
content?: unknown;
|
|
18
|
+
}) => void) => Promise<{
|
|
19
|
+
toolCallId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
content: unknown;
|
|
22
|
+
isError?: boolean;
|
|
23
|
+
durationMs?: number;
|
|
24
|
+
purpose?: string;
|
|
25
|
+
source?: import('@octopi-agent/core/types.js').ToolSource;
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RegisteredTool → AgentTool 适配(热更新已 build Agent 的 client tool)。
|
|
3
|
+
*
|
|
4
|
+
* 将 RegisteredTool 转换为 Loop AgentTool(与 builder.convertToAgentTool、
|
|
5
|
+
* think.buildAgentTools 同构)。原居 gateway.ts,P0b 随客户端工具面迁 run 侧时
|
|
6
|
+
* 归位 engine(其全部依赖本就在 engine)。导出供测试覆盖三处映射的
|
|
7
|
+
* executionMode 透传一致性。
|
|
8
|
+
*/
|
|
9
|
+
import { buildToolLlmParameters, prepareHandlerArgs, resolveToolCallPurpose, } from './tool-purpose.js';
|
|
10
|
+
import { getRunScope } from '../run/run-scope.js';
|
|
11
|
+
export function registeredToolToAgentTool(tool) {
|
|
12
|
+
return {
|
|
13
|
+
name: tool.definition.name,
|
|
14
|
+
description: tool.definition.description,
|
|
15
|
+
// 与 convertToAgentTool 同构:purpose 统一装配(arch/tool-call-purpose.md)
|
|
16
|
+
...(tool.executionMode ? { executionMode: tool.executionMode } : {}),
|
|
17
|
+
// 结果老化策略(同 executionMode:唯一声明源在 RegisteredTool)
|
|
18
|
+
...(tool.ageArgs ? { ageArgs: tool.ageArgs } : {}),
|
|
19
|
+
...(tool.ageResult ? { ageResult: tool.ageResult } : {}),
|
|
20
|
+
...(tool.source === undefined ? {} : { source: tool.source }),
|
|
21
|
+
parameters: buildToolLlmParameters(tool.definition.parameters),
|
|
22
|
+
execute: async (toolCallId, args, signal, onUpdate) => {
|
|
23
|
+
const startTime = Date.now();
|
|
24
|
+
try {
|
|
25
|
+
const rawArgs = (args ?? {});
|
|
26
|
+
// schema 已 required purpose;模型漏填时推导,不中断调用
|
|
27
|
+
const purpose = resolveToolCallPurpose(tool.definition.name, rawArgs);
|
|
28
|
+
const handlerArgs = prepareHandlerArgs(rawArgs, tool.definition);
|
|
29
|
+
const scope = getRunScope();
|
|
30
|
+
const { isPluginToolPermitted } = await import('../extension/plugin-ecosystem/tools/plugin-tool.js');
|
|
31
|
+
if (!isPluginToolPermitted(tool, scope?.toolRuntime?.agentToolPolicy)) {
|
|
32
|
+
throw new Error(`Plugin tool "${tool.definition.name}" is not allowed for this agent`);
|
|
33
|
+
}
|
|
34
|
+
const result = await tool.handler(handlerArgs, {
|
|
35
|
+
sessionId: scope?.sessionId ?? 'unknown',
|
|
36
|
+
agentId: scope?.agentId ?? 'unknown',
|
|
37
|
+
messages: scope?.toolRuntime?.messages ?? [],
|
|
38
|
+
abortSignal: signal,
|
|
39
|
+
// 工具部分输出通道(展示用途);无转发器时不给工具假通道
|
|
40
|
+
...(onUpdate ? { onUpdate } : {}),
|
|
41
|
+
fileEffects: scope?.toolRuntime?.fileEffects
|
|
42
|
+
?? (await import('../extension/execution-environment/undo-log.js')).createUnconfiguredFileEffects(),
|
|
43
|
+
memoryEffects: scope?.toolRuntime?.memoryEffects
|
|
44
|
+
?? (await import('../extension/execution-environment/undo-log.js')).createUnconfiguredMemoryEffects(),
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
toolCallId,
|
|
48
|
+
name: tool.definition.name,
|
|
49
|
+
content: result,
|
|
50
|
+
purpose,
|
|
51
|
+
...(tool.source === undefined ? {} : { source: tool.source }),
|
|
52
|
+
durationMs: Date.now() - startTime,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return {
|
|
57
|
+
toolCallId,
|
|
58
|
+
name: tool.definition.name,
|
|
59
|
+
content: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
60
|
+
isError: true,
|
|
61
|
+
...(tool.source === undefined ? {} : { source: tool.source }),
|
|
62
|
+
durationMs: Date.now() - startTime,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -49,9 +49,15 @@ export declare function resolveSecurityConfig(config: {
|
|
|
49
49
|
* 从配置中创建 ContextEngine 实例
|
|
50
50
|
*
|
|
51
51
|
* @param config - contextEngine 配置(可空)
|
|
52
|
+
* @param extension - hooks / agentId / sessionsDir(有 sessionsDir 时转换记录落
|
|
53
|
+
* `sessions/<sid>/transform/`;否则进程内账本)
|
|
52
54
|
* @returns ContextEngine
|
|
53
55
|
*/
|
|
54
|
-
export declare function resolveContextEngine(config: ContextEngineConfig | undefined
|
|
56
|
+
export declare function resolveContextEngine(config: ContextEngineConfig | undefined, extension?: {
|
|
57
|
+
hooks?: SessionAwareRunnerConfig['extensionHooks'];
|
|
58
|
+
agentId: string;
|
|
59
|
+
sessionsDir?: string;
|
|
60
|
+
}): ContextEngine;
|
|
55
61
|
/**
|
|
56
62
|
* 从配置中解析 RunGuard
|
|
57
63
|
*
|
|
@@ -72,6 +78,8 @@ export interface AgentWireSpec {
|
|
|
72
78
|
/** 已解析/已包装的主模型 provider */
|
|
73
79
|
model: ModelProvider;
|
|
74
80
|
agentId: string;
|
|
81
|
+
/** 归属租户(arch/multi-tenancy.md §4);缺省 DEFAULT_TENANT_ID,透传 audit 打标与家当派生 */
|
|
82
|
+
tenantId?: string;
|
|
75
83
|
workspace?: string;
|
|
76
84
|
/** agent 文件态持久目录(persona/skills) */
|
|
77
85
|
home?: string;
|
|
@@ -80,6 +88,8 @@ export interface AgentWireSpec {
|
|
|
80
88
|
systemPrompt?: string;
|
|
81
89
|
};
|
|
82
90
|
skillDirectory?: string;
|
|
91
|
+
/** Skill 启用清单(agents[].skills,按 skill id);缺省 = 目录内全部启用 */
|
|
92
|
+
skills?: string[];
|
|
83
93
|
/** SEC-2 / E6 工具策略与会话权利天花板 */
|
|
84
94
|
tools?: import('@octopi-agent/core/types.js').ToolPolicy;
|
|
85
95
|
maxSessionRights?: SessionAwareRunnerConfig['agentMaxSessionRights'];
|
|
@@ -95,8 +105,8 @@ export interface AgentWireSpec {
|
|
|
95
105
|
embedding?: ModelsConfig['embedding'];
|
|
96
106
|
};
|
|
97
107
|
contextEngineConfig?: ContextEngineConfig;
|
|
98
|
-
contextAssemblerConfig?: HarnessConfig['contextAssembler'];
|
|
99
|
-
constitutionConfig?: HarnessConfig['constitution'];
|
|
108
|
+
contextAssemblerConfig?: NonNullable<HarnessConfig['context']>['contextAssembler'];
|
|
109
|
+
constitutionConfig?: NonNullable<HarnessConfig['context']>['constitution'];
|
|
100
110
|
memoryConfig?: HarnessConfig['memory'];
|
|
101
111
|
cognitionConfig?: HarnessConfig['cognition'];
|
|
102
112
|
wisdomConfig?: HarnessConfig['wisdom'];
|
|
@@ -18,7 +18,9 @@ import { getOctopiHome } from '../../paths.js';
|
|
|
18
18
|
import { DefaultRunGuard, } from '../run/run-guard/default-run-guard.js';
|
|
19
19
|
import { DefaultContextEngine } from '../context/default-context-engine.js';
|
|
20
20
|
import { DefaultBudgetAllocator } from '../context/budget-allocator.js';
|
|
21
|
+
import { JsonlTransformStore } from '../session/transform-store.js';
|
|
21
22
|
import { initShellParser } from '../governance/security/shell-parser.js';
|
|
23
|
+
import { sqliteVecOption } from '../memory/sqlite/sqlite-vec.js';
|
|
22
24
|
// ── 配置解析(唯一实现;供 wire 与公开导出共用) ──
|
|
23
25
|
/**
|
|
24
26
|
* 解析子系统审计目录(docs/autonomous-subsystem.md §10)
|
|
@@ -56,20 +58,33 @@ export function resolveSecurityConfig(config) {
|
|
|
56
58
|
* 从配置中创建 ContextEngine 实例
|
|
57
59
|
*
|
|
58
60
|
* @param config - contextEngine 配置(可空)
|
|
61
|
+
* @param extension - hooks / agentId / sessionsDir(有 sessionsDir 时转换记录落
|
|
62
|
+
* `sessions/<sid>/transform/`;否则进程内账本)
|
|
59
63
|
* @returns ContextEngine
|
|
60
64
|
*/
|
|
61
|
-
export function resolveContextEngine(config) {
|
|
65
|
+
export function resolveContextEngine(config, extension) {
|
|
62
66
|
// 缺省 type = default:只给旋钮(如 proactiveCompactRatio)也必须落到默认引擎
|
|
63
67
|
if (!config || config.type == null || config.type === 'default') {
|
|
64
68
|
return new DefaultContextEngine({
|
|
65
69
|
protectFirstN: config?.protectFirstN ?? 5,
|
|
66
70
|
protectLastN: config?.protectLastN ?? 20,
|
|
71
|
+
midTurnProtectLastN: config?.midTurnProtectLastN,
|
|
67
72
|
summaryBudget: config?.summaryBudget,
|
|
68
73
|
proactiveCompactRatio: config?.proactiveCompactRatio ?? 0.6,
|
|
69
74
|
proactiveCooldownMs: config?.proactiveCooldownMs ?? 30_000,
|
|
75
|
+
summarizeTimeoutMs: config?.summarizeTimeoutMs,
|
|
70
76
|
historyAging: config?.historyAging,
|
|
71
77
|
targetTokens: config?.targetTokens,
|
|
72
78
|
compactFallbackRatio: config?.compactFallbackRatio,
|
|
79
|
+
...(extension?.sessionsDir
|
|
80
|
+
? {
|
|
81
|
+
transformStore: new JsonlTransformStore({ sessionsDir: extension.sessionsDir }),
|
|
82
|
+
}
|
|
83
|
+
: {}),
|
|
84
|
+
...(extension?.hooks === undefined ? {} : {
|
|
85
|
+
extensionHooks: extension.hooks,
|
|
86
|
+
extensionIdentity: { sessionId: 'default', agentId: extension.agentId },
|
|
87
|
+
}),
|
|
73
88
|
budgetAllocator: new DefaultBudgetAllocator({
|
|
74
89
|
outputRatio: config?.outputRatio ?? 0.20,
|
|
75
90
|
minOutputReserve: config?.minOutputReserve ?? 2000,
|
|
@@ -176,6 +191,10 @@ export async function wireAgentBuilder(builder, spec) {
|
|
|
176
191
|
const agentHome = spec.home ? expandHomePath(spec.home.trim()) : undefined;
|
|
177
192
|
// agentId 无条件接线(审计分区 / 工具域对称);home 只决定 agent 文件态目录
|
|
178
193
|
builder.agentId(spec.agentId);
|
|
194
|
+
// 归属租户透传(audit 打标 / 家当派生域);缺省不设 = 存量 DEFAULT 语义
|
|
195
|
+
if (spec.tenantId) {
|
|
196
|
+
builder.tenantId(spec.tenantId);
|
|
197
|
+
}
|
|
179
198
|
if (spec.home) {
|
|
180
199
|
builder.agentHome(spec.home);
|
|
181
200
|
}
|
|
@@ -197,7 +216,7 @@ export async function wireAgentBuilder(builder, spec) {
|
|
|
197
216
|
if (skillDir && existsSync(skillDir)) {
|
|
198
217
|
try {
|
|
199
218
|
const { DefaultSkillManager } = await import('../extension/plugin-ecosystem/skills/manager.js');
|
|
200
|
-
skillManager = new DefaultSkillManager();
|
|
219
|
+
skillManager = new DefaultSkillManager(undefined, spec.skills ? { only: spec.skills } : undefined);
|
|
201
220
|
await skillManager.discover(skillDir);
|
|
202
221
|
builder.skills(skillManager);
|
|
203
222
|
}
|
|
@@ -205,7 +224,8 @@ export async function wireAgentBuilder(builder, spec) {
|
|
|
205
224
|
console.warn(`[AgentWire] skill discover failed for ${skillDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
206
225
|
skillManager = undefined;
|
|
207
226
|
}
|
|
208
|
-
// 无 manager 时 builder
|
|
227
|
+
// 无 manager 时 builder 仍可用目录兜底(allowlist 同样生效)
|
|
228
|
+
builder.skillAllowlist(spec.skills);
|
|
209
229
|
builder.skillDirectory(skillDir);
|
|
210
230
|
}
|
|
211
231
|
// ── Memory / Wisdom / Cognition(agent home 下 AgentDatabase) ──
|
|
@@ -229,7 +249,11 @@ export async function wireAgentBuilder(builder, spec) {
|
|
|
229
249
|
wireBudget(builder, spec.budgetConfig);
|
|
230
250
|
}
|
|
231
251
|
// ── Context Engine(缺省也接线:配置面必须有唯一出口) ──
|
|
232
|
-
builder.contextEngine(resolveContextEngine(spec.contextEngineConfig
|
|
252
|
+
builder.contextEngine(resolveContextEngine(spec.contextEngineConfig, {
|
|
253
|
+
hooks: spec.extraRunnerConfig?.extensionHooks,
|
|
254
|
+
agentId: spec.agentId,
|
|
255
|
+
sessionsDir: spec.extraRunnerConfig?.sessionsDir,
|
|
256
|
+
}));
|
|
233
257
|
// ── Context Assembler / Constitution / Memory policy ──
|
|
234
258
|
if (spec.contextAssemblerConfig) {
|
|
235
259
|
builder.contextAssembler(spec.contextAssemblerConfig);
|
|
@@ -284,13 +308,13 @@ export function shouldAutoLoadSubsystems(spec) {
|
|
|
284
308
|
function wireBudget(builder, budgetConfig) {
|
|
285
309
|
const engineConfig = {
|
|
286
310
|
maxWallClockMs: budgetConfig.maxWallClockMs,
|
|
287
|
-
|
|
311
|
+
maxSteps: budgetConfig.maxSteps,
|
|
288
312
|
maxToolCalls: budgetConfig.maxToolCalls,
|
|
289
313
|
};
|
|
290
314
|
builder.budget(engineConfig);
|
|
291
315
|
const wrapUpConfig = {};
|
|
292
|
-
if ('
|
|
293
|
-
wrapUpConfig.
|
|
316
|
+
if ('wrapUpSteps' in budgetConfig && budgetConfig.wrapUpSteps !== undefined) {
|
|
317
|
+
wrapUpConfig.steps = budgetConfig.wrapUpSteps;
|
|
294
318
|
}
|
|
295
319
|
if ('onPolicyHit' in budgetConfig && budgetConfig.onPolicyHit !== undefined) {
|
|
296
320
|
wrapUpConfig.onPolicyHit = budgetConfig.onPolicyHit;
|
|
@@ -333,8 +357,8 @@ async function wireContextStores(builder, input) {
|
|
|
333
357
|
const useVec = embRuntime && embRuntime.vectorEngine !== 'js';
|
|
334
358
|
const db = await AgentDatabase.create({
|
|
335
359
|
dbPath: join(input.agentHome, 'agent.db'),
|
|
336
|
-
sqliteVec:
|
|
337
|
-
?
|
|
360
|
+
sqliteVec: embRuntime
|
|
361
|
+
? sqliteVecOption(embRuntime.vectorEngine, embRuntime.sqliteVecExtensionPath)
|
|
338
362
|
: false,
|
|
339
363
|
vectorDimensions: useVec ? embRuntime?.dimensions : undefined,
|
|
340
364
|
});
|
|
@@ -358,6 +382,8 @@ async function wireContextStores(builder, input) {
|
|
|
358
382
|
embeddingProvider: embRuntime?.provider ?? null,
|
|
359
383
|
mergeThreshold: cog?.identity?.mergeThreshold,
|
|
360
384
|
candidateBandHi: cog?.identity?.candidateBandHi,
|
|
385
|
+
semanticSeedMaxDistance: cog?.identity?.semanticSeedMaxDistance,
|
|
386
|
+
semanticSeedEmbedTimeoutMs: cog?.identity?.semanticSeedEmbedTimeoutMs,
|
|
361
387
|
stopNodes: cog?.capacity?.stopNodes,
|
|
362
388
|
stopEdges: cog?.capacity?.stopEdges,
|
|
363
389
|
causesMinIndependentMemories: cog?.relations?.causesMinIndependentMemories,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module harness/capabilities/document/backends/plain
|
|
5
5
|
*/
|
|
6
|
+
import { elidedCharsMarker } from '@octopi-agent/core/elision.js';
|
|
6
7
|
function decodeUtf8(data) {
|
|
7
8
|
return new TextDecoder('utf-8', { fatal: false }).decode(data);
|
|
8
9
|
}
|
|
@@ -33,7 +34,7 @@ export const plainTextBackend = {
|
|
|
33
34
|
const warnings = [];
|
|
34
35
|
const maxChars = options.maxTextChars && options.maxTextChars > 0 ? options.maxTextChars : 0;
|
|
35
36
|
if (maxChars > 0 && text.length > maxChars) {
|
|
36
|
-
text = `${text.slice(0, maxChars)}\n\n
|
|
37
|
+
text = `${text.slice(0, maxChars)}\n\n${elidedCharsMarker(text.length - maxChars)}`;
|
|
37
38
|
warnings.push({
|
|
38
39
|
code: 'PARTIAL_EXTRACT',
|
|
39
40
|
message: `text truncated to maxTextChars=${maxChars}`,
|
|
@@ -11,6 +11,11 @@ import type { DocumentPort } from './types.js';
|
|
|
11
11
|
export interface DocumentCapabilityConfig {
|
|
12
12
|
extract?: {
|
|
13
13
|
enabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 档位路由部署缺省(per-call extractOptions.tier 覆盖):
|
|
16
|
+
* `auto`(缺省)= t0→t1→t2 逐档降级;`t0-only` = 钉死本地抽取,不外发增强/云
|
|
17
|
+
*/
|
|
18
|
+
backend?: 'auto' | 't0-only';
|
|
14
19
|
timeoutMs?: number;
|
|
15
20
|
maxFileBytes?: number;
|
|
16
21
|
allowedRoots?: string[];
|
|
@@ -18,6 +18,7 @@ export function createDocumentPortFromConfig(cfg) {
|
|
|
18
18
|
const extract = cfg?.extract;
|
|
19
19
|
const config = {
|
|
20
20
|
enabled: extract?.enabled !== false,
|
|
21
|
+
...(extract?.backend ? { backend: extract.backend } : {}),
|
|
21
22
|
...(extract?.timeoutMs != null ? { timeoutMs: extract.timeoutMs } : {}),
|
|
22
23
|
...(extract?.maxFileBytes != null ? { maxFileBytes: extract.maxFileBytes } : {}),
|
|
23
24
|
...(extract?.allowedRoots?.length ? { allowedRoots: extract.allowedRoots } : {}),
|
|
@@ -20,6 +20,7 @@ export function createLegacyConverterFromConfig(options) {
|
|
|
20
20
|
maxInputBytes: options.maxInputBytes,
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
// remote(MinerU/WPS
|
|
24
|
-
|
|
23
|
+
// 'remote'(MinerU/WPS/云转换)为前瞻性枚举值,尚无实现——fail-loud,
|
|
24
|
+
// 禁止静默退回「不做转换」(那会让抽取悄悄降级为 T0-only)。
|
|
25
|
+
throw new Error('not_implemented: documents.legacy.converter="remote" (MinerU/WPS/cloud) — use "soffice" or "none"');
|
|
25
26
|
}
|
|
@@ -111,6 +111,8 @@ export function createDefaultDocumentPort(options = {}) {
|
|
|
111
111
|
const backends = options.backends ?? createDefaultBackends();
|
|
112
112
|
const legacy = options.legacyConverter ?? null;
|
|
113
113
|
const capsTtl = options.capabilitiesTtlMs ?? 5 * 60_000;
|
|
114
|
+
/** 部署缺省档位(documents.extract.backend):t0-only 钉死本地档;probe / hasBackendFor / extract 同判 */
|
|
115
|
+
const defaultTier = config.backend === 't0-only' ? 't0' : undefined;
|
|
114
116
|
let capsCache = null;
|
|
115
117
|
async function availableBackendIds() {
|
|
116
118
|
const ids = new Set();
|
|
@@ -230,7 +232,7 @@ export function createDefaultDocumentPort(options = {}) {
|
|
|
230
232
|
if (LEGACY_FORMATS.has(format) && format !== 'xls') {
|
|
231
233
|
return { format, level: caps.formats[format]?.level ?? 'none' };
|
|
232
234
|
}
|
|
233
|
-
const candidates = pickBackends(format, available,
|
|
235
|
+
const candidates = pickBackends(format, available, tierOrder(defaultTier));
|
|
234
236
|
const first = candidates[0];
|
|
235
237
|
return {
|
|
236
238
|
format,
|
|
@@ -296,11 +298,12 @@ export function createDefaultDocumentPort(options = {}) {
|
|
|
296
298
|
});
|
|
297
299
|
async function hasBackendFor(fmt) {
|
|
298
300
|
const { available } = await loadCapabilities();
|
|
299
|
-
return pickBackends(fmt, available,
|
|
301
|
+
return pickBackends(fmt, available, tierOrder(defaultTier)).length > 0;
|
|
300
302
|
}
|
|
301
303
|
async function runExtract(args) {
|
|
302
304
|
const { available } = await loadCapabilities();
|
|
303
|
-
|
|
305
|
+
// 档位路由:per-call tier > documents.extract.backend 部署缺省(t0-only 钉死不外发)> auto 全档
|
|
306
|
+
const tiers = tierOrder(args.extractOptions.tier ?? defaultTier);
|
|
304
307
|
const candidates = pickBackends(args.formatHint, available, tiers);
|
|
305
308
|
if (candidates.length === 0 && args.formatHint === 'unknown') {
|
|
306
309
|
throw new DocumentExtractError('UNSUPPORTED_FORMAT', 'unable to detect document format');
|
|
@@ -145,6 +145,11 @@ export interface ResolvedExtractSource {
|
|
|
145
145
|
}
|
|
146
146
|
export interface DocumentPortConfig {
|
|
147
147
|
enabled?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* 档位路由部署缺省(per-call ExtractOptions.tier 覆盖):
|
|
150
|
+
* `auto`(缺省)= t0→t1→t2 逐档降级;`t0-only` = 钉死本地抽取(内容不外发)
|
|
151
|
+
*/
|
|
152
|
+
backend?: 'auto' | 't0-only';
|
|
148
153
|
timeoutMs?: number;
|
|
149
154
|
maxFileBytes?: number;
|
|
150
155
|
/** 路径允许根;未设置则不限制(由调用方约束) */
|
|
@@ -5,6 +5,11 @@ export interface AuditQuery {
|
|
|
5
5
|
since?: number;
|
|
6
6
|
until?: number;
|
|
7
7
|
agentId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 归属租户(arch/multi-tenancy.md §4);缺省不过滤(host 管理面)。
|
|
10
|
+
* 旧布局数据缺 tenantId 视作 DEFAULT_TENANT_ID。
|
|
11
|
+
*/
|
|
12
|
+
tenantId?: string;
|
|
8
13
|
limit?: number;
|
|
9
14
|
}
|
|
10
15
|
export interface AuditReaderConfig {
|
|
@@ -14,5 +19,17 @@ export declare class AuditReader {
|
|
|
14
19
|
private auditDir;
|
|
15
20
|
constructor(config: AuditReaderConfig);
|
|
16
21
|
query(filter?: AuditQuery): SubsystemRun[];
|
|
22
|
+
/**
|
|
23
|
+
* 检索目录解析:**双布局兼容**(MAJ-6,2026-11-13 评审)。
|
|
24
|
+
*
|
|
25
|
+
* - 新布局(三段式):`{tenantId}/[{agentId}/]{subsystemId}/`——writer 恒按记录租户分区;
|
|
26
|
+
* - legacy(旧两段):`[{agentId}/]{subsystemId}/`(升级前数据,租户视作 DEFAULT)。
|
|
27
|
+
*
|
|
28
|
+
* 叶子分类按段数 + 各解释逐一匹配查询(2 段同时尝试 (tenant,subsystem) 与
|
|
29
|
+
* (agent,subsystem) 两种解释,任一命中即收)。不做模糊 includes 匹配——租户名
|
|
30
|
+
* 与 agent 名可重合,位置语义才是准的。
|
|
31
|
+
*/
|
|
17
32
|
private getSearchDirs;
|
|
33
|
+
/** 叶子路径段对查询的双解释匹配(见 getSearchDirs) */
|
|
34
|
+
private partsMatch;
|
|
18
35
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { readFileSync, existsSync, readdirSync
|
|
1
|
+
import { readFileSync, existsSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { DEFAULT_TENANT_ID } from '@octopi-agent/core/types.js';
|
|
3
4
|
export class AuditReader {
|
|
4
5
|
auditDir;
|
|
5
6
|
constructor(config) {
|
|
@@ -7,7 +8,7 @@ export class AuditReader {
|
|
|
7
8
|
}
|
|
8
9
|
query(filter) {
|
|
9
10
|
const results = [];
|
|
10
|
-
const searchDirs = this.getSearchDirs(filter?.agentId, filter?.subsystemId);
|
|
11
|
+
const searchDirs = this.getSearchDirs(filter?.tenantId, filter?.agentId, filter?.subsystemId);
|
|
11
12
|
for (const dir of searchDirs) {
|
|
12
13
|
if (!existsSync(dir))
|
|
13
14
|
continue;
|
|
@@ -20,6 +21,9 @@ export class AuditReader {
|
|
|
20
21
|
for (const line of lines) {
|
|
21
22
|
try {
|
|
22
23
|
const run = JSON.parse(line);
|
|
24
|
+
// 旧布局记录缺 tenantId 视作 DEFAULT(读端统一补齐查询语义)
|
|
25
|
+
if (filter?.tenantId && (run.tenantId ?? DEFAULT_TENANT_ID) !== filter.tenantId)
|
|
26
|
+
continue;
|
|
23
27
|
if (filter?.status && run.status !== filter.status)
|
|
24
28
|
continue;
|
|
25
29
|
if (filter?.since && run.timestamp < filter.since)
|
|
@@ -42,42 +46,68 @@ export class AuditReader {
|
|
|
42
46
|
}
|
|
43
47
|
return results;
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
dirs.push(directDir);
|
|
49
|
+
/**
|
|
50
|
+
* 检索目录解析:**双布局兼容**(MAJ-6,2026-11-13 评审)。
|
|
51
|
+
*
|
|
52
|
+
* - 新布局(三段式):`{tenantId}/[{agentId}/]{subsystemId}/`——writer 恒按记录租户分区;
|
|
53
|
+
* - legacy(旧两段):`[{agentId}/]{subsystemId}/`(升级前数据,租户视作 DEFAULT)。
|
|
54
|
+
*
|
|
55
|
+
* 叶子分类按段数 + 各解释逐一匹配查询(2 段同时尝试 (tenant,subsystem) 与
|
|
56
|
+
* (agent,subsystem) 两种解释,任一命中即收)。不做模糊 includes 匹配——租户名
|
|
57
|
+
* 与 agent 名可重合,位置语义才是准的。
|
|
58
|
+
*/
|
|
59
|
+
getSearchDirs(tenantId, agentId, subsystemId) {
|
|
60
|
+
const out = [];
|
|
61
|
+
const walk = (dir, parts) => {
|
|
62
|
+
if (!existsSync(dir))
|
|
63
|
+
return;
|
|
64
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
65
|
+
const hasJsonl = entries.some((e) => e.isFile() && e.name.endsWith('.jsonl'));
|
|
66
|
+
if (hasJsonl && this.partsMatch(parts, tenantId, agentId, subsystemId)) {
|
|
67
|
+
out.push(dir);
|
|
65
68
|
}
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
dirs.push(subDir);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
69
|
+
if (parts.length >= 3)
|
|
70
|
+
return;
|
|
71
|
+
for (const e of entries) {
|
|
72
|
+
if (e.isDirectory())
|
|
73
|
+
walk(join(dir, e.name), [...parts, e.name]);
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
};
|
|
76
|
+
walk(this.auditDir, []);
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
/** 叶子路径段对查询的双解释匹配(见 getSearchDirs) */
|
|
80
|
+
partsMatch(parts, tenantId, agentId, subsystemId) {
|
|
81
|
+
if (parts.length === 3) {
|
|
82
|
+
const [t, a, sub] = parts;
|
|
83
|
+
return matches(tenantId, t) && matches(agentId, a) && matches(subsystemId, sub);
|
|
84
|
+
}
|
|
85
|
+
if (parts.length === 2) {
|
|
86
|
+
const [x, sub] = parts;
|
|
87
|
+
// 解释 A:新布局无 agentId 段(tenant, subsystem);解释 B:legacy(agent, subsystem,
|
|
88
|
+
// 租户维视作 DEFAULT——不是「不存在」)
|
|
89
|
+
const asTenantSub = matches(tenantId, x) && matches(agentId, undefined) && matches(subsystemId, sub);
|
|
90
|
+
const asLegacy = matches(tenantId, DEFAULT_TENANT_ID) && matches(agentId, x) && matches(subsystemId, sub);
|
|
91
|
+
return asTenantSub || asLegacy;
|
|
76
92
|
}
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
if (parts.length === 1) {
|
|
94
|
+
// legacy:仅 subsystem 段(租户维视作 DEFAULT,无 agent 维)
|
|
95
|
+
return (matches(tenantId, DEFAULT_TENANT_ID) &&
|
|
96
|
+
matches(agentId, undefined) &&
|
|
97
|
+
matches(subsystemId, parts[0]));
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
82
100
|
}
|
|
83
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* 查询值与路径段匹配:查询缺省(undefined)= 不限;段缺省(布局无该维)= 仅当查询未限该维才命中。
|
|
104
|
+
* legacy 布局的租户维按 DEFAULT 传入(视作 default,非缺维)。
|
|
105
|
+
*
|
|
106
|
+
* @param want - 查询值
|
|
107
|
+
* @param have - 路径段(undefined=该维度不存在)
|
|
108
|
+
*/
|
|
109
|
+
function matches(want, have) {
|
|
110
|
+
if (want === undefined)
|
|
111
|
+
return true;
|
|
112
|
+
return have === want;
|
|
113
|
+
}
|
|
@@ -10,8 +10,10 @@ import type { SubsystemRun } from '../types.js';
|
|
|
10
10
|
export interface AuditWriterConfig {
|
|
11
11
|
/** 审计根目录(默认 ~/.octopi/audit) */
|
|
12
12
|
auditDir: string;
|
|
13
|
-
/** Agent ID
|
|
13
|
+
/** Agent ID(分区) */
|
|
14
14
|
agentId?: string;
|
|
15
|
+
/** 归属租户(arch/multi-tenancy.md §4:每条审计事件带租户);分区 + 记录代打 */
|
|
16
|
+
tenantId?: string;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* AuditWriter — 审计写入器
|
|
@@ -22,6 +24,7 @@ export interface AuditWriterConfig {
|
|
|
22
24
|
export declare class AuditWriter {
|
|
23
25
|
private auditDir;
|
|
24
26
|
private agentId?;
|
|
27
|
+
private tenantId?;
|
|
25
28
|
constructor(config: AuditWriterConfig);
|
|
26
29
|
/**
|
|
27
30
|
* 写入审计记录
|
|
@@ -30,7 +33,8 @@ export declare class AuditWriter {
|
|
|
30
33
|
*/
|
|
31
34
|
write(run: SubsystemRun): void;
|
|
32
35
|
/**
|
|
33
|
-
*
|
|
36
|
+
* 获取审计文件路径(三段式:{auditDir}/{tenantId}/[{agentId}/]{subsystemId}/{date}.jsonl)。
|
|
37
|
+
* 分区段 = 记录的生效租户(与记录恒一致)。
|
|
34
38
|
*/
|
|
35
39
|
private getFilePath;
|
|
36
40
|
}
|