harnery 0.30.0 → 0.31.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/README.md +4 -4
- package/dist/commander.d.ts +8 -0
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +14 -13
- package/dist/commands/adapter.d.ts +12 -0
- package/dist/commands/adapter.d.ts.map +1 -0
- package/dist/commands/{harness.js → adapter.js} +35 -35
- package/dist/commands/agents.d.ts +3 -2
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +61 -60
- package/dist/commands/artifacts.d.ts +4 -0
- package/dist/commands/artifacts.d.ts.map +1 -0
- package/dist/commands/artifacts.js +143 -0
- package/dist/commands/backup.d.ts +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +5 -2
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +310 -7
- package/dist/commands/checkpoint.d.ts +12 -0
- package/dist/commands/checkpoint.d.ts.map +1 -0
- package/dist/commands/checkpoint.js +162 -0
- package/dist/commands/context.d.ts +2 -2
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +3 -151
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +31 -7
- package/dist/commands/deinit.d.ts +2 -2
- package/dist/commands/deinit.js +15 -15
- package/dist/commands/doctor.js +23 -23
- package/dist/commands/governor.d.ts +4 -0
- package/dist/commands/governor.d.ts.map +1 -0
- package/dist/commands/{supervisor.js → governor.js} +133 -108
- package/dist/commands/init.d.ts +12 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +44 -30
- package/dist/commands/{session.d.ts → journal.d.ts} +2 -2
- package/dist/commands/journal.d.ts.map +1 -0
- package/dist/commands/{scratch.js → journal.js} +47 -47
- package/dist/commands/policy.js +1 -1
- package/dist/commands/presence.js +2 -2
- package/dist/commands/sync.d.ts +1 -1
- package/dist/commands/sync.js +3 -3
- package/dist/commands/tunnel.d.ts +16 -0
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +193 -23
- package/dist/commands/web-fetch.js +1 -1
- package/dist/commands/web.d.ts +19 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +51 -0
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +38 -22
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +35 -28
- package/dist/core/{harnesses → adapters}/attest-projection.d.ts +2 -2
- package/dist/core/adapters/attest-projection.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.d.ts +16 -16
- package/dist/core/adapters/attest.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attest.js +9 -9
- package/dist/core/{harnesses → adapters}/attestation.d.ts +16 -16
- package/dist/core/adapters/attestation.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/attestation.js +20 -20
- package/dist/core/{harnesses → adapters}/bench.d.ts +12 -12
- package/dist/core/adapters/bench.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/bench.js +12 -12
- package/dist/core/adapters/index.d.ts +13 -0
- package/dist/core/adapters/index.d.ts.map +1 -0
- package/dist/core/adapters/index.js +6 -0
- package/dist/core/{harnesses → adapters}/profiles.d.ts +11 -11
- package/dist/core/adapters/profiles.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/profiles.js +11 -11
- package/dist/core/adapters/registry.d.ts +15 -0
- package/dist/core/adapters/registry.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/registry.js +11 -11
- package/dist/core/{harnesses → adapters}/types.d.ts +23 -23
- package/dist/core/adapters/types.d.ts.map +1 -0
- package/dist/core/{harnesses → adapters}/types.js +1 -1
- package/dist/core/agents/canonical-emit.d.ts +4 -4
- package/dist/core/agents/canonical-emit.js +5 -5
- package/dist/core/agents/cli-emit.js +1 -1
- package/dist/core/agents/cli.js +30 -26
- package/dist/core/agents/codex-replay.d.ts +1 -1
- package/dist/core/agents/codex-replay.js +6 -6
- package/dist/core/agents/coord-client.d.ts +21 -2
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +122 -27
- package/dist/core/agents/events/consume.d.ts +1 -1
- package/dist/core/agents/events/emit.d.ts +5 -6
- package/dist/core/agents/events/emit.d.ts.map +1 -1
- package/dist/core/agents/events/emit.js +2 -2
- package/dist/core/agents/render/prompt-context.d.ts +21 -9
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +82 -30
- package/dist/core/agents/render/session-context.d.ts +1 -1
- package/dist/core/agents/render/session-context.js +5 -5
- package/dist/core/agents/rules/claim-conflict.d.ts +2 -6
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +1 -1
- package/dist/core/agents/rules/commit-conflict.js +98 -22
- package/dist/core/agents/rules/stop-hook.d.ts +9 -9
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +23 -5
- package/dist/core/agents/rules/verdict.d.ts +14 -0
- package/dist/core/agents/rules/verdict.d.ts.map +1 -0
- package/dist/core/agents/rules/verdict.js +1 -0
- package/dist/core/agents/session-events.js +3 -3
- package/dist/core/agents/state/council.d.ts +1 -1
- package/dist/core/agents/state/council.js +1 -1
- package/dist/core/agents/state/heartbeat-projector.d.ts +3 -2
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-projector.js +14 -10
- package/dist/core/agents/state/heartbeat-writer.d.ts +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +12 -12
- package/dist/core/agents/state/{scratch.d.ts → journal.d.ts} +7 -7
- package/dist/core/agents/state/{scratch.d.ts.map → journal.d.ts.map} +1 -1
- package/dist/core/agents/state/{scratch.js → journal.js} +12 -12
- package/dist/core/agents/state/pidmap.d.ts +28 -4
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +130 -15
- package/dist/core/agents/state/proc-start.d.ts +95 -0
- package/dist/core/agents/state/proc-start.d.ts.map +1 -0
- package/dist/core/agents/state/proc-start.js +199 -0
- package/dist/core/agents/state/shell-mutation.d.ts +1 -1
- package/dist/core/agents/state/shell-mutation.js +1 -1
- package/dist/core/agents/state/stale-sweep.js +7 -7
- package/dist/core/artifacts/index.d.ts +86 -0
- package/dist/core/artifacts/index.d.ts.map +1 -0
- package/dist/core/artifacts/index.js +421 -0
- package/dist/core/config.d.ts +9 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +26 -2
- package/dist/core/context/index.d.ts +12 -12
- package/dist/core/context/index.js +10 -10
- package/dist/core/governor/adapter-spread.d.ts +52 -0
- package/dist/core/governor/adapter-spread.d.ts.map +1 -0
- package/dist/core/governor/adapter-spread.js +52 -0
- package/dist/core/governor/index.d.ts +7 -0
- package/dist/core/governor/index.d.ts.map +1 -0
- package/dist/core/governor/index.js +6 -0
- package/dist/core/governor/plan-api.d.ts +38 -0
- package/dist/core/governor/plan-api.d.ts.map +1 -0
- package/dist/core/governor/plan-api.js +83 -0
- package/dist/core/governor/plan-read.d.ts +5 -0
- package/dist/core/governor/plan-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-read.js +66 -52
- package/dist/core/{supervisor → governor}/plan-types.d.ts +57 -56
- package/dist/core/governor/plan-types.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/plan-types.js +4 -4
- package/dist/core/governor/planning.d.ts +48 -0
- package/dist/core/governor/planning.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/planning.js +125 -94
- package/dist/core/governor/read.d.ts +6 -0
- package/dist/core/governor/read.d.ts.map +1 -0
- package/dist/core/governor/read.js +4 -0
- package/dist/core/governor/runner.d.ts +37 -0
- package/dist/core/governor/runner.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/runner.js +15 -15
- package/dist/core/governor/service-read.d.ts +6 -0
- package/dist/core/governor/service-read.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service-read.js +12 -12
- package/dist/core/governor/service.d.ts +114 -0
- package/dist/core/governor/service.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/service.js +57 -57
- package/dist/core/governor/state.d.ts +116 -0
- package/dist/core/governor/state.d.ts.map +1 -0
- package/dist/core/{supervisor → governor}/state.js +228 -108
- package/dist/core/hooks/adapter/detect.d.ts +9 -0
- package/dist/core/hooks/{harness → adapter}/detect.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/detect.js +8 -8
- package/dist/core/hooks/{harness → adapter}/events.d.ts +15 -14
- package/dist/core/hooks/adapter/events.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/events.js +5 -5
- package/dist/core/hooks/{harness → adapter}/output.d.ts +20 -14
- package/dist/core/hooks/adapter/output.d.ts.map +1 -0
- package/dist/core/hooks/{harness → adapter}/output.js +30 -22
- package/dist/core/hooks/{harness → adapter}/parse.d.ts +5 -5
- package/dist/core/hooks/{harness → adapter}/parse.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/parse.js +4 -4
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts +15 -15
- package/dist/core/hooks/{harness → adapter}/wiring.d.ts.map +1 -1
- package/dist/core/hooks/{harness → adapter}/wiring.js +13 -13
- package/dist/core/hooks/cli.d.ts +3 -3
- package/dist/core/hooks/cli.js +175 -151
- package/dist/core/hooks/effects/image-capture.d.ts +5 -5
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +3 -3
- package/dist/core/hooks/effects/index.d.ts +12 -12
- package/dist/core/hooks/effects/index.d.ts.map +1 -1
- package/dist/core/hooks/effects/index.js +17 -17
- package/dist/core/hooks/events/emit.d.ts +2 -2
- package/dist/core/hooks/events/emit.d.ts.map +1 -1
- package/dist/core/hooks/events/emit.js +1 -1
- package/dist/core/hooks/events/rotate.js +1 -1
- package/dist/core/hooks/events/schema.d.ts +13 -5
- package/dist/core/hooks/events/schema.d.ts.map +1 -1
- package/dist/core/hooks/guard-path.d.ts +2 -2
- package/dist/core/hooks/guard-path.js +2 -2
- package/dist/core/hooks/index.d.ts +1 -1
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.d.ts +14 -5
- package/dist/core/hooks/resolve/anchor.d.ts.map +1 -1
- package/dist/core/hooks/resolve/anchor.js +64 -7
- package/dist/core/hooks/resolve/coord-root.d.ts +3 -3
- package/dist/core/hooks/resolve/coord-root.js +4 -4
- package/dist/core/hooks/resolve/intent.js +1 -1
- package/dist/core/hooks/resolve/owner.d.ts +1 -1
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +11 -5
- package/dist/core/{scratch → journal}/index.d.ts +25 -25
- package/dist/core/{scratch → journal}/index.d.ts.map +1 -1
- package/dist/core/{scratch → journal}/index.js +38 -38
- package/dist/core/policy/evaluate.d.ts +1 -1
- package/dist/core/policy/evaluate.d.ts.map +1 -1
- package/dist/core/policy/evaluate.js +7 -7
- package/dist/core/policy/types.d.ts +3 -3
- package/dist/core/policy/types.d.ts.map +1 -1
- package/dist/core/work/state.d.ts +12 -4
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +50 -17
- package/dist/core/workflow/adapters.d.ts +17 -0
- package/dist/core/workflow/adapters.d.ts.map +1 -0
- package/dist/core/workflow/adapters.js +21 -0
- package/dist/core/workflow/approvals.js +6 -6
- package/dist/core/workflow/billing.d.ts +9 -9
- package/dist/core/workflow/billing.js +9 -9
- package/dist/core/workflow/child-env.d.ts +10 -2
- package/dist/core/workflow/child-env.d.ts.map +1 -1
- package/dist/core/workflow/child-env.js +12 -4
- package/dist/core/workflow/engine.d.ts +15 -5
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +138 -83
- package/dist/core/workflow/evidence-preflight.d.ts +24 -0
- package/dist/core/workflow/evidence-preflight.d.ts.map +1 -0
- package/dist/core/workflow/evidence-preflight.js +134 -0
- package/dist/core/workflow/index.d.ts +1 -1
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/proof.d.ts +11 -5
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +45 -36
- package/dist/core/workflow/run-state.d.ts +1 -1
- package/dist/core/workflow/run-state.js +7 -7
- package/dist/core/workflow/sandbox-projection.d.ts +6 -6
- package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
- package/dist/core/workflow/sandbox-projection.js +11 -11
- package/dist/core/workflow/spawn-claude.d.ts +3 -3
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +9 -6
- package/dist/core/workflow/spawn-codex.d.ts +4 -4
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +9 -6
- package/dist/core/workflow/spawn-cursor.d.ts +4 -4
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +9 -6
- package/dist/core/workflow/spawn-failure.d.ts +1 -1
- package/dist/core/workflow/spawn-failure.js +1 -1
- package/dist/core/workflow/specialists.js +2 -2
- package/dist/core/workflow/{journal.d.ts → transcript.d.ts} +8 -8
- package/dist/core/workflow/transcript.d.ts.map +1 -0
- package/dist/core/workflow/{journal.js → transcript.js} +14 -14
- package/dist/core/workflow/types.d.ts +98 -51
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/types.js +11 -1
- package/dist/core/workflow/validate.d.ts +1 -1
- package/dist/core/workflow/validate.js +1 -1
- package/dist/core/workflow/workspaces/cancellation.js +2 -2
- package/dist/core/workflow/workspaces/cleanup.js +2 -2
- package/dist/core/workflow/workspaces/execution.js +6 -6
- package/dist/core/workflow/workspaces/inspect.js +9 -9
- package/dist/core/workflow/workspaces/integration.js +14 -14
- package/dist/core/workflow/workspaces/lifecycle.d.ts +1 -1
- package/dist/core/workflow/workspaces/lifecycle.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/lifecycle.js +9 -9
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +39 -5
- package/dist/core/workflow/workspaces/recovery.js +3 -3
- package/dist/core/workflow/workspaces/state.d.ts +1 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +3 -3
- package/dist/core/workflow/workspaces/types.d.ts +1 -1
- package/dist/core/workflow/workspaces/types.d.ts.map +1 -1
- package/dist/lib/browser/asserts.d.ts +28 -0
- package/dist/lib/browser/asserts.d.ts.map +1 -0
- package/dist/lib/browser/asserts.js +152 -0
- package/dist/lib/browser/client.d.ts +49 -0
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +155 -14
- package/dist/lib/browser/content-checks.d.ts +108 -0
- package/dist/lib/browser/content-checks.d.ts.map +1 -0
- package/dist/lib/browser/content-checks.js +474 -0
- package/dist/lib/browser/critique.d.ts +91 -0
- package/dist/lib/browser/critique.d.ts.map +1 -0
- package/dist/lib/browser/critique.js +167 -0
- package/dist/lib/browser/geometry.d.ts +32 -0
- package/dist/lib/browser/geometry.d.ts.map +1 -1
- package/dist/lib/browser/geometry.js +244 -1
- package/dist/lib/browser/index.d.ts +4 -1
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/claude-desktop.d.ts.map +1 -1
- package/dist/lib/claude-desktop.js +4 -1
- package/dist/lib/council/index.d.ts +6 -6
- package/dist/lib/council/index.d.ts.map +1 -1
- package/dist/lib/council/index.js +8 -8
- package/dist/lib/identities/assume.d.ts +2 -2
- package/dist/lib/identities/assume.js +7 -7
- package/dist/lib/instructions/apply.d.ts +3 -3
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +75 -27
- package/dist/lib/instructions/host-addendum.d.ts +54 -0
- package/dist/lib/instructions/host-addendum.d.ts.map +1 -0
- package/dist/lib/instructions/host-addendum.js +107 -0
- package/dist/lib/instructions/templates.d.ts +10 -3
- package/dist/lib/instructions/templates.d.ts.map +1 -1
- package/dist/lib/instructions/templates.js +41 -12
- package/dist/lib/machine.d.ts +2 -2
- package/dist/lib/machine.js +2 -2
- package/package.json +26 -21
- package/schemas/config.schema.json +26 -1
- package/src/commander.ts +22 -13
- package/src/commands/{harness.ts → adapter.ts} +46 -46
- package/src/commands/agents.ts +71 -64
- package/src/commands/artifacts.ts +168 -0
- package/src/commands/backup.ts +47 -33
- package/src/commands/browse.ts +438 -2
- package/src/commands/checkpoint.ts +196 -0
- package/src/commands/context.ts +3 -176
- package/src/commands/decision.ts +41 -7
- package/src/commands/deinit.ts +16 -16
- package/src/commands/doctor.ts +28 -28
- package/src/commands/{supervisor.ts → governor.ts} +184 -154
- package/src/commands/init.ts +50 -34
- package/src/commands/{scratch.ts → journal.ts} +60 -60
- package/src/commands/policy.ts +1 -1
- package/src/commands/presence.ts +2 -2
- package/src/commands/sync.ts +3 -3
- package/src/commands/tunnel.ts +237 -34
- package/src/commands/web-fetch.ts +1 -1
- package/src/commands/web.ts +56 -1
- package/src/commands/work.ts +50 -35
- package/src/commands/workflow.ts +43 -34
- package/src/core/{harnesses → adapters}/attest-projection.ts +2 -2
- package/src/core/{harnesses → adapters}/attest.ts +27 -27
- package/src/core/{harnesses → adapters}/attestation.ts +41 -41
- package/src/core/{harnesses → adapters}/bench.ts +34 -43
- package/src/core/adapters/index.ts +56 -0
- package/src/core/{harnesses → adapters}/profiles.ts +16 -16
- package/src/core/{harnesses → adapters}/registry.ts +23 -23
- package/src/core/{harnesses → adapters}/types.ts +23 -23
- package/src/core/agents/canonical-emit.ts +6 -6
- package/src/core/agents/cli-emit.ts +1 -1
- package/src/core/agents/cli.ts +30 -28
- package/src/core/agents/codex-replay.ts +6 -6
- package/src/core/agents/coord-client.ts +119 -28
- package/src/core/agents/events/consume.ts +1 -1
- package/src/core/agents/events/emit.ts +7 -6
- package/src/core/agents/render/prompt-context.ts +107 -31
- package/src/core/agents/render/session-context.ts +6 -6
- package/src/core/agents/rules/claim-conflict.ts +4 -7
- package/src/core/agents/rules/commit-conflict.ts +103 -22
- package/src/core/agents/rules/stop-hook.ts +33 -17
- package/src/core/agents/rules/verdict.ts +13 -0
- package/src/core/agents/session-events.ts +4 -4
- package/src/core/agents/state/council.ts +1 -1
- package/src/core/agents/state/heartbeat-projector.ts +16 -12
- package/src/core/agents/state/heartbeat-writer.ts +12 -12
- package/src/core/agents/state/{scratch.ts → journal.ts} +12 -12
- package/src/core/agents/state/pidmap.ts +130 -15
- package/src/core/agents/state/proc-start.ts +208 -0
- package/src/core/agents/state/shell-mutation.ts +1 -1
- package/src/core/agents/state/stale-sweep.ts +7 -7
- package/src/core/artifacts/index.ts +557 -0
- package/src/core/config.ts +30 -2
- package/src/core/context/index.ts +15 -15
- package/src/core/governor/adapter-spread.ts +82 -0
- package/src/core/governor/index.ts +91 -0
- package/src/core/governor/plan-api.ts +115 -0
- package/src/core/{supervisor → governor}/plan-read.ts +112 -97
- package/src/core/{supervisor → governor}/plan-types.ts +59 -56
- package/src/core/{supervisor → governor}/planning.ts +223 -192
- package/src/core/governor/read.ts +59 -0
- package/src/core/{supervisor → governor}/runner.ts +39 -39
- package/src/core/{supervisor → governor}/service-read.ts +22 -22
- package/src/core/{supervisor → governor}/service.ts +117 -119
- package/src/core/{supervisor → governor}/state.ts +325 -167
- package/src/core/hooks/adapter/detect.ts +30 -0
- package/src/core/hooks/{harness → adapter}/events.ts +16 -14
- package/src/core/hooks/{harness → adapter}/output.ts +31 -23
- package/src/core/hooks/{harness → adapter}/parse.ts +5 -5
- package/src/core/hooks/{harness → adapter}/wiring.ts +21 -21
- package/src/core/hooks/cli.ts +185 -162
- package/src/core/hooks/effects/image-capture.ts +6 -6
- package/src/core/hooks/effects/index.ts +17 -17
- package/src/core/hooks/events/emit.ts +3 -3
- package/src/core/hooks/events/rotate.ts +1 -1
- package/src/core/hooks/events/schema.ts +15 -7
- package/src/core/hooks/guard-path.ts +2 -2
- package/src/core/hooks/index.ts +1 -1
- package/src/core/hooks/resolve/anchor.ts +63 -8
- package/src/core/hooks/resolve/coord-root.ts +4 -4
- package/src/core/hooks/resolve/intent.ts +1 -1
- package/src/core/hooks/resolve/owner.ts +11 -5
- package/src/core/{scratch → journal}/index.ts +53 -53
- package/src/core/policy/evaluate.ts +8 -8
- package/src/core/policy/types.ts +3 -3
- package/src/core/work/state.ts +65 -23
- package/src/core/workflow/adapters.ts +33 -0
- package/src/core/workflow/approvals.ts +7 -7
- package/src/core/workflow/billing.ts +12 -12
- package/src/core/workflow/child-env.ts +13 -4
- package/src/core/workflow/engine.ts +155 -90
- package/src/core/workflow/evidence-preflight.ts +165 -0
- package/src/core/workflow/index.ts +3 -3
- package/src/core/workflow/proof.ts +60 -50
- package/src/core/workflow/run-state.ts +7 -7
- package/src/core/workflow/sandbox-projection.ts +16 -16
- package/src/core/workflow/spawn-claude.ts +13 -10
- package/src/core/workflow/spawn-codex.ts +13 -10
- package/src/core/workflow/spawn-cursor.ts +13 -10
- package/src/core/workflow/spawn-failure.ts +1 -1
- package/src/core/workflow/specialists.ts +2 -2
- package/src/core/workflow/{journal.ts → transcript.ts} +16 -16
- package/src/core/workflow/types.ts +108 -51
- package/src/core/workflow/validate.ts +1 -1
- package/src/core/workflow/workspaces/cancellation.ts +2 -2
- package/src/core/workflow/workspaces/cleanup.ts +2 -2
- package/src/core/workflow/workspaces/execution.ts +6 -6
- package/src/core/workflow/workspaces/inspect.ts +14 -11
- package/src/core/workflow/workspaces/integration.ts +18 -14
- package/src/core/workflow/workspaces/lifecycle.ts +10 -10
- package/src/core/workflow/workspaces/local-git.ts +47 -5
- package/src/core/workflow/workspaces/recovery.ts +3 -3
- package/src/core/workflow/workspaces/state.ts +4 -3
- package/src/core/workflow/workspaces/types.ts +1 -1
- package/src/lib/browser/asserts.ts +177 -0
- package/src/lib/browser/client.ts +189 -14
- package/src/lib/browser/content-checks.ts +571 -0
- package/src/lib/browser/critique.ts +231 -0
- package/src/lib/browser/geometry.ts +297 -1
- package/src/lib/browser/index.ts +34 -0
- package/src/lib/claude-desktop.ts +4 -1
- package/src/lib/council/index.ts +9 -9
- package/src/lib/identities/assume.ts +7 -7
- package/src/lib/instructions/apply.ts +87 -25
- package/src/lib/instructions/host-addendum.ts +126 -0
- package/src/lib/instructions/templates.ts +44 -15
- package/src/lib/machine.ts +2 -2
- package/dist/commands/harness.d.ts +0 -12
- package/dist/commands/harness.d.ts.map +0 -1
- package/dist/commands/scratch.d.ts +0 -4
- package/dist/commands/scratch.d.ts.map +0 -1
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -162
- package/dist/commands/supervisor.d.ts +0 -4
- package/dist/commands/supervisor.d.ts.map +0 -1
- package/dist/core/harnesses/attest-projection.d.ts.map +0 -1
- package/dist/core/harnesses/attest.d.ts.map +0 -1
- package/dist/core/harnesses/attestation.d.ts.map +0 -1
- package/dist/core/harnesses/bench.d.ts.map +0 -1
- package/dist/core/harnesses/index.d.ts +0 -13
- package/dist/core/harnesses/index.d.ts.map +0 -1
- package/dist/core/harnesses/index.js +0 -6
- package/dist/core/harnesses/profiles.d.ts.map +0 -1
- package/dist/core/harnesses/registry.d.ts +0 -15
- package/dist/core/harnesses/registry.d.ts.map +0 -1
- package/dist/core/harnesses/types.d.ts.map +0 -1
- package/dist/core/hooks/harness/detect.d.ts +0 -9
- package/dist/core/hooks/harness/events.d.ts.map +0 -1
- package/dist/core/hooks/harness/output.d.ts.map +0 -1
- package/dist/core/supervisor/index.d.ts +0 -7
- package/dist/core/supervisor/index.d.ts.map +0 -1
- package/dist/core/supervisor/index.js +0 -6
- package/dist/core/supervisor/plan-api.d.ts +0 -23
- package/dist/core/supervisor/plan-api.d.ts.map +0 -1
- package/dist/core/supervisor/plan-api.js +0 -50
- package/dist/core/supervisor/plan-read.d.ts +0 -5
- package/dist/core/supervisor/plan-read.d.ts.map +0 -1
- package/dist/core/supervisor/plan-types.d.ts.map +0 -1
- package/dist/core/supervisor/planning.d.ts +0 -33
- package/dist/core/supervisor/planning.d.ts.map +0 -1
- package/dist/core/supervisor/read.d.ts +0 -6
- package/dist/core/supervisor/read.d.ts.map +0 -1
- package/dist/core/supervisor/read.js +0 -4
- package/dist/core/supervisor/runner.d.ts +0 -37
- package/dist/core/supervisor/runner.d.ts.map +0 -1
- package/dist/core/supervisor/service-read.d.ts +0 -6
- package/dist/core/supervisor/service-read.d.ts.map +0 -1
- package/dist/core/supervisor/service.d.ts +0 -114
- package/dist/core/supervisor/service.d.ts.map +0 -1
- package/dist/core/supervisor/state.d.ts +0 -95
- package/dist/core/supervisor/state.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.d.ts +0 -17
- package/dist/core/workflow/harnesses.d.ts.map +0 -1
- package/dist/core/workflow/harnesses.js +0 -21
- package/dist/core/workflow/journal.d.ts.map +0 -1
- package/src/commands/session.ts +0 -187
- package/src/core/harnesses/index.ts +0 -56
- package/src/core/hooks/harness/detect.ts +0 -30
- package/src/core/supervisor/index.ts +0 -89
- package/src/core/supervisor/plan-api.ts +0 -73
- package/src/core/supervisor/read.ts +0 -59
- package/src/core/workflow/harnesses.ts +0 -33
- /package/dist/core/{harnesses → adapters}/attest-projection.js +0 -0
|
@@ -17,7 +17,7 @@ import { join } from "node:path";
|
|
|
17
17
|
*/
|
|
18
18
|
export function resolveIntent(opts) {
|
|
19
19
|
const stampPath = join(opts.coordRoot, ".harnery", `.last-intent.${opts.instanceId}`);
|
|
20
|
-
// 1. Fresh from the command itself (most reliable, cross-
|
|
20
|
+
// 1. Fresh from the command itself (most reliable, cross-adapter).
|
|
21
21
|
if (opts.commandIntentComment) {
|
|
22
22
|
const cleaned = clamp(opts.commandIntentComment);
|
|
23
23
|
if (cleaned) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Precedence:
|
|
5
5
|
*
|
|
6
|
-
* 1. `HARNERY_AGENT_COORD_OWNER` env var. Set by
|
|
6
|
+
* 1. `HARNERY_AGENT_COORD_OWNER` env var. Set by adapter adapters when they know
|
|
7
7
|
* the owner identity at spawn time (Codex's apply_patch tool path uses
|
|
8
8
|
* this).
|
|
9
9
|
* 2. Hook payload fields, in order: `agent_id` → `subagent_id` →
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/owner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/owner.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,GAAG,SAAS,GAAG,aAAa,GAAG,iBAAiB,CAAA;CAAE,GAAG,IAAI,CAoDhG;AA2BD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ7E;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUxF;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBnF"}
|
|
@@ -2,12 +2,13 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { coordEnv } from "../../../lib/env.js";
|
|
5
|
+
import { checkPidToken } from "../../agents/state/proc-start.js";
|
|
5
6
|
/**
|
|
6
7
|
* Resolve the canonical `instance_id` for the current hook invocation.
|
|
7
8
|
*
|
|
8
9
|
* Precedence:
|
|
9
10
|
*
|
|
10
|
-
* 1. `HARNERY_AGENT_COORD_OWNER` env var. Set by
|
|
11
|
+
* 1. `HARNERY_AGENT_COORD_OWNER` env var. Set by adapter adapters when they know
|
|
11
12
|
* the owner identity at spawn time (Codex's apply_patch tool path uses
|
|
12
13
|
* this).
|
|
13
14
|
* 2. Hook payload fields, in order: `agent_id` → `subagent_id` →
|
|
@@ -34,7 +35,7 @@ export function resolveOwner(opts) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
// Pid-map ancestor walk. Start at own pid (the bash wrapper's bun child),
|
|
37
|
-
// walk up through ppids. The pid-map is stamped keyed by the
|
|
38
|
+
// walk up through ppids. The pid-map is stamped keyed by the adapter PID, so
|
|
38
39
|
// we'll usually find it 1-3 hops up.
|
|
39
40
|
const pidmap = join(opts.coordRoot, ".harnery", "pid-map");
|
|
40
41
|
if (existsSync(pidmap)) {
|
|
@@ -45,9 +46,14 @@ export function resolveOwner(opts) {
|
|
|
45
46
|
if (existsSync(file)) {
|
|
46
47
|
try {
|
|
47
48
|
const row = readFileSync(file, "utf8").trim();
|
|
48
|
-
// Row shape: "<instance_id>"
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
// Row shape: "<instance_id>", "<instance_id>\t<platform>", or
|
|
50
|
+
// "<instance_id>\t<platform>\t<start_token>".
|
|
51
|
+
const [owner, , startToken] = row.split("\t");
|
|
52
|
+
// A row whose start token disagrees with the process now holding this
|
|
53
|
+
// pid is about a different, earlier process. Believing it hands this
|
|
54
|
+
// session another agent's identity, so walk past it.
|
|
55
|
+
const recycled = checkPidToken(pid, startToken || undefined) === "mismatch";
|
|
56
|
+
if (owner && owner.length > 0 && !recycled) {
|
|
51
57
|
return {
|
|
52
58
|
instance_id: owner,
|
|
53
59
|
source: hops === 0 ? "pidmap-self" : "pidmap-ancestor",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agent
|
|
2
|
+
* Agent journal: per-agent markdown journal at `.harnery/journal/<instance_id>.md`.
|
|
3
3
|
*
|
|
4
4
|
* Rules:
|
|
5
5
|
* - Single writer (the agent itself, via this lib). Peers read but never write.
|
|
@@ -7,59 +7,59 @@
|
|
|
7
7
|
* - Strict entry-header format: `## <Chicago datetime> · <category>`. The
|
|
8
8
|
* linter enforces this so format violations are impossible at the write path.
|
|
9
9
|
* - 50 KB hard cap; auto-prunes oldest entries when exceeded.
|
|
10
|
-
* - SessionEnd hook archives to `.harnery/
|
|
10
|
+
* - SessionEnd hook archives to `.harnery/journal/archived/<instance_id>-<ts>.md`;
|
|
11
11
|
* SessionStart janitor deletes archives older than 7 days + surfaces the
|
|
12
12
|
* most-recent archive as a recovery cue.
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
15
|
-
export type
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
14
|
+
export declare const JOURNAL_CATEGORIES: readonly ["note", "plan", "decision", "blocker", "question", "done", "handoff"];
|
|
15
|
+
export type JournalCategory = (typeof JOURNAL_CATEGORIES)[number];
|
|
16
|
+
export declare const MAX_JOURNAL_BYTES: number;
|
|
17
|
+
export declare const WARN_JOURNAL_BYTES: number;
|
|
18
18
|
export declare const ARCHIVE_RETENTION_DAYS = 7;
|
|
19
19
|
/** Entry-header regex: `## 2026-05-15 1:48 AM CDT · note` */
|
|
20
20
|
export declare const ENTRY_HEADER_RE: RegExp;
|
|
21
|
-
/** First line of every
|
|
22
|
-
export declare const
|
|
23
|
-
export interface
|
|
21
|
+
/** First line of every journal file: this prefix followed by the agent name. */
|
|
22
|
+
export declare const JOURNAL_HEADER_PREFIX = "# Journal: agent-";
|
|
23
|
+
export interface JournalEntry {
|
|
24
24
|
ts_iso: string;
|
|
25
25
|
ts_display: string;
|
|
26
|
-
category:
|
|
26
|
+
category: JournalCategory;
|
|
27
27
|
body: string;
|
|
28
28
|
}
|
|
29
|
-
export interface
|
|
29
|
+
export interface JournalHeader {
|
|
30
30
|
name: string;
|
|
31
31
|
session_id: string;
|
|
32
32
|
machine: string;
|
|
33
33
|
started: string;
|
|
34
34
|
last_updated: string;
|
|
35
35
|
}
|
|
36
|
-
export interface
|
|
36
|
+
export interface JournalDoc {
|
|
37
37
|
path: string;
|
|
38
|
-
header:
|
|
39
|
-
entries:
|
|
38
|
+
header: JournalHeader;
|
|
39
|
+
entries: JournalEntry[];
|
|
40
40
|
bytes: number;
|
|
41
41
|
}
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function journalDir(): string;
|
|
43
43
|
export declare function archiveDir(): string;
|
|
44
|
-
export declare function
|
|
44
|
+
export declare function journalPath(instanceId: string): string;
|
|
45
45
|
/** Format `Date` as `2026-05-15 1:48 AM CDT`, what we write into the file. */
|
|
46
46
|
export declare function formatChicago(d?: Date): string;
|
|
47
|
-
/** Parse a
|
|
48
|
-
export declare function
|
|
47
|
+
/** Parse a journal file (or empty content) into a structured doc. */
|
|
48
|
+
export declare function parseJournal(path: string, content: string): JournalDoc;
|
|
49
49
|
/** Serialize a parsed doc back to markdown. */
|
|
50
|
-
export declare function
|
|
50
|
+
export declare function serializeJournal(doc: JournalDoc): string;
|
|
51
51
|
export interface LintIssue {
|
|
52
52
|
line: number;
|
|
53
53
|
message: string;
|
|
54
54
|
}
|
|
55
|
-
export declare function
|
|
56
|
-
export declare function appendEntry(instanceId: string, category:
|
|
55
|
+
export declare function lintJournal(content: string, byteCap?: number): LintIssue[];
|
|
56
|
+
export declare function appendEntry(instanceId: string, category: JournalCategory, body: string): JournalDoc;
|
|
57
57
|
/** Move `<owner>.md` → `archived/<owner>-<ts>.md`. No-op if missing. Returns archive path (or null). */
|
|
58
|
-
export declare function
|
|
58
|
+
export declare function archiveJournal(instanceId: string): string | null;
|
|
59
59
|
/** Delete archives older than `days`. Returns number deleted. */
|
|
60
60
|
export declare function pruneArchives(days?: number): number;
|
|
61
|
-
/** Sweep `.harnery/
|
|
62
|
-
export declare function
|
|
61
|
+
/** Sweep `.harnery/journal/<owner>.md` files whose corresponding heartbeat is gone. */
|
|
62
|
+
export declare function sweepOrphanJournals(): string[];
|
|
63
63
|
/** List archive files sorted by mtime descending. */
|
|
64
64
|
export declare function listArchives(): {
|
|
65
65
|
path: string;
|
|
@@ -68,7 +68,7 @@ export declare function listArchives(): {
|
|
|
68
68
|
bytes: number;
|
|
69
69
|
}[];
|
|
70
70
|
export declare function currentOwnerOrThrow(): string;
|
|
71
|
-
export declare function
|
|
71
|
+
export declare function loadJournal(instanceId: string): JournalDoc | null;
|
|
72
72
|
/** Resolve an agent name → instance_id by walking active heartbeats (case-insensitive). */
|
|
73
73
|
export declare function resolveOwnerByName(name: string): string | null;
|
|
74
74
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/journal/index.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,kBAAkB,iFAQrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAC3C,eAAO,MAAM,kBAAkB,QAAY,CAAC;AAC5C,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,6DAA6D;AAC7D,eAAO,MAAM,eAAe,QACyF,CAAC;AAEtH,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,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BnE;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAa9C;AAED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,EAAE,CAWF;AAID,wBAAgB,mBAAmB,IAAI,MAAM,CAM5C;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAIjE;AAED,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoB9D"}
|
|
@@ -3,7 +3,7 @@ import { dirname, resolve } from "node:path";
|
|
|
3
3
|
import { resolveMachineLabel } from "../../lib/machine.js";
|
|
4
4
|
import { assertSafeInstanceId, monorepoRoot, readHeartbeat, resolveContainedFile, resolveOwner, } from "../agents/index.js";
|
|
5
5
|
/**
|
|
6
|
-
* Agent
|
|
6
|
+
* Agent journal: per-agent markdown journal at `.harnery/journal/<instance_id>.md`.
|
|
7
7
|
*
|
|
8
8
|
* Rules:
|
|
9
9
|
* - Single writer (the agent itself, via this lib). Peers read but never write.
|
|
@@ -11,11 +11,11 @@ import { assertSafeInstanceId, monorepoRoot, readHeartbeat, resolveContainedFile
|
|
|
11
11
|
* - Strict entry-header format: `## <Chicago datetime> · <category>`. The
|
|
12
12
|
* linter enforces this so format violations are impossible at the write path.
|
|
13
13
|
* - 50 KB hard cap; auto-prunes oldest entries when exceeded.
|
|
14
|
-
* - SessionEnd hook archives to `.harnery/
|
|
14
|
+
* - SessionEnd hook archives to `.harnery/journal/archived/<instance_id>-<ts>.md`;
|
|
15
15
|
* SessionStart janitor deletes archives older than 7 days + surfaces the
|
|
16
16
|
* most-recent archive as a recovery cue.
|
|
17
17
|
*/
|
|
18
|
-
export const
|
|
18
|
+
export const JOURNAL_CATEGORIES = [
|
|
19
19
|
"note",
|
|
20
20
|
"plan",
|
|
21
21
|
"decision",
|
|
@@ -24,30 +24,30 @@ export const SCRATCH_CATEGORIES = [
|
|
|
24
24
|
"done",
|
|
25
25
|
"handoff",
|
|
26
26
|
];
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
27
|
+
export const MAX_JOURNAL_BYTES = 50 * 1024;
|
|
28
|
+
export const WARN_JOURNAL_BYTES = 40 * 1024;
|
|
29
29
|
export const ARCHIVE_RETENTION_DAYS = 7;
|
|
30
30
|
/** Entry-header regex: `## 2026-05-15 1:48 AM CDT · note` */
|
|
31
31
|
export const ENTRY_HEADER_RE = /^## (\d{4}-\d{2}-\d{2}) (\d{1,2}):(\d{2}) (AM|PM) (CDT|CST) · (note|plan|decision|blocker|question|done|handoff)$/;
|
|
32
|
-
/** First line of every
|
|
33
|
-
export const
|
|
32
|
+
/** First line of every journal file: this prefix followed by the agent name. */
|
|
33
|
+
export const JOURNAL_HEADER_PREFIX = "# Journal: agent-";
|
|
34
34
|
// ─── Paths ────────────────────────────────────────────────────────────────
|
|
35
|
-
export function
|
|
35
|
+
export function journalDir() {
|
|
36
36
|
const root = monorepoRoot();
|
|
37
37
|
if (!root)
|
|
38
38
|
throw new Error("Not in a coord-aware repo (coord_root() returned null).");
|
|
39
|
-
const dir = resolve(root, ".harnery", "
|
|
39
|
+
const dir = resolve(root, ".harnery", "journal");
|
|
40
40
|
mkdirSync(dir, { recursive: true });
|
|
41
41
|
return dir;
|
|
42
42
|
}
|
|
43
43
|
export function archiveDir() {
|
|
44
|
-
const dir = resolve(
|
|
44
|
+
const dir = resolve(journalDir(), "archived");
|
|
45
45
|
mkdirSync(dir, { recursive: true });
|
|
46
46
|
return dir;
|
|
47
47
|
}
|
|
48
|
-
export function
|
|
48
|
+
export function journalPath(instanceId) {
|
|
49
49
|
assertSafeInstanceId(instanceId);
|
|
50
|
-
return resolveContainedFile(
|
|
50
|
+
return resolveContainedFile(journalDir(), `${instanceId}.md`);
|
|
51
51
|
}
|
|
52
52
|
// ─── Chicago time formatting ──────────────────────────────────────────────
|
|
53
53
|
const CHICAGO_FORMATTER = new Intl.DateTimeFormat("en-US", {
|
|
@@ -74,8 +74,8 @@ export function formatChicago(d = new Date()) {
|
|
|
74
74
|
return `${year}-${month}-${day} ${hour}:${minute} ${dayPeriod} ${tz}`;
|
|
75
75
|
}
|
|
76
76
|
// ─── Parse / serialize ────────────────────────────────────────────────────
|
|
77
|
-
/** Parse a
|
|
78
|
-
export function
|
|
77
|
+
/** Parse a journal file (or empty content) into a structured doc. */
|
|
78
|
+
export function parseJournal(path, content) {
|
|
79
79
|
const lines = content.split("\n");
|
|
80
80
|
const header = {
|
|
81
81
|
name: "unknown",
|
|
@@ -87,8 +87,8 @@ export function parseScratch(path, content) {
|
|
|
87
87
|
const entries = [];
|
|
88
88
|
let i = 0;
|
|
89
89
|
// ── header ──
|
|
90
|
-
if (lines[i]?.startsWith(
|
|
91
|
-
header.name = lines[i].replace(
|
|
90
|
+
if (lines[i]?.startsWith(JOURNAL_HEADER_PREFIX)) {
|
|
91
|
+
header.name = lines[i].replace(JOURNAL_HEADER_PREFIX, "").trim();
|
|
92
92
|
i++;
|
|
93
93
|
}
|
|
94
94
|
for (; i < lines.length; i++) {
|
|
@@ -146,9 +146,9 @@ export function parseScratch(path, content) {
|
|
|
146
146
|
return { path, header, entries, bytes: Buffer.byteLength(content, "utf8") };
|
|
147
147
|
}
|
|
148
148
|
/** Serialize a parsed doc back to markdown. */
|
|
149
|
-
export function
|
|
149
|
+
export function serializeJournal(doc) {
|
|
150
150
|
const lines = [];
|
|
151
|
-
lines.push(`${
|
|
151
|
+
lines.push(`${JOURNAL_HEADER_PREFIX}${doc.header.name}`);
|
|
152
152
|
if (doc.header.session_id)
|
|
153
153
|
lines.push(`session_id: ${doc.header.session_id}`);
|
|
154
154
|
if (doc.header.machine)
|
|
@@ -179,12 +179,12 @@ function chicagoToIso(date, hourStr, minute, period, tz) {
|
|
|
179
179
|
const hh = String(hour).padStart(2, "0");
|
|
180
180
|
return `${date}T${hh}:${minute}:00${offset}`;
|
|
181
181
|
}
|
|
182
|
-
export function
|
|
182
|
+
export function lintJournal(content, byteCap = MAX_JOURNAL_BYTES) {
|
|
183
183
|
const issues = [];
|
|
184
184
|
const lines = content.split("\n");
|
|
185
185
|
// Frontmatter checks
|
|
186
|
-
if (!lines[0]?.startsWith(
|
|
187
|
-
issues.push({ line: 1, message: `missing '${
|
|
186
|
+
if (!lines[0]?.startsWith(JOURNAL_HEADER_PREFIX)) {
|
|
187
|
+
issues.push({ line: 1, message: `missing '${JOURNAL_HEADER_PREFIX}<name>' header` });
|
|
188
188
|
}
|
|
189
189
|
for (const required of ["session_id:", "machine:", "started:"]) {
|
|
190
190
|
if (!lines.slice(0, 10).some((l) => l.startsWith(required))) {
|
|
@@ -239,14 +239,14 @@ export function lintScratch(content, byteCap = MAX_SCRATCH_BYTES) {
|
|
|
239
239
|
// ─── Append + prune ───────────────────────────────────────────────────────
|
|
240
240
|
export function appendEntry(instanceId, category, body) {
|
|
241
241
|
const hb = readHeartbeat(instanceId);
|
|
242
|
-
const path =
|
|
242
|
+
const path = journalPath(instanceId);
|
|
243
243
|
let doc;
|
|
244
244
|
if (existsSync(path)) {
|
|
245
|
-
doc =
|
|
245
|
+
doc = parseJournal(path, readFileSync(path, "utf8"));
|
|
246
246
|
}
|
|
247
247
|
else {
|
|
248
248
|
// Seed `started` from the heartbeat's session start so cross-agent writes
|
|
249
|
-
// (`harn agents ping`) don't stamp the peer's
|
|
249
|
+
// (`harn agents ping`) don't stamp the peer's journal with our wall-clock.
|
|
250
250
|
const startedSeed = hb?.started_at ? formatChicago(new Date(hb.started_at)) : formatChicago();
|
|
251
251
|
doc = {
|
|
252
252
|
path,
|
|
@@ -274,22 +274,22 @@ export function appendEntry(instanceId, category, body) {
|
|
|
274
274
|
doc.header.name = hb?.name ?? doc.header.name;
|
|
275
275
|
}
|
|
276
276
|
// Prune from the tail until under cap.
|
|
277
|
-
let serialized =
|
|
277
|
+
let serialized = serializeJournal(doc);
|
|
278
278
|
let pruned = 0;
|
|
279
|
-
while (Buffer.byteLength(serialized, "utf8") >
|
|
279
|
+
while (Buffer.byteLength(serialized, "utf8") > MAX_JOURNAL_BYTES && doc.entries.length > 1) {
|
|
280
280
|
doc.entries.pop();
|
|
281
281
|
pruned++;
|
|
282
|
-
serialized =
|
|
282
|
+
serialized = serializeJournal(doc);
|
|
283
283
|
}
|
|
284
284
|
if (pruned > 0) {
|
|
285
285
|
const pruneEntry = {
|
|
286
286
|
ts_iso: new Date().toISOString(),
|
|
287
287
|
ts_display: formatChicago(),
|
|
288
288
|
category: "note",
|
|
289
|
-
body: `(auto-pruned ${pruned} oldest entries to stay under ${
|
|
289
|
+
body: `(auto-pruned ${pruned} oldest entries to stay under ${MAX_JOURNAL_BYTES}-byte cap)`,
|
|
290
290
|
};
|
|
291
291
|
doc.entries.unshift(pruneEntry);
|
|
292
|
-
serialized =
|
|
292
|
+
serialized = serializeJournal(doc);
|
|
293
293
|
}
|
|
294
294
|
doc.bytes = Buffer.byteLength(serialized, "utf8");
|
|
295
295
|
// Atomic write
|
|
@@ -301,9 +301,9 @@ export function appendEntry(instanceId, category, body) {
|
|
|
301
301
|
}
|
|
302
302
|
// ─── Archive lifecycle ────────────────────────────────────────────────────
|
|
303
303
|
/** Move `<owner>.md` → `archived/<owner>-<ts>.md`. No-op if missing. Returns archive path (or null). */
|
|
304
|
-
export function
|
|
304
|
+
export function archiveJournal(instanceId) {
|
|
305
305
|
assertSafeInstanceId(instanceId);
|
|
306
|
-
const src =
|
|
306
|
+
const src = journalPath(instanceId);
|
|
307
307
|
if (!existsSync(src))
|
|
308
308
|
return null;
|
|
309
309
|
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
@@ -333,9 +333,9 @@ export function pruneArchives(days = ARCHIVE_RETENTION_DAYS) {
|
|
|
333
333
|
}
|
|
334
334
|
return deleted;
|
|
335
335
|
}
|
|
336
|
-
/** Sweep `.harnery/
|
|
337
|
-
export function
|
|
338
|
-
const dir =
|
|
336
|
+
/** Sweep `.harnery/journal/<owner>.md` files whose corresponding heartbeat is gone. */
|
|
337
|
+
export function sweepOrphanJournals() {
|
|
338
|
+
const dir = journalDir();
|
|
339
339
|
const archived = [];
|
|
340
340
|
for (const f of readdirSync(dir)) {
|
|
341
341
|
if (!f.endsWith(".md"))
|
|
@@ -343,7 +343,7 @@ export function sweepOrphanScratchpads() {
|
|
|
343
343
|
const instanceId = f.replace(/\.md$/, "");
|
|
344
344
|
const hb = readHeartbeat(instanceId);
|
|
345
345
|
if (!hb) {
|
|
346
|
-
const dest =
|
|
346
|
+
const dest = archiveJournal(instanceId);
|
|
347
347
|
if (dest)
|
|
348
348
|
archived.push(dest);
|
|
349
349
|
}
|
|
@@ -372,11 +372,11 @@ export function currentOwnerOrThrow() {
|
|
|
372
372
|
}
|
|
373
373
|
return owner;
|
|
374
374
|
}
|
|
375
|
-
export function
|
|
376
|
-
const path =
|
|
375
|
+
export function loadJournal(instanceId) {
|
|
376
|
+
const path = journalPath(instanceId);
|
|
377
377
|
if (!existsSync(path))
|
|
378
378
|
return null;
|
|
379
|
-
return
|
|
379
|
+
return parseJournal(path, readFileSync(path, "utf8"));
|
|
380
380
|
}
|
|
381
381
|
/** Resolve an agent name → instance_id by walking active heartbeats (case-insensitive). */
|
|
382
382
|
export function resolveOwnerByName(name) {
|
|
@@ -8,7 +8,7 @@ export declare function normalizePolicy(input: PolicySpec, options?: {
|
|
|
8
8
|
}): Readonly<NormalizedPolicy>;
|
|
9
9
|
export declare function policyDigest(policy: NormalizedPolicy): string;
|
|
10
10
|
export declare function evaluatePolicy(policy: Readonly<NormalizedPolicy>, rawRequest: PolicyRequest): PolicyEvaluation;
|
|
11
|
-
/** Bound and normalize the receipt-safe subset before it reaches a
|
|
11
|
+
/** Bound and normalize the receipt-safe subset before it reaches a transcript or proof. */
|
|
12
12
|
export declare function summarizePolicyRequest(input: PolicyRequest): PolicyRequestSummary;
|
|
13
13
|
export type { PolicyIsolation };
|
|
14
14
|
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../src/core/policy/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,oBAAoB,EAEpB,UAAU,EAEX,MAAM,YAAY,CAAC;AAqBpB,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACjC,QAAQ,CAAC,gBAAgB,CAAC,CAwB5B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAE7D;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,UAAU,EAAE,aAAa,GACxB,gBAAgB,CA8FlB;AAED,
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../src/core/policy/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,oBAAoB,EAEpB,UAAU,EAEX,MAAM,YAAY,CAAC;AAqBpB,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACjC,QAAQ,CAAC,gBAAgB,CAAC,CAwB5B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAE7D;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,UAAU,EAAE,aAAa,GACxB,gBAAgB,CA8FlB;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,oBAAoB,CA8BjF;AAyGD,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -11,7 +11,7 @@ const POLICY_FIELDS = new Set([
|
|
|
11
11
|
"name",
|
|
12
12
|
"max_cost_usd",
|
|
13
13
|
"unknown_cost",
|
|
14
|
-
"
|
|
14
|
+
"allowed_adapters",
|
|
15
15
|
"allowed_models",
|
|
16
16
|
"allowed_paths",
|
|
17
17
|
"network",
|
|
@@ -43,7 +43,7 @@ export function normalizePolicy(input, options = {}) {
|
|
|
43
43
|
name: boundedString(input.name ?? "workflow policy", "policy name", MAX_NAME),
|
|
44
44
|
max_cost_usd: optionalMoney(input.max_cost_usd, "max_cost_usd"),
|
|
45
45
|
unknown_cost: enumValue(input.unknown_cost ?? "deny", ["ask", "deny"], "unknown_cost"),
|
|
46
|
-
|
|
46
|
+
allowed_adapters: optionalStringList(input.allowed_adapters, "allowed_adapters"),
|
|
47
47
|
allowed_models: optionalStringList(input.allowed_models, "allowed_models"),
|
|
48
48
|
allowed_paths: optionalPathList(input.allowed_paths, baseDir),
|
|
49
49
|
network: enumValue(input.network ?? "deny", VERDICTS, "network"),
|
|
@@ -61,9 +61,9 @@ export function evaluatePolicy(policy, rawRequest) {
|
|
|
61
61
|
const add = (code, verdict, reason) => {
|
|
62
62
|
rules.push({ code, verdict, reason });
|
|
63
63
|
};
|
|
64
|
-
if (policy.
|
|
65
|
-
if (!request.
|
|
66
|
-
add("
|
|
64
|
+
if (policy.allowed_adapters && request.phase === "dispatch") {
|
|
65
|
+
if (!request.adapter || !policy.allowed_adapters.includes(request.adapter)) {
|
|
66
|
+
add("adapter_not_allowed", "deny", `adapter ${JSON.stringify(request.adapter ?? "unknown")} is not allowed`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
if (policy.allowed_models && request.phase === "dispatch") {
|
|
@@ -114,7 +114,7 @@ export function evaluatePolicy(policy, rawRequest) {
|
|
|
114
114
|
rules,
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
/** Bound and normalize the receipt-safe subset before it reaches a
|
|
117
|
+
/** Bound and normalize the receipt-safe subset before it reaches a transcript or proof. */
|
|
118
118
|
export function summarizePolicyRequest(input) {
|
|
119
119
|
if (!isRecord(input))
|
|
120
120
|
throw new Error("policy request must be an object");
|
|
@@ -125,7 +125,7 @@ export function summarizePolicyRequest(input) {
|
|
|
125
125
|
phase,
|
|
126
126
|
action: boundedString(input.action, "policy action", MAX_FIELD),
|
|
127
127
|
path: optionalBounded(input.path, "policy path"),
|
|
128
|
-
|
|
128
|
+
adapter: optionalBounded(input.adapter, "policy adapter"),
|
|
129
129
|
model: optionalBounded(input.model, "policy model"),
|
|
130
130
|
effort: optionalBounded(input.effort, "policy effort"),
|
|
131
131
|
max_attempts: optionalWholeNumber(input.max_attempts, "policy max_attempts", 1),
|
|
@@ -10,7 +10,7 @@ export interface PolicySpec {
|
|
|
10
10
|
max_cost_usd?: number;
|
|
11
11
|
/** Applied when a cost ceiling exists but the host cannot price a dispatch. */
|
|
12
12
|
unknown_cost?: Exclude<PolicyVerdict, "allow">;
|
|
13
|
-
|
|
13
|
+
allowed_adapters?: readonly string[];
|
|
14
14
|
allowed_models?: readonly string[];
|
|
15
15
|
/** Absolute paths, or paths relative to the policy file. */
|
|
16
16
|
allowed_paths?: readonly string[];
|
|
@@ -24,7 +24,7 @@ export interface NormalizedPolicy {
|
|
|
24
24
|
name: string;
|
|
25
25
|
max_cost_usd?: number;
|
|
26
26
|
unknown_cost: Exclude<PolicyVerdict, "allow">;
|
|
27
|
-
|
|
27
|
+
allowed_adapters?: readonly string[];
|
|
28
28
|
allowed_models?: readonly string[];
|
|
29
29
|
allowed_paths?: readonly string[];
|
|
30
30
|
network: PolicyVerdict;
|
|
@@ -35,7 +35,7 @@ export interface PolicyRequest {
|
|
|
35
35
|
phase: PolicyPhase;
|
|
36
36
|
action: string;
|
|
37
37
|
path?: string;
|
|
38
|
-
|
|
38
|
+
adapter?: string;
|
|
39
39
|
model?: string;
|
|
40
40
|
effort?: string;
|
|
41
41
|
max_attempts?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/policy/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,CAAU,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,mBAAmB,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC3E,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAErE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,OAAO,qBAAqB,CAAC;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAC/C,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/policy/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,CAAU,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,mBAAmB,CAAC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AAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,aAAa,CAAC;IAC/B,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,WAAW,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,oBAAoB,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,KACpC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC"}
|
|
@@ -65,14 +65,17 @@ export interface WorkAttempt {
|
|
|
65
65
|
run_id: string;
|
|
66
66
|
started_at: string;
|
|
67
67
|
trigger?: WorkAttemptTrigger;
|
|
68
|
-
status: "running" | "parked" | "succeeded" | "failed" | "lost" | "
|
|
68
|
+
status: "running" | "parked" | "succeeded" | "failed" | "lost" | "transcript_unreadable";
|
|
69
69
|
approval_id?: string;
|
|
70
70
|
proof_path?: string;
|
|
71
|
-
|
|
71
|
+
transcript_error?: string;
|
|
72
72
|
/** Why this failed attempt was uninformative about the work (ADR 0046), read
|
|
73
73
|
* from the proof's run.class. Absent ⇒ the attempt is charged, exactly as
|
|
74
74
|
* before ADR 0046 (which is also how a proof without a class reads). */
|
|
75
|
-
uncharged?: "environment" | "upstream";
|
|
75
|
+
uncharged?: "environment" | "upstream" | "decision";
|
|
76
|
+
/** Docket id this attempt stopped on, when uncharged is "decision" and the
|
|
77
|
+
* script named one. Lets the projection point at the question itself. */
|
|
78
|
+
blocked_on?: string;
|
|
76
79
|
}
|
|
77
80
|
export interface WorkProjection {
|
|
78
81
|
id: string;
|
|
@@ -93,6 +96,11 @@ export interface WorkProjection {
|
|
|
93
96
|
latest_run_id?: string;
|
|
94
97
|
approval_id?: string;
|
|
95
98
|
proof_path?: string;
|
|
99
|
+
/** Set when this item stopped because a human must rule. The value is the
|
|
100
|
+
* docket id when the script named one, else the empty string — present either
|
|
101
|
+
* way, so a reader can distinguish "waiting on a person" from every other
|
|
102
|
+
* terminal block without parsing the reason prose. */
|
|
103
|
+
blocked_on_decision?: string;
|
|
96
104
|
updated_at: string;
|
|
97
105
|
}
|
|
98
106
|
export interface WorkRecord {
|
|
@@ -152,7 +160,7 @@ export declare function readWorkItemIgnoringLease(coordRoot: string, workId: str
|
|
|
152
160
|
export declare function assertWorkflowUnchanged(intent: WorkIntent): void;
|
|
153
161
|
/** @internal Runner seam; not a separate persistence contract. */
|
|
154
162
|
export declare function acquireWorkLease(coordRoot: string, workId: string): () => void;
|
|
155
|
-
/** @internal Work
|
|
163
|
+
/** @internal Work transcript mutation seam. */
|
|
156
164
|
export declare function acquireWorkEventLease(coordRoot: string, workId: string): () => void;
|
|
157
165
|
/** @internal Runner seam; not a separate persistence contract. */
|
|
158
166
|
export declare function boundedActor(value?: string, fallback?: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/work/state.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AACrD,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC;AAwBpD,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,OAAO,GACP,SAAS,GACT,mBAAmB,GACnB,WAAW,GACX,SAAS,GACT,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,cAAc,GACtB,uBAAuB,GACvB,KAAK,GACL,cAAc,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