@octopi-agent/engine 0.97.15 → 0.102.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/config-schema/agent.d.ts +37 -5
- package/dist/config-schema/agent.js +24 -4
- package/dist/config-schema/context.d.ts +6 -36
- package/dist/config-schema/context.js +4 -28
- package/dist/config-schema/engine.d.ts +61 -160
- package/dist/config-schema/engine.js +1 -5
- package/dist/config-schema/governance.d.ts +10 -1
- package/dist/config-schema/governance.js +38 -1
- package/dist/config-schema/models.d.ts +2 -8
- package/dist/config-schema/models.js +0 -2
- package/dist/config-schema/run.d.ts +2 -2
- package/dist/config-schema/run.js +2 -2
- package/dist/config-schema/shared.d.ts +0 -3
- package/dist/config-schema/shared.js +0 -2
- package/dist/config-schema/substrate.d.ts +14 -88
- package/dist/config-schema/substrate.js +22 -107
- package/dist/config.d.ts +45 -113
- package/dist/config.js +8 -2
- package/dist/harness/activation/dispatcher.js +7 -0
- package/dist/harness/activation/inbox.d.ts +3 -3
- package/dist/harness/activation/inbox.js +3 -3
- package/dist/harness/activation/runtime.js +13 -5
- package/dist/harness/activation/types.d.ts +2 -2
- package/dist/harness/agent/builder.d.ts +34 -2
- package/dist/harness/agent/builder.js +189 -58
- package/dist/harness/agent/config-bridge.js +9 -2
- package/dist/harness/agent/config-integrity.d.ts +66 -0
- package/dist/harness/agent/config-integrity.js +108 -2
- package/dist/harness/agent/wire-agent-builder.d.ts +11 -3
- package/dist/harness/agent/wire-agent-builder.js +31 -7
- package/dist/harness/capabilities/document/factory.d.ts +5 -0
- package/dist/harness/capabilities/document/factory.js +1 -0
- 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/index.d.ts +2 -2
- package/dist/harness/collaboration/autonomous-subsystem/index.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/loader.js +4 -1
- package/dist/harness/collaboration/autonomous-subsystem/sense/engine.d.ts +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/sense/engine.js +21 -4
- 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/completion-guard.d.ts +40 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/completion-guard.js +59 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/index.d.ts +2 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/index.js +1 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/types.d.ts +12 -3
- package/dist/harness/collaboration/delegation/child-run.d.ts +1 -1
- package/dist/harness/collaboration/delegation/child-run.js +4 -4
- 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/service.d.ts +2 -0
- package/dist/harness/collaboration/delegation/service.js +2 -1
- package/dist/harness/collaboration/delegation/store.d.ts +2 -0
- package/dist/harness/collaboration/delegation/store.js +2 -1
- package/dist/harness/collaboration/delegation/types.d.ts +23 -2
- package/dist/harness/collaboration/delegation/types.js +22 -0
- package/dist/harness/collaboration/delegation/wiring.js +11 -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 +0 -6
- package/dist/harness/context/capabilities/compact/engine.js +169 -121
- 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 +5 -1
- package/dist/harness/context/capabilities/compact/index.js +4 -0
- 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 +76 -11
- 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/port.js +0 -1
- package/dist/harness/context/capabilities/summary/resolver.d.ts +1 -1
- package/dist/harness/context/capabilities/summary/resolver.js +4 -9
- package/dist/harness/context/capabilities/summary/tool-binding.d.ts +1 -1
- package/dist/harness/context/capabilities/summary/types.d.ts +4 -7
- package/dist/harness/context/context-size-ledger.d.ts +143 -0
- package/dist/harness/context/context-size-ledger.js +236 -0
- package/dist/harness/context/default-context-engine.d.ts +195 -119
- package/dist/harness/context/default-context-engine.js +1241 -743
- package/dist/harness/context/index.d.ts +2 -2
- package/dist/harness/context/index.js +1 -1
- package/dist/harness/context/layer-types.d.ts +15 -0
- package/dist/harness/context/layer-types.js +14 -1
- package/dist/harness/context/layers.d.ts +16 -19
- package/dist/harness/context/layers.js +42 -14
- package/dist/harness/context/message-selector.d.ts +10 -8
- package/dist/harness/context/message-selector.js +49 -27
- package/dist/harness/context/summarize.d.ts +3 -3
- package/dist/harness/context/summarize.js +11 -4
- package/dist/harness/context/system-prompt-assembler.d.ts +4 -0
- package/dist/harness/context/system-prompt-assembler.js +3 -1
- 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 +6 -1
- package/dist/harness/context/tool-result-aging.js +16 -5
- 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 +127 -117
- package/dist/harness/extension/execution-environment/effect-policy.d.ts +24 -2
- package/dist/harness/extension/execution-environment/effect-policy.js +30 -0
- package/dist/harness/extension/execution-environment/ops-audit.d.ts +7 -3
- package/dist/harness/extension/execution-environment/ops-audit.js +11 -12
- 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/undo-log.d.ts +6 -2
- package/dist/harness/extension/execution-environment/undo-log.js +31 -10
- package/dist/harness/extension/plugin-ecosystem/channel-types.d.ts +1 -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/plugins/api.d.ts +83 -249
- package/dist/harness/extension/plugin-ecosystem/plugins/api.js +88 -214
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-registry.d.ts +43 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/contribution-registry.js +61 -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 +50 -117
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.js +316 -285
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.d.ts +23 -490
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.js +85 -353
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.d.ts +41 -223
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.js +138 -19
- package/dist/harness/extension/plugin-ecosystem/plugins/staging.d.ts +15 -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/builtin.js +17 -24
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.js +18 -8
- package/dist/harness/extension/plugin-ecosystem/tools/document-tools.js +3 -9
- package/dist/harness/extension/plugin-ecosystem/tools/file-edit.js +3 -6
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.js +9 -5
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.js +9 -130
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.js +122 -14
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.js +4 -13
- package/dist/harness/extension/plugin-ecosystem/tools/platform.d.ts +25 -11
- package/dist/harness/extension/plugin-ecosystem/tools/platform.js +168 -62
- 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 +11 -2
- 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/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/security/capability-enforcer.js +1 -2
- package/dist/harness/governance/security/default-risk-policy.d.ts +1 -0
- package/dist/harness/governance/security/default-risk-policy.js +1 -0
- package/dist/harness/governance/security/default-security-guard.js +9 -0
- package/dist/harness/governance/security/index.d.ts +1 -0
- package/dist/harness/governance/security/index.js +2 -0
- package/dist/harness/governance/security/risk-evaluator.js +13 -0
- package/dist/harness/governance/security/risk-types.d.ts +12 -0
- package/dist/harness/governance/security/shell-parser-fallback.d.ts +29 -0
- package/dist/harness/governance/security/shell-parser-fallback.js +410 -0
- package/dist/harness/governance/security/shell-parser-shared.d.ts +83 -0
- package/dist/harness/governance/security/shell-parser-shared.js +188 -0
- package/dist/harness/governance/security/shell-parser-treesitter.d.ts +52 -0
- package/dist/harness/governance/security/shell-parser-treesitter.js +370 -0
- package/dist/harness/governance/security/shell-parser.d.ts +23 -10
- package/dist/harness/governance/security/shell-parser.js +37 -496
- package/dist/harness/governance/security/vendor/README.md +24 -0
- package/dist/harness/governance/security/vendor/tree-sitter-bash.LICENSE.txt +21 -0
- package/dist/harness/governance/security/vendor/tree-sitter-bash.wasm +0 -0
- package/dist/harness/index.d.ts +12 -12
- package/dist/harness/index.js +7 -7
- package/dist/harness/knowledge/boot-config.d.ts +55 -0
- package/dist/harness/knowledge/boot-config.js +50 -0
- package/dist/harness/knowledge/catalog-types.d.ts +2 -0
- package/dist/harness/knowledge/client.d.ts +24 -2
- package/dist/harness/knowledge/client.js +19 -5
- package/dist/harness/knowledge/db.js +5 -0
- 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 +6 -0
- package/dist/harness/knowledge/grounding.js +3 -1
- package/dist/harness/knowledge/http-app.js +35 -4
- 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 +3 -0
- package/dist/harness/knowledge/purge.js +5 -2
- package/dist/harness/knowledge/query-service.d.ts +13 -2
- package/dist/harness/knowledge/query-service.js +4 -2
- package/dist/harness/knowledge/query-worker-client.d.ts +9 -1
- package/dist/harness/knowledge/query-worker-client.js +4 -2
- package/dist/harness/knowledge/query-worker.js +4 -2
- package/dist/harness/knowledge/read-http.js +5 -1
- package/dist/harness/knowledge/serve.d.ts +8 -7
- package/dist/harness/knowledge/serve.js +9 -0
- package/dist/harness/knowledge/source-store.js +26 -3
- package/dist/harness/knowledge/start-service-process.d.ts +15 -7
- package/dist/harness/knowledge/start-service-process.js +21 -9
- package/dist/harness/knowledge/types.d.ts +7 -0
- package/dist/harness/knowledge/writer-service.d.ts +37 -9
- package/dist/harness/knowledge/writer-service.js +120 -14
- package/dist/harness/knowledge/writer-worker-client.d.ts +10 -9
- package/dist/harness/knowledge/writer-worker-client.js +20 -2
- package/dist/harness/knowledge/writer-worker.js +9 -1
- package/dist/harness/memory/index.d.ts +6 -2
- package/dist/harness/memory/index.js +4 -1
- package/dist/harness/memory/memory-events.d.ts +25 -0
- package/dist/harness/memory/memory-events.js +38 -0
- package/dist/harness/memory/sqlite/agent-db.js +15 -0
- package/dist/harness/memory/sqlite/wisdom-store.d.ts +7 -2
- package/dist/harness/memory/sqlite/wisdom-store.js +86 -12
- package/dist/harness/memory/steward-policy.d.ts +3 -0
- package/dist/harness/memory/steward-policy.js +1 -1
- package/dist/harness/memory/types.d.ts +47 -7
- package/dist/harness/memory/wisdom-attribution.d.ts +136 -0
- package/dist/harness/memory/wisdom-attribution.js +287 -0
- package/dist/harness/memory/wisdom-events.d.ts +37 -0
- package/dist/harness/memory/wisdom-events.js +61 -0
- package/dist/harness/memory/wisdom-formation.d.ts +31 -1
- package/dist/harness/memory/wisdom-formation.js +130 -33
- package/dist/harness/memory/wisdom-gates.d.ts +14 -0
- package/dist/harness/memory/wisdom-gates.js +59 -19
- package/dist/harness/memory/wisdom.d.ts +7 -2
- package/dist/harness/memory/wisdom.js +49 -2
- package/dist/harness/observability/observer/hub.js +25 -15
- 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 +66 -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/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 +10 -4
- package/dist/harness/run/reliability/run-agent.js +137 -53
- 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-scope.d.ts +41 -4
- package/dist/harness/run/runner.d.ts +71 -31
- package/dist/harness/run/runner.js +368 -106
- 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/transform-store.d.ts +136 -0
- package/dist/harness/session/transform-store.js +302 -0
- package/dist/harness/session/types.d.ts +2 -2
- package/dist/harness/shared/events/agent-event-map.d.ts +46 -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/paths/glob.d.ts +52 -0
- package/dist/harness/shared/paths/glob.js +218 -0
- package/dist/harness/shared/paths/index.d.ts +84 -0
- package/dist/harness/shared/paths/index.js +179 -0
- package/dist/harness/shared/types/agent-definition.d.ts +1 -2
- package/dist/index.d.ts +14 -17
- package/dist/index.js +7 -9
- 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.js +14 -1
- package/dist/integration/providers/openai.js +7 -1
- package/dist/integration/providers/usage.d.ts +1 -1
- package/dist/integration/providers/wire-dump.d.ts +1 -1
- package/dist/integration/storage/archive-manager.d.ts +6 -0
- package/dist/integration/storage/archive-manager.js +10 -0
- package/dist/integration/storage/jsonl.d.ts +1 -1
- package/dist/integration/storage/jsonl.js +18 -16
- package/dist/subsystems/cognition-steward/conceptualize/config.yaml +4 -2
- package/dist/subsystems/cognition-steward/conceptualize/handler.js +12 -20
- package/dist/subsystems/memory-steward/backfill/config.yaml +4 -2
- package/dist/subsystems/memory-steward/backfill/handler.js +44 -52
- package/dist/subsystems/wisdom-steward/attribute/SUBSYSTEM.md +24 -0
- package/dist/subsystems/wisdom-steward/attribute/config.yaml +60 -0
- package/dist/subsystems/wisdom-steward/attribute/handler.d.ts +23 -0
- package/dist/subsystems/wisdom-steward/attribute/handler.js +167 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.js +3 -1
- package/dist/subsystems/wisdom-steward/formation/SUBSYSTEM.md +8 -1
- package/dist/subsystems/wisdom-steward/formation/config.yaml +13 -5
- package/dist/subsystems/wisdom-steward/formation/handler.js +39 -23
- package/dist/subsystems/wisdom-steward/govern/config.yaml +1 -1
- package/dist/subsystems/wisdom-steward/govern/handler.js +4 -0
- package/package.json +16 -14
- 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,229 @@
|
|
|
1
|
+
import type { Message, ThinkingLevel, ToolCall, ToolResult } from '@octopi-agent/core/types.js';
|
|
2
|
+
import type { HitlOutcome } from '../../../governance/human-in-the-loop/decision-cache.js';
|
|
3
|
+
import type { ChannelMessage, ChannelReply } from '../channel-types.js';
|
|
4
|
+
import type { PluginHookName } from '../plugins/manifest.js';
|
|
5
|
+
/** Per-call execution facts; a missing Port performs no plugin work. */
|
|
6
|
+
export interface ExtensionHookContext {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
agentId: string;
|
|
9
|
+
runId?: string;
|
|
10
|
+
principal?: {
|
|
11
|
+
actorId?: string;
|
|
12
|
+
actorType?: string;
|
|
13
|
+
tenantId?: string;
|
|
14
|
+
};
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
trace?: {
|
|
17
|
+
traceId?: string;
|
|
18
|
+
spanId?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface HookContribution<T> {
|
|
22
|
+
pluginId: string;
|
|
23
|
+
value: T;
|
|
24
|
+
}
|
|
25
|
+
export interface HookVote {
|
|
26
|
+
decision: 'allow' | 'deny' | 'require_approval';
|
|
27
|
+
reason?: string;
|
|
28
|
+
pluginId?: string;
|
|
29
|
+
/** Only before_tool_call may request the Host's existing HITL channel. */
|
|
30
|
+
approval?: HookToolApproval;
|
|
31
|
+
}
|
|
32
|
+
export interface HookTransformResult<T> {
|
|
33
|
+
value: T;
|
|
34
|
+
changes: HookContribution<unknown>[];
|
|
35
|
+
}
|
|
36
|
+
export interface HookCollectResult<T> {
|
|
37
|
+
contributions: HookContribution<T>[];
|
|
38
|
+
}
|
|
39
|
+
export interface HookFailure {
|
|
40
|
+
pluginId: string;
|
|
41
|
+
hookName: PluginHookName;
|
|
42
|
+
reason: 'error' | 'timeout' | 'aborted';
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
export interface HookServiceRegistration {
|
|
46
|
+
serviceId: string;
|
|
47
|
+
required?: boolean;
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
start?: (signal: AbortSignal) => void | Promise<void>;
|
|
50
|
+
stop?: (signal: AbortSignal) => void | Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export interface HookModelSelection {
|
|
53
|
+
provider: string;
|
|
54
|
+
model: string;
|
|
55
|
+
}
|
|
56
|
+
export interface HookModelSelectionEvent extends ExtensionHookContext {
|
|
57
|
+
current: Readonly<HookModelSelection>;
|
|
58
|
+
prompt: string;
|
|
59
|
+
}
|
|
60
|
+
export interface HookTurnEvent extends ExtensionHookContext {
|
|
61
|
+
prompt: string;
|
|
62
|
+
messages: readonly Message[];
|
|
63
|
+
}
|
|
64
|
+
export interface HookPromptBuildEvent extends HookTurnEvent {
|
|
65
|
+
runId: string;
|
|
66
|
+
}
|
|
67
|
+
export interface HookPromptContribution {
|
|
68
|
+
text: string;
|
|
69
|
+
}
|
|
70
|
+
export interface HookRunEvent extends ExtensionHookContext {
|
|
71
|
+
runId: string;
|
|
72
|
+
prompt: string;
|
|
73
|
+
messages: readonly Message[];
|
|
74
|
+
}
|
|
75
|
+
export interface HookReplyEvent extends HookRunEvent {
|
|
76
|
+
}
|
|
77
|
+
export interface HookFinalizeEvent extends ExtensionHookContext {
|
|
78
|
+
runId: string;
|
|
79
|
+
reply: Readonly<Message>;
|
|
80
|
+
}
|
|
81
|
+
export interface HookRunEndEvent extends ExtensionHookContext {
|
|
82
|
+
runId: string;
|
|
83
|
+
messages: readonly Message[];
|
|
84
|
+
durationMs: number;
|
|
85
|
+
/** Exact terminal cause: completed | should_stop | aborted | error | denied (observation-layer label). */
|
|
86
|
+
reason: string;
|
|
87
|
+
/** True only for clean terminal ends (completed / should_stop); aborted / error / denied are false. */
|
|
88
|
+
success: boolean;
|
|
89
|
+
error?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface HookToolEvent extends ExtensionHookContext {
|
|
92
|
+
runId: string;
|
|
93
|
+
toolName: string;
|
|
94
|
+
call: Readonly<ToolCall>;
|
|
95
|
+
params: Readonly<Record<string, unknown>>;
|
|
96
|
+
}
|
|
97
|
+
export interface HookToolApproval {
|
|
98
|
+
title: string;
|
|
99
|
+
description: string;
|
|
100
|
+
severity?: 'info' | 'warning' | 'critical';
|
|
101
|
+
timeoutMs?: number;
|
|
102
|
+
timeoutBehavior?: 'deny';
|
|
103
|
+
}
|
|
104
|
+
export interface HookToolResultEvent extends ExtensionHookContext {
|
|
105
|
+
runId: string;
|
|
106
|
+
call: Readonly<ToolCall>;
|
|
107
|
+
originalParams: Readonly<Record<string, unknown>>;
|
|
108
|
+
params: Readonly<Record<string, unknown>>;
|
|
109
|
+
result: Readonly<ToolResult>;
|
|
110
|
+
error?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface HookMessageReceivedEvent extends ExtensionHookContext {
|
|
113
|
+
message: Readonly<ChannelMessage>;
|
|
114
|
+
}
|
|
115
|
+
export interface HookMessageSendingEvent extends ExtensionHookContext {
|
|
116
|
+
reply: Readonly<ChannelReply>;
|
|
117
|
+
}
|
|
118
|
+
export interface HookMessageSentEvent extends HookMessageSendingEvent {
|
|
119
|
+
success: boolean;
|
|
120
|
+
error?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface HookSessionEvent extends ExtensionHookContext {
|
|
123
|
+
reason?: 'created' | 'deleted' | 'archived';
|
|
124
|
+
}
|
|
125
|
+
export interface HookCompactionEvent extends ExtensionHookContext {
|
|
126
|
+
runId?: string;
|
|
127
|
+
mode: string;
|
|
128
|
+
previousSummary?: string;
|
|
129
|
+
coveredMessageCount?: number;
|
|
130
|
+
compacted?: boolean;
|
|
131
|
+
fresh?: boolean;
|
|
132
|
+
reason?: string;
|
|
133
|
+
error?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface HookGatewayEvent extends ExtensionHookContext {
|
|
136
|
+
phase: 'started' | 'stopping';
|
|
137
|
+
}
|
|
138
|
+
export interface HookInstallEvent extends ExtensionHookContext {
|
|
139
|
+
type: 'skill' | 'plugin';
|
|
140
|
+
source: string;
|
|
141
|
+
target: string;
|
|
142
|
+
}
|
|
143
|
+
export interface HookIterationEvent extends ExtensionHookContext {
|
|
144
|
+
runId: string;
|
|
145
|
+
iteration: number;
|
|
146
|
+
messages: readonly Message[];
|
|
147
|
+
model: HookModelSelection;
|
|
148
|
+
thinking?: ThinkingLevel;
|
|
149
|
+
}
|
|
150
|
+
export interface HookIterationTransform {
|
|
151
|
+
model?: HookModelSelection;
|
|
152
|
+
thinking?: ThinkingLevel;
|
|
153
|
+
/** Ordered Runtime snapshot additions; never a systemPrompt override. */
|
|
154
|
+
snapshot?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface HookAfterIterationEvent extends HookIterationEvent {
|
|
157
|
+
assistantMessage: Readonly<Message>;
|
|
158
|
+
toolResults: readonly ToolResult[];
|
|
159
|
+
usage?: import('@octopi-agent/core/types/step.js').TokenUsage;
|
|
160
|
+
}
|
|
161
|
+
export interface HookLoopEndEvent extends HookRunEndEvent {
|
|
162
|
+
iterations: number;
|
|
163
|
+
response?: string;
|
|
164
|
+
}
|
|
165
|
+
export interface HookBeforeToolTransform {
|
|
166
|
+
params: Record<string, unknown>;
|
|
167
|
+
}
|
|
168
|
+
export type ExtensionHookMap = {
|
|
169
|
+
before_model_resolve: [HookModelSelectionEvent, HookModelSelection | void, 'transform'];
|
|
170
|
+
agent_turn_prepare: [HookTurnEvent, string | void, 'transform'];
|
|
171
|
+
before_prompt_build: [HookPromptBuildEvent, HookPromptContribution | string | void, 'collect'];
|
|
172
|
+
before_agent_run: [HookRunEvent, HookVote | void, 'vote'];
|
|
173
|
+
before_agent_reply: [HookReplyEvent, Message | void, 'override'];
|
|
174
|
+
before_agent_finalize: [HookFinalizeEvent, Message | string | void, 'transform'];
|
|
175
|
+
agent_end: [HookRunEndEvent, void, 'observe'];
|
|
176
|
+
before_tool_call: [HookToolEvent, HookBeforeToolTransform | HookVote | void, 'transform_vote'];
|
|
177
|
+
after_tool_call: [HookToolResultEvent, void, 'observe'];
|
|
178
|
+
message_received: [HookMessageReceivedEvent, void, 'observe'];
|
|
179
|
+
message_sending: [HookMessageSendingEvent, HookVote | void, 'vote'];
|
|
180
|
+
message_sent: [HookMessageSentEvent, void, 'observe'];
|
|
181
|
+
session_start: [HookSessionEvent, void, 'observe'];
|
|
182
|
+
session_end: [HookSessionEvent, void, 'observe'];
|
|
183
|
+
before_compaction: [HookCompactionEvent, HookVote | void, 'vote'];
|
|
184
|
+
after_compaction: [HookCompactionEvent, void, 'observe'];
|
|
185
|
+
gateway_start: [HookGatewayEvent, void, 'observe'];
|
|
186
|
+
gateway_stop: [HookGatewayEvent, void, 'observe'];
|
|
187
|
+
before_install: [HookInstallEvent, HookVote | void, 'vote'];
|
|
188
|
+
before_iteration: [HookIterationEvent, HookIterationTransform | HookVote | void, 'transform_vote'];
|
|
189
|
+
after_iteration: [HookAfterIterationEvent, void, 'observe'];
|
|
190
|
+
loop_end: [HookLoopEndEvent, void, 'observe'];
|
|
191
|
+
};
|
|
192
|
+
export type HookEvent<K extends PluginHookName> = ExtensionHookMap[K][0];
|
|
193
|
+
export type HookResult<K extends PluginHookName> = K extends 'before_tool_call' ? Record<string, unknown> | HookVote | void : K extends 'before_iteration' ? HookIterationTransform | HookVote | void : ExtensionHookMap[K][1];
|
|
194
|
+
export type HookSemantics = 'observe' | 'collect' | 'transform' | 'vote' | 'override' | 'transform_vote';
|
|
195
|
+
export type HookAuditRecord = {
|
|
196
|
+
pluginId: string;
|
|
197
|
+
hookName: PluginHookName | 'service_start' | 'service_stop';
|
|
198
|
+
phase: 'observe' | 'collect' | 'transform' | 'vote' | 'override';
|
|
199
|
+
outcome: 'ok' | 'error' | 'timeout' | 'aborted' | 'denied' | 'skipped';
|
|
200
|
+
sessionId: string;
|
|
201
|
+
agentId: string;
|
|
202
|
+
runId?: string;
|
|
203
|
+
principal?: ExtensionHookContext['principal'];
|
|
204
|
+
reason?: string;
|
|
205
|
+
details?: Record<string, unknown>;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Harness-owned interception boundary. Consumers do not see PluginManager or
|
|
209
|
+
* plugin registrations; the adapter owns cardinality, failures and audit.
|
|
210
|
+
*/
|
|
211
|
+
export interface ExtensionHookPort {
|
|
212
|
+
/** True when at least one handler is registered for the event (optionally for one phase). */
|
|
213
|
+
hasHooks(name: PluginHookName, phase?: 'single' | 'transform' | 'vote'): boolean;
|
|
214
|
+
observe<K extends PluginHookName>(name: K, event: HookEvent<K>): Promise<void>;
|
|
215
|
+
collect(name: 'before_prompt_build', event: HookPromptBuildEvent): Promise<HookCollectResult<HookPromptContribution>>;
|
|
216
|
+
transform<K extends PluginHookName>(name: K, event: HookEvent<K>, initial: unknown): Promise<HookTransformResult<unknown>>;
|
|
217
|
+
vote<K extends PluginHookName>(name: K, event: HookEvent<K>): Promise<HookVote>;
|
|
218
|
+
override(name: 'before_agent_reply', event: HookReplyEvent): Promise<Message | undefined>;
|
|
219
|
+
transformBeforeToolCall(event: HookToolEvent): Promise<HookTransformResult<Record<string, unknown>>>;
|
|
220
|
+
voteBeforeToolCall(event: HookToolEvent, originalParams: Readonly<Record<string, unknown>>): Promise<HookVote>;
|
|
221
|
+
beforeIteration(event: HookIterationEvent): Promise<{
|
|
222
|
+
transform: HookIterationTransform;
|
|
223
|
+
snapshotContributions: HookContribution<string>[];
|
|
224
|
+
vote: HookVote;
|
|
225
|
+
}>;
|
|
226
|
+
/** Resolved Host HITL decision (engine cache included); `allowed` gates execution. */
|
|
227
|
+
approveToolCall(event: HookToolEvent, request: Readonly<HookToolApproval>, pluginId: string): Promise<HitlOutcome>;
|
|
228
|
+
}
|
|
229
|
+
export type ExtensionHookHandler<K extends PluginHookName = PluginHookName> = (event: HookEvent<K>) => HookResult<K> | Promise<HookResult<K>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,289 +1,123 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/** Public author API. Runtime ownership lives in PluginContributionRegistry. */
|
|
2
|
+
import { type ToolDefinition, type ToolHandler } from '@octopi-agent/core/types.js';
|
|
3
|
+
import type { PluginHookName, PluginSessionOpName } from './manifest.js';
|
|
4
|
+
import type { ExtensionHookHandler, HookEvent, HookResult, HookServiceRegistration, HookIterationTransform, HookVote } from '../hooks/types.js';
|
|
5
|
+
import type { ArgSpec, CommandInvoker, CommandKind, CommandResult, CommandRisk } from '../commands/types.js';
|
|
6
|
+
export interface PluginCommandContext {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
agentId: string;
|
|
9
|
+
args: string[];
|
|
10
|
+
raw: string;
|
|
11
|
+
principal: {
|
|
12
|
+
actorId?: string;
|
|
13
|
+
actorType?: string;
|
|
14
|
+
tenantId?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface PluginCommandRegistration {
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
/** Client-side commands require a client contract and are not Plugin v1 contributions. */
|
|
21
|
+
kind?: Exclude<CommandKind, 'client'>;
|
|
22
|
+
risk?: CommandRisk;
|
|
23
|
+
invocableBy?: CommandInvoker[];
|
|
24
|
+
args?: ArgSpec[];
|
|
25
|
+
preempt?: boolean;
|
|
26
|
+
sessionOps?: PluginSessionOpName[];
|
|
27
|
+
handler: (context: PluginCommandContext) => Promise<CommandResult | string | void | unknown>;
|
|
28
|
+
}
|
|
29
|
+
export type PluginHookMap = {
|
|
30
|
+
[K in PluginHookName]: [HookEvent<K>, HookResult<K>];
|
|
31
|
+
};
|
|
32
|
+
export type HookHandler<K extends PluginHookName = PluginHookName> = ExtensionHookHandler<K>;
|
|
33
|
+
export type HookResultFor<K extends PluginHookName, P extends 'transform' | 'vote'> = K extends 'before_tool_call' ? P extends 'transform' ? Record<string, unknown> | void : HookVote | void : K extends 'before_iteration' ? P extends 'transform' ? HookIterationTransform | void : HookVote | void : never;
|
|
34
|
+
export interface OrderedHookEntry {
|
|
35
|
+
pluginId: string;
|
|
36
|
+
hookName: PluginHookName;
|
|
37
|
+
handler: (event: never) => unknown;
|
|
38
|
+
phase: 'single' | 'transform' | 'vote';
|
|
39
|
+
priority: number;
|
|
19
40
|
timeoutMs?: number;
|
|
20
41
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
export interface PluginToolContribution {
|
|
43
|
+
definition: ToolDefinition;
|
|
44
|
+
handler: ToolHandler;
|
|
45
|
+
optional: boolean;
|
|
46
|
+
executionMode?: 'parallel' | 'sequential';
|
|
47
|
+
}
|
|
24
48
|
export interface ToolRegistrationOptions {
|
|
25
|
-
/**
|
|
49
|
+
/** Visibility is separately controlled by the Agent's tools allow/deny policy. */
|
|
26
50
|
optional?: boolean;
|
|
51
|
+
executionMode?: 'parallel' | 'sequential';
|
|
27
52
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
id: string;
|
|
34
|
-
/** Provider 实例 */
|
|
35
|
-
provider: ModelProvider;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Channel 注册定义
|
|
39
|
-
*/
|
|
40
|
-
export interface ChannelRegistration {
|
|
41
|
-
/** Channel ID */
|
|
42
|
-
id: string;
|
|
43
|
-
/** Channel Adapter 实例 */
|
|
44
|
-
adapter: ChannelAdapter;
|
|
53
|
+
export interface HookRegistrationOptions {
|
|
54
|
+
/** Required for the two dual-phase events; ordinary events must not set it. */
|
|
55
|
+
phase?: 'transform' | 'vote';
|
|
56
|
+
priority?: number;
|
|
57
|
+
timeoutMs?: number;
|
|
45
58
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export type HookHandler<TEvent = unknown, TResult = void> = (event: TEvent) => Promise<TResult | undefined | void>;
|
|
50
|
-
/**
|
|
51
|
-
* 有序 hook entry
|
|
52
|
-
*/
|
|
53
|
-
export interface OrderedHookEntry {
|
|
54
|
-
/** Plugin ID */
|
|
55
|
-
pluginId: string;
|
|
56
|
-
/** Hook 名称 */
|
|
57
|
-
hookName: string;
|
|
58
|
-
/** Handler 函数 */
|
|
59
|
-
handler: HookHandler;
|
|
60
|
-
/** 优先级 */
|
|
61
|
-
priority: number;
|
|
62
|
-
/** 超时 */
|
|
59
|
+
export interface DualPhaseHookOptions {
|
|
60
|
+
phase: 'transform' | 'vote';
|
|
61
|
+
priority?: number;
|
|
63
62
|
timeoutMs?: number;
|
|
64
63
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Plugin Logger
|
|
67
|
-
*/
|
|
68
64
|
export interface PluginLogger {
|
|
69
65
|
debug(message: string, ...args: unknown[]): void;
|
|
70
66
|
info(message: string, ...args: unknown[]): void;
|
|
71
67
|
warn(message: string, ...args: unknown[]): void;
|
|
72
68
|
error(message: string, ...args: unknown[]): void;
|
|
73
69
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Plugin API
|
|
76
|
-
*
|
|
77
|
-
* Plugin 在 register() 回调中使用此对象注册能力。
|
|
78
|
-
*/
|
|
79
70
|
export declare class PluginApi {
|
|
80
|
-
/** Plugin ID */
|
|
81
71
|
readonly id: string;
|
|
82
|
-
/** Plugin 显示名称 */
|
|
83
72
|
readonly name: string;
|
|
84
|
-
|
|
85
|
-
readonly version?: string;
|
|
86
|
-
/** Plugin 描述 */
|
|
73
|
+
readonly version: string;
|
|
87
74
|
readonly description?: string;
|
|
88
|
-
/** Plugin 源路径 */
|
|
89
75
|
readonly source: string;
|
|
90
|
-
|
|
91
|
-
readonly rootDir?: string;
|
|
92
|
-
/** Plugin 配置 */
|
|
76
|
+
readonly rootDir: string;
|
|
93
77
|
readonly pluginConfig: Record<string, unknown>;
|
|
94
|
-
/** Plugin Logger */
|
|
95
78
|
readonly logger: PluginLogger;
|
|
96
|
-
/** 已注册的 providers */
|
|
97
|
-
readonly _providers: ProviderRegistration[];
|
|
98
|
-
/** 已注册的 channels */
|
|
99
|
-
readonly _channels: ChannelRegistration[];
|
|
100
|
-
/** 已注册的 tools */
|
|
101
|
-
readonly _tools: Array<{
|
|
102
|
-
definition: ToolDefinition;
|
|
103
|
-
handler: HookHandler;
|
|
104
|
-
optional: boolean;
|
|
105
|
-
}>;
|
|
106
|
-
/** 已注册的 context engines */
|
|
107
|
-
readonly _contextEngines: Array<{
|
|
108
|
-
id: string;
|
|
109
|
-
engine: ContextEngine;
|
|
110
|
-
}>;
|
|
111
|
-
/** 已注册的 hooks */
|
|
112
|
-
readonly _hooks: Map<string, OrderedHookEntry[]>;
|
|
113
|
-
/** 已注册的 commands */
|
|
114
|
-
readonly _commands: Array<{
|
|
115
|
-
name: string;
|
|
116
|
-
handler: HookHandler;
|
|
117
|
-
description?: string;
|
|
118
|
-
}>;
|
|
119
|
-
/** 已注册的服务 */
|
|
120
|
-
readonly _services: Array<{
|
|
121
|
-
id: string;
|
|
122
|
-
start: () => Promise<void>;
|
|
123
|
-
stop: () => Promise<void>;
|
|
124
|
-
}>;
|
|
125
79
|
constructor(opts: {
|
|
126
80
|
id: string;
|
|
127
81
|
name: string;
|
|
128
|
-
version
|
|
82
|
+
version: string;
|
|
129
83
|
description?: string;
|
|
130
84
|
source: string;
|
|
131
|
-
rootDir
|
|
132
|
-
pluginConfig
|
|
85
|
+
rootDir: string;
|
|
86
|
+
pluginConfig: Record<string, unknown>;
|
|
133
87
|
});
|
|
134
88
|
/**
|
|
135
|
-
*
|
|
89
|
+
* Stage a Tool contribution. It is not mounted or exposed by this call.
|
|
136
90
|
*
|
|
137
|
-
* @param
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* 注册 Channel Adapter
|
|
142
|
-
*
|
|
143
|
-
* @param registration - Channel 注册定义
|
|
144
|
-
*/
|
|
145
|
-
registerChannel(registration: ChannelRegistration): void;
|
|
146
|
-
/**
|
|
147
|
-
* 注册 Agent Tool
|
|
148
|
-
*
|
|
149
|
-
* Tool 名称不能与核心 tool 冲突。
|
|
150
|
-
*
|
|
151
|
-
* @param tool - Tool 定义(包含 name、description、parameters)
|
|
152
|
-
* @param handler - Tool 处理函数
|
|
153
|
-
* @param opts - 注册选项
|
|
91
|
+
* @param tool - Core ToolDefinition
|
|
92
|
+
* @param handler - Core ToolHandler
|
|
93
|
+
* @param opts - Execution and optional contribution metadata
|
|
154
94
|
*/
|
|
155
95
|
registerTool(tool: ToolDefinition, handler: ToolHandler, opts?: ToolRegistrationOptions): void;
|
|
156
96
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* Context Engine 是 exclusive slot —— 同一时刻只有一个 active。
|
|
160
|
-
*
|
|
161
|
-
* @param id - Engine ID
|
|
162
|
-
* @param engine - Context Engine 实例
|
|
163
|
-
*/
|
|
164
|
-
registerContextEngine(id: string, engine: ContextEngine): void;
|
|
165
|
-
/**
|
|
166
|
-
* 注册 Hook
|
|
167
|
-
*
|
|
168
|
-
* Hook handler 按 priority 降序执行,同 priority 按注册顺序。
|
|
169
|
-
*
|
|
170
|
-
* @param hookName - Hook 名称
|
|
171
|
-
* @param handler - Hook handler
|
|
172
|
-
* @param opts - 选项(priority、timeoutMs)
|
|
173
|
-
*/
|
|
174
|
-
on<TEvent = unknown, TResult = void>(hookName: string, handler: (event: TEvent) => Promise<TResult | undefined | void>, opts?: HookRegistrationOptions): void;
|
|
175
|
-
/**
|
|
176
|
-
* 注册 Command
|
|
177
|
-
*
|
|
178
|
-
* Command 绕过 LLM,直接执行。
|
|
97
|
+
* Stage a typed hook contribution using one of the 22 existing event names.
|
|
179
98
|
*
|
|
180
|
-
* @param
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
*
|
|
193
|
-
*/
|
|
194
|
-
registerService(service: {
|
|
195
|
-
id: string;
|
|
196
|
-
start: () => Promise<void>;
|
|
197
|
-
stop: () => Promise<void>;
|
|
198
|
-
}): void;
|
|
199
|
-
/** 已注册的 web search providers */
|
|
200
|
-
readonly _webSearchProviders: Array<{
|
|
201
|
-
id: string;
|
|
202
|
-
provider: WebSearchProvider;
|
|
203
|
-
}>;
|
|
204
|
-
/** 已注册的 media understanding providers */
|
|
205
|
-
readonly _mediaUnderstandingProviders: Array<{
|
|
206
|
-
id: string;
|
|
207
|
-
provider: unknown;
|
|
208
|
-
}>;
|
|
209
|
-
/** 已注册的 image generation providers */
|
|
210
|
-
readonly _imageGenerationProviders: Array<{
|
|
211
|
-
id: string;
|
|
212
|
-
provider: unknown;
|
|
213
|
-
}>;
|
|
214
|
-
/** 已注册的 music generation providers */
|
|
215
|
-
readonly _musicGenerationProviders: Array<{
|
|
216
|
-
id: string;
|
|
217
|
-
provider: unknown;
|
|
218
|
-
}>;
|
|
219
|
-
/** 已注册的 video generation providers */
|
|
220
|
-
readonly _videoGenerationProviders: Array<{
|
|
221
|
-
id: string;
|
|
222
|
-
provider: unknown;
|
|
223
|
-
}>;
|
|
224
|
-
/** 已注册的 speech providers */
|
|
225
|
-
readonly _speechProviders: Array<{
|
|
226
|
-
id: string;
|
|
227
|
-
provider: unknown;
|
|
228
|
-
}>;
|
|
229
|
-
/** 已注册的 model catalog providers */
|
|
230
|
-
readonly _modelCatalogProviders: Array<{
|
|
231
|
-
provider: string;
|
|
232
|
-
kinds: string[];
|
|
233
|
-
liveCatalog: unknown;
|
|
234
|
-
}>;
|
|
235
|
-
/** 已注册的 memory embedding providers */
|
|
236
|
-
readonly _memoryEmbeddingProviders: Array<{
|
|
237
|
-
id: string;
|
|
238
|
-
provider: unknown;
|
|
239
|
-
}>;
|
|
240
|
-
/**
|
|
241
|
-
* 注册 Web Search Provider
|
|
99
|
+
* @param hookName - Existing hook name
|
|
100
|
+
* @param handler - Event-specific handler
|
|
101
|
+
* @param opts - Ordering and cooperative timeout options
|
|
102
|
+
*/
|
|
103
|
+
on<K extends PluginHookName>(hookName: K, handler: HookHandler<K>, opts?: HookRegistrationOptions): void;
|
|
104
|
+
/** Register a parameter Transform or admission Vote for before_tool_call. */
|
|
105
|
+
onBeforeToolCall<P extends 'transform' | 'vote'>(phase: P, handler: (event: HookEvent<'before_tool_call'>) => HookResultFor<'before_tool_call', P> | Promise<HookResultFor<'before_tool_call', P>>, opts?: Omit<DualPhaseHookOptions, 'phase'>): void;
|
|
106
|
+
/** Register a controlled Iteration Transform or admission Vote. */
|
|
107
|
+
onBeforeIteration<P extends 'transform' | 'vote'>(phase: P, handler: (event: HookEvent<'before_iteration'>) => HookResultFor<'before_iteration', P> | Promise<HookResultFor<'before_iteration', P>>, opts?: Omit<DualPhaseHookOptions, 'phase'>): void;
|
|
108
|
+
/** Stage a Host-owned background service; start/stop is driven by Gateway. */
|
|
109
|
+
registerService(registration: HookServiceRegistration): void;
|
|
110
|
+
/**
|
|
111
|
+
* Stage a Command contribution. Host authorization is enforced when mounted.
|
|
242
112
|
*
|
|
243
|
-
* @param
|
|
244
|
-
*/
|
|
245
|
-
registerWebSearchProvider(provider: WebSearchProvider): void;
|
|
246
|
-
/**
|
|
247
|
-
* 注册 Media Understanding Provider
|
|
248
|
-
*/
|
|
249
|
-
registerMediaUnderstandingProvider(provider: unknown): void;
|
|
250
|
-
/**
|
|
251
|
-
* 注册 Image Generation Provider
|
|
252
|
-
*/
|
|
253
|
-
registerImageGenerationProvider(provider: unknown): void;
|
|
254
|
-
/**
|
|
255
|
-
* 注册 Music Generation Provider
|
|
256
|
-
*/
|
|
257
|
-
registerMusicGenerationProvider(provider: unknown): void;
|
|
258
|
-
/**
|
|
259
|
-
* 注册 Video Generation Provider
|
|
260
|
-
*/
|
|
261
|
-
registerVideoGenerationProvider(provider: unknown): void;
|
|
262
|
-
/**
|
|
263
|
-
* 注册 Speech Provider
|
|
264
|
-
*/
|
|
265
|
-
registerSpeechProvider(provider: unknown): void;
|
|
266
|
-
/**
|
|
267
|
-
* 注册 Model Catalog Provider
|
|
268
|
-
*/
|
|
269
|
-
registerModelCatalogProvider(catalog: {
|
|
270
|
-
provider: string;
|
|
271
|
-
kinds: string[];
|
|
272
|
-
liveCatalog: unknown;
|
|
273
|
-
}): void;
|
|
274
|
-
/**
|
|
275
|
-
* 注册 Memory Embedding Provider
|
|
276
|
-
*/
|
|
277
|
-
registerMemoryEmbeddingProvider(provider: unknown): void;
|
|
278
|
-
/**
|
|
279
|
-
* 从 provider 对象提取 id(兼容多种命名)
|
|
113
|
+
* @param definition - Command metadata and handler
|
|
280
114
|
*/
|
|
281
|
-
|
|
115
|
+
registerCommand(definition: PluginCommandRegistration): void;
|
|
282
116
|
/**
|
|
283
|
-
*
|
|
117
|
+
* Resolve a path relative to the plugin root in ESM.
|
|
284
118
|
*
|
|
285
|
-
* @param input -
|
|
286
|
-
* @returns
|
|
119
|
+
* @param input - Relative or absolute path
|
|
120
|
+
* @returns Absolute path; not a filesystem security boundary
|
|
287
121
|
*/
|
|
288
122
|
resolvePath(input: string): string;
|
|
289
123
|
}
|