elanous 0.2.17 → 0.2.19
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/apps/pwa/out/404/index.html +1 -1
- package/apps/pwa/out/404.html +1 -1
- package/apps/pwa/out/_next/static/J5H7BvqgSI8DUjtRRcA_S/_buildManifest.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1105-c473ed46272fba79.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1157-cba0e8553d35a980.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{726.83532d69452ee24b.js → 1470.98a6ab61ccb4131c.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/171-23a877ed11720de9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/216-5acd01cbde4acda7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2330-c2f07246c8788af1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2336-e830c777eb6bce04.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{9247-269e4464cc4b491c.js → 2375-e061bb24cd2b5cde.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/2415.ed6428ff334c7ce2.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{211-9c9090c59e2c5907.js → 2977-e38442e86289f1d3.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{f6b7c9ba.64a895b8b2fedbdc.js → 2ea96958.e8c7e112de50b067.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/3094.67339318c7f72a3a.js +2 -0
- package/apps/pwa/out/_next/static/chunks/338-ceb956612dcfaa86.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3395-835e4ceaa6335ba4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3403.4bc97b4066945a94.js +5 -0
- package/apps/pwa/out/_next/static/chunks/3441-be82e3595aef3a20.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3689-89905039bf3e7257.js +1 -0
- package/apps/pwa/out/_next/static/chunks/371-4ad6af55dad02ced.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3822-6f268bc26c6a84ac.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4114-3e63117452378807.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{1268.0840ff91e083fcbd.js → 4323.c5dfb6f503304775.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/4457-d7df81c90f9d0268.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4551-77dadae76f6cbace.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{6110.1297d4093fdfbb0d.js → 4847.56f5bc454fbcc827.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/4978.6fd93b974441e87f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5012-f746f6549b869f91.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5609-012bb3557211f07e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5791-bb82743fa6299562.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{7327-2d69fb321ba73389.js → 6062-73e68343a9814f6a.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/62-5bfed1e23790b745.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6320-9bc8561fde416e07.js +1 -0
- package/apps/pwa/out/_next/static/chunks/649-ca96d1c5d09e02b8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6725-68ab7cc0b1faf00d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6726-85a7db59b288c53f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6735-33267c4630d0d963.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6998-a654fe5c58271600.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7633-141682015873beb6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{935.4ddaa99fc1d1126c.js → 7647.2fcd30d894d5ee30.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/7673-2eda1507d38dadb8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7990-e12efba616f46e03.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{f6231284-45726550aba08fca.js → 8046cadf-211ca3c0e00f2b72.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/8067-143791231c99bd02.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8142-744998d65d7bb17e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8430-a10cfba8ef282d4e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8870-9614a213b990b10b.js +25 -0
- package/apps/pwa/out/_next/static/chunks/920-f7dceb78f1c585ef.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9454-12c2f30dea62291c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/976-4a9b4ebdca7c739a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9989-15cdf568bafa9fc8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/ae787e4c-e5b1ef00b2dbceca.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/_not-found/page-859cea1570b6227a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-deef5ee191830f14.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/autopilot/page-b193da485f9a14b2.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/board/page-b6e1a79df0e214f4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-e84df4d907f703c7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/bots/page-a5fb9a5db89ae4ea.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-1499f481d7fc52d6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/chat/page-c7cf753aeb648790.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/consult/page-4118469e514e10fd.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/control/page-e968f7630654332a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/decisions/page-505915052f947022.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-c2f962fb4a3b06c6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/editor/page-7b5ed0bd8a589ec4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/exec/page-cf8193250dd42dd4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/field/page-cf3f5dfa35dea8e9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/healthz/route-859cea1570b6227a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/inside/page-5b29d9b06ceadade.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/intake/page-a15e7fcc283e9ca7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/layout-d2915e7b70ff3d0e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/live/page-b70cd005d9169e25.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/loops/page-2595f0eba29f57e1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/market/page-c776322454156e36.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-77bbd17f4435aa10.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/morning/page-049689e611ecc936.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/not-found-85954a4fb09c44eb.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-e773e552e1068ee6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-5633c4bfa7684b4a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/release/page-d829b92bd01b4994.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-061c317fc771becf.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/outputs/page-3a45ece8865ed4b6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/page-0be990618c0d56bd.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-bfea4865dc244b73.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/scheduler/page-0d6ba8e337741484.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/sessions/page-76a88b55d816482e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-bba1542df59f61ce.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/settings/page-4185c95689bb372e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/done/page-b699e1a8d5d34b8b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/layout-859cea1570b6227a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/page-c225e338c31bf274.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/share/page-449353f70507ca1f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/showroom/page-90b889714102476d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/tasks/page-f1ee7fbeb7f96ddc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/term/page-d59a95e1434dfaa0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/today/page-71491a23414d1a47.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/trace/page-de7112bdb65fa4fe.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/vault/page-feb4d0d88079660d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-f17d887b40dd6b1d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workflows/page-8da77be2192bcd5d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-72c3b9a5e9582b29.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-c3afe4c8d0c48c39.js +1 -0
- package/apps/pwa/out/_next/static/chunks/framework-ea806bb57f2b8923.js +1 -0
- package/apps/pwa/out/_next/static/chunks/main-8d2302399c2c8f87.js +1 -0
- package/apps/pwa/out/_next/static/chunks/main-app-b9308f2d8a931531.js +1 -0
- package/apps/pwa/out/_next/static/chunks/pages/_app-b10928c60f0b8488.js +1 -0
- package/apps/pwa/out/_next/static/chunks/pages/_error-689039227d443fab.js +1 -0
- package/apps/pwa/out/_next/static/chunks/webpack-6f35f9d892fa630b.js +1 -0
- package/apps/pwa/out/_next/static/css/{e99e3cff94ced78a.css → 599369d853c61df7.css} +1 -1
- package/apps/pwa/out/_next/static/css/85f53c6f35d11382.css +1 -0
- package/apps/pwa/out/_next/static/css/d3427996da11e480.css +1 -0
- package/apps/pwa/out/approvals/index.html +1 -1
- package/apps/pwa/out/approvals/index.txt +23 -23
- package/apps/pwa/out/autopilot/index.html +1 -1
- package/apps/pwa/out/autopilot/index.txt +23 -23
- package/apps/pwa/out/board/index.html +1 -1
- package/apps/pwa/out/board/index.txt +23 -23
- package/apps/pwa/out/botlab/index.html +1 -1
- package/apps/pwa/out/botlab/index.txt +22 -22
- package/apps/pwa/out/bots/index.html +1 -1
- package/apps/pwa/out/bots/index.txt +22 -22
- package/apps/pwa/out/ceo/index.html +1 -1
- package/apps/pwa/out/ceo/index.txt +23 -23
- package/apps/pwa/out/chat/index.html +1 -1
- package/apps/pwa/out/chat/index.txt +22 -22
- package/apps/pwa/out/consult/index.html +1 -1
- package/apps/pwa/out/consult/index.txt +23 -23
- package/apps/pwa/out/control/index.html +1 -1
- package/apps/pwa/out/control/index.txt +23 -23
- package/apps/pwa/out/decisions/index.html +1 -0
- package/apps/pwa/out/decisions/index.txt +30 -0
- package/apps/pwa/out/design-check/index.html +1 -1
- package/apps/pwa/out/design-check/index.txt +23 -23
- package/apps/pwa/out/editor/index.html +1 -1
- package/apps/pwa/out/editor/index.txt +25 -24
- package/apps/pwa/out/exec/index.html +1 -1
- package/apps/pwa/out/exec/index.txt +23 -23
- package/apps/pwa/out/field/index.html +1 -1
- package/apps/pwa/out/field/index.txt +23 -23
- package/apps/pwa/out/healthz +1 -1
- package/apps/pwa/out/index.html +1 -1
- package/apps/pwa/out/index.txt +22 -22
- package/apps/pwa/out/inside/index.html +1 -1
- package/apps/pwa/out/inside/index.txt +24 -23
- package/apps/pwa/out/intake/index.html +1 -1
- package/apps/pwa/out/intake/index.txt +23 -23
- package/apps/pwa/out/live/index.html +1 -1
- package/apps/pwa/out/live/index.txt +23 -23
- package/apps/pwa/out/loops/index.html +1 -1
- package/apps/pwa/out/loops/index.txt +28 -27
- package/apps/pwa/out/market/index.html +1 -1
- package/apps/pwa/out/market/index.txt +22 -22
- package/apps/pwa/out/missions/placeholder/index.html +1 -1
- package/apps/pwa/out/missions/placeholder/index.txt +22 -22
- package/apps/pwa/out/morning/index.html +1 -1
- package/apps/pwa/out/morning/index.txt +23 -23
- package/apps/pwa/out/observatory/index.html +1 -1
- package/apps/pwa/out/observatory/index.txt +23 -23
- package/apps/pwa/out/ops/checklist/index.html +1 -1
- package/apps/pwa/out/ops/checklist/index.txt +22 -22
- package/apps/pwa/out/ops/release/index.html +1 -1
- package/apps/pwa/out/ops/release/index.txt +22 -22
- package/apps/pwa/out/ops/seats/index.html +1 -1
- package/apps/pwa/out/ops/seats/index.txt +22 -22
- package/apps/pwa/out/outputs/index.html +1 -1
- package/apps/pwa/out/outputs/index.txt +22 -22
- package/apps/pwa/out/reflection/index.html +1 -1
- package/apps/pwa/out/reflection/index.txt +23 -23
- package/apps/pwa/out/scheduler/index.html +1 -1
- package/apps/pwa/out/scheduler/index.txt +23 -23
- package/apps/pwa/out/sessions/index.html +1 -1
- package/apps/pwa/out/sessions/index.txt +22 -22
- package/apps/pwa/out/settings/devices/index.html +1 -1
- package/apps/pwa/out/settings/devices/index.txt +23 -23
- package/apps/pwa/out/settings/index.html +1 -1
- package/apps/pwa/out/settings/index.txt +23 -23
- package/apps/pwa/out/setup/done/index.html +1 -1
- package/apps/pwa/out/setup/done/index.txt +23 -23
- package/apps/pwa/out/setup/index.html +1 -1
- package/apps/pwa/out/setup/index.txt +23 -23
- package/apps/pwa/out/share/index.html +1 -1
- package/apps/pwa/out/share/index.txt +23 -23
- package/apps/pwa/out/showroom/index.html +1 -1
- package/apps/pwa/out/showroom/index.txt +22 -22
- package/apps/pwa/out/tasks/index.html +1 -1
- package/apps/pwa/out/tasks/index.txt +23 -23
- package/apps/pwa/out/term/index.html +1 -1
- package/apps/pwa/out/term/index.txt +23 -23
- package/apps/pwa/out/today/index.html +1 -1
- package/apps/pwa/out/today/index.txt +23 -23
- package/apps/pwa/out/trace/index.html +1 -1
- package/apps/pwa/out/trace/index.txt +23 -23
- package/apps/pwa/out/vault/index.html +1 -1
- package/apps/pwa/out/vault/index.txt +23 -23
- package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
- package/apps/pwa/out/workflows/chat-ui/index.txt +23 -23
- package/apps/pwa/out/workflows/index.html +1 -1
- package/apps/pwa/out/workflows/index.txt +23 -23
- package/apps/pwa/out/workspace/index.html +1 -1
- package/apps/pwa/out/workspace/index.txt +23 -23
- package/apps/pwa/out/worktrees/index.html +1 -1
- package/apps/pwa/out/worktrees/index.txt +23 -23
- package/graphs/ops/guardian.yaml +26 -0
- package/graphs/ops/recipes.yaml +3 -0
- package/package.json +2 -1
- package/samples/workflows/templates/approval-gated-deploy.yaml +30 -0
- package/samples/workflows/templates/chat-driven-research.yaml +35 -0
- package/samples/workflows/templates/discord-listen-and-respond.yaml +29 -0
- package/samples/workflows/templates/http-poll-then-alert.yaml +30 -0
- package/samples/workflows/templates/manual-quickstart.yaml +21 -0
- package/samples/workflows/templates/scheduled-daily-digest.yaml +30 -0
- package/samples/workflows/templates/webhook-deploy-hook.yaml +27 -0
- package/scripts/ci-public-export-import-gate.ts +7 -2
- package/scripts/ci-typecheck-changed.ts +21 -6
- package/scripts/coord-channel-watch.sh +2 -2
- package/scripts/discord-seat-probe.ts +6 -3
- package/scripts/docs/generate-cli-anatomy.ts +162 -0
- package/scripts/goals/authoring-metrics.ts +73 -0
- package/scripts/landing-heal/must-fix-match.ts +7 -7
- package/scripts/landing-heal/run-mission.ts +3 -2
- package/scripts/lib/pch-regress-map.ts +23 -0
- package/scripts/morning-report.ts +18 -4
- package/scripts/pch-regress.ts +88 -0
- package/scripts/public-export-test-run.ts +37 -2
- package/scripts/release-loop/checklist-gate-node.ts +13 -11
- package/scripts/release-loop/cut-branch.ts +2 -1
- package/scripts/release-loop/cutoff.ts +4 -2
- package/scripts/release-loop/docs-land-node.ts +8 -1
- package/scripts/release-loop/docs-node.ts +1 -1
- package/scripts/release-loop/gate-diff.ts +18 -0
- package/scripts/release-loop/gate-node.ts +436 -59
- package/scripts/release-loop/gate-partial.ts +106 -0
- package/scripts/release-loop/gate-timing.ts +120 -0
- package/scripts/release-loop/node-verdict.ts +2 -1
- package/scripts/release-loop/npm-publish-node.ts +11 -7
- package/scripts/release-loop/ops-upgrade-node.ts +8 -1
- package/scripts/release-loop/preflight.ts +246 -0
- package/scripts/release-loop/publish-node.ts +8 -1
- package/scripts/release-loop/release-readiness.ts +11 -6
- package/scripts/release-loop/release-version.ts +48 -0
- package/scripts/release-loop/resume-release.ts +174 -0
- package/scripts/release-loop/shard-plan.ts +65 -0
- package/scripts/release-loop/unattended-release.ts +45 -7
- package/scripts/release-loop/version-node.ts +145 -40
- package/scripts/rhythm/daily.ts +25 -4
- package/scripts/skills/public-check.ts +62 -12
- package/scripts/test-deterministic.ts +51 -33
- package/scripts/test-diet/effectiveness.ts +62 -1
- package/scripts/test-diet/lib.ts +1 -1
- package/scripts/test-diet/node.ts +8 -1
- package/scripts/video/scene-table.ts +159 -0
- package/src/acp/core-turn-bridge.ts +39 -2
- package/src/agent-mission/review-loop.ts +4 -3
- package/src/agent-substrate/pr-comment-meta.ts +20 -0
- package/src/autopilot/build/llm-conflict-merge.ts +28 -8
- package/src/away/presence.ts +40 -0
- package/src/away/release-watch.ts +255 -0
- package/src/briefing/brief-items.ts +86 -17
- package/src/chat/index.ts +2 -1
- package/src/chat/short-question.ts +3 -40
- package/src/cli/autopilot-cli.ts +30 -11
- package/src/cli/away-cli.ts +68 -0
- package/src/cli/brief-cli.ts +36 -2
- package/src/cli/freeze-cli.ts +3 -2
- package/src/cli/guardian-cli.ts +49 -0
- package/src/cli/intake-cli.ts +85 -7
- package/src/cli/log-event-names.ts +1 -0
- package/src/cli/notify-cli.ts +75 -0
- package/src/cli/pod-cli.ts +5 -1
- package/src/cli/provider-cli.ts +12 -2
- package/src/cli/pty-drive-cli.ts +14 -3
- package/src/cli/release-cli.ts +128 -19
- package/src/cli/setup-cli.ts +31 -1
- package/src/cli/tasks-cli.ts +403 -4
- package/src/context-bus/condense.ts +19 -3
- package/src/context-bus/context-day.ts +77 -24
- package/src/context-bus/context-first.ts +33 -0
- package/src/context-bus/context-now-public.ts +1 -1
- package/src/context-bus/context-now-surfaces.ts +16 -6
- package/src/context-bus/context-now.ts +97 -3
- package/src/core-turn/short-question.ts +100 -0
- package/src/dashboard/dashboard-status-lines.ts +24 -4
- package/src/dashboard/index.ts +50 -5
- package/src/dashboard/input/slash-executor.ts +6 -2
- package/src/dashboard/slash-runtime/dashboard-handlers.ts +63 -36
- package/src/dashboard/slash-runtime/decide-slash.ts +60 -0
- package/src/dashboard/slash-runtime/help-from-registry.ts +21 -8
- package/src/dashboard/slash-runtime/help-groups.ts +44 -0
- package/src/dashboard/slash-runtime/model-choices.ts +125 -0
- package/src/discord-self-message.ts +20 -2
- package/src/discord-slash-wire.ts +1 -0
- package/src/domains/guardian-tick.ts +138 -0
- package/src/domains/outbound-alert.ts +244 -40
- package/src/domains/outbound-log-probe.ts +16 -1
- package/src/domains/release-tool.ts +2 -2
- package/src/domains/schedule-registry.ts +23 -0
- package/src/domains/telegram-kind-route.ts +39 -0
- package/src/domains/watch-default-scheduler.ts +95 -0
- package/src/esc-abort-gate.ts +44 -0
- package/src/execution-loop/gates.ts +11 -2
- package/src/flow-loop/split.ts +8 -4
- package/src/git-fs/worktree.ts +23 -3
- package/src/graph-runner/runner.ts +25 -5
- package/src/harness/harness-cli-command.ts +12 -2
- package/src/harness/harness-queue.ts +388 -33
- package/src/harness/harness-salvage-cli.ts +78 -0
- package/src/harness/harness-worktree-add.ts +68 -0
- package/src/harness/helper-scan.ts +10 -3
- package/src/harness/ledger-write-guard.ts +6 -16
- package/src/hq/hq.ts +6 -1
- package/src/hq/seats.ts +369 -0
- package/src/index.ts +185 -18
- package/src/instance/test-write-guard-spy-first.fixture.ts +13 -0
- package/src/instance/test-write-guard.ts +200 -0
- package/src/intake-plane/adopt-gate.ts +49 -0
- package/src/intake-plane/check.ts +3 -0
- package/src/intake-plane/collect-github.ts +57 -25
- package/src/intake-plane/digest.ts +39 -15
- package/src/intake-plane/discord-seat-work.ts +8 -2
- package/src/intake-plane/harness-target.ts +4 -3
- package/src/intake-plane/intake-sources.ts +1 -0
- package/src/intake-plane/items.ts +1 -0
- package/src/intake-plane/requirement-funnel.ts +316 -0
- package/src/knowledge/know-find.ts +10 -1
- package/src/loops/budget.ts +36 -0
- package/src/loops/orchestrator/degradation.ts +57 -0
- package/src/loops/orchestrator/finish-rate.ts +106 -4
- package/src/loops/orchestrator/grid-place.ts +11 -0
- package/src/loops/orchestrator/tick.ts +450 -54
- package/src/maturity/feature-maturity.ts +8 -5
- package/src/maturity/tui-slash-maturity.ts +1 -0
- package/src/mss/logging/log-store.ts +3 -0
- package/src/nexus/api/decisions-route.ts +11 -1
- package/src/nexus/api/http-server.ts +16 -5
- package/src/nexus/api/loop-edges.ts +352 -23
- package/src/nexus/api/ops-api.ts +96 -28
- package/src/nexus/api/ops-seats-sources.ts +2 -2
- package/src/nexus/api/workflow-templates.ts +3 -0
- package/src/nexus/index.ts +7 -0
- package/src/oauth/codex.ts +38 -0
- package/src/onboarding/first-chat-gate.ts +29 -0
- package/src/release-loop/checklist.ts +106 -6
- package/src/release-loop/feature-store.ts +64 -16
- package/src/release-loop/landing-freeze.ts +6 -4
- package/src/release-loop/light-rc.ts +173 -0
- package/src/release-loop/placement.ts +64 -20
- package/src/release-loop/rubric.ts +136 -0
- package/src/seat-dispatch/seat-ask.ts +79 -16
- package/src/seat-loop/seat-loop.ts +12 -6
- package/src/self-dev/ask-launch-flow.ts +24 -3
- package/src/self-dev/ask-path-candidates.ts +68 -0
- package/src/self-dev/dev-cli.ts +36 -0
- package/src/self-dev/dev-pipeline.ts +4 -0
- package/src/self-dev/draft-triage-rules.ts +1 -1
- package/src/self-dev/orchestrate-cli.ts +22 -0
- package/src/self-dev/orchestrate.ts +1 -0
- package/src/self-dev/pr-preview.ts +179 -0
- package/src/self-dev/round-pr-supersede.ts +244 -0
- package/src/self-dev/run-supervisor.ts +14 -0
- package/src/self-dev/shard-run.ts +23 -7
- package/src/self-implement/follow-up-goals.ts +2 -2
- package/src/self-implement/gate-cli.ts +29 -8
- package/src/self-implement/gate-remote.ts +427 -0
- package/src/self-implement/goal-author-clarification.ts +88 -13
- package/src/self-implement/goal-author.ts +8 -3
- package/src/self-implement/goal-clarification-escalation.ts +2 -0
- package/src/self-implement/l8-merge-queue.ts +29 -5
- package/src/self-implement/orchestrator.ts +61 -13
- package/src/self-implement/prior-draft-findings.ts +4 -3
- package/src/self-implement/salvage-branches.ts +254 -0
- package/src/skills/skill-feedback.ts +76 -0
- package/src/task-agent/actions.ts +101 -7
- package/src/task-agent/board.ts +132 -0
- package/src/task-agent/card-evidence.ts +203 -0
- package/src/task-agent/completion-evidence.ts +126 -0
- package/src/task-agent/judge.ts +49 -5
- package/src/task-agent/live-moves.ts +176 -0
- package/src/task-agent/mission.ts +449 -0
- package/src/task-agent/shadow.ts +258 -0
- package/src/task-agent/task-hand.ts +337 -0
- package/src/task-orchestrator/surfaces/pod-command-job.ts +64 -4
- package/src/task-orchestrator/surfaces/pod-failure-reason.ts +10 -0
- package/src/task-orchestrator/surfaces/pod-lease.ts +142 -13
- package/src/task-orchestrator/surfaces/pod-pool.ts +13 -5
- package/src/task-orchestrator/surfaces/self-implement-pod.ts +88 -20
- package/src/telegram-away-command.ts +38 -0
- package/src/telegram-commands.ts +11 -0
- package/src/telegram-loops-command.ts +1 -1
- package/src/telegram-report-log-probe.ts +21 -0
- package/src/telegram-report.ts +27 -3
- package/src/telegram.ts +5 -20
- package/src/tui-client/dashboard-session.ts +1 -0
- package/src/user-config.ts +196 -4
- package/src/version/packed-revision.json +1 -1
- package/apps/pwa/out/_next/static/chunks/1307-aac7332576c4d6fc.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1826-5d279da64bbbc2de.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1844-9ec4b1d12f6e80eb.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1866-e7a6999f25548b30.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1948.15f356b15a625597.js +0 -5
- package/apps/pwa/out/_next/static/chunks/2196-4700653d12a44b40.js +0 -1
- package/apps/pwa/out/_next/static/chunks/224-798346143007ff65.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2699-63b73fa4d3bcf6ff.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2957-96ffab3d521fb08f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/311.e685738f92e6e2ec.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3194-807b212fb8eae065.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3324-d1d2979821dfa845.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3558-bbb5ab553a0471d3.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3916-3d02dd1fc257dd3c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4144-a0041c8dc3be57ac.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4554-3565eea1f1495ba7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4614-21403aac730d4586.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4795-f372490b178583fc.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5135-44008fe8b1f2aa41.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5233-bf28bd6bd7a32099.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5360-be1f1d8f9fcc9755.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5977-c952712c87a1f757.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5994-ae92c0de046ab9ba.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6158.9c0449a9a8d0064b.js +0 -2
- package/apps/pwa/out/_next/static/chunks/6877-fe94e76a5841ee9b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7290-f09c928a06c52e2d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7395-164e238f471b5d7b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7787-02a1c0b04e25e811.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8060-cc008cc6fedfa818.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8085-d065d0393c1760f5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8401-4ce1c42c8d89903f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8682-7061dd4fa7bd62ed.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8868-10a3a4440fb0ccd8.js +0 -25
- package/apps/pwa/out/_next/static/chunks/8949-ecb4128a0858b911.js +0 -1
- package/apps/pwa/out/_next/static/chunks/899-f41be85e8a680651.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9070.067c106528ec1ae6.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9103-60fbef33e66f0a46.js +0 -1
- package/apps/pwa/out/_next/static/chunks/a9f2b54d-7865aba0f4d2ee49.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/_not-found/page-c1a96669158471ec.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-3143b07a817d1da9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/autopilot/page-17ba086ef82d339b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/board/page-7eb661ff23af7da2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-6b8444914da74ca6.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/bots/page-6e5c3a867557298b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-7110f732f45bf944.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/chat/page-9a41d65355fc25b9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/consult/page-5e77cd1802567c89.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/control/page-41afec0b255ed2bb.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-4187666132fc98c4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/editor/page-09328d499162bae4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/exec/page-29ff3a8f84f03b6a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/field/page-80ec7401bc83f511.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/healthz/route-c1a96669158471ec.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/inside/page-ab93b240f687d69a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/intake/page-fc7d86467291ae38.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/layout-de43a186e5ba5683.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/live/page-8b08cafad27759c9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/loops/page-0e2d6985fb42cd2f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/market/page-13e4108999f58d13.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-e8296ee284aa1293.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/morning/page-043a9111e74f6b24.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-23a4601ceb7f452e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-1ed1324b1dc36754.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-10d958605a77b3bd.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/release/page-166745e51ac0c7b0.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-a04260b8ccc968d4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/outputs/page-7a1d85e121065cc8.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/page-1f50e3d4e13435f4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-12916918988ac97e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/scheduler/page-d8a3347a9d0c3f4a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/sessions/page-a9117d2cd3093d36.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-5a64cb5208c6a8fd.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/page-1407ec83ea64c1f9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/done/page-1d824510df025d18.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/layout-c1a96669158471ec.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/page-6e878ebbe1737d00.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/share/page-7f49fe645d5132f7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/showroom/page-81a4e7f8dbfe74cb.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/tasks/page-27d71f131acd9320.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/term/page-3ab59d19913b200e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/today/page-bf85b2f5bf077925.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/trace/page-424659bacfb8cdd7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/vault/page-ab32a8f522a60371.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-fc2df261f8a2c7df.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/page-09461366af82ef13.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-5d4fef9ccd7d406b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-ea90a8ac73ce2749.js +0 -1
- package/apps/pwa/out/_next/static/chunks/framework-5c169757551134ed.js +0 -1
- package/apps/pwa/out/_next/static/chunks/main-59fe95fed40c7a01.js +0 -1
- package/apps/pwa/out/_next/static/chunks/main-app-4ca74dbbee7057c6.js +0 -1
- package/apps/pwa/out/_next/static/chunks/pages/_app-13a0a886df4d97a1.js +0 -1
- package/apps/pwa/out/_next/static/chunks/pages/_error-6af8591cd3a3f038.js +0 -1
- package/apps/pwa/out/_next/static/chunks/webpack-539cde99554be20f.js +0 -1
- package/apps/pwa/out/_next/static/css/001d5fbaee388a25.css +0 -1
- package/apps/pwa/out/_next/static/yRA5ur6DcPl0YHSRheH2O/_buildManifest.js +0 -1
- /package/apps/pwa/out/_next/static/{yRA5ur6DcPl0YHSRheH2O → J5H7BvqgSI8DUjtRRcA_S}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TASK-AGENT-MISSION ① — `elanous tasks hand --mission "<칸 문면>"`: 미션을 조각 카드 ⊕ 선후 간선으로 쪼개 적고,
|
|
3
|
+
* 선행이 없는 조각만 기존 `handTask` 로 넘긴다(기본 shadow · `--live` 면 발사).
|
|
4
|
+
*
|
|
5
|
+
* - 쪼개기: 문면이 이미 조각을 줄로 나열하면(`- …` · `① …` · `1. …` + `after: 1, ②` 힌트) LLM 없이 결정론으로.
|
|
6
|
+
* 아니면 기존 분해기 `decomposeSelfDevGoal`(self orchestrate --decompose 와 같은 것)을 주입 가능한 자리로 부른다.
|
|
7
|
+
* - 저장: 과제 카드와 «같은» 상태 파일(`taskAgentStatePath()`) — 미션 카드(`pieces`) ⊕ 조각 카드(`mission`·`after`).
|
|
8
|
+
* - ② `elanous tasks advance`: 조각의 착지 근거(카드의 PR 번호·골 id → PR 병합)로 착지를 가르고(`landedPieces`),
|
|
9
|
+
* 새로 준비된 조각만 같은 `handTask` 로 «한 번» 넘긴다 · 모두 착지하면 미션 카드에 green «제안»만 적는다.
|
|
10
|
+
* - 관측: `debug.log('task-agent', 'mission-split' | 'mission-piece' | 'mission-advance' | 'mission-piece-handed' | 'mission-green-proposed', …)`.
|
|
11
|
+
*/
|
|
12
|
+
import { randomBytes } from 'node:crypto';
|
|
13
|
+
import { debug } from '../debug/log.js';
|
|
14
|
+
import type { SelfDevDecomposition } from '../self-dev/decompose.js';
|
|
15
|
+
import { refreshCardRunBinding, type CardRunEvidenceDeps } from './card-evidence.js';
|
|
16
|
+
import {
|
|
17
|
+
cardPrNumber,
|
|
18
|
+
handTask,
|
|
19
|
+
nextMoveFor,
|
|
20
|
+
readTaskAgentState,
|
|
21
|
+
readTaskCard,
|
|
22
|
+
TaskCardSupersededError,
|
|
23
|
+
TASK_CARD_PREFIX,
|
|
24
|
+
TASK_SEATS,
|
|
25
|
+
taskAgentStatePath,
|
|
26
|
+
updateTaskCard,
|
|
27
|
+
writeTaskCards,
|
|
28
|
+
type TaskCard,
|
|
29
|
+
type TaskCardMove,
|
|
30
|
+
type TaskLauncher,
|
|
31
|
+
type TaskSeat,
|
|
32
|
+
} from './task-hand.js';
|
|
33
|
+
|
|
34
|
+
/** 쪼갠 조각 — `after` 는 같은 목록 안의 0-기반 위치. */
|
|
35
|
+
export interface MissionPieceDraft { text: string; after: number[] }
|
|
36
|
+
export interface MissionSplit { pieces: MissionPieceDraft[]; source: string }
|
|
37
|
+
|
|
38
|
+
/** 주입 가능한 분해기 — 기본은 `decomposeSelfDevGoal`(LLM). 시험은 가짜를 준다. */
|
|
39
|
+
export type MissionDecompose = (text: string) => Promise<SelfDevDecomposition>;
|
|
40
|
+
|
|
41
|
+
const CIRCLED_FIRST = 0x2460; // ①
|
|
42
|
+
const CIRCLED_LAST = 0x2473; // ⑳
|
|
43
|
+
const ITEM = /^(\s*)(?:([-*•])|([①-⑳])|(\d{1,3})[.)])\s+(.*)$/u;
|
|
44
|
+
const AFTER_HINT = /\s*[([]?\s*(?:after|선행)\s*[::]\s*([^)\]]*?)\s*[)\]]?\s*$/iu;
|
|
45
|
+
const EMPTY_ITEM = /^\s*(?:[-*•]|[\u2460-\u2473]|\d{1,3}[.)])\s*$/u;
|
|
46
|
+
const AFTER_LINE = /^\s*(?:after|선행)\s*[::]\s*(.*?)\s*$/iu;
|
|
47
|
+
|
|
48
|
+
function circledNumber(ch: string): number | null {
|
|
49
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
50
|
+
return code >= CIRCLED_FIRST && code <= CIRCLED_LAST ? code - CIRCLED_FIRST + 1 : null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function refLabel(raw: string): string | null {
|
|
54
|
+
const ref = raw.trim().replace(/^#/, '');
|
|
55
|
+
if (!ref) return null;
|
|
56
|
+
if (/^\d{1,3}$/.test(ref)) return String(Number(ref));
|
|
57
|
+
const circled = [...ref].length === 1 ? circledNumber(ref) : null;
|
|
58
|
+
return circled === null ? ref : String(circled);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** 문면이 이미 조각을 나열했을 때의 결정론 분해 — 조각이 2장 미만이면 null(분해기로 간다). */
|
|
62
|
+
export function parseListedMission(text: string): MissionSplit | null {
|
|
63
|
+
interface Item { label: string; lines: string[]; afterRefs: string[] }
|
|
64
|
+
const items: Item[] = [];
|
|
65
|
+
let baseIndent = 0; // 첫 조각의 들여쓰기 — 같은 수준(±1칸)만 조각, 더 깊으면 그 조각의 하위 줄
|
|
66
|
+
for (const line of text.split(/\r?\n/)) {
|
|
67
|
+
if (EMPTY_ITEM.test(line)) throw new Error(`빈 조각 표식이 있다: «${line.trim()}»`);
|
|
68
|
+
const item = line.match(ITEM);
|
|
69
|
+
if (item && items.length === 0) baseIndent = item[1]!.length;
|
|
70
|
+
if (item && (items.length === 0 || item[1]!.length <= baseIndent + 1)) {
|
|
71
|
+
const marker = item[3] ? String(circledNumber(item[3])) : item[4] ? String(Number(item[4])) : String(items.length + 1);
|
|
72
|
+
let body = item[5]!;
|
|
73
|
+
const afterRefs: string[] = [];
|
|
74
|
+
const hint = body.match(AFTER_HINT);
|
|
75
|
+
if (hint) { afterRefs.push(...hint[1]!.split(/[,\s]+/).filter(Boolean)); body = body.slice(0, hint.index).trimEnd(); }
|
|
76
|
+
items.push({ label: marker, lines: [body], afterRefs });
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const current = items.at(-1);
|
|
80
|
+
if (!current) continue; // 머리말 — 미션 카드 원문에 남는다
|
|
81
|
+
const afterLine = line.match(AFTER_LINE);
|
|
82
|
+
if (afterLine) { current.afterRefs.push(...afterLine[1]!.split(/[,\s]+/).filter(Boolean)); continue; }
|
|
83
|
+
if (line.trim()) current.lines.push(line.trim());
|
|
84
|
+
}
|
|
85
|
+
if (items.length < 2) return null;
|
|
86
|
+
const byLabel = new Map<string, number>();
|
|
87
|
+
items.forEach((item, index) => {
|
|
88
|
+
if (byLabel.has(item.label)) throw new Error(`조각 번호가 겹친다: ${item.label}`);
|
|
89
|
+
byLabel.set(item.label, index);
|
|
90
|
+
});
|
|
91
|
+
const pieces = items.map((item, index) => {
|
|
92
|
+
const after = item.afterRefs.map((raw) => {
|
|
93
|
+
const label = refLabel(raw);
|
|
94
|
+
const target = label === null ? undefined : byLabel.get(label);
|
|
95
|
+
if (target === undefined) throw new Error(`조각 ${item.label} 의 after 가 없는 조각을 가리킨다: ${raw}`);
|
|
96
|
+
if (target === index) throw new Error(`조각 ${item.label} 이 자기 자신 뒤에 올 수 없다`);
|
|
97
|
+
return target;
|
|
98
|
+
});
|
|
99
|
+
return { text: item.lines.join('\n').trim(), after: [...new Set(after)] };
|
|
100
|
+
});
|
|
101
|
+
if (pieces.some((piece) => !piece.text)) throw new Error('빈 조각이 있다');
|
|
102
|
+
return { pieces, source: 'listed' };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** 분해기 결과(`SelfDevGoal[]`)를 조각으로 — dependsOn 의 id 를 위치로 바꾼다. 없는 id·자기 참조는 버리지 않고 멈춘다. */
|
|
106
|
+
export function piecesFromDecomposition(result: SelfDevDecomposition): MissionSplit {
|
|
107
|
+
const ids = result.goals.map((goal, index) => goal.id ?? String(index));
|
|
108
|
+
if (new Set(ids).size !== ids.length) throw new Error(`분해기 조각 id 가 겹친다: ${ids.join(', ')}`);
|
|
109
|
+
const pieces = result.goals.map((goal, index) => ({
|
|
110
|
+
text: (goal.feature ?? '').trim(),
|
|
111
|
+
after: [...new Set((goal.dependsOn ?? []).map((id) => {
|
|
112
|
+
const at = ids.indexOf(id);
|
|
113
|
+
if (at < 0) throw new Error(`분해기 조각 ${ids[index]} 의 dependsOn 이 없는 조각을 가리킨다: ${id}`);
|
|
114
|
+
if (at === index) throw new Error(`분해기 조각 ${ids[index]} 이 자기 자신 뒤에 올 수 없다`);
|
|
115
|
+
return at;
|
|
116
|
+
}))],
|
|
117
|
+
}));
|
|
118
|
+
return { pieces, source: `decompose:${result.decomposition.outcome}` };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** 선후에 고리가 있으면 던진다 — 고리 속 조각은 영영 발사되지 않는다. */
|
|
122
|
+
export function assertAcyclic(pieces: readonly MissionPieceDraft[]): void {
|
|
123
|
+
const state = new Array<0 | 1 | 2>(pieces.length).fill(0);
|
|
124
|
+
const visit = (at: number): void => {
|
|
125
|
+
if (state[at] === 2) return;
|
|
126
|
+
if (state[at] === 1) throw new Error(`조각 선후에 고리가 있다 (조각 ${at + 1})`);
|
|
127
|
+
state[at] = 1;
|
|
128
|
+
for (const before of pieces[at]!.after) visit(before);
|
|
129
|
+
state[at] = 2;
|
|
130
|
+
};
|
|
131
|
+
pieces.forEach((_piece, at) => visit(at));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export async function defaultMissionDecompose(text: string): Promise<SelfDevDecomposition> {
|
|
135
|
+
const { decomposeSelfDevGoal } = await import('../self-dev/decompose.js');
|
|
136
|
+
return decomposeSelfDevGoal(text, { observation: { category: 'task-agent', event: 'mission-decompose' } });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export async function splitMission(text: string, decompose: MissionDecompose = defaultMissionDecompose): Promise<MissionSplit> {
|
|
140
|
+
const split = parseListedMission(text) ?? piecesFromDecomposition(await decompose(text));
|
|
141
|
+
if (split.pieces.length === 0) throw new Error('미션을 조각으로 쪼개지 못했다');
|
|
142
|
+
const empty = split.pieces.findIndex((piece) => !piece.text.trim());
|
|
143
|
+
if (empty >= 0) throw new Error(`조각 ${empty + 1} 의 문면이 비어 있다 (${split.source})`);
|
|
144
|
+
assertAcyclic(split.pieces);
|
|
145
|
+
return split;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* ② 의 자리(순수): 아직 착지하지 않았고 선행이 모두 착지한 조각 id.
|
|
150
|
+
* `landed` 는 착지한 조각 id 집합 — 감지(PR 병합 등)는 이 함수 밖의 몫이다.
|
|
151
|
+
*/
|
|
152
|
+
export function readyPieces(pieces: readonly Pick<TaskCard, 'id' | 'after'>[], landed: ReadonlySet<string>): string[] {
|
|
153
|
+
return pieces.filter((piece) => !landed.has(piece.id) && (piece.after ?? []).every((id) => landed.has(id))).map((piece) => piece.id);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** 모든 조각이 착지했나 — 미션 칸 green 제안의 조건(② 이후에 쓴다). */
|
|
157
|
+
export function missionLanded(mission: Pick<TaskCard, 'pieces'>, landed: ReadonlySet<string>): boolean {
|
|
158
|
+
return (mission.pieces ?? []).length > 0 && (mission.pieces ?? []).every((id) => landed.has(id));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface HandMissionOptions {
|
|
162
|
+
text: string;
|
|
163
|
+
seat?: TaskSeat;
|
|
164
|
+
checklistId?: string;
|
|
165
|
+
live?: boolean;
|
|
166
|
+
statePath?: string;
|
|
167
|
+
launcher?: TaskLauncher;
|
|
168
|
+
decompose?: MissionDecompose;
|
|
169
|
+
now?: () => Date;
|
|
170
|
+
id?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface MissionPieceResult { card: TaskCard; move: TaskCardMove; launched: boolean; error?: string }
|
|
174
|
+
export interface HandMissionResult {
|
|
175
|
+
mission: TaskCard;
|
|
176
|
+
pieces: MissionPieceResult[];
|
|
177
|
+
edges: Array<[string, string]>;
|
|
178
|
+
source: string;
|
|
179
|
+
mode: 'shadow' | 'live';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export async function handMission(opts: HandMissionOptions): Promise<HandMissionResult> {
|
|
183
|
+
const text = opts.text.trim();
|
|
184
|
+
if (!text) throw new Error('미션 문면이 비어 있다');
|
|
185
|
+
if (opts.seat !== undefined && !TASK_SEATS.includes(opts.seat)) throw new Error(`자리는 ${TASK_SEATS.join('|')} 중 하나다: ${opts.seat}`);
|
|
186
|
+
const split = await splitMission(text, opts.decompose);
|
|
187
|
+
const now = (opts.now ?? (() => new Date()))();
|
|
188
|
+
const missionId = opts.id ?? `${TASK_CARD_PREFIX}${now.toISOString().slice(0, 10).replaceAll('-', '')}-${randomBytes(3).toString('hex')}`;
|
|
189
|
+
const mode = opts.live ? 'live' : 'shadow';
|
|
190
|
+
const path = opts.statePath ?? taskAgentStatePath();
|
|
191
|
+
const pieceIds = split.pieces.map((_piece, index) => `${missionId}-${index + 1}`);
|
|
192
|
+
const common = { ...(opts.seat ? { seat: opts.seat } : {}), ...(opts.checklistId ? { checklistId: opts.checklistId } : {}) };
|
|
193
|
+
const mission: TaskCard = { id: missionId, text, ...common, createdAt: now.toISOString(), status: 'handed', history: [], pieces: pieceIds, splitSource: split.source };
|
|
194
|
+
const drafts: TaskCard[] = split.pieces.map((piece, index) => ({
|
|
195
|
+
id: pieceIds[index]!, text: piece.text, ...common, createdAt: now.toISOString(), status: 'handed', history: [],
|
|
196
|
+
mission: missionId, after: piece.after.map((at) => pieceIds[at]!),
|
|
197
|
+
}));
|
|
198
|
+
const edges = drafts.flatMap((card) => (card.after ?? []).map((before) => [before, card.id] as [string, string]));
|
|
199
|
+
// 미션 ⊕ 조각을 한 잠금 안에서 먼저 적는다 — 발사 도중 실패해도 선후 기록은 남는다.
|
|
200
|
+
writeTaskCards(path, [mission, ...drafts]);
|
|
201
|
+
try { debug.log('task-agent', 'mission-split', { missionId, pieces: drafts.length, edges: edges.map(([a, b]) => `${a}->${b}`), source: split.source, seat: opts.seat ?? null, checklistId: opts.checklistId ?? null, mode }); } catch { /* fail-soft */ }
|
|
202
|
+
// 방금 만든 조각이다 — 착지한 것이 «없음»을 안다(모름이 아니다).
|
|
203
|
+
const landedNone: ReadonlySet<string> = new Set();
|
|
204
|
+
const ready = new Set(readyPieces(drafts, landedNone));
|
|
205
|
+
const results: MissionPieceResult[] = [];
|
|
206
|
+
for (const draft of drafts) {
|
|
207
|
+
let result: MissionPieceResult;
|
|
208
|
+
if (!ready.has(draft.id)) {
|
|
209
|
+
result = { card: draft, move: nextMoveFor(draft, landedNone), launched: false };
|
|
210
|
+
} else {
|
|
211
|
+
try {
|
|
212
|
+
const handed = await handTask({
|
|
213
|
+
text: draft.text, id: draft.id, mission: missionId, after: draft.after ?? [],
|
|
214
|
+
...(opts.seat ? { seat: opts.seat } : {}), ...(opts.checklistId ? { checklistId: opts.checklistId } : {}),
|
|
215
|
+
live: opts.live === true, statePath: path, ...(opts.launcher ? { launcher: opts.launcher } : {}), ...(opts.now ? { now: opts.now } : {}),
|
|
216
|
+
});
|
|
217
|
+
result = { card: handed.card, move: handed.move, launched: handed.launched };
|
|
218
|
+
} catch (error) {
|
|
219
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
220
|
+
const card = readTaskCard(draft.id, path) ?? draft; // launch-failed 면 handTask 가 이미 적었다
|
|
221
|
+
result = { card, move: nextMoveFor(card, landedNone), launched: false, error: reason };
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
results.push(result);
|
|
225
|
+
try { debug.log('task-agent', 'mission-piece', { missionId, pieceId: draft.id, after: draft.after ?? [], ready: ready.has(draft.id), move: result.move.kind, reason: result.move.reason, launched: result.launched, mode, ...(result.error ? { error: result.error } : {}) }); } catch { /* fail-soft */ }
|
|
226
|
+
}
|
|
227
|
+
return { mission, pieces: results, edges, source: split.source, mode };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* ② 착지 근거 — 조각 하나의 PR 상태. `merged` 만 착지다.
|
|
233
|
+
* pending = 열림·못 읽음·원장에 PR 없음 · closed = 병합 없이 닫힘 · no-ref = 카드에 PR 번호도 골 id 도 없다.
|
|
234
|
+
*/
|
|
235
|
+
export type PieceEvidence = 'merged' | 'pending' | 'closed' | 'no-ref';
|
|
236
|
+
|
|
237
|
+
/** ② 의 판정(순수): 근거가 `merged` 인 조각만 착지다 — 모름(근거 없음·no-ref·pending)은 «미착지»(착지를 추측하지 않는다). */
|
|
238
|
+
export function landedPieces(mission: Pick<TaskCard, 'pieces'>, evidence: Readonly<Record<string, PieceEvidence | undefined>>): Set<string> {
|
|
239
|
+
return new Set((mission.pieces ?? []).filter((id) => evidence[id] === 'merged'));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** 조각 근거 하나를 읽는 자리(시험 주입) — 기본은 `predecessorState`(PR 번호 → gh · 골 id → 런 원장 `pr-opened` → gh). */
|
|
243
|
+
export type PieceEvidenceReader = (ref: number | string) => Promise<'merged' | 'waiting' | 'blocked'>;
|
|
244
|
+
|
|
245
|
+
async function defaultEvidenceReader(ref: number | string): Promise<'merged' | 'waiting' | 'blocked'> {
|
|
246
|
+
const { predecessorState } = await import('../pod-lease/dependency-state.js');
|
|
247
|
+
return predecessorState(ref);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* 조각의 착지 근거 하나 — PR 번호 › 골 id. 수동(`--pr`/`--goal`)이든 런 원장 묶기든 같은 칸이다(TA-CARD-RUN-LINK) —
|
|
252
|
+
* 수동이 적히면 `refSource: 'manual'` 이라 묶기가 다시 채우지 않는다(수동이 덮는다).
|
|
253
|
+
*/
|
|
254
|
+
export function pieceRef(piece: Pick<TaskCard, 'pr' | 'goalId'>): number | string | undefined {
|
|
255
|
+
return cardPrNumber(piece) ?? piece.goalId;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** 조각 카드마다 근거를 모은다 — `pieceRef` 순. 읽기 실패는 pending(미착지). */
|
|
259
|
+
export async function collectPieceEvidence(pieces: readonly TaskCard[], read: PieceEvidenceReader = defaultEvidenceReader): Promise<Record<string, PieceEvidence>> {
|
|
260
|
+
const out: Record<string, PieceEvidence> = {};
|
|
261
|
+
for (const piece of pieces) {
|
|
262
|
+
const ref = pieceRef(piece);
|
|
263
|
+
if (ref === undefined) { out[piece.id] = 'no-ref'; continue; }
|
|
264
|
+
let state: 'merged' | 'waiting' | 'blocked';
|
|
265
|
+
try { state = await read(ref); } catch { state = 'waiting'; }
|
|
266
|
+
out[piece.id] = state === 'merged' ? 'merged' : state === 'blocked' ? 'closed' : 'pending';
|
|
267
|
+
}
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const GOAL_ID = /^[a-f0-9]{16}$/;
|
|
272
|
+
|
|
273
|
+
/** `--pr <조각>=<N>` · `--goal <조각>=<골id>` — 조각 카드에 착지 근거를 잠금 안에서 적는다(미션 조각만 · 근거는 하나 · 새 것이 교체). */
|
|
274
|
+
export function recordPieceRef(pieceId: string, ref: { pr?: number; goalId?: string }, statePath = taskAgentStatePath(), expectedMission?: string): TaskCard {
|
|
275
|
+
if ((ref.pr === undefined) === (ref.goalId === undefined)) throw new Error('근거는 PR 번호 «또는» 골 id 하나다');
|
|
276
|
+
if (ref.pr !== undefined && !(Number.isSafeInteger(ref.pr) && ref.pr > 0)) throw new Error(`PR 번호가 아니다: ${ref.pr}`);
|
|
277
|
+
if (ref.goalId !== undefined && !GOAL_ID.test(ref.goalId)) throw new Error(`골 id 는 16자 hex 다: ${ref.goalId}`);
|
|
278
|
+
const refused: { reason?: string } = {};
|
|
279
|
+
const card = updateTaskCard(statePath, pieceId, (current, tasks) => {
|
|
280
|
+
if (!current?.mission) { refused.reason = `미션 조각 카드가 아니다: ${pieceId}`; return undefined; }
|
|
281
|
+
// 미션을 지정했으면 그 미션(실재하는 미션 카드)의 조각에만 적는다 — 미션 A 호출이 미션 B 근거를 바꾸지 않게.
|
|
282
|
+
if (expectedMission !== undefined && (current.mission !== expectedMission || !tasks[expectedMission]?.pieces?.includes(pieceId))) {
|
|
283
|
+
refused.reason = `조각 ${pieceId} 은 미션 ${expectedMission} 의 조각이 아니다`; return undefined;
|
|
284
|
+
}
|
|
285
|
+
// green 제안 뒤 근거를 바꾸면 제안이 바뀐 근거와 어긋난다 — 제안된 미션의 조각 근거는 잠근다.
|
|
286
|
+
if (tasks[current.mission]?.greenProposal) { refused.reason = `미션 ${current.mission} 은 이미 green 제안됐다 — 근거를 바꾸지 않는다`; return undefined; }
|
|
287
|
+
// 근거는 하나만 — 새 근거가 옛 근거를 «교체»한다(정정한 골 id 뒤에 옛 PR 이 남아 우선되지 않게).
|
|
288
|
+
// 런 묶기가 적은 자식 런도 함께 지운다 — 수동 근거를 옛 Pod 자식 런의 결과처럼 보이지 않게.
|
|
289
|
+
const { pr: _oldPr, goalId: _oldGoal, runChildId: _oldChild, ...rest } = current;
|
|
290
|
+
return { ...rest, ...(ref.pr !== undefined ? { pr: ref.pr } : { goalId: ref.goalId! }), refSource: 'manual' as const };
|
|
291
|
+
});
|
|
292
|
+
if (refused.reason || !card) throw new Error(refused.reason ?? `미션 조각 카드가 아니다: ${pieceId}`);
|
|
293
|
+
try { debug.log('task-agent', 'mission-piece-ref', { pieceId, missionId: card.mission ?? null, pr: ref.pr ?? null, goalId: ref.goalId ?? null }); } catch { /* fail-soft */ }
|
|
294
|
+
return card;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** 이미 넘긴 조각인가 — live 는 live 넘김·발사·발사 실패면 다시 안 넘긴다 · shadow 는 어떤 넘김이든 있으면 안 넘긴다. */
|
|
298
|
+
function alreadyHanded(card: TaskCard, mode: 'shadow' | 'live'): boolean {
|
|
299
|
+
if (card.status === 'launched' || card.status === 'launch-failed') return true;
|
|
300
|
+
if (!card.handed) return false;
|
|
301
|
+
return mode === 'shadow' || card.handed.mode === 'live';
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export interface AdvanceMissionOptions {
|
|
305
|
+
live?: boolean;
|
|
306
|
+
statePath?: string;
|
|
307
|
+
launcher?: TaskLauncher;
|
|
308
|
+
readEvidence?: PieceEvidenceReader;
|
|
309
|
+
/** 런 id 가 있는 조각의 런 근거(PR·골 id) 읽기(시험 주입) — `false` 면 묶지 않는다. */
|
|
310
|
+
runEvidence?: CardRunEvidenceDeps | false;
|
|
311
|
+
now?: () => Date;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export interface AdvancedPiece { pieceId: string; launched: boolean; move: TaskCardMove['kind']; error?: string }
|
|
315
|
+
export interface AdvanceMissionResult {
|
|
316
|
+
missionId: string;
|
|
317
|
+
mode: 'shadow' | 'live';
|
|
318
|
+
evidence: Record<string, PieceEvidence>;
|
|
319
|
+
landed: string[];
|
|
320
|
+
ready: string[];
|
|
321
|
+
handed: AdvancedPiece[];
|
|
322
|
+
/** 준비됐지만 이미 넘겨서 건너뛴 조각(선행 없는 첫 조각 포함). */
|
|
323
|
+
skipped: string[];
|
|
324
|
+
green: 'proposed' | 'already-proposed' | 'not-yet';
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* ② 한 걸음: 근거 → 착지 → 준비된 조각 → 새로 준비된 조각만 `handTask` 로 한 번 → 모두 착지면 green 제안.
|
|
329
|
+
* 넘김은 같은 상태 파일 잠금 안에서 «먼저» 표지를 적고(claim) 넘긴다 — 동시에 두 번 불러도 한 번만 넘긴다.
|
|
330
|
+
* 선행이 없는 조각은 `tasks hand --mission` 이 이미 넘겼다 — ② 는 다시 넘기지 않는다.
|
|
331
|
+
*/
|
|
332
|
+
export async function advanceMission(missionId: string, opts: AdvanceMissionOptions = {}): Promise<AdvanceMissionResult> {
|
|
333
|
+
const started = Date.now();
|
|
334
|
+
try {
|
|
335
|
+
const result = await advanceMissionOnce(missionId, opts);
|
|
336
|
+
try { debug.log('task-agent', 'mission-advance', { missionId, mode: result.mode, landed: result.landed, ready: result.ready, handed: result.handed.map((piece) => piece.pieceId), skipped: result.skipped, green: result.green, evidence: result.evidence, ms: Date.now() - started }); } catch { /* fail-soft */ }
|
|
337
|
+
return result;
|
|
338
|
+
} catch (error) {
|
|
339
|
+
// 실패한 호출도 한 줄 — 관측이 «호출마다» 남는다.
|
|
340
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
341
|
+
try { debug.log('task-agent', 'mission-advance', { missionId, mode: opts.live ? 'live' : 'shadow', error: reason, ms: Date.now() - started }); } catch { /* fail-soft */ }
|
|
342
|
+
throw new MissionAdvanceError(reason);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** `advanceMission` 이 실패했다 — `mission-advance` 관측은 이미 남겼다. */
|
|
347
|
+
export class MissionAdvanceError extends Error {
|
|
348
|
+
constructor(reason: string) {
|
|
349
|
+
super(reason);
|
|
350
|
+
this.name = 'MissionAdvanceError';
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
async function advanceMissionOnce(missionId: string, opts: AdvanceMissionOptions): Promise<AdvanceMissionResult> {
|
|
355
|
+
const path = opts.statePath ?? taskAgentStatePath();
|
|
356
|
+
const mode = opts.live ? 'live' : 'shadow';
|
|
357
|
+
const clock = opts.now ?? (() => new Date());
|
|
358
|
+
// live 인데 발사기가 없으면 claim 을 적기 «전»에 멈춘다 — live 표지가 발사 없이 남아 영영 안 넘겨지지 않게.
|
|
359
|
+
if (mode === 'live' && !opts.launcher) throw new Error('--live 인데 launcher 가 없다');
|
|
360
|
+
const before = readTaskAgentState<{ tasks?: Record<string, TaskCard> }>(path).tasks ?? {};
|
|
361
|
+
if (!before[missionId]?.pieces) throw new Error(`미션 카드가 아니다: ${missionId}`);
|
|
362
|
+
// 런 id 가 있고 PR·골 id 중 빈 칸이 있는 조각 — 원장에서 묶어 둔다(제안 끝난 미션은 건드리지 않는다 · 실패는 근거 없음).
|
|
363
|
+
if (opts.runEvidence !== false && !before[missionId]!.greenProposal) {
|
|
364
|
+
for (const id of before[missionId]!.pieces!) {
|
|
365
|
+
const piece = before[id];
|
|
366
|
+
if (!piece?.runId || piece.refSource === 'manual' || (piece.pr !== undefined && piece.goalId !== undefined)) continue;
|
|
367
|
+
try { await refreshCardRunBinding(id, path, opts.runEvidence ?? {}); } catch (error) {
|
|
368
|
+
// 근거 없음으로 본다(미착지) — 원장 부재와 갈리게 실패는 남긴다.
|
|
369
|
+
try { debug.log('task-agent', 'card-bind-failed', { card: id, runId: piece.runId, via: 'advance', error: error instanceof Error ? error.message : String(error) }); } catch { /* fail-soft */ }
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const all = readTaskAgentState<{ tasks?: Record<string, TaskCard> }>(path).tasks ?? {};
|
|
374
|
+
const mission = all[missionId];
|
|
375
|
+
if (!mission?.pieces) throw new Error(`미션 카드가 아니다: ${missionId}`);
|
|
376
|
+
const missing = mission.pieces.filter((id) => !all[id]);
|
|
377
|
+
if (missing.length) throw new Error(`조각 카드 없음: ${missing.join(', ')} — 선후 기록이 불완전하다`);
|
|
378
|
+
const pieces = mission.pieces.map((id) => all[id]!);
|
|
379
|
+
if (mission.greenProposal) {
|
|
380
|
+
// 제안이 끝난 미션은 다시 조회하지도 넘기지도 않는다 — 재조회 실패(pending)가 착지한 조각을 재발사하게 하지 않는다.
|
|
381
|
+
return { missionId, mode, evidence: {}, landed: [], ready: [], handed: [], skipped: [], green: 'already-proposed' };
|
|
382
|
+
}
|
|
383
|
+
const evidence = await collectPieceEvidence(pieces, opts.readEvidence);
|
|
384
|
+
const landed = landedPieces(mission, evidence);
|
|
385
|
+
const ready = readyPieces(pieces, landed);
|
|
386
|
+
const handed: AdvancedPiece[] = [];
|
|
387
|
+
const skipped: string[] = [];
|
|
388
|
+
for (const pieceId of ready) {
|
|
389
|
+
const card = all[pieceId]!;
|
|
390
|
+
// 자기 PR·골 근거가 이미 있는 조각은 런이 있었다 — 재조회가 pending 이어도 다시 넘기지 않는다.
|
|
391
|
+
if (!(card.after ?? []).length || alreadyHanded(card, mode) || card.pr !== undefined || card.goalId !== undefined) { skipped.push(pieceId); continue; }
|
|
392
|
+
const mark: NonNullable<TaskCard['handed']> = { at: clock().toISOString(), mode, claim: randomBytes(6).toString('hex') };
|
|
393
|
+
const claim: { card?: TaskCard } = {};
|
|
394
|
+
updateTaskCard(path, pieceId, (current) => {
|
|
395
|
+
if (!current || alreadyHanded(current, mode) || current.pr !== undefined || current.goalId !== undefined) return undefined;
|
|
396
|
+
claim.card = { ...current, handed: mark };
|
|
397
|
+
return claim.card;
|
|
398
|
+
});
|
|
399
|
+
const claimed = claim.card;
|
|
400
|
+
if (!claimed) { skipped.push(pieceId); continue; }
|
|
401
|
+
let result: AdvancedPiece;
|
|
402
|
+
try {
|
|
403
|
+
const out = await handTask({
|
|
404
|
+
text: claimed.text, id: pieceId, mission: missionId, after: claimed.after ?? [], landed,
|
|
405
|
+
...(claimed.seat ? { seat: claimed.seat } : {}), ...(claimed.checklistId ? { checklistId: claimed.checklistId } : {}),
|
|
406
|
+
cardFields: { handed: mark, ...(claimed.pr !== undefined ? { pr: claimed.pr } : {}), ...(claimed.goalId !== undefined ? { goalId: claimed.goalId } : {}) },
|
|
407
|
+
live: mode === 'live', statePath: path, ...(opts.launcher ? { launcher: opts.launcher } : {}), ...(opts.now ? { now: opts.now } : {}),
|
|
408
|
+
// claim 을 가진 동안만 쓴다 — 늦게 끝난 shadow 넘김이 live 표지·발사 기록을 덮지 않게.
|
|
409
|
+
writeGuard: (current) => current?.handed?.claim === mark.claim,
|
|
410
|
+
});
|
|
411
|
+
result = { pieceId, launched: out.launched, move: out.move.kind };
|
|
412
|
+
} catch (error) {
|
|
413
|
+
if (error instanceof TaskCardSupersededError) { skipped.push(pieceId); continue; }
|
|
414
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
415
|
+
// 발사 실패면 handTask 가 launch-failed 로 적었다 — 표지에 사유를 덧붙여 다시 넘기지 않는다(판단부 몫).
|
|
416
|
+
updateTaskCard(path, pieceId, (current) => current && current.handed?.claim === mark.claim ? { ...current, handed: { ...mark, error: reason } } : undefined);
|
|
417
|
+
result = { pieceId, launched: false, move: 'launch', error: reason };
|
|
418
|
+
}
|
|
419
|
+
handed.push(result);
|
|
420
|
+
try { debug.log('task-agent', 'mission-piece-handed', { missionId, pieceId, after: claimed.after ?? [], mode, launched: result.launched, ...(result.error ? { error: result.error } : {}) }); } catch { /* fail-soft */ }
|
|
421
|
+
}
|
|
422
|
+
let green: AdvanceMissionResult['green'] = 'not-yet';
|
|
423
|
+
if (missionLanded(mission, landed)) {
|
|
424
|
+
const proposal = {
|
|
425
|
+
at: clock().toISOString(),
|
|
426
|
+
checklistId: mission.checklistId ?? null,
|
|
427
|
+
evidence: Object.fromEntries(pieces.map((piece) => { const ref = pieceRef(piece); return [piece.id, typeof ref === 'number' ? `#${ref}` : `goal:${ref}`]; })),
|
|
428
|
+
};
|
|
429
|
+
const wrote = { proposed: false, stale: false };
|
|
430
|
+
updateTaskCard(path, missionId, (current, tasks) => {
|
|
431
|
+
if (!current || current.greenProposal) return undefined;
|
|
432
|
+
// 조회에 쓴 근거가 잠금 안에서도 그대로일 때만 — 조회 도중 근거가 바뀌었으면 다음 호출이 다시 본다.
|
|
433
|
+
if (pieces.some((piece) => { const now = tasks[piece.id]; return (now ? cardPrNumber(now) : undefined) !== cardPrNumber(piece) || now?.goalId !== piece.goalId; })) { wrote.stale = true; return undefined; }
|
|
434
|
+
wrote.proposed = true;
|
|
435
|
+
return { ...current, greenProposal: proposal };
|
|
436
|
+
});
|
|
437
|
+
green = wrote.proposed ? 'proposed' : wrote.stale ? 'not-yet' : 'already-proposed';
|
|
438
|
+
if (wrote.proposed) {
|
|
439
|
+
try { debug.log('task-agent', 'mission-green-proposed', { missionId, checklist: mission.checklistId ?? null, evidence: proposal.evidence }); } catch { /* fail-soft */ }
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return { missionId, mode, evidence, landed: [...landed], ready, handed, skipped, green };
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/** `--all` 의 대상 — green 제안이 아직 없는 미션 카드 id. */
|
|
446
|
+
export function openMissionIds(statePath = taskAgentStatePath()): string[] {
|
|
447
|
+
const all = readTaskAgentState<{ tasks?: Record<string, TaskCard> }>(statePath).tasks ?? {};
|
|
448
|
+
return Object.values(all).filter((card) => card.pieces && !card.greenProposal).map((card) => card.id).sort();
|
|
449
|
+
}
|