@octopi-agent/engine 0.65.0 → 0.86.38
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/LICENSE +201 -201
- package/NOTICE +7 -7
- package/README.md +64 -26
- package/dist/config-schema/agent.d.ts +89 -1
- package/dist/config-schema/agent.js +69 -0
- package/dist/config-schema/context.d.ts +23 -4
- package/dist/config-schema/context.js +28 -1
- package/dist/config-schema/engine.d.ts +285 -9
- package/dist/config-schema/engine.js +35 -3
- package/dist/config-schema/governance.d.ts +95 -0
- package/dist/config-schema/governance.js +91 -0
- package/dist/config-schema/models.d.ts +1 -1
- package/dist/config-schema/observability.d.ts +6 -0
- package/dist/config-schema/observability.js +16 -0
- package/dist/config-schema/run.d.ts +10 -0
- package/dist/config-schema/run.js +18 -0
- package/dist/config-schema/shared.d.ts +10 -0
- package/dist/config-schema/shared.js +10 -0
- package/dist/config-schema/substrate.d.ts +87 -1
- package/dist/config-schema/substrate.js +114 -0
- package/dist/config-schema/subsystems.d.ts +1 -1
- package/dist/config-schema/subsystems.js +2 -1
- package/dist/config.d.ts +249 -7
- package/dist/config.js +113 -3
- package/dist/harness/activation/compiler.js +3 -0
- package/dist/harness/activation/runtime.d.ts +7 -0
- package/dist/harness/activation/runtime.js +60 -2
- package/dist/harness/activation/sources/agent-signal.d.ts +11 -0
- package/dist/harness/activation/sources/agent-signal.js +33 -0
- package/dist/harness/activation/types.d.ts +6 -1
- package/dist/harness/agent/builder.d.ts +48 -4
- package/dist/harness/agent/builder.js +206 -55
- package/dist/harness/agent/config-bridge.d.ts +33 -25
- package/dist/harness/agent/config-bridge.js +83 -280
- package/dist/harness/agent/index.d.ts +3 -1
- package/dist/harness/agent/index.js +2 -1
- package/dist/harness/agent/tool-purpose.d.ts +38 -0
- package/dist/harness/agent/tool-purpose.js +118 -0
- package/dist/harness/agent/wire-agent-builder.d.ts +133 -0
- package/dist/harness/agent/wire-agent-builder.js +363 -0
- package/dist/harness/collaboration/autonomous-subsystem/runtime.d.ts +4 -1
- package/dist/harness/collaboration/autonomous-subsystem/runtime.js +14 -8
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.d.ts +12 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.js +19 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.d.ts +6 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.js +24 -7
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.d.ts +5 -2
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +11 -3
- package/dist/harness/collaboration/autonomous-subsystem/think/index.d.ts +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/index.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.d.ts +7 -4
- package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.js +8 -9
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.d.ts +36 -10
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.js +60 -7
- package/dist/harness/collaboration/delegation/child-run.d.ts +144 -0
- package/dist/harness/collaboration/delegation/child-run.js +241 -0
- package/dist/harness/collaboration/delegation/index.d.ts +26 -0
- package/dist/harness/collaboration/delegation/index.js +25 -0
- package/dist/harness/collaboration/delegation/notifier.d.ts +46 -0
- package/dist/harness/collaboration/delegation/notifier.js +84 -0
- package/dist/harness/collaboration/delegation/registry-types.d.ts +200 -0
- package/dist/harness/collaboration/delegation/registry-types.js +61 -0
- package/dist/harness/collaboration/delegation/registry.d.ts +110 -0
- package/dist/harness/collaboration/delegation/registry.js +220 -0
- package/dist/harness/collaboration/delegation/service.d.ts +249 -0
- package/dist/harness/collaboration/delegation/service.js +499 -0
- package/dist/harness/collaboration/delegation/store.d.ts +155 -0
- package/dist/harness/collaboration/delegation/store.js +271 -0
- package/dist/harness/collaboration/delegation/transport.d.ts +73 -0
- package/dist/harness/collaboration/delegation/transport.js +61 -0
- package/dist/harness/collaboration/delegation/types.d.ts +231 -0
- package/dist/harness/collaboration/delegation/types.js +70 -0
- package/dist/harness/collaboration/delegation/wiring.d.ts +111 -0
- package/dist/harness/collaboration/delegation/wiring.js +145 -0
- package/dist/harness/collaboration/orchestration/index.d.ts +11 -13
- package/dist/harness/collaboration/orchestration/index.js +11 -11
- package/dist/harness/context/assembler.d.ts +2 -2
- package/dist/harness/context/assembler.js +12 -7
- package/dist/harness/context/capabilities/compact/engine.js +80 -38
- package/dist/harness/context/capabilities/compact/types.d.ts +12 -1
- package/dist/harness/context/capabilities/summary/gate.js +2 -2
- package/dist/harness/context/capabilities/summary/policies.js +5 -5
- package/dist/harness/context/capabilities/summary/registry.js +39 -24
- package/dist/harness/context/constitution/default-agents.md +230 -228
- package/dist/harness/context/default-context-engine.d.ts +101 -23
- package/dist/harness/context/default-context-engine.js +483 -172
- package/dist/harness/context/hybrid-compressor.d.ts +3 -3
- package/dist/harness/context/hybrid-compressor.js +18 -23
- package/dist/harness/context/index.d.ts +5 -1
- package/dist/harness/context/index.js +2 -0
- package/dist/harness/context/layer-health.js +3 -2
- package/dist/harness/context/layer-snapshot.d.ts +4 -0
- package/dist/harness/context/layer-snapshot.js +30 -18
- package/dist/harness/context/layer-types.d.ts +49 -1
- package/dist/harness/context/layer-types.js +72 -4
- package/dist/harness/context/layers.d.ts +32 -15
- package/dist/harness/context/layers.js +87 -71
- package/dist/harness/context/llm-summarizer.d.ts +15 -1
- package/dist/harness/context/llm-summarizer.js +107 -56
- package/dist/harness/context/message-selector.js +6 -2
- package/dist/harness/context/root-instructions.d.ts +72 -0
- package/dist/harness/context/root-instructions.js +227 -0
- package/dist/harness/context/runtime-datetime.d.ts +34 -7
- package/dist/harness/context/runtime-datetime.js +66 -10
- package/dist/harness/context/smart-router.d.ts +1 -1
- package/dist/harness/context/smart-router.js +1 -1
- package/dist/harness/context/system-prompt-assembler.d.ts +33 -0
- package/dist/harness/context/system-prompt-assembler.js +78 -7
- package/dist/harness/context/token-constants.d.ts +2 -2
- package/dist/harness/context/token-constants.js +2 -2
- package/dist/harness/context/token-estimate-fns.d.ts +1 -3
- package/dist/harness/context/token-estimate-fns.js +2 -4
- package/dist/harness/context/token-estimator.d.ts +1 -1
- package/dist/harness/context/token-estimator.js +14 -6
- package/dist/harness/context/tool-result-aging.d.ts +140 -0
- package/dist/harness/context/tool-result-aging.js +331 -0
- package/dist/harness/context/tool-result-body.d.ts +10 -0
- package/dist/harness/context/tool-result-body.js +27 -0
- package/dist/harness/context/turn-envelope.d.ts +123 -0
- package/dist/harness/context/turn-envelope.js +188 -0
- package/dist/harness/context/types.d.ts +35 -47
- package/dist/harness/extension/execution-environment/effect-policy.d.ts +248 -0
- package/dist/harness/extension/execution-environment/effect-policy.js +334 -0
- package/dist/harness/extension/execution-environment/index.d.ts +18 -2
- package/dist/harness/extension/execution-environment/index.js +11 -2
- package/dist/harness/extension/execution-environment/memory-undo.d.ts +101 -0
- package/dist/harness/extension/execution-environment/memory-undo.js +192 -0
- package/dist/harness/extension/execution-environment/process-isolation.d.ts +84 -0
- package/dist/harness/extension/execution-environment/process-isolation.js +315 -0
- package/dist/harness/extension/execution-environment/resource-limits.d.ts +36 -0
- package/dist/harness/extension/execution-environment/resource-limits.js +84 -0
- package/dist/harness/extension/execution-environment/sandbox.d.ts +125 -4
- package/dist/harness/extension/execution-environment/sandbox.js +493 -51
- package/dist/harness/extension/execution-environment/shell-journal.d.ts +100 -0
- package/dist/harness/extension/execution-environment/shell-journal.js +299 -0
- package/dist/harness/extension/execution-environment/tool-capabilities.d.ts +45 -0
- package/dist/harness/extension/execution-environment/tool-capabilities.js +126 -0
- package/dist/harness/extension/execution-environment/types.d.ts +67 -39
- package/dist/harness/extension/execution-environment/types.js +2 -2
- package/dist/harness/extension/execution-environment/undo-log.d.ts +203 -0
- package/dist/harness/extension/execution-environment/undo-log.js +627 -0
- package/dist/harness/extension/execution-environment/undo-merge.d.ts +40 -0
- package/dist/harness/extension/execution-environment/undo-merge.js +167 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/index.d.ts +4 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/index.js +3 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/invoke.d.ts +56 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/invoke.js +281 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.d.ts +98 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.js +250 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/stream.d.ts +124 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/stream.js +372 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/types.d.ts +118 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/types.js +8 -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/mcp/bridge.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/api.d.ts +1 -6
- package/dist/harness/extension/plugin-ecosystem/plugins/api.js +3 -8
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.d.ts +0 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.js +0 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.d.ts +2 -10
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.js +2 -9
- package/dist/harness/extension/plugin-ecosystem/plugins/index.d.ts +1 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/index.js +1 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.d.ts +2 -4
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.js +4 -21
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.d.ts +3 -9
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.js +4 -8
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.d.ts +1 -4
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.js +1 -3
- package/dist/harness/extension/plugin-ecosystem/skills/manager.d.ts +1 -1
- package/dist/harness/extension/plugin-ecosystem/skills/manager.js +1 -1
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.d.ts +45 -0
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.js +136 -0
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.d.ts +18 -3
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +278 -82
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.d.ts +31 -0
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.js +291 -0
- package/dist/harness/extension/plugin-ecosystem/tools/document-tools.js +10 -2
- package/dist/harness/extension/plugin-ecosystem/tools/env-info.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/tools/eol.d.ts +35 -0
- package/dist/harness/extension/plugin-ecosystem/tools/eol.js +43 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-edit.js +40 -9
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.d.ts +33 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.js +376 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.d.ts +12 -2
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.js +239 -61
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.d.ts +27 -0
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.js +554 -0
- package/dist/harness/extension/plugin-ecosystem/tools/http.d.ts +10 -6
- package/dist/harness/extension/plugin-ecosystem/tools/http.js +41 -47
- package/dist/harness/extension/plugin-ecosystem/tools/index.d.ts +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/index.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/knowledge.js +4 -0
- package/dist/harness/extension/plugin-ecosystem/tools/memory.d.ts +11 -1
- package/dist/harness/extension/plugin-ecosystem/tools/memory.js +39 -1
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.d.ts +13 -0
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.js +391 -0
- package/dist/harness/extension/plugin-ecosystem/tools/platform.d.ts +51 -2
- package/dist/harness/extension/plugin-ecosystem/tools/platform.js +151 -12
- package/dist/harness/extension/plugin-ecosystem/tools/session-history.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.d.ts +10 -1
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.js +35 -19
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.d.ts +8 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.js +5 -0
- package/dist/harness/extension/plugin-ecosystem/tools/web-search.js +1 -0
- package/dist/harness/governance/credentials/index.d.ts +1 -1
- package/dist/harness/governance/credentials/store.d.ts +16 -4
- package/dist/harness/governance/credentials/store.js +33 -6
- package/dist/harness/governance/credentials/types.d.ts +11 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.d.ts +105 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.js +184 -0
- package/dist/harness/governance/human-in-the-loop/index.d.ts +5 -5
- package/dist/harness/governance/human-in-the-loop/index.js +3 -3
- package/dist/harness/governance/human-in-the-loop/types.d.ts +7 -62
- package/dist/harness/governance/human-in-the-loop/types.js +6 -2
- package/dist/harness/governance/security/capability-enforcer.d.ts +9 -1
- package/dist/harness/governance/security/capability-enforcer.js +31 -8
- package/dist/harness/governance/security/degradation.js +5 -7
- package/dist/harness/governance/security/risk-evaluator.d.ts +1 -1
- package/dist/harness/governance/security/risk-evaluator.js +4 -82
- package/dist/harness/governance/security/temp-path.d.ts +41 -0
- package/dist/harness/governance/security/temp-path.js +117 -0
- package/dist/harness/governance/session-acl/index.d.ts +1 -0
- package/dist/harness/governance/session-acl/index.js +1 -0
- package/dist/harness/governance/session-acl/rights.d.ts +12 -0
- package/dist/harness/governance/session-acl/rights.js +89 -7
- package/dist/harness/governance/session-acl/seed-roles.js +9 -1
- package/dist/harness/governance/session-acl/service.js +21 -29
- package/dist/harness/governance/session-acl/tool-rights.d.ts +81 -0
- package/dist/harness/governance/session-acl/tool-rights.js +238 -0
- package/dist/harness/governance/session-acl/types.d.ts +22 -0
- package/dist/harness/index.d.ts +18 -15
- package/dist/harness/index.js +11 -7
- package/dist/harness/knowledge/file-index-store.js +11 -11
- package/dist/harness/knowledge/grounding.d.ts +2 -1
- package/dist/harness/knowledge/grounding.js +6 -3
- package/dist/harness/knowledge/index.d.ts +2 -2
- package/dist/harness/knowledge/index.js +1 -1
- package/dist/harness/knowledge/ingest.js +4 -1
- package/dist/harness/knowledge/job-control-state.js +4 -4
- package/dist/harness/knowledge/job-control.js +11 -11
- package/dist/harness/knowledge/membership-store.js +11 -11
- package/dist/harness/knowledge/network-guard.d.ts +61 -4
- package/dist/harness/knowledge/network-guard.js +390 -113
- package/dist/harness/knowledge/query-service.js +8 -8
- package/dist/harness/knowledge/retriever.js +1 -1
- package/dist/harness/knowledge/source-store.d.ts +17 -2
- package/dist/harness/knowledge/source-store.js +6 -5
- package/dist/harness/knowledge/writer-service.d.ts +2 -0
- package/dist/harness/knowledge/writer-service.js +14 -13
- package/dist/harness/memory/backfill-trigger.d.ts +2 -2
- package/dist/harness/memory/backfill-trigger.js +4 -4
- package/dist/harness/memory/cognition-decay.d.ts +36 -0
- package/dist/harness/memory/cognition-decay.js +55 -0
- package/dist/harness/memory/cognition-gates.d.ts +60 -0
- package/dist/harness/memory/cognition-gates.js +191 -0
- package/dist/harness/memory/cognition-trigger.d.ts +30 -0
- package/dist/harness/memory/cognition-trigger.js +41 -0
- package/dist/harness/memory/cognition-types.d.ts +1 -1
- package/dist/harness/memory/cognition.d.ts +40 -8
- package/dist/harness/memory/cognition.js +432 -79
- package/dist/harness/memory/conceptualizer.d.ts +66 -0
- package/dist/harness/memory/conceptualizer.js +246 -0
- package/dist/harness/memory/index.d.ts +17 -2
- package/dist/harness/memory/index.js +12 -1
- package/dist/harness/memory/sqlite/agent-db.d.ts +9 -0
- package/dist/harness/memory/sqlite/agent-db.js +120 -15
- package/dist/harness/memory/sqlite/cognition-store.d.ts +55 -16
- package/dist/harness/memory/sqlite/cognition-store.js +591 -144
- package/dist/harness/memory/sqlite/memory-store.d.ts +1 -0
- package/dist/harness/memory/sqlite/memory-store.js +14 -4
- package/dist/harness/memory/sqlite/wisdom-store.d.ts +33 -14
- package/dist/harness/memory/sqlite/wisdom-store.js +257 -44
- package/dist/harness/memory/store.d.ts +1 -0
- package/dist/harness/memory/store.js +3 -0
- package/dist/harness/memory/time-format.d.ts +28 -0
- package/dist/harness/memory/time-format.js +52 -0
- package/dist/harness/memory/types.d.ts +343 -16
- package/dist/harness/memory/types.js +49 -0
- package/dist/harness/memory/wisdom-formation.d.ts +101 -0
- package/dist/harness/memory/wisdom-formation.js +304 -0
- package/dist/harness/memory/wisdom-gates.d.ts +50 -0
- package/dist/harness/memory/wisdom-gates.js +204 -0
- package/dist/harness/memory/wisdom-policy.d.ts +107 -0
- package/dist/harness/memory/wisdom-policy.js +220 -0
- package/dist/harness/memory/wisdom-types.d.ts +3 -2
- package/dist/harness/memory/wisdom-types.js +2 -2
- package/dist/harness/memory/wisdom.d.ts +27 -0
- package/dist/harness/memory/wisdom.js +181 -0
- package/dist/harness/observability/observer/hub.js +23 -1
- package/dist/harness/observability/observer/index.d.ts +2 -2
- package/dist/harness/observability/observer/index.js +1 -1
- package/dist/harness/observability/observer/types.d.ts +57 -0
- package/dist/harness/observability/observer/types.js +118 -9
- package/dist/harness/run/agent/agent.d.ts +27 -0
- package/dist/harness/run/agent/agent.js +45 -0
- package/dist/harness/run/concurrency/tool-loop-detection-core.d.ts +1 -1
- package/dist/harness/run/concurrency/tool-loop-detection-core.js +1 -1
- package/dist/harness/run/reliability/harness-events.d.ts +4 -0
- package/dist/harness/run/reliability/run-agent.js +116 -20
- package/dist/harness/run/reliability/run-metrics-collector.d.ts +28 -2
- package/dist/harness/run/reliability/run-metrics-collector.js +92 -2
- package/dist/harness/run/run-guard/default-run-guard.d.ts +0 -5
- package/dist/harness/run/run-guard/default-run-guard.js +104 -44
- package/dist/harness/run/run-scope.d.ts +52 -0
- package/dist/harness/run/runner.d.ts +101 -16
- package/dist/harness/run/runner.js +557 -158
- package/dist/harness/session/attachments/llm-intent.js +17 -17
- package/dist/harness/session/history/port.js +1 -0
- package/dist/harness/session/in-memory-store.d.ts +1 -0
- package/dist/harness/session/in-memory-store.js +22 -1
- package/dist/harness/session/index.d.ts +1 -0
- package/dist/harness/session/index.js +1 -0
- package/dist/harness/session/schedules/index.d.ts +10 -0
- package/dist/harness/session/schedules/index.js +10 -0
- package/dist/harness/session/schedules/render.d.ts +13 -0
- package/dist/harness/session/schedules/render.js +63 -0
- package/dist/harness/session/schedules/service.d.ts +179 -0
- package/dist/harness/session/schedules/service.js +695 -0
- package/dist/harness/session/schedules/store.d.ts +119 -0
- package/dist/harness/session/schedules/store.js +323 -0
- package/dist/harness/session/schedules/tools.d.ts +39 -0
- package/dist/harness/session/schedules/tools.js +442 -0
- package/dist/harness/session/schedules/types.d.ts +104 -0
- package/dist/harness/session/schedules/types.js +97 -0
- package/dist/harness/session/tasks/tools.js +22 -0
- package/dist/harness/session/title.d.ts +86 -0
- package/dist/harness/session/title.js +268 -0
- package/dist/harness/session/types.d.ts +35 -0
- package/dist/harness/shared/events/agent-event-map.d.ts +21 -0
- package/dist/harness/shared/events/agent-event-map.js +1 -0
- package/dist/harness/shared/types/agent-definition.d.ts +23 -0
- package/dist/index.d.ts +25 -9
- package/dist/index.js +11 -2
- package/dist/integration/providers/anthropic.d.ts +10 -0
- package/dist/integration/providers/anthropic.js +44 -1
- package/dist/integration/providers/openai.d.ts +10 -0
- package/dist/integration/providers/openai.js +58 -2
- package/dist/integration/providers/wire-dump-diff.d.ts +191 -0
- package/dist/integration/providers/wire-dump-diff.js +351 -0
- package/dist/integration/providers/wire-dump.d.ts +178 -0
- package/dist/integration/providers/wire-dump.js +396 -0
- package/dist/integration/storage/jsonl.d.ts +11 -0
- package/dist/integration/storage/jsonl.js +148 -39
- package/dist/integration/storage/session-index.js +63 -8
- package/dist/subsystems/cognition-steward/conceptualize/SUBSYSTEM.md +43 -0
- package/dist/subsystems/cognition-steward/conceptualize/config.yaml +50 -0
- package/dist/subsystems/cognition-steward/conceptualize/handler.d.ts +9 -0
- package/dist/subsystems/cognition-steward/conceptualize/handler.js +125 -0
- package/dist/subsystems/cognition-steward/consolidate/SUBSYSTEM.md +6 -0
- package/dist/subsystems/cognition-steward/consolidate/config.yaml +54 -0
- package/dist/subsystems/cognition-steward/consolidate/handler.d.ts +12 -0
- package/dist/subsystems/cognition-steward/consolidate/handler.js +93 -0
- package/dist/subsystems/memory-steward/backfill/handler.js +9 -0
- package/dist/subsystems/wisdom-steward/evaluate/config.yaml +50 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.d.ts +18 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.js +91 -0
- package/dist/subsystems/wisdom-steward/formation/SUBSYSTEM.md +42 -0
- package/dist/subsystems/wisdom-steward/formation/config.yaml +54 -0
- package/dist/subsystems/wisdom-steward/formation/handler.d.ts +18 -0
- package/dist/subsystems/wisdom-steward/formation/handler.js +212 -0
- package/dist/subsystems/wisdom-steward/govern/config.yaml +55 -0
- package/dist/subsystems/wisdom-steward/govern/handler.d.ts +17 -0
- package/dist/subsystems/wisdom-steward/govern/handler.js +68 -0
- package/package.json +115 -115
- package/dist/harness/collaboration/multi-agent/agent-registry-types.d.ts +0 -144
- package/dist/harness/collaboration/multi-agent/agent-registry-types.js +0 -25
- package/dist/harness/collaboration/multi-agent/index.d.ts +0 -17
- package/dist/harness/collaboration/multi-agent/index.js +0 -15
- package/dist/harness/collaboration/multi-agent/process.d.ts +0 -167
- package/dist/harness/collaboration/multi-agent/process.js +0 -256
- package/dist/harness/collaboration/multi-agent/registry.d.ts +0 -36
- package/dist/harness/collaboration/multi-agent/registry.js +0 -137
- package/dist/harness/collaboration/multi-agent/swarm.d.ts +0 -135
- package/dist/harness/collaboration/multi-agent/swarm.js +0 -317
- package/dist/harness/collaboration/multi-agent/types.d.ts +0 -66
- package/dist/harness/collaboration/multi-agent/types.js +0 -15
- package/dist/harness/collaboration/orchestration/async-task-store.d.ts +0 -107
- package/dist/harness/collaboration/orchestration/async-task-store.js +0 -12
- package/dist/harness/collaboration/orchestration/async-task.d.ts +0 -156
- package/dist/harness/collaboration/orchestration/async-task.js +0 -359
- package/dist/harness/collaboration/orchestration/planner/hybrid-planner.d.ts +0 -47
- package/dist/harness/collaboration/orchestration/planner/hybrid-planner.js +0 -61
- package/dist/harness/collaboration/orchestration/planner/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/planner/index.js +0 -6
- package/dist/harness/collaboration/orchestration/planner/llm-planner.d.ts +0 -54
- package/dist/harness/collaboration/orchestration/planner/llm-planner.js +0 -167
- package/dist/harness/collaboration/orchestration/planner/rule-planner.d.ts +0 -85
- package/dist/harness/collaboration/orchestration/planner/rule-planner.js +0 -175
- package/dist/harness/collaboration/orchestration/quality/classifier.d.ts +0 -21
- package/dist/harness/collaboration/orchestration/quality/classifier.js +0 -235
- package/dist/harness/collaboration/orchestration/quality/gate.d.ts +0 -29
- package/dist/harness/collaboration/orchestration/quality/gate.js +0 -409
- package/dist/harness/collaboration/orchestration/quality/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/quality/index.js +0 -8
- package/dist/harness/collaboration/orchestration/quality/types.d.ts +0 -159
- package/dist/harness/collaboration/orchestration/quality/types.js +0 -33
- package/dist/harness/collaboration/orchestration/scheduler/index.d.ts +0 -5
- package/dist/harness/collaboration/orchestration/scheduler/index.js +0 -4
- package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.d.ts +0 -143
- package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.js +0 -297
- package/dist/harness/collaboration/orchestration/strategy/classifier.d.ts +0 -12
- package/dist/harness/collaboration/orchestration/strategy/classifier.js +0 -81
- package/dist/harness/collaboration/orchestration/strategy/index.d.ts +0 -3
- package/dist/harness/collaboration/orchestration/strategy/index.js +0 -2
- package/dist/harness/collaboration/orchestration/strategy/router.d.ts +0 -28
- package/dist/harness/collaboration/orchestration/strategy/router.js +0 -105
- package/dist/harness/collaboration/orchestration/strategy/types.d.ts +0 -49
- package/dist/harness/collaboration/orchestration/strategy/types.js +0 -4
- package/dist/harness/collaboration/orchestration/workflow/engine.d.ts +0 -86
- package/dist/harness/collaboration/orchestration/workflow/engine.js +0 -298
- package/dist/harness/collaboration/orchestration/workflow/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/workflow/index.js +0 -7
- package/dist/harness/collaboration/orchestration/workflow/types.d.ts +0 -143
- package/dist/harness/collaboration/orchestration/workflow/types.js +0 -7
- package/dist/harness/governance/human-in-the-loop/approval-manager.d.ts +0 -32
- package/dist/harness/governance/human-in-the-loop/approval-manager.js +0 -93
- /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.d.ts +0 -0
- /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.js +0 -0
|
@@ -44,6 +44,11 @@ export interface MemoryEntry {
|
|
|
44
44
|
evidence?: string;
|
|
45
45
|
/** 最近强化时间 */
|
|
46
46
|
reinforcedAt?: number;
|
|
47
|
+
/**
|
|
48
|
+
* 命题成立时刻(as-of)— 与 createdAt(入库时刻)区分。
|
|
49
|
+
* 时效敏感 fact 用:「3 月时版本是 1.2」≠「3 月写入了当前版本是 1.2」。
|
|
50
|
+
*/
|
|
51
|
+
asOf?: number;
|
|
47
52
|
/** 软删除 */
|
|
48
53
|
deleted?: boolean;
|
|
49
54
|
deletedAt?: number;
|
|
@@ -101,6 +106,11 @@ export interface MemoryStore {
|
|
|
101
106
|
winnerId?: string;
|
|
102
107
|
}): Promise<void>;
|
|
103
108
|
undelete(id: string): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* 按原 id 恢复整行(L3 undo / 硬删除逆放)。
|
|
111
|
+
* 与 store() 不同:不重新生成 id。
|
|
112
|
+
*/
|
|
113
|
+
importEntry(entry: MemoryEntry): Promise<void>;
|
|
104
114
|
/** 治理批量读取 */
|
|
105
115
|
listForGovern(filter?: {
|
|
106
116
|
includeDeleted?: boolean;
|
|
@@ -115,50 +125,365 @@ export interface MemoryStore {
|
|
|
115
125
|
}): Promise<number>;
|
|
116
126
|
stats(): Promise<MemoryStats>;
|
|
117
127
|
}
|
|
118
|
-
/**
|
|
128
|
+
/** 范式生命周期 */
|
|
129
|
+
export type WisdomStatus = 'candidate' | 'trial' | 'active' | 'strengthened' | 'contested' | 'retired' | 'superseded';
|
|
130
|
+
export declare const WISDOM_STATUSES: readonly WisdomStatus[];
|
|
131
|
+
/** 可注入状态(contested 默认不注入) */
|
|
132
|
+
export declare const WISDOM_INJECTABLE_STATUSES: readonly WisdomStatus[];
|
|
133
|
+
/** 写入来源 */
|
|
134
|
+
export type WisdomOrigin = 'factory' | 'distilled' | 'agent_write' | 'admin';
|
|
135
|
+
export declare const WISDOM_ORIGINS: readonly WisdomOrigin[];
|
|
136
|
+
/** 范式形态 */
|
|
137
|
+
export type WisdomKind = 'generalize' | 'corrective' | 'selection' | 'boundary';
|
|
138
|
+
export declare const WISDOM_KINDS: readonly WisdomKind[];
|
|
139
|
+
/** 软退休原因 */
|
|
140
|
+
export type WisdomRetireReason = 'capacity' | 'high_miss' | 'zero_apply' | 'superseded' | 'counterevidence' | 'admin';
|
|
141
|
+
/** 适用域 — 问题形态签名(非主题关键词堆) */
|
|
142
|
+
export interface WisdomScenario {
|
|
143
|
+
/** 问题形态(如「验证型宣称」「失败排查」) */
|
|
144
|
+
problemTypes: string[];
|
|
145
|
+
/** 触发线索(任务特征 / 领域 / 失败模式) */
|
|
146
|
+
signals?: string[];
|
|
147
|
+
/** 明确不适用 */
|
|
148
|
+
antiScenarios?: string[];
|
|
149
|
+
}
|
|
150
|
+
/** 操作效应 — 元认知可执行(禁止空壳格言) */
|
|
151
|
+
export interface WisdomEffect {
|
|
152
|
+
/** 推理时先问的问题 */
|
|
153
|
+
questions?: string[];
|
|
154
|
+
/** 要校准的偏见 */
|
|
155
|
+
biases?: string[];
|
|
156
|
+
/** 姿态简述 */
|
|
157
|
+
posture?: string;
|
|
158
|
+
}
|
|
159
|
+
/** 溯源 — MDL 多源压缩 */
|
|
160
|
+
export interface WisdomDerivation {
|
|
161
|
+
memoryIds: string[];
|
|
162
|
+
conceptIds?: string[];
|
|
163
|
+
sessionIds?: string[];
|
|
164
|
+
communityId?: string;
|
|
165
|
+
promotionBatchId?: string;
|
|
166
|
+
}
|
|
167
|
+
/** 反证登记(可错论) */
|
|
168
|
+
export interface WisdomCounterevidence {
|
|
169
|
+
ref: string;
|
|
170
|
+
note: string;
|
|
171
|
+
at: number;
|
|
172
|
+
weight: number;
|
|
173
|
+
}
|
|
174
|
+
/** 结局统计(弱归因线索,非因果证明) */
|
|
175
|
+
export interface WisdomOutcomes {
|
|
176
|
+
applied: number;
|
|
177
|
+
cited: number;
|
|
178
|
+
assisted: number;
|
|
179
|
+
contested: number;
|
|
180
|
+
lastAppliedAt?: number;
|
|
181
|
+
lastOutcomeAt?: number;
|
|
182
|
+
/** 置信度评估水位:已并入 confidence 的 assisted/contested 累计值(增量更新) */
|
|
183
|
+
evalAssisted?: number;
|
|
184
|
+
evalContested?: number;
|
|
185
|
+
}
|
|
186
|
+
/** 智慧条目 — 判断范式(maxim) */
|
|
119
187
|
export interface WisdomEntry {
|
|
120
188
|
id: string;
|
|
121
|
-
|
|
122
|
-
|
|
189
|
+
/** 核心范式陈述 */
|
|
190
|
+
statement: string;
|
|
191
|
+
rationale?: string;
|
|
192
|
+
scenario: WisdomScenario;
|
|
193
|
+
effect: WisdomEffect;
|
|
194
|
+
status: WisdomStatus;
|
|
195
|
+
confidence: number;
|
|
123
196
|
priority: number;
|
|
124
|
-
|
|
197
|
+
derivedFrom: WisdomDerivation;
|
|
198
|
+
exceptions?: string[];
|
|
199
|
+
counterevidence?: WisdomCounterevidence[];
|
|
200
|
+
outcomes: WisdomOutcomes;
|
|
201
|
+
origin: WisdomOrigin;
|
|
202
|
+
kind: WisdomKind;
|
|
203
|
+
supersededBy?: string;
|
|
125
204
|
createdAt: number;
|
|
126
|
-
|
|
205
|
+
updatedAt: number;
|
|
206
|
+
}
|
|
207
|
+
/** 出生门控 reason */
|
|
208
|
+
export type WisdomGateReason = 'ok' | 'empty_statement' | 'statement_too_long' | 'empty_problem_types' | 'empty_effect' | 'secret_like' | 'persona_overwrite' | 'insufficient_support' | 'duplicate_statement' | 'semantic_conflict' | 'capacity_admit_stop' | 'invalid_status' | 'invalid_origin' | 'invalid_kind' | 'missing_derived_from' | 'unknown_derived_id' | 'supersedes_target_missing';
|
|
209
|
+
export interface WisdomGateOutcome {
|
|
210
|
+
ok: boolean;
|
|
211
|
+
reason: WisdomGateReason;
|
|
212
|
+
message?: string;
|
|
213
|
+
}
|
|
214
|
+
/** admit 入口(代码执法;意图归 LLM) */
|
|
215
|
+
export interface AdmitWisdomInput {
|
|
216
|
+
statement: string;
|
|
217
|
+
rationale?: string;
|
|
218
|
+
scenario: WisdomScenario;
|
|
219
|
+
effect: WisdomEffect;
|
|
220
|
+
derivedFrom: WisdomDerivation;
|
|
221
|
+
kind: WisdomKind;
|
|
222
|
+
origin?: WisdomOrigin;
|
|
223
|
+
exceptions?: string[];
|
|
224
|
+
/** 显式取代既有条目 */
|
|
225
|
+
supersedesId?: string;
|
|
226
|
+
priority?: number;
|
|
227
|
+
confidence?: number;
|
|
228
|
+
/** factory / 显式 agent_write 可直达 active;distilled 一律 trial 起步 */
|
|
229
|
+
initialStatus?: WisdomStatus;
|
|
127
230
|
}
|
|
128
|
-
|
|
231
|
+
export type AdmitWisdomAction = 'created' | 'superseded' | 'rejected';
|
|
232
|
+
export interface AdmitWisdomResult {
|
|
233
|
+
action: AdmitWisdomAction;
|
|
234
|
+
id?: string;
|
|
235
|
+
reason?: WisdomGateReason;
|
|
236
|
+
message?: string;
|
|
237
|
+
}
|
|
238
|
+
/** 注入检索 */
|
|
239
|
+
export interface WisdomInjectQuery {
|
|
240
|
+
/** 本轮任务/查询文本(场景匹配) */
|
|
241
|
+
text?: string;
|
|
242
|
+
/** 小核心条数硬顶 */
|
|
243
|
+
coreMaxItems?: number;
|
|
244
|
+
/** 场景条数硬顶 */
|
|
245
|
+
scenarioMaxItems?: number;
|
|
246
|
+
/** 是否包含 trial(默认 false) */
|
|
247
|
+
includeTrial?: boolean;
|
|
248
|
+
}
|
|
249
|
+
export interface WisdomInjectPick {
|
|
250
|
+
entry: WisdomEntry;
|
|
251
|
+
/** core = 常备小核心;scenario = 本轮匹配 */
|
|
252
|
+
bucket: 'core' | 'scenario';
|
|
253
|
+
/** 场景匹配分(core 为 1) */
|
|
254
|
+
score: number;
|
|
255
|
+
}
|
|
256
|
+
export type WisdomOutcomeSignal = 'applied' | 'cited' | 'assisted' | 'contested' | 'ignored';
|
|
257
|
+
/** 结局观测窗口内的一次弱信号 */
|
|
258
|
+
export interface WisdomOutcomeEvent {
|
|
259
|
+
wisdomId: string;
|
|
260
|
+
signal: WisdomOutcomeSignal;
|
|
261
|
+
at?: number;
|
|
262
|
+
note?: string;
|
|
263
|
+
ref?: string;
|
|
264
|
+
}
|
|
265
|
+
export interface WisdomStats {
|
|
266
|
+
total: number;
|
|
267
|
+
byStatus: Record<WisdomStatus, number>;
|
|
268
|
+
avgConfidence: number;
|
|
269
|
+
avgPriority: number;
|
|
270
|
+
totalApplied: number;
|
|
271
|
+
totalContested: number;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* WisdomStore — 判断范式存储
|
|
275
|
+
*
|
|
276
|
+
* 写入只经 admit*(门控在 wisdom-gates)。检索主路径是 selectForInjection。
|
|
277
|
+
*/
|
|
129
278
|
export interface WisdomStore {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
279
|
+
readonly name: string;
|
|
280
|
+
admit(input: AdmitWisdomInput, options?: {
|
|
281
|
+
allowedMemoryIds?: ReadonlySet<string>;
|
|
282
|
+
}): Promise<AdmitWisdomResult>;
|
|
283
|
+
get(id: string): Promise<WisdomEntry | null>;
|
|
284
|
+
/** 注入选择:core + scenario(不含 retired/superseded/candidate) */
|
|
285
|
+
selectForInjection(query: WisdomInjectQuery): Promise<WisdomInjectPick[]>;
|
|
286
|
+
/** 治理全量读(含 contested;不含 superseded 链内容可另取) */
|
|
287
|
+
listForGovern(filter?: {
|
|
288
|
+
includeRetired?: boolean;
|
|
289
|
+
}): Promise<WisdomEntry[]>;
|
|
290
|
+
update(id: string, patch: Partial<WisdomEntry>): Promise<void>;
|
|
291
|
+
softRetire(id: string, meta: {
|
|
292
|
+
by: string;
|
|
293
|
+
reason: WisdomRetireReason | string;
|
|
294
|
+
}): Promise<void>;
|
|
295
|
+
/** 弱归因结局入账 */
|
|
296
|
+
recordOutcomes(events: WisdomOutcomeEvent[]): Promise<void>;
|
|
297
|
+
/** 注入命中轻量入账(S1 applied);不跑 confidence 规划 */
|
|
298
|
+
touchApplied(ids: string[]): Promise<void>;
|
|
299
|
+
stats(): Promise<WisdomStats>;
|
|
300
|
+
}
|
|
301
|
+
/** 概念种类 — 基本层级偏置 */
|
|
302
|
+
export type ConceptKind = 'entity' | 'construct' | 'method' | 'problem' | 'constraint';
|
|
303
|
+
export declare const CONCEPT_KINDS: readonly ConceptKind[];
|
|
304
|
+
/** 关系类型;`related` 为弱边(共现级) */
|
|
305
|
+
export type ConceptRelationType = 'causes' | 'part_of' | 'opposes' | 'similar_to' | 'evolves_to' | 'related';
|
|
306
|
+
export declare const CONCEPT_RELATION_TYPES: readonly ConceptRelationType[];
|
|
307
|
+
/** 强关系(需持证);`related` / `similar_to` 不在此列 */
|
|
308
|
+
export declare const STRONG_RELATION_TYPES: readonly ConceptRelationType[];
|
|
309
|
+
/** 概念/边运行时状态(与 Memory 对齐) */
|
|
310
|
+
export type ConceptStatus = 'shadow' | 'active' | 'strengthened';
|
|
311
|
+
/** 证据形态 — 持证件字段 */
|
|
312
|
+
export type EvidenceClass = 'causal' | 'mereonymy' | 'negation' | 'analogy' | 'evolution' | 'cooccur';
|
|
313
|
+
/** 边持证件:强边入库必填 */
|
|
314
|
+
export interface EdgeBasis {
|
|
315
|
+
/** 独立支撑命题 */
|
|
316
|
+
memoryIds: string[];
|
|
317
|
+
/** 证据中的原句片段(须 ⊆ evidence/contextSlice) */
|
|
318
|
+
cue: string;
|
|
319
|
+
evidenceClass: EvidenceClass;
|
|
320
|
+
licensedAt: number;
|
|
133
321
|
}
|
|
134
|
-
/**
|
|
322
|
+
/** 概念节点(义项,非词面) */
|
|
135
323
|
export interface ConceptNode {
|
|
136
324
|
id: string;
|
|
137
325
|
name: string;
|
|
326
|
+
kind: ConceptKind;
|
|
327
|
+
/** 原型描述(含论域) */
|
|
138
328
|
description?: string;
|
|
139
329
|
frequency: number;
|
|
140
330
|
memoryIds: string[];
|
|
331
|
+
/** 论域标签(义项指纹) */
|
|
332
|
+
domain: string[];
|
|
333
|
+
status: ConceptStatus;
|
|
334
|
+
embedding?: number[] | null;
|
|
335
|
+
createdAt: number;
|
|
336
|
+
updatedAt: number;
|
|
141
337
|
}
|
|
142
338
|
/** 概念关系 */
|
|
143
339
|
export interface ConceptEdge {
|
|
340
|
+
id: string;
|
|
144
341
|
sourceId: string;
|
|
145
342
|
targetId: string;
|
|
146
|
-
relationType:
|
|
343
|
+
relationType: ConceptRelationType;
|
|
147
344
|
strength: number;
|
|
148
345
|
description?: string;
|
|
346
|
+
status: ConceptStatus;
|
|
347
|
+
basis: EdgeBasis;
|
|
348
|
+
createdAt: number;
|
|
349
|
+
updatedAt: number;
|
|
149
350
|
}
|
|
150
351
|
/** 认知图谱 */
|
|
151
352
|
export interface ConceptGraph {
|
|
152
353
|
nodes: ConceptNode[];
|
|
153
354
|
edges: ConceptEdge[];
|
|
154
355
|
}
|
|
155
|
-
/**
|
|
356
|
+
/** 合并候选(近阈带 / 指纹可疑) */
|
|
357
|
+
export interface MergeCandidate {
|
|
358
|
+
id: string;
|
|
359
|
+
leftId: string;
|
|
360
|
+
rightId: string;
|
|
361
|
+
reason: string;
|
|
362
|
+
distance: number | null;
|
|
363
|
+
fingerprintDiff: string[];
|
|
364
|
+
status: 'open' | 'merged' | 'kept_split' | 'dropped';
|
|
365
|
+
createdAt: number;
|
|
366
|
+
resolvedAt?: number;
|
|
367
|
+
resolvedAction?: string;
|
|
368
|
+
}
|
|
369
|
+
/** `causal_candidate` 等旁路假设,不进慢图强边 */
|
|
370
|
+
export interface EdgeAux {
|
|
371
|
+
id: string;
|
|
372
|
+
edgeKey: string;
|
|
373
|
+
kind: 'causal_candidate';
|
|
374
|
+
memoryIds: string[];
|
|
375
|
+
cue: string;
|
|
376
|
+
note?: string;
|
|
377
|
+
createdAt: number;
|
|
378
|
+
}
|
|
379
|
+
export type AdmitConceptAction = 'created' | 'merged' | 'merge_candidate' | 'rejected';
|
|
380
|
+
export interface AdmitConceptResult {
|
|
381
|
+
action: AdmitConceptAction;
|
|
382
|
+
/** created / merged 时的节点 id */
|
|
383
|
+
id?: string;
|
|
384
|
+
/** merge_candidate 时的候选 id */
|
|
385
|
+
candidateId?: string;
|
|
386
|
+
reason?: ConceptGateReason;
|
|
387
|
+
message?: string;
|
|
388
|
+
}
|
|
389
|
+
export type AdmitEdgeAction = 'active' | 'shadow' | 'demoted' | 'rejected' | 'candidate_only';
|
|
390
|
+
export interface AdmitEdgeResult {
|
|
391
|
+
action: AdmitEdgeAction;
|
|
392
|
+
edgeId?: string;
|
|
393
|
+
/** demoted 时实际入库的关系类型 */
|
|
394
|
+
relationType?: ConceptRelationType;
|
|
395
|
+
reason?: ConceptGateReason;
|
|
396
|
+
message?: string;
|
|
397
|
+
}
|
|
398
|
+
export type ConceptGateReason = 'ok' | 'empty_name' | 'invalid_kind' | 'invalid_relation' | 'mdl_insufficient' | 'pseudo_concept' | 'secret_like' | 'budget_node' | 'budget_edge' | 'cue_mismatch' | 'multi_evidence_required' | 'cooccur_no_escalation' | 'demoted_related' | 'candidate_only' | 'fingerprint_conflict' | 'capacity_admit_stop' | 'no_context_slice';
|
|
399
|
+
export interface AdmitConceptInput {
|
|
400
|
+
name: string;
|
|
401
|
+
kind: ConceptKind;
|
|
402
|
+
description?: string;
|
|
403
|
+
domain?: string[];
|
|
404
|
+
memoryIds?: string[];
|
|
405
|
+
/** 提出该概念的命题条数(MDL);缺省用 memoryIds.length */
|
|
406
|
+
supportCount?: number;
|
|
407
|
+
}
|
|
408
|
+
export interface AdmitEdgeInput {
|
|
409
|
+
sourceId: string;
|
|
410
|
+
targetId: string;
|
|
411
|
+
relationType: ConceptRelationType;
|
|
412
|
+
strength: number;
|
|
413
|
+
description?: string;
|
|
414
|
+
basis: EdgeBasis;
|
|
415
|
+
/** 用于 cue 校验的证据/语境全文;缺省跳过 cue 子串校验(仅类型门控) */
|
|
416
|
+
evidenceText?: string;
|
|
417
|
+
}
|
|
418
|
+
export interface SpreadingActivateOptions {
|
|
419
|
+
/** BFS/扩散深度(默认 2) */
|
|
420
|
+
depth?: number;
|
|
421
|
+
/** 距离衰减(默认 0.55) */
|
|
422
|
+
delta?: number;
|
|
423
|
+
/** 激活地板(默认 0.08) */
|
|
424
|
+
tau?: number;
|
|
425
|
+
/** 节点上限(默认 40) */
|
|
426
|
+
limit?: number;
|
|
427
|
+
/** 仅这些 status(默认 active + strengthened) */
|
|
428
|
+
statuses?: ConceptStatus[];
|
|
429
|
+
}
|
|
430
|
+
export interface ActivatedGraph extends ConceptGraph {
|
|
431
|
+
/** nodeId → 激活值 */
|
|
432
|
+
activation: Record<string, number>;
|
|
433
|
+
seeds: string[];
|
|
434
|
+
}
|
|
435
|
+
export interface ConceptGraphStats {
|
|
436
|
+
nodes: number;
|
|
437
|
+
edges: number;
|
|
438
|
+
byStatus: Record<ConceptStatus, number>;
|
|
439
|
+
byKind: Record<ConceptKind, number>;
|
|
440
|
+
openMergeCandidates: number;
|
|
441
|
+
causalCandidates: number;
|
|
442
|
+
}
|
|
443
|
+
export interface DecayResult {
|
|
444
|
+
decayedEdges: number;
|
|
445
|
+
gcNodes: number;
|
|
446
|
+
gcEdges: number;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* ConceptGraphStore — 认知图谱存储
|
|
450
|
+
*
|
|
451
|
+
* 写入只经 admit*(门控在 layers 之上的 cognition-gates / conceptualizer)。
|
|
452
|
+
* 检索主路径是 spreadingActivate;getFullGraph 供巩固与 health。
|
|
453
|
+
*/
|
|
156
454
|
export interface ConceptGraphStore {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
455
|
+
admitConcept(input: AdmitConceptInput): Promise<AdmitConceptResult>;
|
|
456
|
+
admitEdge(input: AdmitEdgeInput): Promise<AdmitEdgeResult>;
|
|
457
|
+
/** 记录「假因果」假设,不进慢图 */
|
|
458
|
+
addCausalCandidate(input: {
|
|
459
|
+
sourceId: string;
|
|
460
|
+
targetId: string;
|
|
461
|
+
memoryIds: string[];
|
|
462
|
+
cue: string;
|
|
463
|
+
note?: string;
|
|
464
|
+
}): Promise<void>;
|
|
465
|
+
listMergeCandidates(limit?: number): Promise<MergeCandidate[]>;
|
|
466
|
+
resolveMerge(id: string, action: 'merge' | 'keep_split' | 'drop'): Promise<void>;
|
|
467
|
+
/** Hebbian 加强(使用痕迹 / 新证据) */
|
|
468
|
+
reinforce(input: {
|
|
469
|
+
nodeIds?: string[];
|
|
470
|
+
edgeIds?: string[];
|
|
471
|
+
/** 0–1 证据强度 */
|
|
472
|
+
evidenceStrength?: number;
|
|
473
|
+
}): Promise<void>;
|
|
474
|
+
/** 反证:降权或改型 */
|
|
475
|
+
counterEvidence(input: {
|
|
476
|
+
edgeId: string;
|
|
477
|
+
memoryId?: string;
|
|
478
|
+
/** 是否改标 opposes */
|
|
479
|
+
markOpposes?: boolean;
|
|
480
|
+
}): Promise<void>;
|
|
481
|
+
promote(ids: string[], to: 'active' | 'strengthened'): Promise<void>;
|
|
482
|
+
demote(ids: string[], to: 'shadow'): Promise<void>;
|
|
483
|
+
applyDecay(now?: number): Promise<DecayResult>;
|
|
484
|
+
spreadingActivate(seeds: string[], options?: SpreadingActivateOptions): Promise<ActivatedGraph>;
|
|
161
485
|
getFullGraph(): Promise<ConceptGraph>;
|
|
486
|
+
stats(): Promise<ConceptGraphStats>;
|
|
162
487
|
}
|
|
163
488
|
export interface MemoryWriteSlot {
|
|
164
489
|
type: MemoryType;
|
|
@@ -172,6 +497,8 @@ export interface MemoryWriteSlot {
|
|
|
172
497
|
channel: MemoryChannel;
|
|
173
498
|
importance?: number;
|
|
174
499
|
tags?: string[];
|
|
500
|
+
/** 命题成立时刻(epoch ms);时效敏感 fact 建议写入 */
|
|
501
|
+
asOf?: number;
|
|
175
502
|
}
|
|
176
503
|
/** 门控/置信度可调用的 store 入参 */
|
|
177
504
|
export type MemoryStoreInput = Omit<MemoryEntry, 'id' | 'accessCount' | 'lastAccessedAt' | 'createdAt' | 'decayFactor'>;
|
|
@@ -5,3 +5,52 @@
|
|
|
5
5
|
* 实现:InMemory* / Sqlite*(AgentDatabase)。非 Kernel。
|
|
6
6
|
*/
|
|
7
7
|
export const MEMORY_TYPES = ['fact', 'method', 'norm'];
|
|
8
|
+
export const WISDOM_STATUSES = [
|
|
9
|
+
'candidate',
|
|
10
|
+
'trial',
|
|
11
|
+
'active',
|
|
12
|
+
'strengthened',
|
|
13
|
+
'contested',
|
|
14
|
+
'retired',
|
|
15
|
+
'superseded',
|
|
16
|
+
];
|
|
17
|
+
/** 可注入状态(contested 默认不注入) */
|
|
18
|
+
export const WISDOM_INJECTABLE_STATUSES = [
|
|
19
|
+
'trial',
|
|
20
|
+
'active',
|
|
21
|
+
'strengthened',
|
|
22
|
+
];
|
|
23
|
+
export const WISDOM_ORIGINS = [
|
|
24
|
+
'factory',
|
|
25
|
+
'distilled',
|
|
26
|
+
'agent_write',
|
|
27
|
+
'admin',
|
|
28
|
+
];
|
|
29
|
+
export const WISDOM_KINDS = [
|
|
30
|
+
'generalize',
|
|
31
|
+
'corrective',
|
|
32
|
+
'selection',
|
|
33
|
+
'boundary',
|
|
34
|
+
];
|
|
35
|
+
export const CONCEPT_KINDS = [
|
|
36
|
+
'entity',
|
|
37
|
+
'construct',
|
|
38
|
+
'method',
|
|
39
|
+
'problem',
|
|
40
|
+
'constraint',
|
|
41
|
+
];
|
|
42
|
+
export const CONCEPT_RELATION_TYPES = [
|
|
43
|
+
'causes',
|
|
44
|
+
'part_of',
|
|
45
|
+
'opposes',
|
|
46
|
+
'similar_to',
|
|
47
|
+
'evolves_to',
|
|
48
|
+
'related',
|
|
49
|
+
];
|
|
50
|
+
/** 强关系(需持证);`related` / `similar_to` 不在此列 */
|
|
51
|
+
export const STRONG_RELATION_TYPES = [
|
|
52
|
+
'causes',
|
|
53
|
+
'part_of',
|
|
54
|
+
'opposes',
|
|
55
|
+
'evolves_to',
|
|
56
|
+
];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wisdom formation — 炼制解析、场景匹配、注入排版
|
|
3
|
+
*
|
|
4
|
+
* LLM 判「是不是范式、适用域」;本模块做结构解析 + admit 门控 + 关键词场景匹配。
|
|
5
|
+
* 禁止 session 全文 ETL。规范:arch/wisdom-layer-formation.md §6 / §9。
|
|
6
|
+
*
|
|
7
|
+
* @module harness/memory/wisdom-formation
|
|
8
|
+
*/
|
|
9
|
+
import type { AdmitWisdomInput, AdmitWisdomResult, WisdomEntry, WisdomInjectPick, WisdomKind, WisdomStore } from './types.js';
|
|
10
|
+
export interface RawWisdomFormationOutput {
|
|
11
|
+
items?: unknown;
|
|
12
|
+
droppedNotes?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface ParsedWisdomItem {
|
|
15
|
+
statement: string;
|
|
16
|
+
rationale?: string;
|
|
17
|
+
problemTypes: string[];
|
|
18
|
+
signals?: string[];
|
|
19
|
+
antiScenarios?: string[];
|
|
20
|
+
questions?: string[];
|
|
21
|
+
biases?: string[];
|
|
22
|
+
posture?: string;
|
|
23
|
+
memoryIds: string[];
|
|
24
|
+
conceptIds?: string[];
|
|
25
|
+
exceptions?: string[];
|
|
26
|
+
kind: WisdomKind;
|
|
27
|
+
}
|
|
28
|
+
export interface ParsedWisdomFormation {
|
|
29
|
+
items: ParsedWisdomItem[];
|
|
30
|
+
droppedNotes: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 从 LLM 文本提取 `{items, droppedNotes}`。
|
|
34
|
+
*
|
|
35
|
+
* @param text - LLM 输出
|
|
36
|
+
* @returns 解析结果或 null
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseWisdomFormationJson(text: string): RawWisdomFormationOutput | null;
|
|
39
|
+
/**
|
|
40
|
+
* 归一化 raw → 严格 Parsed(丢弃残缺项,不半写)。
|
|
41
|
+
*
|
|
42
|
+
* @param raw - 解析后的 JSON
|
|
43
|
+
* @returns 有效 items 与丢弃说明
|
|
44
|
+
*/
|
|
45
|
+
export declare function normalizeWisdomFormation(raw: RawWisdomFormationOutput): ParsedWisdomFormation;
|
|
46
|
+
/**
|
|
47
|
+
* Parsed → AdmitWisdomInput(distilled 默认)。
|
|
48
|
+
*
|
|
49
|
+
* @param item - 已归一项
|
|
50
|
+
* @param options - origin / supersedesId
|
|
51
|
+
* @returns admit 入参
|
|
52
|
+
*/
|
|
53
|
+
export declare function toAdmitWisdomInput(item: ParsedWisdomItem, options?: {
|
|
54
|
+
origin?: AdmitWisdomInput['origin'];
|
|
55
|
+
supersedesId?: string;
|
|
56
|
+
}): AdmitWisdomInput;
|
|
57
|
+
/**
|
|
58
|
+
* 炼制解析并逐条 admit。
|
|
59
|
+
*
|
|
60
|
+
* @param llmText - LLM 原文
|
|
61
|
+
* @param store - WisdomStore
|
|
62
|
+
* @param options - origin / maxItems
|
|
63
|
+
* @returns admit 结果与丢弃笔记
|
|
64
|
+
*/
|
|
65
|
+
export declare function formAndAdmit(llmText: string, store: WisdomStore, options?: {
|
|
66
|
+
origin?: AdmitWisdomInput['origin'];
|
|
67
|
+
maxItems?: number;
|
|
68
|
+
allowedMemoryIds?: ReadonlySet<string>;
|
|
69
|
+
dryRun?: boolean;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
results: AdmitWisdomResult[];
|
|
72
|
+
droppedNotes: string[];
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* 关键词/字面场景匹配分。
|
|
76
|
+
*
|
|
77
|
+
* @param entry - 条目
|
|
78
|
+
* @param text - 本轮查询/任务文本
|
|
79
|
+
* @returns [0,1];无命中为 0
|
|
80
|
+
*/
|
|
81
|
+
export declare function scenarioMatchScore(entry: WisdomEntry, text: string): number;
|
|
82
|
+
/**
|
|
83
|
+
* 选择注入集:小核心 + 场景匹配。
|
|
84
|
+
*
|
|
85
|
+
* @param entries - 可注入条目(store 已滤状态)
|
|
86
|
+
* @param text - 本轮文本
|
|
87
|
+
* @param options - 条数硬顶
|
|
88
|
+
* @returns 排序后的注入选择
|
|
89
|
+
*/
|
|
90
|
+
export declare function pickForInjection(entries: WisdomEntry[], text: string, options?: {
|
|
91
|
+
coreMaxItems?: number;
|
|
92
|
+
scenarioMaxItems?: number;
|
|
93
|
+
includeTrial?: boolean;
|
|
94
|
+
}): WisdomInjectPick[];
|
|
95
|
+
/**
|
|
96
|
+
* 按 problemTypes 分组渲染 system 片段(不含 # 思维框架 头,由 WisdomLayer 加)。
|
|
97
|
+
*
|
|
98
|
+
* @param picks - 注入选择
|
|
99
|
+
* @returns 正文
|
|
100
|
+
*/
|
|
101
|
+
export declare function formatWisdomBody(picks: WisdomInjectPick[]): string;
|