@haaaiawd/second-nature 0.1.43 → 0.1.50
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/HEARTBEAT.md +44 -0
- package/LICENSE +176 -0
- package/README.md +136 -0
- package/README.zh-CN.md +120 -0
- package/SKILL.md +320 -22
- package/dist/data/observability.db +0 -0
- package/dist/data/state.db +0 -0
- package/dist/plugin/index.d.ts +31 -0
- package/dist/plugin/workspace-ops-bridge.d.ts +15 -0
- package/dist/scripts/build-plugin-package.d.ts +12 -0
- package/dist/scripts/build-plugin-package.js +220 -0
- package/dist/scripts/build-plugin-runtime.d.ts +10 -0
- package/dist/scripts/build-plugin-runtime.js +198 -0
- package/dist/scripts/packaging-feasibility-poc.js +127 -0
- package/dist/scripts/plugin-smoke-check.js +124 -0
- package/dist/src/cli/action-bridge.d.ts +11 -0
- package/dist/src/cli/index.d.ts +65 -0
- package/dist/src/cli/ops/heartbeat-surface.d.ts +84 -0
- package/dist/src/cli/ops/heartbeat-surface.js +100 -0
- package/dist/src/cli/ops/ops-router.js +1482 -0
- package/dist/src/cli/ops/workspace-heartbeat-runner.d.ts +85 -0
- package/dist/src/cli/ops/workspace-heartbeat-runner.js +242 -0
- package/dist/src/core/second-nature/heartbeat/goal-lifecycle-policy.d.ts +24 -0
- package/dist/src/core/second-nature/heartbeat/goal-lifecycle-policy.js +61 -0
- package/dist/src/core/second-nature/heartbeat/heartbeat-loop.d.ts +97 -0
- package/dist/src/core/second-nature/heartbeat/heartbeat-loop.js +397 -0
- package/dist/src/core/second-nature/orchestrator/platform-capability-router.js +149 -0
- package/dist/src/storage/snapshots/types.js +1 -0
- package/dist/src/storage/user-interest/types.js +1 -0
- package/dist/tests/integration/cli/cli-ops-surface.test.d.ts +1 -0
- package/dist/tests/integration/cli/cli-ops-surface.test.js +380 -0
- package/dist/tests/integration/cli/heartbeat-surface-workspace.test.d.ts +1 -0
- package/dist/tests/integration/cli/heartbeat-surface-workspace.test.js +61 -0
- package/dist/tests/integration/cli/host-capability-probe.test.d.ts +1 -0
- package/dist/tests/integration/cli/host-capability-probe.test.js +37 -0
- package/dist/tests/integration/cli/host-smoke-heartbeat-tool.test.d.ts +1 -0
- package/dist/tests/integration/cli/host-smoke-heartbeat-tool.test.js +34 -0
- package/dist/tests/integration/cli/plugin-packaging-walkthrough.test.d.ts +1 -0
- package/dist/tests/integration/cli/plugin-packaging-walkthrough.test.js +79 -0
- package/dist/tests/integration/cli/plugin-runtime-registration.test.d.ts +1 -0
- package/dist/tests/integration/cli/plugin-runtime-registration.test.js +285 -0
- package/dist/tests/integration/cli/plugin-workspace-ops-bridge.test.d.ts +1 -0
- package/dist/tests/integration/cli/plugin-workspace-ops-bridge.test.js +487 -0
- package/dist/tests/integration/cli/t1-2-1-explain-read-models.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-1-explain-read-models.test.js +58 -0
- package/dist/tests/integration/cli/t1-2-1-narrative-command.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-1-narrative-command.test.js +194 -0
- package/dist/tests/integration/cli/t1-2-2-dream-recent.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-2-dream-recent.test.js +100 -0
- package/dist/tests/integration/cli/t1-2-3-status-observability-writeback.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-3-status-observability-writeback.test.js +71 -0
- package/dist/tests/integration/cli/t1-2-4-quiet-report-read-canonical.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-4-quiet-report-read-canonical.test.js +206 -0
- package/dist/tests/integration/cli/t1-2-5-cycle-recent.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-5-cycle-recent.test.js +156 -0
- package/dist/tests/integration/cli/t1-2-5-status-delivery-posture-audit-store.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-5-status-delivery-posture-audit-store.test.js +95 -0
- package/dist/tests/integration/cli/t1-2-6-policy-show-non-shell.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-6-policy-show-non-shell.test.js +74 -0
- package/dist/tests/integration/cli/t1-2-6-status-aggregate.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-6-status-aggregate.test.js +223 -0
- package/dist/tests/integration/cli/t1-2-7-audit-command-minimal-closure.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-7-audit-command-minimal-closure.test.js +101 -0
- package/dist/tests/integration/cli/t1-2-8-capability-probe-ops-surface.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-8-capability-probe-ops-surface.test.js +74 -0
- package/dist/tests/integration/cli/t1-2-9-decision-denied-not-degraded.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-2-9-decision-denied-not-degraded.test.js +79 -0
- package/dist/tests/integration/cli/t1-4-1-runtime-secret-bootstrap.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-4-1-runtime-secret-bootstrap.test.js +139 -0
- package/dist/tests/integration/cli/t1-4-2-activation-ux-contract.test.d.ts +1 -0
- package/dist/tests/integration/cli/t1-4-2-activation-ux-contract.test.js +143 -0
- package/dist/tests/integration/cli/t2-2-2-snapshot-life-evidence.test.d.ts +1 -0
- package/dist/tests/integration/cli/t2-2-2-snapshot-life-evidence.test.js +116 -0
- package/dist/tests/integration/cli/t3-3-2-near-real-smoke-cli-bridge.test.d.ts +1 -0
- package/dist/tests/integration/cli/t3-3-2-near-real-smoke-cli-bridge.test.js +69 -0
- package/dist/tests/integration/connectors/connector-base.test.d.ts +1 -0
- package/dist/tests/integration/connectors/connector-base.test.js +211 -0
- package/dist/tests/integration/connectors/connector-executor-adapter-honest-failure.test.d.ts +1 -0
- package/dist/tests/integration/connectors/connector-executor-adapter-honest-failure.test.js +311 -0
- package/dist/tests/integration/connectors/credential-optional-regression.test.d.ts +1 -0
- package/dist/tests/integration/connectors/credential-optional-regression.test.js +117 -0
- package/dist/tests/integration/connectors/declarative-http-runner.test.d.ts +7 -0
- package/dist/tests/integration/connectors/declarative-http-runner.test.js +229 -0
- package/dist/tests/integration/connectors/evomap-secret-port.test.d.ts +1 -0
- package/dist/tests/integration/connectors/evomap-secret-port.test.js +83 -0
- package/dist/tests/integration/connectors/life-evidence-chain.test.d.ts +1 -0
- package/dist/tests/integration/connectors/life-evidence-chain.test.js +188 -0
- package/dist/tests/integration/connectors/moltbook-client.test.d.ts +1 -0
- package/dist/tests/integration/connectors/moltbook-client.test.js +274 -0
- package/dist/tests/integration/connectors/moltbook-mock-runner.test.d.ts +7 -0
- package/dist/tests/integration/connectors/moltbook-mock-runner.test.js +108 -0
- package/dist/tests/integration/connectors/near-real-connector-smoke.test.d.ts +1 -0
- package/dist/tests/integration/connectors/near-real-connector-smoke.test.js +38 -0
- package/dist/tests/integration/connectors/platform-adapters.test.d.ts +1 -0
- package/dist/tests/integration/connectors/platform-adapters.test.js +189 -0
- package/dist/tests/integration/connectors/policy-layer.test.d.ts +1 -0
- package/dist/tests/integration/connectors/policy-layer.test.js +249 -0
- package/dist/tests/integration/connectors/scriptable-node-e2e.test.d.ts +1 -0
- package/dist/tests/integration/connectors/scriptable-node-e2e.test.js +228 -0
- package/dist/tests/integration/connectors/t3-3-1-real-connector-evidence.test.d.ts +1 -0
- package/dist/tests/integration/connectors/t3-3-1-real-connector-evidence.test.js +171 -0
- package/dist/tests/integration/control-plane/_helpers/decision-cycle-harness.d.ts +40 -0
- package/dist/tests/integration/control-plane/_helpers/decision-cycle-harness.js +116 -0
- package/dist/tests/integration/control-plane/decision-loop-validation.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/decision-loop-validation.test.js +319 -0
- package/dist/tests/integration/control-plane/delivery-failed-fallback.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/delivery-failed-fallback.test.js +118 -0
- package/dist/tests/integration/control-plane/dream-projection-heartbeat.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/dream-projection-heartbeat.test.js +109 -0
- package/dist/tests/integration/control-plane/effect-dispatcher.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/effect-dispatcher.test.js +157 -0
- package/dist/tests/integration/control-plane/guidance-request.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/guidance-request.test.js +63 -0
- package/dist/tests/integration/control-plane/heartbeat-executor.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/heartbeat-executor.test.js +363 -0
- package/dist/tests/integration/control-plane/heartbeat-loop.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/heartbeat-loop.test.js +190 -0
- package/dist/tests/integration/control-plane/heartbeat-quiet-orchestration.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/heartbeat-quiet-orchestration.test.js +133 -0
- package/dist/tests/integration/control-plane/heartbeat-spine-integration.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/heartbeat-spine-integration.test.js +342 -0
- package/dist/tests/integration/control-plane/heartbeat-spine.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/heartbeat-spine.test.js +216 -0
- package/dist/tests/integration/control-plane/int-s3-outreach-delivery-quiet-closure.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/int-s3-outreach-delivery-quiet-closure.test.js +241 -0
- package/dist/tests/integration/control-plane/outreach-resume.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/outreach-resume.test.js +158 -0
- package/dist/tests/integration/control-plane/outreach-style.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/outreach-style.test.js +46 -0
- package/dist/tests/integration/control-plane/quiet-reflection.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/quiet-reflection.test.js +73 -0
- package/dist/tests/integration/control-plane/rhythm-intent-guard.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/rhythm-intent-guard.test.js +99 -0
- package/dist/tests/integration/control-plane/run-heartbeat-cycle.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/run-heartbeat-cycle.test.js +80 -0
- package/dist/tests/integration/control-plane/t2-3-1-outreach-v6.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/t2-3-1-outreach-v6.test.js +208 -0
- package/dist/tests/integration/control-plane/t2-4-1-heartbeat-platform-intent.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/t2-4-1-heartbeat-platform-intent.test.js +156 -0
- package/dist/tests/integration/control-plane/t2-4-2-source-backed-outreach-loop.test.d.ts +1 -0
- package/dist/tests/integration/control-plane/t2-4-2-source-backed-outreach-loop.test.js +188 -0
- package/dist/tests/integration/control-plane/v7c-evidence-body-feedback.test.d.ts +11 -0
- package/dist/tests/integration/control-plane/v7c-evidence-body-feedback.test.js +213 -0
- package/dist/tests/integration/control-plane/v7c-heartbeat-unlock-e2e.test.d.ts +9 -0
- package/dist/tests/integration/control-plane/v7c-heartbeat-unlock-e2e.test.js +134 -0
- package/dist/tests/integration/dream/quiet-dream-trigger.test.d.ts +1 -0
- package/dist/tests/integration/dream/quiet-dream-trigger.test.js +86 -0
- package/dist/tests/integration/dream/t7-1-1-dream-pipeline.test.d.ts +1 -0
- package/dist/tests/integration/dream/t7-1-1-dream-pipeline.test.js +378 -0
- package/dist/tests/integration/dream/t7-1-2-dream-scheduler.test.d.ts +1 -0
- package/dist/tests/integration/dream/t7-1-2-dream-scheduler.test.js +124 -0
- package/dist/tests/integration/dream/v7c-rhythm-loop.test.d.ts +10 -0
- package/dist/tests/integration/dream/v7c-rhythm-loop.test.js +185 -0
- package/dist/tests/integration/guidance/assembler-and-fallback.test.d.ts +1 -0
- package/dist/tests/integration/guidance/assembler-and-fallback.test.js +86 -0
- package/dist/tests/integration/guidance/outreach-draft-contract.test.d.ts +1 -0
- package/dist/tests/integration/guidance/outreach-draft-contract.test.js +106 -0
- package/dist/tests/integration/guidance/persona-selection.test.d.ts +1 -0
- package/dist/tests/integration/guidance/persona-selection.test.js +70 -0
- package/dist/tests/integration/guidance/template-review.test.d.ts +1 -0
- package/dist/tests/integration/guidance/template-review.test.js +26 -0
- package/dist/tests/integration/guidance/user-reply-continuity.test.d.ts +1 -0
- package/dist/tests/integration/guidance/user-reply-continuity.test.js +96 -0
- package/dist/tests/integration/guidance/v7c-guidance-chain.test.d.ts +1 -0
- package/dist/tests/integration/guidance/v7c-guidance-chain.test.js +190 -0
- package/dist/tests/integration/guidance/v7c-guidance-semantics.test.d.ts +1 -0
- package/dist/tests/integration/guidance/v7c-guidance-semantics.test.js +146 -0
- package/dist/tests/integration/observability/digest-delivery.test.d.ts +14 -0
- package/dist/tests/integration/observability/digest-delivery.test.js +160 -0
- package/dist/tests/integration/observability/evidence-query-engine.test.d.ts +1 -0
- package/dist/tests/integration/observability/evidence-query-engine.test.js +219 -0
- package/dist/tests/integration/observability/explain-query-export.test.d.ts +1 -0
- package/dist/tests/integration/observability/explain-query-export.test.js +92 -0
- package/dist/tests/integration/observability/guidance-audit.test.d.ts +1 -0
- package/dist/tests/integration/observability/guidance-audit.test.js +55 -0
- package/dist/tests/integration/observability/heartbeat-decision-record.test.d.ts +1 -0
- package/dist/tests/integration/observability/heartbeat-decision-record.test.js +223 -0
- package/dist/tests/integration/observability/heartbeat-narrative-trace.test.d.ts +1 -0
- package/dist/tests/integration/observability/heartbeat-narrative-trace.test.js +230 -0
- package/dist/tests/integration/observability/lived-experience-audit-chain.test.d.ts +1 -0
- package/dist/tests/integration/observability/lived-experience-audit-chain.test.js +43 -0
- package/dist/tests/integration/observability/observability-gates.test.d.ts +1 -0
- package/dist/tests/integration/observability/observability-gates.test.js +224 -0
- package/dist/tests/integration/observability/observability-retention-cleanup.test.d.ts +1 -0
- package/dist/tests/integration/observability/observability-retention-cleanup.test.js +94 -0
- package/dist/tests/integration/observability/observability-services.test.d.ts +1 -0
- package/dist/tests/integration/observability/observability-services.test.js +219 -0
- package/dist/tests/integration/observability/projections.test.d.ts +1 -0
- package/dist/tests/integration/observability/projections.test.js +36 -0
- package/dist/tests/integration/observability/t5-1-1-dream-trace-audit.test.d.ts +1 -0
- package/dist/tests/integration/observability/t5-1-1-dream-trace-audit.test.js +115 -0
- package/dist/tests/integration/plugin/plugin-registration.test.d.ts +16 -0
- package/dist/tests/integration/plugin/plugin-registration.test.js +151 -0
- package/dist/tests/integration/runtime-ops/commands.test.d.ts +16 -0
- package/dist/tests/integration/runtime-ops/commands.test.js +662 -0
- package/dist/tests/integration/s3-exit/int-s3-body-heartbeat.test.d.ts +15 -0
- package/dist/tests/integration/s3-exit/int-s3-body-heartbeat.test.js +462 -0
- package/dist/tests/integration/s5-exit/int-s5-observability.test.d.ts +17 -0
- package/dist/tests/integration/s5-exit/int-s5-observability.test.js +402 -0
- package/dist/tests/integration/state/t4-2-1-owner-reply-relationship-loop.test.d.ts +1 -0
- package/dist/tests/integration/state/t4-2-1-owner-reply-relationship-loop.test.js +132 -0
- package/dist/tests/integration/state/v7c-identity-goal-hygiene.test.d.ts +9 -0
- package/dist/tests/integration/state/v7c-identity-goal-hygiene.test.js +240 -0
- package/dist/tests/integration/storage/packaged-runtime-smoke.test.d.ts +1 -0
- package/dist/tests/integration/storage/packaged-runtime-smoke.test.js +17 -0
- package/dist/tests/integration/storage/persona-candidate-loader.test.d.ts +1 -0
- package/dist/tests/integration/storage/persona-candidate-loader.test.js +23 -0
- package/dist/tests/integration/storage/quiet-artifact-writer.test.d.ts +1 -0
- package/dist/tests/integration/storage/quiet-artifact-writer.test.js +66 -0
- package/dist/tests/integration/storage/repair-and-backup.test.d.ts +1 -0
- package/dist/tests/integration/storage/repair-and-backup.test.js +125 -0
- package/dist/tests/integration/storage/schema-migration.test.d.ts +11 -0
- package/dist/tests/integration/storage/schema-migration.test.js +183 -0
- package/dist/tests/integration/storage/storage-mode-smoke.test.d.ts +1 -0
- package/dist/tests/integration/storage/storage-mode-smoke.test.js +18 -0
- package/dist/tests/integration/storage/t4-1-5-memory-store-lifecycle.test.d.ts +1 -0
- package/dist/tests/integration/storage/t4-1-5-memory-store-lifecycle.test.js +118 -0
- package/dist/tests/unit/body/affordance-assembler.test.d.ts +14 -0
- package/dist/tests/unit/body/affordance-assembler.test.js +259 -0
- package/dist/tests/unit/body/affordance-context-scope.test.d.ts +12 -0
- package/dist/tests/unit/body/affordance-context-scope.test.js +73 -0
- package/dist/tests/unit/body/behavior-promotion-loop.test.d.ts +15 -0
- package/dist/tests/unit/body/behavior-promotion-loop.test.js +130 -0
- package/dist/tests/unit/body/circuit-breaker-manager.test.d.ts +13 -0
- package/dist/tests/unit/body/circuit-breaker-manager.test.js +160 -0
- package/dist/tests/unit/body/experience-writer.test.d.ts +11 -0
- package/dist/tests/unit/body/experience-writer.test.js +77 -0
- package/dist/tests/unit/body/pain-signal-query.test.d.ts +11 -0
- package/dist/tests/unit/body/pain-signal-query.test.js +104 -0
- package/dist/tests/unit/cli/connector-init-manifest.test.d.ts +9 -0
- package/dist/tests/unit/cli/connector-init-manifest.test.js +68 -0
- package/dist/tests/unit/cli/delivery-target-probe.test.d.ts +1 -0
- package/dist/tests/unit/cli/delivery-target-probe.test.js +108 -0
- package/dist/tests/unit/cli/host-capability.test.d.ts +1 -0
- package/dist/tests/unit/cli/host-capability.test.js +50 -0
- package/dist/tests/unit/cli/operator-fallback-view.test.d.ts +1 -0
- package/dist/tests/unit/cli/operator-fallback-view.test.js +60 -0
- package/dist/tests/unit/cli/runtime-artifact-boundary.test.d.ts +1 -0
- package/dist/tests/unit/cli/runtime-artifact-boundary.test.js +57 -0
- package/dist/tests/unit/cli/t1-2-3-connector-status.test.d.ts +1 -0
- package/dist/tests/unit/cli/t1-2-3-connector-status.test.js +214 -0
- package/dist/tests/unit/cli/t1-2-4-goal-command.test.d.ts +1 -0
- package/dist/tests/unit/cli/t1-2-4-goal-command.test.js +207 -0
- package/dist/tests/unit/cli/t1-3-1-connector-init.test.d.ts +1 -0
- package/dist/tests/unit/cli/t1-3-1-connector-init.test.js +212 -0
- package/dist/tests/unit/connectors/connector-manifest-and-evidence-map.test.d.ts +1 -0
- package/dist/tests/unit/connectors/connector-manifest-and-evidence-map.test.js +71 -0
- package/dist/tests/unit/connectors/effect-commit-ledger-sqlite.test.d.ts +10 -0
- package/dist/tests/unit/connectors/effect-commit-ledger-sqlite.test.js +101 -0
- package/dist/tests/unit/connectors/evomap-runner.test.d.ts +1 -0
- package/dist/tests/unit/connectors/evomap-runner.test.js +136 -0
- package/dist/tests/unit/connectors/execution-policy.test.d.ts +1 -0
- package/dist/tests/unit/connectors/execution-policy.test.js +71 -0
- package/dist/tests/unit/connectors/instreet-registration.test.d.ts +1 -0
- package/dist/tests/unit/connectors/instreet-registration.test.js +102 -0
- package/dist/tests/unit/connectors/manifest-v7-schema.test.d.ts +9 -0
- package/dist/tests/unit/connectors/manifest-v7-schema.test.js +165 -0
- package/dist/tests/unit/connectors/scriptable-node-runner.test.d.ts +1 -0
- package/dist/tests/unit/connectors/scriptable-node-runner.test.js +246 -0
- package/dist/tests/unit/connectors/structured-unavailable-reason.test.d.ts +11 -0
- package/dist/tests/unit/connectors/structured-unavailable-reason.test.js +76 -0
- package/dist/tests/unit/connectors/t3-1-1-dynamic-registry.test.d.ts +1 -0
- package/dist/tests/unit/connectors/t3-1-1-dynamic-registry.test.js +178 -0
- package/dist/tests/unit/connectors/t3-1-2-capability-registry.test.d.ts +1 -0
- package/dist/tests/unit/connectors/t3-1-2-capability-registry.test.js +105 -0
- package/dist/tests/unit/connectors/t3-2-1-v5-parity.test.d.ts +1 -0
- package/dist/tests/unit/connectors/t3-2-1-v5-parity.test.js +103 -0
- package/dist/tests/unit/connectors/t3-3-1-evidence-mapper.test.d.ts +1 -0
- package/dist/tests/unit/connectors/t3-3-1-evidence-mapper.test.js +198 -0
- package/dist/tests/unit/connectors/t3-3-1-evidence-redaction.test.d.ts +1 -0
- package/dist/tests/unit/connectors/t3-3-1-evidence-redaction.test.js +95 -0
- package/dist/tests/unit/connectors/wet-probe-runner.test.d.ts +11 -0
- package/dist/tests/unit/connectors/wet-probe-runner.test.js +84 -0
- package/dist/tests/unit/control-plane/decision-trace-emitter.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/decision-trace-emitter.test.js +51 -0
- package/dist/tests/unit/control-plane/downstream-intent-orchestrator.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/downstream-intent-orchestrator.test.js +57 -0
- package/dist/tests/unit/control-plane/embodied-context-assembler.test.d.ts +13 -0
- package/dist/tests/unit/control-plane/embodied-context-assembler.test.js +182 -0
- package/dist/tests/unit/control-plane/goal-lifecycle-policy.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/goal-lifecycle-policy.test.js +75 -0
- package/dist/tests/unit/control-plane/hard-guard-evaluator.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/hard-guard-evaluator.test.js +113 -0
- package/dist/tests/unit/control-plane/idle-curiosity-policy.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/idle-curiosity-policy.test.js +69 -0
- package/dist/tests/unit/control-plane/intent-planner-source-ref-fallback.test.d.ts +7 -0
- package/dist/tests/unit/control-plane/intent-planner-source-ref-fallback.test.js +124 -0
- package/dist/tests/unit/control-plane/rhythm-policy-snapshot-window.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/rhythm-policy-snapshot-window.test.js +64 -0
- package/dist/tests/unit/control-plane/run-heartbeat-cycle-v7.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/run-heartbeat-cycle-v7.test.js +165 -0
- package/dist/tests/unit/control-plane/t2-1-4-goal-priority.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/t2-1-4-goal-priority.test.js +185 -0
- package/dist/tests/unit/control-plane/t2-1-5-narrative-update.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/t2-1-5-narrative-update.test.js +313 -0
- package/dist/tests/unit/control-plane/t2-4-1-credential-route.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/t2-4-1-credential-route.test.js +75 -0
- package/dist/tests/unit/control-plane/t2-4-1-platform-intent.test.d.ts +1 -0
- package/dist/tests/unit/control-plane/t2-4-1-platform-intent.test.js +168 -0
- package/dist/tests/unit/core/outreach-judgment.test.d.ts +1 -0
- package/dist/tests/unit/core/outreach-judgment.test.js +109 -0
- package/dist/tests/unit/core/resolve-allowed-intent.test.d.ts +1 -0
- package/dist/tests/unit/core/resolve-allowed-intent.test.js +69 -0
- package/dist/tests/unit/core/t2-2-3-connector-action-honest-result.test.d.ts +1 -0
- package/dist/tests/unit/core/t2-2-3-connector-action-honest-result.test.js +130 -0
- package/dist/tests/unit/core/t2-2-3-connector-dispatch-wired.test.d.ts +1 -0
- package/dist/tests/unit/core/t2-2-3-connector-dispatch-wired.test.js +99 -0
- package/dist/tests/unit/dream/dream-input-loader.test.d.ts +15 -0
- package/dist/tests/unit/dream/dream-input-loader.test.js +424 -0
- package/dist/tests/unit/dream/dream-scheduler.test.d.ts +1 -0
- package/dist/tests/unit/dream/dream-scheduler.test.js +57 -0
- package/dist/tests/unit/dream/t-dqs-c3-redacted-evidence.test.d.ts +11 -0
- package/dist/tests/unit/dream/t-dqs-c3-redacted-evidence.test.js +298 -0
- package/dist/tests/unit/dream/t7-1-3-insight-extraction.test.d.ts +1 -0
- package/dist/tests/unit/dream/t7-1-3-insight-extraction.test.js +79 -0
- package/dist/tests/unit/dream/t7-1-4-narrative-update.test.d.ts +1 -0
- package/dist/tests/unit/dream/t7-1-4-narrative-update.test.js +93 -0
- package/dist/tests/unit/dream/t7-1-5-relationship-update.test.d.ts +1 -0
- package/dist/tests/unit/dream/t7-1-5-relationship-update.test.js +116 -0
- package/dist/tests/unit/feedback/t4-2-1-owner-reply-inference.test.d.ts +1 -0
- package/dist/tests/unit/feedback/t4-2-1-owner-reply-inference.test.js +58 -0
- package/dist/tests/unit/guidance/capability-class.test.d.ts +1 -0
- package/dist/tests/unit/guidance/capability-class.test.js +96 -0
- package/dist/tests/unit/guidance/channel-feedback-ingestion.test.d.ts +1 -0
- package/dist/tests/unit/guidance/channel-feedback-ingestion.test.js +163 -0
- package/dist/tests/unit/guidance/evidence-guidance.test.d.ts +1 -0
- package/dist/tests/unit/guidance/evidence-guidance.test.js +40 -0
- package/dist/tests/unit/guidance/guidance-draft-service.test.d.ts +1 -0
- package/dist/tests/unit/guidance/guidance-draft-service.test.js +140 -0
- package/dist/tests/unit/guidance/impulse-assembler.test.d.ts +1 -0
- package/dist/tests/unit/guidance/impulse-assembler.test.js +169 -0
- package/dist/tests/unit/guidance/outreach-draft-schema.test.d.ts +1 -0
- package/dist/tests/unit/guidance/outreach-draft-schema.test.js +56 -0
- package/dist/tests/unit/guidance/outreach-strategy-selector.test.d.ts +1 -0
- package/dist/tests/unit/guidance/outreach-strategy-selector.test.js +208 -0
- package/dist/tests/unit/guidance/outreach-style-fixtures.test.d.ts +1 -0
- package/dist/tests/unit/guidance/outreach-style-fixtures.test.js +81 -0
- package/dist/tests/unit/guidance/t6-1-1-narrative-outreach.test.d.ts +1 -0
- package/dist/tests/unit/guidance/t6-1-1-narrative-outreach.test.js +256 -0
- package/dist/tests/unit/observability/audit-envelope.test.d.ts +1 -0
- package/dist/tests/unit/observability/audit-envelope.test.js +169 -0
- package/dist/tests/unit/observability/connector-inventory-ledger.test.d.ts +1 -0
- package/dist/tests/unit/observability/connector-inventory-ledger.test.js +128 -0
- package/dist/tests/unit/observability/family-registry.test.d.ts +12 -0
- package/dist/tests/unit/observability/family-registry.test.js +105 -0
- package/dist/tests/unit/observability/governance-plane-recorder.test.d.ts +1 -0
- package/dist/tests/unit/observability/governance-plane-recorder.test.js +72 -0
- package/dist/tests/unit/observability/heartbeat-digest-assembler.test.d.ts +1 -0
- package/dist/tests/unit/observability/heartbeat-digest-assembler.test.js +227 -0
- package/dist/tests/unit/observability/lived-experience-audit.test.d.ts +1 -0
- package/dist/tests/unit/observability/lived-experience-audit.test.js +105 -0
- package/dist/tests/unit/observability/narrative-timeline-query.test.d.ts +18 -0
- package/dist/tests/unit/observability/narrative-timeline-query.test.js +239 -0
- package/dist/tests/unit/observability/restore-audit-service.test.d.ts +16 -0
- package/dist/tests/unit/observability/restore-audit-service.test.js +186 -0
- package/dist/tests/unit/observability/runtime-decision-recorder.test.d.ts +1 -0
- package/dist/tests/unit/observability/runtime-decision-recorder.test.js +66 -0
- package/dist/tests/unit/observability/runtime-secret-anchor-view.test.d.ts +18 -0
- package/dist/tests/unit/observability/runtime-secret-anchor-view.test.js +209 -0
- package/dist/tests/unit/observability/self-health-snapshot.test.d.ts +1 -0
- package/dist/tests/unit/observability/self-health-snapshot.test.js +223 -0
- package/dist/tests/unit/observability/verify-audit-hash-chain.test.d.ts +1 -0
- package/dist/tests/unit/observability/verify-audit-hash-chain.test.js +93 -0
- package/dist/tests/unit/ops/manual-run-dispatcher.test.d.ts +13 -0
- package/dist/tests/unit/ops/manual-run-dispatcher.test.js +219 -0
- package/dist/tests/unit/quiet/claim-synthesizer.test.d.ts +17 -0
- package/dist/tests/unit/quiet/claim-synthesizer.test.js +289 -0
- package/dist/tests/unit/quiet/daily-diary-writer.test.d.ts +12 -0
- package/dist/tests/unit/quiet/daily-diary-writer.test.js +108 -0
- package/dist/tests/unit/shared/v7-entities.test.d.ts +13 -0
- package/dist/tests/unit/shared/v7-entities.test.js +306 -0
- package/dist/tests/unit/storage/delivery-attempt.test.d.ts +1 -0
- package/dist/tests/unit/storage/delivery-attempt.test.js +72 -0
- package/dist/tests/unit/storage/diary-dream-store.test.d.ts +12 -0
- package/dist/tests/unit/storage/diary-dream-store.test.js +118 -0
- package/dist/tests/unit/storage/embodied-context-state-port.test.d.ts +4 -0
- package/dist/tests/unit/storage/embodied-context-state-port.test.js +77 -0
- package/dist/tests/unit/storage/goal-lifecycle-store.test.d.ts +4 -0
- package/dist/tests/unit/storage/goal-lifecycle-store.test.js +143 -0
- package/dist/tests/unit/storage/history-digest-store.test.d.ts +10 -0
- package/dist/tests/unit/storage/history-digest-store.test.js +126 -0
- package/dist/tests/unit/storage/identity-profile-store.test.d.ts +4 -0
- package/dist/tests/unit/storage/identity-profile-store.test.js +48 -0
- package/dist/tests/unit/storage/life-evidence-snapshot.test.d.ts +1 -0
- package/dist/tests/unit/storage/life-evidence-snapshot.test.js +60 -0
- package/dist/tests/unit/storage/life-evidence.test.d.ts +1 -0
- package/dist/tests/unit/storage/life-evidence.test.js +54 -0
- package/dist/tests/unit/storage/migration-runner.test.d.ts +12 -0
- package/dist/tests/unit/storage/migration-runner.test.js +197 -0
- package/dist/tests/unit/storage/repair-gate.test.d.ts +1 -0
- package/dist/tests/unit/storage/repair-gate.test.js +41 -0
- package/dist/tests/unit/storage/restore-snapshot-store.test.d.ts +11 -0
- package/dist/tests/unit/storage/restore-snapshot-store.test.js +161 -0
- package/dist/tests/unit/storage/rhythm-policy-snapshot.test.d.ts +1 -0
- package/dist/tests/unit/storage/rhythm-policy-snapshot.test.js +31 -0
- package/dist/tests/unit/storage/runtime-secret-anchor-store.test.d.ts +10 -0
- package/dist/tests/unit/storage/runtime-secret-anchor-store.test.js +81 -0
- package/dist/tests/unit/storage/t1-4-1-credential-health-mapper.test.d.ts +1 -0
- package/dist/tests/unit/storage/t1-4-1-credential-health-mapper.test.js +83 -0
- package/dist/tests/unit/storage/t4-1-1-session-chronicle.test.d.ts +1 -0
- package/dist/tests/unit/storage/t4-1-1-session-chronicle.test.js +112 -0
- package/dist/tests/unit/storage/t4-1-2-narrative-state.test.d.ts +1 -0
- package/dist/tests/unit/storage/t4-1-2-narrative-state.test.js +80 -0
- package/dist/tests/unit/storage/t4-1-3-relationship-memory.test.d.ts +1 -0
- package/dist/tests/unit/storage/t4-1-3-relationship-memory.test.js +65 -0
- package/dist/tests/unit/storage/t4-1-4-agent-goal.test.d.ts +1 -0
- package/dist/tests/unit/storage/t4-1-4-agent-goal.test.js +166 -0
- package/dist/tests/unit/storage/tool-experience-store.test.d.ts +4 -0
- package/dist/tests/unit/storage/tool-experience-store.test.js +92 -0
- package/dist/tests/unit/storage/user-interest-snapshot.test.d.ts +1 -0
- package/dist/tests/unit/storage/user-interest-snapshot.test.js +48 -0
- package/dist/tests/unit/storage/write-queue.test.d.ts +12 -0
- package/dist/tests/unit/storage/write-queue.test.js +177 -0
- package/dist/tests/unit/storage/write-validation-gate.test.d.ts +9 -0
- package/dist/tests/unit/storage/write-validation-gate.test.js +153 -0
- package/docs/claw-second-nature-inner-guide.md +144 -0
- package/package.json +84 -55
- package/agent-inner-guide.md +0 -187
- package/openclaw.plugin.json +0 -29
- package/runtime/cli/ops/heartbeat-surface.d.ts +0 -75
- package/runtime/cli/ops/heartbeat-surface.js +0 -97
- package/runtime/cli/ops/ops-router.js +0 -1454
- package/runtime/cli/ops/workspace-heartbeat-runner.d.ts +0 -76
- package/runtime/cli/ops/workspace-heartbeat-runner.js +0 -236
- package/runtime/core/second-nature/heartbeat/goal-lifecycle-policy.d.ts +0 -37
- package/runtime/core/second-nature/heartbeat/goal-lifecycle-policy.js +0 -61
- package/runtime/core/second-nature/heartbeat/heartbeat-loop.d.ts +0 -88
- package/runtime/core/second-nature/heartbeat/heartbeat-loop.js +0 -329
- package/runtime/core/second-nature/orchestrator/platform-capability-router.js +0 -131
- /package/{index.js → dist/plugin/index.js} +0 -0
- /package/{workspace-ops-bridge.js → dist/plugin/workspace-ops-bridge.js} +0 -0
- /package/{runtime/cli/read-models/types.js → dist/scripts/packaging-feasibility-poc.d.ts} +0 -0
- /package/{runtime/core/second-nature/types.js → dist/scripts/plugin-smoke-check.d.ts} +0 -0
- /package/{runtime → dist/src}/cli/action-bridge.js +0 -0
- /package/{runtime → dist/src}/cli/commands/connector-behavior.d.ts +0 -0
- /package/{runtime → dist/src}/cli/commands/connector-behavior.js +0 -0
- /package/{runtime → dist/src}/cli/commands/connector-init.d.ts +0 -0
- /package/{runtime → dist/src}/cli/commands/connector-init.js +0 -0
- /package/{runtime → dist/src}/cli/commands/connector-status.d.ts +0 -0
- /package/{runtime → dist/src}/cli/commands/connector-status.js +0 -0
- /package/{runtime → dist/src}/cli/commands/credential.d.ts +0 -0
- /package/{runtime → dist/src}/cli/commands/credential.js +0 -0
- /package/{runtime → dist/src}/cli/commands/goal.d.ts +0 -0
- /package/{runtime → dist/src}/cli/commands/goal.js +0 -0
- /package/{runtime → dist/src}/cli/commands/index.d.ts +0 -0
- /package/{runtime → dist/src}/cli/commands/index.js +0 -0
- /package/{runtime → dist/src}/cli/commands/policy.d.ts +0 -0
- /package/{runtime → dist/src}/cli/commands/policy.js +0 -0
- /package/{runtime → dist/src}/cli/explain/explain-surface-subject.d.ts +0 -0
- /package/{runtime → dist/src}/cli/explain/explain-surface-subject.js +0 -0
- /package/{runtime → dist/src}/cli/explain/format-explanation.d.ts +0 -0
- /package/{runtime → dist/src}/cli/explain/format-explanation.js +0 -0
- /package/{runtime → dist/src}/cli/explain/resolve-subject.d.ts +0 -0
- /package/{runtime → dist/src}/cli/explain/resolve-subject.js +0 -0
- /package/{runtime → dist/src}/cli/host-capability/classify-delivery.d.ts +0 -0
- /package/{runtime → dist/src}/cli/host-capability/classify-delivery.js +0 -0
- /package/{runtime → dist/src}/cli/host-capability/probe-host-capability.d.ts +0 -0
- /package/{runtime → dist/src}/cli/host-capability/probe-host-capability.js +0 -0
- /package/{runtime → dist/src}/cli/host-capability/record-host-capability.d.ts +0 -0
- /package/{runtime → dist/src}/cli/host-capability/record-host-capability.js +0 -0
- /package/{runtime → dist/src}/cli/host-capability/types.d.ts +0 -0
- /package/{runtime → dist/src}/cli/host-capability/types.js +0 -0
- /package/{runtime → dist/src}/cli/host-smoke/run-host-smoke.d.ts +0 -0
- /package/{runtime → dist/src}/cli/host-smoke/run-host-smoke.js +0 -0
- /package/{runtime → dist/src}/cli/host-smoke/types.d.ts +0 -0
- /package/{runtime → dist/src}/cli/host-smoke/types.js +0 -0
- /package/{runtime → dist/src}/cli/index.js +0 -0
- /package/{runtime → dist/src}/cli/ops/manual-run-dispatcher.d.ts +0 -0
- /package/{runtime → dist/src}/cli/ops/manual-run-dispatcher.js +0 -0
- /package/{runtime → dist/src}/cli/ops/ops-router.d.ts +0 -0
- /package/{runtime → dist/src}/cli/ops/show-operator-fallback.d.ts +0 -0
- /package/{runtime → dist/src}/cli/ops/show-operator-fallback.js +0 -0
- /package/{runtime → dist/src}/cli/read-models/index.d.ts +0 -0
- /package/{runtime → dist/src}/cli/read-models/index.js +0 -0
- /package/{runtime → dist/src}/cli/read-models/operator-explain-map.d.ts +0 -0
- /package/{runtime → dist/src}/cli/read-models/operator-explain-map.js +0 -0
- /package/{runtime → dist/src}/cli/read-models/types.d.ts +0 -0
- /package/{runtime/guidance → dist/src/cli/read-models}/types.js +0 -0
- /package/{runtime → dist/src}/cli/runtime/runtime-artifact-boundary.d.ts +0 -0
- /package/{runtime → dist/src}/cli/runtime/runtime-artifact-boundary.js +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/agent-world/adapter.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/agent-world/adapter.js +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/agent-world/index.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/agent-world/index.js +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/agent-world/manifest.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/agent-world/manifest.js +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/evomap/adapter.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/evomap/adapter.js +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/evomap/index.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/evomap/index.js +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/evomap/manifest.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/agent-network/evomap/manifest.js +0 -0
- /package/{runtime → dist/src}/connectors/base/channel-health.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/channel-health.js +0 -0
- /package/{runtime → dist/src}/connectors/base/contract.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/contract.js +0 -0
- /package/{runtime → dist/src}/connectors/base/effect-commit-ledger-sqlite.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/effect-commit-ledger-sqlite.js +0 -0
- /package/{runtime → dist/src}/connectors/base/execution-policy.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/execution-policy.js +0 -0
- /package/{runtime → dist/src}/connectors/base/failure-taxonomy.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/failure-taxonomy.js +0 -0
- /package/{runtime → dist/src}/connectors/base/index.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/index.js +0 -0
- /package/{runtime → dist/src}/connectors/base/manifest-v7.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/manifest-v7.js +0 -0
- /package/{runtime → dist/src}/connectors/base/manifest.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/manifest.js +0 -0
- /package/{runtime → dist/src}/connectors/base/map-life-evidence.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/map-life-evidence.js +0 -0
- /package/{runtime → dist/src}/connectors/base/policy-layer.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/policy-layer.js +0 -0
- /package/{runtime → dist/src}/connectors/base/route-planner.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/route-planner.js +0 -0
- /package/{runtime → dist/src}/connectors/base/structured-unavailable-reason.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/structured-unavailable-reason.js +0 -0
- /package/{runtime → dist/src}/connectors/base/wet-probe-runner.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/base/wet-probe-runner.js +0 -0
- /package/{runtime → dist/src}/connectors/index.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/index.js +0 -0
- /package/{runtime → dist/src}/connectors/manifest/manifest-parser.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/manifest/manifest-parser.js +0 -0
- /package/{runtime → dist/src}/connectors/manifest/manifest-schema.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/manifest/manifest-schema.js +0 -0
- /package/{runtime → dist/src}/connectors/near-real/near-real-connector-smoke.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/near-real/near-real-connector-smoke.js +0 -0
- /package/{runtime → dist/src}/connectors/registry/dynamic-connector-registry.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/registry/dynamic-connector-registry.js +0 -0
- /package/{runtime → dist/src}/connectors/registry/index.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/registry/index.js +0 -0
- /package/{runtime → dist/src}/connectors/registry/manifest-scanner.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/registry/manifest-scanner.js +0 -0
- /package/{runtime → dist/src}/connectors/registry/trust-policy.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/registry/trust-policy.js +0 -0
- /package/{runtime → dist/src}/connectors/services/connector-executor-adapter.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/services/connector-executor-adapter.js +0 -0
- /package/{runtime → dist/src}/connectors/services/credential-route-context.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/services/credential-route-context.js +0 -0
- /package/{runtime → dist/src}/connectors/social-community/instreet/adapter.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/social-community/instreet/adapter.js +0 -0
- /package/{runtime → dist/src}/connectors/social-community/instreet/index.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/social-community/instreet/index.js +0 -0
- /package/{runtime → dist/src}/connectors/social-community/instreet/manifest.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/social-community/instreet/manifest.js +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/adapter.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/adapter.js +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/api-client.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/api-client.js +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/index.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/index.js +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/manifest.d.ts +0 -0
- /package/{runtime → dist/src}/connectors/social-community/moltbook/manifest.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/behavior-promotion/behavior-promotion-loop.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/behavior-promotion/behavior-promotion-loop.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/circuit-breaker/circuit-breaker-manager.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/circuit-breaker/circuit-breaker-manager.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/probe-signal-adapter.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/probe-signal-adapter.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-affordance/affordance-assembler.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-affordance/affordance-assembler.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-affordance/affordance-context-scope.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-affordance/affordance-context-scope.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-experience/experience-writer.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-experience/experience-writer.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-experience/pain-signal-query.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/body/tool-experience/pain-signal-query.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/feedback/owner-reply-feedback.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/feedback/owner-reply-feedback.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/guidance/apply-guidance.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/guidance/apply-guidance.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/guidance/request-guidance.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/guidance/request-guidance.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/guidance/user-reply-continuity.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/guidance/user-reply-continuity.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/decision-trace-emitter.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/decision-trace-emitter.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/embodied-context-assembler.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/embodied-context-assembler.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/heartbeat-executor.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/heartbeat-executor.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/idle-curiosity-policy.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/idle-curiosity-policy.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/index.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/index.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/run-heartbeat-cycle-v7.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/run-heartbeat-cycle-v7.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/run-heartbeat-cycle.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/run-heartbeat-cycle.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/runtime-snapshot.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/runtime-snapshot.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/scope-router.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/scope-router.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/signal.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/signal.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/snapshot-builder.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/heartbeat/snapshot-builder.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/index.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/index.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/downstream-intent-orchestrator.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/downstream-intent-orchestrator.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/effect-dispatcher.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/effect-dispatcher.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/goal-priority.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/goal-priority.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/guard-layer.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/guard-layer.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/hard-guard-evaluator.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/hard-guard-evaluator.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/index.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/index.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/intent-planner.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/intent-planner.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/lease-manager.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/lease-manager.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/narrative-update.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/narrative-update.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/platform-capability-router.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/resume-from-checkpoint.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/orchestrator/resume-from-checkpoint.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/build-message.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/build-message.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/build-outreach-draft-request.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/build-outreach-draft-request.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/delivery-target.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/delivery-target.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/dispatch-user-outreach.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/dispatch-user-outreach.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/evaluate-outreach.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/evaluate-outreach.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/judge-input-from-snapshot.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/judge-input-from-snapshot.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/judge-outreach.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/outreach/judge-outreach.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/claim-synthesizer.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/claim-synthesizer.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/daily-diary-writer.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/daily-diary-writer.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/index.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/index.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/quiet-pipeline.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/quiet-pipeline.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/run-source-backed-quiet.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/quiet/run-source-backed-quiet.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/reflection/run-narrative-reflection.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/reflection/run-narrative-reflection.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/planner-rhythm-window.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/planner-rhythm-window.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/policy-bridge.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/policy-bridge.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/rhythm-policy.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/rhythm-policy.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/select-window.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/rhythm/select-window.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/runtime/lifecycle-service.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/runtime/lifecycle-service.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/runtime/service-entry.d.ts +0 -0
- /package/{runtime → dist/src}/core/second-nature/runtime/service-entry.js +0 -0
- /package/{runtime → dist/src}/core/second-nature/types.d.ts +0 -0
- /package/{runtime/storage/delivery → dist/src/core/second-nature}/types.js +0 -0
- /package/{runtime → dist/src}/dream/dream-engine.d.ts +0 -0
- /package/{runtime → dist/src}/dream/dream-engine.js +0 -0
- /package/{runtime → dist/src}/dream/dream-input-loader.d.ts +0 -0
- /package/{runtime → dist/src}/dream/dream-input-loader.js +0 -0
- /package/{runtime → dist/src}/dream/dream-scheduler.d.ts +0 -0
- /package/{runtime → dist/src}/dream/dream-scheduler.js +0 -0
- /package/{runtime → dist/src}/dream/index.d.ts +0 -0
- /package/{runtime → dist/src}/dream/index.js +0 -0
- /package/{runtime → dist/src}/dream/insight-extractor.d.ts +0 -0
- /package/{runtime → dist/src}/dream/insight-extractor.js +0 -0
- /package/{runtime → dist/src}/dream/memory-consolidator.d.ts +0 -0
- /package/{runtime → dist/src}/dream/memory-consolidator.js +0 -0
- /package/{runtime → dist/src}/dream/narrative-update-proposal.d.ts +0 -0
- /package/{runtime → dist/src}/dream/narrative-update-proposal.js +0 -0
- /package/{runtime → dist/src}/dream/output-validator.d.ts +0 -0
- /package/{runtime → dist/src}/dream/output-validator.js +0 -0
- /package/{runtime → dist/src}/dream/redaction-gate.d.ts +0 -0
- /package/{runtime → dist/src}/dream/redaction-gate.js +0 -0
- /package/{runtime → dist/src}/dream/relationship-update-proposal.d.ts +0 -0
- /package/{runtime → dist/src}/dream/relationship-update-proposal.js +0 -0
- /package/{runtime → dist/src}/dream/sampler.d.ts +0 -0
- /package/{runtime → dist/src}/dream/sampler.js +0 -0
- /package/{runtime → dist/src}/dream/types.d.ts +0 -0
- /package/{runtime → dist/src}/dream/types.js +0 -0
- /package/{runtime → dist/src}/guidance/capability-class.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/capability-class.js +0 -0
- /package/{runtime → dist/src}/guidance/channel-feedback-ingestion-service.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/channel-feedback-ingestion-service.js +0 -0
- /package/{runtime → dist/src}/guidance/contracts.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/contracts.js +0 -0
- /package/{runtime → dist/src}/guidance/draft-narrative-outreach.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/draft-narrative-outreach.js +0 -0
- /package/{runtime → dist/src}/guidance/draft-outreach-message.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/draft-outreach-message.js +0 -0
- /package/{runtime → dist/src}/guidance/evidence-guidance.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/evidence-guidance.js +0 -0
- /package/{runtime → dist/src}/guidance/fallback.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/fallback.js +0 -0
- /package/{runtime → dist/src}/guidance/guidance-assembler.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/guidance-assembler.js +0 -0
- /package/{runtime → dist/src}/guidance/guidance-draft-service.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/guidance-draft-service.js +0 -0
- /package/{runtime → dist/src}/guidance/impulse-assembler.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/impulse-assembler.js +0 -0
- /package/{runtime → dist/src}/guidance/index.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/index.js +0 -0
- /package/{runtime → dist/src}/guidance/output-guard.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/output-guard.js +0 -0
- /package/{runtime → dist/src}/guidance/outreach-draft-schema.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/outreach-draft-schema.js +0 -0
- /package/{runtime → dist/src}/guidance/outreach-strategy-selector.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/outreach-strategy-selector.js +0 -0
- /package/{runtime → dist/src}/guidance/persona-selection.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/persona-selection.js +0 -0
- /package/{runtime → dist/src}/guidance/review-workflow.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/review-workflow.js +0 -0
- /package/{runtime → dist/src}/guidance/template-registry.d.ts +0 -0
- /package/{runtime → dist/src}/guidance/template-registry.js +0 -0
- /package/{runtime → dist/src}/guidance/types.d.ts +0 -0
- /package/{runtime/storage/memory/workspace → dist/src/guidance}/types.js +0 -0
- /package/{runtime → dist/src}/observability/audit/append-only-audit-store.d.ts +0 -0
- /package/{runtime → dist/src}/observability/audit/append-only-audit-store.js +0 -0
- /package/{runtime → dist/src}/observability/audit/audit-envelope.d.ts +0 -0
- /package/{runtime → dist/src}/observability/audit/audit-envelope.js +0 -0
- /package/{runtime → dist/src}/observability/audit/audit-family-registry.json +0 -0
- /package/{runtime → dist/src}/observability/audit/family-registry.d.ts +0 -0
- /package/{runtime → dist/src}/observability/audit/family-registry.js +0 -0
- /package/{runtime → dist/src}/observability/audit/verify-audit-hash-chain.d.ts +0 -0
- /package/{runtime → dist/src}/observability/audit/verify-audit-hash-chain.js +0 -0
- /package/{runtime → dist/src}/observability/connector-inventory-ledger.d.ts +0 -0
- /package/{runtime → dist/src}/observability/connector-inventory-ledger.js +0 -0
- /package/{runtime → dist/src}/observability/db/index.d.ts +0 -0
- /package/{runtime → dist/src}/observability/db/index.js +0 -0
- /package/{runtime → dist/src}/observability/db/schema/connector-inventory.d.ts +0 -0
- /package/{runtime → dist/src}/observability/db/schema/connector-inventory.js +0 -0
- /package/{runtime → dist/src}/observability/db/schema/host-capability-reports.d.ts +0 -0
- /package/{runtime → dist/src}/observability/db/schema/host-capability-reports.js +0 -0
- /package/{runtime → dist/src}/observability/db/schema/index.d.ts +0 -0
- /package/{runtime → dist/src}/observability/db/schema/index.js +0 -0
- /package/{runtime → dist/src}/observability/index.d.ts +0 -0
- /package/{runtime → dist/src}/observability/index.js +0 -0
- /package/{runtime → dist/src}/observability/projections/guidance-audit.d.ts +0 -0
- /package/{runtime → dist/src}/observability/projections/guidance-audit.js +0 -0
- /package/{runtime → dist/src}/observability/projections/outreach-quality-audit.d.ts +0 -0
- /package/{runtime → dist/src}/observability/projections/outreach-quality-audit.js +0 -0
- /package/{runtime → dist/src}/observability/projections/reflection-audit.d.ts +0 -0
- /package/{runtime → dist/src}/observability/projections/reflection-audit.js +0 -0
- /package/{runtime → dist/src}/observability/query/compose-evidence.d.ts +0 -0
- /package/{runtime → dist/src}/observability/query/compose-evidence.js +0 -0
- /package/{runtime → dist/src}/observability/query/evidence-query-engine.d.ts +0 -0
- /package/{runtime → dist/src}/observability/query/evidence-query-engine.js +0 -0
- /package/{runtime → dist/src}/observability/query/explain-query.d.ts +0 -0
- /package/{runtime → dist/src}/observability/query/explain-query.js +0 -0
- /package/{runtime → dist/src}/observability/query/export-audit-bundle.d.ts +0 -0
- /package/{runtime → dist/src}/observability/query/export-audit-bundle.js +0 -0
- /package/{runtime → dist/src}/observability/redaction/manifest.d.ts +0 -0
- /package/{runtime → dist/src}/observability/redaction/manifest.js +0 -0
- /package/{runtime → dist/src}/observability/redaction/policy.d.ts +0 -0
- /package/{runtime → dist/src}/observability/redaction/policy.js +0 -0
- /package/{runtime → dist/src}/observability/services/decision-ledger.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/decision-ledger.js +0 -0
- /package/{runtime → dist/src}/observability/services/execution-telemetry.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/execution-telemetry.js +0 -0
- /package/{runtime → dist/src}/observability/services/governance-audit.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/governance-audit.js +0 -0
- /package/{runtime → dist/src}/observability/services/governance-plane-recorder.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/governance-plane-recorder.js +0 -0
- /package/{runtime → dist/src}/observability/services/heartbeat-digest-assembler.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/heartbeat-digest-assembler.js +0 -0
- /package/{runtime → dist/src}/observability/services/lived-experience-audit.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/lived-experience-audit.js +0 -0
- /package/{runtime → dist/src}/observability/services/narrative-timeline-query-service.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/narrative-timeline-query-service.js +0 -0
- /package/{runtime → dist/src}/observability/services/observability-retention.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/observability-retention.js +0 -0
- /package/{runtime → dist/src}/observability/services/redaction-store.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/redaction-store.js +0 -0
- /package/{runtime → dist/src}/observability/services/restore-audit-service.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/restore-audit-service.js +0 -0
- /package/{runtime → dist/src}/observability/services/runtime-decision-recorder.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/runtime-decision-recorder.js +0 -0
- /package/{runtime → dist/src}/observability/services/runtime-secret-anchor-view.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/runtime-secret-anchor-view.js +0 -0
- /package/{runtime → dist/src}/observability/services/self-health-snapshot.d.ts +0 -0
- /package/{runtime → dist/src}/observability/services/self-health-snapshot.js +0 -0
- /package/{runtime → dist/src}/shared/types/continuity.d.ts +0 -0
- /package/{runtime → dist/src}/shared/types/continuity.js +0 -0
- /package/{runtime → dist/src}/shared/types/credential.d.ts +0 -0
- /package/{runtime → dist/src}/shared/types/credential.js +0 -0
- /package/{runtime → dist/src}/shared/types/goal.d.ts +0 -0
- /package/{runtime → dist/src}/shared/types/goal.js +0 -0
- /package/{runtime → dist/src}/shared/types/index.d.ts +0 -0
- /package/{runtime → dist/src}/shared/types/index.js +0 -0
- /package/{runtime → dist/src}/shared/types/outreach.d.ts +0 -0
- /package/{runtime → dist/src}/shared/types/outreach.js +0 -0
- /package/{runtime → dist/src}/shared/types/source-ref.d.ts +0 -0
- /package/{runtime → dist/src}/shared/types/source-ref.js +0 -0
- /package/{runtime → dist/src}/shared/types/v7-entities.d.ts +0 -0
- /package/{runtime → dist/src}/shared/types/v7-entities.js +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/native-sqlite-probe.d.ts +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/native-sqlite-probe.js +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/repair-gate.d.ts +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/repair-gate.js +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/repair.d.ts +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/repair.js +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/storage-mode-smoke.d.ts +0 -0
- /package/{runtime → dist/src}/storage/bootstrap/storage-mode-smoke.js +0 -0
- /package/{runtime → dist/src}/storage/chronicle/session-chronicle-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/chronicle/session-chronicle-store.js +0 -0
- /package/{runtime → dist/src}/storage/db/index.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/index.js +0 -0
- /package/{runtime → dist/src}/storage/db/migration-runner.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/migration-runner.js +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/index.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/index.js +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-001-foundation.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-001-foundation.js +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-002-effect-commit-ledger.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-002-effect-commit-ledger.js +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-003-circuit-breaker.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-003-circuit-breaker.js +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-004-behavior-promotion.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/migrations/v7-004-behavior-promotion.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/agent-goal.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/agent-goal.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/assets.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/assets.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/credentials.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/credentials.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/delivery-attempts.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/delivery-attempts.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/index.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/index.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/intent-commits.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/intent-commits.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/life-evidence-index.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/life-evidence-index.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/memory-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/memory-store.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/narrative-state.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/narrative-state.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/operator-fallback-artifacts.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/operator-fallback-artifacts.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/policies.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/policies.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/proposals.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/proposals.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/provenance.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/provenance.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/relationship-memory.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/relationship-memory.js +0 -0
- /package/{runtime → dist/src}/storage/db/schema/session-chronicle.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/schema/session-chronicle.js +0 -0
- /package/{runtime → dist/src}/storage/db/transaction-utils.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/transaction-utils.js +0 -0
- /package/{runtime → dist/src}/storage/db/write-queue.d.ts +0 -0
- /package/{runtime → dist/src}/storage/db/write-queue.js +0 -0
- /package/{runtime → dist/src}/storage/delivery/query-delivery-attempts.d.ts +0 -0
- /package/{runtime → dist/src}/storage/delivery/query-delivery-attempts.js +0 -0
- /package/{runtime → dist/src}/storage/delivery/types.d.ts +0 -0
- /package/{runtime/storage/snapshots → dist/src/storage/delivery}/types.js +0 -0
- /package/{runtime → dist/src}/storage/delivery/write-delivery-attempt.d.ts +0 -0
- /package/{runtime → dist/src}/storage/delivery/write-delivery-attempt.js +0 -0
- /package/{runtime → dist/src}/storage/fallback/load-operator-fallback.d.ts +0 -0
- /package/{runtime → dist/src}/storage/fallback/load-operator-fallback.js +0 -0
- /package/{runtime → dist/src}/storage/fallback/operator-fallback-types.d.ts +0 -0
- /package/{runtime → dist/src}/storage/fallback/operator-fallback-types.js +0 -0
- /package/{runtime → dist/src}/storage/fallback/operator-fallback-view.d.ts +0 -0
- /package/{runtime → dist/src}/storage/fallback/operator-fallback-view.js +0 -0
- /package/{runtime → dist/src}/storage/fallback/write-operator-fallback.d.ts +0 -0
- /package/{runtime → dist/src}/storage/fallback/write-operator-fallback.js +0 -0
- /package/{runtime → dist/src}/storage/goal/agent-goal-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/goal/agent-goal-store.js +0 -0
- /package/{runtime → dist/src}/storage/index.d.ts +0 -0
- /package/{runtime → dist/src}/storage/index.js +0 -0
- /package/{runtime → dist/src}/storage/life-evidence/append-life-evidence.d.ts +0 -0
- /package/{runtime → dist/src}/storage/life-evidence/append-life-evidence.js +0 -0
- /package/{runtime → dist/src}/storage/life-evidence/types.d.ts +0 -0
- /package/{runtime → dist/src}/storage/life-evidence/types.js +0 -0
- /package/{runtime → dist/src}/storage/memory/workspace/paths.d.ts +0 -0
- /package/{runtime → dist/src}/storage/memory/workspace/paths.js +0 -0
- /package/{runtime → dist/src}/storage/memory/workspace/store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/memory/workspace/store.js +0 -0
- /package/{runtime → dist/src}/storage/memory/workspace/types.d.ts +0 -0
- /package/{runtime/storage/user-interest → dist/src/storage/memory/workspace}/types.js +0 -0
- /package/{runtime → dist/src}/storage/memory-store/memory-store-lifecycle.d.ts +0 -0
- /package/{runtime → dist/src}/storage/memory-store/memory-store-lifecycle.js +0 -0
- /package/{runtime → dist/src}/storage/narrative/narrative-state-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/narrative/narrative-state-store.js +0 -0
- /package/{runtime → dist/src}/storage/quiet/persist-quiet-artifact.d.ts +0 -0
- /package/{runtime → dist/src}/storage/quiet/persist-quiet-artifact.js +0 -0
- /package/{runtime → dist/src}/storage/quiet/quiet-artifact-types.d.ts +0 -0
- /package/{runtime → dist/src}/storage/quiet/quiet-artifact-types.js +0 -0
- /package/{runtime → dist/src}/storage/quiet/quiet-artifact-writer.d.ts +0 -0
- /package/{runtime → dist/src}/storage/quiet/quiet-artifact-writer.js +0 -0
- /package/{runtime → dist/src}/storage/relationship/relationship-memory-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/relationship/relationship-memory-store.js +0 -0
- /package/{runtime → dist/src}/storage/repositories/asset-repository.d.ts +0 -0
- /package/{runtime → dist/src}/storage/repositories/asset-repository.js +0 -0
- /package/{runtime → dist/src}/storage/repositories/credential-repository.d.ts +0 -0
- /package/{runtime → dist/src}/storage/repositories/credential-repository.js +0 -0
- /package/{runtime → dist/src}/storage/repositories/index.d.ts +0 -0
- /package/{runtime → dist/src}/storage/repositories/index.js +0 -0
- /package/{runtime → dist/src}/storage/repositories/intent-commit-repository.d.ts +0 -0
- /package/{runtime → dist/src}/storage/repositories/intent-commit-repository.js +0 -0
- /package/{runtime → dist/src}/storage/repositories/policy-repository.d.ts +0 -0
- /package/{runtime → dist/src}/storage/repositories/policy-repository.js +0 -0
- /package/{runtime → dist/src}/storage/repositories/proposal-repository.d.ts +0 -0
- /package/{runtime → dist/src}/storage/repositories/proposal-repository.js +0 -0
- /package/{runtime → dist/src}/storage/repositories/provenance-repository.d.ts +0 -0
- /package/{runtime → dist/src}/storage/repositories/provenance-repository.js +0 -0
- /package/{runtime → dist/src}/storage/rhythm/rhythm-policy-snapshot.d.ts +0 -0
- /package/{runtime → dist/src}/storage/rhythm/rhythm-policy-snapshot.js +0 -0
- /package/{runtime → dist/src}/storage/services/credential-vault.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/credential-vault.js +0 -0
- /package/{runtime → dist/src}/storage/services/daily-log-pipeline.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/daily-log-pipeline.js +0 -0
- /package/{runtime → dist/src}/storage/services/diary-dream-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/diary-dream-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/effect-commit-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/effect-commit-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/embodied-context-state-port.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/embodied-context-state-port.js +0 -0
- /package/{runtime → dist/src}/storage/services/goal-lifecycle-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/goal-lifecycle-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/governance-layer.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/governance-layer.js +0 -0
- /package/{runtime → dist/src}/storage/services/history-digest-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/history-digest-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/identity-profile-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/identity-profile-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/interaction-snapshot-projector.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/interaction-snapshot-projector.js +0 -0
- /package/{runtime → dist/src}/storage/services/persona-candidate-loader.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/persona-candidate-loader.js +0 -0
- /package/{runtime → dist/src}/storage/services/provenance-service.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/provenance-service.js +0 -0
- /package/{runtime → dist/src}/storage/services/quiet-input-loader.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/quiet-input-loader.js +0 -0
- /package/{runtime → dist/src}/storage/services/repair-and-backup.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/repair-and-backup.js +0 -0
- /package/{runtime → dist/src}/storage/services/restore-snapshot-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/restore-snapshot-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/runtime-secret-anchor-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/runtime-secret-anchor-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/tool-experience-store.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/tool-experience-store.js +0 -0
- /package/{runtime → dist/src}/storage/services/write-validation-gate.d.ts +0 -0
- /package/{runtime → dist/src}/storage/services/write-validation-gate.js +0 -0
- /package/{runtime → dist/src}/storage/snapshots/continuity-snapshot.d.ts +0 -0
- /package/{runtime → dist/src}/storage/snapshots/continuity-snapshot.js +0 -0
- /package/{runtime → dist/src}/storage/snapshots/life-evidence-snapshot.d.ts +0 -0
- /package/{runtime → dist/src}/storage/snapshots/life-evidence-snapshot.js +0 -0
- /package/{runtime → dist/src}/storage/snapshots/types.d.ts +0 -0
- /package/{runtime → dist/src}/storage/state-api.d.ts +0 -0
- /package/{runtime → dist/src}/storage/state-api.js +0 -0
- /package/{runtime → dist/src}/storage/user-interest/load-user-interest-snapshot.d.ts +0 -0
- /package/{runtime → dist/src}/storage/user-interest/load-user-interest-snapshot.js +0 -0
- /package/{runtime → dist/src}/storage/user-interest/types.d.ts +0 -0
|
@@ -1,1454 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared ops command dispatch for CLI + tool surfaces (T1.1.3, T1.2.2).
|
|
3
|
-
*
|
|
4
|
-
* v7 additions (T-ROS.C.1): self_health, tool_affordance, connector_test --wet,
|
|
5
|
-
* heartbeat_digest, narrative:diff, timeline, restore, runtime_secret_bootstrap.
|
|
6
|
-
* All commands return RuntimeOpsEnvelope.
|
|
7
|
-
*/
|
|
8
|
-
import { createHash } from "node:crypto";
|
|
9
|
-
import fs from "node:fs";
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
import { heartbeatCheck, } from "./heartbeat-surface.js";
|
|
12
|
-
import { showOperatorFallback, OperatorFallbackNotFoundError, } from "./show-operator-fallback.js";
|
|
13
|
-
import { probeHostCapability } from "../host-capability/probe-host-capability.js";
|
|
14
|
-
import { recordHostCapability } from "../host-capability/record-host-capability.js";
|
|
15
|
-
import { runNearRealConnectorSmoke } from "../../connectors/near-real/near-real-connector-smoke.js";
|
|
16
|
-
import { scanConnectorManifests } from "../../connectors/registry/manifest-scanner.js";
|
|
17
|
-
import { parseConnectorManifestV6 } from "../../connectors/manifest/manifest-parser.js";
|
|
18
|
-
import { connectorInit } from "../commands/connector-init.js";
|
|
19
|
-
import { connectorBehaviorAdd } from "../commands/connector-behavior.js";
|
|
20
|
-
import { connectorStatus, connectorTest } from "../commands/connector-status.js";
|
|
21
|
-
import { goalCommand } from "../commands/goal.js";
|
|
22
|
-
// v7 observability services (T-ROS.C.1)
|
|
23
|
-
import { getSelfHealthSnapshot, ensureMinimumProbes, } from "../../observability/services/self-health-snapshot.js";
|
|
24
|
-
import { generateHeartbeatDigest, } from "../../observability/services/heartbeat-digest-assembler.js";
|
|
25
|
-
import { queryNarrativeTimeline, queryNarrativeDiff, NarrativeVersionNotFoundError, } from "../../observability/services/narrative-timeline-query-service.js";
|
|
26
|
-
import { viewSecretAnchor, } from "../../observability/services/runtime-secret-anchor-view.js";
|
|
27
|
-
import { writeRestoreAudit, } from "../../observability/services/restore-audit-service.js";
|
|
28
|
-
import { createHistoryDigestStore } from "../../storage/services/history-digest-store.js";
|
|
29
|
-
// T-ROS.C.3: ManualRunDispatcher and its deps
|
|
30
|
-
import { createManualRunDispatcher, } from "./manual-run-dispatcher.js";
|
|
31
|
-
import { createExperienceWriter } from "../../core/second-nature/body/tool-experience/experience-writer.js";
|
|
32
|
-
import { createCapabilityProbeResultStore, createToolExperienceStore, } from "../../storage/services/tool-experience-store.js";
|
|
33
|
-
import { createWetProbeRunner } from "../../connectors/base/wet-probe-runner.js";
|
|
34
|
-
import { CapabilityContractRegistryV7 } from "../../connectors/base/manifest-v7.js";
|
|
35
|
-
// v7 T-V7C.C.6: Dream scheduling deps for heartbeat_check quiet→dream auto-trigger
|
|
36
|
-
import { scheduleDream } from "../../dream/dream-scheduler.js";
|
|
37
|
-
import { createDreamInputLoader } from "../../dream/dream-input-loader.js";
|
|
38
|
-
import { createDiaryDreamStore } from "../../storage/services/diary-dream-store.js";
|
|
39
|
-
function coerceProbeOnlyFlag(input) {
|
|
40
|
-
const v = input?.probeOnly;
|
|
41
|
-
return v === true || v === "true" || v === 1 || v === "1";
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* v7 T-V7C.C.6: Build a minimal QuietDreamSchedulePort backed by the state DB.
|
|
45
|
-
* When a source-backed Quiet write completes, this port triggers Dream scheduling
|
|
46
|
-
* via the standard scheduleDream path (rules-only mode when no model port).
|
|
47
|
-
*/
|
|
48
|
-
function createQuietDreamSchedulePort(state) {
|
|
49
|
-
return {
|
|
50
|
-
async scheduleDream({ triggerKind, runId, traceId }) {
|
|
51
|
-
const dreamStore = createDiaryDreamStore(state);
|
|
52
|
-
const inputLoader = createDreamInputLoader({ database: state });
|
|
53
|
-
const statePort = {
|
|
54
|
-
async loadDreamInputs(query) {
|
|
55
|
-
return inputLoader.loadDreamInputs(query);
|
|
56
|
-
},
|
|
57
|
-
async writeDreamOutput(output) {
|
|
58
|
-
// Bridge: dream-engine emits dream/types DreamOutput; diary-dream-store expects shared/types.
|
|
59
|
-
// Structures are identical at runtime; TS strictness requires the cast.
|
|
60
|
-
await dreamStore.appendDreamOutput(output);
|
|
61
|
-
return { outputId: output.outputId, status: "acknowledged" };
|
|
62
|
-
},
|
|
63
|
-
async markDreamOutputLifecycle(input) {
|
|
64
|
-
// transitionDreamOutputLifecycle only accepts accepted|archived.
|
|
65
|
-
if (input.newStatus !== "accepted" && input.newStatus !== "archived") {
|
|
66
|
-
return { outputId: input.outputId, status: "degraded" };
|
|
67
|
-
}
|
|
68
|
-
await dreamStore.transitionDreamOutputLifecycle(input.outputId, input.newStatus);
|
|
69
|
-
return { outputId: input.outputId, status: "acknowledged" };
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
const result = await scheduleDream({
|
|
73
|
-
triggerKind,
|
|
74
|
-
runId,
|
|
75
|
-
traceId,
|
|
76
|
-
statePort,
|
|
77
|
-
windowKey: "quiet_completion",
|
|
78
|
-
});
|
|
79
|
-
return { status: result.status, reason: result.reason };
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
const SNAPSHOT_TABLE_BY_KIND = {
|
|
84
|
-
identity_profile: "identity_profile",
|
|
85
|
-
agent_goal: "agent_goal",
|
|
86
|
-
tool_experience: "tool_experience",
|
|
87
|
-
daily_diary: "daily_diary_index",
|
|
88
|
-
dream_output: "dream_output_index",
|
|
89
|
-
narrative_timeline: "narrative_timeline",
|
|
90
|
-
};
|
|
91
|
-
const DEFAULT_SNAPSHOT_KINDS = [
|
|
92
|
-
"identity_profile",
|
|
93
|
-
"agent_goal",
|
|
94
|
-
"tool_experience",
|
|
95
|
-
"daily_diary",
|
|
96
|
-
"dream_output",
|
|
97
|
-
"narrative_timeline",
|
|
98
|
-
];
|
|
99
|
-
function coerceRestorableKinds(value) {
|
|
100
|
-
if (!Array.isArray(value))
|
|
101
|
-
return undefined;
|
|
102
|
-
const valid = new Set(DEFAULT_SNAPSHOT_KINDS);
|
|
103
|
-
return value.filter((item) => typeof item === "string" && valid.has(item));
|
|
104
|
-
}
|
|
105
|
-
function tableExists(state, table) {
|
|
106
|
-
const result = state.sqlite.exec(`SELECT name FROM sqlite_master WHERE type = 'table' AND name = ? LIMIT 1`, [table]);
|
|
107
|
-
return result.length > 0 && result[0].values.length > 0;
|
|
108
|
-
}
|
|
109
|
-
function readRowsFromTable(state, table) {
|
|
110
|
-
const result = state.sqlite.exec(`SELECT * FROM ${table}`);
|
|
111
|
-
if (result.length === 0 || result[0].values.length === 0)
|
|
112
|
-
return [];
|
|
113
|
-
const columns = result[0].columns;
|
|
114
|
-
return result[0].values.map((row) => {
|
|
115
|
-
const out = {};
|
|
116
|
-
columns.forEach((column, index) => {
|
|
117
|
-
out[column] = row[index];
|
|
118
|
-
});
|
|
119
|
-
return out;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
function stringArray(value) {
|
|
123
|
-
return Array.isArray(value)
|
|
124
|
-
? value.filter((item) => typeof item === "string")
|
|
125
|
-
: [];
|
|
126
|
-
}
|
|
127
|
-
function textInput(input, key) {
|
|
128
|
-
const value = input?.[key];
|
|
129
|
-
if (typeof value !== "string")
|
|
130
|
-
return undefined;
|
|
131
|
-
const trimmed = value.trim();
|
|
132
|
-
return trimmed.length > 0 ? trimmed : undefined;
|
|
133
|
-
}
|
|
134
|
-
function buildSnapshotNarrativeDelta(input, snapshotId, rowCounts) {
|
|
135
|
-
const explicit = input?.narrativeSnapshot &&
|
|
136
|
-
typeof input.narrativeSnapshot === "object" &&
|
|
137
|
-
!Array.isArray(input.narrativeSnapshot)
|
|
138
|
-
? input.narrativeSnapshot
|
|
139
|
-
: {};
|
|
140
|
-
const from = (key) => input?.[key] ?? explicit[key];
|
|
141
|
-
const sourceRefs = stringArray(from("sourceRefs"));
|
|
142
|
-
return {
|
|
143
|
-
focus: from("focus") ?? "workspace_state",
|
|
144
|
-
progress: from("progress") ??
|
|
145
|
-
`snapshot_captured:${Object.entries(rowCounts)
|
|
146
|
-
.map(([kind, count]) => `${kind}=${count}`)
|
|
147
|
-
.join(",")}`,
|
|
148
|
-
nextIntent: from("nextIntent") ?? "restore_ready",
|
|
149
|
-
toneSignal: from("toneSignal") ?? "system_maintenance",
|
|
150
|
-
acceptedGoalId: from("acceptedGoalId") ?? undefined,
|
|
151
|
-
sourceRefs: sourceRefs.length > 0
|
|
152
|
-
? sourceRefs
|
|
153
|
-
: [`restore_snapshot:${snapshotId}`, "runtime_ops:snapshot_capture"],
|
|
154
|
-
reasonCode: from("reasonCode") ?? "snapshot_captured",
|
|
155
|
-
summaryText: from("summaryText") ?? `Captured restore snapshot ${snapshotId}`,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
function hashNarrativeSnapshot(input) {
|
|
159
|
-
return createHash("sha256")
|
|
160
|
-
.update(JSON.stringify({
|
|
161
|
-
previousHash: input.previousHash,
|
|
162
|
-
snapshotId: input.snapshotId,
|
|
163
|
-
delta: input.delta,
|
|
164
|
-
createdAt: input.createdAt,
|
|
165
|
-
}))
|
|
166
|
-
.digest("hex");
|
|
167
|
-
}
|
|
168
|
-
function resolveManifestPath(manifestPath, workspaceRoot) {
|
|
169
|
-
if (path.isAbsolute(manifestPath))
|
|
170
|
-
return manifestPath;
|
|
171
|
-
return path.join(workspaceRoot ?? process.cwd(), manifestPath);
|
|
172
|
-
}
|
|
173
|
-
function registerConnectorForWetProbe(input) {
|
|
174
|
-
if (input.entry.manifestPath) {
|
|
175
|
-
try {
|
|
176
|
-
const manifestText = fs.readFileSync(resolveManifestPath(input.entry.manifestPath, input.workspaceRoot), "utf-8");
|
|
177
|
-
const parsed = JSON.parse(manifestText);
|
|
178
|
-
const registered = input.registryV7.register(parsed);
|
|
179
|
-
if (registered.ok && input.registryV7.hasCapability(input.entry.platformId, input.selectedCapabilityId)) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
// Non-v7 or YAML workspace manifests are projected below.
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
input.registryV7.register({
|
|
188
|
-
platformId: input.entry.platformId,
|
|
189
|
-
capabilities: input.entry.capabilities.map((capabilityId) => ({
|
|
190
|
-
capabilityId,
|
|
191
|
-
intent: capabilityId,
|
|
192
|
-
probeConfig: capabilityId === input.selectedCapabilityId && input.safeEndpoint
|
|
193
|
-
? {
|
|
194
|
-
safeEndpoint: input.safeEndpoint,
|
|
195
|
-
idempotencyClass: "read_only",
|
|
196
|
-
}
|
|
197
|
-
: undefined,
|
|
198
|
-
})),
|
|
199
|
-
channelPriority: ["runtime_ops"],
|
|
200
|
-
credentialTypes: ["runtime_ops_probe"],
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
async function captureRuntimeSnapshot(deps, input) {
|
|
204
|
-
const generatedAt = new Date().toISOString();
|
|
205
|
-
if (!deps.state || !deps.restoreSnapshotStore) {
|
|
206
|
-
return {
|
|
207
|
-
ok: false,
|
|
208
|
-
command: "snapshot:capture",
|
|
209
|
-
runtimeMode: "unavailable",
|
|
210
|
-
surfaceMode: "cli",
|
|
211
|
-
generatedAt,
|
|
212
|
-
error: {
|
|
213
|
-
code: "SNAPSHOT_CAPTURE_DEPS_UNAVAILABLE",
|
|
214
|
-
message: "snapshot:capture requires state DB and RestoreSnapshotStore in OpsRouterDeps",
|
|
215
|
-
nextStep: "wire_state_and_restore_snapshot_store_into_ops_router",
|
|
216
|
-
},
|
|
217
|
-
warnings: [],
|
|
218
|
-
sourceRefs: [],
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
const snapshotId = textInput(input, "snapshotId") ??
|
|
222
|
-
`snapshot:${Date.now()}:${Math.random().toString(36).slice(2, 8)}`;
|
|
223
|
-
const requestedKinds = coerceRestorableKinds(input?.entityWhitelist) ?? [...DEFAULT_SNAPSHOT_KINDS];
|
|
224
|
-
const rowCounts = {};
|
|
225
|
-
const warnings = [];
|
|
226
|
-
for (const kind of requestedKinds) {
|
|
227
|
-
const table = SNAPSHOT_TABLE_BY_KIND[kind];
|
|
228
|
-
if (!tableExists(deps.state, table)) {
|
|
229
|
-
rowCounts[kind] = 0;
|
|
230
|
-
warnings.push(`table_missing:${kind}:${table}`);
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
rowCounts[kind] = readRowsFromTable(deps.state, table).length;
|
|
234
|
-
}
|
|
235
|
-
const historyStore = createHistoryDigestStore(deps.state);
|
|
236
|
-
const previousHash = (await historyStore.listNarrativeTimeline({ limit: 1 }))[0]?.currentHash ?? "";
|
|
237
|
-
const delta = buildSnapshotNarrativeDelta(input, snapshotId, rowCounts);
|
|
238
|
-
const currentHash = hashNarrativeSnapshot({
|
|
239
|
-
previousHash,
|
|
240
|
-
snapshotId,
|
|
241
|
-
delta,
|
|
242
|
-
createdAt: generatedAt,
|
|
243
|
-
});
|
|
244
|
-
await historyStore.appendNarrativeTimeline({
|
|
245
|
-
timelineId: snapshotId,
|
|
246
|
-
entryType: "owner.override",
|
|
247
|
-
subjectId: textInput(input, "subjectId") ?? snapshotId,
|
|
248
|
-
delta,
|
|
249
|
-
previousHash,
|
|
250
|
-
currentHash,
|
|
251
|
-
createdAt: generatedAt,
|
|
252
|
-
});
|
|
253
|
-
const payload = {};
|
|
254
|
-
const capturedKinds = [];
|
|
255
|
-
for (const kind of requestedKinds) {
|
|
256
|
-
const table = SNAPSHOT_TABLE_BY_KIND[kind];
|
|
257
|
-
if (!tableExists(deps.state, table))
|
|
258
|
-
continue;
|
|
259
|
-
const rows = readRowsFromTable(deps.state, table);
|
|
260
|
-
rowCounts[kind] = rows.length;
|
|
261
|
-
if (rows.length > 0) {
|
|
262
|
-
payload[kind] = rows;
|
|
263
|
-
capturedKinds.push(kind);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
const snapshot = await deps.restoreSnapshotStore.captureSnapshot({
|
|
267
|
-
snapshotId,
|
|
268
|
-
entityWhitelist: requestedKinds,
|
|
269
|
-
payload,
|
|
270
|
-
capturedAt: generatedAt,
|
|
271
|
-
});
|
|
272
|
-
return {
|
|
273
|
-
ok: true,
|
|
274
|
-
command: "snapshot:capture",
|
|
275
|
-
runtimeMode: "workspace_full_runtime",
|
|
276
|
-
surfaceMode: "cli",
|
|
277
|
-
generatedAt,
|
|
278
|
-
data: {
|
|
279
|
-
snapshotId: snapshot.snapshotId,
|
|
280
|
-
capturedAt: snapshot.capturedAt,
|
|
281
|
-
entityWhitelist: snapshot.entityWhitelist,
|
|
282
|
-
capturedKinds,
|
|
283
|
-
rowCounts,
|
|
284
|
-
narrativeVersion: snapshotId,
|
|
285
|
-
},
|
|
286
|
-
warnings,
|
|
287
|
-
sourceRefs: [
|
|
288
|
-
"storage/services/restore-snapshot-store.ts",
|
|
289
|
-
"storage/services/history-digest-store.ts",
|
|
290
|
-
],
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* T1.2.8 — static local adapter: all checks return `unknown` when no real host is available.
|
|
295
|
-
* Allows `capability_probe` to be called from CLI / workspace bridge without requiring a live host.
|
|
296
|
-
*/
|
|
297
|
-
function createStaticUnknownAdapter(workspaceRoot) {
|
|
298
|
-
const now = new Date().toISOString();
|
|
299
|
-
const unknownResult = (name) => ({
|
|
300
|
-
name,
|
|
301
|
-
verdict: "unknown",
|
|
302
|
-
observedAt: now,
|
|
303
|
-
reason: "static_local_probe_no_host_context",
|
|
304
|
-
evidenceRefs: [],
|
|
305
|
-
});
|
|
306
|
-
function checkDeliveryTarget() {
|
|
307
|
-
if (!workspaceRoot) {
|
|
308
|
-
return { status: "target_none", evidenceRefs: [], reason: "no_workspace_root_provided" };
|
|
309
|
-
}
|
|
310
|
-
const deliveryCapabilities = ["message.send", "comment.reply"];
|
|
311
|
-
const scanned = scanConnectorManifests(workspaceRoot);
|
|
312
|
-
for (const manifestFile of scanned) {
|
|
313
|
-
const parsed = parseConnectorManifestV6(manifestFile.content, manifestFile.path);
|
|
314
|
-
if (parsed.ok && parsed.manifest.capabilities.some((cap) => deliveryCapabilities.includes(cap.id))) {
|
|
315
|
-
return {
|
|
316
|
-
status: "target_available",
|
|
317
|
-
evidenceRefs: [
|
|
318
|
-
{
|
|
319
|
-
id: `delivery:${parsed.manifest.platformId}`,
|
|
320
|
-
kind: "workspace_artifact",
|
|
321
|
-
uri: `workspace://connectors/${parsed.manifest.platformId}/manifest.yaml`,
|
|
322
|
-
observedAt: now,
|
|
323
|
-
},
|
|
324
|
-
],
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
return { status: "target_none", evidenceRefs: [], reason: "no_delivery_connector_found_in_workspace" };
|
|
329
|
-
}
|
|
330
|
-
return {
|
|
331
|
-
checkPluginLoad: () => unknownResult("plugin_load"),
|
|
332
|
-
checkHeartbeatBridge: () => unknownResult("heartbeat_bridge"),
|
|
333
|
-
checkHeartbeatToolInvocation: () => unknownResult("heartbeat_tool_invocation"),
|
|
334
|
-
checkDeliveryTarget,
|
|
335
|
-
checkAckDropBehavior: () => unknownResult("ack_drop"),
|
|
336
|
-
checkHookSupport: () => [],
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
export function createOpsRouter(deps) {
|
|
340
|
-
return {
|
|
341
|
-
heartbeatCheck: (input) => heartbeatCheck({
|
|
342
|
-
...input,
|
|
343
|
-
runtimeAvailable: input.runtimeAvailable ?? deps.runtimeAvailable,
|
|
344
|
-
readModels: input.readModels ?? deps.readModels,
|
|
345
|
-
runtimeRecorder: input.runtimeRecorder ?? deps.runtimeRecorder,
|
|
346
|
-
state: input.state ?? deps.state,
|
|
347
|
-
workspaceRoot: input.workspaceRoot ?? deps.workspaceRoot,
|
|
348
|
-
connectorExecutor: input.connectorExecutor ?? deps.connectorExecutor,
|
|
349
|
-
connectorRegistry: input
|
|
350
|
-
?.connectorRegistry ?? deps.connectorRegistry,
|
|
351
|
-
digestOpts: input.digestOpts,
|
|
352
|
-
dreamSchedulePort: input.dreamSchedulePort,
|
|
353
|
-
}),
|
|
354
|
-
async dispatch(command, input) {
|
|
355
|
-
if (command === "heartbeat_check") {
|
|
356
|
-
const runtimeAvailable = typeof input?.runtimeAvailable === "boolean"
|
|
357
|
-
? input.runtimeAvailable
|
|
358
|
-
: deps.runtimeAvailable;
|
|
359
|
-
// v7 T-V7C.C.2: assemble affordance map and experience writer for breaker-aware heartbeat.
|
|
360
|
-
let affordanceMap;
|
|
361
|
-
if (deps.toolAffordancePort) {
|
|
362
|
-
try {
|
|
363
|
-
affordanceMap = await deps.toolAffordancePort.assembleAffordanceMap({});
|
|
364
|
-
}
|
|
365
|
-
catch {
|
|
366
|
-
// degrade gracefully; guard-layer will skip breaker check without affordanceMap
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
let experienceWriter;
|
|
370
|
-
if (deps.state) {
|
|
371
|
-
experienceWriter = createExperienceWriter(createToolExperienceStore(deps.state));
|
|
372
|
-
}
|
|
373
|
-
// v7 T-V7C.C.6: assemble digest opts when auditStore is wired.
|
|
374
|
-
let digestOpts;
|
|
375
|
-
if (deps.auditStore) {
|
|
376
|
-
digestOpts = {
|
|
377
|
-
assemblerDeps: {
|
|
378
|
-
auditStore: deps.auditStore,
|
|
379
|
-
...deps.heartbeatDigestDeps,
|
|
380
|
-
},
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
// v7 T-V7C.C.6: assemble dream schedule port when state DB is wired.
|
|
384
|
-
let dreamSchedulePort;
|
|
385
|
-
if (deps.state) {
|
|
386
|
-
dreamSchedulePort = createQuietDreamSchedulePort(deps.state);
|
|
387
|
-
}
|
|
388
|
-
try {
|
|
389
|
-
const result = await heartbeatCheck({
|
|
390
|
-
probeOnly: coerceProbeOnlyFlag(input),
|
|
391
|
-
runtimeAvailable,
|
|
392
|
-
fakeControlPlanePassthrough: input?.fakeControlPlanePassthrough &&
|
|
393
|
-
typeof input.fakeControlPlanePassthrough === "object"
|
|
394
|
-
? input.fakeControlPlanePassthrough
|
|
395
|
-
: undefined,
|
|
396
|
-
readModels: input?.readModels ??
|
|
397
|
-
deps.readModels,
|
|
398
|
-
runtimeRecorder: input
|
|
399
|
-
?.runtimeRecorder ?? deps.runtimeRecorder,
|
|
400
|
-
state: input?.state ??
|
|
401
|
-
deps.state,
|
|
402
|
-
workspaceRoot: input
|
|
403
|
-
?.workspaceRoot ?? deps.workspaceRoot,
|
|
404
|
-
timestamp: typeof input?.timestamp === "string" ? input.timestamp : undefined,
|
|
405
|
-
sessionContext: typeof input?.sessionContext === "string"
|
|
406
|
-
? input.sessionContext
|
|
407
|
-
: undefined,
|
|
408
|
-
scopeHint: input?.scopeHint,
|
|
409
|
-
connectorExecutor: input
|
|
410
|
-
?.connectorExecutor ?? deps.connectorExecutor,
|
|
411
|
-
connectorRegistry: input
|
|
412
|
-
?.connectorRegistry ?? deps.connectorRegistry,
|
|
413
|
-
affordanceMap,
|
|
414
|
-
experienceWriter,
|
|
415
|
-
digestOpts,
|
|
416
|
-
dreamSchedulePort,
|
|
417
|
-
});
|
|
418
|
-
if (result.ok &&
|
|
419
|
-
result.surfaceMode === "workspace_full_runtime" &&
|
|
420
|
-
!coerceProbeOnlyFlag(input) &&
|
|
421
|
-
deps.state &&
|
|
422
|
-
deps.restoreSnapshotStore) {
|
|
423
|
-
try {
|
|
424
|
-
const capture = await captureRuntimeSnapshot(deps, {
|
|
425
|
-
snapshotId: `heartbeat:${result.decisionId ?? "cycle"}:${Date.now()}`,
|
|
426
|
-
subjectId: result.decisionId ?? "heartbeat_check",
|
|
427
|
-
reasonCode: "heartbeat_check",
|
|
428
|
-
summaryText: `Heartbeat ${result.status} captured bounded restore snapshot`,
|
|
429
|
-
focus: result.status,
|
|
430
|
-
progress: result.reasons.join(",") || "heartbeat_completed",
|
|
431
|
-
nextIntent: "continue_runtime_loop",
|
|
432
|
-
sourceRefs: result.decisionId
|
|
433
|
-
? [`heartbeat:${result.decisionId}`]
|
|
434
|
-
: ["heartbeat:runtime"],
|
|
435
|
-
});
|
|
436
|
-
if (capture.ok) {
|
|
437
|
-
result.reasons = [...result.reasons, "restore_snapshot_captured"];
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
catch (err) {
|
|
441
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
442
|
-
result.reasons = [...result.reasons, `restore_snapshot_capture_failed:${msg}`];
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return result;
|
|
446
|
-
}
|
|
447
|
-
catch (err) {
|
|
448
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
449
|
-
const envelope = {
|
|
450
|
-
ok: false,
|
|
451
|
-
command: "heartbeat_check",
|
|
452
|
-
runtimeMode: runtimeAvailable ? "workspace_full_runtime" : "unavailable",
|
|
453
|
-
surfaceMode: "cli",
|
|
454
|
-
generatedAt: new Date().toISOString(),
|
|
455
|
-
error: {
|
|
456
|
-
code: "HEARTBEAT_CYCLE_EXCEPTION",
|
|
457
|
-
message: `heartbeat_check cycle threw unexpectedly: ${msg.slice(0, 200)}`,
|
|
458
|
-
nextStep: "check_logs_and_report",
|
|
459
|
-
},
|
|
460
|
-
warnings: [],
|
|
461
|
-
sourceRefs: [],
|
|
462
|
-
};
|
|
463
|
-
return envelope;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
if (command === "fallback") {
|
|
467
|
-
const ref = typeof input?.ref === "string" ? input.ref.trim() : "";
|
|
468
|
-
if (!ref) {
|
|
469
|
-
return {
|
|
470
|
-
ok: false,
|
|
471
|
-
error: {
|
|
472
|
-
code: "MISSING_FALLBACK_REF",
|
|
473
|
-
message: "fallback requires args.ref (e.g. fallback:…)",
|
|
474
|
-
requiredUserInput: ["ref"],
|
|
475
|
-
nextStep: "reinvoke_with_ref",
|
|
476
|
-
},
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
if (!deps.readModels?.loadFallbackView) {
|
|
480
|
-
return {
|
|
481
|
-
ok: false,
|
|
482
|
-
error: {
|
|
483
|
-
code: "FALLBACK_READ_MODEL_UNAVAILABLE",
|
|
484
|
-
message: "Operator fallback view requires workspace read models",
|
|
485
|
-
requiredUserInput: ["ref"],
|
|
486
|
-
nextStep: "wire_read_models_into_ops_router",
|
|
487
|
-
},
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
return (async () => {
|
|
491
|
-
try {
|
|
492
|
-
const data = await showOperatorFallback(ref, deps.readModels);
|
|
493
|
-
return { ok: true, command: "fallback", data };
|
|
494
|
-
}
|
|
495
|
-
catch (error) {
|
|
496
|
-
if (error instanceof OperatorFallbackNotFoundError) {
|
|
497
|
-
return {
|
|
498
|
-
ok: false,
|
|
499
|
-
command: "fallback",
|
|
500
|
-
error: {
|
|
501
|
-
code: error.code,
|
|
502
|
-
message: error.message,
|
|
503
|
-
requiredUserInput: ["ref"],
|
|
504
|
-
nextStep: "verify_fallback_ref_from_delivery_audit",
|
|
505
|
-
},
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
throw error;
|
|
509
|
-
}
|
|
510
|
-
})();
|
|
511
|
-
}
|
|
512
|
-
if (command === "capability_probe") {
|
|
513
|
-
// T1.2.8 (SN-CODE-03): run host capability probe with static unknown adapter (CLI context).
|
|
514
|
-
// Persists report when observabilityDb is available; returns safe JSON subset.
|
|
515
|
-
return (async () => {
|
|
516
|
-
const adapter = createStaticUnknownAdapter(deps.workspaceRoot);
|
|
517
|
-
const docCheckedAt = new Date().toISOString();
|
|
518
|
-
const report = probeHostCapability({
|
|
519
|
-
adapter,
|
|
520
|
-
docLinks: [],
|
|
521
|
-
docCheckedAt,
|
|
522
|
-
});
|
|
523
|
-
if (deps.observabilityDb) {
|
|
524
|
-
await recordHostCapability(deps.observabilityDb, report);
|
|
525
|
-
}
|
|
526
|
-
return {
|
|
527
|
-
ok: true,
|
|
528
|
-
command: "capability_probe",
|
|
529
|
-
data: {
|
|
530
|
-
reportId: report.reportId,
|
|
531
|
-
generatedAt: report.generatedAt,
|
|
532
|
-
deliveryTarget: report.deliveryTarget,
|
|
533
|
-
pluginLoad: { verdict: report.pluginLoad.verdict },
|
|
534
|
-
heartbeatBridge: { verdict: report.heartbeatBridge.verdict },
|
|
535
|
-
heartbeatToolInvocation: {
|
|
536
|
-
verdict: report.heartbeatToolInvocation.verdict,
|
|
537
|
-
},
|
|
538
|
-
ackDropBehavior: { verdict: report.ackDropBehavior.verdict },
|
|
539
|
-
conflictCount: report.conflictRecords.length,
|
|
540
|
-
recommendedNextStep: report.recommendedNextStep,
|
|
541
|
-
note: "static_local_probe: all verdicts are unknown without live host context",
|
|
542
|
-
},
|
|
543
|
-
};
|
|
544
|
-
})();
|
|
545
|
-
}
|
|
546
|
-
if (command === "near_real_smoke") {
|
|
547
|
-
// T3.3.2 (SN-CODE-05): wrap runNearRealConnectorSmoke as an ops surface command.
|
|
548
|
-
// Requires state + observabilityDb + workspaceRoot to be wired into OpsRouterDeps.
|
|
549
|
-
if (!deps.state || !deps.observabilityDb || !deps.workspaceRoot) {
|
|
550
|
-
return {
|
|
551
|
-
ok: false,
|
|
552
|
-
command: "near_real_smoke",
|
|
553
|
-
error: {
|
|
554
|
-
code: "NEAR_REAL_SMOKE_DEPS_UNAVAILABLE",
|
|
555
|
-
message: "near_real_smoke requires state, observabilityDb, and workspaceRoot in OpsRouterDeps",
|
|
556
|
-
nextStep: "wire_deps_into_ops_router",
|
|
557
|
-
},
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
return (async () => {
|
|
561
|
-
const result = await runNearRealConnectorSmoke({
|
|
562
|
-
state: deps.state,
|
|
563
|
-
observabilityDb: deps.observabilityDb,
|
|
564
|
-
workspaceRoot: deps.workspaceRoot,
|
|
565
|
-
});
|
|
566
|
-
return {
|
|
567
|
-
ok: true,
|
|
568
|
-
command: "near_real_smoke",
|
|
569
|
-
data: result,
|
|
570
|
-
};
|
|
571
|
-
})();
|
|
572
|
-
}
|
|
573
|
-
if (command === "connector_init") {
|
|
574
|
-
// T1.3.1 (SN-CODE-06): generate connector manifest stub.
|
|
575
|
-
return (async () => {
|
|
576
|
-
const result = await connectorInit({
|
|
577
|
-
platformId: typeof input?.platformId === "string" ? input.platformId : "",
|
|
578
|
-
family: typeof input?.family === "string"
|
|
579
|
-
? input.family
|
|
580
|
-
: undefined,
|
|
581
|
-
displayName: typeof input?.displayName === "string" ? input.displayName : undefined,
|
|
582
|
-
runnerKind: typeof input?.runnerKind === "string"
|
|
583
|
-
? input.runnerKind
|
|
584
|
-
: undefined,
|
|
585
|
-
force: Boolean(input?.force),
|
|
586
|
-
workspaceRoot: deps.workspaceRoot,
|
|
587
|
-
});
|
|
588
|
-
return result;
|
|
589
|
-
})();
|
|
590
|
-
}
|
|
591
|
-
if (command === "connector_behavior_add") {
|
|
592
|
-
return connectorBehaviorAdd({
|
|
593
|
-
platformId: typeof input?.platformId === "string" ? input.platformId : "",
|
|
594
|
-
behaviorId: typeof input?.behaviorId === "string"
|
|
595
|
-
? input.behaviorId
|
|
596
|
-
: typeof input?.capabilityId === "string"
|
|
597
|
-
? input.capabilityId
|
|
598
|
-
: "",
|
|
599
|
-
description: typeof input?.description === "string" ? input.description : undefined,
|
|
600
|
-
channel: typeof input?.channel === "string" ? input.channel : undefined,
|
|
601
|
-
sourceRefs: input?.sourceRefs,
|
|
602
|
-
observedCount: typeof input?.observedCount === "number" ? input.observedCount : undefined,
|
|
603
|
-
workspaceRoot: typeof input?.workspaceRoot === "string"
|
|
604
|
-
? input.workspaceRoot
|
|
605
|
-
: deps.workspaceRoot,
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
if (command === "connector_status") {
|
|
609
|
-
return connectorStatus(deps.registry, undefined, {
|
|
610
|
-
includeHealth: Boolean(input?.includeHealth),
|
|
611
|
-
workspaceRoot: typeof input?.workspaceRoot === "string"
|
|
612
|
-
? input.workspaceRoot
|
|
613
|
-
: deps.workspaceRoot,
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
if (command === "connector_test") {
|
|
617
|
-
// v7 T-V7C.C.1: dryRun=false is the canonical wet probe switch.
|
|
618
|
-
const isWet = input?.wet === true ||
|
|
619
|
-
input?.wet === "true" ||
|
|
620
|
-
input?.dryRun === false ||
|
|
621
|
-
input?.dryRun === "false";
|
|
622
|
-
const result = await connectorTest(deps.registry, {
|
|
623
|
-
platformId: typeof input?.platformId === "string" ? input.platformId : "",
|
|
624
|
-
dryRun: isWet ? false : (input?.dryRun === false ? false : true),
|
|
625
|
-
workspaceRoot: typeof input?.workspaceRoot === "string"
|
|
626
|
-
? input.workspaceRoot
|
|
627
|
-
: deps.workspaceRoot,
|
|
628
|
-
});
|
|
629
|
-
if (!isWet || !result.ok) {
|
|
630
|
-
return result;
|
|
631
|
-
}
|
|
632
|
-
const data = result.data && typeof result.data === "object"
|
|
633
|
-
? result.data
|
|
634
|
-
: {};
|
|
635
|
-
const capabilities = Array.isArray(data.capabilities)
|
|
636
|
-
? data.capabilities.filter((item) => typeof item === "string")
|
|
637
|
-
: [];
|
|
638
|
-
const capabilityId = textInput(input, "capabilityId") ?? capabilities[0] ?? "";
|
|
639
|
-
if (!capabilityId) {
|
|
640
|
-
return {
|
|
641
|
-
ok: false,
|
|
642
|
-
command: "connector_test",
|
|
643
|
-
error: {
|
|
644
|
-
code: "MISSING_CAPABILITY_ID",
|
|
645
|
-
message: "wet connector_test requires capabilityId or at least one connector capability",
|
|
646
|
-
requiredUserInput: ["capabilityId"],
|
|
647
|
-
nextStep: "reinvoke_with_capability_id",
|
|
648
|
-
},
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
const platformId = String(data.platformId ?? input?.platformId ?? "");
|
|
652
|
-
const registryEntry = deps.registry?.describeConnector(platformId);
|
|
653
|
-
if (!registryEntry) {
|
|
654
|
-
return result;
|
|
655
|
-
}
|
|
656
|
-
const registryV7 = new CapabilityContractRegistryV7();
|
|
657
|
-
registerConnectorForWetProbe({
|
|
658
|
-
registryV7,
|
|
659
|
-
entry: {
|
|
660
|
-
platformId: registryEntry.platformId,
|
|
661
|
-
capabilities: registryEntry.capabilities,
|
|
662
|
-
manifestPath: registryEntry.manifestPath,
|
|
663
|
-
},
|
|
664
|
-
workspaceRoot: typeof input?.workspaceRoot === "string"
|
|
665
|
-
? input.workspaceRoot
|
|
666
|
-
: deps.workspaceRoot,
|
|
667
|
-
selectedCapabilityId: capabilityId,
|
|
668
|
-
safeEndpoint: textInput(input, "safeEndpoint"),
|
|
669
|
-
});
|
|
670
|
-
const wetResult = await createWetProbeRunner().runWetProbe(platformId, capabilityId, registryV7);
|
|
671
|
-
const warnings = [];
|
|
672
|
-
let persistedProbeResult = false;
|
|
673
|
-
if (deps.state) {
|
|
674
|
-
await createCapabilityProbeResultStore(deps.state).appendProbeResult(wetResult.probeResult);
|
|
675
|
-
persistedProbeResult = true;
|
|
676
|
-
}
|
|
677
|
-
else {
|
|
678
|
-
warnings.push("state_db_unavailable:capability_probe_result_not_persisted");
|
|
679
|
-
}
|
|
680
|
-
return {
|
|
681
|
-
// T-V7C.C.5: only "available" (HTTP 200-299) counts as success;
|
|
682
|
-
// "degraded" (429/503) and "unavailable" both result in ok=false.
|
|
683
|
-
ok: wetResult.probeResult.actualStatus === "available",
|
|
684
|
-
command: "connector_test",
|
|
685
|
-
data: {
|
|
686
|
-
...data,
|
|
687
|
-
dryRun: false,
|
|
688
|
-
capabilityId,
|
|
689
|
-
actualStatus: wetResult.probeResult.actualStatus,
|
|
690
|
-
httpStatus: wetResult.probeResult.httpStatus ?? wetResult.httpStatus,
|
|
691
|
-
probeResultId: wetResult.probeResult.probeResultId,
|
|
692
|
-
probeConfigRef: wetResult.probeResult.probeConfigRef,
|
|
693
|
-
sampleResponseRef: wetResult.probeResult.sampleResponseRef,
|
|
694
|
-
persistedProbeResult,
|
|
695
|
-
triggerSource: "manual_run",
|
|
696
|
-
affectsHeartbeatCadence: false,
|
|
697
|
-
note: "wet probe mode: executed safe probe endpoint and persisted capability_probe_result when state DB is available",
|
|
698
|
-
},
|
|
699
|
-
warnings,
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
if (command === "connector:run") {
|
|
703
|
-
// T-ROS.C.3: manual connector execution — isolated from heartbeat cadence
|
|
704
|
-
const platformId = typeof input?.platformId === "string" ? input.platformId : "";
|
|
705
|
-
const capabilityId = typeof input?.capabilityId === "string" ? input.capabilityId : "";
|
|
706
|
-
if (!platformId || !capabilityId) {
|
|
707
|
-
return {
|
|
708
|
-
ok: false,
|
|
709
|
-
command: "connector:run",
|
|
710
|
-
error: {
|
|
711
|
-
code: "MISSING_PLATFORM_OR_CAPABILITY_ID",
|
|
712
|
-
message: "connector:run requires platformId and capabilityId",
|
|
713
|
-
requiredUserInput: ["platformId", "capabilityId"],
|
|
714
|
-
nextStep: "reinvoke_with_platform_and_capability_id",
|
|
715
|
-
},
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
if (!deps.connectorExecutor || !deps.state) {
|
|
719
|
-
return {
|
|
720
|
-
ok: false,
|
|
721
|
-
command: "connector:run",
|
|
722
|
-
error: {
|
|
723
|
-
code: "MANUAL_RUN_DEPS_UNAVAILABLE",
|
|
724
|
-
message: "connector:run requires connectorExecutor and state database",
|
|
725
|
-
nextStep: "wire_connector_executor_and_state_into_ops_router",
|
|
726
|
-
},
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
const toolExperienceStore = createToolExperienceStore(deps.state);
|
|
730
|
-
const experienceWriter = createExperienceWriter(toolExperienceStore);
|
|
731
|
-
const wetProbeRunner = createWetProbeRunner();
|
|
732
|
-
const registryV7 = new CapabilityContractRegistryV7();
|
|
733
|
-
// Populate V7 registry from dynamic registry if available (best-effort)
|
|
734
|
-
if (deps.registry) {
|
|
735
|
-
for (const entry of deps.registry.listConnectors()) {
|
|
736
|
-
if (entry.manifestPath) {
|
|
737
|
-
try {
|
|
738
|
-
const manifestText = fs.readFileSync(entry.manifestPath, "utf-8");
|
|
739
|
-
const manifest = JSON.parse(manifestText);
|
|
740
|
-
registryV7.register(manifest);
|
|
741
|
-
}
|
|
742
|
-
catch {
|
|
743
|
-
// Skip manifests that can't be read or don't validate as V7
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
const dispatcher = createManualRunDispatcher({
|
|
749
|
-
connectorExecutor: deps.connectorExecutor,
|
|
750
|
-
experienceWriter,
|
|
751
|
-
wetProbeRunner,
|
|
752
|
-
registryV7,
|
|
753
|
-
});
|
|
754
|
-
return dispatcher.runConnector({
|
|
755
|
-
platformId,
|
|
756
|
-
capabilityId,
|
|
757
|
-
payload: typeof input?.payload === "object" && input?.payload !== null
|
|
758
|
-
? input.payload
|
|
759
|
-
: undefined,
|
|
760
|
-
caller: typeof input?.caller === "string" ? input.caller : undefined,
|
|
761
|
-
reason: typeof input?.reason === "string" ? input.reason : undefined,
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
if (command === "goal") {
|
|
765
|
-
const rawAction = typeof input?.action === "string" ? input.action : "list";
|
|
766
|
-
const action = ["set", "list", "accept", "reject"].includes(rawAction)
|
|
767
|
-
? rawAction
|
|
768
|
-
: "list";
|
|
769
|
-
const sanitizeText = (v, maxLen = 1000) => {
|
|
770
|
-
if (typeof v !== "string")
|
|
771
|
-
return undefined;
|
|
772
|
-
const trimmed = v.trim();
|
|
773
|
-
if (trimmed.length === 0)
|
|
774
|
-
return undefined;
|
|
775
|
-
return trimmed.slice(0, maxLen);
|
|
776
|
-
};
|
|
777
|
-
return goalCommand(deps.state, {
|
|
778
|
-
action,
|
|
779
|
-
goalId: typeof input?.goalId === "string" ? input.goalId.trim().slice(0, 128) : undefined,
|
|
780
|
-
description: sanitizeText(input?.description),
|
|
781
|
-
completionCriteria: sanitizeText(input?.completionCriteria),
|
|
782
|
-
// T1.4.2: criteria alias for completionCriteria
|
|
783
|
-
criteria: sanitizeText(input?.criteria),
|
|
784
|
-
risk: typeof input?.risk === "string"
|
|
785
|
-
? input.risk
|
|
786
|
-
: undefined,
|
|
787
|
-
kind: typeof input?.kind === "string"
|
|
788
|
-
? input.kind
|
|
789
|
-
: undefined,
|
|
790
|
-
statusFilter: typeof input?.statusFilter === "string" ? input.statusFilter : undefined,
|
|
791
|
-
originFilter: typeof input?.originFilter === "string" ? input.originFilter : undefined,
|
|
792
|
-
limit: typeof input?.limit === "number" ? input.limit : undefined,
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
if (command === "dream:recent") {
|
|
796
|
-
if (!deps.readModels) {
|
|
797
|
-
return {
|
|
798
|
-
ok: false,
|
|
799
|
-
error: {
|
|
800
|
-
code: "READ_MODELS_UNAVAILABLE",
|
|
801
|
-
message: "dream:recent requires workspace read models",
|
|
802
|
-
nextStep: "wire_read_models_into_ops_router",
|
|
803
|
-
},
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
const limit = typeof input?.limit === "number" ? input.limit : 5;
|
|
807
|
-
const data = await deps.readModels.loadDreamRecent(limit);
|
|
808
|
-
return { ok: true, data };
|
|
809
|
-
}
|
|
810
|
-
if (command === "cycle:recent") {
|
|
811
|
-
if (!deps.readModels) {
|
|
812
|
-
return {
|
|
813
|
-
ok: false,
|
|
814
|
-
error: {
|
|
815
|
-
code: "READ_MODELS_UNAVAILABLE",
|
|
816
|
-
message: "cycle:recent requires workspace read models",
|
|
817
|
-
nextStep: "wire_read_models_into_ops_router",
|
|
818
|
-
},
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
const limit = typeof input?.limit === "number" ? input.limit : 5;
|
|
822
|
-
const data = await deps.readModels.loadCycleRecent(limit);
|
|
823
|
-
return { ok: true, data };
|
|
824
|
-
}
|
|
825
|
-
// ─── v7 commands (T-ROS.C.1) ─────────────────────────────────────────
|
|
826
|
-
/** [G2] self_health — transparent pass-through from SelfHealthSnapshot (DR-042). */
|
|
827
|
-
if (command === "self_health") {
|
|
828
|
-
const generatedAt = new Date().toISOString();
|
|
829
|
-
try {
|
|
830
|
-
ensureMinimumProbes();
|
|
831
|
-
const snap = await getSelfHealthSnapshot();
|
|
832
|
-
const degraded_dimensions = Object.entries(snap.dimensions)
|
|
833
|
-
.filter(([, d]) => d.status === "degraded")
|
|
834
|
-
.map(([k]) => k);
|
|
835
|
-
const envelope = {
|
|
836
|
-
ok: true,
|
|
837
|
-
command: "self_health",
|
|
838
|
-
runtimeMode: "workspace_full_runtime",
|
|
839
|
-
surfaceMode: "cli",
|
|
840
|
-
generatedAt,
|
|
841
|
-
data: {
|
|
842
|
-
overall: snap.overall,
|
|
843
|
-
generatedAt: snap.generatedAt,
|
|
844
|
-
degraded_dimensions,
|
|
845
|
-
dimensions: snap.dimensions,
|
|
846
|
-
},
|
|
847
|
-
warnings: [],
|
|
848
|
-
sourceRefs: ["observability/services/self-health-snapshot.ts"],
|
|
849
|
-
};
|
|
850
|
-
return envelope;
|
|
851
|
-
}
|
|
852
|
-
catch (err) {
|
|
853
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
854
|
-
const envelope = {
|
|
855
|
-
ok: false,
|
|
856
|
-
command: "self_health",
|
|
857
|
-
runtimeMode: "unavailable",
|
|
858
|
-
surfaceMode: "cli",
|
|
859
|
-
generatedAt,
|
|
860
|
-
error: { code: "SELF_HEALTH_PROBE_FAILED", message: msg },
|
|
861
|
-
warnings: [],
|
|
862
|
-
sourceRefs: [],
|
|
863
|
-
};
|
|
864
|
-
return envelope;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
/**
|
|
868
|
-
* [G3] tool_affordance — body-tool AffordanceMap pass-through.
|
|
869
|
-
* Port not yet wired in this wave; returns degraded view with clear next-step.
|
|
870
|
-
*/
|
|
871
|
-
if (command === "tool_affordance") {
|
|
872
|
-
const generatedAt = new Date().toISOString();
|
|
873
|
-
if (deps.toolAffordancePort) {
|
|
874
|
-
const allStatuses = [
|
|
875
|
-
"safe",
|
|
876
|
-
"exploratory",
|
|
877
|
-
"needs_auth",
|
|
878
|
-
"painful",
|
|
879
|
-
"unavailable",
|
|
880
|
-
];
|
|
881
|
-
const platformIds = Array.isArray(input?.platformIds)
|
|
882
|
-
? input.platformIds.filter((item) => typeof item === "string")
|
|
883
|
-
: typeof input?.platformId === "string"
|
|
884
|
-
? [input.platformId]
|
|
885
|
-
: undefined;
|
|
886
|
-
const data = await deps.toolAffordancePort.assembleAffordanceMap({
|
|
887
|
-
platformIds,
|
|
888
|
-
allowedStatuses: allStatuses,
|
|
889
|
-
goalKind: typeof input?.goalKind === "string" ? input.goalKind : undefined,
|
|
890
|
-
});
|
|
891
|
-
const envelope = {
|
|
892
|
-
ok: true,
|
|
893
|
-
command: "tool_affordance",
|
|
894
|
-
runtimeMode: "workspace_full_runtime",
|
|
895
|
-
surfaceMode: "cli",
|
|
896
|
-
generatedAt,
|
|
897
|
-
data,
|
|
898
|
-
warnings: [],
|
|
899
|
-
sourceRefs: [
|
|
900
|
-
"core/second-nature/body/tool-affordance/affordance-assembler.ts",
|
|
901
|
-
],
|
|
902
|
-
};
|
|
903
|
-
return envelope;
|
|
904
|
-
}
|
|
905
|
-
const envelope = {
|
|
906
|
-
ok: false,
|
|
907
|
-
command: "tool_affordance",
|
|
908
|
-
runtimeMode: "unavailable",
|
|
909
|
-
surfaceMode: "cli",
|
|
910
|
-
generatedAt,
|
|
911
|
-
error: {
|
|
912
|
-
code: "TOOL_AFFORDANCE_PORT_UNWIRED",
|
|
913
|
-
message: "tool_affordance requires body-tool AffordanceMap port (T-BTS.C.1) to be wired into OpsRouterDeps",
|
|
914
|
-
nextStep: "wire_body_tool_port_into_ops_router_deps",
|
|
915
|
-
},
|
|
916
|
-
warnings: [],
|
|
917
|
-
sourceRefs: [],
|
|
918
|
-
};
|
|
919
|
-
return envelope;
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* [G6] heartbeat_digest — wraps generateHeartbeatDigest.
|
|
923
|
-
* Requires auditStore in deps; degrades if unavailable.
|
|
924
|
-
*/
|
|
925
|
-
if (command === "heartbeat_digest") {
|
|
926
|
-
const generatedAt = new Date().toISOString();
|
|
927
|
-
if (!deps.auditStore) {
|
|
928
|
-
const envelope = {
|
|
929
|
-
ok: false,
|
|
930
|
-
command: "heartbeat_digest",
|
|
931
|
-
runtimeMode: "unavailable",
|
|
932
|
-
surfaceMode: "cli",
|
|
933
|
-
generatedAt,
|
|
934
|
-
error: {
|
|
935
|
-
code: "AUDIT_STORE_UNAVAILABLE",
|
|
936
|
-
message: "heartbeat_digest requires auditStore in OpsRouterDeps",
|
|
937
|
-
nextStep: "wire_audit_store_into_ops_router",
|
|
938
|
-
},
|
|
939
|
-
warnings: [],
|
|
940
|
-
sourceRefs: [],
|
|
941
|
-
};
|
|
942
|
-
return envelope;
|
|
943
|
-
}
|
|
944
|
-
const date = typeof input?.date === "string" && input.date
|
|
945
|
-
? input.date
|
|
946
|
-
: new Date().toISOString().slice(0, 10);
|
|
947
|
-
try {
|
|
948
|
-
const digestDeps = {
|
|
949
|
-
auditStore: deps.auditStore,
|
|
950
|
-
...deps.heartbeatDigestDeps,
|
|
951
|
-
};
|
|
952
|
-
const digest = await generateHeartbeatDigest(date, digestDeps);
|
|
953
|
-
const envelope = {
|
|
954
|
-
ok: true,
|
|
955
|
-
command: "heartbeat_digest",
|
|
956
|
-
runtimeMode: "workspace_full_runtime",
|
|
957
|
-
surfaceMode: "cli",
|
|
958
|
-
generatedAt,
|
|
959
|
-
data: digest,
|
|
960
|
-
warnings: [],
|
|
961
|
-
sourceRefs: ["observability/services/heartbeat-digest-assembler.ts"],
|
|
962
|
-
};
|
|
963
|
-
return envelope;
|
|
964
|
-
}
|
|
965
|
-
catch (err) {
|
|
966
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
967
|
-
const envelope = {
|
|
968
|
-
ok: false,
|
|
969
|
-
command: "heartbeat_digest",
|
|
970
|
-
runtimeMode: "unavailable",
|
|
971
|
-
surfaceMode: "cli",
|
|
972
|
-
generatedAt,
|
|
973
|
-
error: { code: "DIGEST_GENERATION_FAILED", message: msg },
|
|
974
|
-
warnings: [],
|
|
975
|
-
sourceRefs: [],
|
|
976
|
-
};
|
|
977
|
-
return envelope;
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* [G6] snapshot:capture — production capture path for RestoreSnapshot +
|
|
982
|
-
* NarrativeTimeline. This gives restore and narrative:diff real state to consume.
|
|
983
|
-
*/
|
|
984
|
-
if (command === "snapshot:capture") {
|
|
985
|
-
return captureRuntimeSnapshot(deps, input);
|
|
986
|
-
}
|
|
987
|
-
/**
|
|
988
|
-
* [G6] narrative:diff — queryNarrativeDiff between two versions.
|
|
989
|
-
* Requires narrativeTimelineDeps in OpsRouterDeps.
|
|
990
|
-
*/
|
|
991
|
-
if (command === "narrative:diff") {
|
|
992
|
-
const generatedAt = new Date().toISOString();
|
|
993
|
-
if (!deps.narrativeTimelineDeps) {
|
|
994
|
-
const envelope = {
|
|
995
|
-
ok: false,
|
|
996
|
-
command: "narrative:diff",
|
|
997
|
-
runtimeMode: "unavailable",
|
|
998
|
-
surfaceMode: "cli",
|
|
999
|
-
generatedAt,
|
|
1000
|
-
error: {
|
|
1001
|
-
code: "NARRATIVE_TIMELINE_PORT_UNAVAILABLE",
|
|
1002
|
-
message: "narrative:diff requires narrativeTimelineDeps in OpsRouterDeps",
|
|
1003
|
-
nextStep: "wire_narrative_timeline_deps_into_ops_router",
|
|
1004
|
-
},
|
|
1005
|
-
warnings: [],
|
|
1006
|
-
sourceRefs: [],
|
|
1007
|
-
};
|
|
1008
|
-
return envelope;
|
|
1009
|
-
}
|
|
1010
|
-
const fromVersion = typeof input?.from === "string" ? input.from : "";
|
|
1011
|
-
const toVersion = typeof input?.to === "string" ? input.to : "";
|
|
1012
|
-
if (!fromVersion || !toVersion) {
|
|
1013
|
-
const envelope = {
|
|
1014
|
-
ok: false,
|
|
1015
|
-
command: "narrative:diff",
|
|
1016
|
-
runtimeMode: "workspace_full_runtime",
|
|
1017
|
-
surfaceMode: "cli",
|
|
1018
|
-
generatedAt,
|
|
1019
|
-
error: {
|
|
1020
|
-
code: "MISSING_VERSIONS",
|
|
1021
|
-
message: "narrative:diff requires 'from' and 'to' version arguments",
|
|
1022
|
-
nextStep: "reinvoke_with_from_and_to",
|
|
1023
|
-
},
|
|
1024
|
-
warnings: [],
|
|
1025
|
-
sourceRefs: [],
|
|
1026
|
-
};
|
|
1027
|
-
return envelope;
|
|
1028
|
-
}
|
|
1029
|
-
try {
|
|
1030
|
-
const diff = await queryNarrativeDiff(fromVersion, toVersion, deps.narrativeTimelineDeps);
|
|
1031
|
-
const envelope = {
|
|
1032
|
-
ok: true,
|
|
1033
|
-
command: "narrative:diff",
|
|
1034
|
-
runtimeMode: "workspace_full_runtime",
|
|
1035
|
-
surfaceMode: "cli",
|
|
1036
|
-
generatedAt,
|
|
1037
|
-
data: diff,
|
|
1038
|
-
warnings: [],
|
|
1039
|
-
sourceRefs: ["observability/services/narrative-timeline-query-service.ts"],
|
|
1040
|
-
};
|
|
1041
|
-
return envelope;
|
|
1042
|
-
}
|
|
1043
|
-
catch (err) {
|
|
1044
|
-
if (err instanceof NarrativeVersionNotFoundError) {
|
|
1045
|
-
const envelope = {
|
|
1046
|
-
ok: false,
|
|
1047
|
-
command: "narrative:diff",
|
|
1048
|
-
runtimeMode: "workspace_full_runtime",
|
|
1049
|
-
surfaceMode: "cli",
|
|
1050
|
-
generatedAt,
|
|
1051
|
-
error: {
|
|
1052
|
-
code: "NARRATIVE_VERSION_NOT_FOUND",
|
|
1053
|
-
message: err.message,
|
|
1054
|
-
nextStep: "verify_version_exists_in_timeline",
|
|
1055
|
-
},
|
|
1056
|
-
warnings: [],
|
|
1057
|
-
sourceRefs: [],
|
|
1058
|
-
};
|
|
1059
|
-
return envelope;
|
|
1060
|
-
}
|
|
1061
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
1062
|
-
const envelope = {
|
|
1063
|
-
ok: false,
|
|
1064
|
-
command: "narrative:diff",
|
|
1065
|
-
runtimeMode: "unavailable",
|
|
1066
|
-
surfaceMode: "cli",
|
|
1067
|
-
generatedAt,
|
|
1068
|
-
error: { code: "NARRATIVE_DIFF_FAILED", message: msg },
|
|
1069
|
-
warnings: [],
|
|
1070
|
-
sourceRefs: [],
|
|
1071
|
-
};
|
|
1072
|
-
return envelope;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
/**
|
|
1076
|
-
* [G6] timeline — queryNarrativeTimeline with cursor pagination.
|
|
1077
|
-
* Requires narrativeTimelineDeps in OpsRouterDeps.
|
|
1078
|
-
*/
|
|
1079
|
-
if (command === "timeline") {
|
|
1080
|
-
const generatedAt = new Date().toISOString();
|
|
1081
|
-
if (!deps.narrativeTimelineDeps) {
|
|
1082
|
-
const envelope = {
|
|
1083
|
-
ok: false,
|
|
1084
|
-
command: "timeline",
|
|
1085
|
-
runtimeMode: "unavailable",
|
|
1086
|
-
surfaceMode: "cli",
|
|
1087
|
-
generatedAt,
|
|
1088
|
-
error: {
|
|
1089
|
-
code: "NARRATIVE_TIMELINE_PORT_UNAVAILABLE",
|
|
1090
|
-
message: "timeline requires narrativeTimelineDeps in OpsRouterDeps",
|
|
1091
|
-
nextStep: "wire_narrative_timeline_deps_into_ops_router",
|
|
1092
|
-
},
|
|
1093
|
-
warnings: [],
|
|
1094
|
-
sourceRefs: [],
|
|
1095
|
-
};
|
|
1096
|
-
return envelope;
|
|
1097
|
-
}
|
|
1098
|
-
const now = new Date();
|
|
1099
|
-
const to = typeof input?.to === "string" ? input.to : now.toISOString();
|
|
1100
|
-
const from = typeof input?.from === "string"
|
|
1101
|
-
? input.from
|
|
1102
|
-
: new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000).toISOString();
|
|
1103
|
-
const limit = typeof input?.limit === "number" ? input.limit : 20;
|
|
1104
|
-
const cursor = typeof input?.cursor === "string" ? input.cursor : undefined;
|
|
1105
|
-
try {
|
|
1106
|
-
const page = await queryNarrativeTimeline(from, to, { limit, cursor }, deps.narrativeTimelineDeps);
|
|
1107
|
-
const envelope = {
|
|
1108
|
-
ok: true,
|
|
1109
|
-
command: "timeline",
|
|
1110
|
-
runtimeMode: "workspace_full_runtime",
|
|
1111
|
-
surfaceMode: "cli",
|
|
1112
|
-
generatedAt,
|
|
1113
|
-
data: page,
|
|
1114
|
-
warnings: [],
|
|
1115
|
-
sourceRefs: ["observability/services/narrative-timeline-query-service.ts"],
|
|
1116
|
-
};
|
|
1117
|
-
return envelope;
|
|
1118
|
-
}
|
|
1119
|
-
catch (err) {
|
|
1120
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
1121
|
-
const code = err.name === "NarrativeQueryRangeError"
|
|
1122
|
-
? "NARRATIVE_RANGE_EXCEEDED"
|
|
1123
|
-
: "TIMELINE_QUERY_FAILED";
|
|
1124
|
-
const envelope = {
|
|
1125
|
-
ok: false,
|
|
1126
|
-
command: "timeline",
|
|
1127
|
-
runtimeMode: "unavailable",
|
|
1128
|
-
surfaceMode: "cli",
|
|
1129
|
-
generatedAt,
|
|
1130
|
-
error: { code, message: msg },
|
|
1131
|
-
warnings: [],
|
|
1132
|
-
sourceRefs: [],
|
|
1133
|
-
};
|
|
1134
|
-
return envelope;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* [G6] restore — bounded state restoration via RestoreSnapshotStore + audit (T-ROS.C.1, T-OBS.C.6).
|
|
1139
|
-
* When restoreSnapshotStore is wired, attempts to apply the snapshot payload back to state.
|
|
1140
|
-
* Always writes RestoreAudit. Never restores credential fields.
|
|
1141
|
-
*/
|
|
1142
|
-
if (command === "restore") {
|
|
1143
|
-
const generatedAt = new Date().toISOString();
|
|
1144
|
-
if (!deps.auditStore) {
|
|
1145
|
-
const envelope = {
|
|
1146
|
-
ok: false,
|
|
1147
|
-
command: "restore",
|
|
1148
|
-
runtimeMode: "unavailable",
|
|
1149
|
-
surfaceMode: "cli",
|
|
1150
|
-
generatedAt,
|
|
1151
|
-
error: {
|
|
1152
|
-
code: "AUDIT_STORE_UNAVAILABLE",
|
|
1153
|
-
message: "restore requires auditStore in OpsRouterDeps",
|
|
1154
|
-
nextStep: "wire_audit_store_into_ops_router",
|
|
1155
|
-
},
|
|
1156
|
-
warnings: [],
|
|
1157
|
-
sourceRefs: [],
|
|
1158
|
-
};
|
|
1159
|
-
return envelope;
|
|
1160
|
-
}
|
|
1161
|
-
let restoreTarget;
|
|
1162
|
-
let fromVersion;
|
|
1163
|
-
let toVersion;
|
|
1164
|
-
// T-V7C.C.5: snapshotId operator-friendly parameter takes precedence over legacy fields.
|
|
1165
|
-
// When snapshotId is provided, resolve restoreTarget/fromVersion/toVersion from the
|
|
1166
|
-
// matching snapshot row; otherwise fall back to explicit legacy parameters.
|
|
1167
|
-
const snapshotId = textInput(input, "snapshotId");
|
|
1168
|
-
if (snapshotId) {
|
|
1169
|
-
if (!deps.restoreSnapshotStore) {
|
|
1170
|
-
const envelope = {
|
|
1171
|
-
ok: false,
|
|
1172
|
-
command: "restore",
|
|
1173
|
-
runtimeMode: "unavailable",
|
|
1174
|
-
surfaceMode: "cli",
|
|
1175
|
-
generatedAt,
|
|
1176
|
-
error: {
|
|
1177
|
-
code: "RESTORE_SNAPSHOT_STORE_UNAVAILABLE",
|
|
1178
|
-
message: "snapshotId restore requires restoreSnapshotStore in OpsRouterDeps",
|
|
1179
|
-
nextStep: "wire_restore_snapshot_store_into_ops_router",
|
|
1180
|
-
},
|
|
1181
|
-
warnings: [],
|
|
1182
|
-
sourceRefs: [],
|
|
1183
|
-
};
|
|
1184
|
-
return envelope;
|
|
1185
|
-
}
|
|
1186
|
-
const snapshots = await deps.restoreSnapshotStore.listSnapshots();
|
|
1187
|
-
const match = snapshots.find((s) => s.snapshotId === snapshotId);
|
|
1188
|
-
if (match) {
|
|
1189
|
-
restoreTarget = snapshotId;
|
|
1190
|
-
fromVersion = match.capturedAt;
|
|
1191
|
-
toVersion = snapshotId;
|
|
1192
|
-
}
|
|
1193
|
-
else {
|
|
1194
|
-
const envelope = {
|
|
1195
|
-
ok: false,
|
|
1196
|
-
command: "restore",
|
|
1197
|
-
runtimeMode: "workspace_full_runtime",
|
|
1198
|
-
surfaceMode: "cli",
|
|
1199
|
-
generatedAt,
|
|
1200
|
-
error: {
|
|
1201
|
-
code: "SNAPSHOT_NOT_FOUND",
|
|
1202
|
-
message: `snapshotId ${snapshotId} not found in restore_snapshot table`,
|
|
1203
|
-
nextStep: "list_available_snapshots_or_verify_snapshotId",
|
|
1204
|
-
},
|
|
1205
|
-
warnings: [],
|
|
1206
|
-
sourceRefs: [],
|
|
1207
|
-
};
|
|
1208
|
-
return envelope;
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
else {
|
|
1212
|
-
const missingFields = [];
|
|
1213
|
-
if (typeof input?.restoreTarget !== "string")
|
|
1214
|
-
missingFields.push("restoreTarget");
|
|
1215
|
-
if (typeof input?.fromVersion !== "string")
|
|
1216
|
-
missingFields.push("fromVersion");
|
|
1217
|
-
if (typeof input?.toVersion !== "string")
|
|
1218
|
-
missingFields.push("toVersion");
|
|
1219
|
-
if (missingFields.length > 0) {
|
|
1220
|
-
const envelope = {
|
|
1221
|
-
ok: false,
|
|
1222
|
-
command: "restore",
|
|
1223
|
-
runtimeMode: "workspace_full_runtime",
|
|
1224
|
-
surfaceMode: "cli",
|
|
1225
|
-
generatedAt,
|
|
1226
|
-
error: {
|
|
1227
|
-
code: "MISSING_RESTORE_FIELDS",
|
|
1228
|
-
message: `restore requires: ${missingFields.join(", ")}`,
|
|
1229
|
-
nextStep: "reinvoke_with_required_fields",
|
|
1230
|
-
},
|
|
1231
|
-
warnings: [],
|
|
1232
|
-
sourceRefs: [],
|
|
1233
|
-
};
|
|
1234
|
-
return envelope;
|
|
1235
|
-
}
|
|
1236
|
-
restoreTarget = input.restoreTarget;
|
|
1237
|
-
fromVersion = input.fromVersion;
|
|
1238
|
-
toVersion = input.toVersion;
|
|
1239
|
-
}
|
|
1240
|
-
// [NEW] Invoke bounded restore via RestoreSnapshotStore when wired
|
|
1241
|
-
let restoreResult = {
|
|
1242
|
-
ok: false,
|
|
1243
|
-
completedEntities: [],
|
|
1244
|
-
failedEntities: [],
|
|
1245
|
-
warnings: ["restore_snapshot_store_unavailable"],
|
|
1246
|
-
};
|
|
1247
|
-
if (deps.restoreSnapshotStore) {
|
|
1248
|
-
restoreResult = await deps.restoreSnapshotStore.applyBoundedRestore({
|
|
1249
|
-
restoreTarget: restoreTarget,
|
|
1250
|
-
fromVersion: fromVersion,
|
|
1251
|
-
toVersion: toVersion,
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
const event = {
|
|
1255
|
-
id: `restore-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
1256
|
-
restoreTarget: restoreTarget,
|
|
1257
|
-
fromVersion: fromVersion,
|
|
1258
|
-
toVersion: toVersion,
|
|
1259
|
-
triggeredBy: input?.triggeredBy ?? "operator",
|
|
1260
|
-
reason: typeof input?.reason === "string" ? input.reason : "manual_restore",
|
|
1261
|
-
completedEntities: restoreResult.completedEntities,
|
|
1262
|
-
failedEntities: restoreResult.failedEntities,
|
|
1263
|
-
// credentials are always excluded from restore audit
|
|
1264
|
-
excludedFields: Array.isArray(input?.excludedFields)
|
|
1265
|
-
? input.excludedFields.filter((f) => typeof f === "string")
|
|
1266
|
-
: ["credential", "encryptionKey"],
|
|
1267
|
-
restoredFieldCount: restoreResult.completedEntities.length,
|
|
1268
|
-
createdAt: generatedAt,
|
|
1269
|
-
traceId: typeof input?.traceId === "string" ? input.traceId : `trace-restore-${Date.now()}`,
|
|
1270
|
-
};
|
|
1271
|
-
const auditResult = await writeRestoreAudit(event, deps.auditStore);
|
|
1272
|
-
const envelope = {
|
|
1273
|
-
ok: restoreResult.ok && auditResult.ok,
|
|
1274
|
-
command: "restore",
|
|
1275
|
-
runtimeMode: "workspace_full_runtime",
|
|
1276
|
-
surfaceMode: "cli",
|
|
1277
|
-
generatedAt,
|
|
1278
|
-
data: {
|
|
1279
|
-
auditWritten: auditResult.warnings.length === 0,
|
|
1280
|
-
fromVersion: event.fromVersion,
|
|
1281
|
-
toVersion: event.toVersion,
|
|
1282
|
-
restoreTarget: event.restoreTarget,
|
|
1283
|
-
isPartialRestore: event.failedEntities.length > 0,
|
|
1284
|
-
failedEntities: event.failedEntities,
|
|
1285
|
-
completedEntities: event.completedEntities,
|
|
1286
|
-
restoreSnapshotStoreAvailable: !!deps.restoreSnapshotStore,
|
|
1287
|
-
},
|
|
1288
|
-
warnings: [...restoreResult.warnings, ...auditResult.warnings],
|
|
1289
|
-
sourceRefs: [
|
|
1290
|
-
"observability/services/restore-audit-service.ts",
|
|
1291
|
-
"storage/services/restore-snapshot-store.ts",
|
|
1292
|
-
],
|
|
1293
|
-
};
|
|
1294
|
-
return envelope;
|
|
1295
|
-
}
|
|
1296
|
-
/**
|
|
1297
|
-
* [G7] runtime_secret_bootstrap — RuntimeSecretAnchorView pass-through.
|
|
1298
|
-
* Requires secretAnchorDeps in OpsRouterDeps; never returns key plaintext.
|
|
1299
|
-
*/
|
|
1300
|
-
if (command === "runtime_secret_bootstrap") {
|
|
1301
|
-
const generatedAt = new Date().toISOString();
|
|
1302
|
-
if (!deps.secretAnchorDeps) {
|
|
1303
|
-
const envelope = {
|
|
1304
|
-
ok: false,
|
|
1305
|
-
command: "runtime_secret_bootstrap",
|
|
1306
|
-
runtimeMode: "unavailable",
|
|
1307
|
-
surfaceMode: "cli",
|
|
1308
|
-
generatedAt,
|
|
1309
|
-
error: {
|
|
1310
|
-
code: "SECRET_ANCHOR_DEPS_UNAVAILABLE",
|
|
1311
|
-
message: "runtime_secret_bootstrap requires secretAnchorDeps in OpsRouterDeps",
|
|
1312
|
-
nextStep: "wire_secret_anchor_deps_into_ops_router",
|
|
1313
|
-
},
|
|
1314
|
-
warnings: [],
|
|
1315
|
-
sourceRefs: [],
|
|
1316
|
-
};
|
|
1317
|
-
return envelope;
|
|
1318
|
-
}
|
|
1319
|
-
try {
|
|
1320
|
-
const view = await viewSecretAnchor(deps.secretAnchorDeps);
|
|
1321
|
-
// Map to RuntimeSecretBootstrapView (design model §6.1)
|
|
1322
|
-
const data = {
|
|
1323
|
-
status: view.status === "verified" || view.status === "ok"
|
|
1324
|
-
? "ok"
|
|
1325
|
-
: view.status === "missing"
|
|
1326
|
-
? "runtime_secret_anchor_missing"
|
|
1327
|
-
: view.status === "wrong_key"
|
|
1328
|
-
? "credential_recovery_required"
|
|
1329
|
-
: view.status === "decryption_failed"
|
|
1330
|
-
? "runtime_secret_unavailable"
|
|
1331
|
-
: "unknown",
|
|
1332
|
-
keyHealth: view.status === "verified" || view.status === "ok"
|
|
1333
|
-
? "ok"
|
|
1334
|
-
: view.status === "missing"
|
|
1335
|
-
? "missing_key"
|
|
1336
|
-
: view.status === "wrong_key"
|
|
1337
|
-
? "wrong_key"
|
|
1338
|
-
: "unknown",
|
|
1339
|
-
anchorLocation: view.keyPath,
|
|
1340
|
-
recoveryPrincipleRef: view.recoveryDocRef,
|
|
1341
|
-
plaintextKeyExposed: false,
|
|
1342
|
-
reasonCode: view.reasonCode,
|
|
1343
|
-
recoverySteps: view.recoverySteps,
|
|
1344
|
-
};
|
|
1345
|
-
const envelope = {
|
|
1346
|
-
ok: true,
|
|
1347
|
-
command: "runtime_secret_bootstrap",
|
|
1348
|
-
runtimeMode: "workspace_full_runtime",
|
|
1349
|
-
surfaceMode: "cli",
|
|
1350
|
-
generatedAt,
|
|
1351
|
-
data,
|
|
1352
|
-
warnings: [],
|
|
1353
|
-
sourceRefs: ["observability/services/runtime-secret-anchor-view.ts"],
|
|
1354
|
-
};
|
|
1355
|
-
return envelope;
|
|
1356
|
-
}
|
|
1357
|
-
catch (err) {
|
|
1358
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
1359
|
-
const envelope = {
|
|
1360
|
-
ok: false,
|
|
1361
|
-
command: "runtime_secret_bootstrap",
|
|
1362
|
-
runtimeMode: "unavailable",
|
|
1363
|
-
surfaceMode: "cli",
|
|
1364
|
-
generatedAt,
|
|
1365
|
-
error: { code: "SECRET_ANCHOR_PROBE_FAILED", message: msg },
|
|
1366
|
-
warnings: [],
|
|
1367
|
-
sourceRefs: [],
|
|
1368
|
-
};
|
|
1369
|
-
return envelope;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
// ─── T-V7C.C.4R: guidance_payload ──────────────────────────────────────
|
|
1373
|
-
// Returns the assembled impulse + atmosphere for a given scene context.
|
|
1374
|
-
// Useful for Claw to inspect what guidance content would be injected before
|
|
1375
|
-
// a real heartbeat cycle, and to verify platform-specific impulse overrides.
|
|
1376
|
-
if (command === "guidance_payload") {
|
|
1377
|
-
const generatedAt = new Date().toISOString();
|
|
1378
|
-
const { assembleImpulseSync } = await import("../../guidance/impulse-assembler.js");
|
|
1379
|
-
const { getBaselineAtmosphereTemplate } = await import("../../guidance/template-registry.js");
|
|
1380
|
-
const sceneType = input?.sceneType ?? "social";
|
|
1381
|
-
const capabilityIntent = typeof input?.capabilityIntent === "string"
|
|
1382
|
-
? input.capabilityIntent
|
|
1383
|
-
: undefined;
|
|
1384
|
-
const platformId = typeof input?.platformId === "string"
|
|
1385
|
-
? input.platformId
|
|
1386
|
-
: undefined;
|
|
1387
|
-
const validSceneTypes = ["social", "reply", "outreach", "quiet", "explain", "user_reply"];
|
|
1388
|
-
if (!validSceneTypes.includes(sceneType)) {
|
|
1389
|
-
const envelope = {
|
|
1390
|
-
ok: false,
|
|
1391
|
-
command: "guidance_payload",
|
|
1392
|
-
runtimeMode: "unavailable",
|
|
1393
|
-
surfaceMode: "cli",
|
|
1394
|
-
generatedAt,
|
|
1395
|
-
error: {
|
|
1396
|
-
code: "INVALID_SCENE_TYPE",
|
|
1397
|
-
message: `sceneType must be one of: ${validSceneTypes.join(", ")}`,
|
|
1398
|
-
nextStep: "reinvoke_with_valid_scene_type",
|
|
1399
|
-
},
|
|
1400
|
-
warnings: [],
|
|
1401
|
-
sourceRefs: [],
|
|
1402
|
-
};
|
|
1403
|
-
return envelope;
|
|
1404
|
-
}
|
|
1405
|
-
const impulseResult = assembleImpulseSync({
|
|
1406
|
-
sceneType: sceneType,
|
|
1407
|
-
capabilityIntent,
|
|
1408
|
-
platformId,
|
|
1409
|
-
});
|
|
1410
|
-
const { buildExpressionBoundary } = await import("../../guidance/output-guard.js");
|
|
1411
|
-
const { getShortAtmosphereTemplate } = await import("../../guidance/template-registry.js");
|
|
1412
|
-
const atmosphere = getShortAtmosphereTemplate("active", "low");
|
|
1413
|
-
const expressionBoundary = buildExpressionBoundary(sceneType);
|
|
1414
|
-
const envelope = {
|
|
1415
|
-
ok: true,
|
|
1416
|
-
command: "guidance_payload",
|
|
1417
|
-
runtimeMode: deps.runtimeAvailable ? "workspace_full_runtime" : "host_safe_carrier",
|
|
1418
|
-
surfaceMode: "cli",
|
|
1419
|
-
generatedAt,
|
|
1420
|
-
data: {
|
|
1421
|
-
sceneType,
|
|
1422
|
-
capabilityIntent: capabilityIntent ?? null,
|
|
1423
|
-
platformId: platformId ?? null,
|
|
1424
|
-
capabilityClass: impulseResult.capabilityClass,
|
|
1425
|
-
impulseSource: impulseResult.source,
|
|
1426
|
-
impulseText: impulseResult.impulse?.text ?? null,
|
|
1427
|
-
impulseReviewStatus: impulseResult.impulse?.reviewStatus ?? null,
|
|
1428
|
-
atmosphereText: atmosphere.text,
|
|
1429
|
-
atmosphereReviewStatus: atmosphere.reviewStatus,
|
|
1430
|
-
expressionBoundaryConstraints: expressionBoundary.constraints,
|
|
1431
|
-
expressionBoundaryStyle: expressionBoundary.style,
|
|
1432
|
-
},
|
|
1433
|
-
warnings: impulseResult.source === "none"
|
|
1434
|
-
? ["no_impulse_available_for_this_scene_and_capability"]
|
|
1435
|
-
: [],
|
|
1436
|
-
sourceRefs: [
|
|
1437
|
-
"guidance/capability-class.ts",
|
|
1438
|
-
"guidance/impulse-assembler.ts",
|
|
1439
|
-
"guidance/template-registry.ts",
|
|
1440
|
-
"guidance/output-guard.ts",
|
|
1441
|
-
],
|
|
1442
|
-
};
|
|
1443
|
-
return envelope;
|
|
1444
|
-
}
|
|
1445
|
-
return {
|
|
1446
|
-
ok: false,
|
|
1447
|
-
error: {
|
|
1448
|
-
code: "unknown_ops_command",
|
|
1449
|
-
message: `Unknown ops command: ${command}`,
|
|
1450
|
-
},
|
|
1451
|
-
};
|
|
1452
|
-
},
|
|
1453
|
-
};
|
|
1454
|
-
}
|