@cluesmith/codev 3.2.4 → 3.3.1
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/dashboard-dist/assets/index-BZRTEMtH.css +32 -0
- package/dashboard-dist/assets/{index-BZ1x7x1X.js → index-D3XaKpZW.js} +46 -44
- package/dashboard-dist/assets/index-D3XaKpZW.js.map +1 -0
- package/dashboard-dist/index.html +2 -2
- package/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +154 -0
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
- package/dist/agent-farm/commands/cleanup.js +16 -0
- package/dist/agent-farm/commands/cleanup.js.map +1 -1
- package/dist/agent-farm/commands/inbox.d.ts +42 -0
- package/dist/agent-farm/commands/inbox.d.ts.map +1 -0
- package/dist/agent-farm/commands/inbox.js +129 -0
- package/dist/agent-farm/commands/inbox.js.map +1 -0
- package/dist/agent-farm/commands/interrupt.d.ts +20 -0
- package/dist/agent-farm/commands/interrupt.d.ts.map +1 -0
- package/dist/agent-farm/commands/interrupt.js +65 -0
- package/dist/agent-farm/commands/interrupt.js.map +1 -0
- package/dist/agent-farm/commands/reset/constants.d.ts +52 -0
- package/dist/agent-farm/commands/reset/constants.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/constants.js +52 -0
- package/dist/agent-farm/commands/reset/constants.js.map +1 -0
- package/dist/agent-farm/commands/reset/context.d.ts +230 -0
- package/dist/agent-farm/commands/reset/context.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/context.js +428 -0
- package/dist/agent-farm/commands/reset/context.js.map +1 -0
- package/dist/agent-farm/commands/reset/index.d.ts +192 -0
- package/dist/agent-farm/commands/reset/index.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/index.js +488 -0
- package/dist/agent-farm/commands/reset/index.js.map +1 -0
- package/dist/agent-farm/commands/reset/receipt.d.ts +97 -0
- package/dist/agent-farm/commands/reset/receipt.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/receipt.js +149 -0
- package/dist/agent-farm/commands/reset/receipt.js.map +1 -0
- package/dist/agent-farm/commands/reset/reorient.d.ts +117 -0
- package/dist/agent-farm/commands/reset/reorient.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/reorient.js +313 -0
- package/dist/agent-farm/commands/reset/reorient.js.map +1 -0
- package/dist/agent-farm/commands/reset.d.ts +34 -0
- package/dist/agent-farm/commands/reset.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset.js +309 -0
- package/dist/agent-farm/commands/reset.js.map +1 -0
- package/dist/agent-farm/commands/send.d.ts.map +1 -1
- package/dist/agent-farm/commands/send.js +49 -8
- package/dist/agent-farm/commands/send.js.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.d.ts +105 -6
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js +289 -66
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +13 -1
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/commands/status.d.ts.map +1 -1
- package/dist/agent-farm/commands/status.js +80 -8
- package/dist/agent-farm/commands/status.js.map +1 -1
- package/dist/agent-farm/commands/tower.d.ts.map +1 -1
- package/dist/agent-farm/commands/tower.js +13 -0
- package/dist/agent-farm/commands/tower.js.map +1 -1
- package/dist/agent-farm/db/index.d.ts +1 -1
- package/dist/agent-farm/db/index.d.ts.map +1 -1
- package/dist/agent-farm/db/index.js +80 -1
- package/dist/agent-farm/db/index.js.map +1 -1
- package/dist/agent-farm/db/mailbox.d.ts +222 -0
- package/dist/agent-farm/db/mailbox.d.ts.map +1 -0
- package/dist/agent-farm/db/mailbox.js +304 -0
- package/dist/agent-farm/db/mailbox.js.map +1 -0
- package/dist/agent-farm/db/schema.d.ts +1 -1
- package/dist/agent-farm/db/schema.d.ts.map +1 -1
- package/dist/agent-farm/db/schema.js +35 -0
- package/dist/agent-farm/db/schema.js.map +1 -1
- package/dist/agent-farm/db/types.d.ts +45 -0
- package/dist/agent-farm/db/types.d.ts.map +1 -1
- package/dist/agent-farm/db/types.js.map +1 -1
- package/dist/agent-farm/lib/builder-lookup.d.ts +1 -1
- package/dist/agent-farm/lib/builder-lookup.js +2 -2
- package/dist/agent-farm/lib/builder-lookup.js.map +1 -1
- package/dist/agent-farm/lib/reconnect-backoff.d.ts +64 -0
- package/dist/agent-farm/lib/reconnect-backoff.d.ts.map +1 -0
- package/dist/agent-farm/lib/reconnect-backoff.js +57 -0
- package/dist/agent-farm/lib/reconnect-backoff.js.map +1 -0
- package/dist/agent-farm/lib/tower-client.d.ts +16 -6
- package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tower-client.js +37 -6
- package/dist/agent-farm/lib/tower-client.js.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.d.ts +69 -1
- package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.js +225 -30
- package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
- package/dist/agent-farm/servers/canvas-relay.d.ts +60 -0
- package/dist/agent-farm/servers/canvas-relay.d.ts.map +1 -0
- package/dist/agent-farm/servers/canvas-relay.js +376 -0
- package/dist/agent-farm/servers/canvas-relay.js.map +1 -0
- package/dist/agent-farm/servers/cron-delivery.d.ts +72 -0
- package/dist/agent-farm/servers/cron-delivery.d.ts.map +1 -0
- package/dist/agent-farm/servers/cron-delivery.js +80 -0
- package/dist/agent-farm/servers/cron-delivery.js.map +1 -0
- package/dist/agent-farm/servers/delayed-send.d.ts +85 -0
- package/dist/agent-farm/servers/delayed-send.d.ts.map +1 -0
- package/dist/agent-farm/servers/delayed-send.js +165 -0
- package/dist/agent-farm/servers/delayed-send.js.map +1 -0
- package/dist/agent-farm/servers/gate-profiles.d.ts +67 -0
- package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -0
- package/dist/agent-farm/servers/gate-profiles.js +113 -0
- package/dist/agent-farm/servers/gate-profiles.js.map +1 -0
- package/dist/agent-farm/servers/mailbox-delivery.d.ts +370 -0
- package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -0
- package/dist/agent-farm/servers/mailbox-delivery.js +617 -0
- package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -0
- package/dist/agent-farm/servers/mailbox-wiring.d.ts +125 -0
- package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -0
- package/dist/agent-farm/servers/mailbox-wiring.js +425 -0
- package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -0
- package/dist/agent-farm/servers/message-write.d.ts +53 -1
- package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
- package/dist/agent-farm/servers/message-write.js +63 -0
- package/dist/agent-farm/servers/message-write.js.map +1 -1
- package/dist/agent-farm/servers/overview.d.ts +19 -0
- package/dist/agent-farm/servers/overview.d.ts.map +1 -1
- package/dist/agent-farm/servers/overview.js +100 -4
- package/dist/agent-farm/servers/overview.js.map +1 -1
- package/dist/agent-farm/servers/render-gate.d.ts +141 -0
- package/dist/agent-farm/servers/render-gate.d.ts.map +1 -0
- package/dist/agent-farm/servers/render-gate.js +251 -0
- package/dist/agent-farm/servers/render-gate.js.map +1 -0
- package/dist/agent-farm/servers/session-submit.d.ts +90 -0
- package/dist/agent-farm/servers/session-submit.d.ts.map +1 -0
- package/dist/agent-farm/servers/session-submit.js +127 -0
- package/dist/agent-farm/servers/session-submit.js.map +1 -0
- package/dist/agent-farm/servers/tower-cron.d.ts +10 -7
- package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-cron.js +58 -53
- package/dist/agent-farm/servers/tower-cron.js.map +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts +14 -2
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-instances.js +78 -16
- package/dist/agent-farm/servers/tower-instances.js.map +1 -1
- package/dist/agent-farm/servers/tower-messages.d.ts +38 -1
- package/dist/agent-farm/servers/tower-messages.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-messages.js +106 -1
- package/dist/agent-farm/servers/tower-messages.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.d.ts +16 -4
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +826 -145
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/servers/tower-server.js +188 -34
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts +23 -2
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.js +134 -127
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
- package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-tunnel.js +63 -4
- package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
- package/dist/agent-farm/servers/tower-types.d.ts +2 -1
- package/dist/agent-farm/servers/tower-types.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-utils.d.ts +64 -1
- package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-utils.js +168 -1
- package/dist/agent-farm/servers/tower-utils.js.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.d.ts +6 -1
- package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.js +95 -57
- package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
- package/dist/agent-farm/servers/write-queue.d.ts +35 -0
- package/dist/agent-farm/servers/write-queue.d.ts.map +1 -0
- package/dist/agent-farm/servers/write-queue.js +56 -0
- package/dist/agent-farm/servers/write-queue.js.map +1 -0
- package/dist/agent-farm/types.d.ts +39 -0
- package/dist/agent-farm/types.d.ts.map +1 -1
- package/dist/agent-farm/utils/agent-names.d.ts +2 -2
- package/dist/agent-farm/utils/agent-names.d.ts.map +1 -1
- package/dist/agent-farm/utils/agent-names.js +3 -3
- package/dist/agent-farm/utils/agent-names.js.map +1 -1
- package/dist/agent-farm/utils/architect-name.d.ts +2 -2
- package/dist/agent-farm/utils/architect-name.d.ts.map +1 -1
- package/dist/agent-farm/utils/architect-name.js +3 -3
- package/dist/agent-farm/utils/architect-name.js.map +1 -1
- package/dist/agent-farm/utils/config.d.ts +13 -0
- package/dist/agent-farm/utils/config.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.js +33 -1
- package/dist/agent-farm/utils/config.js.map +1 -1
- package/dist/agent-farm/utils/harness.d.ts +103 -7
- package/dist/agent-farm/utils/harness.d.ts.map +1 -1
- package/dist/agent-farm/utils/harness.js +126 -19
- package/dist/agent-farm/utils/harness.js.map +1 -1
- package/dist/agent-farm/utils/message-format.d.ts +8 -0
- package/dist/agent-farm/utils/message-format.d.ts.map +1 -1
- package/dist/agent-farm/utils/message-format.js +20 -0
- package/dist/agent-farm/utils/message-format.js.map +1 -1
- package/dist/agent-farm/utils/server-utils.d.ts +80 -4
- package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
- package/dist/agent-farm/utils/server-utils.js +286 -5
- package/dist/agent-farm/utils/server-utils.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -32
- package/dist/cli.js.map +1 -1
- package/dist/commands/consult/cli-options.d.ts +34 -0
- package/dist/commands/consult/cli-options.d.ts.map +1 -0
- package/dist/commands/consult/cli-options.js +67 -0
- package/dist/commands/consult/cli-options.js.map +1 -0
- package/dist/commands/consult/index.d.ts +56 -2
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +272 -28
- package/dist/commands/consult/index.js.map +1 -1
- package/dist/commands/consult/metrics.d.ts +42 -0
- package/dist/commands/consult/metrics.d.ts.map +1 -1
- package/dist/commands/consult/metrics.js +129 -9
- package/dist/commands/consult/metrics.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +71 -19
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/porch/checks.d.ts +23 -0
- package/dist/commands/porch/checks.d.ts.map +1 -1
- package/dist/commands/porch/checks.js +60 -0
- package/dist/commands/porch/checks.js.map +1 -1
- package/dist/commands/porch/config.d.ts +20 -0
- package/dist/commands/porch/config.d.ts.map +1 -1
- package/dist/commands/porch/config.js +20 -0
- package/dist/commands/porch/config.js.map +1 -1
- package/dist/commands/porch/index.js +21 -28
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/next.d.ts.map +1 -1
- package/dist/commands/porch/next.js +2 -41
- package/dist/commands/porch/next.js.map +1 -1
- package/dist/lib/config.d.ts +69 -3
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +67 -3
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/consult-lanes.d.ts +149 -0
- package/dist/lib/consult-lanes.d.ts.map +1 -0
- package/dist/lib/consult-lanes.js +360 -0
- package/dist/lib/consult-lanes.js.map +1 -0
- package/dist/lib/forge-contracts.d.ts +9 -0
- package/dist/lib/forge-contracts.d.ts.map +1 -1
- package/dist/lib/forge-contracts.js.map +1 -1
- package/dist/lib/github.d.ts +15 -1
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +18 -1
- package/dist/lib/github.js.map +1 -1
- package/dist/lib/prompt-behavior-metrics.d.ts +67 -0
- package/dist/lib/prompt-behavior-metrics.d.ts.map +1 -0
- package/dist/lib/prompt-behavior-metrics.js +290 -0
- package/dist/lib/prompt-behavior-metrics.js.map +1 -0
- package/dist/lib/skeleton.d.ts +22 -1
- package/dist/lib/skeleton.d.ts.map +1 -1
- package/dist/lib/skeleton.js +120 -0
- package/dist/lib/skeleton.js.map +1 -1
- package/dist/lib/test-env.d.ts +74 -0
- package/dist/lib/test-env.d.ts.map +1 -0
- package/dist/lib/test-env.js +92 -0
- package/dist/lib/test-env.js.map +1 -0
- package/dist/terminal/attach-replay.d.ts +39 -0
- package/dist/terminal/attach-replay.d.ts.map +1 -0
- package/dist/terminal/attach-replay.js +76 -0
- package/dist/terminal/attach-replay.js.map +1 -0
- package/dist/terminal/pty-manager.d.ts +2 -0
- package/dist/terminal/pty-manager.d.ts.map +1 -1
- package/dist/terminal/pty-manager.js +51 -23
- package/dist/terminal/pty-manager.js.map +1 -1
- package/dist/terminal/pty-session.d.ts +201 -1
- package/dist/terminal/pty-session.d.ts.map +1 -1
- package/dist/terminal/pty-session.js +327 -46
- package/dist/terminal/pty-session.js.map +1 -1
- package/dist/terminal/ring-buffer.d.ts +39 -6
- package/dist/terminal/ring-buffer.d.ts.map +1 -1
- package/dist/terminal/ring-buffer.js +74 -6
- package/dist/terminal/ring-buffer.js.map +1 -1
- package/dist/terminal/session-manager.d.ts +53 -0
- package/dist/terminal/session-manager.d.ts.map +1 -1
- package/dist/terminal/session-manager.js +94 -9
- package/dist/terminal/session-manager.js.map +1 -1
- package/dist/terminal/session-screen.d.ts +116 -0
- package/dist/terminal/session-screen.d.ts.map +1 -0
- package/dist/terminal/session-screen.js +180 -0
- package/dist/terminal/session-screen.js.map +1 -0
- package/dist/terminal/shellper-main.js +2 -1
- package/dist/terminal/shellper-main.js.map +1 -1
- package/dist/terminal/shellper-process.d.ts +1 -1
- package/dist/terminal/shellper-process.d.ts.map +1 -1
- package/dist/terminal/shellper-process.js +17 -8
- package/dist/terminal/shellper-process.js.map +1 -1
- package/dist/terminal/shellper-replay-buffer.d.ts +69 -7
- package/dist/terminal/shellper-replay-buffer.d.ts.map +1 -1
- package/dist/terminal/shellper-replay-buffer.js +167 -31
- package/dist/terminal/shellper-replay-buffer.js.map +1 -1
- package/package.json +13 -8
- package/scripts/forge/gitea/pr-view.sh +4 -1
- package/scripts/forge/github/pr-view.sh +1 -1
- package/scripts/forge/gitlab/pr-view.sh +4 -1
- package/skeleton/.claude/skills/afx/SKILL.md +68 -1
- package/skeleton/.claude/skills/arch-init/SKILL.md +22 -9
- package/skeleton/.claude/skills/arch-save/SKILL.md +183 -0
- package/skeleton/.claude/skills/codev/SKILL.md +31 -0
- package/skeleton/.claude/skills/runnable-worktrees/SKILL.md +119 -0
- package/skeleton/.codex/skills/afx/SKILL.md +68 -1
- package/skeleton/.codex/skills/arch-init/SKILL.md +22 -9
- package/skeleton/.codex/skills/arch-save/SKILL.md +183 -0
- package/skeleton/.codex/skills/codev/SKILL.md +31 -0
- package/skeleton/.codex/skills/runnable-worktrees/SKILL.md +119 -0
- package/skeleton/protocols/air/builder-prompt.md +28 -47
- package/skeleton/protocols/air/consult-types/impl-review.md +17 -34
- package/skeleton/protocols/air/consult-types/pr-review.md +14 -37
- package/skeleton/protocols/air/prompts/implement.md +20 -73
- package/skeleton/protocols/air/prompts/pr.md +22 -54
- package/skeleton/protocols/air/protocol.md +40 -71
- package/skeleton/protocols/aspir/builder-prompt.md +29 -66
- package/skeleton/protocols/aspir/consult-types/impl-review.md +17 -44
- package/skeleton/protocols/aspir/consult-types/phase-review.md +17 -44
- package/skeleton/protocols/aspir/consult-types/plan-review.md +14 -38
- package/skeleton/protocols/aspir/consult-types/pr-review.md +13 -39
- package/skeleton/protocols/aspir/consult-types/spec-review.md +13 -33
- package/skeleton/protocols/aspir/prompts/implement.md +27 -196
- package/skeleton/protocols/aspir/prompts/plan.md +21 -85
- package/skeleton/protocols/aspir/prompts/review.md +29 -228
- package/skeleton/protocols/aspir/prompts/specify.md +25 -111
- package/skeleton/protocols/aspir/protocol.json +10 -0
- package/skeleton/protocols/aspir/protocol.md +36 -82
- package/skeleton/protocols/bugfix/builder-prompt.md +23 -45
- package/skeleton/protocols/bugfix/consult-types/impl-review.md +21 -45
- package/skeleton/protocols/bugfix/consult-types/pr-review.md +18 -52
- package/skeleton/protocols/bugfix/prompts/fix.md +16 -61
- package/skeleton/protocols/bugfix/prompts/investigate.md +18 -62
- package/skeleton/protocols/bugfix/prompts/pr.md +22 -57
- package/skeleton/protocols/bugfix/protocol.md +44 -50
- package/skeleton/protocols/experiment/builder-prompt.md +25 -58
- package/skeleton/protocols/experiment/protocol.md +22 -188
- package/skeleton/protocols/experiment/templates/notes.md +11 -71
- package/skeleton/protocols/maintain/builder-prompt.md +24 -45
- package/skeleton/protocols/maintain/consult-types/impl-review.md +17 -44
- package/skeleton/protocols/maintain/consult-types/pr-review.md +13 -39
- package/skeleton/protocols/maintain/prompts/maintain.md +1 -1
- package/skeleton/protocols/maintain/protocol.md +32 -266
- package/skeleton/protocols/maintain/templates/maintenance-run.md +11 -0
- package/skeleton/protocols/pir/builder-prompt.md +31 -64
- package/skeleton/protocols/pir/consult-types/impl-review.md +17 -50
- package/skeleton/protocols/pir/consult-types/pr-review.md +11 -40
- package/skeleton/protocols/pir/prompts/implement.md +2 -3
- package/skeleton/protocols/pir/prompts/plan.md +1 -4
- package/skeleton/protocols/pir/prompts/review.md +2 -2
- package/skeleton/protocols/pir/protocol.md +54 -177
- package/skeleton/protocols/research/builder-prompt.md +27 -58
- package/skeleton/protocols/research/protocol.md +28 -153
- package/skeleton/protocols/spike/builder-prompt.md +30 -48
- package/skeleton/protocols/spike/protocol.md +24 -107
- package/skeleton/protocols/spike/templates/findings.md +9 -39
- package/skeleton/protocols/spir/builder-prompt.md +33 -62
- package/skeleton/protocols/spir/consult-types/impl-review.md +17 -44
- package/skeleton/protocols/spir/consult-types/phase-review.md +17 -44
- package/skeleton/protocols/spir/consult-types/plan-review.md +14 -38
- package/skeleton/protocols/spir/consult-types/pr-review.md +13 -39
- package/skeleton/protocols/spir/consult-types/spec-review.md +13 -33
- package/skeleton/protocols/spir/prompts/implement.md +26 -195
- package/skeleton/protocols/spir/prompts/plan.md +20 -84
- package/skeleton/protocols/spir/prompts/review.md +28 -227
- package/skeleton/protocols/spir/prompts/specify.md +24 -110
- package/skeleton/protocols/spir/protocol.json +10 -0
- package/skeleton/protocols/spir/protocol.md +84 -633
- package/skeleton/protocols/spir/templates/plan.md +28 -147
- package/skeleton/protocols/spir/templates/review.md +21 -80
- package/skeleton/protocols/spir/templates/spec.md +24 -118
- package/skeleton/resources/commands/agent-farm.md +262 -0
- package/skeleton/resources/commands/consult.md +236 -8
- package/skeleton/resources/commands/overview.md +1 -0
- package/skeleton/roles/architect.md +67 -317
- package/skeleton/roles/builder.md +76 -191
- package/skeleton/templates/AGENTS.md +2 -0
- package/skeleton/templates/CLAUDE.md +2 -0
- package/templates/3d-viewer.html +32 -4
- package/templates/open.html +58 -12
- package/templates/tower.html +65 -9
- package/templates/vendor/three-3MFLoader.js +1478 -0
- package/templates/vendor/three-STLLoader.js +410 -0
- package/templates/vendor/three-TrackballControls.js +828 -0
- package/templates/vendor/three-fflate.module.js +2474 -0
- package/templates/vendor/three.module.js +53044 -0
- package/dashboard-dist/assets/index-BZ1x7x1X.js.map +0 -1
- package/dashboard-dist/assets/index-DB1KBSNE.css +0 -32
- package/dist/agent-farm/servers/send-buffer.d.ts +0 -59
- package/dist/agent-farm/servers/send-buffer.d.ts.map +0 -1
- package/dist/agent-farm/servers/send-buffer.js +0 -116
- package/dist/agent-farm/servers/send-buffer.js.map +0 -1
- package/skeleton/porch/prompts/defend.md +0 -108
- package/skeleton/porch/prompts/diagnose.md +0 -70
- package/skeleton/porch/prompts/evaluate.md +0 -132
- package/skeleton/porch/prompts/fix.md +0 -59
- package/skeleton/porch/prompts/implement.md +0 -88
- package/skeleton/porch/prompts/plan.md +0 -74
- package/skeleton/porch/prompts/pr.md +0 -84
- package/skeleton/porch/prompts/review.md +0 -249
- package/skeleton/porch/prompts/specify.md +0 -53
- package/skeleton/porch/prompts/test.md +0 -63
- package/skeleton/protocols/aspir/templates/plan.md +0 -184
- package/skeleton/protocols/aspir/templates/review.md +0 -120
- package/skeleton/protocols/aspir/templates/spec.md +0 -154
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reset receipt gate — invariant R2 (Spec 1273).
|
|
3
|
+
*
|
|
4
|
+
* `afx refresh` clears a builder's context, which is irreversible. The manual
|
|
5
|
+
* version of this flow guarded that step by eyeballing the state file ("ours was
|
|
6
|
+
* 203 lines"). This module replaces the eyeball with evidence: a state file is
|
|
7
|
+
* accepted only if it proves it is *this run's* save, is substantive, and has
|
|
8
|
+
* stopped growing.
|
|
9
|
+
*
|
|
10
|
+
* Freshness comes from a nonce written INSIDE the file, not from mtime. mtime
|
|
11
|
+
* was rejected deliberately: filesystem timestamp granularity and clock skew
|
|
12
|
+
* make it fragile, and it cannot distinguish "rewritten in response to this
|
|
13
|
+
* request" from "touched". A nonce the builder must reproduce can only appear
|
|
14
|
+
* in a file written after the request that carried it.
|
|
15
|
+
*
|
|
16
|
+
* Pure: all filesystem access arrives through injected ports, so every rejection
|
|
17
|
+
* path is testable without a real builder, a real worktree, or real time.
|
|
18
|
+
*/
|
|
19
|
+
import { randomBytes } from 'node:crypto';
|
|
20
|
+
import { join } from 'node:path';
|
|
21
|
+
import { DEFAULT_MIN_BYTES, DEFAULT_STABILITY_WINDOW_MS, STATE_FILE_NAME, } from './constants.js';
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Nonce
|
|
24
|
+
// ============================================================================
|
|
25
|
+
/**
|
|
26
|
+
* Generate a per-run nonce.
|
|
27
|
+
*
|
|
28
|
+
* Short enough that a builder reproduces it without transcription errors, long
|
|
29
|
+
* enough that a stale file from a previous reset cannot collide with it.
|
|
30
|
+
*/
|
|
31
|
+
export function generateNonce() {
|
|
32
|
+
return randomBytes(6).toString('hex');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The marker line the builder is asked to reproduce verbatim.
|
|
36
|
+
*
|
|
37
|
+
* An HTML comment so it is invisible in rendered markdown but trivially
|
|
38
|
+
* greppable, and harmless if the file is later read by a human.
|
|
39
|
+
*/
|
|
40
|
+
export function nonceMarker(nonce) {
|
|
41
|
+
return `<!-- codev-reset: ${nonce} -->`;
|
|
42
|
+
}
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// The save-state request
|
|
45
|
+
// ============================================================================
|
|
46
|
+
/**
|
|
47
|
+
* Build the message asking the builder to write its working state.
|
|
48
|
+
*
|
|
49
|
+
* The checklist is the quality bar. It cannot be enforced programmatically (see
|
|
50
|
+
* `verifyReceipt` — the gate is structural on purpose), so it has to be explicit
|
|
51
|
+
* enough that a builder writing in good faith produces something a cold reader
|
|
52
|
+
* can actually use.
|
|
53
|
+
*/
|
|
54
|
+
export function buildSaveRequest(nonce, statePath) {
|
|
55
|
+
return [
|
|
56
|
+
'CONTEXT REFRESH INCOMING — save your working state now.',
|
|
57
|
+
'',
|
|
58
|
+
`Write your complete working state to \`${statePath}\` (untracked; do not stage or commit it).`,
|
|
59
|
+
'',
|
|
60
|
+
`The file MUST begin with this exact line, reproduced character for character:`,
|
|
61
|
+
'',
|
|
62
|
+
nonceMarker(nonce),
|
|
63
|
+
'',
|
|
64
|
+
'Everything after that line is yours. Write it **for a cold reader** — a competent',
|
|
65
|
+
'agent who wakes up with your worktree, your branch, and no memory of this',
|
|
66
|
+
'conversation. Assume nothing carries over. Cover:',
|
|
67
|
+
'',
|
|
68
|
+
'1. **Role and mission** — what you are building and why.',
|
|
69
|
+
'2. **Position in the protocol** — phase, plan phase, what porch expects next.',
|
|
70
|
+
'3. **Receipts** — what is actually done and verified, with file paths and commit',
|
|
71
|
+
' hashes. Distinguish "written" from "verified"; a cold reader cannot tell.',
|
|
72
|
+
'4. **In-flight work** — anything started but not finished, and where it stands.',
|
|
73
|
+
'5. **Open questions** — decisions you deferred, and what they hinge on.',
|
|
74
|
+
'6. **Standing orders** — instructions from the architect you are still bound by,',
|
|
75
|
+
' including anything you were told NOT to do.',
|
|
76
|
+
'7. **Next concrete action** — the single thing to do first after the refresh.',
|
|
77
|
+
'',
|
|
78
|
+
'Do not summarise for brevity. A save that omits a standing order or a receipt',
|
|
79
|
+
'costs more than a long file does. When the file is written, stop and wait.',
|
|
80
|
+
].join('\n');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Evaluate the state file once.
|
|
84
|
+
*
|
|
85
|
+
* Checks run in escalating order so the reported reason is the *most specific*
|
|
86
|
+
* one true: existence, then freshness, then substance, then stability. A caller
|
|
87
|
+
* polls this and only proceeds on `accepted`.
|
|
88
|
+
*
|
|
89
|
+
* Stability requires agreement between two observations separated by at least
|
|
90
|
+
* `stabilityWindowMs`. Without the time gap, a builder mid-write would look
|
|
91
|
+
* stable simply because two reads landed between the same two `write()` calls.
|
|
92
|
+
*/
|
|
93
|
+
export function verifyReceipt(options) {
|
|
94
|
+
const { fs, statePath, nonce, minBytes = DEFAULT_MIN_BYTES, previous = null, msSincePrevious = 0, stabilityWindowMs = DEFAULT_STABILITY_WINDOW_MS, } = options;
|
|
95
|
+
const bytes = fs.sizeOf(statePath);
|
|
96
|
+
if (bytes === null)
|
|
97
|
+
return { status: 'missing' };
|
|
98
|
+
const content = fs.read(statePath);
|
|
99
|
+
if (content === null)
|
|
100
|
+
return { status: 'missing' };
|
|
101
|
+
// Match on the nonce token rather than the whole marker line: a builder that
|
|
102
|
+
// reproduces the nonce but alters the comment's spacing has still proved
|
|
103
|
+
// freshness, and failing that file would discard a real save over whitespace.
|
|
104
|
+
if (!content.includes(nonce))
|
|
105
|
+
return { status: 'wrong-nonce', bytes };
|
|
106
|
+
if (bytes < minBytes)
|
|
107
|
+
return { status: 'too-small', bytes };
|
|
108
|
+
const stable = previous !== null &&
|
|
109
|
+
previous.bytes === bytes &&
|
|
110
|
+
(previous.status === 'still-growing' || previous.status === 'accepted') &&
|
|
111
|
+
msSincePrevious >= stabilityWindowMs;
|
|
112
|
+
if (!stable)
|
|
113
|
+
return { status: 'still-growing', bytes };
|
|
114
|
+
return { status: 'accepted', bytes };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Human-readable explanation of a non-acceptance, for the abort message.
|
|
118
|
+
*
|
|
119
|
+
* Reset aborts loudly rather than clearing on a doubtful file, so the architect
|
|
120
|
+
* needs to know which gate failed — "timed out" alone would not distinguish a
|
|
121
|
+
* builder that never responded from one that wrote a stub.
|
|
122
|
+
*/
|
|
123
|
+
export function describeReceiptFailure(observation, statePath, minBytes = DEFAULT_MIN_BYTES) {
|
|
124
|
+
switch (observation.status) {
|
|
125
|
+
case 'missing':
|
|
126
|
+
return `${statePath} was never written. The builder may not have read the request (if it is wedged mid-turn, retry with --interrupt-first).`;
|
|
127
|
+
case 'wrong-nonce':
|
|
128
|
+
return `${statePath} exists (${observation.bytes} bytes) but does not carry this run's nonce — it is stale, left by an earlier refresh. Refusing to clear on superseded state.`;
|
|
129
|
+
case 'too-small':
|
|
130
|
+
return `${statePath} carries the nonce but is only ${observation.bytes} bytes (minimum ${minBytes}). That is a stub, not a working-state save. Override with --min-bytes if this is genuinely all there was.`;
|
|
131
|
+
case 'still-growing':
|
|
132
|
+
return `${statePath} was still being written when the wait expired. Refusing to clear on a partial save.`;
|
|
133
|
+
case 'accepted':
|
|
134
|
+
return `${statePath} was accepted.`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Absolute path of the state file for a worktree.
|
|
139
|
+
*
|
|
140
|
+
* Uses `path.join` rather than string concatenation: this path is handed to the
|
|
141
|
+
* builder verbatim in the save request, so on Windows a hand-built
|
|
142
|
+
* `C:\repo\wt\` + `/` + name would instruct the builder to write to a path that
|
|
143
|
+
* is not the one the gate then stats. `path.join` also collapses redundant
|
|
144
|
+
* separators, so a trailing slash on the worktree is harmless.
|
|
145
|
+
*/
|
|
146
|
+
export function stateFilePath(worktreePath, fileName = STATE_FILE_NAME) {
|
|
147
|
+
return join(worktreePath, fileName);
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=receipt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receipt.js","sourceRoot":"","sources":["../../../../src/agent-farm/commands/reset/receipt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAA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QAAQ,4GAA4G,CAAC;QAChN,KAAK,eAAe;YAClB,OAAO,GAAG,SAAS,sFAAsF,CAAC;QAC5G,KAAK,UAAU;YACb,OAAO,GAAG,SAAS,gBAAgB,CAAC;IACxC,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,YAAoB,EAAE,QAAQ,GAAG,eAAe;IAC5E,OAAO,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-orientation assembly — invariant R3 (Spec 1273).
|
|
3
|
+
*
|
|
4
|
+
* R3: the re-orientation always carries role frame, protocol, mode, project
|
|
5
|
+
* identity, worktree, branch, the state-file pointer, and — for porch lanes —
|
|
6
|
+
* the porch re-entry instruction. **There is no code path that emits a partial
|
|
7
|
+
* frame**: a missing input throws a named error rather than being omitted.
|
|
8
|
+
*
|
|
9
|
+
* That strictness is the point. A re-orientation missing its frame does not
|
|
10
|
+
* crash anything; it produces a builder with a fresh window that does not know
|
|
11
|
+
* it is a builder, what protocol governs it, or what porch expects next. The
|
|
12
|
+
* drift is silent and only shows up later as off-protocol work.
|
|
13
|
+
*
|
|
14
|
+
* Two parts, with a fixed division:
|
|
15
|
+
*
|
|
16
|
+
* - `inline` — compact, sent as a message. Satisfies R3 on its own. Kept small
|
|
17
|
+
* because the message channel writes ≥4-line payloads line-by-line at 10ms
|
|
18
|
+
* intervals and multi-line writes risk paste detection (#584).
|
|
19
|
+
* - `longForm` — written to `.builder-reorient.md`. This IS the spawn prompt:
|
|
20
|
+
* `buildSpawnPrompt` is the same `buildPromptFromTemplate` the fresh-launch
|
|
21
|
+
* path calls, so the builder gets the same protocol/phase framing a fresh
|
|
22
|
+
* spawn delivers — through a file rather than a prompt argument.
|
|
23
|
+
*
|
|
24
|
+
* The role's *full text* is deliberately not inlined. Under the Claude harness it
|
|
25
|
+
* is injected via `--append-system-prompt`, a process flag that `/clear` does not
|
|
26
|
+
* touch, so it survives the reset intact. R3 is satisfied by the identity block
|
|
27
|
+
* regardless, so the guarantee does not rest on that harness detail.
|
|
28
|
+
*/
|
|
29
|
+
import type { ResolvedBuilderContext } from './context.js';
|
|
30
|
+
import type { TemplateContext } from '../spawn-roles.js';
|
|
31
|
+
/**
|
|
32
|
+
* Renders the protocol's builder prompt. Injected so this module stays pure and
|
|
33
|
+
* so the orchestrator can wire it to the real `buildPromptFromTemplate`.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Renders the porch re-entry guidance. Wired in phase 6 to `buildResumeNotice`,
|
|
37
|
+
* so reset and spawn share **one** copy of that text.
|
|
38
|
+
*
|
|
39
|
+
* Reuse matters beyond tidiness: `buildResumeNotice` carries the fallback
|
|
40
|
+
* instruction for when porch reports "not found" (run `porch init`). A restated
|
|
41
|
+
* version drops it, and the two surfaces then drift apart with no test noticing.
|
|
42
|
+
*/
|
|
43
|
+
export type ResumeNoticePort = (projectId: string) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Typed against the REAL `TemplateContext` rather than a hand-rolled copy.
|
|
46
|
+
*
|
|
47
|
+
* The local copy was how issue metadata went missing: the port's shape drifted
|
|
48
|
+
* from what the templates actually consume, and nothing type-checked the gap.
|
|
49
|
+
* Importing the canonical type means any field added to `TemplateContext` is
|
|
50
|
+
* visible here, and a field this module fails to populate is a deliberate
|
|
51
|
+
* omission rather than an oversight nobody can see.
|
|
52
|
+
*/
|
|
53
|
+
export type SpawnPromptPort = (protocol: string, context: TemplateContext) => string;
|
|
54
|
+
/**
|
|
55
|
+
* Issue metadata for the spawn template.
|
|
56
|
+
*
|
|
57
|
+
* Every issue-driven protocol's builder prompt renders `{{issue.number}}`,
|
|
58
|
+
* `{{issue.title}}` and `{{issue.body}}` — and for BUGFIX and AIR the issue body
|
|
59
|
+
* *is* the spec. Omitting it would leave a reset builder on those lanes without
|
|
60
|
+
* the requirements it is implementing, which is the opposite of spawn-equivalent.
|
|
61
|
+
*
|
|
62
|
+
* Fetched by the orchestrator (I/O stays out of this module) and passed in.
|
|
63
|
+
*/
|
|
64
|
+
export interface IssuePayload {
|
|
65
|
+
number: number | string;
|
|
66
|
+
title: string;
|
|
67
|
+
body: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ReorientationPayload {
|
|
70
|
+
/** Compact frame delivered as a message. Satisfies R3 by itself. */
|
|
71
|
+
inline: string;
|
|
72
|
+
/** Full spawn-quality prompt, written to the worktree before the clear (R1). */
|
|
73
|
+
longForm: string;
|
|
74
|
+
/** Worktree-relative path the inline frame points at. */
|
|
75
|
+
longFormFileName: string;
|
|
76
|
+
}
|
|
77
|
+
/** Thrown when a required frame element cannot be produced. Never swallowed. */
|
|
78
|
+
export declare class ReorientationAssemblyError extends Error {
|
|
79
|
+
constructor(message: string);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Elements every inline frame must contain, as literal markers.
|
|
83
|
+
*
|
|
84
|
+
* Assembly validates the rendered payload against this list before returning, so
|
|
85
|
+
* adding an element here without producing it fails the tests rather than
|
|
86
|
+
* silently shipping a frame that is missing it.
|
|
87
|
+
*/
|
|
88
|
+
export declare const REQUIRED_INLINE_MARKERS: readonly ["CONTEXT REFRESH", "You are a Builder", ".builder-role.md", "Protocol:", "Mode:", "Worktree:", "Branch:", "State file:", "Full re-orientation:"];
|
|
89
|
+
/**
|
|
90
|
+
* Markers required *when the context supplies the corresponding fact*.
|
|
91
|
+
*
|
|
92
|
+
* Project identity and porch re-entry are not universally applicable — a task or
|
|
93
|
+
* shell builder has neither — but on a porch lane they are as load-bearing as
|
|
94
|
+
* the protocol name, and omitting them would leave a reset builder unable to
|
|
95
|
+
* find its own project. So they are required conditionally rather than left
|
|
96
|
+
* optional: "missing input is an abort, not an omission" applies to whatever the
|
|
97
|
+
* lane actually has.
|
|
98
|
+
*/
|
|
99
|
+
export declare function conditionalInlineMarkers(context: ResolvedBuilderContext): string[];
|
|
100
|
+
export interface AssembleOptions {
|
|
101
|
+
context: ResolvedBuilderContext;
|
|
102
|
+
/** Absolute path of the verified state file. */
|
|
103
|
+
statePath: string;
|
|
104
|
+
/** Architect addendum from --note / --file. */
|
|
105
|
+
addendum?: string;
|
|
106
|
+
buildSpawnPrompt: SpawnPromptPort;
|
|
107
|
+
/** Porch re-entry guidance; omitted only for non-porch lanes. */
|
|
108
|
+
buildResumeNotice?: ResumeNoticePort;
|
|
109
|
+
/**
|
|
110
|
+
* Issue metadata, when the orchestrator could fetch it. Absence on an
|
|
111
|
+
* issue-backed lane is surfaced in the long form with a recovery instruction
|
|
112
|
+
* rather than silently dropped — see `buildLongForm`.
|
|
113
|
+
*/
|
|
114
|
+
issue?: IssuePayload;
|
|
115
|
+
}
|
|
116
|
+
export declare function assembleReorientation(options: AssembleOptions): ReorientationPayload;
|
|
117
|
+
//# sourceMappingURL=reorient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorient.d.ts","sourceRoot":"","sources":["../../../../src/agent-farm/commands/reset/reorient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMzD;;;GAGG;AACH;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC;AAErF;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,gFAAgF;AAChF,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,4JAY1B,CAAC;AAEX;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,EAAE,CAOlF;AAMD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,sBAAsB,CAAC;IAChC,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,eAAe,CAAC;IAClC,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IACrC;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,oBAAoB,CAoCpF"}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-orientation assembly — invariant R3 (Spec 1273).
|
|
3
|
+
*
|
|
4
|
+
* R3: the re-orientation always carries role frame, protocol, mode, project
|
|
5
|
+
* identity, worktree, branch, the state-file pointer, and — for porch lanes —
|
|
6
|
+
* the porch re-entry instruction. **There is no code path that emits a partial
|
|
7
|
+
* frame**: a missing input throws a named error rather than being omitted.
|
|
8
|
+
*
|
|
9
|
+
* That strictness is the point. A re-orientation missing its frame does not
|
|
10
|
+
* crash anything; it produces a builder with a fresh window that does not know
|
|
11
|
+
* it is a builder, what protocol governs it, or what porch expects next. The
|
|
12
|
+
* drift is silent and only shows up later as off-protocol work.
|
|
13
|
+
*
|
|
14
|
+
* Two parts, with a fixed division:
|
|
15
|
+
*
|
|
16
|
+
* - `inline` — compact, sent as a message. Satisfies R3 on its own. Kept small
|
|
17
|
+
* because the message channel writes ≥4-line payloads line-by-line at 10ms
|
|
18
|
+
* intervals and multi-line writes risk paste detection (#584).
|
|
19
|
+
* - `longForm` — written to `.builder-reorient.md`. This IS the spawn prompt:
|
|
20
|
+
* `buildSpawnPrompt` is the same `buildPromptFromTemplate` the fresh-launch
|
|
21
|
+
* path calls, so the builder gets the same protocol/phase framing a fresh
|
|
22
|
+
* spawn delivers — through a file rather than a prompt argument.
|
|
23
|
+
*
|
|
24
|
+
* The role's *full text* is deliberately not inlined. Under the Claude harness it
|
|
25
|
+
* is injected via `--append-system-prompt`, a process flag that `/clear` does not
|
|
26
|
+
* touch, so it survives the reset intact. R3 is satisfied by the identity block
|
|
27
|
+
* regardless, so the guarantee does not rest on that harness detail.
|
|
28
|
+
*/
|
|
29
|
+
import { REORIENT_FILE_NAME } from './constants.js';
|
|
30
|
+
/** Thrown when a required frame element cannot be produced. Never swallowed. */
|
|
31
|
+
export class ReorientationAssemblyError extends Error {
|
|
32
|
+
constructor(message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = 'ReorientationAssemblyError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Elements every inline frame must contain, as literal markers.
|
|
39
|
+
*
|
|
40
|
+
* Assembly validates the rendered payload against this list before returning, so
|
|
41
|
+
* adding an element here without producing it fails the tests rather than
|
|
42
|
+
* silently shipping a frame that is missing it.
|
|
43
|
+
*/
|
|
44
|
+
export const REQUIRED_INLINE_MARKERS = [
|
|
45
|
+
'CONTEXT REFRESH',
|
|
46
|
+
'You are a Builder',
|
|
47
|
+
// The spec requires the identity block to name WHICH role document governs
|
|
48
|
+
// the builder, not merely that one does.
|
|
49
|
+
'.builder-role.md',
|
|
50
|
+
'Protocol:',
|
|
51
|
+
'Mode:',
|
|
52
|
+
'Worktree:',
|
|
53
|
+
'Branch:',
|
|
54
|
+
'State file:',
|
|
55
|
+
'Full re-orientation:',
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Markers required *when the context supplies the corresponding fact*.
|
|
59
|
+
*
|
|
60
|
+
* Project identity and porch re-entry are not universally applicable — a task or
|
|
61
|
+
* shell builder has neither — but on a porch lane they are as load-bearing as
|
|
62
|
+
* the protocol name, and omitting them would leave a reset builder unable to
|
|
63
|
+
* find its own project. So they are required conditionally rather than left
|
|
64
|
+
* optional: "missing input is an abort, not an omission" applies to whatever the
|
|
65
|
+
* lane actually has.
|
|
66
|
+
*/
|
|
67
|
+
export function conditionalInlineMarkers(context) {
|
|
68
|
+
const markers = [];
|
|
69
|
+
// Project ID is required, not just the directory stem: porch commands take the
|
|
70
|
+
// id, and a reset builder should not have to parse it out of a slug.
|
|
71
|
+
if (context.porch)
|
|
72
|
+
markers.push('Project ID:', 'Project:', 'porch next');
|
|
73
|
+
if (context.issueNumber)
|
|
74
|
+
markers.push('Issue:');
|
|
75
|
+
return markers;
|
|
76
|
+
}
|
|
77
|
+
export function assembleReorientation(options) {
|
|
78
|
+
const { context, statePath, addendum, buildSpawnPrompt } = options;
|
|
79
|
+
requireField(context.builderId, 'builderId');
|
|
80
|
+
requireField(context.worktree, 'worktree');
|
|
81
|
+
requireField(context.branch, 'branch');
|
|
82
|
+
requireField(context.protocol, 'protocol');
|
|
83
|
+
requireField(context.mode, 'mode');
|
|
84
|
+
requireField(statePath, 'statePath');
|
|
85
|
+
// Porch identity is checked field by field, not just for the presence of the
|
|
86
|
+
// `porch` object. The marker validation below matches on LABELS, so an empty
|
|
87
|
+
// projectId still renders `Project ID:` and satisfies it — a frame that looks
|
|
88
|
+
// complete and tells the builder nothing. Presence of a label is not presence
|
|
89
|
+
// of a value.
|
|
90
|
+
if (context.porch) {
|
|
91
|
+
requireField(context.porch.projectId, 'porch.projectId');
|
|
92
|
+
requireField(context.porch.projectName, 'porch.projectName');
|
|
93
|
+
requireField(context.porch.phase, 'porch.phase');
|
|
94
|
+
}
|
|
95
|
+
const longForm = buildLongForm(options);
|
|
96
|
+
const inline = buildInline(options);
|
|
97
|
+
// R3 is enforced here, not asserted in a comment: a frame that lost an element
|
|
98
|
+
// during a refactor fails at assembly rather than reaching a live builder.
|
|
99
|
+
const expected = [...REQUIRED_INLINE_MARKERS, ...conditionalInlineMarkers(context)];
|
|
100
|
+
const missing = expected.filter(marker => !inline.includes(marker));
|
|
101
|
+
if (missing.length > 0) {
|
|
102
|
+
throw new ReorientationAssemblyError(`Assembled re-orientation is missing required element(s): ${missing.join(', ')}. ` +
|
|
103
|
+
`Refusing to clear a builder's context without a complete frame (R3).`);
|
|
104
|
+
}
|
|
105
|
+
return { inline, longForm, longFormFileName: REORIENT_FILE_NAME };
|
|
106
|
+
}
|
|
107
|
+
function requireField(value, name) {
|
|
108
|
+
if (value === undefined || value === null || value === '') {
|
|
109
|
+
throw new ReorientationAssemblyError(`Cannot assemble a re-orientation without '${name}'. ` +
|
|
110
|
+
`Refusing to emit a partial frame — a builder re-oriented without it would drift silently (R3).`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// Inline frame
|
|
115
|
+
// ============================================================================
|
|
116
|
+
function buildInline(options) {
|
|
117
|
+
const { context: c, statePath, addendum } = options;
|
|
118
|
+
const lines = [
|
|
119
|
+
'## CONTEXT REFRESH — re-orientation',
|
|
120
|
+
'',
|
|
121
|
+
'Your conversation history was cleared. Everything you knew that was not written',
|
|
122
|
+
'down is gone. Do not try to recall it; read the files below instead.',
|
|
123
|
+
'',
|
|
124
|
+
// Name the role document rather than gesturing at it: a builder with no
|
|
125
|
+
// conversation history cannot resolve "your role document" to a file, and
|
|
126
|
+
// the spec requires the identity block to say WHICH document governs it.
|
|
127
|
+
// `.builder-role.md` is the copy the harness actually injected at launch
|
|
128
|
+
// (written on spawn, and refreshed on resume since #1267 — the clean-exit
|
|
129
|
+
// relaunch injects it too).
|
|
130
|
+
'You are a Builder. Your role document is `.builder-role.md` at the worktree root',
|
|
131
|
+
'(the builder role, injected into your system prompt at spawn and still in effect).',
|
|
132
|
+
'',
|
|
133
|
+
`- Protocol: ${c.protocol.toUpperCase()}`,
|
|
134
|
+
`- Mode: ${c.mode.toUpperCase()}`,
|
|
135
|
+
];
|
|
136
|
+
if (c.issueNumber)
|
|
137
|
+
lines.push(`- Issue: #${c.issueNumber}`);
|
|
138
|
+
if (c.porch) {
|
|
139
|
+
// Project ID is stated explicitly, not left implicit in the directory stem:
|
|
140
|
+
// `porch status`/`porch next` take the id, and a reset builder should not
|
|
141
|
+
// have to parse it back out of a slug to address its own project.
|
|
142
|
+
lines.push(`- Project ID: ${c.porch.projectId}`);
|
|
143
|
+
lines.push(`- Project: ${c.porch.projectName} (phase: ${c.porch.phase}${c.porch.currentPlanPhase ? `, plan phase: ${c.porch.currentPlanPhase}` : ''})`);
|
|
144
|
+
}
|
|
145
|
+
if (c.specPath)
|
|
146
|
+
lines.push(`- Spec: ${c.specPath}`);
|
|
147
|
+
if (c.planPath)
|
|
148
|
+
lines.push(`- Plan: ${c.planPath}`);
|
|
149
|
+
lines.push(`- Worktree: ${c.worktree}`, `- Branch: ${c.branch}`, '', '### Do this now, in order', '', `1. State file: read \`${statePath}\` **in full** before acting. It is the working`, ' state your previous session wrote for exactly this moment — receipts, open', ' questions, standing orders. Untracked: do not stage or commit it.', `2. Full re-orientation: read \`${REORIENT_FILE_NAME}\` at the worktree root for the`, ' complete protocol framing.');
|
|
150
|
+
if (c.porch) {
|
|
151
|
+
// Short pointer inline; the full guidance — including the `porch init`
|
|
152
|
+
// fallback — is carried verbatim in the long form from buildResumeNotice,
|
|
153
|
+
// so there is exactly one copy of that text in the codebase.
|
|
154
|
+
lines.push(`3. Run \`porch next\` to confirm where the protocol actually stands (full re-entry`, ` guidance is in ${REORIENT_FILE_NAME}), and continue.`);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
lines.push('3. Continue from the next action named in the state file.');
|
|
158
|
+
}
|
|
159
|
+
if (addendum && addendum.trim() !== '') {
|
|
160
|
+
lines.push('', '### From the architect (this post-dates your save)', '', addendum.trim());
|
|
161
|
+
}
|
|
162
|
+
return lines.join('\n');
|
|
163
|
+
}
|
|
164
|
+
// ============================================================================
|
|
165
|
+
// Long form
|
|
166
|
+
// ============================================================================
|
|
167
|
+
/**
|
|
168
|
+
* Reconstruct `input_description` (and `task_text`) the way the matching spawn
|
|
169
|
+
* entry point would.
|
|
170
|
+
*
|
|
171
|
+
* `{{input_description}}` is the FIRST line of every protocol's builder prompt
|
|
172
|
+
* (`bugfix/air/aspir/spir/builder-prompt.md:3`), so getting it wrong mis-frames
|
|
173
|
+
* the whole document — the reset builder is told it is doing something other
|
|
174
|
+
* than what it is doing. Spawn produces four distinct values, one per entry
|
|
175
|
+
* point, and this mirrors all four rather than approximating with two:
|
|
176
|
+
*
|
|
177
|
+
* - spec-driven → `spawn.ts:455` (also the lane that attaches an issue)
|
|
178
|
+
* - ad-hoc task → `spawn.ts:543` (carries `task_text` as well)
|
|
179
|
+
* - issue-driven → `spawn.ts:837` (BUGFIX/AIR; the issue body IS the spec)
|
|
180
|
+
* - protocol-only → `spawn.ts:607`
|
|
181
|
+
*
|
|
182
|
+
* **Order is load-bearing, and not the obvious one.** A `--task` builder gets a
|
|
183
|
+
* porch project keyed on its own builder id, so `issueNumber` is populated for
|
|
184
|
+
* it too (`context.ts` falls back to `porch.projectId`). Testing `issueNumber`
|
|
185
|
+
* before `taskText` would therefore route every task builder down the
|
|
186
|
+
* issue-driven branch and announce a GitHub issue that does not exist. Spec wins
|
|
187
|
+
* over both because the spec-driven spawn path sets its own description even
|
|
188
|
+
* when an issue is attached.
|
|
189
|
+
*/
|
|
190
|
+
function buildInputDescription(c) {
|
|
191
|
+
if (c.specPath)
|
|
192
|
+
return { input_description: `the feature specified in ${c.specPath}` };
|
|
193
|
+
if (c.taskText)
|
|
194
|
+
return { input_description: 'an ad-hoc task', task_text: c.taskText };
|
|
195
|
+
if (c.issueNumber)
|
|
196
|
+
return { input_description: `work for GitHub Issue #${c.issueNumber}` };
|
|
197
|
+
return { input_description: `running the ${c.protocol.toUpperCase()} protocol` };
|
|
198
|
+
}
|
|
199
|
+
function buildLongForm(options) {
|
|
200
|
+
const { context: c, statePath, addendum, buildSpawnPrompt, buildResumeNotice, issue } = options;
|
|
201
|
+
let spawnPrompt;
|
|
202
|
+
// The bare `--task` lane has NO protocol template, and asking for one is not a
|
|
203
|
+
// near-miss — it is a category error. `afx spawn --task` without `--protocol`
|
|
204
|
+
// takes spawn.ts's `else` branch and builds the prompt directly from the task
|
|
205
|
+
// text (`spawn.ts:551`); there is no `protocols/task/builder-prompt.md` to
|
|
206
|
+
// render, so the live e2e died on
|
|
207
|
+
// `Protocol "task" has no builder-prompt.md`.
|
|
208
|
+
//
|
|
209
|
+
// Identified by a POSITIVE fact rather than by catching that error, and
|
|
210
|
+
// rather than by `taskText && !porch`: `initPorchInWorktree` is non-fatal, so
|
|
211
|
+
// a `--task --protocol X` builder whose porch init FAILED also has task text
|
|
212
|
+
// and no porch. `isBareTask` is established from the prompt file itself (see
|
|
213
|
+
// context.ts), which carries the rendered template for that lane regardless.
|
|
214
|
+
if (c.isBareTask) {
|
|
215
|
+
const longFormTask = [
|
|
216
|
+
'You are a Builder. Read codev/roles/builder.md for your full role definition.',
|
|
217
|
+
'',
|
|
218
|
+
'# Task',
|
|
219
|
+
'',
|
|
220
|
+
c.taskText,
|
|
221
|
+
].join('\n');
|
|
222
|
+
return assembleLongFormDocument(options, longFormTask);
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
spawnPrompt = buildSpawnPrompt(c.protocol, {
|
|
226
|
+
protocol_name: c.protocol.toUpperCase(),
|
|
227
|
+
mode: c.mode,
|
|
228
|
+
mode_soft: c.mode === 'soft',
|
|
229
|
+
mode_strict: c.mode === 'strict',
|
|
230
|
+
project_id: c.porch?.projectId,
|
|
231
|
+
...buildInputDescription(c),
|
|
232
|
+
...(c.specPath && c.specName ? { spec: { path: c.specPath, name: c.specName } } : {}),
|
|
233
|
+
...(c.planPath && c.specName ? { plan: { path: c.planPath, name: c.specName } } : {}),
|
|
234
|
+
// Issue-driven protocols render {{issue.*}} in their builder prompt, and
|
|
235
|
+
// on BUGFIX/AIR the body IS the spec. Forwarding it is what makes the long
|
|
236
|
+
// form genuinely spawn-equivalent rather than spawn-shaped.
|
|
237
|
+
...(issue ? { issue: { number: issue.number, title: issue.title, body: issue.body } } : {}),
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
catch (err) {
|
|
241
|
+
// Abort rather than degrade: a long form without the protocol framing is the
|
|
242
|
+
// partial frame R3 forbids, and it would be delivered to a builder with no
|
|
243
|
+
// context left to notice the gap.
|
|
244
|
+
throw new ReorientationAssemblyError(`Could not render the ${c.protocol} builder prompt for the long-form re-orientation: ` +
|
|
245
|
+
`${err instanceof Error ? err.message : String(err)}. Refusing to clear without it (R1/R3).`);
|
|
246
|
+
}
|
|
247
|
+
return assembleLongFormDocument(options, spawnPrompt);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Wrap a rendered prompt body in the reset header, state-file pointer, addendum
|
|
251
|
+
* and porch re-entry.
|
|
252
|
+
*
|
|
253
|
+
* Shared by both lanes so the framing cannot drift between them: the bare
|
|
254
|
+
* `--task` lane supplies spawn's task prompt, every other lane supplies the
|
|
255
|
+
* rendered protocol template. Only the BODY differs — everything R3 requires is
|
|
256
|
+
* assembled here, once.
|
|
257
|
+
*/
|
|
258
|
+
function assembleLongFormDocument(options, promptBody) {
|
|
259
|
+
const { context: c, statePath, addendum, buildResumeNotice, issue } = options;
|
|
260
|
+
const header = [
|
|
261
|
+
'<!-- Written by `afx refresh` (Spec 1273). Untracked; regenerated on every refresh. -->',
|
|
262
|
+
'',
|
|
263
|
+
'# Re-orientation after context refresh',
|
|
264
|
+
'',
|
|
265
|
+
`Your conversation history was cleared deliberately, to give you a fresh window`,
|
|
266
|
+
`without losing your working state. This file restores the protocol framing a`,
|
|
267
|
+
`fresh spawn would have given you; \`${statePath}\` holds what your previous`,
|
|
268
|
+
`session actually knew.`,
|
|
269
|
+
'',
|
|
270
|
+
'## Read order',
|
|
271
|
+
'',
|
|
272
|
+
`1. \`${statePath}\` — your working state (receipts, open questions, standing orders).`,
|
|
273
|
+
'2. The rest of this file — protocol framing, identical to a fresh spawn prompt.',
|
|
274
|
+
c.porch ? '3. `porch next` — the authoritative protocol state.' : '3. The next action named in your state file.',
|
|
275
|
+
'',
|
|
276
|
+
'## Current position',
|
|
277
|
+
'',
|
|
278
|
+
`- Builder: ${c.builderId}`,
|
|
279
|
+
`- Protocol: ${c.protocol.toUpperCase()} (${c.mode})`,
|
|
280
|
+
`- Worktree: ${c.worktree}`,
|
|
281
|
+
`- Branch: ${c.branch}`,
|
|
282
|
+
];
|
|
283
|
+
if (c.porch) {
|
|
284
|
+
header.push(`- Porch project ID: ${c.porch.projectId}`, `- Porch project: ${c.porch.projectName}`, `- Phase: ${c.porch.phase}${c.porch.currentPlanPhase ? ` (plan phase: ${c.porch.currentPlanPhase})` : ''}`);
|
|
285
|
+
}
|
|
286
|
+
if (c.issueNumber)
|
|
287
|
+
header.push(`- Issue: #${c.issueNumber}`);
|
|
288
|
+
header.push('', `Protocol and mode were resolved from ${c.protocolSource} and ${c.modeSource} respectively.`);
|
|
289
|
+
// An issue-backed lane whose issue could not be fetched keeps a VISIBLE gap
|
|
290
|
+
// with a recovery instruction, rather than a silently shorter prompt. On
|
|
291
|
+
// BUGFIX/AIR the issue body is the spec, so a reset builder must be told the
|
|
292
|
+
// requirements are missing instead of inferring them from what remains.
|
|
293
|
+
if (c.issueNumber && !issue) {
|
|
294
|
+
header.push('', `> **Issue #${c.issueNumber} could not be fetched when this file was written**, so the`, `> protocol framing below does not include its title or body. On issue-driven`, `> protocols that body carries the requirements. Read it before continuing:`, `> \`gh issue view ${c.issueNumber}\`.`);
|
|
295
|
+
}
|
|
296
|
+
if (addendum && addendum.trim() !== '') {
|
|
297
|
+
header.push('', '## From the architect (post-dates your save)', '', addendum.trim());
|
|
298
|
+
}
|
|
299
|
+
// Porch re-entry, verbatim from the single source shared with spawn. Reset must
|
|
300
|
+
// not restate it: buildResumeNotice carries the `porch init` fallback for when
|
|
301
|
+
// porch reports "not found", and a restated copy silently drops it.
|
|
302
|
+
if (c.porch) {
|
|
303
|
+
if (!buildResumeNotice) {
|
|
304
|
+
throw new ReorientationAssemblyError(`Cannot assemble a re-orientation for porch project '${c.porch.projectName}' without the ` +
|
|
305
|
+
`porch re-entry notice. Refusing to emit a frame that leaves a porch-driven builder ` +
|
|
306
|
+
`without its re-entry instruction (R3).`);
|
|
307
|
+
}
|
|
308
|
+
header.push('', '---', '', buildResumeNotice(c.porch.projectId).trim());
|
|
309
|
+
}
|
|
310
|
+
header.push('', '---', '', '## Protocol framing (as delivered at spawn)', '');
|
|
311
|
+
return `${header.join('\n')}\n${promptBody}\n`;
|
|
312
|
+
}
|
|
313
|
+
//# sourceMappingURL=reorient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorient.js","sourceRoot":"","sources":["../../../../src/agent-farm/commands/reset/reorient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AA8DpD,gFAAgF;AAChF,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC3C,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,iBAAiB;IACjB,mBAAmB;IACnB,2EAA2E;IAC3E,yCAAyC;IACzC,kBAAkB;IAClB,WAAW;IACX,OAAO;IACP,WAAW;IACX,SAAS;IACT,aAAa;IACb,sBAAsB;CACd,CAAC;AAEX;;;;;;;;;GASG;AACH,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qF;gBACrF,wCAAwC,CAC3C,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,6CAA6C,EAAE,EAAE,CAAC,CAAC;IAE9E,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `afx refresh` — the command surface over the refresh state machine (Spec 1273).
|
|
3
|
+
*
|
|
4
|
+
* This file is deliberately thin. It does three things and nothing else:
|
|
5
|
+
* resolves the target, binds REAL implementations to the orchestrator's ports,
|
|
6
|
+
* and prints the report. Every decision, every ordering rule and every refusal
|
|
7
|
+
* lives in `reset/index.ts`, where it is testable without Tower, a PTY, or a
|
|
8
|
+
* live builder.
|
|
9
|
+
*
|
|
10
|
+
* That split is the point. The dangerous part of a refresh is the ordering, and
|
|
11
|
+
* ordering is only provable if the thing that decides it has no I/O in it.
|
|
12
|
+
*
|
|
13
|
+
* Addressing, workspace detection and sender identity are reused verbatim from
|
|
14
|
+
* `afx send` — there is exactly one address resolver (the same rule `afx
|
|
15
|
+
* interrupt` follows).
|
|
16
|
+
*/
|
|
17
|
+
import type { ResetOptions } from '../types.js';
|
|
18
|
+
/**
|
|
19
|
+
* The one-line notice `afx reset` prints before doing the work (#1489).
|
|
20
|
+
*
|
|
21
|
+
* Exported so the deprecation is pinned by a test rather than by whoever
|
|
22
|
+
* happens to read the CLI wiring: an alias that stops announcing itself is an
|
|
23
|
+
* alias nobody migrates off, and this one is scheduled for removal.
|
|
24
|
+
*/
|
|
25
|
+
export declare const RESET_ALIAS_NOTICE = "afx reset has been renamed to afx refresh; this alias will be removed in a future release";
|
|
26
|
+
/**
|
|
27
|
+
* Announce the deprecated spelling on **stderr**.
|
|
28
|
+
*
|
|
29
|
+
* stdout carries the run report, which is read by humans and occasionally piped;
|
|
30
|
+
* a deprecation line does not belong in it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function warnResetAlias(): void;
|
|
33
|
+
export declare function refresh(options: ResetOptions): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=reset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/reset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAuBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,8FAC8D,CAAC;AAE9F;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuHlE"}
|