@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,78 @@
|
|
|
1
|
+
/** Host-level effective contribution registry; per-Agent buses are mount projections. */
|
|
2
|
+
import type { PluginManifest } from './manifest.js';
|
|
3
|
+
import type { HookServiceRegistration } from '../hooks/types.js';
|
|
4
|
+
export interface PluginServiceRecord extends HookServiceRegistration {
|
|
5
|
+
pluginId: string;
|
|
6
|
+
}
|
|
7
|
+
import type { PluginApi, PluginProviderFactory, PluginChannelFactory } from './api.js';
|
|
8
|
+
import type { PluginCommandRegistration, PluginToolContribution, OrderedHookEntry } from './api.js';
|
|
9
|
+
export interface RegisteredPlugin {
|
|
10
|
+
manifest: PluginManifest;
|
|
11
|
+
definition: {
|
|
12
|
+
id: string;
|
|
13
|
+
register(api: PluginApi): void | Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
api: PluginApi;
|
|
16
|
+
path: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginToolRecord extends PluginToolContribution {
|
|
19
|
+
pluginId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PluginCommandRecord extends PluginCommandRegistration {
|
|
22
|
+
pluginId: string;
|
|
23
|
+
}
|
|
24
|
+
/** A published provider factory contribution; globally unique id, like services. */
|
|
25
|
+
export interface PluginProviderRecord {
|
|
26
|
+
pluginId: string;
|
|
27
|
+
id: string;
|
|
28
|
+
factory: PluginProviderFactory;
|
|
29
|
+
/**
|
|
30
|
+
* Host-private instance-registration hook (see contribution-kinds
|
|
31
|
+
* `bindInstances`). Hosts MUST call it with the accepted factory product —
|
|
32
|
+
* after contract validation, before any Host-side decorator wraps it — so
|
|
33
|
+
* the instance registry's notion of "live" matches what the Host routes to.
|
|
34
|
+
*/
|
|
35
|
+
acceptInstance?(instance: object, label: string): boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A published channel factory contribution; globally unique id, like providers. */
|
|
38
|
+
export interface PluginChannelRecord {
|
|
39
|
+
pluginId: string;
|
|
40
|
+
id: string;
|
|
41
|
+
factory: PluginChannelFactory;
|
|
42
|
+
/** Host-private instance-registration hook; see PluginProviderRecord.acceptInstance. */
|
|
43
|
+
acceptInstance?(instance: object, label: string): boolean;
|
|
44
|
+
}
|
|
45
|
+
/** An immutable published contribution set. Mutations are staged by PluginLoader. */
|
|
46
|
+
export declare class PluginContributionRegistry {
|
|
47
|
+
private plugins;
|
|
48
|
+
private records;
|
|
49
|
+
private owners;
|
|
50
|
+
/** Replace the effective set only after all staged registrations validate. */
|
|
51
|
+
publish(plugins: readonly RegisteredPlugin[]): void;
|
|
52
|
+
/** Clear the effective set before a fresh discovery attempt. */
|
|
53
|
+
clear(): void;
|
|
54
|
+
private addOwner;
|
|
55
|
+
getPlugins(): RegisteredPlugin[];
|
|
56
|
+
getPlugin(id: string): RegisteredPlugin | undefined;
|
|
57
|
+
getTools(): PluginToolRecord[];
|
|
58
|
+
getCommands(): PluginCommandRecord[];
|
|
59
|
+
getHooks(): OrderedHookEntry[];
|
|
60
|
+
getServices(): PluginServiceRecord[];
|
|
61
|
+
getProviders(): PluginProviderRecord[];
|
|
62
|
+
getChannels(): PluginChannelRecord[];
|
|
63
|
+
/**
|
|
64
|
+
* Roll back an accepted-but-never-installed instance across all plugin
|
|
65
|
+
* instance tables (see ContributionInstanceTable.discardByInstance).
|
|
66
|
+
*
|
|
67
|
+
* @param instance - The instance the Host validated but never routed to
|
|
68
|
+
*/
|
|
69
|
+
discardInstance(instance: object): void;
|
|
70
|
+
/**
|
|
71
|
+
* Logical retirement by instance identity across all plugin instance tables
|
|
72
|
+
* (see ContributionInstanceTable.retireByInstance) — called when the Host
|
|
73
|
+
* stops routing to an instance.
|
|
74
|
+
*
|
|
75
|
+
* @param instance - The instance the Host stopped routing to
|
|
76
|
+
*/
|
|
77
|
+
retireInstance(instance: object): void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** Host-level effective contribution registry; per-Agent buses are mount projections. */
|
|
2
|
+
import { CONTRIBUTION_KINDS } from './contribution-kinds.js';
|
|
3
|
+
import { readInstanceTable } from './contribution-instances.js';
|
|
4
|
+
import { readStaging } from './staging.js';
|
|
5
|
+
function emptySink() {
|
|
6
|
+
return { tools: [], commands: [], hooks: [], services: [], providers: [], channels: [] };
|
|
7
|
+
}
|
|
8
|
+
/** An immutable published contribution set. Mutations are staged by PluginLoader. */
|
|
9
|
+
export class PluginContributionRegistry {
|
|
10
|
+
plugins = new Map();
|
|
11
|
+
records = emptySink();
|
|
12
|
+
owners = new Map();
|
|
13
|
+
/** Replace the effective set only after all staged registrations validate. */
|
|
14
|
+
publish(plugins) {
|
|
15
|
+
const next = new PluginContributionRegistry();
|
|
16
|
+
for (const plugin of plugins) {
|
|
17
|
+
next.plugins.set(plugin.manifest.id, plugin);
|
|
18
|
+
const staged = readStaging(plugin.api);
|
|
19
|
+
for (const kind of CONTRIBUTION_KINDS) {
|
|
20
|
+
kind.forEachStaged(staged, (key, entry) => {
|
|
21
|
+
if (kind.globallyUnique)
|
|
22
|
+
next.addOwner(kind.label, key, plugin.manifest.id);
|
|
23
|
+
const bound = kind.bindInstances?.(entry, readInstanceTable(plugin.api)) ?? entry;
|
|
24
|
+
if (kind.bindInstances !== undefined && typeof bound.acceptInstance !== 'function') {
|
|
25
|
+
throw new Error(`contribution kind "${kind.label}" is factory-backed but bindInstances did not wire acceptInstance`);
|
|
26
|
+
}
|
|
27
|
+
kind.collect(next.records, plugin.manifest.id, bound);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const replyOwners = next.records.hooks.filter((entry) => entry.hookName === 'before_agent_reply');
|
|
32
|
+
if (replyOwners.length > 1) {
|
|
33
|
+
throw new Error(`Override hook before_agent_reply has multiple owners: ${replyOwners.map((entry) => entry.pluginId).join(', ')}`);
|
|
34
|
+
}
|
|
35
|
+
this.plugins = next.plugins;
|
|
36
|
+
this.records = next.records;
|
|
37
|
+
this.owners = next.owners;
|
|
38
|
+
}
|
|
39
|
+
/** Clear the effective set before a fresh discovery attempt. */
|
|
40
|
+
clear() {
|
|
41
|
+
this.publish([]);
|
|
42
|
+
}
|
|
43
|
+
addOwner(type, id, pluginId) {
|
|
44
|
+
const key = `${type}:${id}`;
|
|
45
|
+
const owner = this.owners.get(key);
|
|
46
|
+
if (owner !== undefined) {
|
|
47
|
+
throw new Error(`Contribution conflict ${key}: "${owner}" and "${pluginId}"`);
|
|
48
|
+
}
|
|
49
|
+
this.owners.set(key, pluginId);
|
|
50
|
+
}
|
|
51
|
+
getPlugins() { return [...this.plugins.values()]; }
|
|
52
|
+
getPlugin(id) { return this.plugins.get(id); }
|
|
53
|
+
getTools() { return [...this.records.tools]; }
|
|
54
|
+
getCommands() { return [...this.records.commands]; }
|
|
55
|
+
getHooks() { return [...this.records.hooks]; }
|
|
56
|
+
getServices() { return [...this.records.services]; }
|
|
57
|
+
getProviders() { return [...this.records.providers]; }
|
|
58
|
+
getChannels() { return [...this.records.channels]; }
|
|
59
|
+
/**
|
|
60
|
+
* Roll back an accepted-but-never-installed instance across all plugin
|
|
61
|
+
* instance tables (see ContributionInstanceTable.discardByInstance).
|
|
62
|
+
*
|
|
63
|
+
* @param instance - The instance the Host validated but never routed to
|
|
64
|
+
*/
|
|
65
|
+
discardInstance(instance) {
|
|
66
|
+
for (const plugin of this.plugins.values())
|
|
67
|
+
readInstanceTable(plugin.api).discardByInstance(instance);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Logical retirement by instance identity across all plugin instance tables
|
|
71
|
+
* (see ContributionInstanceTable.retireByInstance) — called when the Host
|
|
72
|
+
* stops routing to an instance.
|
|
73
|
+
*
|
|
74
|
+
* @param instance - The instance the Host stopped routing to
|
|
75
|
+
*/
|
|
76
|
+
retireInstance(instance) {
|
|
77
|
+
for (const plugin of this.plugins.values())
|
|
78
|
+
readInstanceTable(plugin.api).retireByInstance(instance);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Read the installed engine package version through its public package export. */
|
|
2
|
+
export declare function getEngineVersion(): string;
|
|
3
|
+
/** Return whether the installed engine satisfies a manifest's semver range. */
|
|
4
|
+
export declare function satisfiesEngineRange(version: string, range: string): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import semver from 'semver';
|
|
3
|
+
let cachedVersion;
|
|
4
|
+
/** Read the installed engine package version through its public package export. */
|
|
5
|
+
export function getEngineVersion() {
|
|
6
|
+
if (cachedVersion === undefined) {
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const metadata = require('@octopi-agent/engine/package.json');
|
|
9
|
+
cachedVersion = metadata.version;
|
|
10
|
+
}
|
|
11
|
+
return cachedVersion;
|
|
12
|
+
}
|
|
13
|
+
/** Return whether the installed engine satisfies a manifest's semver range. */
|
|
14
|
+
export function satisfiesEngineRange(version, range) {
|
|
15
|
+
if (!semver.valid(version) || !semver.validRange(range))
|
|
16
|
+
return false;
|
|
17
|
+
return semver.satisfies(version, range);
|
|
18
|
+
}
|
|
@@ -1,93 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin Entry
|
|
3
|
-
*
|
|
4
|
-
* definePluginEntry 是创建 plugin 的标准方式。
|
|
5
|
-
* 它定义了 plugin 的 id、name、register 回调等。
|
|
6
|
-
*/
|
|
1
|
+
/** Plugin entry contract. Installation metadata lives in octopi.plugin.json. */
|
|
7
2
|
import type { PluginApi } from './api.js';
|
|
8
|
-
/**
|
|
9
|
-
* Plugin 定义
|
|
10
|
-
*
|
|
11
|
-
* 这是 plugin 的完整定义。每个 plugin 必须导出一个 default export,
|
|
12
|
-
* 使用 definePluginEntry() 创建。
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* export default definePluginEntry({
|
|
17
|
-
* id: 'my-plugin',
|
|
18
|
-
* name: 'My Plugin',
|
|
19
|
-
* description: 'Adds custom capabilities',
|
|
20
|
-
* register(api) {
|
|
21
|
-
* api.on('before_tool_call', async (event) => {
|
|
22
|
-
* // hook logic
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* api.registerTool(
|
|
26
|
-
* { name: 'my_tool', description: '...', parameters: {} },
|
|
27
|
-
* async (args, ctx) => { return 'result'; },
|
|
28
|
-
* );
|
|
29
|
-
* },
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
3
|
export interface OctopiPluginDefinition {
|
|
34
|
-
/**
|
|
4
|
+
/** Must match the manifest identity. */
|
|
35
5
|
id: string;
|
|
36
|
-
/**
|
|
37
|
-
name: string;
|
|
38
|
-
/** Plugin 描述 */
|
|
39
|
-
description?: string;
|
|
40
|
-
/** Plugin 版本 */
|
|
41
|
-
version?: string;
|
|
42
|
-
/**
|
|
43
|
-
* 注册回调
|
|
44
|
-
*
|
|
45
|
-
* 框架在加载 plugin 时调用此方法,传入 PluginApi 对象。
|
|
46
|
-
* Plugin 通过 api 对象注册各种能力。
|
|
47
|
-
*
|
|
48
|
-
* @param api - Plugin API 对象
|
|
49
|
-
*/
|
|
6
|
+
/** Declaration-only registration; external resources start at a host lifecycle point. */
|
|
50
7
|
register(api: PluginApi): void | Promise<void>;
|
|
51
8
|
}
|
|
52
9
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* 这是创建 plugin 的标准方式。
|
|
56
|
-
*
|
|
57
|
-
* @param definition - Plugin 定义
|
|
58
|
-
* @returns Plugin 定义对象
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```ts
|
|
62
|
-
* // index.ts
|
|
63
|
-
* import { definePluginEntry } from '@octopi-agent/engine/plugin-sdk/plugin-entry';
|
|
64
|
-
*
|
|
65
|
-
* export default definePluginEntry({
|
|
66
|
-
* id: 'tool-preflight',
|
|
67
|
-
* name: 'Tool Preflight',
|
|
68
|
-
* register(api) {
|
|
69
|
-
* api.on('before_tool_call', async (event) => {
|
|
70
|
-
* if (event.toolName !== 'web_search') return;
|
|
71
|
-
* return { requireApproval: { title: 'Run web search' } };
|
|
72
|
-
* }, { priority: 50 });
|
|
73
|
-
* },
|
|
74
|
-
* });
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function definePluginEntry(definition: OctopiPluginDefinition): OctopiPluginDefinition;
|
|
78
|
-
/**
|
|
79
|
-
* Channel Plugin 定义
|
|
80
|
-
*
|
|
81
|
-
* 用于 channel 类型的 plugin。
|
|
82
|
-
*/
|
|
83
|
-
export interface OctopiChannelPluginDefinition extends OctopiPluginDefinition {
|
|
84
|
-
/** Channel ID */
|
|
85
|
-
channelId: string;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* 定义一个 Channel Plugin Entry
|
|
10
|
+
* Define a v1 plugin entry without duplicating its manifest.
|
|
89
11
|
*
|
|
90
|
-
* @param definition -
|
|
91
|
-
* @returns
|
|
12
|
+
* @param definition - Entry identity and registration function
|
|
13
|
+
* @returns The validated definition
|
|
92
14
|
*/
|
|
93
|
-
export declare function
|
|
15
|
+
export declare function definePlugin(definition: OctopiPluginDefinition): OctopiPluginDefinition;
|
|
@@ -1,58 +1,16 @@
|
|
|
1
|
+
/** Plugin entry contract. Installation metadata lives in octopi.plugin.json. */
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Define a v1 plugin entry without duplicating its manifest.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* @param definition - Entry identity and registration function
|
|
6
|
+
* @returns The validated definition
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* 这是创建 plugin 的标准方式。
|
|
11
|
-
*
|
|
12
|
-
* @param definition - Plugin 定义
|
|
13
|
-
* @returns Plugin 定义对象
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* // index.ts
|
|
18
|
-
* import { definePluginEntry } from '@octopi-agent/engine/plugin-sdk/plugin-entry';
|
|
19
|
-
*
|
|
20
|
-
* export default definePluginEntry({
|
|
21
|
-
* id: 'tool-preflight',
|
|
22
|
-
* name: 'Tool Preflight',
|
|
23
|
-
* register(api) {
|
|
24
|
-
* api.on('before_tool_call', async (event) => {
|
|
25
|
-
* if (event.toolName !== 'web_search') return;
|
|
26
|
-
* return { requireApproval: { title: 'Run web search' } };
|
|
27
|
-
* }, { priority: 50 });
|
|
28
|
-
* },
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export function definePluginEntry(definition) {
|
|
33
|
-
// 验证必填字段
|
|
34
|
-
if (!definition.id || typeof definition.id !== 'string') {
|
|
35
|
-
throw new Error('definePluginEntry: "id" is required and must be a string');
|
|
36
|
-
}
|
|
37
|
-
if (!definition.name || typeof definition.name !== 'string') {
|
|
38
|
-
throw new Error('definePluginEntry: "name" is required and must be a string');
|
|
8
|
+
export function definePlugin(definition) {
|
|
9
|
+
if (typeof definition.id !== 'string' || definition.id.length === 0) {
|
|
10
|
+
throw new Error('definePlugin: "id" is required and must be a string');
|
|
39
11
|
}
|
|
40
12
|
if (typeof definition.register !== 'function') {
|
|
41
|
-
throw new Error(`
|
|
42
|
-
}
|
|
43
|
-
return definition;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 定义一个 Channel Plugin Entry
|
|
47
|
-
*
|
|
48
|
-
* @param definition - Channel Plugin 定义
|
|
49
|
-
* @returns Plugin 定义对象
|
|
50
|
-
*/
|
|
51
|
-
export function defineChannelPluginEntry(definition) {
|
|
52
|
-
if (!definition.channelId) {
|
|
53
|
-
throw new Error(`defineChannelPluginEntry: "channelId" is required (plugin: ${definition.id})`);
|
|
13
|
+
throw new Error(`definePlugin: "register" must be a function (plugin: ${definition.id})`);
|
|
54
14
|
}
|
|
55
|
-
// 基础验证
|
|
56
|
-
definePluginEntry(definition);
|
|
57
15
|
return definition;
|
|
58
16
|
}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* 核心概念:
|
|
5
|
-
* - Plugin = 能力的所有权边界(Provider/Channel/Tool/Hook 等)
|
|
6
|
-
* - definePluginEntry() = 创建 plugin 的标准方式
|
|
7
|
-
* - PluginApi = plugin register() 回调中接收的 api 对象
|
|
8
|
-
* - PluginManifest = 声明式元数据(octopi.plugin.json)
|
|
9
|
-
* - PluginLoader = 发现和加载 plugins
|
|
10
|
-
* - PluginManager = 管理 plugin 生命周期和 hook 执行
|
|
11
|
-
* - CapabilityRegistry = 能力注册中心
|
|
12
|
-
*/
|
|
13
|
-
export { definePluginEntry, defineChannelPluginEntry } from './entry.js';
|
|
14
|
-
export type { OctopiPluginDefinition, OctopiChannelPluginDefinition } from './entry.js';
|
|
1
|
+
/** Plugin author contract. Host loading and mounting live under ./harness/. */
|
|
2
|
+
export { definePlugin } from './entry.js';
|
|
3
|
+
export type { OctopiPluginDefinition } from './entry.js';
|
|
15
4
|
export { PluginApi } from './api.js';
|
|
16
|
-
export type { PluginLogger, HookRegistrationOptions, ToolRegistrationOptions,
|
|
17
|
-
export { validateManifest, parseManifest } from './manifest.js';
|
|
18
|
-
export type { PluginManifest,
|
|
19
|
-
export { CapabilityRegistry, registerManifestCapabilities } from './capability.js';
|
|
20
|
-
export type { CapabilityType, CapabilityRecord } from './capability.js';
|
|
21
|
-
export { PluginLoader } from './loader.js';
|
|
22
|
-
export type { LoadedPlugin, PluginLoaderConfig, PluginEntryConfig } from './loader.js';
|
|
23
|
-
export { PluginManager } from './manager.js';
|
|
24
|
-
export type { BeforeModelResolveEvent, AgentTurnPrepareEvent, BeforePromptBuildEvent, BeforeAgentRunEvent, BeforeAgentReplyEvent, BeforeAgentFinalizeEvent, AgentEndEvent, BeforeToolCallEvent, AfterToolCallEvent, MessageReceivedEvent, MessageSendingEvent, MessageSentEvent, SessionLifecycleEvent, CompactionEvent, GatewayLifecycleEvent, BeforeInstallEvent, ModelResolveResult, PromptBuildResult, AgentRunResult, AgentReplyResult, AgentFinalizeResult, ToolCallResult, MessageSendingResult, InstallResult, } from './manager.js';
|
|
5
|
+
export type { PluginLogger, PluginCommandRegistration, PluginCommandContext, PluginHookMap, HookHandler, HookRegistrationOptions, ToolRegistrationOptions, PluginProviderFactory, PluginProviderFactoryContext, PluginProviderModelEntry, PluginProviderRegistration, PluginChannelFactory, PluginChannelFactoryContext, PluginChannelRegistration, PluginChannelAdapterLike, ContributionInstanceKind, } from './api.js';
|
|
6
|
+
export { PLUGIN_API_VERSION, PLUGIN_HOOK_NAMES, validateManifest, parseManifest, validatePluginConfig, } from './manifest.js';
|
|
7
|
+
export type { PluginManifest, PluginContributions, PluginCommandContribution, PluginHookName, PluginSessionOpName, JsonSchema, } from './manifest.js';
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* 核心概念:
|
|
5
|
-
* - Plugin = 能力的所有权边界(Provider/Channel/Tool/Hook 等)
|
|
6
|
-
* - definePluginEntry() = 创建 plugin 的标准方式
|
|
7
|
-
* - PluginApi = plugin register() 回调中接收的 api 对象
|
|
8
|
-
* - PluginManifest = 声明式元数据(octopi.plugin.json)
|
|
9
|
-
* - PluginLoader = 发现和加载 plugins
|
|
10
|
-
* - PluginManager = 管理 plugin 生命周期和 hook 执行
|
|
11
|
-
* - CapabilityRegistry = 能力注册中心
|
|
12
|
-
*/
|
|
13
|
-
// ── 定义和创建 ──
|
|
14
|
-
export { definePluginEntry, defineChannelPluginEntry } from './entry.js';
|
|
15
|
-
// ── Plugin API ──
|
|
1
|
+
/** Plugin author contract. Host loading and mounting live under ./harness/. */
|
|
2
|
+
export { definePlugin } from './entry.js';
|
|
16
3
|
export { PluginApi } from './api.js';
|
|
17
|
-
|
|
18
|
-
export { validateManifest, parseManifest } from './manifest.js';
|
|
19
|
-
// ── Capability Registry ──
|
|
20
|
-
export { CapabilityRegistry, registerManifestCapabilities } from './capability.js';
|
|
21
|
-
// ── Plugin Loader ──
|
|
22
|
-
export { PluginLoader } from './loader.js';
|
|
23
|
-
// ── Plugin Manager ──
|
|
24
|
-
export { PluginManager } from './manager.js';
|
|
4
|
+
export { PLUGIN_API_VERSION, PLUGIN_HOOK_NAMES, validateManifest, parseManifest, validatePluginConfig, } from './manifest.js';
|
|
@@ -1,133 +1,76 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* 加载流程:
|
|
5
|
-
* 1. Discovery — 从配置路径发现候选 plugins
|
|
6
|
-
* 2. Validation — 验证 manifest、检查 enable/disable 状态
|
|
7
|
-
* 3. Loading — 进程内加载 plugin 代码
|
|
8
|
-
* 4. Registration — 调用 register() 注册能力
|
|
9
|
-
*/
|
|
10
|
-
import type { PluginManifest } from './manifest.js';
|
|
1
|
+
/** Manifest-first discovery: no plugin code runs before eligibility and config validation. */
|
|
2
|
+
import { type PluginManifest } from './manifest.js';
|
|
11
3
|
import type { OctopiPluginDefinition } from './entry.js';
|
|
12
|
-
import type
|
|
13
|
-
import { CapabilityRegistry } from './capability.js';
|
|
14
|
-
/**
|
|
15
|
-
* 加载后的 Plugin 实例
|
|
16
|
-
*/
|
|
17
|
-
export interface LoadedPlugin {
|
|
18
|
-
/** Plugin ID */
|
|
19
|
-
id: string;
|
|
20
|
-
/** Plugin Manifest */
|
|
21
|
-
manifest: PluginManifest;
|
|
22
|
-
/** Plugin 定义(包含 register 回调) */
|
|
23
|
-
definition: OctopiPluginDefinition;
|
|
24
|
-
/** Plugin API 实例 */
|
|
25
|
-
api: PluginApi;
|
|
26
|
-
/** Plugin 源路径 */
|
|
27
|
-
source: string;
|
|
28
|
-
/** Plugin root 目录 */
|
|
29
|
-
rootDir: string;
|
|
30
|
-
/** 是否已执行 register() */
|
|
31
|
-
registered: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Plugin Loader 配置
|
|
35
|
-
*/
|
|
36
|
-
export interface PluginLoaderConfig {
|
|
37
|
-
/** Plugin 搜索路径列表 */
|
|
38
|
-
loadPaths: string[];
|
|
39
|
-
/** 允许的 plugin IDs(白名单,空 = 全部允许) */
|
|
40
|
-
allowList?: string[];
|
|
41
|
-
/** 禁用的 plugin IDs */
|
|
42
|
-
blockList?: string[];
|
|
43
|
-
/** Plugin 配置 entries */
|
|
44
|
-
pluginEntries?: Record<string, PluginEntryConfig>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Plugin Entry 配置(来自宿主配置)
|
|
48
|
-
*/
|
|
4
|
+
import { PluginContributionRegistry, type RegisteredPlugin } from './contribution-registry.js';
|
|
49
5
|
export interface PluginEntryConfig {
|
|
50
|
-
/** 是否启用 */
|
|
51
6
|
enabled?: boolean;
|
|
52
|
-
/** Plugin 配置 */
|
|
53
7
|
config?: Record<string, unknown>;
|
|
54
|
-
/** Hook
|
|
8
|
+
/** Per-plugin hook timeout policy; consumed by the Hook adapter (timeouts keyed by hook name). */
|
|
55
9
|
hooks?: {
|
|
56
|
-
/** 全局 hook 超时 */
|
|
57
10
|
timeoutMs?: number;
|
|
58
|
-
/** 按 hook 名称的超时 */
|
|
59
11
|
timeouts?: Record<string, number>;
|
|
60
|
-
/** 超时后是否中断 hook 链(默认 false:跳过并继续) */
|
|
61
|
-
abortOnTimeout?: Record<string, boolean>;
|
|
62
|
-
/** 是否允许 conversation access */
|
|
63
|
-
allowConversationAccess?: boolean;
|
|
64
|
-
/** 是否允许 prompt injection */
|
|
65
|
-
allowPromptInjection?: boolean;
|
|
66
12
|
};
|
|
67
13
|
}
|
|
68
14
|
/**
|
|
69
|
-
*
|
|
15
|
+
* Resolve a manifest entry to its real path inside the plugin root. Shared
|
|
16
|
+
* single source for the loader and `octopi plugin doctor`: rejects entries
|
|
17
|
+
* that escape the plugin root (before and after symlink resolution).
|
|
70
18
|
*
|
|
71
|
-
*
|
|
19
|
+
* @param rootDir - Plugin directory
|
|
20
|
+
* @param entry - Manifest `entry` (relative path)
|
|
21
|
+
* @returns The real path of the entry file
|
|
22
|
+
* @throws When the entry is missing, escapes its root, or is not a file
|
|
72
23
|
*/
|
|
24
|
+
export declare function resolvePluginEntry(rootDir: string, entry: string): string;
|
|
25
|
+
export interface PluginLoaderConfig {
|
|
26
|
+
loadPaths: string[];
|
|
27
|
+
allowList?: string[];
|
|
28
|
+
blockList?: string[];
|
|
29
|
+
entries?: Record<string, PluginEntryConfig>;
|
|
30
|
+
engineVersion?: string;
|
|
31
|
+
}
|
|
32
|
+
export type PluginDiagnosticStatus = 'disabled' | 'failed' | 'registered';
|
|
33
|
+
export interface PluginDiagnostic {
|
|
34
|
+
id: string;
|
|
35
|
+
status: PluginDiagnosticStatus;
|
|
36
|
+
stage: 'manifest' | 'policy' | 'dependency' | 'config' | 'entry' | 'import' | 'register' | 'publish';
|
|
37
|
+
reason: string;
|
|
38
|
+
path?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface LoadedPlugin extends RegisteredPlugin {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
version: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
manifest: PluginManifest;
|
|
46
|
+
definition: OctopiPluginDefinition;
|
|
47
|
+
source: 'local' | 'npm';
|
|
48
|
+
registered: true;
|
|
49
|
+
}
|
|
73
50
|
export declare class PluginLoader {
|
|
74
|
-
|
|
75
|
-
private plugins;
|
|
76
|
-
/** Capability Registry */
|
|
77
|
-
readonly capabilities: CapabilityRegistry;
|
|
78
|
-
/** 配置 */
|
|
51
|
+
readonly contributions: PluginContributionRegistry;
|
|
79
52
|
private config;
|
|
53
|
+
private plugins;
|
|
54
|
+
private diagnostics;
|
|
80
55
|
constructor(config: PluginLoaderConfig);
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* 扫描所有配置路径,查找包含 octopi.plugin.json 的目录。
|
|
85
|
-
*
|
|
86
|
-
* @returns 加载的 plugin 列表
|
|
87
|
-
*/
|
|
56
|
+
/** Resolve a loaded plugin's configured hook policy, including legacy aliases. */
|
|
57
|
+
getPluginConfig(id: string): PluginEntryConfig | undefined;
|
|
58
|
+
/** Discover, validate and atomically publish the successful plugin set. */
|
|
88
59
|
discover(): Promise<LoadedPlugin[]>;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
private
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
private
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
* 3. src/index.ts / src/index.js
|
|
104
|
-
*/
|
|
105
|
-
private resolveEntryPoint;
|
|
106
|
-
/**
|
|
107
|
-
* 过滤 plugins(allowlist / blocklist / enabled)
|
|
108
|
-
*/
|
|
109
|
-
private filterPlugins;
|
|
110
|
-
/**
|
|
111
|
-
* 拓扑排序:按依赖关系排列 plugin 顺序
|
|
112
|
-
*
|
|
113
|
-
* 使用 Kahn 算法。被依赖的 plugin 排在前面。
|
|
114
|
-
* 存在循环依赖时,剩余的 plugin 按原始顺序追加并警告。
|
|
115
|
-
*/
|
|
116
|
-
private resolveDependencyOrder;
|
|
117
|
-
/**
|
|
118
|
-
* 执行 plugin 的 register()
|
|
119
|
-
*/
|
|
120
|
-
private registerPlugin;
|
|
121
|
-
/**
|
|
122
|
-
* 获取已加载的 plugin
|
|
123
|
-
*/
|
|
60
|
+
private scanDirectories;
|
|
61
|
+
private readCandidate;
|
|
62
|
+
private addCandidate;
|
|
63
|
+
private applyAliases;
|
|
64
|
+
private isEligible;
|
|
65
|
+
private prepareCandidate;
|
|
66
|
+
private markDependencyFailures;
|
|
67
|
+
private checkDeclaredConflicts;
|
|
68
|
+
private importAndRegister;
|
|
69
|
+
private assertActualContributions;
|
|
70
|
+
private disabled;
|
|
71
|
+
private fail;
|
|
72
|
+
getDiagnostics(): PluginDiagnostic[];
|
|
73
|
+
getRegisteredIds(): string[];
|
|
124
74
|
getPlugin(id: string): LoadedPlugin | undefined;
|
|
125
|
-
/**
|
|
126
|
-
* 获取所有已加载的 plugins
|
|
127
|
-
*/
|
|
128
75
|
getAllPlugins(): LoadedPlugin[];
|
|
129
|
-
/**
|
|
130
|
-
* 获取所有已注册的 plugin IDs
|
|
131
|
-
*/
|
|
132
|
-
getRegisteredIds(): string[];
|
|
133
76
|
}
|