@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,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry types — 租户与定义面实体模型(arch/multi-tenancy.md §3)。
|
|
3
|
+
*
|
|
4
|
+
* 所有权锚 = tenantId(隔离/审计/转移的钥匙);ownerUserId = 管理归属;
|
|
5
|
+
* visibility 决定租户内可见性。「一用户一租户」是策略默认,不是 schema 约束。
|
|
6
|
+
*/
|
|
7
|
+
import type { Branded } from '../../knowledge/types.js';
|
|
8
|
+
export type TenantId = Branded<string, 'TenantId'>;
|
|
9
|
+
export type UserId = Branded<string, 'UserId'>;
|
|
10
|
+
export type AgentId = Branded<string, 'AgentId'>;
|
|
11
|
+
export type BindingId = Branded<string, 'BindingId'>;
|
|
12
|
+
export type MountId = Branded<string, 'MountId'>;
|
|
13
|
+
export type KnowledgeSourceId = Branded<string, 'KnowledgeSourceId'>;
|
|
14
|
+
export type AuthToken = Branded<string, 'AuthToken'>;
|
|
15
|
+
/** agent 在租户内的可见性:private=仅 owner;tenant=租户共享 */
|
|
16
|
+
export type AgentVisibility = 'private' | 'tenant';
|
|
17
|
+
/** 渠道会话策略:per-user 常驻 / per-chat 群会话 / per-message 单发 */
|
|
18
|
+
export type SessionPolicy = 'per-user' | 'per-chat' | 'per-message';
|
|
19
|
+
/** 挂载消费方:agent / project / session */
|
|
20
|
+
export type MountConsumerType = 'agent' | 'project' | 'session';
|
|
21
|
+
/** 挂载资产类型:knowledge 知识库 / project 项目 */
|
|
22
|
+
export type MountSourceType = 'knowledge' | 'project';
|
|
23
|
+
/** 资产所有权:platform 公共(跨租户共享唯一合法形态)/ tenant 私有 */
|
|
24
|
+
export type SourceScope = 'platform' | 'tenant';
|
|
25
|
+
export interface Tenant {
|
|
26
|
+
tenantId: TenantId;
|
|
27
|
+
name: string;
|
|
28
|
+
createdAt: number;
|
|
29
|
+
}
|
|
30
|
+
export interface User {
|
|
31
|
+
userId: UserId;
|
|
32
|
+
tenantId: TenantId;
|
|
33
|
+
name: string;
|
|
34
|
+
/** 平台 admin(Q13:首个注册用户;管理 platform 公共资产) */
|
|
35
|
+
isPlatformAdmin: boolean;
|
|
36
|
+
createdAt: number;
|
|
37
|
+
}
|
|
38
|
+
export interface AgentRecord {
|
|
39
|
+
agentId: AgentId;
|
|
40
|
+
tenantId: TenantId;
|
|
41
|
+
ownerUserId: UserId;
|
|
42
|
+
visibility: AgentVisibility;
|
|
43
|
+
name: string;
|
|
44
|
+
/** 定义权威在此(config/persona/skills 引用);机器上 agents/<id>/ 是物化态 */
|
|
45
|
+
definition: string;
|
|
46
|
+
homeRef: string | null;
|
|
47
|
+
createdAt: number;
|
|
48
|
+
updatedAt: number;
|
|
49
|
+
}
|
|
50
|
+
export interface Binding {
|
|
51
|
+
bindingId: BindingId;
|
|
52
|
+
tenantId: TenantId;
|
|
53
|
+
platform: string;
|
|
54
|
+
identity: string;
|
|
55
|
+
agentId: AgentId;
|
|
56
|
+
sessionPolicy: SessionPolicy;
|
|
57
|
+
createdAt: number;
|
|
58
|
+
}
|
|
59
|
+
export interface Mount {
|
|
60
|
+
mountId: MountId;
|
|
61
|
+
tenantId: TenantId;
|
|
62
|
+
consumerType: MountConsumerType;
|
|
63
|
+
consumerId: string;
|
|
64
|
+
sourceType: MountSourceType;
|
|
65
|
+
sourceId: KnowledgeSourceId | string;
|
|
66
|
+
/** session 挂载的反物化锚(消费会话所属 agent);agent/project 挂载为 null */
|
|
67
|
+
agentRef: string | null;
|
|
68
|
+
createdAt: number;
|
|
69
|
+
}
|
|
70
|
+
export interface KnowledgeSource {
|
|
71
|
+
sourceId: KnowledgeSourceId;
|
|
72
|
+
scope: SourceScope;
|
|
73
|
+
/** platform 库为 null */
|
|
74
|
+
tenantId: TenantId | null;
|
|
75
|
+
name: string;
|
|
76
|
+
createdAt: number;
|
|
77
|
+
}
|
|
@@ -138,8 +138,7 @@ export class CapabilityEnforcer {
|
|
|
138
138
|
case '*':
|
|
139
139
|
return { allowed: true };
|
|
140
140
|
case 'allowed-list':
|
|
141
|
-
|
|
142
|
-
return { allowed: true };
|
|
141
|
+
return { allowed: false, reason: `Plugin "${pluginId}" network allow-list is not implemented for host "${host}"` };
|
|
143
142
|
case 'none':
|
|
144
143
|
return { allowed: false, reason: `Plugin "${pluginId}" has no network access` };
|
|
145
144
|
default:
|
|
@@ -56,6 +56,9 @@ export declare class DefaultSecurityGuard {
|
|
|
56
56
|
checkModelOutput(output: string): SecurityCheckResult;
|
|
57
57
|
/**
|
|
58
58
|
* 检查工具输出(注入检测,始终开启)
|
|
59
|
+
*
|
|
60
|
+
* 默认档命中的处置是「标记放行」(severity medium → warn,调用方附不可信资料标记后放行),
|
|
61
|
+
* 不是销毁内容;只有 `injectionSensitivity: 'high'` 严格档升级为拦截。
|
|
59
62
|
*/
|
|
60
63
|
checkToolOutput(output: string): SecurityCheckResult;
|
|
61
64
|
/**
|
|
@@ -282,6 +282,9 @@ export class DefaultSecurityGuard {
|
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
* 检查工具输出(注入检测,始终开启)
|
|
285
|
+
*
|
|
286
|
+
* 默认档命中的处置是「标记放行」(severity medium → warn,调用方附不可信资料标记后放行),
|
|
287
|
+
* 不是销毁内容;只有 `injectionSensitivity: 'high'` 严格档升级为拦截。
|
|
285
288
|
*/
|
|
286
289
|
checkToolOutput(output) {
|
|
287
290
|
return this.checkInjection(output, 'tool_output');
|
|
@@ -566,7 +569,15 @@ export class DefaultSecurityGuard {
|
|
|
566
569
|
if (match) {
|
|
567
570
|
violations.push({
|
|
568
571
|
type: 'injection',
|
|
569
|
-
|
|
572
|
+
// 注入命中的处置分通道:工具输出是「资料」——出现攻击形态文本 ≠ 攻击已生效,
|
|
573
|
+
// 默认档标记放行(medium→warn),内容不销毁(否则一切讨论注入的安全文档、
|
|
574
|
+
// 宪法、本守卫源码自身都被整份误杀);用户输入不适用「资料」语义,维持
|
|
575
|
+
// high(→confirm)。injectionSensitivity: 'high' 是严格档,两通道一律拦截。
|
|
576
|
+
severity: this.config.injectionSensitivity === 'high'
|
|
577
|
+
? 'critical'
|
|
578
|
+
: source === 'tool_output'
|
|
579
|
+
? 'medium'
|
|
580
|
+
: 'high',
|
|
570
581
|
description: `检测到可能的 prompt injection: "${match[0].substring(0, 50)}..."`,
|
|
571
582
|
range: { start: match.index, end: match.index + match[0].length },
|
|
572
583
|
});
|
|
@@ -55,10 +55,20 @@ export declare function isProtectedPath(path: string, cwd?: string): boolean;
|
|
|
55
55
|
*/
|
|
56
56
|
export declare function detectCatastrophicRecursiveDelete(command: string, cwd?: string): string | null;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* 硬边界:下载并执行(下载内容真实流入解释器)
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* 数据流判定(非共存判定),三条规则:
|
|
61
|
+
* 1. **管道链**:同一条 `|` 链上下载源在解释器上游 → 拦
|
|
62
|
+
* (`curl | sh`、`curl | /bin/bash`、`curl | env bash`、`curl | tee x | bash`)
|
|
63
|
+
* 2. **文件交接**:下载落盘(`curl -o f` / `curl -O` / `wget` 默认落盘 / `wget -O f` /
|
|
64
|
+
* `> f` 重定向 / 链下游 `tee f`)且同一命令串在下载之后执行同一文件(`bash f` /
|
|
65
|
+
* `python f` / `./f` / `source f` / `sh -c "./f"`)→ 拦(`curl -o s.sh … && bash s.sh`)
|
|
66
|
+
* 3. **嵌入注入**:下载源出现在解释器的内联载荷(`sh -c "$(curl …)"`)或进程替换
|
|
67
|
+
* (`bash <(curl …)`)里——下载文本直接进入解释器代码位 → 拦
|
|
68
|
+
*
|
|
69
|
+
* 仅共存不算数据流:`curl -o data.csv … && python analyze.py`、
|
|
70
|
+
* `bash build.sh && curl …`(解释器与下载无交接或顺序相反)不命中。
|
|
71
|
+
* 仅下载(`curl -o file` 无执行)或普通管道(`cat | grep`)不命中。
|
|
62
72
|
*/
|
|
63
73
|
export declare function detectDownloadToInterpreter(command: string): string | null;
|
|
64
74
|
/**
|
|
@@ -776,34 +776,320 @@ const INTERPRETER_BASES = new Set([
|
|
|
776
776
|
/** 下载源命令 basename */
|
|
777
777
|
const DOWNLOAD_BASES = new Set(['curl', 'wget', 'http', 'https']);
|
|
778
778
|
/** 解释器前的合法 wrapper(不改变 RCE 语义) */
|
|
779
|
-
const EXEC_WRAPPER_BASES = new Set(['sudo', 'env', 'nice', 'nohup', 'exec', 'xargs', 'time']);
|
|
779
|
+
const EXEC_WRAPPER_BASES = new Set(['sudo', 'env', 'nice', 'nohup', 'exec', 'xargs', 'time', 'timeout']);
|
|
780
780
|
/**
|
|
781
|
-
*
|
|
781
|
+
* 硬边界:下载并执行(下载内容真实流入解释器)
|
|
782
782
|
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
783
|
+
* 数据流判定(非共存判定),三条规则:
|
|
784
|
+
* 1. **管道链**:同一条 `|` 链上下载源在解释器上游 → 拦
|
|
785
|
+
* (`curl | sh`、`curl | /bin/bash`、`curl | env bash`、`curl | tee x | bash`)
|
|
786
|
+
* 2. **文件交接**:下载落盘(`curl -o f` / `curl -O` / `wget` 默认落盘 / `wget -O f` /
|
|
787
|
+
* `> f` 重定向 / 链下游 `tee f`)且同一命令串在下载之后执行同一文件(`bash f` /
|
|
788
|
+
* `python f` / `./f` / `source f` / `sh -c "./f"`)→ 拦(`curl -o s.sh … && bash s.sh`)
|
|
789
|
+
* 3. **嵌入注入**:下载源出现在解释器的内联载荷(`sh -c "$(curl …)"`)或进程替换
|
|
790
|
+
* (`bash <(curl …)`)里——下载文本直接进入解释器代码位 → 拦
|
|
791
|
+
*
|
|
792
|
+
* 仅共存不算数据流:`curl -o data.csv … && python analyze.py`、
|
|
793
|
+
* `bash build.sh && curl …`(解释器与下载无交接或顺序相反)不命中。
|
|
794
|
+
* 仅下载(`curl -o file` 无执行)或普通管道(`cat | grep`)不命中。
|
|
785
795
|
*/
|
|
786
796
|
export function detectDownloadToInterpreter(command) {
|
|
787
797
|
const parsed = parseShellCommand(command);
|
|
788
|
-
if (!parsed.parsed || parsed.segments.length
|
|
798
|
+
if (!parsed.parsed || parsed.segments.length === 0)
|
|
799
|
+
return null;
|
|
800
|
+
const keys = parsed.segments.map((s) => resolveExecCommand(s).key);
|
|
801
|
+
// 单段命令无管道/交接形态,但内联载荷注入仍可能(`sh -c "curl x | sh"`)
|
|
802
|
+
const viaFlow = parsed.segments.length >= 2
|
|
803
|
+
? detectDownloadPipeToInterpreter(parsed, keys) ?? detectDownloadFileHandoff(parsed)
|
|
804
|
+
: null;
|
|
805
|
+
return viaFlow ?? detectDownloadEmbeddedInjection(parsed);
|
|
806
|
+
}
|
|
807
|
+
/** 已知命令词(wrapper 剥离时优先认出真实命令,越过带值选项的值) */
|
|
808
|
+
const KNOWN_EXEC_BASES = new Set([...INTERPRETER_BASES, ...DOWNLOAD_BASES, 'tee', 'source', '.']);
|
|
809
|
+
/**
|
|
810
|
+
* 段的有效命令:剥 wrapper(sudo/env/nice/nohup/exec/xargs/time/timeout)。
|
|
811
|
+
* wrapper 后先找已知命令词(`sudo -u bob bash s.sh` 的 `bob` 是 -u 的值,不是命令),
|
|
812
|
+
* 找不到再退第一个非选项/非赋值/非纯数字参数。
|
|
813
|
+
*/
|
|
814
|
+
function resolveExecCommand(seg) {
|
|
815
|
+
const key = cmdKey(seg.command);
|
|
816
|
+
if (!EXEC_WRAPPER_BASES.has(key))
|
|
817
|
+
return { key, args: seg.args, cmdArg: seg.command };
|
|
818
|
+
const knownIdx = seg.args.findIndex((a) => !a.includes('=') && KNOWN_EXEC_BASES.has(cmdKey(a)));
|
|
819
|
+
const nextIdx = knownIdx >= 0
|
|
820
|
+
? knownIdx
|
|
821
|
+
: seg.args.findIndex((a) => !a.startsWith('-') && !a.includes('=') && !/^\d+$/.test(a));
|
|
822
|
+
if (nextIdx < 0)
|
|
823
|
+
return { key, args: seg.args, cmdArg: seg.command };
|
|
824
|
+
return {
|
|
825
|
+
key: cmdKey(seg.args[nextIdx]),
|
|
826
|
+
args: seg.args.slice(nextIdx + 1),
|
|
827
|
+
cmdArg: seg.args[nextIdx],
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
/** 规则 1:同管道链(连接符全为 `|` 的极大段组)内下载源在解释器上游 */
|
|
831
|
+
function detectDownloadPipeToInterpreter(parsed, keys) {
|
|
832
|
+
let start = 0;
|
|
833
|
+
for (let i = 0; i < parsed.segments.length; i++) {
|
|
834
|
+
const continues = i + 1 < parsed.segments.length && (parsed.connectors[i] ?? ';') === '|';
|
|
835
|
+
if (continues)
|
|
836
|
+
continue;
|
|
837
|
+
const dlIdx = keys.slice(start, i + 1).findIndex((k) => DOWNLOAD_BASES.has(k));
|
|
838
|
+
if (dlIdx >= 0) {
|
|
839
|
+
for (let j = start + dlIdx + 1; j <= i; j++) {
|
|
840
|
+
if (INTERPRETER_BASES.has(keys[j])) {
|
|
841
|
+
return 'download pipe to interpreter (remote code execution)';
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
start = i + 1;
|
|
846
|
+
}
|
|
847
|
+
return null;
|
|
848
|
+
}
|
|
849
|
+
/** URL basename(去 query/hash),`curl -O` 落盘名 */
|
|
850
|
+
function urlBasename(url) {
|
|
851
|
+
const path = url.replace(/[?#].*$/, '');
|
|
852
|
+
const base = path.split('/').pop() ?? '';
|
|
853
|
+
return base && base !== '/' ? base : null;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* 同一文件判定:归一路径相等(大小写敏感)。
|
|
857
|
+
* 不做 basename 合并——跨目录/跨大小写是不同文件(`…/a/run.sh` 与 `…/b/run.sh`、
|
|
858
|
+
* `S.sh` 与 `s.sh` 在大小写敏感文件系统上不相交)。
|
|
859
|
+
*/
|
|
860
|
+
function sameHandoffFile(a, b) {
|
|
861
|
+
return normalizeHandoffPath(a) === normalizeHandoffPath(b);
|
|
862
|
+
}
|
|
863
|
+
/** 归一路径(统一斜杠、剥 `./` 前缀;大小写保留) */
|
|
864
|
+
function normalizeHandoffPath(p) {
|
|
865
|
+
return p.replace(/\\/g, '/').replace(/^\.\//, '');
|
|
866
|
+
}
|
|
867
|
+
/** 直接执行脚本形态:`./s.sh` / `s.sh` / `/path/s.sh` */
|
|
868
|
+
function isScriptPath(cmd) {
|
|
869
|
+
return cmd.startsWith('./') || /\.(sh|bash|zsh|ksh|py|js|rb|pl|php|ps1|cmd|bat)$/i.test(cmd);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* 规则 2:下载落盘文件(name = 落盘名;afterIdx = 落盘段索引,执行须在其后)。
|
|
873
|
+
* 选项解析覆盖短选项簇(`-sSLo f` / `-qO f` / `-of` 粘连值)与长选项别名
|
|
874
|
+
* (`--remote-name` / `--output=…`);wget 无输出选项时默认按 URL basename 落盘,
|
|
875
|
+
* wget 的 `-o` 是日志文件不算落盘,curl 的 `-O` 是无值选项(落盘名 = URL basename)。
|
|
876
|
+
*/
|
|
877
|
+
function collectDownloadDrops(parsed) {
|
|
878
|
+
const drops = [];
|
|
879
|
+
for (let i = 0; i < parsed.segments.length; i++) {
|
|
880
|
+
const seg = parsed.segments[i];
|
|
881
|
+
const { key, args } = resolveExecCommand(seg);
|
|
882
|
+
if (!DOWNLOAD_BASES.has(key))
|
|
883
|
+
continue;
|
|
884
|
+
let outFileFlag = false; // 显式指定内容落盘文件(抑制 wget 默认落盘)
|
|
885
|
+
let remoteName = false; // curl -O / --remote-name:落盘名 = URL basename
|
|
886
|
+
let httpDownload = false; // httpie --download
|
|
887
|
+
for (let j = 0; j < args.length; j++) {
|
|
888
|
+
const a = args[j];
|
|
889
|
+
if (a === '--output' || a === '--output-document') {
|
|
890
|
+
const target = args[j + 1];
|
|
891
|
+
// `-O -` 是写 stdout,不落盘
|
|
892
|
+
if (target && target !== '-' && !target.startsWith('-')) {
|
|
893
|
+
drops.push({ name: target, afterIdx: i });
|
|
894
|
+
outFileFlag = true;
|
|
895
|
+
}
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
const eq = /^--output(?:-document)?=(.+)$/i.exec(a);
|
|
899
|
+
if (eq) {
|
|
900
|
+
if (eq[1] !== '-')
|
|
901
|
+
drops.push({ name: eq[1], afterIdx: i });
|
|
902
|
+
outFileFlag = true;
|
|
903
|
+
continue;
|
|
904
|
+
}
|
|
905
|
+
if (a === '--remote-name') {
|
|
906
|
+
remoteName = true;
|
|
907
|
+
continue;
|
|
908
|
+
}
|
|
909
|
+
if (a === '--download') {
|
|
910
|
+
httpDownload = true;
|
|
911
|
+
continue;
|
|
912
|
+
}
|
|
913
|
+
if (a.startsWith('--') || !a.startsWith('-') || a.length < 2 || a.includes('='))
|
|
914
|
+
continue;
|
|
915
|
+
// 短选项簇:`-sSLo f`(O 后取值)/ `-os.sh`(粘连值)/ `-OJ`(O 无值,J 另一选项)
|
|
916
|
+
for (let k = 1; k < a.length; k++) {
|
|
917
|
+
const c = a[k];
|
|
918
|
+
if (key === 'wget') {
|
|
919
|
+
if (c === 'O') {
|
|
920
|
+
// wget -O = 内容落盘文件(值可粘连/下一参数;`-O -` 写 stdout)
|
|
921
|
+
const value = a.slice(k + 1) || args[j + 1];
|
|
922
|
+
if (a.slice(k + 1))
|
|
923
|
+
k = a.length;
|
|
924
|
+
else
|
|
925
|
+
j += 1;
|
|
926
|
+
if (value && value !== '-' && !value.startsWith('-'))
|
|
927
|
+
drops.push({ name: value, afterIdx: i });
|
|
928
|
+
outFileFlag = true;
|
|
929
|
+
}
|
|
930
|
+
else if (c === 'o') {
|
|
931
|
+
// wget -o = 日志文件(不记内容落盘;消耗其值防止被误认)
|
|
932
|
+
if (a.slice(k + 1))
|
|
933
|
+
k = a.length;
|
|
934
|
+
else
|
|
935
|
+
j += 1;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
else if (c === 'o') {
|
|
939
|
+
// curl/httpie -o = 内容落盘文件
|
|
940
|
+
const value = a.slice(k + 1) || args[j + 1];
|
|
941
|
+
if (a.slice(k + 1))
|
|
942
|
+
k = a.length;
|
|
943
|
+
else
|
|
944
|
+
j += 1;
|
|
945
|
+
if (value && value !== '-' && !value.startsWith('-'))
|
|
946
|
+
drops.push({ name: value, afterIdx: i });
|
|
947
|
+
outFileFlag = true;
|
|
948
|
+
}
|
|
949
|
+
else if (c === 'O') {
|
|
950
|
+
// curl -O = 无值选项,落盘名 = URL basename(下方统一记,多 -O 全记)
|
|
951
|
+
remoteName = true;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
// URL basename 落盘:curl -O/--remote-name(段内全部 URL);httpie --download;
|
|
956
|
+
// wget 无输出选项时默认落盘(裸 `wget URL` 就是下载执行最常见写法)
|
|
957
|
+
const wantsUrlBasename = remoteName || httpDownload || (key === 'wget' && !outFileFlag);
|
|
958
|
+
if (wantsUrlBasename) {
|
|
959
|
+
for (const u of args) {
|
|
960
|
+
if (/^https?:\/\//i.test(u)) {
|
|
961
|
+
const base = urlBasename(u);
|
|
962
|
+
if (base)
|
|
963
|
+
drops.push({ name: base, afterIdx: i });
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
// 重定向落盘(`> f` / `>> f`)
|
|
968
|
+
for (const r of seg.redirects) {
|
|
969
|
+
if (r.type !== 'input')
|
|
970
|
+
drops.push({ name: r.target, afterIdx: i });
|
|
971
|
+
}
|
|
972
|
+
// 管道链下游 `tee f`:下载内容经 tee 落盘(`curl … | tee f | grep x && bash f`)
|
|
973
|
+
for (let j = i + 1; j < parsed.segments.length && (parsed.connectors[j - 1] ?? '|') === '|'; j++) {
|
|
974
|
+
const tee = resolveExecCommand(parsed.segments[j]);
|
|
975
|
+
if (tee.key === 'tee') {
|
|
976
|
+
for (const f of tee.args) {
|
|
977
|
+
if (!f.startsWith('-'))
|
|
978
|
+
drops.push({ name: f, afterIdx: j });
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return drops;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* 规则 2:脚本执行段。候选是解释器的**全部**非选项参数(带值选项的值多收,保守向:
|
|
987
|
+
* `bash -O extglob ./s.sh` 不漏 `./s.sh`);内联载荷(`sh -c "…"`)若是纯脚本路径
|
|
988
|
+
* (`sh -c "./s.sh"`、`cmd /c s.bat`)也算文件执行;`python -m mod` 是模块文件
|
|
989
|
+
* 执行(候选含 `mod` 与 `mod.py`);内联多词载荷不是文件执行(嵌入注入走规则 3)。
|
|
990
|
+
*/
|
|
991
|
+
function collectScriptExecs(parsed) {
|
|
992
|
+
const execs = [];
|
|
993
|
+
for (let i = 0; i < parsed.segments.length; i++) {
|
|
994
|
+
const seg = parsed.segments[i];
|
|
995
|
+
const { key, args, cmdArg } = resolveExecCommand(seg);
|
|
996
|
+
if (key === 'source' || key === '.') {
|
|
997
|
+
const target = args[0];
|
|
998
|
+
if (target && !target.startsWith('-'))
|
|
999
|
+
execs.push({ name: target, idx: i });
|
|
1000
|
+
continue;
|
|
1001
|
+
}
|
|
1002
|
+
if (INTERPRETER_BASES.has(key)) {
|
|
1003
|
+
const inlineFlags = INTERPRETER_INLINE_FLAGS[key] ?? [];
|
|
1004
|
+
const firstArgIdx = args.findIndex((a) => !a.startsWith('-') && !a.includes('='));
|
|
1005
|
+
const preArgs = args.slice(0, firstArgIdx < 0 ? args.length : firstArgIdx);
|
|
1006
|
+
const inlineIdx = preArgs.findIndex((a) => inlineFlags.includes(a.toLowerCase()));
|
|
1007
|
+
if (inlineIdx >= 0) {
|
|
1008
|
+
const payload = args.slice(inlineIdx + 1).join(' ').trim();
|
|
1009
|
+
if (payload && (isScriptPath(payload) || payload.startsWith('./'))) {
|
|
1010
|
+
execs.push({ name: payload, idx: i });
|
|
1011
|
+
}
|
|
1012
|
+
continue;
|
|
1013
|
+
}
|
|
1014
|
+
for (const a of args) {
|
|
1015
|
+
if (!a.startsWith('-') && !a.includes('=') && !/^\d+$/.test(a)) {
|
|
1016
|
+
execs.push({ name: a, idx: i });
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
// `python -m mod` 模块执行:模块主文件是 `mod.py`
|
|
1020
|
+
for (let j = 0; j < args.length - 1; j++) {
|
|
1021
|
+
if (args[j].toLowerCase() === '-m') {
|
|
1022
|
+
execs.push({ name: `${args[j + 1]}.py`, idx: i });
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
// stdin 交接(`bash < s.sh`):输入重定向的文件也是执行对象
|
|
1026
|
+
for (const r of seg.redirects) {
|
|
1027
|
+
if (r.type === 'input')
|
|
1028
|
+
execs.push({ name: r.target, idx: i });
|
|
1029
|
+
}
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
if (isScriptPath(cmdArg)) {
|
|
1033
|
+
execs.push({ name: cmdArg, idx: i });
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
return execs;
|
|
1037
|
+
}
|
|
1038
|
+
/** 规则 2:下载落盘文件在下载之后被同一命令串执行 */
|
|
1039
|
+
function detectDownloadFileHandoff(parsed) {
|
|
1040
|
+
const drops = collectDownloadDrops(parsed);
|
|
1041
|
+
if (drops.length === 0)
|
|
1042
|
+
return null;
|
|
1043
|
+
for (const e of collectScriptExecs(parsed)) {
|
|
1044
|
+
for (const d of drops) {
|
|
1045
|
+
if (e.idx > d.afterIdx && sameHandoffFile(e.name, d.name)) {
|
|
1046
|
+
return 'downloaded file executed (remote code execution)';
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
/** 文本中出现下载源命令(词边界,防 `mycurl` 之类误报) */
|
|
1053
|
+
function hasDownloadSource(text) {
|
|
1054
|
+
return /(^|[\s|;&($<])((sudo|env|nice|nohup|exec|timeout)\s+)*(curl|wget|http|https)\b/i.test(text);
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* 规则 3:下载源进入解释器代码位——内联载荷(`sh -c "$(curl …)"`)或进程替换
|
|
1058
|
+
* (`bash <(curl …)`)里的下载文本直接成为解释器的代码/输入文件。
|
|
1059
|
+
* 内联载荷内的 shell 文本另递归跑规则 1/2(`bash -c "curl x | sh"`)。
|
|
1060
|
+
*/
|
|
1061
|
+
function detectDownloadEmbeddedInjection(parsed) {
|
|
1062
|
+
const hasDownload = parsed.segments.some((s) => DOWNLOAD_BASES.has(resolveExecCommand(s).key) || hasDownloadSource(s.raw));
|
|
1063
|
+
if (!hasDownload)
|
|
789
1064
|
return null;
|
|
790
|
-
let hasDownload = false;
|
|
791
|
-
let hasInterpreter = false;
|
|
792
1065
|
for (const seg of parsed.segments) {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
1066
|
+
const { key, args } = resolveExecCommand(seg);
|
|
1067
|
+
if (!INTERPRETER_BASES.has(key) && key !== 'source' && key !== '.')
|
|
1068
|
+
continue;
|
|
1069
|
+
const inlineFlags = INTERPRETER_INLINE_FLAGS[key] ?? [];
|
|
1070
|
+
const firstArgIdx = args.findIndex((a) => !a.startsWith('-') && !a.includes('='));
|
|
1071
|
+
const preArgs = args.slice(0, firstArgIdx < 0 ? args.length : firstArgIdx);
|
|
1072
|
+
const inlineIdx = preArgs.findIndex((a) => inlineFlags.includes(a.toLowerCase()));
|
|
1073
|
+
if (inlineIdx >= 0) {
|
|
1074
|
+
const payload = args.slice(inlineIdx + 1).join(' ').trim();
|
|
1075
|
+
if (!payload)
|
|
1076
|
+
continue;
|
|
1077
|
+
// 载荷是 shell 文本:内层 `curl x | sh` 走规则 1/2 递归
|
|
1078
|
+
const inner = detectDownloadToInterpreter(payload);
|
|
1079
|
+
if (inner)
|
|
1080
|
+
return inner;
|
|
1081
|
+
// 命令替换/进程替换把下载文本拼进代码位(`sh -c "$(curl x)"`)
|
|
1082
|
+
if (/\$\(|<\(|>\(/.test(payload) && hasDownloadSource(payload)) {
|
|
1083
|
+
return 'download injected into interpreter payload (remote code execution)';
|
|
1084
|
+
}
|
|
1085
|
+
continue;
|
|
1086
|
+
}
|
|
1087
|
+
// 进程替换参数(`bash <(curl …)`):下载文本成为解释器的输入文件
|
|
1088
|
+
for (const a of args) {
|
|
1089
|
+
if (/[<>]\(/.test(a) && hasDownloadSource(a)) {
|
|
1090
|
+
return 'download injected into interpreter process substitution (remote code execution)';
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
807
1093
|
}
|
|
808
1094
|
return null;
|
|
809
1095
|
}
|
|
@@ -130,7 +130,7 @@ function extract(node, ctx, spanNode) {
|
|
|
130
130
|
if (child.type === 'file_redirect') {
|
|
131
131
|
const redirect = mapFileRedirect(child);
|
|
132
132
|
if (redirect)
|
|
133
|
-
redirects.push(redirect);
|
|
133
|
+
redirects.push({ redirect, start: child.startIndex });
|
|
134
134
|
// 重定向目标里的命令替换仍会执行
|
|
135
135
|
extract(child, ctx, null);
|
|
136
136
|
}
|
|
@@ -149,12 +149,20 @@ function extract(node, ctx, spanNode) {
|
|
|
149
149
|
extract(body, ctx, node);
|
|
150
150
|
if (redirects.length > 0) {
|
|
151
151
|
if (ctx.segments.length > before) {
|
|
152
|
-
//
|
|
153
|
-
|
|
152
|
+
// 整句重定向按源位置归属:作用于其之前最近(end 最大)的命令段——
|
|
153
|
+
// `A && B < f` 归 B、`A < f && B` 归 A(tree-sitter 把链式重定向解析为
|
|
154
|
+
// 整句包装,源位置是唯一的作用域线索;嵌套命令替换段 end 更早,自然落选)
|
|
155
|
+
for (const entry of redirects) {
|
|
156
|
+
const candidates = ctx.segments.filter((s) => s.end <= entry.start);
|
|
157
|
+
const owner = candidates.length
|
|
158
|
+
? candidates.reduce((a, b) => (a.end >= b.end ? a : b))
|
|
159
|
+
: ctx.segments[before];
|
|
160
|
+
owner.seg.redirects.push(entry.redirect);
|
|
161
|
+
}
|
|
154
162
|
}
|
|
155
163
|
else {
|
|
156
164
|
// 句内无命令(`> file` 单独成句):目标仍可能是写入,不可丢
|
|
157
|
-
ctx.orphans.push(...redirects);
|
|
165
|
+
ctx.orphans.push(...redirects.map((entry) => entry.redirect));
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
return;
|
|
@@ -78,4 +78,5 @@ export declare function isToolAllowedByRights(toolName: string, capabilities: re
|
|
|
78
78
|
export declare function isToolPermitted(toolName: string, capabilities: readonly string[] | null | undefined, layers: Array<ToolRights | {
|
|
79
79
|
allow?: string[];
|
|
80
80
|
deny?: string[];
|
|
81
|
+
denyCapabilities?: string[];
|
|
81
82
|
} | undefined>): boolean;
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -31,14 +31,9 @@ export type { DefaultContextEngineConfig } from './context/default-context-engin
|
|
|
31
31
|
export { HeuristicTokenEstimator, estimateTextTokens, estimateLLMMessages } from './context/index.js';
|
|
32
32
|
export { JSON_CHARS_PER_TOKEN, TOOL_RESULT_CHARS_PER_TOKEN, CHARS_PER_TOKEN, } from './context/index.js';
|
|
33
33
|
export { DefaultMessageSelector } from './context/message-selector.js';
|
|
34
|
-
export { TruncateCompressor } from './context/truncate-compressor.js';
|
|
35
|
-
export { LLMSummaryCompressor } from './context/llm-summarizer.js';
|
|
36
|
-
export { HybridCompressor } from './context/hybrid-compressor.js';
|
|
37
34
|
export { DefaultBudgetAllocator } from './context/budget-allocator.js';
|
|
38
|
-
export { SmartRouter } from './context/smart-router.js';
|
|
39
|
-
export type { SmartRouterConfig, Route, RoutingDecision } from './context/smart-router.js';
|
|
40
35
|
export { LAYER_ORDER, LAYER_PRIORITY, LAYER_DEFAULT_SHARE, extractLayerQuery, hasLayerText, DefaultContextAssembler, truncateTextToTokens, ALL_LAYER_IDS, buildContextLayersSnapshot, deriveLayerStatus, emptyContextLayersSnapshot, probeContextLayerHealth, probeAgentHomeHealth, PersonaLayer, SkillLayer, RuntimeLayer, KnowledgeLayer, MemoryLayer, CognitionLayer, WisdomLayer, createDefaultLayers, createProviderSummarize, pickSummarizeProvider, createDefaultSystemPromptAssembler, } from './context/index.js';
|
|
41
|
-
export type { ContextLayerId, LayerAssembleContext, LayerContent, ContextLayer, LayerManifestEntry, AssembleManifest, SystemAssembleResult, ContextAssembler, ContextAssembleParams, DefaultContextAssemblerConfig, CreateDefaultLayersOptions, CreateProviderSummarizeOptions, SystemPromptAssembleInput, SystemPromptAssembleOutput, ContextLayersSnapshot, LayerRuntimeView, LayerUiStatus, ContextLayerHealth, ContextLayerHealthEntry, ProbeContextHealthDeps, ContextCompactReason, ContextCompactEvent, ContextEmitFn, ContextCompactSnapshot, } from './context/index.js';
|
|
36
|
+
export type { ContextLayerId, LayerAssembleContext, LayerContent, ContextLayer, LayerManifestEntry, AssembleManifest, SystemAssembleResult, ContextAssembler, ContextAssembleParams, DefaultContextAssemblerConfig, CreateDefaultLayersOptions, CreateProviderSummarizeOptions, SystemPromptAssembleInput, SystemPromptAssembleOutput, ContextLayersSnapshot, LayerRuntimeView, LayerUiStatus, ContextLayerHealth, ContextLayerHealthEntry, ProbeContextHealthDeps, ContextCompactReason, ContextCompactEvent, ContextEmitFn, ContextSizeSnapshot, ContextCompactSnapshot, } from './context/index.js';
|
|
42
37
|
export { CapabilityEnforcer, PluginTrustLevel } from './governance/security/capability-enforcer.js';
|
|
43
38
|
export { runAgentWithReliability, DEFAULT_RELIABILITY_CONFIG } from './run/reliability/index.js';
|
|
44
39
|
export type { ReliabilityConfig, ConcreteReliabilityHarness } from './run/reliability/index.js';
|
|
@@ -48,16 +43,17 @@ export { CircuitBreaker } from './run/reliability/circuit-breaker.js';
|
|
|
48
43
|
export { wrapProviderWithCircuitBreaker } from './run/reliability/provider-wrapper.js';
|
|
49
44
|
export { FallbackProvider } from './run/reliability/fallback-provider.js';
|
|
50
45
|
export { guardRefusalProvider } from './run/reliability/refusal-guard.js';
|
|
51
|
-
export { detectSummaryContamination } from './context/capabilities/compact/engine.js';
|
|
46
|
+
export { detectSummaryContamination, inspectSummaryOutput, evaluateEcho, } from './context/capabilities/compact/engine.js';
|
|
47
|
+
export type { ContaminationResult, EchoVerdict } from './context/capabilities/compact/engine.js';
|
|
52
48
|
export { PluginManager } from './extension/plugin-ecosystem/plugins/manager.js';
|
|
53
|
-
export {
|
|
54
|
-
export type { OctopiPluginDefinition
|
|
49
|
+
export { definePlugin } from './extension/plugin-ecosystem/plugins/entry.js';
|
|
50
|
+
export type { OctopiPluginDefinition } from './extension/plugin-ecosystem/plugins/entry.js';
|
|
55
51
|
export { PluginApi } from './extension/plugin-ecosystem/plugins/api.js';
|
|
56
52
|
export { PluginLoader } from './extension/plugin-ecosystem/plugins/loader.js';
|
|
57
|
-
export type { LoadedPlugin, PluginLoaderConfig, PluginEntryConfig } from './extension/plugin-ecosystem/plugins/loader.js';
|
|
58
|
-
export {
|
|
59
|
-
export { validateManifest, parseManifest } from './extension/plugin-ecosystem/plugins/manifest.js';
|
|
60
|
-
export type { PluginManifest,
|
|
53
|
+
export type { LoadedPlugin, PluginLoaderConfig, PluginEntryConfig, PluginDiagnostic } from './extension/plugin-ecosystem/plugins/loader.js';
|
|
54
|
+
export { PluginContributionRegistry } from './extension/plugin-ecosystem/plugins/contribution-registry.js';
|
|
55
|
+
export { validateManifest, parseManifest, validatePluginConfig, PLUGIN_API_VERSION } from './extension/plugin-ecosystem/plugins/manifest.js';
|
|
56
|
+
export type { PluginManifest, PluginContributions, PluginHookName, PluginSessionOpName } from './extension/plugin-ecosystem/plugins/manifest.js';
|
|
61
57
|
export { DefaultToolBus } from './extension/plugin-ecosystem/tools/tool-bus.js';
|
|
62
58
|
export { getBuiltinTools, createShellTool, createFileReadTool, createFileWriteTool, createFileDeleteTool, createFileListTool } from './extension/plugin-ecosystem/tools/builtin.js';
|
|
63
59
|
export { readGitStatusSnapshot, parsePorcelainV2 } from './extension/plugin-ecosystem/tools/git-status-snapshot.js';
|
|
@@ -110,7 +106,8 @@ export { createEmbeddingProviderFromModels, resolveEmbeddingRuntime, isEmbedding
|
|
|
110
106
|
export type { MemoryType, MemoryEntry, MemoryQuery, MemoryStats, MemoryStore } from './memory/types.js';
|
|
111
107
|
export type { WisdomEntry, WisdomStore, WisdomStatus, WisdomOrigin, WisdomKind, WisdomScenario, WisdomEffect, WisdomDerivation, WisdomOutcomes, AdmitWisdomInput, AdmitWisdomResult, WisdomInjectQuery, WisdomInjectPick, WisdomStats, } from './memory/types.js';
|
|
112
108
|
export type { ConceptKind, ConceptRelationType, ConceptStatus, EvidenceClass, EdgeBasis, ConceptNode, ConceptEdge, ConceptGraph, MergeCandidate, AdmitConceptInput, AdmitConceptResult, AdmitEdgeInput, AdmitEdgeResult, ConceptGateReason, SpreadingActivateOptions, ActivatedGraph, ConceptGraphStats, DecayResult, ConceptGraphStore, } from './memory/types.js';
|
|
113
|
-
export { evaluateConceptGate, licenseEdge, conceptualizeAndAdmit, parseConceptualizerJson, DEFAULT_EDGE_DECAY_PER_DAY, hebbianStrengthen, nextEdgeStrength, } from './memory/index.js';
|
|
109
|
+
export { evaluateConceptGate, licenseEdge, conceptualizeAndAdmit, parseConceptualizerJson, DEFAULT_EDGE_DECAY_PER_DAY, hebbianStrengthen, nextEdgeStrength, normName, deriveQuerySeeds, createSeedMatcher, } from './memory/index.js';
|
|
110
|
+
export type { DeriveQuerySeedsOptions, SeedMatcher } from './memory/index.js';
|
|
114
111
|
export type { Planner, Reflector, AgentState, AgentStats, Plan, PlanStep, StepResult, ExecutionRecord, Assessment, Pattern, } from './collaboration/orchestration/cognitive-loop.js';
|
|
115
112
|
export type { SessionData, SessionLifecycleMeta, SessionLifecycleStatus, MemoryExtractionStatus } from './session/types.js';
|
|
116
113
|
export { SessionAwareRunner } from './run/runner.js';
|
|
@@ -125,10 +122,15 @@ export type { SessionSwitchRecord } from './session/types.js';
|
|
|
125
122
|
export type { RunAuditRecord } from './activation/types.js';
|
|
126
123
|
export { readSessionCompact, writeSessionCompact } from './session/compact.js';
|
|
127
124
|
export { compactStateKey } from './context/compact-key.js';
|
|
125
|
+
export { JsonlTransformStore, InMemoryTransformStore, resolveSessionTransformPaths, copySessionTransformDir, removeSessionTransformDir, scanOrphanSessionTransform, } from './session/transform-store.js';
|
|
126
|
+
export { foldTransformView } from './context/transform/fold.js';
|
|
127
|
+
export { anchorFor, anchorRange, resolveAnchor, resolveRun, canonicalMessageHash } from './context/transform/anchors.js';
|
|
128
|
+
export { legacySnapshotToRecords } from './context/transform/migrate.js';
|
|
129
|
+
export type { TransformRecord, TransformRun, TransformLedger, TransformStore, NewTransformRecord, MessageAnchor, TransformRecordType, TransformPlaceholder, TransformRecordMeta, } from './context/transform/types.js';
|
|
128
130
|
export { agentLoop, callModel, classifyError } from '@octopi-agent/core/loop/index.js';
|
|
129
131
|
export type { AgentContext, AgentTool, LoopToolResult, AgentLoopConfig, AgentLoopEvent, LoopObserver, ClassifiedError as LoopClassifiedError } from '@octopi-agent/core/loop/index.js';
|
|
130
132
|
export { Agent } from './run/agent/index.js';
|
|
131
|
-
export type { AgentOptions } from './run/agent/index.js';
|
|
133
|
+
export type { AgentOptions, RunIdentity } from './run/agent/index.js';
|
|
132
134
|
export { withRunScope, getRunScope, getRunSessionId, createRunId } from './run/run-scope.js';
|
|
133
135
|
export type { RunScope, RunToolRuntime } from './run/run-scope.js';
|
|
134
136
|
export { ObserverHub } from './observability/observer/hub.js';
|