@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
package/dist/harness/index.js
CHANGED
|
@@ -24,11 +24,7 @@ export { DefaultContextEngine } from './context/default-context-engine.js';
|
|
|
24
24
|
export { HeuristicTokenEstimator, estimateTextTokens, estimateLLMMessages } from './context/index.js';
|
|
25
25
|
export { JSON_CHARS_PER_TOKEN, TOOL_RESULT_CHARS_PER_TOKEN, CHARS_PER_TOKEN, } from './context/index.js';
|
|
26
26
|
export { DefaultMessageSelector } from './context/message-selector.js';
|
|
27
|
-
export { TruncateCompressor } from './context/truncate-compressor.js';
|
|
28
|
-
export { LLMSummaryCompressor } from './context/llm-summarizer.js';
|
|
29
|
-
export { HybridCompressor } from './context/hybrid-compressor.js';
|
|
30
27
|
export { DefaultBudgetAllocator } from './context/budget-allocator.js';
|
|
31
|
-
export { SmartRouter } from './context/smart-router.js';
|
|
32
28
|
export { LAYER_ORDER, LAYER_PRIORITY, LAYER_DEFAULT_SHARE, extractLayerQuery, hasLayerText, DefaultContextAssembler, truncateTextToTokens, ALL_LAYER_IDS, buildContextLayersSnapshot, deriveLayerStatus, emptyContextLayersSnapshot, probeContextLayerHealth, probeAgentHomeHealth, PersonaLayer, SkillLayer, RuntimeLayer, KnowledgeLayer, MemoryLayer, CognitionLayer, WisdomLayer, createDefaultLayers, createProviderSummarize, pickSummarizeProvider, createDefaultSystemPromptAssembler, } from './context/index.js';
|
|
33
29
|
// ── Security ──
|
|
34
30
|
export { CapabilityEnforcer, PluginTrustLevel } from './governance/security/capability-enforcer.js';
|
|
@@ -39,14 +35,14 @@ export { CircuitBreaker } from './run/reliability/circuit-breaker.js';
|
|
|
39
35
|
export { wrapProviderWithCircuitBreaker } from './run/reliability/provider-wrapper.js';
|
|
40
36
|
export { FallbackProvider } from './run/reliability/fallback-provider.js';
|
|
41
37
|
export { guardRefusalProvider } from './run/reliability/refusal-guard.js';
|
|
42
|
-
export { detectSummaryContamination } from './context/capabilities/compact/engine.js';
|
|
38
|
+
export { detectSummaryContamination, inspectSummaryOutput, evaluateEcho, } from './context/capabilities/compact/engine.js';
|
|
43
39
|
// ── Plugin Ecosystem ──
|
|
44
40
|
export { PluginManager } from './extension/plugin-ecosystem/plugins/manager.js';
|
|
45
|
-
export {
|
|
41
|
+
export { definePlugin } from './extension/plugin-ecosystem/plugins/entry.js';
|
|
46
42
|
export { PluginApi } from './extension/plugin-ecosystem/plugins/api.js';
|
|
47
43
|
export { PluginLoader } from './extension/plugin-ecosystem/plugins/loader.js';
|
|
48
|
-
export {
|
|
49
|
-
export { validateManifest, parseManifest } from './extension/plugin-ecosystem/plugins/manifest.js';
|
|
44
|
+
export { PluginContributionRegistry } from './extension/plugin-ecosystem/plugins/contribution-registry.js';
|
|
45
|
+
export { validateManifest, parseManifest, validatePluginConfig, PLUGIN_API_VERSION } from './extension/plugin-ecosystem/plugins/manifest.js';
|
|
50
46
|
export { DefaultToolBus } from './extension/plugin-ecosystem/tools/tool-bus.js';
|
|
51
47
|
export { getBuiltinTools, createShellTool, createFileReadTool, createFileWriteTool, createFileDeleteTool, createFileListTool } from './extension/plugin-ecosystem/tools/builtin.js';
|
|
52
48
|
export { readGitStatusSnapshot, parsePorcelainV2 } from './extension/plugin-ecosystem/tools/git-status-snapshot.js';
|
|
@@ -83,7 +79,7 @@ export { KnowledgeDatabase, KnowledgeSourceStore, KnowledgeIndexStore, Knowledge
|
|
|
83
79
|
// ── Memory ──
|
|
84
80
|
export { InMemoryMemoryStore, InMemoryWisdomStore, InMemoryConceptGraph, AgentDatabase, SqliteMemoryStore, SqliteWisdomStore, SqliteConceptGraph, createEmbeddingProvider } from './memory/index.js';
|
|
85
81
|
export { createEmbeddingProviderFromModels, resolveEmbeddingRuntime, isEmbeddingEnabled, tokenizeKeywordQuery, scoreKeywordFields, } from './memory/index.js';
|
|
86
|
-
export { evaluateConceptGate, licenseEdge, conceptualizeAndAdmit, parseConceptualizerJson, DEFAULT_EDGE_DECAY_PER_DAY, hebbianStrengthen, nextEdgeStrength, } from './memory/index.js';
|
|
82
|
+
export { evaluateConceptGate, licenseEdge, conceptualizeAndAdmit, parseConceptualizerJson, DEFAULT_EDGE_DECAY_PER_DAY, hebbianStrengthen, nextEdgeStrength, normName, deriveQuerySeeds, createSeedMatcher, } from './memory/index.js';
|
|
87
83
|
// ── Runner ──
|
|
88
84
|
export { SessionAwareRunner } from './run/runner.js';
|
|
89
85
|
// ── Tool effect isolation (I5) ──
|
|
@@ -94,6 +90,10 @@ export { InProcessSessionLock } from './run/concurrency/session-lease.js';
|
|
|
94
90
|
export { SessionAclService, SessionRoleCatalog, BUILTIN_SESSION_ROLES, computeEffectiveRights, intersectRights, applyRightsOverlay, exceedsRightsCeiling, L0_SESSION_RIGHTS_FLOOR, EMPTY_TOOL_RIGHTS, normalizeToolRights, intersectToolRights, toolRightsExceeds, isToolAllowedByRights, isToolPermitted, } from './governance/session-acl/index.js';
|
|
95
91
|
export { readSessionCompact, writeSessionCompact } from './session/compact.js';
|
|
96
92
|
export { compactStateKey } from './context/compact-key.js';
|
|
93
|
+
export { JsonlTransformStore, InMemoryTransformStore, resolveSessionTransformPaths, copySessionTransformDir, removeSessionTransformDir, scanOrphanSessionTransform, } from './session/transform-store.js';
|
|
94
|
+
export { foldTransformView } from './context/transform/fold.js';
|
|
95
|
+
export { anchorFor, anchorRange, resolveAnchor, resolveRun, canonicalMessageHash } from './context/transform/anchors.js';
|
|
96
|
+
export { legacySnapshotToRecords } from './context/transform/migrate.js';
|
|
97
97
|
// ── Config Bridge ──
|
|
98
98
|
// (exported from agent-building above)
|
|
99
99
|
// ── Loop re-export(纯函数与协议类型;Agent 门面在 harness/agent) ──
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* octopi.json `knowledge.*` 调参面 → Knowledge Service boot 调参块(唯一映射点)
|
|
3
|
+
*
|
|
4
|
+
* 背景:v0.51 Gateway 直连 knowledge.db 时这些键全量贯通;v0.60 拆独立 Service
|
|
5
|
+
* 后传递线丢失(配了不生效,见 arch/config-key-audit-2026-11-01.md §1a/§2)。
|
|
6
|
+
* v0.98.11 起经 boot 文件传入 Service——schema 形状(knowledge.embed / index /
|
|
7
|
+
* load / keywordWeight / autoInject / hint)到消费侧形状(KnowledgeIngestOptions /
|
|
8
|
+
* KnowledgeRetrieverOptions)的转换只发生在这里。
|
|
9
|
+
*
|
|
10
|
+
* @module harness/knowledge/boot-config
|
|
11
|
+
*/
|
|
12
|
+
import type { KnowledgeRuntimeConfig } from '../../config.js';
|
|
13
|
+
import type { KnowledgeFileLimitsInput } from './file-limits.js';
|
|
14
|
+
/** Phase B 向量化调参(KnowledgeIngestOptions embed 子集 + 启用开关) */
|
|
15
|
+
export interface KnowledgeBootEmbed {
|
|
16
|
+
/** false = 纯关键词索引(不外发 embed);缺省 true */
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
embedBatch?: number;
|
|
19
|
+
embedMinIntervalMs?: number;
|
|
20
|
+
embedConcurrency?: number;
|
|
21
|
+
embedSecretPolicy?: 'allow' | 'redact' | 'skip';
|
|
22
|
+
}
|
|
23
|
+
/** Ingest 调参(KnowledgeIngestOptions 子集) */
|
|
24
|
+
export interface KnowledgeBootIngest {
|
|
25
|
+
parseConcurrency?: number;
|
|
26
|
+
/** fs watch debounce ms */
|
|
27
|
+
debounceMs?: number;
|
|
28
|
+
/** 队列深度上限(超出只报警,不丢任务) */
|
|
29
|
+
maxQueueDepth?: number;
|
|
30
|
+
diskWatermarkAlert?: boolean;
|
|
31
|
+
fileLimits?: KnowledgeFileLimitsInput;
|
|
32
|
+
}
|
|
33
|
+
/** 检索调参(KnowledgeRetrieverOptions 子集) */
|
|
34
|
+
export interface KnowledgeBootRetriever {
|
|
35
|
+
hybridKeyword?: boolean;
|
|
36
|
+
keywordWeight?: number;
|
|
37
|
+
injectMinScore?: number;
|
|
38
|
+
hintMinScore?: number;
|
|
39
|
+
minCoverage?: number;
|
|
40
|
+
}
|
|
41
|
+
/** boot 文件里的调参块 */
|
|
42
|
+
export interface KnowledgeBootTuning {
|
|
43
|
+
/** 跨租户共享闸(B-5):knowledge.projects.allowPublic,缺省 false=禁止创建 visibility='public' 项目 */
|
|
44
|
+
allowPublic?: boolean;
|
|
45
|
+
embed?: KnowledgeBootEmbed;
|
|
46
|
+
ingest?: KnowledgeBootIngest;
|
|
47
|
+
retriever?: KnowledgeBootRetriever;
|
|
48
|
+
/** false = 索引稳定后不自动生成 generatedDescription(catalog.autoDescribe;仅 manageLocal) */
|
|
49
|
+
autoDescribe?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 把 `knowledge.*` 配置映射为 Service boot 调参块。
|
|
53
|
+
*
|
|
54
|
+
* @param kn - octopi.json 的 knowledge 段(undefined = 全默认)
|
|
55
|
+
* @returns 调参三块;未配置的键不出现在输出中(消费侧用各自默认值)
|
|
56
|
+
*/
|
|
57
|
+
export declare function knowledgeTuningFromConfig(kn?: KnowledgeRuntimeConfig | null): KnowledgeBootTuning;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** 去掉值为 undefined 的键,保证输出只含显式配置(可安全展开进选项对象) */
|
|
2
|
+
function definedOnly(obj) {
|
|
3
|
+
const out = {};
|
|
4
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
5
|
+
if (v !== undefined)
|
|
6
|
+
out[k] = v;
|
|
7
|
+
}
|
|
8
|
+
return out;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 把 `knowledge.*` 配置映射为 Service boot 调参块。
|
|
12
|
+
*
|
|
13
|
+
* @param kn - octopi.json 的 knowledge 段(undefined = 全默认)
|
|
14
|
+
* @returns 调参三块;未配置的键不出现在输出中(消费侧用各自默认值)
|
|
15
|
+
*/
|
|
16
|
+
export function knowledgeTuningFromConfig(kn) {
|
|
17
|
+
if (!kn)
|
|
18
|
+
return {};
|
|
19
|
+
const tuning = {};
|
|
20
|
+
const embed = definedOnly({
|
|
21
|
+
enabled: kn.embed?.enabled,
|
|
22
|
+
embedBatch: kn.embed?.embedBatch,
|
|
23
|
+
embedMinIntervalMs: kn.embed?.embedMinIntervalMs,
|
|
24
|
+
embedConcurrency: kn.embed?.embedConcurrency,
|
|
25
|
+
embedSecretPolicy: kn.embed?.embedSecretPolicy,
|
|
26
|
+
});
|
|
27
|
+
if (Object.keys(embed).length > 0)
|
|
28
|
+
tuning.embed = embed;
|
|
29
|
+
const ingest = definedOnly({
|
|
30
|
+
parseConcurrency: kn.load?.parseConcurrency,
|
|
31
|
+
debounceMs: kn.load?.debounceMs,
|
|
32
|
+
maxQueueDepth: kn.index?.queue?.maxDepth,
|
|
33
|
+
diskWatermarkAlert: kn.load?.diskWatermarkAlert,
|
|
34
|
+
fileLimits: kn.index?.files,
|
|
35
|
+
});
|
|
36
|
+
if (Object.keys(ingest).length > 0)
|
|
37
|
+
tuning.ingest = ingest;
|
|
38
|
+
const retriever = definedOnly({
|
|
39
|
+
hybridKeyword: kn.index?.hybridKeyword,
|
|
40
|
+
keywordWeight: kn.keywordWeight,
|
|
41
|
+
injectMinScore: kn.autoInject?.minScore,
|
|
42
|
+
hintMinScore: kn.hint?.minScore,
|
|
43
|
+
minCoverage: kn.autoInject?.minCoverage,
|
|
44
|
+
});
|
|
45
|
+
if (Object.keys(retriever).length > 0)
|
|
46
|
+
tuning.retriever = retriever;
|
|
47
|
+
if (kn.catalog?.autoDescribe !== undefined)
|
|
48
|
+
tuning.autoDescribe = kn.catalog.autoDescribe;
|
|
49
|
+
if (kn.projects?.allowPublic !== undefined)
|
|
50
|
+
tuning.allowPublic = kn.projects.allowPublic;
|
|
51
|
+
return tuning;
|
|
52
|
+
}
|
|
@@ -17,6 +17,8 @@ export interface KnowledgeCatalogItem {
|
|
|
17
17
|
status?: string;
|
|
18
18
|
/** 一行用途说明(人工 description 或 generatedDescription) */
|
|
19
19
|
description?: string;
|
|
20
|
+
/** description 的生成方(信任分级 human > llm > heuristic);仅自动描述时存在 */
|
|
21
|
+
descriptionSource?: 'human' | 'llm' | 'heuristic';
|
|
20
22
|
/** global | project | session */
|
|
21
23
|
scopeLevel?: string;
|
|
22
24
|
/** 规模粗标,如 "~1.2k files" / "small" */
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* KnowledgeClient — Gateway 侧 RPC(不打开 knowledge.db)
|
|
3
3
|
*/
|
|
4
|
+
import type { KnowledgeSourceKind } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* run 归属租户断言提供者(T3b):run 内 = run 租户(DEFAULT 兜底,fail-closed);
|
|
7
|
+
* run 外 = 不断言(宿主面,broker 全量语义)。实例级挂载,防逐方法漏传断言。
|
|
8
|
+
*/
|
|
9
|
+
export declare function runTenantClaimProvider(): () => string | undefined;
|
|
4
10
|
export interface KnowledgeClientOptions {
|
|
5
11
|
baseUrl: string;
|
|
6
12
|
token: string;
|
|
@@ -17,7 +23,15 @@ export interface KnowledgeClientOptions {
|
|
|
17
23
|
}
|
|
18
24
|
export declare class KnowledgeClient {
|
|
19
25
|
private readonly opts;
|
|
26
|
+
/** 实例级租户断言提供者(T3b):逐方法 opts 缺省时取用——防新增方法漏传断言的结构性漂移 */
|
|
27
|
+
private tenantProvider?;
|
|
20
28
|
constructor(opts: KnowledgeClientOptions);
|
|
29
|
+
/**
|
|
30
|
+
* 设置实例级租户断言提供者(调用时刻求值;逐方法 opts.tenantId 优先)。
|
|
31
|
+
*
|
|
32
|
+
* @param provider - 返回断言租户;undefined = 不断言(宿主面)
|
|
33
|
+
*/
|
|
34
|
+
setTenantProvider(provider: () => string | undefined): void;
|
|
21
35
|
get baseUrl(): string;
|
|
22
36
|
get token(): string;
|
|
23
37
|
private request;
|
|
@@ -36,9 +50,17 @@ export declare class KnowledgeClient {
|
|
|
36
50
|
projectKey?: string;
|
|
37
51
|
sessionId?: string;
|
|
38
52
|
}): Promise<Array<Record<string, unknown>>>;
|
|
39
|
-
createSource(input: Record<string, unknown
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
createSource(input: Record<string, unknown>, opts?: {
|
|
54
|
+
tenantId?: string;
|
|
55
|
+
}): Promise<Record<string, unknown>>;
|
|
56
|
+
/** 单项目登记行(含归属域/可见性;管理面域继承用)。未登记/不可见 → null */
|
|
57
|
+
getProject(projectKey: string): Promise<Record<string, unknown> | null>;
|
|
58
|
+
patchSource(sourceId: string, patch: Record<string, unknown>, opts?: {
|
|
59
|
+
tenantId?: string;
|
|
60
|
+
}): Promise<Record<string, unknown>>;
|
|
61
|
+
deleteSource(sourceId: string, opts?: {
|
|
62
|
+
tenantId?: string;
|
|
63
|
+
}): Promise<unknown>;
|
|
42
64
|
reindex(sourceId: string): Promise<unknown>;
|
|
43
65
|
/** 按路径 / 筛选强制重解析(中止态自动 resume) */
|
|
44
66
|
reprocess(sourceId: string, opts: {
|
|
@@ -58,6 +80,7 @@ export declare class KnowledgeClient {
|
|
|
58
80
|
search(agentId: string, q: string, opts?: {
|
|
59
81
|
sessionId?: string;
|
|
60
82
|
limit?: number;
|
|
83
|
+
tenantId?: string;
|
|
61
84
|
}): Promise<{
|
|
62
85
|
hits: unknown[];
|
|
63
86
|
keywordHits: number;
|
|
@@ -67,6 +90,7 @@ export declare class KnowledgeClient {
|
|
|
67
90
|
autoGround(agentId: string, q: string, opts?: {
|
|
68
91
|
sessionId?: string;
|
|
69
92
|
limit?: number;
|
|
93
|
+
tenantId?: string;
|
|
70
94
|
recall?: 'off' | 'hint' | 'hybrid' | 'inject';
|
|
71
95
|
}): Promise<{
|
|
72
96
|
mode: 'inject' | 'hint' | 'none';
|
|
@@ -86,7 +110,7 @@ export declare class KnowledgeClient {
|
|
|
86
110
|
projectKey: string;
|
|
87
111
|
displayName?: string;
|
|
88
112
|
visibility?: string;
|
|
89
|
-
}): Promise<Record<string, unknown>>;
|
|
113
|
+
}, tenantId?: string): Promise<Record<string, unknown>>;
|
|
90
114
|
deleteProject(projectKey: string): Promise<unknown>;
|
|
91
115
|
getSource(sourceId: string): Promise<Record<string, unknown>>;
|
|
92
116
|
/** 中止源任务;省略 sourceId = 中止本 Gateway 全部源 */
|
|
@@ -115,13 +139,38 @@ export declare class KnowledgeClient {
|
|
|
115
139
|
n: number;
|
|
116
140
|
}>;
|
|
117
141
|
}>;
|
|
118
|
-
catalog(agentId: string
|
|
119
|
-
|
|
120
|
-
|
|
142
|
+
catalog(agentId: string, opts?: {
|
|
143
|
+
tenantId?: string;
|
|
144
|
+
}): Promise<unknown[]>;
|
|
145
|
+
promotionCandidates(opts?: {
|
|
146
|
+
minSessions?: number;
|
|
147
|
+
minHits?: number;
|
|
148
|
+
}): Promise<unknown[]>;
|
|
149
|
+
describeSource(sourceId: string, input?: {
|
|
150
|
+
description: string;
|
|
151
|
+
source?: 'llm' | 'heuristic';
|
|
152
|
+
}): Promise<{
|
|
121
153
|
generatedDescription: string;
|
|
122
154
|
source: string;
|
|
123
155
|
}>;
|
|
124
|
-
|
|
156
|
+
/** B 方案取素材(Service 侧密钥扫描把关;blocked=true 时无 sample) */
|
|
157
|
+
getDescribeSample(sourceId: string): Promise<{
|
|
158
|
+
blocked: false;
|
|
159
|
+
meta: {
|
|
160
|
+
displayName: string;
|
|
161
|
+
kind: KnowledgeSourceKind;
|
|
162
|
+
location: string;
|
|
163
|
+
};
|
|
164
|
+
sample: string;
|
|
165
|
+
} | {
|
|
166
|
+
blocked: true;
|
|
167
|
+
secretHits: string[];
|
|
168
|
+
}>;
|
|
169
|
+
/** 待 LLM 升级的源 id(boot sweep 用) */
|
|
170
|
+
listDescribePending(): Promise<string[]>;
|
|
171
|
+
listChunks(agentId: string, sourceId: string, path: string, opts?: {
|
|
172
|
+
tenantId?: string;
|
|
173
|
+
}): Promise<Array<{
|
|
125
174
|
id: string;
|
|
126
175
|
text: string;
|
|
127
176
|
startLine: number;
|
|
@@ -133,6 +182,8 @@ export declare class KnowledgeClient {
|
|
|
133
182
|
chunkId?: string;
|
|
134
183
|
sourceId?: string;
|
|
135
184
|
path?: string;
|
|
185
|
+
}, opts?: {
|
|
186
|
+
tenantId?: string;
|
|
136
187
|
}): Promise<{
|
|
137
188
|
found: boolean;
|
|
138
189
|
path?: string;
|
|
@@ -141,16 +192,31 @@ export declare class KnowledgeClient {
|
|
|
141
192
|
text?: string;
|
|
142
193
|
chunkCount?: number;
|
|
143
194
|
}>;
|
|
195
|
+
/** 租户断言头(T3,arch/multi-tenancy.md §6):token=platform 时上行 run 归属域 */
|
|
196
|
+
private tenantHeaders;
|
|
144
197
|
getVisibility(agentId: string): Promise<{
|
|
145
198
|
assignedProjects: string[];
|
|
146
199
|
hiddenSourceIds: string[];
|
|
147
200
|
}>;
|
|
148
201
|
sessionVisibility(agentId: string, sessionId: string): Promise<Array<Record<string, unknown>>>;
|
|
202
|
+
/**
|
|
203
|
+
* agent 级可见性 override(T3b 挂载物化):op=mount|unmount|hide|unhide。
|
|
204
|
+
*
|
|
205
|
+
* @param agentId - 消费 agent
|
|
206
|
+
* @param op - override 操作
|
|
207
|
+
* @param sourceId - 目标知识源
|
|
208
|
+
* @param opts - 租户断言(token=platform 时上行归属域)
|
|
209
|
+
*/
|
|
210
|
+
setAgentVisibility(agentId: string, op: 'mount' | 'unmount' | 'hide' | 'unhide', sourceId: string, opts?: {
|
|
211
|
+
tenantId?: string;
|
|
212
|
+
}): Promise<unknown>;
|
|
149
213
|
setSessionVisibility(agentId: string, item: {
|
|
150
214
|
sessionId: string;
|
|
151
215
|
targetType: 'project' | 'source';
|
|
152
216
|
targetId: string;
|
|
153
217
|
op: 'include' | 'exclude';
|
|
218
|
+
}, opts?: {
|
|
219
|
+
tenantId?: string;
|
|
154
220
|
}): Promise<unknown>;
|
|
155
221
|
replaceSessionVisibility(agentId: string, sessionId: string, items: Array<{
|
|
156
222
|
targetType: 'project' | 'source';
|
|
@@ -160,7 +226,9 @@ export declare class KnowledgeClient {
|
|
|
160
226
|
clearSessionVisibility(agentId: string, sessionId: string, target?: {
|
|
161
227
|
targetType: 'project' | 'source';
|
|
162
228
|
targetId: string;
|
|
163
|
-
}
|
|
229
|
+
}, opts?: {
|
|
230
|
+
tenantId?: string;
|
|
231
|
+
}, op?: 'include' | 'exclude'): Promise<unknown>;
|
|
164
232
|
jobControl(sourceId: string): Promise<{
|
|
165
233
|
aborted: boolean;
|
|
166
234
|
jobsQueued: number;
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* KnowledgeClient — Gateway 侧 RPC(不打开 knowledge.db)
|
|
3
3
|
*/
|
|
4
|
+
import { DEFAULT_TENANT_ID } from '@octopi-agent/core/types.js';
|
|
5
|
+
import { getRunScope } from '../run/run-scope.js';
|
|
6
|
+
/**
|
|
7
|
+
* run 归属租户断言提供者(T3b):run 内 = run 租户(DEFAULT 兜底,fail-closed);
|
|
8
|
+
* run 外 = 不断言(宿主面,broker 全量语义)。实例级挂载,防逐方法漏传断言。
|
|
9
|
+
*/
|
|
10
|
+
export function runTenantClaimProvider() {
|
|
11
|
+
return () => {
|
|
12
|
+
const scope = getRunScope();
|
|
13
|
+
if (!scope)
|
|
14
|
+
return undefined;
|
|
15
|
+
return scope.principal?.tenantId ?? DEFAULT_TENANT_ID;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
4
18
|
export class KnowledgeClient {
|
|
5
19
|
opts;
|
|
20
|
+
/** 实例级租户断言提供者(T3b):逐方法 opts 缺省时取用——防新增方法漏传断言的结构性漂移 */
|
|
21
|
+
tenantProvider;
|
|
6
22
|
constructor(opts) {
|
|
7
23
|
this.opts = opts;
|
|
8
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* 设置实例级租户断言提供者(调用时刻求值;逐方法 opts.tenantId 优先)。
|
|
27
|
+
*
|
|
28
|
+
* @param provider - 返回断言租户;undefined = 不断言(宿主面)
|
|
29
|
+
*/
|
|
30
|
+
setTenantProvider(provider) {
|
|
31
|
+
this.tenantProvider = provider;
|
|
32
|
+
}
|
|
9
33
|
get baseUrl() {
|
|
10
34
|
return this.opts.baseUrl;
|
|
11
35
|
}
|
|
@@ -27,6 +51,9 @@ export class KnowledgeClient {
|
|
|
27
51
|
headers: {
|
|
28
52
|
authorization: `Bearer ${this.opts.token}`,
|
|
29
53
|
...(body != null ? { 'content-type': 'application/json' } : {}),
|
|
54
|
+
// 租户断言单点收口(T3b):实例级 provider 兜底,逐方法显式断言优先——
|
|
55
|
+
// 新增方法不传 opts 也自动带 run 归属,防漏传漂移
|
|
56
|
+
...(this.tenantHeaders(undefined) ?? {}),
|
|
30
57
|
...headers,
|
|
31
58
|
},
|
|
32
59
|
body: body != null ? JSON.stringify(body) : undefined,
|
|
@@ -72,14 +99,23 @@ export class KnowledgeClient {
|
|
|
72
99
|
read: true,
|
|
73
100
|
});
|
|
74
101
|
}
|
|
75
|
-
createSource(input) {
|
|
76
|
-
return this.request('POST', '/v1/sources', input);
|
|
102
|
+
createSource(input, opts) {
|
|
103
|
+
return this.request('POST', '/v1/sources', input, this.tenantHeaders(opts?.tenantId));
|
|
77
104
|
}
|
|
78
|
-
|
|
79
|
-
|
|
105
|
+
/** 单项目登记行(含归属域/可见性;管理面域继承用)。未登记/不可见 → null */
|
|
106
|
+
async getProject(projectKey) {
|
|
107
|
+
try {
|
|
108
|
+
return await this.request('GET', `/v1/projects/${encodeURIComponent(projectKey)}`, undefined, undefined, { read: true });
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
80
113
|
}
|
|
81
|
-
|
|
82
|
-
return this.request('
|
|
114
|
+
patchSource(sourceId, patch, opts) {
|
|
115
|
+
return this.request('PATCH', `/v1/sources/${encodeURIComponent(sourceId)}`, patch, this.tenantHeaders(opts?.tenantId));
|
|
116
|
+
}
|
|
117
|
+
deleteSource(sourceId, opts) {
|
|
118
|
+
return this.request('DELETE', `/v1/sources/${encodeURIComponent(sourceId)}`, undefined, this.tenantHeaders(opts?.tenantId));
|
|
83
119
|
}
|
|
84
120
|
reindex(sourceId) {
|
|
85
121
|
return this.request('POST', `/v1/sources/${encodeURIComponent(sourceId)}/reindex`);
|
|
@@ -94,7 +130,7 @@ export class KnowledgeClient {
|
|
|
94
130
|
qs.set('sessionId', opts.sessionId);
|
|
95
131
|
if (opts?.limit != null)
|
|
96
132
|
qs.set('limit', String(opts.limit));
|
|
97
|
-
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/search?${qs}`, undefined,
|
|
133
|
+
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/search?${qs}`, undefined, this.tenantHeaders(opts?.tenantId), { read: true });
|
|
98
134
|
}
|
|
99
135
|
/** turn 级自动召回分档(与 Search Worker `autoGround` 同源) */
|
|
100
136
|
autoGround(agentId, q, opts) {
|
|
@@ -105,7 +141,7 @@ export class KnowledgeClient {
|
|
|
105
141
|
qs.set('limit', String(opts.limit));
|
|
106
142
|
if (opts?.recall)
|
|
107
143
|
qs.set('recall', opts.recall);
|
|
108
|
-
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/ground?${qs}`, undefined,
|
|
144
|
+
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/ground?${qs}`, undefined, this.tenantHeaders(opts?.tenantId), { read: true });
|
|
109
145
|
}
|
|
110
146
|
stats(agentId) {
|
|
111
147
|
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/stats`, undefined, undefined, { read: true });
|
|
@@ -119,8 +155,9 @@ export class KnowledgeClient {
|
|
|
119
155
|
listProjects() {
|
|
120
156
|
return this.request('GET', '/v1/projects');
|
|
121
157
|
}
|
|
122
|
-
createProject(input) {
|
|
123
|
-
|
|
158
|
+
createProject(input, tenantId) {
|
|
159
|
+
// 显式 tenantId = 租户断言(如公共项目断言 'platform' 落共享面);缺省走实例 provider
|
|
160
|
+
return this.request('POST', '/v1/projects', input, this.tenantHeaders(tenantId));
|
|
124
161
|
}
|
|
125
162
|
deleteProject(projectKey) {
|
|
126
163
|
return this.request('DELETE', `/v1/projects/${encodeURIComponent(projectKey)}`);
|
|
@@ -158,21 +195,40 @@ export class KnowledgeClient {
|
|
|
158
195
|
const s = qs.toString();
|
|
159
196
|
return this.request('GET', `/v1/sources/${encodeURIComponent(sourceId)}/files${s ? `?${s}` : ''}`, undefined, undefined, { read: true });
|
|
160
197
|
}
|
|
161
|
-
catalog(agentId) {
|
|
162
|
-
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/catalog`, undefined,
|
|
198
|
+
catalog(agentId, opts) {
|
|
199
|
+
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/catalog`, undefined, this.tenantHeaders(opts?.tenantId), { read: true });
|
|
200
|
+
}
|
|
201
|
+
promotionCandidates(opts) {
|
|
202
|
+
const qs = new URLSearchParams();
|
|
203
|
+
if (opts?.minSessions != null)
|
|
204
|
+
qs.set('minSessions', String(opts.minSessions));
|
|
205
|
+
if (opts?.minHits != null)
|
|
206
|
+
qs.set('minHits', String(opts.minHits));
|
|
207
|
+
const search = qs.toString();
|
|
208
|
+
return this.request('GET', `/v1/promotion-candidates${search ? `?${search}` : ''}`, undefined, undefined, { read: true });
|
|
209
|
+
}
|
|
210
|
+
describeSource(sourceId, input) {
|
|
211
|
+
return this.request('POST', `/v1/sources/${encodeURIComponent(sourceId)}/describe`, input);
|
|
163
212
|
}
|
|
164
|
-
|
|
165
|
-
|
|
213
|
+
/** B 方案取素材(Service 侧密钥扫描把关;blocked=true 时无 sample) */
|
|
214
|
+
getDescribeSample(sourceId) {
|
|
215
|
+
return this.request('GET', `/v1/sources/${encodeURIComponent(sourceId)}/describe-sample`, undefined, undefined, { read: true });
|
|
166
216
|
}
|
|
167
|
-
|
|
168
|
-
|
|
217
|
+
/** 待 LLM 升级的源 id(boot sweep 用) */
|
|
218
|
+
listDescribePending() {
|
|
219
|
+
return this.request('GET', '/v1/describe-pending', undefined, undefined, { read: true });
|
|
169
220
|
}
|
|
170
|
-
listChunks(agentId, sourceId, path) {
|
|
221
|
+
listChunks(agentId, sourceId, path, opts) {
|
|
171
222
|
const qs = new URLSearchParams({ sourceId, path });
|
|
172
|
-
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/chunks?${qs}`, undefined,
|
|
223
|
+
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/chunks?${qs}`, undefined, this.tenantHeaders(opts?.tenantId), { read: true });
|
|
224
|
+
}
|
|
225
|
+
read(agentId, body, opts) {
|
|
226
|
+
return this.request('POST', `/v1/principals/${encodeURIComponent(agentId)}/read`, body, this.tenantHeaders(opts?.tenantId));
|
|
173
227
|
}
|
|
174
|
-
|
|
175
|
-
|
|
228
|
+
/** 租户断言头(T3,arch/multi-tenancy.md §6):token=platform 时上行 run 归属域 */
|
|
229
|
+
tenantHeaders(tenantId) {
|
|
230
|
+
const t = tenantId ?? this.tenantProvider?.();
|
|
231
|
+
return t ? { 'x-octopi-tenant': t } : undefined;
|
|
176
232
|
}
|
|
177
233
|
getVisibility(agentId) {
|
|
178
234
|
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/visibility`, undefined, undefined, { read: true });
|
|
@@ -180,8 +236,19 @@ export class KnowledgeClient {
|
|
|
180
236
|
sessionVisibility(agentId, sessionId) {
|
|
181
237
|
return this.request('GET', `/v1/principals/${encodeURIComponent(agentId)}/session-visibility?sessionId=${encodeURIComponent(sessionId)}`, undefined, undefined, { read: true });
|
|
182
238
|
}
|
|
183
|
-
|
|
184
|
-
|
|
239
|
+
/**
|
|
240
|
+
* agent 级可见性 override(T3b 挂载物化):op=mount|unmount|hide|unhide。
|
|
241
|
+
*
|
|
242
|
+
* @param agentId - 消费 agent
|
|
243
|
+
* @param op - override 操作
|
|
244
|
+
* @param sourceId - 目标知识源
|
|
245
|
+
* @param opts - 租户断言(token=platform 时上行归属域)
|
|
246
|
+
*/
|
|
247
|
+
setAgentVisibility(agentId, op, sourceId, opts) {
|
|
248
|
+
return this.request('POST', `/v1/principals/${encodeURIComponent(agentId)}/visibility`, { op, sourceId }, this.tenantHeaders(opts?.tenantId));
|
|
249
|
+
}
|
|
250
|
+
setSessionVisibility(agentId, item, opts) {
|
|
251
|
+
return this.request('POST', `/v1/principals/${encodeURIComponent(agentId)}/session-visibility`, item, this.tenantHeaders(opts?.tenantId));
|
|
185
252
|
}
|
|
186
253
|
replaceSessionVisibility(agentId, sessionId, items) {
|
|
187
254
|
return this.request('PUT', `/v1/principals/${encodeURIComponent(agentId)}/session-visibility`, {
|
|
@@ -189,13 +256,15 @@ export class KnowledgeClient {
|
|
|
189
256
|
items,
|
|
190
257
|
});
|
|
191
258
|
}
|
|
192
|
-
clearSessionVisibility(agentId, sessionId, target) {
|
|
259
|
+
clearSessionVisibility(agentId, sessionId, target, opts, op) {
|
|
193
260
|
const qs = new URLSearchParams({ sessionId });
|
|
194
261
|
if (target?.targetType && target?.targetId) {
|
|
195
262
|
qs.set('targetType', target.targetType);
|
|
196
263
|
qs.set('targetId', target.targetId);
|
|
197
264
|
}
|
|
198
|
-
|
|
265
|
+
if (op)
|
|
266
|
+
qs.set('op', op);
|
|
267
|
+
return this.request('DELETE', `/v1/principals/${encodeURIComponent(agentId)}/session-visibility?${qs}`, undefined, this.tenantHeaders(opts?.tenantId));
|
|
199
268
|
}
|
|
200
269
|
jobControl(sourceId) {
|
|
201
270
|
return this.request('GET', `/v1/jobs/control?sourceId=${encodeURIComponent(sourceId)}`, undefined, undefined, { read: true });
|
|
@@ -231,6 +300,8 @@ export class ClientKnowledgeGrounding {
|
|
|
231
300
|
return (await this.client.autoGround(opts.agentId, query, {
|
|
232
301
|
...(opts.sessionId != null ? { sessionId: opts.sessionId } : {}),
|
|
233
302
|
...(opts.limit != null ? { limit: opts.limit } : {}),
|
|
303
|
+
// 租户断言(T3):run 归属域上行,服务端按 token 域包含校验
|
|
304
|
+
...(opts.tenantId != null ? { tenantId: opts.tenantId } : {}),
|
|
234
305
|
...(recall ? { recall } : {}),
|
|
235
306
|
}));
|
|
236
307
|
}
|
|
@@ -12,6 +12,7 @@ export interface KnowledgeDatabaseOptions {
|
|
|
12
12
|
/** 尝试加载 sqlite-vec(默认 true;失败则 JS 余弦);可指定扩展路径 */
|
|
13
13
|
sqliteVec?: boolean | {
|
|
14
14
|
extensionPath?: string;
|
|
15
|
+
require?: boolean;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* 只读打开(Query Worker / Engine 残留短读):跳过 DDL/升列,不抢写锁。
|
|
@@ -41,6 +42,13 @@ export declare class KnowledgeDatabase {
|
|
|
41
42
|
* (含 tenant/gateway),否则 ON CONFLICT(tenant_id, project_key) 会炸。
|
|
42
43
|
*/
|
|
43
44
|
private rebuildLegacyProjectTables;
|
|
45
|
+
/**
|
|
46
|
+
* knowledge_agent_hidden → knowledge_agent_visibility(T3b:hidden 泛化为 include|exclude,
|
|
47
|
+
* 挂载=include、隐藏=exclude,(agent, source) 单 op 无优先级歧义)。旧行以 op='exclude' 迁入。
|
|
48
|
+
* 幂等(评审 MIN):hidden 在即迁——两表并存(回滚→再升级)也必收编,不因 visibility 已在而静默丢行。
|
|
49
|
+
* 必须在 backfillLegacyAgentColumns 之后跑(legacy 行的 local_agent_id 已回填)。
|
|
50
|
+
*/
|
|
51
|
+
private migrateAgentHiddenToVisibility;
|
|
44
52
|
/** 旧列 agent_id / session_id → local_* 回填(best-effort) */
|
|
45
53
|
private backfillLegacyAgentColumns;
|
|
46
54
|
/**
|
|
@@ -62,4 +70,12 @@ export declare class KnowledgeDatabase {
|
|
|
62
70
|
get raw(): DatabaseSync;
|
|
63
71
|
close(): void;
|
|
64
72
|
stats(): Record<string, number>;
|
|
73
|
+
/**
|
|
74
|
+
* 本视图口径统计(principalStats,评审 m7 拍板 B):只对给定的可见源集合计数。
|
|
75
|
+
* 与 {@link stats} 的全库口径有意区分——全库口径属运维面(doctor/ops),等运维功能
|
|
76
|
+
* 落地后再回接;现阶段 UI 一律本视图,避免「统计有数、列表为空」式误读。
|
|
77
|
+
*
|
|
78
|
+
* @param ids 可见源 id 集合(空集 = 全 0)
|
|
79
|
+
*/
|
|
80
|
+
statsForSourceIds(ids: string[]): Record<string, number>;
|
|
65
81
|
}
|