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,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TASK-AGENT-SHADOW — 슈퍼바이저가 런의 멈춤을 확정한 자리에서 판단부를 «그림자»로 부른다.
|
|
3
|
+
*
|
|
4
|
+
* RFC-task-agent-any-task-to-completion-2026-10-06 §A9 «판단부 호출부 0»을 메운다.
|
|
5
|
+
* - 입력은 슈퍼바이저 결과에 «이미 실려 있는» 값만 쓴다(네트워크 호출 0): 종료 어휘 ·
|
|
6
|
+
* PR 번호/병합 여부(`prNumber`·`merged`). 리뷰 판정·must-fix 는 결과에 없으므로 비운다
|
|
7
|
+
* («통과»로 읽지 않는다 — 판단부가 review 수를 고른다).
|
|
8
|
+
* - 슈퍼바이저의 기본 호출은 shadow: «했을 수»만 기록하고 명령·복사는 하나도 돌리지 않는다.
|
|
9
|
+
* 전달 과제의 명시적 live 호출만 파일을 복사한다. 설정 `taskAgent.mode=live` 는 기본 호출에 먹지 않는다.
|
|
10
|
+
* - 관측: `debug.log('task-agent', 'shadow-move', …)` → `elanous logs --category task-agent`.
|
|
11
|
+
*/
|
|
12
|
+
import { lstatSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
|
|
13
|
+
import { extname, join, relative, resolve } from 'node:path';
|
|
14
|
+
import { debug } from '../debug/log.js';
|
|
15
|
+
import { readTaskAgentState, readTaskCard, taskAgentStatePath, type CompletionKind, type TaskCard } from './task-hand.js';
|
|
16
|
+
import type { SupervisorJobResult, SupervisorStopReason } from '../self-dev/run-supervisor.js';
|
|
17
|
+
import { executeNextAction, type DeliveryKind, type NextAction } from './actions.js';
|
|
18
|
+
import { judgeNextMove, type TaskJudgeInput, type TaskJudgement } from './judge.js';
|
|
19
|
+
import { configuredTaskAgentLiveMoves, executeLiveGreenProposal, executeLiveReview, type LiveMoveDeps, type LiveMoveResult, type TaskAgentLiveMove } from './live-moves.js';
|
|
20
|
+
|
|
21
|
+
export interface TaskAgentShadowInput {
|
|
22
|
+
runId: string | null;
|
|
23
|
+
stopReason: SupervisorStopReason;
|
|
24
|
+
results: readonly SupervisorJobResult[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TaskAgentShadowMove {
|
|
28
|
+
runId: string | null;
|
|
29
|
+
stopReason: SupervisorStopReason;
|
|
30
|
+
move: TaskJudgement['move'];
|
|
31
|
+
executorKind: TaskJudgement['executorKind'] | null;
|
|
32
|
+
variant: TaskJudgement['executorVariant'] | null;
|
|
33
|
+
reason: string;
|
|
34
|
+
/** 실행부 결과 — 기본 shadow 경로에서는 'shadow'(실행부 밖의 수면 null). */
|
|
35
|
+
executorResult: string | null;
|
|
36
|
+
/** 실행부가 남긴 «했을 수» 문면. */
|
|
37
|
+
wouldDo: string | null;
|
|
38
|
+
pr: number | null;
|
|
39
|
+
/** TA-JUDGE-LIVE-SAFE — `taskAgent.liveMoves` 가 이 수를 실제로 했을 때만 실린다(없으면 종전 그대로 그림자). */
|
|
40
|
+
liveMove?: LiveMoveResult;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface TaskAgentShadowDeps {
|
|
44
|
+
log?: (category: string, event: string, data: Record<string, unknown>) => void;
|
|
45
|
+
/** 시험용 — shadow 실행부가 명령을 부르면 여기로 온다(정상이면 0회). */
|
|
46
|
+
command?: (args: string[]) => Promise<{ status: number; stdout: string; stderr?: string }>;
|
|
47
|
+
readCard?: (taskId: string) => TaskCard | undefined;
|
|
48
|
+
/** Explicit live invocation only; supervisor's default hook always uses shadow. */
|
|
49
|
+
mode?: 'shadow' | 'live';
|
|
50
|
+
/** TA-JUDGE-LIVE-SAFE — 실제로 할 안전한 수(`review`·`propose-green`). 비면 설정 `taskAgent.liveMoves` 를 읽는다. */
|
|
51
|
+
liveMoves?: ReadonlySet<TaskAgentLiveMove>;
|
|
52
|
+
/** live 수의 부작용(리뷰 띄우기·PR 머리 조회·상태 파일) — 시험은 주입한다. */
|
|
53
|
+
live?: LiveMoveDeps;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 파일 산출물로 전달(elanous-out)하는 종결 종류 — 그 밖의 code-pr 밖 종류는 확인 증거를 판단부에서 기다린다. */
|
|
57
|
+
const DELIVERY_KINDS: ReadonlySet<CompletionKind> = new Set<CompletionKind>(['research-report', 'artifact', 'content']);
|
|
58
|
+
function isDeliveryKind(kind: CompletionKind | undefined): kind is DeliveryKind {
|
|
59
|
+
return kind !== undefined && DELIVERY_KINDS.has(kind);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 슈퍼바이저 결과에서 판단부 입력을 만든다 — 추가 조회 없이 이미 실린 값만.
|
|
64
|
+
* `completion` 은 카드의 종결 종류(§A4b③) — 있으면 판단부 입력에 싣는다(비면 종전 입력 그대로).
|
|
65
|
+
*/
|
|
66
|
+
export function shadowJudgeInput(stopReason: SupervisorStopReason, results: readonly SupervisorJobResult[], completion?: CompletionKind): TaskJudgeInput {
|
|
67
|
+
const withPr = results.filter((result) => typeof result.prNumber === 'number' && result.prNumber > 0);
|
|
68
|
+
const input: TaskJudgeInput = { stopReason };
|
|
69
|
+
if (completion !== undefined) input.completion = completion;
|
|
70
|
+
if (withPr.length > 0) {
|
|
71
|
+
input.pr = withPr[0]!.prNumber!;
|
|
72
|
+
// 병합 여부만 결과에 실린다 — 닫힘(CLOSED)은 여기서 모른다. 병합이 아니면 OPEN 으로 둔다(판단부는 MERGED 만 본다).
|
|
73
|
+
input.prState = withPr.every((result) => result.merged === true) ? 'MERGED' : 'OPEN';
|
|
74
|
+
}
|
|
75
|
+
return input;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function selectDeliveryCandidates(worktreePath: string, kind: DeliveryKind): string[] {
|
|
79
|
+
const allowed = kind === 'research-report' ? new Set(['.md']) : new Set(['.md', '.html', '.pdf', '.png', '.pptx']);
|
|
80
|
+
try {
|
|
81
|
+
const root = realpathSync(worktreePath);
|
|
82
|
+
const gitMarker = join(root, '.git');
|
|
83
|
+
let gitPointer = '';
|
|
84
|
+
try { if (lstatSync(gitMarker).isFile()) gitPointer = readFileSync(gitMarker, 'utf8').trim(); }
|
|
85
|
+
catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error; }
|
|
86
|
+
const gitDir = gitPointer.startsWith('gitdir: ') ? resolve(root, gitPointer.slice(8)) : gitMarker;
|
|
87
|
+
const commonPointer = join(gitDir, 'commondir');
|
|
88
|
+
const sharedDir = (() => { try { return resolve(gitDir, readFileSync(commonPointer, 'utf8').trim()); } catch { return gitDir; } })();
|
|
89
|
+
let index: Buffer;
|
|
90
|
+
try { index = readFileSync(join(gitDir, 'index')); }
|
|
91
|
+
catch (error) {
|
|
92
|
+
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
|
|
93
|
+
index = Buffer.alloc(12);
|
|
94
|
+
index.write('DIRC');
|
|
95
|
+
index.writeUInt32BE(2, 4);
|
|
96
|
+
}
|
|
97
|
+
const tracked = new Set<string>();
|
|
98
|
+
if (index.toString('ascii', 0, 4) !== 'DIRC' || ![2, 3].includes(index.readUInt32BE(4))) return [];
|
|
99
|
+
let offset = 12;
|
|
100
|
+
const count = index.readUInt32BE(8);
|
|
101
|
+
for (let i = 0; i < count; i++) {
|
|
102
|
+
const start = offset;
|
|
103
|
+
const flags = index.readUInt16BE(start + 60);
|
|
104
|
+
offset = start + 62;
|
|
105
|
+
if (flags & 0x4000) offset += 2;
|
|
106
|
+
const end = index.indexOf(0, offset);
|
|
107
|
+
if (end < 0) return [];
|
|
108
|
+
tracked.add(index.toString('utf8', offset, end));
|
|
109
|
+
offset = start + Math.ceil((end + 1 - start) / 8) * 8;
|
|
110
|
+
}
|
|
111
|
+
const ignored = (() => {
|
|
112
|
+
try { return readFileSync(join(root, '.gitignore'), 'utf8').split(/\r?\n/).map(line => line.trim()).filter(line => line && !line.startsWith('#')); }
|
|
113
|
+
catch { return [] as string[]; }
|
|
114
|
+
})();
|
|
115
|
+
const excluded = (() => {
|
|
116
|
+
try { return readFileSync(join(sharedDir, 'info', 'exclude'), 'utf8').split(/\r?\n/).map(line => line.trim()).filter(line => line && !line.startsWith('#')); }
|
|
117
|
+
catch { return [] as string[]; }
|
|
118
|
+
})();
|
|
119
|
+
const isIgnored = (name: string): boolean => [...ignored, ...excluded].some(pattern => {
|
|
120
|
+
const rule = pattern.replace(/^\//, '').replace(/\/$/, '');
|
|
121
|
+
if (rule.includes('*')) return new RegExp(`^${rule.split('*').map(part => part.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')).join('.*')}$`).test(name);
|
|
122
|
+
return name === rule || name.startsWith(rule + '/') || name.split('/').includes(rule);
|
|
123
|
+
});
|
|
124
|
+
const candidates: string[] = [];
|
|
125
|
+
const walk = (dir: string): void => {
|
|
126
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
127
|
+
if (entry.name === '.git' || entry.name === 'node_modules') continue;
|
|
128
|
+
const file = join(dir, entry.name);
|
|
129
|
+
const name = relative(root, file);
|
|
130
|
+
if (isIgnored(name)) continue;
|
|
131
|
+
if (entry.isDirectory()) { walk(file); continue; }
|
|
132
|
+
if (!entry.isFile()) continue;
|
|
133
|
+
if (allowed.has(extname(name).toLowerCase()) && !tracked.has(name) && lstatSync(file).isFile() && realpathSync(file) === file) candidates.push(name);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
walk(root);
|
|
137
|
+
return candidates.sort();
|
|
138
|
+
} catch { return []; }
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** shadow-move 관측의 종결 종류 — 읽은 카드만 «비면 code-pr» 로 풀고, 조회 실패는 'unmeasured', 카드를 안 봤으면 null. */
|
|
142
|
+
function shadowCompletion(card: TaskCard | undefined, lookupFailed: boolean): CompletionKind | 'unmeasured' | null {
|
|
143
|
+
if (card) return card.completion ?? 'code-pr';
|
|
144
|
+
return lookupFailed ? 'unmeasured' : null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export async function recordTaskAgentShadowMove(input: TaskAgentShadowInput, deps: TaskAgentShadowDeps = {}): Promise<TaskAgentShadowMove> {
|
|
148
|
+
const successful = input.results.find(result => result.ok === true && result.worktreePath);
|
|
149
|
+
let card: TaskCard | undefined;
|
|
150
|
+
let cardLookupFailed = false;
|
|
151
|
+
try {
|
|
152
|
+
card = successful ? (deps.readCard ?? readTaskCard)(successful.taskId) : undefined;
|
|
153
|
+
if (!card && successful && !deps.readCard) {
|
|
154
|
+
const tasks = readTaskAgentState<{ tasks?: Record<string, TaskCard> }>(taskAgentStatePath()).tasks ?? {};
|
|
155
|
+
const matches = Object.values(tasks).filter(candidate => candidate.status === 'launched' && candidate.text === successful.feature);
|
|
156
|
+
if (matches.length === 1) card = matches[0];
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
// Card lookup is optional; preserve the original PR judgement when unavailable — but mark the completion kind as unmeasured.
|
|
160
|
+
cardLookupFailed = true;
|
|
161
|
+
}
|
|
162
|
+
const kind = card?.completion;
|
|
163
|
+
const judgeInput = shadowJudgeInput(input.stopReason, input.results, kind);
|
|
164
|
+
const delivery = successful?.worktreePath && card?.project?.target && isDeliveryKind(kind)
|
|
165
|
+
? { kind, worktreePath: successful.worktreePath, projectTarget: card.project.target, files: selectDeliveryCandidates(successful.worktreePath, kind) }
|
|
166
|
+
: undefined;
|
|
167
|
+
const judgement: TaskJudgement = delivery
|
|
168
|
+
? delivery.files.length
|
|
169
|
+
? { move: 'wait', stage: 'observing', reason: '전달 후보 확인 — 산출물 판독 대기', executorKind: 'deliver' }
|
|
170
|
+
: { move: 'wait', stage: 'waiting', reason: '전달 후보 없음' }
|
|
171
|
+
: judgeNextMove(judgeInput);
|
|
172
|
+
if (cardLookupFailed) judgement.reason = `${judgement.reason} · 종결 종류 미확인(카드 조회 실패)`;
|
|
173
|
+
let executorResult: string | null = null;
|
|
174
|
+
let wouldDo: string | null = null;
|
|
175
|
+
if (judgement.executorKind) {
|
|
176
|
+
const action: NextAction = {
|
|
177
|
+
kind: judgement.executorKind,
|
|
178
|
+
...(judgement.executorVariant ? { variant: judgement.executorVariant } : {}),
|
|
179
|
+
taskId: delivery ? card!.id : input.runId ?? 'run-unknown',
|
|
180
|
+
rationale: judgement.reason,
|
|
181
|
+
pr: delivery ? 0 : typeof judgeInput.pr === 'number' ? judgeInput.pr : 0,
|
|
182
|
+
runId: input.runId ?? '',
|
|
183
|
+
original: [...new Set(input.results.map((result) => result.feature))].join(' · '),
|
|
184
|
+
checklistId: delivery ? card?.checklistId ?? '' : '',
|
|
185
|
+
...(delivery ? { delivery } : {}),
|
|
186
|
+
};
|
|
187
|
+
executorResult = await executeNextAction(action, {
|
|
188
|
+
mode: delivery ? (deps.mode ?? 'shadow') : 'shadow',
|
|
189
|
+
command: deps.command ?? (async () => { throw new Error('task-agent shadow path must not run commands'); }),
|
|
190
|
+
observe: (_event, data) => { wouldDo = data.reason; },
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const move: TaskAgentShadowMove = {
|
|
194
|
+
runId: input.runId,
|
|
195
|
+
stopReason: input.stopReason,
|
|
196
|
+
move: judgement.move,
|
|
197
|
+
executorKind: judgement.executorKind ?? null,
|
|
198
|
+
variant: judgement.executorVariant ?? null,
|
|
199
|
+
reason: judgement.reason,
|
|
200
|
+
executorResult,
|
|
201
|
+
wouldDo,
|
|
202
|
+
pr: delivery ? null : typeof judgeInput.pr === 'number' ? judgeInput.pr : null,
|
|
203
|
+
};
|
|
204
|
+
if (delivery && deps.mode !== 'live') {
|
|
205
|
+
move.wouldDo = `${move.wouldDo ?? 'would wait'} → ${join(delivery.projectTarget, 'elanous-out', card!.id)} (${delivery.files.join(', ')})`;
|
|
206
|
+
}
|
|
207
|
+
if (delivery && deps.mode === 'live') {
|
|
208
|
+
move.move = executorResult === 'done' ? 'propose-green' : 'wait';
|
|
209
|
+
move.reason = wouldDo ?? judgement.reason;
|
|
210
|
+
move.wouldDo = null;
|
|
211
|
+
}
|
|
212
|
+
const liveKind: TaskAgentLiveMove | null = move.move === 'review' || move.move === 'propose-green' ? move.move : null;
|
|
213
|
+
// 판단마다 해석한다 — 안전하지 않은 수를 판단할 때도 모르는 항목 경고가 남게(실행은 아래 두 수뿐).
|
|
214
|
+
const liveMoves = deps.liveMoves ?? await configuredTaskAgentLiveMoves();
|
|
215
|
+
const live = liveKind !== null && liveMoves.has(liveKind);
|
|
216
|
+
// 카드 id 는 모든 판단 관측에 싣는다(그림자 일치율을 카드로 잇는다) — 읽기 전용 조회.
|
|
217
|
+
// live 수는 «근거 결과»에 묶는다 — PR 수는 그 PR 을 낸 결과의 카드·작업 트리, 전달은 전달한 카드(다중 결과에서 남의 카드에 쓰지 않게).
|
|
218
|
+
const prResult = typeof judgeInput.pr === 'number' ? input.results.find((result) => result.prNumber === judgeInput.pr) : undefined;
|
|
219
|
+
const boundCard = delivery
|
|
220
|
+
? card
|
|
221
|
+
: prResult
|
|
222
|
+
? (card && successful?.taskId === prResult.taskId ? card : liveCardFor([prResult], deps))
|
|
223
|
+
: undefined;
|
|
224
|
+
// PR 에 묶인 수는 그 PR 의 카드만 관측에 싣는다(못 찾으면 null — 다른 결과의 카드로 대체하지 않는다).
|
|
225
|
+
const liveCard = prResult || delivery ? boundCard : card ?? (cardLookupFailed ? undefined : liveCardFor(input.results, deps));
|
|
226
|
+
let liveMove: LiveMoveResult | undefined;
|
|
227
|
+
if (live) {
|
|
228
|
+
if (liveKind === 'review') {
|
|
229
|
+
liveMove = await executeLiveReview(boundCard, prResult?.prNumber,
|
|
230
|
+
{ runId: input.runId, stopReason: input.stopReason, ...(prResult?.worktreePath ? { cwd: prResult.worktreePath } : {}) }, { ...(deps.log ? { log: deps.log } : {}), ...deps.live });
|
|
231
|
+
} else {
|
|
232
|
+
const evidence: Record<string, string> = {};
|
|
233
|
+
if (boundCard && !delivery && judgeInput.prState === 'MERGED' && prResult) evidence[boundCard.id] = `#${prResult.prNumber}`;
|
|
234
|
+
else if (boundCard && delivery && deps.mode === 'live' && executorResult === 'done') evidence[boundCard.id] = join(delivery.projectTarget, 'elanous-out', boundCard.id);
|
|
235
|
+
liveMove = executeLiveGreenProposal(boundCard, evidence, { ...(deps.log ? { log: deps.log } : {}), ...deps.live });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
// 판단한 수마다 live/shadow 를 남긴다 — OP 가 «오판 건수»·«그림자 일치율»을 카드·수 종류로 잰다.
|
|
239
|
+
(deps.log ?? ((category, event, data) => debug.log(category, event, data)))('task-agent', 'shadow-move', {
|
|
240
|
+
...move, completion: shadowCompletion(card, cardLookupFailed), card: liveCard?.id ?? null, live, liveExecuted: liveMove?.executed ?? false, ...(liveMove ? { liveOk: liveMove.ok } : {}),
|
|
241
|
+
});
|
|
242
|
+
return liveMove ? { ...move, liveMove } : move;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** live 수의 카드 — 성공한 결과가 없어도(수확 가능 런은 ok 가 아닐 수 있다) 결과의 taskId · 유일한 발사 문장으로 찾는다. */
|
|
246
|
+
function liveCardFor(results: readonly SupervisorJobResult[], deps: TaskAgentShadowDeps): TaskCard | undefined {
|
|
247
|
+
try {
|
|
248
|
+
for (const result of results) {
|
|
249
|
+
const found = deps.readCard ? deps.readCard(result.taskId) : readTaskCard(result.taskId, deps.live?.statePath);
|
|
250
|
+
if (found) return found;
|
|
251
|
+
}
|
|
252
|
+
if (deps.readCard) return undefined;
|
|
253
|
+
const tasks = readTaskAgentState<{ tasks?: Record<string, TaskCard> }>(deps.live?.statePath ?? taskAgentStatePath()).tasks ?? {};
|
|
254
|
+
const features = new Set(results.map((result) => result.feature));
|
|
255
|
+
const matches = Object.values(tasks).filter(candidate => candidate.status === 'launched' && features.has(candidate.text));
|
|
256
|
+
return matches.length === 1 ? matches[0] : undefined;
|
|
257
|
+
} catch { return undefined; }
|
|
258
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TASK-AGENT 과제 넘기기 문 — `elanous task hand "<한 줄>"` (RFC-task-agent-any-task-to-completion §A9 표 1행 · R3).
|
|
3
|
+
*
|
|
4
|
+
* - 과제 카드를 실행부와 «같은» 상태 파일(`effectiveInstanceRoot()/task-agent-actions.json`)의 `tasks` 칸에 적는다.
|
|
5
|
+
* 종전 칸(landingDay·landingsToday·failureCounts)은 그대로 두고 덧붙이기만 한다(하위 호환 — 실행부 쓰기는 `...disk` 로 보존).
|
|
6
|
+
* - 첫 수는 «launch» = `harness say [--seat <자리>] --substrate pod --merge-by-host "<원문>"`.
|
|
7
|
+
* - 기본은 SHADOW: 카드와 명령만 남기고 아무것도 띄우지 않는다. `--live` 일 때만 주입된 launcher 로 띄운다.
|
|
8
|
+
* - 관측: `debug.log('task-agent', 'handed', {taskId, seat, checklistId, mode})`.
|
|
9
|
+
*/
|
|
10
|
+
import { execFileSync } from 'node:child_process';
|
|
11
|
+
import { randomBytes } from 'node:crypto';
|
|
12
|
+
import { mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import { dirname, join, resolve } from 'node:path';
|
|
14
|
+
import { resolveDaemonHarnessTarget } from '../intake-plane/harness-target.js';
|
|
15
|
+
import { HARNESS_RUN_ID_ENV, mintRunId, normalizeRunId } from '../harness/harness-space.js';
|
|
16
|
+
import { debug } from '../debug/log.js';
|
|
17
|
+
import { effectiveInstanceRoot } from '../instance/resolve.js';
|
|
18
|
+
import { withFileLockSync } from '../storage/file-lock.js';
|
|
19
|
+
|
|
20
|
+
export const TASK_SEATS = ['OP', 'TC', 'MK', 'UX'] as const;
|
|
21
|
+
export type TaskSeat = typeof TASK_SEATS[number];
|
|
22
|
+
/** 과제 카드 id 접두 — `task show <id>` 가 이 접두로 TOX 태스크와 갈린다. */
|
|
23
|
+
export const TASK_CARD_PREFIX = 'ta-';
|
|
24
|
+
/**
|
|
25
|
+
* 과제 종결 종류(RFC-loop-agent-map §A4b③) — 비면 code-pr(PR 병합)로 읽는다.
|
|
26
|
+
* code-pr 밖의 종류는 «확인 증거»(`judge.ts` TaskJudgeInput.evidence)로 종결한다 — 증거를 만드는 일은 DEFAULT-HANDS 몫.
|
|
27
|
+
*/
|
|
28
|
+
export const COMPLETION_KINDS = ['code-pr', 'artifact', 'research-report', 'ops-action', 'content', 'watch-brief', 'decision-support'] as const;
|
|
29
|
+
export type CompletionKind = typeof COMPLETION_KINDS[number];
|
|
30
|
+
|
|
31
|
+
/** `run-bound`·`goal-bound`·`pr-bound` 은 runId(⊕ pr)를 싣는다 — 옛 카드의 칸은 at·event·detail 뿐이다. */
|
|
32
|
+
export interface TaskCardEvent { at: string; event: string; detail?: string; runId?: string; pr?: number }
|
|
33
|
+
export interface TaskCardMove { kind: 'launch' | 'wait'; command?: string[]; reason: string }
|
|
34
|
+
export interface TaskCard {
|
|
35
|
+
id: string;
|
|
36
|
+
text: string;
|
|
37
|
+
seat?: TaskSeat;
|
|
38
|
+
checklistId?: string;
|
|
39
|
+
/** 종결 종류 — 비면 code-pr. */
|
|
40
|
+
completion?: CompletionKind;
|
|
41
|
+
/** 과제 대상 프로젝트(§A4b②) — target 은 절대 경로(git 이 아닐 수 있다). id 는 `task hand --project` 가 싣는다(옛 카드엔 없을 수 있다). */
|
|
42
|
+
project?: { id?: string; target: string };
|
|
43
|
+
/** 보드(§A4b① `board.ts`) 소속 — 목표 id · 이정표 id(`task hand --goal/--milestone`). 조각 카드의 `goalId`(골 sha 16자)와 다른 칸이다. */
|
|
44
|
+
goal?: string;
|
|
45
|
+
milestone?: string;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
/** launch-failed = 발사기가 띄우기에 실패했다(사유는 history 마지막 칸) — 다음 수는 다시 발사. */
|
|
48
|
+
status: 'handed' | 'launched' | 'launch-failed';
|
|
49
|
+
history: TaskCardEvent[];
|
|
50
|
+
/** 미션 카드만 — 조각 카드 id(순서대로) · 쪼갠 출처(`mission.ts` splitMission). */
|
|
51
|
+
pieces?: string[];
|
|
52
|
+
splitSource?: string;
|
|
53
|
+
/** 조각 카드만 — 소속 미션 카드 id · 먼저 착지해야 하는 조각 id(선후). */
|
|
54
|
+
mission?: string;
|
|
55
|
+
after?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* 이 카드 런이 연 PR · 골 id(16자). 두 출처가 한 칸을 쓴다(UX LOOP-INTERACT 계약 — card.runId → goalId):
|
|
58
|
+
* - 수동(② `tasks advance --pr|--goal` · 미션 조각만) — PR 은 번호(number) · `refSource: 'manual'`.
|
|
59
|
+
* - 런 원장 묶기(TA-CARD-RUN-LINK `card-evidence.ts`) — PR 은 `{number, url}` · 비어 있을 때만 «한 번» 채운다 · 수동 근거를 덮지 않는다.
|
|
60
|
+
* 번호는 `cardPrNumber` 로 읽는다(옛 카드의 number 도 그대로 읽힌다).
|
|
61
|
+
*/
|
|
62
|
+
pr?: number | TaskCardPr;
|
|
63
|
+
goalId?: string;
|
|
64
|
+
/** `manual` = pr/goalId 를 사람이 적었다(`recordPieceRef`) — 런 묶기가 건드리지 않는다. */
|
|
65
|
+
refSource?: 'manual';
|
|
66
|
+
/** 조각 카드만 — ② 가 선행 착지 뒤 넘겼다(한 번만 · 같은 잠금 안에서 먼저 적는다). */
|
|
67
|
+
handed?: { at: string; mode: 'shadow' | 'live'; claim?: string; error?: string };
|
|
68
|
+
/**
|
|
69
|
+
* TA-CARD-RUN-LINK — `--live` 발사가 발사기에 넘긴 런 id(`ELANOUS_RUN_ID` 상속 → 하니스 런이 그 id 로 돈다) ⊕ 발사 토큰.
|
|
70
|
+
* 발사기가 그 id 를 «받았다»고 돌려줄 때만 적는다(한 번만). 원장이 아직 없으면 그 런은 시작 전이거나 대기열로 갔다.
|
|
71
|
+
*/
|
|
72
|
+
runId?: string;
|
|
73
|
+
launchId?: string;
|
|
74
|
+
/** Pod 런이면 PR 을 연 자식 런 id(런 묶기가 PR 과 함께 적는다). */
|
|
75
|
+
runChildId?: string;
|
|
76
|
+
/** 미션 카드만 — 모든 조각 착지 → 칸 green «제안»(체크리스트는 손대지 않는다 · OP/주인이 뒤집는다). */
|
|
77
|
+
greenProposal?: { at: string; checklistId: string | null; evidence: Record<string, string> };
|
|
78
|
+
/** TA-JUDGE-LIVE-SAFE — live `review` 수가 리뷰를 요청한 PR 머리들(머리마다 한 번 · 띄우기 실패면 error · 이력은 지우지 않는다). */
|
|
79
|
+
reviewRequests?: Array<{ pr: number; head: string; at: string; error?: string }>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** 런 원장에서 묶은 PR — url 은 원장(pr-opened · Pod job-finished)에 있을 때만(지어내지 않는다). */
|
|
83
|
+
export interface TaskCardPr { number: number; url?: string }
|
|
84
|
+
|
|
85
|
+
/** 카드의 PR 번호 — 수동(number)·묶음(`{number,url}`) 둘 다. */
|
|
86
|
+
export function cardPrNumber(card: Pick<TaskCard, 'pr'>): number | undefined {
|
|
87
|
+
return typeof card.pr === 'number' ? card.pr : card.pr?.number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface TaskAgentStateFile { tasks?: Record<string, TaskCard>; [key: string]: unknown }
|
|
91
|
+
|
|
92
|
+
function isGitWorkTree(path: string): boolean {
|
|
93
|
+
try {
|
|
94
|
+
return execFileSync('git', ['rev-parse', '--is-inside-work-tree'], { cwd: path, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() === 'true';
|
|
95
|
+
} catch { return false; }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function taskAgentStatePath(): string {
|
|
99
|
+
return join(effectiveInstanceRoot(), 'task-agent-actions.json');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** 상태 파일을 읽을 수 없거나(ENOENT 제외) 해석할 수 없다 — 덮어쓰기 전에 멈춘다. */
|
|
103
|
+
export class TaskAgentStateError extends Error {
|
|
104
|
+
constructor(path: string, cause: unknown) {
|
|
105
|
+
super(`task-agent 상태 파일을 읽을 수 없다 — 덮어쓰지 않고 멈춘다: ${path} (${cause instanceof Error ? cause.message : String(cause)})`);
|
|
106
|
+
this.name = 'TaskAgentStateError';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 실행부·과제 넘기기 문이 함께 쓰는 상태 파일(`task-agent-actions.json`)의 엄격한 읽기.
|
|
112
|
+
* 파일이 «없음»(ENOENT)만 빈 상태다. 그 밖의 읽기·해석 오류(손상된 JSON · 객체 아님 · 권한)는
|
|
113
|
+
* 던진다 — 빈 상태로 읽고 다시 쓰면 failureCounts·착지 기록·과제 카드가 지워진다.
|
|
114
|
+
*/
|
|
115
|
+
export function readTaskAgentState<T extends object = TaskAgentStateFile>(path: string): T {
|
|
116
|
+
let raw: string;
|
|
117
|
+
try { raw = readFileSync(path, 'utf8'); } catch (error) {
|
|
118
|
+
if ((error as NodeJS.ErrnoException)?.code === 'ENOENT') return {} as T;
|
|
119
|
+
return stateError(path, error);
|
|
120
|
+
}
|
|
121
|
+
let parsed: unknown;
|
|
122
|
+
try { parsed = JSON.parse(raw); } catch (error) { return stateError(path, error); }
|
|
123
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return stateError(path, new Error('최상위가 객체가 아니다'));
|
|
124
|
+
return parsed as T;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function stateError(path: string, cause: unknown): never {
|
|
128
|
+
const error = new TaskAgentStateError(path, cause);
|
|
129
|
+
try { debug.log('task-agent', 'state-unreadable', { path, reason: error.message }); } catch { /* fail-soft */ }
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function readState(path: string): TaskAgentStateFile {
|
|
134
|
+
return readTaskAgentState<TaskAgentStateFile>(path);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** 카드 여럿을 한 잠금 안에서 적는다(미션 ⊕ 조각) — 종전 칸은 `...disk` 로 보존. */
|
|
138
|
+
export function writeTaskCards(path: string, cards: readonly TaskCard[]): void {
|
|
139
|
+
withFileLockSync(`${path}.lock`, () => {
|
|
140
|
+
const disk = readState(path);
|
|
141
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
142
|
+
const tasks = { ...(disk.tasks ?? {}) };
|
|
143
|
+
for (const card of cards) tasks[card.id] = card;
|
|
144
|
+
writeFileSync(path, JSON.stringify({ ...disk, tasks }));
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** 카드 하나를 잠금 안에서 읽고 고쳐 쓴다 — `update` 가 undefined 를 돌려주면 쓰지 않는다. 쓴(또는 그대로인) 카드를 돌려준다. */
|
|
149
|
+
export function updateTaskCard(path: string, id: string, update: (card: TaskCard | undefined, tasks: Readonly<Record<string, TaskCard>>) => TaskCard | undefined): TaskCard | undefined {
|
|
150
|
+
return withFileLockSync(`${path}.lock`, () => {
|
|
151
|
+
const disk = readState(path);
|
|
152
|
+
const current = disk.tasks?.[id];
|
|
153
|
+
const next = update(current, disk.tasks ?? {});
|
|
154
|
+
if (!next) return current;
|
|
155
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
156
|
+
writeFileSync(path, JSON.stringify({ ...disk, tasks: { ...(disk.tasks ?? {}), [id]: next } }));
|
|
157
|
+
return next;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function readTaskCard(id: string, path = taskAgentStatePath()): TaskCard | undefined {
|
|
162
|
+
return readState(path).tasks?.[id];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** 첫 수의 elanous 인자(진입점·--config-dir 앞붙임은 launcher 몫). */
|
|
166
|
+
export function launchArgs(card: Pick<TaskCard, 'text' | 'seat'>): string[] {
|
|
167
|
+
return ['harness', 'say', ...(card.seat ? ['--seat', card.seat] : []), '--substrate', 'pod', '--merge-by-host', card.text];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `landed` = 착지한 조각 id(② 감지가 채운다). 안 주면 «모른다» — 선행은 미착지로 보고(fail-closed)
|
|
172
|
+
* 이유에 «착지 미확인»을 단다(착지했다/안 했다를 단정하지 않는다).
|
|
173
|
+
* 미션 카드는 스스로 발사하지 않는다 · 아직 안 뜬 조각의 선행이 덜 착지했으면 `wait after <id>`.
|
|
174
|
+
*/
|
|
175
|
+
export function nextMoveFor(card: TaskCard, landed?: ReadonlySet<string>): TaskCardMove {
|
|
176
|
+
if (card.pieces) return { kind: 'wait', reason: `미션 — 조각 ${card.pieces.length}장이 선후대로 발사된다` };
|
|
177
|
+
const unmet = (card.after ?? []).filter((id) => !landed?.has(id));
|
|
178
|
+
if (card.status !== 'launched' && unmet.length > 0) return { kind: 'wait', reason: `after ${unmet.join(', ')}${landed ? '' : ' · 착지 미확인'}` };
|
|
179
|
+
if (card.status === 'handed') return { kind: 'launch', command: launchArgs(card), reason: '넘겨받은 과제 — 첫 발사' };
|
|
180
|
+
if (card.status === 'launch-failed') return { kind: 'launch', command: launchArgs(card), reason: '직전 발사 실패 — 다시 발사' };
|
|
181
|
+
return { kind: 'wait', reason: '발사됨 — 런 멈춤을 슈퍼바이저 그림자 판단(task-agent.shadow-move)이 받는다' };
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function shellQuote(arg: string): string {
|
|
185
|
+
return /^[A-Za-z0-9_./:=@%+-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** 발사기에 넘기는 연결 — env(`ELANOUS_RUN_ID`)를 자식 환경에 얹으면 하니스 런이 `runId` 로 돈다(`resolveRunIdentity` 상속). launchId 는 카드에만 남는 발사 토큰이다. */
|
|
189
|
+
export interface TaskLaunchContext { runId: string; launchId: string; env: Record<string, string> }
|
|
190
|
+
/** 발사기가 «이 런 id 로 띄웠다»고 돌려주는 영수증 — 없으면 카드에 런 id 를 적지 않는다(추측하지 않는다). */
|
|
191
|
+
export interface TaskLaunchReceipt { runId?: string }
|
|
192
|
+
export type TaskLauncher = (args: string[], cwd?: string, context?: TaskLaunchContext) => void | TaskLaunchReceipt | Promise<void | TaskLaunchReceipt>;
|
|
193
|
+
|
|
194
|
+
export interface HandTaskOptions {
|
|
195
|
+
text: string;
|
|
196
|
+
seat?: TaskSeat;
|
|
197
|
+
checklistId?: string;
|
|
198
|
+
completion?: TaskCard['completion'];
|
|
199
|
+
/** `--project <id> --target <dir>` — target 은 존재 확인 뒤 절대 경로로 바꿔 싣는다. */
|
|
200
|
+
project?: { id: string; target: string };
|
|
201
|
+
/** 보드 소속 목표·이정표 id — 카드에 그대로 싣는다. */
|
|
202
|
+
goal?: string;
|
|
203
|
+
milestone?: string;
|
|
204
|
+
live?: boolean;
|
|
205
|
+
statePath?: string;
|
|
206
|
+
/** `--live` 일 때만 불린다. */
|
|
207
|
+
launcher?: TaskLauncher;
|
|
208
|
+
now?: () => Date;
|
|
209
|
+
id?: string;
|
|
210
|
+
/** 미션 조각으로 넘길 때 — 카드에 소속 미션·선후를 싣는다. */
|
|
211
|
+
mission?: string;
|
|
212
|
+
after?: string[];
|
|
213
|
+
/** 착지한 조각 id — `after` 가 모두 여기 있어야 발사한다(② 의 자리). */
|
|
214
|
+
landed?: ReadonlySet<string>;
|
|
215
|
+
/** 카드에 그대로 싣는 칸(② 의 넘김 표지·착지 근거) — handTask 가 카드를 새로 적을 때 지워지지 않게. */
|
|
216
|
+
cardFields?: Pick<TaskCard, 'pr' | 'goalId' | 'handed'>;
|
|
217
|
+
/**
|
|
218
|
+
* 있으면 카드 쓰기마다 잠금 안에서 디스크 카드를 보고 참일 때만 쓴다(② 의 claim 소유 확인).
|
|
219
|
+
* 거짓이면 쓰지 않고 `TaskCardSupersededError` — 다른 넘김이 그 카드를 가져갔다(발사 전이면 발사하지 않는다).
|
|
220
|
+
*/
|
|
221
|
+
writeGuard?: (current: TaskCard | undefined) => boolean;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** `writeGuard` 가 거짓 — 다른 넘김이 카드를 가져갔다. 카드는 건드리지 않았다. */
|
|
225
|
+
export class TaskCardSupersededError extends Error {
|
|
226
|
+
constructor(id: string) {
|
|
227
|
+
super(`과제 카드를 다른 넘김이 가져갔다 — 쓰지 않았다: ${id}`);
|
|
228
|
+
this.name = 'TaskCardSupersededError';
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** `--live` 발사가 실패했다 — 카드는 launch-failed 로 남았다. */
|
|
233
|
+
export class TaskLaunchError extends Error {
|
|
234
|
+
constructor(card: TaskCard, reason: string) {
|
|
235
|
+
super(`발사 실패 (${card.id} → launch-failed): ${reason}`);
|
|
236
|
+
this.name = 'TaskLaunchError';
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface HandTaskResult { card: TaskCard; move: TaskCardMove; mode: 'shadow' | 'live'; launched: boolean; cwd?: string }
|
|
241
|
+
|
|
242
|
+
export async function handTask(opts: HandTaskOptions): Promise<HandTaskResult> {
|
|
243
|
+
const text = opts.text.trim();
|
|
244
|
+
if (!text) throw new Error('과제 한 줄이 비어 있다');
|
|
245
|
+
if (opts.seat !== undefined && !TASK_SEATS.includes(opts.seat)) throw new Error(`자리는 ${TASK_SEATS.join('|')} 중 하나다: ${opts.seat}`);
|
|
246
|
+
if (opts.completion !== undefined && !COMPLETION_KINDS.includes(opts.completion)) throw new Error(`종결 종류는 ${COMPLETION_KINDS.join('|')} 중 하나다: ${opts.completion}`);
|
|
247
|
+
for (const [flag, value] of [['--goal', opts.goal], ['--milestone', opts.milestone]] as const) {
|
|
248
|
+
if (value !== undefined && (!value.trim() || /\p{Cc}/u.test(value))) throw new Error(`${flag} id 가 비었거나 제어 문자를 담았다: ${JSON.stringify(value)}`);
|
|
249
|
+
}
|
|
250
|
+
let project: TaskCard['project'];
|
|
251
|
+
let targetIsGit: boolean | null = null;
|
|
252
|
+
if (opts.project) {
|
|
253
|
+
if (!opts.project.id.trim()) throw new Error('--project id 가 비어 있다');
|
|
254
|
+
const target = resolve(opts.project.target);
|
|
255
|
+
let isDir = false;
|
|
256
|
+
try { isDir = statSync(target).isDirectory(); } catch { /* 없음 */ }
|
|
257
|
+
if (!isDir) throw new Error(`대상 디렉터리가 없습니다: ${target}`);
|
|
258
|
+
targetIsGit = isGitWorkTree(target);
|
|
259
|
+
// 코드 종결(code-pr · 비면 code-pr)은 git 대상만 — 그 밖의 종결 종류는 git 이 아닌 폴더도 받는다(같은 판정을 harness-target 과 공유).
|
|
260
|
+
const codeCompletion = (opts.completion ?? 'code-pr') === 'code-pr';
|
|
261
|
+
const selection = resolveDaemonHarnessTarget({ configured: target, cwd: target, isGitRepo: () => targetIsGit === true, allowNonGit: !codeCompletion });
|
|
262
|
+
if (!selection.ok) throw new Error(`코드 종결은 git 대상이 필요 — --completion 을 고르거나 git init: ${target}`);
|
|
263
|
+
project = { id: opts.project.id, target: selection.repo };
|
|
264
|
+
}
|
|
265
|
+
const now = (opts.now ?? (() => new Date()))();
|
|
266
|
+
const id = opts.id ?? `${TASK_CARD_PREFIX}${now.toISOString().slice(0, 10).replaceAll('-', '')}-${randomBytes(3).toString('hex')}`;
|
|
267
|
+
const mode = opts.live ? 'live' : 'shadow';
|
|
268
|
+
const path = opts.statePath ?? taskAgentStatePath();
|
|
269
|
+
const card: TaskCard = {
|
|
270
|
+
id, text,
|
|
271
|
+
...(opts.seat ? { seat: opts.seat } : {}),
|
|
272
|
+
...(opts.checklistId ? { checklistId: opts.checklistId } : {}),
|
|
273
|
+
...(opts.completion ? { completion: opts.completion } : {}),
|
|
274
|
+
...(project ? { project } : {}),
|
|
275
|
+
...(opts.goal ? { goal: opts.goal } : {}),
|
|
276
|
+
...(opts.milestone ? { milestone: opts.milestone } : {}),
|
|
277
|
+
createdAt: now.toISOString(),
|
|
278
|
+
status: 'handed',
|
|
279
|
+
history: [],
|
|
280
|
+
...(opts.mission ? { mission: opts.mission, after: [...(opts.after ?? [])] } : {}),
|
|
281
|
+
...(opts.cardFields ?? {}),
|
|
282
|
+
};
|
|
283
|
+
const move = nextMoveFor(card, opts.landed);
|
|
284
|
+
if (move.kind !== 'launch') throw new Error(`발사할 수 없는 과제다 — ${move.reason}`);
|
|
285
|
+
const guard = opts.writeGuard;
|
|
286
|
+
const writeCard = (target: string, next: TaskCard): void => {
|
|
287
|
+
if (!guard) { writeTaskCards(target, [next]); return; }
|
|
288
|
+
const owned = { ok: false };
|
|
289
|
+
// 착지 근거(pr·goalId)는 `recordPieceRef` 소유 — claim 뒤에 적힌 최신 근거를 디스크에서 이어 받는다.
|
|
290
|
+
updateTaskCard(target, next.id, (current) => {
|
|
291
|
+
if (!guard(current)) return undefined;
|
|
292
|
+
owned.ok = true;
|
|
293
|
+
// next 의 옛 근거는 버리고 디스크의 근거로 «교체»한다 — 정정된 근거 옆에 옛 근거가 되살아나지 않게.
|
|
294
|
+
const { pr: _stalePr, goalId: _staleGoal, refSource: _staleSource, ...base } = next;
|
|
295
|
+
return { ...base, ...(current?.pr !== undefined ? { pr: current.pr } : {}), ...(current?.goalId !== undefined ? { goalId: current.goalId } : {}), ...(current?.refSource ? { refSource: current.refSource } : {}) };
|
|
296
|
+
});
|
|
297
|
+
if (!owned.ok) throw new TaskCardSupersededError(next.id);
|
|
298
|
+
};
|
|
299
|
+
writeCard(path, card);
|
|
300
|
+
try { debug.log('task-agent', 'handed', { taskId: id, seat: card.seat ?? null, checklistId: card.checklistId ?? null, mode, projectId: project?.id ?? null, targetIsGit }); } catch { /* fail-soft */ }
|
|
301
|
+
if (mode === 'shadow') return { card, move, mode, launched: false, ...(project ? { cwd: project.target } : {}) };
|
|
302
|
+
if (!opts.launcher) throw new Error('--live 인데 launcher 가 없다');
|
|
303
|
+
const runId = mintRunId();
|
|
304
|
+
const launchId = `tl-${randomBytes(6).toString('hex')}`;
|
|
305
|
+
const context: TaskLaunchContext = { runId, launchId, env: { [HARNESS_RUN_ID_ENV]: runId } };
|
|
306
|
+
let receipt: void | TaskLaunchReceipt;
|
|
307
|
+
try {
|
|
308
|
+
receipt = await opts.launcher(move.command!, project?.target, context);
|
|
309
|
+
} catch (error) {
|
|
310
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
311
|
+
const failed: TaskCard = { ...card, status: 'launch-failed', history: [{ at: (opts.now ?? (() => new Date()))().toISOString(), event: 'launch-failed', detail: reason }] };
|
|
312
|
+
writeCard(path, failed);
|
|
313
|
+
try { debug.log('task-agent', 'launch-failed', { taskId: id, seat: card.seat ?? null, reason }); } catch { /* fail-soft */ }
|
|
314
|
+
throw new TaskLaunchError(failed, reason);
|
|
315
|
+
}
|
|
316
|
+
const launchedAt = (opts.now ?? (() => new Date()))().toISOString();
|
|
317
|
+
const receivedRunId = receipt && typeof receipt.runId === 'string' ? receipt.runId.trim() : '';
|
|
318
|
+
// 넘긴 런 id 와 «같은» 영수증만 — 다른 id 면 env 로 넘긴 런과 카드가 어긋난다(묶지 않는다).
|
|
319
|
+
const boundRunId = receivedRunId && receivedRunId === runId && normalizeRunId(receivedRunId) === receivedRunId ? receivedRunId : undefined;
|
|
320
|
+
if (receivedRunId && !boundRunId) {
|
|
321
|
+
try { debug.log('task-agent', 'card-run-unbound', { card: id, launchId, expected: runId, received: receivedRunId }); } catch { /* fail-soft */ }
|
|
322
|
+
}
|
|
323
|
+
const launched: TaskCard = {
|
|
324
|
+
...card, status: 'launched',
|
|
325
|
+
...(boundRunId ? { runId: boundRunId, launchId } : {}),
|
|
326
|
+
history: [
|
|
327
|
+
{ at: launchedAt, event: 'launch', detail: move.command!.join(' ') },
|
|
328
|
+
...(boundRunId ? [{ at: launchedAt, event: 'run-bound', detail: boundRunId, runId: boundRunId }] : []),
|
|
329
|
+
],
|
|
330
|
+
};
|
|
331
|
+
writeCard(path, launched);
|
|
332
|
+
try { debug.log('task-agent', 'launched', { taskId: id, seat: card.seat ?? null, runId: boundRunId ?? null }); } catch { /* fail-soft */ }
|
|
333
|
+
if (boundRunId) {
|
|
334
|
+
try { debug.log('task-agent', 'card-run-bound', { card: id, runId: boundRunId, launchId }); } catch { /* fail-soft */ }
|
|
335
|
+
}
|
|
336
|
+
return { card: launched, move, mode, launched: true, ...(project ? { cwd: project.target } : {}) };
|
|
337
|
+
}
|