harnery 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commander.d.ts +9 -0
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +10 -1
- package/dist/commands/admission.d.ts +21 -0
- package/dist/commands/admission.d.ts.map +1 -0
- package/dist/commands/admission.js +565 -0
- package/dist/commands/agents.d.ts +7 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +148 -47
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +73 -2
- package/dist/commands/browse-ai.d.ts +2 -2
- package/dist/commands/browse-ai.d.ts.map +1 -1
- package/dist/commands/browse-ai.js +6 -4
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +360 -21
- package/dist/commands/diagnostics.d.ts +4 -0
- package/dist/commands/diagnostics.d.ts.map +1 -0
- package/dist/commands/diagnostics.js +229 -0
- package/dist/commands/fetch.js +1 -0
- package/dist/commands/files.d.ts +12 -0
- package/dist/commands/files.d.ts.map +1 -1
- package/dist/commands/files.js +54 -1
- package/dist/commands/governor.d.ts.map +1 -1
- package/dist/commands/governor.js +4 -0
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +71 -2
- package/dist/commands/qa-record.d.ts +144 -0
- package/dist/commands/qa-record.d.ts.map +1 -0
- package/dist/commands/qa-record.js +0 -0
- package/dist/commands/qa-run.d.ts +8 -0
- package/dist/commands/qa-run.d.ts.map +1 -0
- package/dist/commands/qa-run.js +396 -0
- package/dist/commands/qa-status.d.ts +71 -0
- package/dist/commands/qa-status.d.ts.map +1 -0
- package/dist/commands/qa-status.js +490 -0
- package/dist/commands/qa-verify.d.ts +40 -0
- package/dist/commands/qa-verify.d.ts.map +1 -0
- package/dist/commands/qa-verify.js +180 -0
- package/dist/commands/resources.d.ts +4 -0
- package/dist/commands/resources.d.ts.map +1 -0
- package/dist/commands/resources.js +29 -0
- package/dist/commands/review-pack.d.ts +4 -0
- package/dist/commands/review-pack.d.ts.map +1 -0
- package/dist/commands/review-pack.js +1001 -0
- package/dist/commands/supervisor.d.ts +4 -0
- package/dist/commands/supervisor.d.ts.map +1 -0
- package/dist/commands/supervisor.js +101 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +17 -0
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +4 -0
- package/dist/core/agents/cli.js +7 -3
- package/dist/core/agents/health.d.ts +17 -0
- package/dist/core/agents/health.d.ts.map +1 -0
- package/dist/core/agents/health.js +109 -0
- package/dist/core/agents/mailbox.d.ts +92 -0
- package/dist/core/agents/mailbox.d.ts.map +1 -0
- package/dist/core/agents/mailbox.js +325 -0
- package/dist/core/agents/qa-signal.d.ts +111 -0
- package/dist/core/agents/qa-signal.d.ts.map +1 -0
- package/dist/core/agents/qa-signal.js +231 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts +44 -0
- package/dist/core/agents/reconcile-coordination-v3.d.ts.map +1 -0
- package/dist/core/agents/reconcile-coordination-v3.js +58 -0
- package/dist/core/agents/render/prompt-context.d.ts +5 -0
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +34 -13
- package/dist/core/agents/render/session-context.d.ts +8 -0
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +34 -3
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +50 -1
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +6 -10
- package/dist/core/agents/session-finalizer-v3.js +4 -1
- package/dist/core/agents/session-name-display.d.ts +20 -5
- package/dist/core/agents/session-name-display.d.ts.map +1 -1
- package/dist/core/agents/session-name-display.js +67 -7
- package/dist/core/agents/state/heartbeat-reader.d.ts +7 -0
- package/dist/core/agents/state/heartbeat-reader.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.d.ts +11 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +17 -0
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +1 -0
- package/dist/core/agents/state/live-coordination-writer.js +5 -0
- package/dist/core/artifacts/constants.d.ts +1 -1
- package/dist/core/artifacts/constants.js +1 -1
- package/dist/core/artifacts/index.d.ts +82 -6
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +410 -15
- package/dist/core/config.d.ts +20 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +59 -0
- package/dist/core/diagnostics/advice.d.ts +9 -0
- package/dist/core/diagnostics/advice.d.ts.map +1 -0
- package/dist/core/diagnostics/advice.js +112 -0
- package/dist/core/diagnostics/bundle.d.ts +51 -0
- package/dist/core/diagnostics/bundle.d.ts.map +1 -0
- package/dist/core/diagnostics/bundle.js +968 -0
- package/dist/core/diagnostics/comparison.d.ts +5 -0
- package/dist/core/diagnostics/comparison.d.ts.map +1 -0
- package/dist/core/diagnostics/comparison.js +444 -0
- package/dist/core/diagnostics/contract.d.ts +245 -0
- package/dist/core/diagnostics/contract.d.ts.map +1 -0
- package/dist/core/diagnostics/contract.js +18 -0
- package/dist/core/diagnostics/identity.d.ts +3 -0
- package/dist/core/diagnostics/identity.d.ts.map +1 -0
- package/dist/core/diagnostics/identity.js +10 -0
- package/dist/core/diagnostics/index.d.ts +8 -0
- package/dist/core/diagnostics/index.d.ts.map +1 -0
- package/dist/core/diagnostics/index.js +7 -0
- package/dist/core/diagnostics/replay.d.ts +8 -0
- package/dist/core/diagnostics/replay.d.ts.map +1 -0
- package/dist/core/diagnostics/replay.js +213 -0
- package/dist/core/diagnostics/sanitize.d.ts +9 -0
- package/dist/core/diagnostics/sanitize.d.ts.map +1 -0
- package/dist/core/diagnostics/sanitize.js +84 -0
- package/dist/core/events/legacy-storage/compression.d.ts +13 -0
- package/dist/core/events/legacy-storage/compression.d.ts.map +1 -0
- package/dist/core/events/legacy-storage/compression.js +107 -0
- package/dist/core/events/legacy-storage/index.d.ts +1 -0
- package/dist/core/events/legacy-storage/index.d.ts.map +1 -1
- package/dist/core/events/legacy-storage/index.js +1 -0
- package/dist/core/events/v3/archive-retention.d.ts +33 -0
- package/dist/core/events/v3/archive-retention.d.ts.map +1 -0
- package/dist/core/events/v3/archive-retention.js +195 -0
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +10 -0
- package/dist/core/events/v3/capabilities.d.ts +1 -1
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +1 -0
- package/dist/core/events/v3/coordination-view.d.ts +3 -0
- package/dist/core/events/v3/coordination-view.d.ts.map +1 -1
- package/dist/core/events/v3/coordination-view.js +69 -8
- package/dist/core/events/v3/index.d.ts +1 -0
- package/dist/core/events/v3/index.d.ts.map +1 -1
- package/dist/core/events/v3/index.js +1 -0
- package/dist/core/events/v3/live-routing.d.ts.map +1 -1
- package/dist/core/events/v3/live-routing.js +1 -0
- package/dist/core/events/v3/producers/hook-base.d.ts +1 -1
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +13 -2
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +10 -2
- package/dist/core/events/v3/producers/recorder.d.ts +39 -0
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +350 -17
- package/dist/core/hooks/adapter/output.d.ts +8 -0
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +11 -1
- package/dist/core/hooks/cli.js +303 -219
- package/dist/core/hooks/health.d.ts +59 -0
- package/dist/core/hooks/health.d.ts.map +1 -0
- package/dist/core/hooks/health.js +84 -0
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +10 -3
- package/dist/core/hooks/session-name-presence.d.ts.map +1 -1
- package/dist/core/hooks/session-name-presence.js +4 -1
- package/dist/core/qa-artifacts.d.ts +20 -0
- package/dist/core/qa-artifacts.d.ts.map +1 -0
- package/dist/core/qa-artifacts.js +110 -0
- package/dist/core/resources/contract.d.ts +96 -0
- package/dist/core/resources/contract.d.ts.map +1 -0
- package/dist/core/resources/contract.js +2 -0
- package/dist/core/resources/index.d.ts +6 -0
- package/dist/core/resources/index.d.ts.map +1 -0
- package/dist/core/resources/index.js +5 -0
- package/dist/core/resources/sampler.d.ts +34 -0
- package/dist/core/resources/sampler.d.ts.map +1 -0
- package/dist/core/resources/sampler.js +458 -0
- package/dist/core/resources/service-status.d.ts +3 -0
- package/dist/core/resources/service-status.d.ts.map +1 -0
- package/dist/core/resources/service-status.js +48 -0
- package/dist/core/resources/service.d.ts +26 -0
- package/dist/core/resources/service.d.ts.map +1 -0
- package/dist/core/resources/service.js +292 -0
- package/dist/core/resources/storage.d.ts +13 -0
- package/dist/core/resources/storage.d.ts.map +1 -0
- package/dist/core/resources/storage.js +30 -0
- package/dist/core/storage/atomic-json.d.ts +3 -0
- package/dist/core/storage/atomic-json.d.ts.map +1 -0
- package/dist/core/storage/atomic-json.js +15 -0
- package/dist/core/storage/builtins.d.ts.map +1 -1
- package/dist/core/storage/builtins.js +45 -6
- package/dist/core/storage/logger.d.ts +2 -0
- package/dist/core/storage/logger.d.ts.map +1 -1
- package/dist/core/storage/logger.js +2 -0
- package/dist/core/storage/query.d.ts +14 -0
- package/dist/core/storage/query.d.ts.map +1 -1
- package/dist/core/storage/query.js +51 -0
- package/dist/core/supervisor/activity.d.ts +4 -0
- package/dist/core/supervisor/activity.d.ts.map +1 -0
- package/dist/core/supervisor/activity.js +141 -0
- package/dist/core/supervisor/contract.d.ts +268 -0
- package/dist/core/supervisor/contract.d.ts.map +1 -0
- package/dist/core/supervisor/contract.js +35 -0
- package/dist/core/supervisor/explanations.d.ts +4 -0
- package/dist/core/supervisor/explanations.d.ts.map +1 -0
- package/dist/core/supervisor/explanations.js +71 -0
- package/dist/core/supervisor/findings.d.ts +20 -0
- package/dist/core/supervisor/findings.d.ts.map +1 -0
- package/dist/core/supervisor/findings.js +399 -0
- package/dist/core/supervisor/history.d.ts +9 -0
- package/dist/core/supervisor/history.d.ts.map +1 -0
- package/dist/core/supervisor/history.js +46 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts +14 -0
- package/dist/core/supervisor/hook-health-alerts.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-alerts.js +70 -0
- package/dist/core/supervisor/hook-health-storage.d.ts +5 -0
- package/dist/core/supervisor/hook-health-storage.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health-storage.js +24 -0
- package/dist/core/supervisor/hook-health.d.ts +72 -0
- package/dist/core/supervisor/hook-health.d.ts.map +1 -0
- package/dist/core/supervisor/hook-health.js +203 -0
- package/dist/core/supervisor/hooks.d.ts +10 -0
- package/dist/core/supervisor/hooks.d.ts.map +1 -0
- package/dist/core/supervisor/hooks.js +28 -0
- package/dist/core/supervisor/index.d.ts +15 -0
- package/dist/core/supervisor/index.d.ts.map +1 -0
- package/dist/core/supervisor/index.js +14 -0
- package/dist/core/supervisor/log-feed.d.ts +9 -0
- package/dist/core/supervisor/log-feed.d.ts.map +1 -0
- package/dist/core/supervisor/log-feed.js +103 -0
- package/dist/core/supervisor/service.d.ts +29 -0
- package/dist/core/supervisor/service.d.ts.map +1 -0
- package/dist/core/supervisor/service.js +450 -0
- package/dist/core/supervisor/services.d.ts +11 -0
- package/dist/core/supervisor/services.d.ts.map +1 -0
- package/dist/core/supervisor/services.js +155 -0
- package/dist/core/supervisor/status.d.ts +3 -0
- package/dist/core/supervisor/status.d.ts.map +1 -0
- package/dist/core/supervisor/status.js +48 -0
- package/dist/core/supervisor/storage.d.ts +30 -0
- package/dist/core/supervisor/storage.d.ts.map +1 -0
- package/dist/core/supervisor/storage.js +73 -0
- package/dist/core/supervisor/timeline.d.ts +3 -0
- package/dist/core/supervisor/timeline.d.ts.map +1 -0
- package/dist/core/supervisor/timeline.js +87 -0
- package/dist/core/workflow/admission.d.ts +23 -0
- package/dist/core/workflow/admission.d.ts.map +1 -0
- package/dist/core/workflow/admission.js +136 -0
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +77 -2
- package/dist/core/workflow/index.d.ts +3 -2
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -1
- package/dist/core/workflow/proof.d.ts +2 -1
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +39 -1
- package/dist/core/workflow/run-state.d.ts +3 -2
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +8 -1
- package/dist/core/workflow/types.d.ts +33 -1
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.js +2 -1
- package/dist/lib/admission.d.ts +71 -0
- package/dist/lib/admission.d.ts.map +1 -0
- package/dist/lib/admission.js +264 -0
- package/dist/lib/agent-browser/client.d.ts +1 -1
- package/dist/lib/agent-browser/client.d.ts.map +1 -1
- package/dist/lib/agent-browser/client.js +1 -5
- package/dist/lib/browser/capture-fidelity.d.ts +39 -0
- package/dist/lib/browser/capture-fidelity.d.ts.map +1 -0
- package/dist/lib/browser/capture-fidelity.js +84 -0
- package/dist/lib/browser/client.d.ts +46 -1
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +168 -9
- package/dist/lib/browser/critique.d.ts +38 -1
- package/dist/lib/browser/critique.d.ts.map +1 -1
- package/dist/lib/browser/critique.js +34 -6
- package/dist/lib/browser/index.d.ts +5 -1
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +4 -0
- package/dist/lib/browser/page-review-judge.d.ts +64 -0
- package/dist/lib/browser/page-review-judge.d.ts.map +1 -0
- package/dist/lib/browser/page-review-judge.js +270 -0
- package/dist/lib/browser/page-review-pack.d.ts +613 -0
- package/dist/lib/browser/page-review-pack.d.ts.map +1 -0
- package/dist/lib/browser/page-review-pack.js +1751 -0
- package/dist/lib/browser/qa-run-contracts.d.ts +377 -0
- package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -0
- package/dist/lib/browser/qa-run-contracts.js +361 -0
- package/dist/lib/browser/qa-run.d.ts +141 -0
- package/dist/lib/browser/qa-run.d.ts.map +1 -0
- package/dist/lib/browser/qa-run.js +1283 -0
- package/dist/lib/browser/request-diagnostics.d.ts +13 -0
- package/dist/lib/browser/request-diagnostics.d.ts.map +1 -0
- package/dist/lib/browser/request-diagnostics.js +18 -0
- package/dist/lib/browser/tiling.d.ts +19 -0
- package/dist/lib/browser/tiling.d.ts.map +1 -1
- package/dist/lib/browser/tiling.js +28 -0
- package/dist/lib/cookies/client.d.ts +9 -0
- package/dist/lib/cookies/client.d.ts.map +1 -1
- package/dist/lib/cookies/client.js +197 -44
- package/dist/lib/cookies/extra.d.ts +18 -0
- package/dist/lib/cookies/extra.d.ts.map +1 -0
- package/dist/lib/cookies/extra.js +14 -0
- package/dist/lib/cookies/index.d.ts +2 -1
- package/dist/lib/cookies/index.d.ts.map +1 -1
- package/dist/lib/cookies/index.js +2 -1
- package/dist/lib/coord-root-id.d.ts +9 -0
- package/dist/lib/coord-root-id.d.ts.map +1 -0
- package/dist/lib/coord-root-id.js +17 -0
- package/dist/lib/durable-job.d.ts +124 -0
- package/dist/lib/durable-job.d.ts.map +1 -0
- package/dist/lib/durable-job.js +296 -0
- package/dist/lib/http/client.d.ts +7 -1
- package/dist/lib/http/client.d.ts.map +1 -1
- package/dist/lib/http/client.js +2 -0
- package/dist/lib/instructions/apply.d.ts +3 -1
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +74 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +11 -2
- package/package.json +19 -2
- package/src/commander.ts +75 -1
- package/src/commands/admission.ts +699 -0
- package/src/commands/agents.ts +189 -50
- package/src/commands/artifacts.ts +132 -18
- package/src/commands/browse-ai.ts +10 -5
- package/src/commands/browse.ts +496 -20
- package/src/commands/diagnostics.ts +271 -0
- package/src/commands/fetch.ts +1 -0
- package/src/commands/files.ts +102 -2
- package/src/commands/governor.ts +8 -0
- package/src/commands/ledger-v3.ts +82 -0
- package/src/commands/qa-record.ts +682 -0
- package/src/commands/qa-run.ts +503 -0
- package/src/commands/qa-status.ts +608 -0
- package/src/commands/qa-verify.ts +238 -0
- package/src/commands/resources.ts +38 -0
- package/src/commands/review-pack.ts +1281 -0
- package/src/commands/supervisor.ts +141 -0
- package/src/commands/web.ts +19 -0
- package/src/commands/workflow.ts +8 -0
- package/src/core/agents/cli.ts +7 -3
- package/src/core/agents/health.ts +142 -0
- package/src/core/agents/mailbox.ts +373 -0
- package/src/core/agents/qa-signal.ts +261 -0
- package/src/core/agents/reconcile-coordination-v3.ts +77 -0
- package/src/core/agents/render/prompt-context.ts +42 -12
- package/src/core/agents/render/session-context.ts +37 -3
- package/src/core/agents/rules/commit-conflict.ts +58 -1
- package/src/core/agents/rules/stop-hook.ts +6 -12
- package/src/core/agents/session-finalizer-v3.ts +4 -1
- package/src/core/agents/session-name-display.ts +78 -7
- package/src/core/agents/state/heartbeat-reader.ts +7 -0
- package/src/core/agents/state/heartbeat-writer.ts +23 -0
- package/src/core/agents/state/live-coordination-view.ts +1 -0
- package/src/core/agents/state/live-coordination-writer.ts +5 -0
- package/src/core/artifacts/constants.ts +1 -1
- package/src/core/artifacts/index.ts +565 -30
- package/src/core/config.ts +134 -2
- package/src/core/diagnostics/advice.ts +147 -0
- package/src/core/diagnostics/bundle.ts +1250 -0
- package/src/core/diagnostics/comparison.ts +565 -0
- package/src/core/diagnostics/contract.ts +311 -0
- package/src/core/diagnostics/identity.ts +11 -0
- package/src/core/diagnostics/index.ts +7 -0
- package/src/core/diagnostics/replay.ts +314 -0
- package/src/core/diagnostics/sanitize.ts +97 -0
- package/src/core/events/legacy-storage/compression.ts +130 -0
- package/src/core/events/legacy-storage/index.ts +1 -0
- package/src/core/events/v3/archive-retention.ts +251 -0
- package/src/core/events/v3/bootstrap.ts +10 -0
- package/src/core/events/v3/capabilities.ts +2 -0
- package/src/core/events/v3/coordination-view.ts +100 -11
- package/src/core/events/v3/index.ts +9 -0
- package/src/core/events/v3/live-routing.ts +1 -0
- package/src/core/events/v3/producers/hook-base.ts +14 -2
- package/src/core/events/v3/producers/intake.ts +10 -2
- package/src/core/events/v3/producers/recorder.ts +420 -17
- package/src/core/hooks/adapter/output.ts +12 -1
- package/src/core/hooks/cli.ts +332 -247
- package/src/core/hooks/health.ts +146 -0
- package/src/core/hooks/resolve/transcript.ts +10 -3
- package/src/core/hooks/session-name-presence.ts +6 -1
- package/src/core/qa-artifacts.ts +126 -0
- package/src/core/resources/contract.ts +105 -0
- package/src/core/resources/index.ts +5 -0
- package/src/core/resources/sampler.ts +590 -0
- package/src/core/resources/service-status.ts +62 -0
- package/src/core/resources/service.ts +337 -0
- package/src/core/resources/storage.ts +44 -0
- package/src/core/storage/atomic-json.ts +15 -0
- package/src/core/storage/builtins.ts +62 -6
- package/src/core/storage/logger.ts +2 -0
- package/src/core/storage/query.ts +58 -0
- package/src/core/supervisor/activity.ts +193 -0
- package/src/core/supervisor/contract.ts +312 -0
- package/src/core/supervisor/explanations.ts +104 -0
- package/src/core/supervisor/findings.ts +788 -0
- package/src/core/supervisor/history.ts +61 -0
- package/src/core/supervisor/hook-health-alerts.ts +108 -0
- package/src/core/supervisor/hook-health-storage.ts +25 -0
- package/src/core/supervisor/hook-health.ts +301 -0
- package/src/core/supervisor/hooks.ts +35 -0
- package/src/core/supervisor/index.ts +14 -0
- package/src/core/supervisor/log-feed.ts +131 -0
- package/src/core/supervisor/service.ts +511 -0
- package/src/core/supervisor/services.ts +203 -0
- package/src/core/supervisor/status.ts +59 -0
- package/src/core/supervisor/storage.ts +126 -0
- package/src/core/supervisor/timeline.ts +133 -0
- package/src/core/workflow/admission.ts +215 -0
- package/src/core/workflow/engine.ts +93 -1
- package/src/core/workflow/index.ts +10 -0
- package/src/core/workflow/proof.ts +54 -1
- package/src/core/workflow/run-state.ts +13 -1
- package/src/core/workflow/types.ts +39 -1
- package/src/lib/admission.ts +347 -0
- package/src/lib/agent-browser/client.ts +2 -10
- package/src/lib/browser/capture-fidelity.ts +98 -0
- package/src/lib/browser/client.ts +212 -10
- package/src/lib/browser/critique.ts +62 -7
- package/src/lib/browser/index.ts +65 -0
- package/src/lib/browser/page-review-judge.ts +360 -0
- package/src/lib/browser/page-review-pack.ts +2384 -0
- package/src/lib/browser/qa-run-contracts.ts +743 -0
- package/src/lib/browser/qa-run.ts +1462 -0
- package/src/lib/browser/request-diagnostics.ts +27 -0
- package/src/lib/browser/tiling.ts +32 -0
- package/src/lib/cookies/client.ts +228 -42
- package/src/lib/cookies/extra.ts +28 -0
- package/src/lib/cookies/index.ts +2 -0
- package/src/lib/coord-root-id.ts +23 -0
- package/src/lib/durable-job.ts +407 -0
- package/src/lib/http/client.ts +13 -1
- package/src/lib/instructions/apply.ts +81 -2
- package/src/lib/instructions/templates.ts +11 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAQ1E,OAAO,EAGL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,OAAO,KAAK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B,GAAG,IAAI,CAO5B"}
|
package/dist/commands/agents.js
CHANGED
|
@@ -20,6 +20,9 @@ import { coordBinPath } from "../core/agents/coord-bin.js";
|
|
|
20
20
|
import { checkGitFinalization, formatGitFinalizationFailure, readSessionWriteClaims, } from "../core/agents/finalization.js";
|
|
21
21
|
import { emitEventV3, monorepoRoot, nativeSessionIdentity, normalizeAdapter, resolveOwner, resolveOwnerBySessionEnv, resolveOwnerWithSource, sessionIdentityFromEnv, } from "../core/agents/index.js";
|
|
22
22
|
import { bootstrapLiveCoordinationAuthorityV3, LiveCoordinationAuthorityV3Error, reopenLiveCoordinationGenerationV3, } from "../core/agents/live-authority-v3.js";
|
|
23
|
+
import { isAddressableName, MailboxCapacityError, queueMailboxMessage, suggestNames, } from "../core/agents/mailbox.js";
|
|
24
|
+
import { qaSignalStatusRow } from "../core/agents/qa-signal.js";
|
|
25
|
+
import { reconcileCoordinationV3 } from "../core/agents/reconcile-coordination-v3.js";
|
|
23
26
|
import { listSessionFinalizationRequestsV3, observeHostDisappearedV3, reconcileSessionFinalizationV3, requestSessionEndExplicitV3, } from "../core/agents/session-finalizer-v3.js";
|
|
24
27
|
import { SESSION_NAME_DISPLAY_NOTE, sessionNameDisplayPending, } from "../core/agents/session-name-display.js";
|
|
25
28
|
import { agentDisplayName } from "../core/agents/state/activity-log.js";
|
|
@@ -28,7 +31,7 @@ import { readLiveCoordinationRow, readLiveCoordinationRows, } from "../core/agen
|
|
|
28
31
|
import { foldSessionState, } from "../core/agents/state/session-state.js";
|
|
29
32
|
import { coordFreshnessSeconds, resolveBinName, sessionFinalizationConfig, } from "../core/config.js";
|
|
30
33
|
import { readEventV3ControlState } from "../core/events/v3/control.js";
|
|
31
|
-
import { projectCoordinationViewV3 } from "../core/events/v3/coordination-view.js";
|
|
34
|
+
import { projectCoordinationViewV3, readCoordinationViewV3, } from "../core/events/v3/coordination-view.js";
|
|
32
35
|
import { liveInstanceIdV3 } from "../core/events/v3/live-routing.js";
|
|
33
36
|
import { countSummarizedSinceV3, listDiagnosticSummariesV3, } from "../core/events/v3/producers/diagnostic-summaries.js";
|
|
34
37
|
import { listHookIntakeGroupsV3, listHookIntakeRecordsV3, } from "../core/events/v3/producers/intake.js";
|
|
@@ -232,7 +235,8 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
|
|
|
232
235
|
});
|
|
233
236
|
cmd
|
|
234
237
|
.command("reconcile")
|
|
235
|
-
.description("
|
|
238
|
+
.description("Sweep the stale coordination cache, then reconcile archive, idle, parent/run " +
|
|
239
|
+
"completion, stale, superseded, and host lifecycle signals into V3 session finalization.")
|
|
236
240
|
.option("--watch", "Keep reconciling until interrupted")
|
|
237
241
|
.option("--interval-seconds <n>", "Watch interval in seconds")
|
|
238
242
|
.option("--json", "JSON output")
|
|
@@ -267,9 +271,10 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
|
|
|
267
271
|
});
|
|
268
272
|
cmd
|
|
269
273
|
.command("ping <name> <message...>")
|
|
270
|
-
.description("
|
|
271
|
-
"
|
|
272
|
-
"
|
|
274
|
+
.description("Send a message to another agent by name. Works whether or not that agent " +
|
|
275
|
+
"is running: a live peer sees it on their next prompt, and a name with no " +
|
|
276
|
+
"live session gets it queued until a session of that name next starts. " +
|
|
277
|
+
"Only an unknown name is refused.")
|
|
273
278
|
.option("--json", "JSON output")
|
|
274
279
|
.action((name, message, opts) => {
|
|
275
280
|
runPing(name, message.join(" "), opts);
|
|
@@ -299,7 +304,7 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
|
|
|
299
304
|
cmd
|
|
300
305
|
.command("health")
|
|
301
306
|
.description("One-screen coord-layer health rollup: heal events, council activity, " +
|
|
302
|
-
"
|
|
307
|
+
"heartbeat cache issues, and findings. Designed for " +
|
|
303
308
|
"daily glance + dashboard ingestion. Reads .harnery/.")
|
|
304
309
|
.option("--since <window>", "Window (Nh | Nd). Default: 24h.", "24h")
|
|
305
310
|
.option("--json", "JSON envelope output")
|
|
@@ -431,7 +436,7 @@ async function runSessionReconcile(opts) {
|
|
|
431
436
|
}
|
|
432
437
|
let stopped = false;
|
|
433
438
|
do {
|
|
434
|
-
emit.data(
|
|
439
|
+
emit.data(reconcileCoordinationV3(root));
|
|
435
440
|
if (!opts.watch || stopped)
|
|
436
441
|
return;
|
|
437
442
|
await new Promise((resolvePromise) => {
|
|
@@ -1802,6 +1807,11 @@ function runStatus(opts) {
|
|
|
1802
1807
|
catch {
|
|
1803
1808
|
/* non-fatal: status box should not fail on council errors */
|
|
1804
1809
|
}
|
|
1810
|
+
// Latest page-QA verdict for this session, with the RUNNER's clock. Session
|
|
1811
|
+
// age is not QA time; without this row an operator reads "session 58m" as if
|
|
1812
|
+
// the QA run took 58 minutes. Best-effort by contract — no pointer, a
|
|
1813
|
+
// malformed one, or any read failure renders no row.
|
|
1814
|
+
const qaSignal = qaSignalStatusRow({ coordRoot: root, instanceId: hb.instance_id });
|
|
1805
1815
|
const data = {
|
|
1806
1816
|
name: displayName,
|
|
1807
1817
|
instance_id: hb.instance_id,
|
|
@@ -1839,6 +1849,7 @@ function runStatus(opts) {
|
|
|
1839
1849
|
timestamp_iso: new Date().toISOString(),
|
|
1840
1850
|
timestamp_local: timeStr,
|
|
1841
1851
|
...(quality ? { quality } : {}),
|
|
1852
|
+
...(qaSignal ? { qa: qaSignal.pointer } : {}),
|
|
1842
1853
|
...(finalization ? { finalization } : {}),
|
|
1843
1854
|
...(sessionEnd ? { session_end: sessionEnd } : {}),
|
|
1844
1855
|
};
|
|
@@ -1874,6 +1885,10 @@ function runStatus(opts) {
|
|
|
1874
1885
|
const idx = rows.findIndex((row) => row[0] === "time");
|
|
1875
1886
|
rows.splice(idx, 0, ["quality", formatRunQuality(quality.status, quality.signal_ids)]);
|
|
1876
1887
|
}
|
|
1888
|
+
if (qaSignal) {
|
|
1889
|
+
const idx = rows.findIndex((row) => row[0] === "time");
|
|
1890
|
+
rows.splice(idx, 0, ["qa", qaSignal.value]);
|
|
1891
|
+
}
|
|
1877
1892
|
if (sessionEnd) {
|
|
1878
1893
|
const idx = rows.findIndex((row) => row[0] === "time");
|
|
1879
1894
|
rows.splice(idx, 0, [
|
|
@@ -2481,6 +2496,46 @@ export function collectEventLedgerHealthV3(root, nowMs = Date.now()) {
|
|
|
2481
2496
|
catch (error) {
|
|
2482
2497
|
collectionErrors.push(`diagnostic summaries unreadable: ${errorText(error)}`);
|
|
2483
2498
|
}
|
|
2499
|
+
let coordinationAuthority = {
|
|
2500
|
+
safe: false,
|
|
2501
|
+
global_diagnostics: 0,
|
|
2502
|
+
isolated_diagnostics: 0,
|
|
2503
|
+
affected_generations: [],
|
|
2504
|
+
codes: [],
|
|
2505
|
+
};
|
|
2506
|
+
try {
|
|
2507
|
+
const view = readCoordinationViewV3(root);
|
|
2508
|
+
const globalDiagnostics = view.global_diagnostics.filter((diagnostic) => diagnostic.authority_blocking);
|
|
2509
|
+
const isolatedDiagnostics = new Map();
|
|
2510
|
+
const affectedGenerations = [];
|
|
2511
|
+
for (const [generationId, diagnostics] of Object.entries(view.diagnostics_by_generation)) {
|
|
2512
|
+
const blocking = diagnostics.filter((diagnostic) => diagnostic.authority_blocking);
|
|
2513
|
+
if (blocking.length === 0)
|
|
2514
|
+
continue;
|
|
2515
|
+
affectedGenerations.push(generationId);
|
|
2516
|
+
for (const diagnostic of blocking) {
|
|
2517
|
+
isolatedDiagnostics.set([
|
|
2518
|
+
diagnostic.code,
|
|
2519
|
+
diagnostic.source_code ?? "",
|
|
2520
|
+
diagnostic.event_id ?? "",
|
|
2521
|
+
diagnostic.generation_id ?? "",
|
|
2522
|
+
diagnostic.subject_instance_id ?? "",
|
|
2523
|
+
].join("\0"), diagnostic);
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
coordinationAuthority = {
|
|
2527
|
+
safe: view.authority_safe,
|
|
2528
|
+
global_diagnostics: globalDiagnostics.length,
|
|
2529
|
+
isolated_diagnostics: isolatedDiagnostics.size,
|
|
2530
|
+
affected_generations: affectedGenerations.sort(),
|
|
2531
|
+
codes: [
|
|
2532
|
+
...new Set([...globalDiagnostics, ...isolatedDiagnostics.values()].map((diagnostic) => diagnostic.source_code ?? diagnostic.code)),
|
|
2533
|
+
].sort(),
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
catch (error) {
|
|
2537
|
+
collectionErrors.push(`coordination authority unreadable: ${errorText(error)}`);
|
|
2538
|
+
}
|
|
2484
2539
|
return {
|
|
2485
2540
|
state: "live",
|
|
2486
2541
|
mode: control.state,
|
|
@@ -2504,6 +2559,7 @@ export function collectEventLedgerHealthV3(root, nowMs = Date.now()) {
|
|
|
2504
2559
|
recent_by_category: recentByCategory,
|
|
2505
2560
|
mitigation_fail_open: mitigationFailOpen,
|
|
2506
2561
|
},
|
|
2562
|
+
coordination_authority: coordinationAuthority,
|
|
2507
2563
|
span_pressure: spanPressure,
|
|
2508
2564
|
collection_errors: collectionErrors,
|
|
2509
2565
|
};
|
|
@@ -3091,8 +3147,8 @@ function runHealth(opts) {
|
|
|
3091
3147
|
// Heartbeat cache issues: files in active/ that are unparseable, nameless,
|
|
3092
3148
|
// invalidly timestamped, or stale. Old parseable timestamps are ordinary
|
|
3093
3149
|
// staleness, not evidence of epoch-like timestamp corruption.
|
|
3094
|
-
let
|
|
3095
|
-
const
|
|
3150
|
+
let cacheIssueCount = 0;
|
|
3151
|
+
const cacheIssueSamples = [];
|
|
3096
3152
|
const STALE_HEARTBEAT_AGE_MS = 24 * 60 * 60 * 1000;
|
|
3097
3153
|
if (existsSync(activeDir)) {
|
|
3098
3154
|
for (const file of readdirSync(activeDir)) {
|
|
@@ -3107,16 +3163,16 @@ function runHealth(opts) {
|
|
|
3107
3163
|
hb = null;
|
|
3108
3164
|
}
|
|
3109
3165
|
if (!hb || typeof hb.instance_id !== "string") {
|
|
3110
|
-
|
|
3111
|
-
if (
|
|
3112
|
-
|
|
3166
|
+
cacheIssueCount++;
|
|
3167
|
+
if (cacheIssueSamples.length < 5)
|
|
3168
|
+
cacheIssueSamples.push(`${idFromFile.slice(0, 12)} (unparseable/no-id)`);
|
|
3113
3169
|
continue;
|
|
3114
3170
|
}
|
|
3115
3171
|
const cacheIssue = classifyHeartbeatCacheIssue(hb, nowMs, STALE_HEARTBEAT_AGE_MS);
|
|
3116
3172
|
if (cacheIssue) {
|
|
3117
|
-
|
|
3118
|
-
if (
|
|
3119
|
-
|
|
3173
|
+
cacheIssueCount++;
|
|
3174
|
+
if (cacheIssueSamples.length < 5) {
|
|
3175
|
+
cacheIssueSamples.push(`${idFromFile.slice(0, 12)} (${cacheIssue})`);
|
|
3120
3176
|
}
|
|
3121
3177
|
}
|
|
3122
3178
|
}
|
|
@@ -3132,11 +3188,11 @@ function runHealth(opts) {
|
|
|
3132
3188
|
activeCouncils++;
|
|
3133
3189
|
}
|
|
3134
3190
|
}
|
|
3135
|
-
//
|
|
3136
|
-
const
|
|
3191
|
+
// Finding detection.
|
|
3192
|
+
const findings = [];
|
|
3137
3193
|
for (const { agent, count } of healTopAgents) {
|
|
3138
3194
|
if (count >= 5) {
|
|
3139
|
-
|
|
3195
|
+
findings.push(`${agent} self-healed ${count}x in ${opts.since}; possible idle-prune loop or PID instability`);
|
|
3140
3196
|
}
|
|
3141
3197
|
}
|
|
3142
3198
|
if (activeAgents.stale > 0) {
|
|
@@ -3144,49 +3200,58 @@ function runHealth(opts) {
|
|
|
3144
3200
|
const action = activeAgents.source === "event-ledger-v3"
|
|
3145
3201
|
? "lifecycle reconciliation may be delayed"
|
|
3146
3202
|
: "heal mechanism may not be firing";
|
|
3147
|
-
|
|
3203
|
+
findings.push(`${activeAgents.stale} active ${noun}(s) without activity for ${Math.floor(freshnessCutoffSecs() / 60)}min; ${action}`);
|
|
3148
3204
|
}
|
|
3149
3205
|
const expectedSchema = "v3";
|
|
3150
3206
|
const unexpectedSchemas = Object.keys(activeAgents.by_schema_version).filter((schema) => schema !== expectedSchema);
|
|
3151
3207
|
if (unexpectedSchemas.length > 0) {
|
|
3152
|
-
|
|
3208
|
+
findings.push(`Unexpected active-agent schema versions in use: ${unexpectedSchemas.join(", ")} (expected ${expectedSchema})`);
|
|
3153
3209
|
}
|
|
3154
|
-
// Only recent hook failures are active
|
|
3210
|
+
// Only recent hook failures are active findings. Historical rows remain in
|
|
3155
3211
|
// the report with exact error signatures and their latest timestamp.
|
|
3156
3212
|
if (hookErrors.last1h > 0) {
|
|
3157
3213
|
const top = hookErrors.recentTopErrors[0];
|
|
3158
3214
|
const detail = top ? `: top '${top.error.slice(0, 80)}' x${top.count} (${top.phase})` : "";
|
|
3159
|
-
|
|
3215
|
+
findings.push(`agent-hook errored ${hookErrors.last1h}x in the last hour${detail}`);
|
|
3160
3216
|
}
|
|
3161
3217
|
if (stream.cursor_backlog > 500) {
|
|
3162
|
-
|
|
3218
|
+
findings.push(`projection cursor is ${stream.cursor_backlog} events behind; drain lagging (stop projection may be failing)`);
|
|
3163
3219
|
}
|
|
3164
|
-
// Raw V3 stream size is not
|
|
3220
|
+
// Raw V3 stream size is not a finding; catalog rotation bounds readers.
|
|
3165
3221
|
if ((sweptByReason.unparseable ?? 0) > 0) {
|
|
3166
|
-
|
|
3222
|
+
findings.push(`${sweptByReason.unparseable} heartbeat(s) swept as unparseable in ${opts.since}; possible corruption or a non-atomic writer`);
|
|
3167
3223
|
}
|
|
3168
|
-
if (
|
|
3169
|
-
|
|
3224
|
+
if (cacheIssueCount > 0) {
|
|
3225
|
+
findings.push(`${cacheIssueCount} heartbeat cache issue(s) in active/ (${cacheIssueSamples.join(", ")}); ` +
|
|
3226
|
+
"rows the last sweep deliberately kept (malformed but mtime-fresh, or neither audit " +
|
|
3227
|
+
"write could persist), or that aged past the freshness cutoff since it ran");
|
|
3170
3228
|
}
|
|
3171
3229
|
if (stopRemediation.total > 0) {
|
|
3172
3230
|
const who = stopRemediation.sessions.length > 0
|
|
3173
3231
|
? ` (sessions: ${stopRemediation.sessions.map((s) => s.slice(0, 8)).join(", ")})`
|
|
3174
3232
|
: "";
|
|
3175
|
-
|
|
3233
|
+
findings.push(`stop-hook remediation cap exhausted ${stopRemediation.total}x in ${opts.since}${who}; these sessions ended turns without the end-of-turn ritual — check why their evidence never lands`);
|
|
3176
3234
|
}
|
|
3177
3235
|
if (eventLedger.state === "live") {
|
|
3236
|
+
const authority = eventLedger.coordination_authority;
|
|
3237
|
+
if (authority.global_diagnostics > 0) {
|
|
3238
|
+
findings.push(`${authority.global_diagnostics} global coordination authority diagnostic(s): ${authority.codes.join(", ")}`);
|
|
3239
|
+
}
|
|
3240
|
+
if (authority.isolated_diagnostics > 0) {
|
|
3241
|
+
findings.push(`${authority.isolated_diagnostics} coordination authority diagnostic(s) isolated to ${authority.affected_generations.length} generation(s): ${authority.codes.join(", ")}`);
|
|
3242
|
+
}
|
|
3178
3243
|
// Open spans whose generation has no open turn: the turn ended without its
|
|
3179
3244
|
// tool spans closing, so an explicit end can only queue, never finalize.
|
|
3180
3245
|
const orphanGenerations = eventLedger.open_spans.generations.filter((generation) => !generation.turn_open);
|
|
3181
3246
|
if (orphanGenerations.length > 0) {
|
|
3182
3247
|
const orphanSpans = orphanGenerations.reduce((sum, generation) => sum + generation.span_count, 0);
|
|
3183
|
-
|
|
3248
|
+
findings.push(`${orphanSpans} open tool span(s) across ${orphanGenerations.length} generation(s) with no open turn; orphaned spans block clean session end`);
|
|
3184
3249
|
}
|
|
3185
3250
|
for (const pressure of eventLedger.span_pressure) {
|
|
3186
|
-
|
|
3251
|
+
findings.push(`${pressure.instance_id} (${pressure.generation_id}) holds ${pressure.span_count} open spans (soft watermark ${SPAN_PRESSURE_SOFT_WATERMARK}; the reader's 256-span cap makes the state unreadable)`);
|
|
3187
3252
|
}
|
|
3188
3253
|
for (const collectionError of eventLedger.collection_errors) {
|
|
3189
|
-
|
|
3254
|
+
findings.push(`event-ledger health: ${collectionError}`);
|
|
3190
3255
|
}
|
|
3191
3256
|
}
|
|
3192
3257
|
const report = {
|
|
@@ -3230,14 +3295,14 @@ function runHealth(opts) {
|
|
|
3230
3295
|
recent_top_errors: hookErrors.recentTopErrors,
|
|
3231
3296
|
},
|
|
3232
3297
|
stream,
|
|
3233
|
-
|
|
3298
|
+
heartbeat_cache_issues: { count: cacheIssueCount, samples: cacheIssueSamples },
|
|
3234
3299
|
event_ledger: eventLedger,
|
|
3235
3300
|
stop_remediation: {
|
|
3236
3301
|
total: stopRemediation.total,
|
|
3237
3302
|
latest_at: stopRemediation.latestAt,
|
|
3238
3303
|
sessions: stopRemediation.sessions,
|
|
3239
3304
|
},
|
|
3240
|
-
|
|
3305
|
+
findings,
|
|
3241
3306
|
};
|
|
3242
3307
|
if (opts.json) {
|
|
3243
3308
|
emit.data(report);
|
|
@@ -3292,6 +3357,7 @@ function renderHealthBox(report) {
|
|
|
3292
3357
|
.map((request) => request.age_ms < 0 ? "age?" : formatAge(Math.floor(request.age_ms / 1000)))
|
|
3293
3358
|
.join(", ");
|
|
3294
3359
|
ledgerStr = [
|
|
3360
|
+
`authority ${ledger.coordination_authority.safe ? "safe" : "unsafe"}${ledger.coordination_authority.isolated_diagnostics > 0 ? ` (${ledger.coordination_authority.isolated_diagnostics} isolated)` : ""}`,
|
|
3295
3361
|
`open spans ${ledger.open_spans.total}${orphanGenerations > 0 ? ` (${orphanGenerations} gen turn-closed)` : ""}`,
|
|
3296
3362
|
`pending ends ${ledger.pending_finalizations.length}${pendingAges ? ` (${pendingAges})` : ""}`,
|
|
3297
3363
|
`intake ${ledger.intake_spool.total}`,
|
|
@@ -3316,19 +3382,19 @@ function renderHealthBox(report) {
|
|
|
3316
3382
|
["event ledger", ledgerStr],
|
|
3317
3383
|
[
|
|
3318
3384
|
"cache issues",
|
|
3319
|
-
report.
|
|
3385
|
+
report.heartbeat_cache_issues.count === 0
|
|
3320
3386
|
? "0"
|
|
3321
|
-
: `${report.
|
|
3387
|
+
: `${report.heartbeat_cache_issues.count} (${report.heartbeat_cache_issues.samples.join(", ")})`,
|
|
3322
3388
|
],
|
|
3323
3389
|
["councils", councilParts.join(", ")],
|
|
3324
|
-
["
|
|
3390
|
+
["findings", report.findings.length === 0 ? "(clean)" : `${report.findings.length} flagged`],
|
|
3325
3391
|
];
|
|
3326
3392
|
const localTime = formatLocalTime(new Date(report.generated_at));
|
|
3327
3393
|
const title = `Coord Health (${localTime})`;
|
|
3328
3394
|
process.stdout.write(`${formatBox(title, rows)}\n`); // lint-ok-emission: chat-paste path; mirrors runStatus's direct write so the box surfaces in both TTY + harn-session-teed contexts
|
|
3329
|
-
if (report.
|
|
3395
|
+
if (report.findings.length > 0) {
|
|
3330
3396
|
process.stdout.write("\n"); // lint-ok-emission: same chat-paste path
|
|
3331
|
-
for (const a of report.
|
|
3397
|
+
for (const a of report.findings) {
|
|
3332
3398
|
process.stdout.write(` ! ${a}\n`); // lint-ok-emission: same
|
|
3333
3399
|
}
|
|
3334
3400
|
}
|
|
@@ -3708,18 +3774,48 @@ function runPing(name, message, opts) {
|
|
|
3708
3774
|
});
|
|
3709
3775
|
process.exit(1);
|
|
3710
3776
|
}
|
|
3777
|
+
const coordRoot = monorepoRoot();
|
|
3711
3778
|
const peerOwner = resolveOwnerByName(name);
|
|
3712
|
-
|
|
3779
|
+
// A name with no live session is the common case, not an error: the agent it
|
|
3780
|
+
// refers to may have ended minutes ago and may come back under the same name.
|
|
3781
|
+
// Refuse only a name that no agent has ever held, which is a typo — queueing
|
|
3782
|
+
// that would swallow the message silently.
|
|
3783
|
+
if (!peerOwner && coordRoot && !isAddressableName(coordRoot, name)) {
|
|
3784
|
+
const suggestions = suggestNames(coordRoot, name);
|
|
3713
3785
|
emit.error({
|
|
3714
|
-
code: "
|
|
3715
|
-
message: `no
|
|
3786
|
+
code: "unknown_agent",
|
|
3787
|
+
message: `no agent has ever been named "${name}". ` +
|
|
3788
|
+
(suggestions.length > 0 ? `Did you mean ${suggestions.join(", ")}? ` : "") +
|
|
3789
|
+
`Run \`${resolveBinName()} agents list\` for live sessions.`,
|
|
3716
3790
|
});
|
|
3717
3791
|
process.exit(1);
|
|
3718
3792
|
}
|
|
3719
3793
|
const myHb = readCurrentCoordinationRow(myOwner);
|
|
3720
3794
|
const fromName = myHb?.name ?? "anonymous";
|
|
3721
3795
|
const body = `from agent-${fromName}: ${message.trim()}`;
|
|
3722
|
-
|
|
3796
|
+
// A live recipient gets the journal entry immediately, so a peer reading
|
|
3797
|
+
// their own journal mid-session sees it without waiting for a prompt. A
|
|
3798
|
+
// dormant recipient has no journal to write to yet; the drain writes it into
|
|
3799
|
+
// whichever session picks the message up.
|
|
3800
|
+
const doc = peerOwner ? appendEntry(peerOwner, "handoff", body) : null;
|
|
3801
|
+
let queued;
|
|
3802
|
+
try {
|
|
3803
|
+
queued = queueMailboxMessage({
|
|
3804
|
+
coordRoot: coordRoot ?? process.cwd(),
|
|
3805
|
+
toName: name,
|
|
3806
|
+
fromName,
|
|
3807
|
+
fromInstanceId: myOwner,
|
|
3808
|
+
body: message.trim(),
|
|
3809
|
+
journaled: Boolean(peerOwner),
|
|
3810
|
+
});
|
|
3811
|
+
}
|
|
3812
|
+
catch (error) {
|
|
3813
|
+
if (error instanceof MailboxCapacityError) {
|
|
3814
|
+
emit.error({ code: `mailbox_${error.reason_code}`, message: error.message });
|
|
3815
|
+
process.exit(1);
|
|
3816
|
+
}
|
|
3817
|
+
throw error;
|
|
3818
|
+
}
|
|
3723
3819
|
// Canonical delivery record: sender is the envelope owner, recipient rides
|
|
3724
3820
|
// in data, so read-only observers can render the communication without
|
|
3725
3821
|
// joining journal files.
|
|
@@ -3730,17 +3826,20 @@ function runPing(name, message, opts) {
|
|
|
3730
3826
|
observation: {
|
|
3731
3827
|
event_type: "coord.message_observed",
|
|
3732
3828
|
direction: "sent",
|
|
3733
|
-
subject: peerOwner
|
|
3829
|
+
subject: peerOwner ?? `name:${queued.message.to_name}`,
|
|
3734
3830
|
body: message.trim(),
|
|
3735
3831
|
},
|
|
3736
3832
|
});
|
|
3737
3833
|
const data = {
|
|
3738
|
-
peer:
|
|
3834
|
+
peer: queued.message.to_name,
|
|
3739
3835
|
peer_instance_id: peerOwner,
|
|
3836
|
+
delivery: peerOwner ? "live" : "queued",
|
|
3837
|
+
message_id: queued.message.message_id,
|
|
3838
|
+
pending: queued.pending,
|
|
3740
3839
|
from: fromName,
|
|
3741
3840
|
body,
|
|
3742
|
-
journal_path: doc
|
|
3743
|
-
journal_bytes: doc
|
|
3841
|
+
journal_path: doc?.path ?? null,
|
|
3842
|
+
journal_bytes: doc?.bytes ?? null,
|
|
3744
3843
|
};
|
|
3745
3844
|
if (opts.json) {
|
|
3746
3845
|
emit.config({ format: "json" });
|
|
@@ -3748,7 +3847,9 @@ function runPing(name, message, opts) {
|
|
|
3748
3847
|
return;
|
|
3749
3848
|
}
|
|
3750
3849
|
emit.data(data);
|
|
3751
|
-
emit.text(
|
|
3850
|
+
emit.text(peerOwner
|
|
3851
|
+
? `delivered to agent-${data.peer} (live; they see it on their next prompt): "${truncate(message.trim(), 80)}"\n`
|
|
3852
|
+
: `queued for agent-${data.peer} (no live session; delivered when a session of that name next starts): "${truncate(message.trim(), 80)}"\n`);
|
|
3752
3853
|
}
|
|
3753
3854
|
async function runWait(name, opts) {
|
|
3754
3855
|
const timeoutMs = parseDurationToMs(opts.timeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAmB1E,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAmMN"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { monorepoRoot, resolveOwner } from "../core/agents/index.js";
|
|
2
2
|
import { readLiveCoordinationRow } from "../core/agents/state/live-coordination-view.js";
|
|
3
|
-
import { cleanArtifacts, createArtifact, inventoryArtifacts, releaseArtifact, renewArtifact, showArtifact, } from "../core/artifacts/index.js";
|
|
3
|
+
import { adoptUnmanagedArtifactFiles, artifactCapabilities, cleanArtifacts, createArtifact, holdArtifact, inventoryArtifacts, migrateArtifacts, releaseArtifact, renewArtifact, showArtifact, unholdArtifact, } from "../core/artifacts/index.js";
|
|
4
4
|
import { artifactDefaultRetentionDays, coordFreshnessSeconds } from "../core/config.js";
|
|
5
5
|
export function registerArtifactsCommand(program, emit, context) {
|
|
6
6
|
const root = program
|
|
@@ -12,10 +12,16 @@ export function registerArtifactsCommand(program, emit, context) {
|
|
|
12
12
|
.description("Create one managed artifact workspace and print its path.")
|
|
13
13
|
.requiredOption("--purpose <text>", "What the files are for")
|
|
14
14
|
.option("--days <n>", "Retention in days (default from artifacts.default_retention_days)")
|
|
15
|
+
.option("--big", "Acknowledge that this workspace may exceed the per-bundle size ceiling")
|
|
16
|
+
.option("--hold <id>", "Create the workspace with this hold already present")
|
|
17
|
+
.option("--hold-reason <text>", "Why the initial hold is required")
|
|
18
|
+
.option("--actor <instance-id>", "Stable owner identity for the initial hold")
|
|
15
19
|
.action((slug, opts) => {
|
|
16
20
|
run(emit, () => {
|
|
17
21
|
const repoRoot = requireRepoRoot(context);
|
|
18
|
-
const actor = currentActor(repoRoot);
|
|
22
|
+
const actor = opts.actor ? { instance_id: opts.actor } : currentActor(repoRoot);
|
|
23
|
+
if (!!opts.hold !== !!opts.holdReason)
|
|
24
|
+
throw new Error("--hold and --hold-reason must be used together");
|
|
19
25
|
const retentionDays = opts.days
|
|
20
26
|
? parseDays(opts.days)
|
|
21
27
|
: artifactDefaultRetentionDays(repoRoot);
|
|
@@ -24,15 +30,39 @@ export function registerArtifactsCommand(program, emit, context) {
|
|
|
24
30
|
purpose: opts.purpose,
|
|
25
31
|
retentionDays,
|
|
26
32
|
actor,
|
|
33
|
+
big: opts.big,
|
|
34
|
+
holds: opts.hold ? [{ id: opts.hold, reason: opts.holdReason }] : [],
|
|
27
35
|
});
|
|
28
36
|
emit.data({
|
|
29
37
|
path: created.path,
|
|
30
38
|
artifact_id: created.manifest.artifact_id,
|
|
31
39
|
expires_at: created.manifest.retention.expires_at,
|
|
32
40
|
owner_instance_id: actor?.instance_id ?? null,
|
|
41
|
+
holds: created.manifest.holds,
|
|
33
42
|
});
|
|
34
43
|
});
|
|
35
44
|
});
|
|
45
|
+
root
|
|
46
|
+
.command("adopt-unmanaged")
|
|
47
|
+
.description("Preview loose direct-child files, or move them into one managed workspace.")
|
|
48
|
+
.option("--purpose <text>", "Why the adopted files are being retained", "Adopt legacy loose artifact files")
|
|
49
|
+
.option("--days <n>", "Retention in days (default from artifacts.default_retention_days)")
|
|
50
|
+
.option("--big", "Acknowledge an adopted bundle above the per-bundle size ceiling")
|
|
51
|
+
.option("--yes", "Move the exact previewed regular files into a managed workspace")
|
|
52
|
+
.action((opts) => {
|
|
53
|
+
run(emit, () => {
|
|
54
|
+
const repoRoot = requireRepoRoot(context);
|
|
55
|
+
emit.data(adoptUnmanagedArtifactFiles(repoRoot, {
|
|
56
|
+
yes: opts.yes,
|
|
57
|
+
big: opts.big,
|
|
58
|
+
purpose: opts.purpose,
|
|
59
|
+
retentionDays: opts.days
|
|
60
|
+
? parseDays(opts.days)
|
|
61
|
+
: artifactDefaultRetentionDays(repoRoot),
|
|
62
|
+
actor: currentActor(repoRoot),
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
});
|
|
36
66
|
root
|
|
37
67
|
.command("list")
|
|
38
68
|
.description("Inventory every artifact workspace with its cleanup classification.")
|
|
@@ -79,6 +109,39 @@ export function registerArtifactsCommand(program, emit, context) {
|
|
|
79
109
|
emit.data(releaseArtifact(repoRoot, ref, { actor: currentActor(repoRoot) }));
|
|
80
110
|
});
|
|
81
111
|
});
|
|
112
|
+
root
|
|
113
|
+
.command("capabilities")
|
|
114
|
+
.description("Report artifact schema and hold capabilities for embedding clients.")
|
|
115
|
+
.option("--json", "Emit the capability document as JSON")
|
|
116
|
+
.action(() => emit.data(artifactCapabilities()));
|
|
117
|
+
root
|
|
118
|
+
.command("migrate")
|
|
119
|
+
.description("Preview the explicit v1 to v2 manifest migration, preserving preimages.")
|
|
120
|
+
.option("--yes", "Apply the migration to valid v1 manifests")
|
|
121
|
+
.action((opts) => run(emit, () => emit.data({ rows: migrateArtifacts(requireRepoRoot(context), opts) })));
|
|
122
|
+
root
|
|
123
|
+
.command("hold <ref>")
|
|
124
|
+
.description("Protect an artifact from cleanup until its owner removes this exact hold.")
|
|
125
|
+
.requiredOption("--id <id>", "Unique hold id within this artifact")
|
|
126
|
+
.requiredOption("--reason <text>", "Why cleanup must retain these files")
|
|
127
|
+
.option("--actor <instance-id>", "Stable hold owner; defaults to the current agent")
|
|
128
|
+
.action((ref, opts) => run(emit, () => {
|
|
129
|
+
const repoRoot = requireRepoRoot(context);
|
|
130
|
+
emit.data(holdArtifact(repoRoot, ref, {
|
|
131
|
+
id: opts.id,
|
|
132
|
+
reason: opts.reason,
|
|
133
|
+
actor: requireHoldActor(repoRoot, opts.actor),
|
|
134
|
+
}));
|
|
135
|
+
}));
|
|
136
|
+
root
|
|
137
|
+
.command("unhold <ref>")
|
|
138
|
+
.description("Remove one exact hold belonging to the supplied owner.")
|
|
139
|
+
.requiredOption("--id <id>", "Exact hold id to remove")
|
|
140
|
+
.option("--actor <instance-id>", "Stable hold owner; defaults to the current agent")
|
|
141
|
+
.action((ref, opts) => run(emit, () => {
|
|
142
|
+
const repoRoot = requireRepoRoot(context);
|
|
143
|
+
emit.data(unholdArtifact(repoRoot, ref, opts.id, { actor: requireHoldActor(repoRoot, opts.actor) }));
|
|
144
|
+
}));
|
|
82
145
|
root
|
|
83
146
|
.command("clean")
|
|
84
147
|
.description("Preview expired artifact deletion; pass --yes to delete.")
|
|
@@ -94,6 +157,12 @@ export function registerArtifactsCommand(program, emit, context) {
|
|
|
94
157
|
});
|
|
95
158
|
});
|
|
96
159
|
}
|
|
160
|
+
function requireHoldActor(repoRoot, explicit) {
|
|
161
|
+
const actor = explicit ? { instance_id: explicit } : currentActor(repoRoot);
|
|
162
|
+
if (!actor)
|
|
163
|
+
throw new Error("hold operations require --actor or a current agent identity");
|
|
164
|
+
return actor;
|
|
165
|
+
}
|
|
97
166
|
function currentActor(repoRoot) {
|
|
98
167
|
const instanceId = resolveOwner();
|
|
99
168
|
if (!instanceId)
|
|
@@ -125,9 +194,11 @@ function summarize(rows) {
|
|
|
125
194
|
}
|
|
126
195
|
return {
|
|
127
196
|
total: rows.length,
|
|
197
|
+
bytes: rows.reduce((sum, row) => sum + (row.bytes ?? 0), 0),
|
|
128
198
|
classifications,
|
|
129
199
|
would_delete: rows.filter((row) => row.action === "would-delete").length,
|
|
130
200
|
deleted: rows.filter((row) => row.action === "deleted").length,
|
|
201
|
+
would_delete_bytes: rows.reduce((sum, row) => sum + (row.action === "would-delete" ? (row.bytes ?? 0) : 0), 0),
|
|
131
202
|
};
|
|
132
203
|
}
|
|
133
204
|
function run(emit, fn) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
|
-
import type { EmitContext } from "../commander.js";
|
|
3
|
-
export declare function registerBrowseAiCommand(program: Command, emitParam: EmitContext): void;
|
|
2
|
+
import type { EmitContext, HarneryProgramContext } from "../commander.js";
|
|
3
|
+
export declare function registerBrowseAiCommand(program: Command, emitParam: EmitContext, context?: HarneryProgramContext): void;
|
|
4
4
|
//# sourceMappingURL=browse-ai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browse-ai.d.ts","sourceRoot":"","sources":["../../src/commands/browse-ai.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"browse-ai.d.ts","sourceRoot":"","sources":["../../src/commands/browse-ai.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAiD1E,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,EACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CA2CN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { AgentBrowser } from "../lib/agent-browser/index.js";
|
|
4
|
-
import { CookieJar } from "../lib/cookies/index.js";
|
|
4
|
+
import { applyExtraCookies, CookieJar } from "../lib/cookies/index.js";
|
|
5
5
|
// Module-scoped emit assigned by registerBrowseAiCommand. Same pattern as
|
|
6
6
|
// cookies/read/browse: helper functions close over `emit` so action
|
|
7
7
|
// callbacks stay concise.
|
|
@@ -25,7 +25,7 @@ let emit;
|
|
|
25
25
|
* works on the other modulo path differences.
|
|
26
26
|
*/
|
|
27
27
|
const DEFAULT_STORE = resolve(homedir(), ".cache", "harnery", "cookies.json");
|
|
28
|
-
export function registerBrowseAiCommand(program, emitParam) {
|
|
28
|
+
export function registerBrowseAiCommand(program, emitParam, context) {
|
|
29
29
|
emit = emitParam;
|
|
30
30
|
program
|
|
31
31
|
.command("browse-ai <url>")
|
|
@@ -50,7 +50,7 @@ export function registerBrowseAiCommand(program, emitParam) {
|
|
|
50
50
|
.option("--timeout <ms>", "Per-step timeout in ms", "60000")
|
|
51
51
|
.action((url, opts) => {
|
|
52
52
|
try {
|
|
53
|
-
runBrowseAi(url, opts);
|
|
53
|
+
runBrowseAi(url, opts, context);
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
56
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -59,10 +59,12 @@ export function registerBrowseAiCommand(program, emitParam) {
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
function runBrowseAi(url, opts) {
|
|
62
|
+
function runBrowseAi(url, opts, context) {
|
|
63
63
|
const jar = opts.cookies === false
|
|
64
64
|
? null
|
|
65
65
|
: new CookieJar({ path: opts.store ?? DEFAULT_STORE, source: "harn-browse-ai" });
|
|
66
|
+
if (jar)
|
|
67
|
+
applyExtraCookies(url, jar, context?.extraCookies);
|
|
66
68
|
const ab = new AgentBrowser({
|
|
67
69
|
jar,
|
|
68
70
|
timeoutMs: Number.parseInt(opts.timeout, 10),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../../src/commands/browse.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../../src/commands/browse.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AA8P1E,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,EACtB,OAAO,CAAC,EAAE,qBAAqB,EAC/B,OAAO,SAAmB,GACzB,IAAI,CA+fN"}
|