elanous 0.2.11 → 0.2.13
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/chunks/{1394-556de6d71bbdb0fb.js → 1394-931c9827067b2276.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/3869-3cd46526879f454c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{3992-2e522a8ac5f2afde.js → 3992-fe5c06d6b31f8b25.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/5250-c78ca295585bbf95.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6511-ff8360be3d65aaa4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6588-ba380869b67c4fa7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7758-85c2b53f731da024.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{8605-ea5bee9dfae512c7.js → 8605-9da4678f8a310d18.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/9906-e7b8b5310a169dfe.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-e5b4e1b256f41076.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/autopilot/{page-6a061bd97f0b9398.js → page-e49b9b76c565a0b1.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/board/page-b4f032c893b21cc9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-f14987d5850a31e0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/bots/page-b433308aad13ceb6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/chat/{page-7c97dcdfe2e37a60.js → page-4c1dbb21861beab2.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/consult/page-c85b816e3b269dbb.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/control/{page-5721537ca8a3598c.js → page-f6bc66b919b2ea7d.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/design-check/{page-b654240a572e4c48.js → page-60603c1e056c9b25.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/editor/{page-b9750abc897508c3.js → page-a0ea8f5a2341ee6b.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/exec/page-45c5bf04b4a605e6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/field/page-36c6c4183353ac9e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/inside/page-cb2eb0fd809980da.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/intake/{page-c8b1ccda6ba7ae98.js → page-31012264da8a341f.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/{layout-d6b1d156fb95e74b.js → layout-50309aeb0bdd554a.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/live/page-bc00e964e855f4df.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/market/{page-9688f5b4f1ff950f.js → page-0696ee3fac9fe56c.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-66c27608f651b866.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/morning/{page-35414e0a007b4082.js → page-6ddd2109b7fc3a80.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-4e50b7298c1f69a5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/observatory/{page-e001823c35c9dd67.js → page-7a2bf830038a2264.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/{page-371423d1a573d64b.js → page-1f327f18694fabca.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/release/{page-4b764b125339ac17.js → page-e5cef2fe6e4028df.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/{page-cdf8e4b01067bcf1.js → page-cf596128d2b420ba.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/outputs/{page-3a24072b35470157.js → page-f672536f14f0969f.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/page-b52365662232db89.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-e7a6c80f288b1948.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/scheduler/{page-d37cb0d52f9b6bd5.js → page-29a709616df9b050.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/sessions/{page-686da0df9bf23e5c.js → page-fee842d7c2151129.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/devices/{page-4dc614f3ce043e63.js → page-78b40a344ed22f24.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/page-75d199f448171014.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/done/{page-d02c782fc792e2af.js → page-a011dd5b0bff29c5.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/{page-239c17b911b84e72.js → page-d92e32d51ab5157e.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/share/{page-dc6a79fb003f746c.js → page-5f21aed6932ef375.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/showroom/{page-0fffb84cafdc9da6.js → page-1e1a53946804debf.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/tasks/{page-1218753c82d585f6.js → page-a1833cd43d832601.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/term/{page-4b5935e67531efb5.js → page-63d14a4d8fe1e1c1.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/today/{page-3285bc87caf1eaa5.js → page-2a511d320f762e06.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/trace/{page-ad553b0e06505ecd.js → page-1c3e03f88dac1e21.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/vault/{page-fca096e3e860306f.js → page-c4d5289c2ea97a89.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/{page-9ebfa78f0d9885c3.js → page-b91f8952deaeaf27.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/{page-3dc5f21f7e39622d.js → page-71b43a2588489987.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-2b256feed331546f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-505bb96d69a8622c.js +1 -0
- package/apps/pwa/out/_next/static/css/128fb7fb670b2fbf.css +1 -0
- package/apps/pwa/out/approvals/index.html +1 -1
- package/apps/pwa/out/approvals/index.txt +14 -14
- package/apps/pwa/out/autopilot/index.html +1 -1
- package/apps/pwa/out/autopilot/index.txt +14 -14
- package/apps/pwa/out/board/index.html +1 -1
- package/apps/pwa/out/board/index.txt +14 -14
- package/apps/pwa/out/botlab/index.html +1 -1
- package/apps/pwa/out/botlab/index.txt +14 -14
- package/apps/pwa/out/bots/index.html +1 -1
- package/apps/pwa/out/bots/index.txt +14 -14
- package/apps/pwa/out/chat/index.html +1 -1
- package/apps/pwa/out/chat/index.txt +14 -14
- package/apps/pwa/out/consult/index.html +1 -1
- package/apps/pwa/out/consult/index.txt +14 -14
- package/apps/pwa/out/control/index.html +1 -1
- package/apps/pwa/out/control/index.txt +14 -14
- package/apps/pwa/out/design-check/index.html +1 -1
- package/apps/pwa/out/design-check/index.txt +14 -14
- package/apps/pwa/out/editor/index.html +1 -1
- package/apps/pwa/out/editor/index.txt +14 -14
- package/apps/pwa/out/exec/index.html +1 -1
- package/apps/pwa/out/exec/index.txt +14 -14
- package/apps/pwa/out/field/index.html +1 -1
- package/apps/pwa/out/field/index.txt +14 -14
- package/apps/pwa/out/healthz +1 -1
- package/apps/pwa/out/index.html +1 -1
- package/apps/pwa/out/index.txt +14 -14
- package/apps/pwa/out/inside/index.html +1 -1
- package/apps/pwa/out/inside/index.txt +14 -14
- package/apps/pwa/out/intake/index.html +1 -1
- package/apps/pwa/out/intake/index.txt +14 -14
- package/apps/pwa/out/live/index.html +1 -1
- package/apps/pwa/out/live/index.txt +14 -14
- package/apps/pwa/out/market/index.html +1 -1
- package/apps/pwa/out/market/index.txt +14 -14
- package/apps/pwa/out/missions/placeholder/index.html +1 -1
- package/apps/pwa/out/missions/placeholder/index.txt +14 -14
- package/apps/pwa/out/morning/index.html +1 -1
- package/apps/pwa/out/morning/index.txt +14 -14
- package/apps/pwa/out/observatory/index.html +1 -1
- package/apps/pwa/out/observatory/index.txt +14 -14
- package/apps/pwa/out/ops/checklist/index.html +1 -1
- package/apps/pwa/out/ops/checklist/index.txt +14 -14
- package/apps/pwa/out/ops/release/index.html +1 -1
- package/apps/pwa/out/ops/release/index.txt +14 -14
- package/apps/pwa/out/ops/seats/index.html +1 -1
- package/apps/pwa/out/ops/seats/index.txt +14 -14
- package/apps/pwa/out/outputs/index.html +1 -1
- package/apps/pwa/out/outputs/index.txt +14 -14
- package/apps/pwa/out/reflection/index.html +1 -1
- package/apps/pwa/out/reflection/index.txt +15 -15
- package/apps/pwa/out/scheduler/index.html +1 -1
- package/apps/pwa/out/scheduler/index.txt +14 -14
- package/apps/pwa/out/sessions/index.html +1 -1
- package/apps/pwa/out/sessions/index.txt +14 -14
- package/apps/pwa/out/settings/devices/index.html +1 -1
- package/apps/pwa/out/settings/devices/index.txt +14 -14
- package/apps/pwa/out/settings/index.html +1 -1
- package/apps/pwa/out/settings/index.txt +14 -14
- package/apps/pwa/out/setup/done/index.html +1 -1
- package/apps/pwa/out/setup/done/index.txt +14 -14
- package/apps/pwa/out/setup/index.html +1 -1
- package/apps/pwa/out/setup/index.txt +14 -14
- package/apps/pwa/out/share/index.html +1 -1
- package/apps/pwa/out/share/index.txt +14 -14
- package/apps/pwa/out/showroom/index.html +1 -1
- package/apps/pwa/out/showroom/index.txt +14 -14
- package/apps/pwa/out/tasks/index.html +1 -1
- package/apps/pwa/out/tasks/index.txt +14 -14
- package/apps/pwa/out/term/index.html +1 -1
- package/apps/pwa/out/term/index.txt +14 -14
- package/apps/pwa/out/today/index.html +1 -1
- package/apps/pwa/out/today/index.txt +14 -14
- package/apps/pwa/out/trace/index.html +1 -1
- package/apps/pwa/out/trace/index.txt +14 -14
- package/apps/pwa/out/vault/index.html +1 -1
- package/apps/pwa/out/vault/index.txt +14 -14
- package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
- package/apps/pwa/out/workflows/chat-ui/index.txt +14 -14
- package/apps/pwa/out/workflows/index.html +1 -1
- package/apps/pwa/out/workflows/index.txt +14 -14
- package/apps/pwa/out/workspace/index.html +1 -1
- package/apps/pwa/out/workspace/index.txt +14 -14
- package/apps/pwa/out/worktrees/index.html +1 -1
- package/apps/pwa/out/worktrees/index.txt +14 -14
- package/examples/teams/personas/backend.yaml +4 -0
- package/examples/teams/personas/pm.yaml +4 -0
- package/examples/teams/personas/qa.yaml +4 -0
- package/examples/teams/small-product.yaml +20 -0
- package/graphs/context/nightly-condense.yaml +21 -0
- package/graphs/context/recipes.yaml +12 -0
- package/graphs/demo/inside-seed.yaml +20 -0
- package/graphs/demo/recipes.yaml +12 -0
- package/graphs/lecture/lecture-note.yaml +28 -0
- package/graphs/lecture/recipes.yaml +17 -0
- package/package.json +2 -1
- package/plugins/card-followup/examples/sample-card.png +0 -0
- package/scripts/context-hooks/emit.ts +36 -14
- package/scripts/coord-channel-watch.sh +1 -0
- package/scripts/discord-seat-probe.ts +144 -0
- package/scripts/hq/hq-standby.sh +65 -0
- package/scripts/hq/standby-promote.ts +173 -0
- package/scripts/hq/standby-role.ts +59 -0
- package/scripts/hq/standby-snapshot.ts +226 -0
- package/scripts/hq/standby-verify.ts +219 -0
- package/scripts/lecture-note/node.ts +256 -0
- package/scripts/lib/telegram-inject-args.ts +31 -0
- package/scripts/measure-pod-memory-by-goal.ts +130 -0
- package/scripts/release-loop/auto-approve-node.ts +1 -1
- package/scripts/release-loop/checklist-gate-node.ts +2 -1
- package/scripts/release-loop/gate-node.ts +61 -17
- package/scripts/release-loop/ops-upgrade-node.ts +59 -6
- package/scripts/release-loop/publish-node.ts +4 -1
- package/scripts/release-loop/version-node.ts +13 -3
- package/scripts/telegram-inject.ts +14 -6
- package/scripts/test-deterministic.ts +53 -3
- package/scripts/test-diet/remeasure-list.ts +112 -0
- package/scripts/ux/demo-rehearsal.ts +17 -13
- package/scripts/ux/demo-seed.ts +108 -0
- package/scripts/ux/lib/rehearsal-verdict.ts +12 -5
- package/skills/omni-crawl/SKILL.md +16 -16
- package/skills/omni-crawl/package-lock.json +1 -544
- package/skills/omni-crawl/package.json +3 -4
- package/skills/omni-crawl/scripts/main.ts +13 -13
- package/skills/omni-crawl/scripts/monitor.ts +8 -8
- package/skills/omni-crawl/src/apify.ts +13 -2
- package/skills/omni-crawl/src/capture.ts +6 -0
- package/skills/omni-crawl/src/registry.ts +2 -2
- package/skills/omni-crawl/src/stdout-json.ts +4 -0
- package/skills/omni-digest/SKILL.md +10 -11
- package/skills/omni-digest/package-lock.json +0 -545
- package/skills/omni-digest/package.json +2 -5
- package/skills/omni-digest/scripts/main.ts +3 -3
- package/skills/omni-digest/src/delegate.ts +5 -5
- package/skills/omni-digest/src/fetch.ts +2 -2
- package/skills/omni-digest/src/media.ts +25 -11
- package/skills/omni-digest/src/visual.ts +3 -2
- package/skills/omni-market/scripts/main.ts +1 -1
- package/skills/omni-market/scripts/stdout-json.ts +4 -0
- package/src/agent/identity-env.ts +11 -0
- package/src/agent-mission/driver.ts +150 -23
- package/src/agent-mission/duo.ts +94 -0
- package/src/agent-mission/pty-decision.ts +2 -2
- package/src/autopilot/pty-control-loop.ts +4 -1
- package/src/autopilot/track-agent-shadow.ts +2 -1
- package/src/autopilot/track-agent.ts +4 -1
- package/src/boot/daemon-prompt-request.ts +3 -0
- package/src/boot/daemon-prompt-turn.ts +6 -2
- package/src/boot/daemon-runtime.ts +48 -16
- package/src/chat/index.ts +1 -0
- package/src/cli/decisions-cli.ts +51 -19
- package/src/cli/outputs-cli.ts +92 -0
- package/src/cli/persona-cli.ts +45 -13
- package/src/cli/pod-cli.ts +27 -3
- package/src/cli/pod-memory-advice.ts +35 -0
- package/src/cli/pr-cli.ts +15 -1
- package/src/cli/release-cli.ts +135 -15
- package/src/context-bus/condense.ts +194 -0
- package/src/context-bus/context-day.ts +82 -0
- package/src/context-bus/context-now-surfaces.ts +32 -2
- package/src/context-bus/context-now.ts +2 -2
- package/src/context-bus/coord-events.ts +2 -2
- package/src/context-bus/long-term-memory.ts +118 -22
- package/src/context-bus/nightly-condense.ts +153 -0
- package/src/context-bus/session-events.ts +35 -0
- package/src/dashboard/dashboard-status-lines.ts +2 -0
- package/src/dashboard/index.ts +8 -0
- package/src/dashboard/slash-runtime/dashboard-handlers.ts +24 -0
- package/src/decisions/decision-cards.ts +13 -7
- package/src/decisions/decision-ledger.ts +43 -17
- package/src/domains/outbound-alert.ts +99 -31
- package/src/domains/outbound-log-probe.ts +8 -0
- package/src/execution-loop/launch-gate.ts +17 -8
- package/src/field-note/telegram.ts +142 -0
- package/src/graph-kinds/registry.ts +2 -2
- package/src/graph-runner/graph-approval-card.ts +2 -2
- package/src/graph-runner/graph-grow-llm.ts +23 -13
- package/src/graph-runner/graph-grow.ts +69 -13
- package/src/graph-runner/graph-tick.ts +9 -2
- package/src/graph-runner/runner.ts +92 -24
- package/src/harness/harness-cli-command.ts +165 -17
- package/src/harness/harness-queue-child.ts +37 -0
- package/src/harness/harness-queue.ts +306 -0
- package/src/hooks/consult-intake.ts +153 -0
- package/src/hooks/github-shadow.ts +72 -2
- package/src/hooks/receiver.ts +82 -3
- package/src/hq/hq.ts +318 -0
- package/src/hq/lease.ts +210 -0
- package/src/hq/ledger-write-target.ts +41 -0
- package/src/index.ts +232 -16
- package/src/intake-plane/discord-seat-work.ts +36 -3
- package/src/intake-plane/linear-wish.ts +44 -0
- package/src/intake-plane/persona-answer.ts +5 -0
- package/src/intake-plane/telegram-seat-work.ts +13 -6
- package/src/intake-plane/wish-card.ts +33 -0
- package/src/llm/difficulty.ts +1 -1
- package/src/loops/checker.ts +178 -0
- package/src/loops/loop-cli.ts +37 -3
- package/src/loops/observe.ts +49 -0
- package/src/loops/orchestrator/overlap.ts +141 -0
- package/src/loops/orchestrator/traffic.ts +150 -0
- package/src/loops/package/verify.ts +125 -0
- package/src/loops/verdict.ts +22 -0
- package/src/maturity/feature-maturity.ts +5 -4
- package/src/memory.ts +37 -4
- package/src/nexus/api/card-followup-route.ts +118 -0
- package/src/nexus/api/decisions-route.ts +68 -0
- package/src/nexus/api/http-server.ts +78 -8
- package/src/nexus/api/outbound-report.ts +40 -7
- package/src/nexus/api/personas.ts +97 -54
- package/src/nexus/api/skill-exec-route.ts +97 -0
- package/src/nexus/api/task-cards-api.ts +19 -0
- package/src/nexus/api/workflow-history.ts +88 -0
- package/src/nexus/api/workflows.ts +52 -0
- package/src/nexus/outbound/delivery-ledger.ts +17 -8
- package/src/nexus/outbound/router.ts +8 -3
- package/src/persona/loader.ts +18 -0
- package/src/persona/persona-todo.ts +14 -9
- package/src/persona/presets.ts +10 -2
- package/src/persona/team.ts +105 -0
- package/src/persona/types.ts +4 -0
- package/src/plugins/maker/market-bundle.ts +2 -1
- package/src/pod-lease/host-lease.ts +130 -20
- package/src/release-loop/checklist.ts +15 -3
- package/src/release-loop/feature-store.ts +24 -10
- package/src/release-loop/landed-but-yellow.ts +60 -0
- package/src/seat-dispatch/seat-ask.ts +57 -12
- package/src/seat-loop/seat-loop.ts +253 -18
- package/src/seat-loop/seat-pack.ts +127 -0
- package/src/self-dev/ask-launch-flow.ts +3 -0
- package/src/self-dev/draft-sweep.ts +44 -10
- package/src/self-dev/draft-triage-rules.ts +54 -2
- package/src/self-implement/budget-gate.ts +29 -12
- package/src/self-implement/gate-candidate-ranking.ts +60 -0
- package/src/self-implement/gate-scope.ts +9 -8
- package/src/self-implement/headless-elanous-driver.ts +7 -2
- package/src/self-implement/l8-merge-queue.ts +157 -1
- package/src/self-implement/orchestrator.ts +15 -0
- package/src/self-implement/test-seams.ts +1 -0
- package/src/steward/launch.ts +5 -1
- package/src/steward/readiness.ts +125 -0
- package/src/steward/rescue.ts +75 -0
- package/src/steward/triage.ts +48 -9
- package/src/task-cards/card-cli.ts +78 -0
- package/src/task-orchestrator/surfaces/pod-command-job.ts +14 -10
- package/src/task-orchestrator/surfaces/pod-lease.ts +18 -6
- package/src/task-orchestrator/surfaces/pod-pool.ts +27 -10
- package/src/task-orchestrator/surfaces/self-implement-pod.ts +46 -8
- package/src/telegram-commands.ts +21 -0
- package/src/telegram-dispatch-forward.ts +1 -1
- package/src/telegram-fabric-plan.ts +90 -0
- package/src/telegram-project-command.ts +84 -4
- package/src/telegram.ts +37 -5
- package/src/tool-runtime/elanous-control-runtimes.ts +2 -1
- package/src/user-config.ts +101 -13
- package/src/version/packed-revision.json +1 -1
- package/src/workflow-runtime/executor.ts +4 -0
- package/src/workflow-runtime/node-catalog.ts +13 -0
- package/src/workflow-runtime/nodes/knowledge.ts +38 -0
- package/src/workflow-runtime/schema.ts +17 -1
- package/src/workflow-runtime/types.ts +13 -1
- package/apps/pwa/out/_next/static/chunks/2310-7a59f043f6db207e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2548-6e316138d347cefe.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3869-a39d1d9921e10d43.js +0 -1
- package/apps/pwa/out/_next/static/chunks/507-5acd98bd6dab2d8a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5445-745eb795c5963d79.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9906-482c6619b3fdda20.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-1dcdc58fc2de2454.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/board/page-cb95a7432c9ee744.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-b12b6d2f8d2d1aea.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/bots/page-b9efe868bfd36255.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/consult/page-8fd36984f549270a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/exec/page-4cd1de371f8ad048.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/field/page-d99f89657828421c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/inside/page-50cb2a0eb15e6c83.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/live/page-2a9932ddb62d76bd.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-6b15dd6456c5df09.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-e7a529e0507ac86c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/page-94c82eb0ae5abb32.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-0be8d4b2ced75ba0.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/page-53f80edc6b8dc07c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-c6da2b468454532d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-93bc70e36f595414.js +0 -1
- package/apps/pwa/out/_next/static/css/543f56bcb1f79fca.css +0 -1
- /package/apps/pwa/out/_next/static/{Y4zKzL62sakG5momz3SoQ → D51l8jUBplJrIpWvENsDK}/_buildManifest.js +0 -0
- /package/apps/pwa/out/_next/static/{Y4zKzL62sakG5momz3SoQ → D51l8jUBplJrIpWvENsDK}/_ssgManifest.js +0 -0
|
@@ -21,6 +21,7 @@ export function seams(over: Partial<SelfImplementSeams> & { gateResults?: boolea
|
|
|
21
21
|
// ⭐ 실제 경로는 그것을 «의도한» 전용 테스트에서만 탄다(그 테스트가 심을 명시로 준다).
|
|
22
22
|
refreshCodexQuotaSignals: async () => ({ accounts: [] }),
|
|
23
23
|
writeRunLedger: () => {},
|
|
24
|
+
emitContextEvent: () => {},
|
|
24
25
|
registerLoopAgent: () => {},
|
|
25
26
|
createWorktree: async ({ branch, base }) => ({ path: `/wt/${branch}`, branch, base, resolvedBase: 'a'.repeat(40), invokedHead: 'a'.repeat(40) }),
|
|
26
27
|
implement: async ({ feature }) => { features.push(feature); return { ok: true, summary: 'impl' }; },
|
package/src/steward/launch.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { redactSecrets } from '../task-cards/card-store.js';
|
|
|
7
7
|
import { preLaunchGate, type PreLaunchGateDecision } from '../execution-loop/launch-gate.js';
|
|
8
8
|
import type { BudgetDecision } from '../self-implement/budget-gate.js';
|
|
9
9
|
import type { ScheduledDecision, StewardSettings, TriageIssue } from './triage.js';
|
|
10
|
+
import { launchModeOf, rescueAllows } from './rescue.js';
|
|
10
11
|
|
|
11
12
|
/** `completed` = the run finished without a merge (a non-code artifact, or nothing to deliver) — never reported as a failure. */
|
|
12
13
|
export type LaunchStatus = 'shadow' | 'launched' | 'skipped-budget' | 'blocked-duplicate' | 'blocked-location' | 'failed' | 'running' | 'merged' | 'completed';
|
|
@@ -50,7 +51,7 @@ const RUN_ID = /\brun-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
|
|
|
50
51
|
const DEFAULT_POOL = 'pool-node-b@node-b:8';
|
|
51
52
|
// `harness budget --json` outcomes: proceed | next-provider | wait-reset | stop. next-provider still runs (the harness switches provider itself).
|
|
52
53
|
const BUDGET_PROCEED: readonly string[] = ['proceed', 'next-provider'];
|
|
53
|
-
const launchMode = (settings: StewardSettings): 'off' | 'shadow' | 'live' => settings.mode ?? settings.launch ?? 'shadow';
|
|
54
|
+
const launchMode = (settings: StewardSettings): 'off' | 'shadow' | 'live' => launchModeOf(settings.mode ?? settings.launch ?? 'shadow');
|
|
54
55
|
const cli = (args: string[]) => ['bun', 'bin/elanous.mjs', ...(process.env.NODE_ENV === 'test' ? ['--test'] : []), ...args];
|
|
55
56
|
const sourceOf = (issue: TriageIssue): string => /^출처: (telegram|pwa|tui|cli)$/m.exec(issue.body)?.[1] ?? `linear:${issue.identifier}`;
|
|
56
57
|
const promptOf = (issue: TriageIssue): string => `${issue.title}\n${issue.body.slice(0, 1500)}`;
|
|
@@ -125,6 +126,7 @@ export function launch(item: LaunchItem, deps: LaunchDeps): LaunchEntry {
|
|
|
125
126
|
const { ledger, settings, root } = deps;
|
|
126
127
|
if (item.row.rung !== 4 || item.row.hitlReason || item.row.disposition !== 'now' || (ledger.launches[item.issue.identifier] && !['skipped-budget', 'blocked-duplicate', 'blocked-location'].includes(ledger.launches[item.issue.identifier].status) && !(launchMode(settings) === 'live' && ledger.launches[item.issue.identifier].status === 'shadow'))) throw new Error('steward launch is not eligible');
|
|
127
128
|
if (launchMode(settings) === 'off') throw new Error('steward launch is off');
|
|
129
|
+
if (!rescueAllows(settings.mode, 'launch', { issue: item.issue.identifier })) throw new Error('steward rescue refused launch');
|
|
128
130
|
const key = item.issue.identifier;
|
|
129
131
|
const entry: LaunchEntry = { issue: key, title: redactSecrets(item.issue.title), source: item.source, command: redactSecrets(item.command), status: 'shadow' };
|
|
130
132
|
if (launchMode(settings) !== 'live') {
|
|
@@ -187,6 +189,7 @@ export function launch(item: LaunchItem, deps: LaunchDeps): LaunchEntry {
|
|
|
187
189
|
export function raiseHitl(issue: TriageIssue, row: ScheduledDecision, deps: LaunchDeps): HitlEntry {
|
|
188
190
|
const old = deps.ledger.hitl[issue.identifier];
|
|
189
191
|
if (old && (old.attempted || launchMode(deps.settings) !== 'live')) return old;
|
|
192
|
+
if (!rescueAllows(deps.settings.mode, 'decision-card', { issue: issue.identifier })) return old ?? { issue: issue.identifier, reason: redactSecrets(row.hitlReason ?? row.why), raised: false };
|
|
190
193
|
const entry: HitlEntry = old ?? { issue: issue.identifier, reason: redactSecrets(row.hitlReason ?? row.why), raised: false };
|
|
191
194
|
deps.ledger.hitl[issue.identifier] = entry;
|
|
192
195
|
if (launchMode(deps.settings) !== 'live') {
|
|
@@ -215,6 +218,7 @@ function alive(pid: number | undefined): boolean {
|
|
|
215
218
|
|
|
216
219
|
export function collectOutcomes(ledger: LaunchLedger, deps: LaunchDeps): LaunchEntry[] {
|
|
217
220
|
if (launchMode(deps.settings) !== 'live') return [];
|
|
221
|
+
if (!rescueAllows(deps.settings.mode, 'harvest')) return [];
|
|
218
222
|
const done: LaunchEntry[] = [];
|
|
219
223
|
for (const entry of Object.values(ledger.launches)) {
|
|
220
224
|
if (entry.reported || entry.status === 'shadow' || entry.status === 'skipped-budget' || entry.status === 'blocked-duplicate' || entry.status === 'blocked-location') continue;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { appendFileSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { effectiveInstanceRoot } from '../instance/resolve.js';
|
|
4
|
+
import type { LaunchPlan } from './launch.js';
|
|
5
|
+
import type { ScheduledDecision } from './triage.js';
|
|
6
|
+
|
|
7
|
+
// Planning estimates, not invoices: one harness run per launch, one Pod-hour per run.
|
|
8
|
+
// No model/token or runtime telemetry is present in the shadow decision line.
|
|
9
|
+
const ESTIMATED_LLM_USD_PER_LAUNCH = 2;
|
|
10
|
+
const ESTIMATED_POD_USD_PER_LAUNCH = 1;
|
|
11
|
+
const CATEGORY = 'steward.readiness';
|
|
12
|
+
const EVENT = 'shadow-tick';
|
|
13
|
+
|
|
14
|
+
export interface ShadowTick {
|
|
15
|
+
at: string;
|
|
16
|
+
decisions: Array<{ issue: string; rung: ScheduledDecision['rung']; disposition: ScheduledDecision['disposition'] }>;
|
|
17
|
+
actions: Array<{ issue: string; kind: 'launch' | 'hitl'; llmUsd: number; podUsd: number }>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ledgerPath(root: string): string { return join(root, 'steward', 'readiness.jsonl'); }
|
|
21
|
+
|
|
22
|
+
/** Called by the shadow schedule after its launch/HITL candidates have been selected. */
|
|
23
|
+
export function recordShadowTick(root: string, rows: ScheduledDecision[], plan: LaunchPlan, now: Date = new Date()): ShadowTick {
|
|
24
|
+
const tick: ShadowTick = {
|
|
25
|
+
at: now.toISOString(),
|
|
26
|
+
decisions: rows.map(({ issue, rung, disposition }) => ({ issue, rung, disposition })),
|
|
27
|
+
actions: [
|
|
28
|
+
...plan.launches.map(({ issue }) => ({ issue: issue.identifier, kind: 'launch' as const, llmUsd: ESTIMATED_LLM_USD_PER_LAUNCH, podUsd: ESTIMATED_POD_USD_PER_LAUNCH })),
|
|
29
|
+
...plan.hitl.map(({ issue }) => ({ issue: issue.identifier, kind: 'hitl' as const, llmUsd: 0, podUsd: 0 })),
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
appendFileSync(ledgerPath(root), `${JSON.stringify(tick)}\n`);
|
|
33
|
+
return tick;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ReadinessReport {
|
|
37
|
+
since: string;
|
|
38
|
+
until: string;
|
|
39
|
+
ticks: number;
|
|
40
|
+
judgments: number;
|
|
41
|
+
distribution: Record<string, number>;
|
|
42
|
+
actions: Array<ShadowTick['actions'][number] & { at: string }>;
|
|
43
|
+
budgetGate: { estimatedLlmUsd: number; estimatedPodUsd: number; estimatedTotalUsd: number; basis: string; verdict: 'estimate-only' };
|
|
44
|
+
hitlGate: { requiringHuman: number };
|
|
45
|
+
source: { decisions: string; logs: string };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Snapshot-only reader: no CardStore, stage, config setter, logger or write-capable DB handle. */
|
|
49
|
+
export function stewardReadiness(root: string, sinceHours = 24, now: Date = new Date()): ReadinessReport {
|
|
50
|
+
if (!Number.isFinite(sinceHours) || sinceHours <= 0) throw new Error('--since must be a positive duration such as 24h');
|
|
51
|
+
const since = new Date(now.getTime() - sinceHours * 3_600_000);
|
|
52
|
+
if (!Number.isFinite(since.getTime())) throw new Error('--since is out of range');
|
|
53
|
+
const path = ledgerPath(root);
|
|
54
|
+
let text: string;
|
|
55
|
+
try { text = readFileSync(path, 'utf8'); }
|
|
56
|
+
catch (error) {
|
|
57
|
+
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
|
|
58
|
+
text = '';
|
|
59
|
+
}
|
|
60
|
+
const ticks: ShadowTick[] = [];
|
|
61
|
+
for (const [index, line] of text.split('\n').entries()) {
|
|
62
|
+
if (!line.trim()) continue;
|
|
63
|
+
let parsed: ShadowTick;
|
|
64
|
+
try { parsed = JSON.parse(line) as ShadowTick; }
|
|
65
|
+
catch { throw new Error(`Invalid steward shadow decision line ${index + 1}`); }
|
|
66
|
+
if (!parsed || typeof parsed.at !== 'string' || !Number.isFinite(Date.parse(parsed.at)) ||
|
|
67
|
+
!Array.isArray(parsed.decisions) || !parsed.decisions.every(row => row && typeof row.issue === 'string' &&
|
|
68
|
+
[0, 1, 2, 3, 4, 5, 'hitl'].includes(row.rung) && ['now', 'wait', 'hitl'].includes(row.disposition)) ||
|
|
69
|
+
!Array.isArray(parsed.actions) || !parsed.actions.every(action => action && typeof action.issue === 'string' &&
|
|
70
|
+
['launch', 'hitl'].includes(action.kind) && Number.isFinite(action.llmUsd) && action.llmUsd >= 0 &&
|
|
71
|
+
Number.isFinite(action.podUsd) && action.podUsd >= 0))
|
|
72
|
+
throw new Error(`Invalid steward shadow decision line ${index + 1}`);
|
|
73
|
+
const at = Date.parse(parsed.at);
|
|
74
|
+
if (at >= since.getTime() && at <= now.getTime()) ticks.push(parsed);
|
|
75
|
+
}
|
|
76
|
+
const distribution: Record<string, number> = {};
|
|
77
|
+
const actions = ticks.flatMap(tick => tick.actions.map(action => ({ at: tick.at, ...action })));
|
|
78
|
+
for (const row of ticks.flatMap(tick => tick.decisions)) {
|
|
79
|
+
const key = `${row.disposition} / rung ${row.rung}`;
|
|
80
|
+
distribution[key] = (distribution[key] ?? 0) + 1;
|
|
81
|
+
}
|
|
82
|
+
const estimatedLlmUsd = actions.reduce((sum, action) => sum + action.llmUsd, 0);
|
|
83
|
+
const estimatedPodUsd = actions.reduce((sum, action) => sum + action.podUsd, 0);
|
|
84
|
+
return {
|
|
85
|
+
since: since.toISOString(), until: now.toISOString(), ticks: ticks.length,
|
|
86
|
+
judgments: ticks.reduce((sum, tick) => sum + tick.decisions.length, 0), distribution, actions,
|
|
87
|
+
budgetGate: { estimatedLlmUsd, estimatedPodUsd, estimatedTotalUsd: estimatedLlmUsd + estimatedPodUsd,
|
|
88
|
+
basis: 'Planning assumption per launch: LLM $2 + Pod $1 (one Pod-hour); not metered usage or budget approval', verdict: 'estimate-only' },
|
|
89
|
+
hitlGate: { requiringHuman: actions.filter(action => action.kind === 'hitl').length },
|
|
90
|
+
source: { decisions: path, logs: `elanous logs --category ${CATEGORY} --event ${EVENT} --since ${sinceHours}h` },
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function formatStewardReadiness(report: ReadinessReport): string {
|
|
95
|
+
return [
|
|
96
|
+
`Steward shadow readiness | ${report.since} → ${report.until}`,
|
|
97
|
+
`Ticks | ${report.ticks}`,
|
|
98
|
+
`Judgments | ${report.judgments}`,
|
|
99
|
+
`Judgment distribution | ${Object.entries(report.distribution).map(([kind, count]) => `${kind}: ${count}`).join(' · ') || 'none'}`,
|
|
100
|
+
`If live, actions | ${report.actions.map(a => `${a.at} ${a.kind} ${a.issue}`).join(' · ') || 'none'}`,
|
|
101
|
+
`Budget gate | LLM ~$${report.budgetGate.estimatedLlmUsd} · Pod ~$${report.budgetGate.estimatedPodUsd} · total ~$${report.budgetGate.estimatedTotalUsd} (estimate only; not approval)`,
|
|
102
|
+
`HITL gate | ${report.hitlGate.requiringHuman} human confirmations`,
|
|
103
|
+
`Estimate basis | ${report.budgetGate.basis}`,
|
|
104
|
+
`Shadow decisions | ${report.source.decisions}`,
|
|
105
|
+
`First-class logs | ${report.source.logs}`,
|
|
106
|
+
].join('\n');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function parseReadinessSince(value: string): number {
|
|
110
|
+
if (!/^(?:\d+)(?:\.\d+)?h$/.test(value)) throw new Error('--since must be a positive duration such as 24h');
|
|
111
|
+
const hours = Number(value.slice(0, -1));
|
|
112
|
+
if (!Number.isFinite(hours) || hours <= 0) throw new Error('--since must be a positive duration such as 24h');
|
|
113
|
+
return hours;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function runStewardReadinessCli(opts: { since: string; json?: boolean }, root = effectiveInstanceRoot()): number {
|
|
117
|
+
try {
|
|
118
|
+
const report = stewardReadiness(root, parseReadinessSince(opts.since));
|
|
119
|
+
console.log(opts.json ? JSON.stringify(report) : formatStewardReadiness(report));
|
|
120
|
+
return 0;
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(`steward readiness: ${error instanceof Error ? error.message : String(error)}`);
|
|
123
|
+
return 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// HQ-SEAT — steward «구조 모드»(rescue): after an HQ move the seat sessions are gone and the steward keeps
|
|
2
|
+
// the line live, but only for the four reversible, internal actions below (OP 10-04 10:22 · 대표 directive).
|
|
3
|
+
import { debug } from '../debug/log.js';
|
|
4
|
+
|
|
5
|
+
export type StewardMode = 'off' | 'shadow' | 'live' | 'rescue';
|
|
6
|
+
|
|
7
|
+
/** The whole rescue allow-list: launch queued goals · harvest finished runs · internal stuck alerts · decision cards. */
|
|
8
|
+
export const RESCUE_ALLOWED = ['launch', 'harvest', 'alert', 'decision-card'] as const;
|
|
9
|
+
export type RescueAllowedAction = typeof RESCUE_ALLOWED[number];
|
|
10
|
+
export type RescueAction = RescueAllowedAction | 'publish' | 'release-run' | 'external-post' | 'delete' | 'config-change' | 'git-force';
|
|
11
|
+
|
|
12
|
+
/** Shared, fail-closed policy for rescue and seat-loop live-safe decisions. */
|
|
13
|
+
export function isRescueAllowedAction(action: string): action is RescueAllowedAction {
|
|
14
|
+
return (RESCUE_ALLOWED as readonly string[]).includes(action);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Launch semantics of a steward mode: rescue launches like live. */
|
|
18
|
+
export function launchModeOf(mode: StewardMode): 'off' | 'shadow' | 'live' {
|
|
19
|
+
return mode === 'rescue' ? 'live' : mode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Rescue-mode action gate. Outside rescue the steward's own mode rules decide (returns true).
|
|
24
|
+
* In rescue only RESCUE_ALLOWED pass; every decision is observed as steward.rescue/<action> or steward.rescue/refused.
|
|
25
|
+
*/
|
|
26
|
+
export function rescueAllows(mode: StewardMode | undefined, action: RescueAction, data: Record<string, unknown> = {}): boolean {
|
|
27
|
+
if (mode !== 'rescue') return true;
|
|
28
|
+
const allowed = isRescueAllowedAction(action);
|
|
29
|
+
try { debug.log('steward.rescue', allowed ? action : 'refused', { action, ...data }); } catch { /* observation is fail-soft */ }
|
|
30
|
+
return allowed;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface StewardModeStore {
|
|
34
|
+
read: () => StewardMode;
|
|
35
|
+
write: (mode: StewardMode) => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const MODES: readonly StewardMode[] = ['off', 'shadow', 'live', 'rescue'];
|
|
39
|
+
|
|
40
|
+
export function parseStewardMode(value: string): StewardMode | null {
|
|
41
|
+
return (MODES as readonly string[]).includes(value) ? value as StewardMode : null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** `elanous steward mode [<mode>]` — HQ promotion sets rescue; a reattaching human seat sets shadow. */
|
|
45
|
+
export async function runStewardModeCli(value: string | undefined, opts: { json?: boolean }, store?: StewardModeStore): Promise<number> {
|
|
46
|
+
const s = store ?? await defaultModeStore();
|
|
47
|
+
const before = s.read();
|
|
48
|
+
if (value === undefined) {
|
|
49
|
+
console.log(opts.json ? JSON.stringify({ mode: before }) : before);
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
const mode = parseStewardMode(value);
|
|
53
|
+
if (!mode) { console.error(`steward mode: unknown mode ${JSON.stringify(value)} (off|shadow|live|rescue)`); return 2; }
|
|
54
|
+
s.write(mode);
|
|
55
|
+
const after = s.read();
|
|
56
|
+
try { debug.log('steward.rescue', 'mode-set', { before, after }); } catch { /* observation is fail-soft */ }
|
|
57
|
+
if (after !== mode) { console.error(`steward mode: saved value did not stick (read ${after})`); return 1; }
|
|
58
|
+
console.log(opts.json ? JSON.stringify({ before, mode: after }) : `steward mode ${before} → ${after}`);
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function defaultModeStore(): Promise<StewardModeStore> {
|
|
63
|
+
const uc = await import('../user-config.js');
|
|
64
|
+
return {
|
|
65
|
+
read: () => (uc.getUserConfig().loops?.steward?.mode ?? 'shadow') as StewardMode,
|
|
66
|
+
write: (mode) => {
|
|
67
|
+
const cfg = uc.getUserConfig();
|
|
68
|
+
uc.backupUserConfig(uc.userConfigPath());
|
|
69
|
+
const loops = { ...(cfg.loops ?? {}) };
|
|
70
|
+
loops.steward = { ...(loops.steward ?? {}), mode };
|
|
71
|
+
uc.saveUserConfig({ ...cfg, loops });
|
|
72
|
+
uc.reloadUserConfig();
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
package/src/steward/triage.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { closeSync, existsSync, openSync, readFileSync, writeFileSync, mkdirSync, rmSync } from 'node:fs';
|
|
3
|
+
import { launchModeOf, rescueAllows } from './rescue.js';
|
|
2
4
|
import { join } from 'node:path';
|
|
3
5
|
import { fetchLinearIssues } from '../connectors/linear.js';
|
|
4
6
|
import { getSecretAsync } from '../nexus/config/secrets/index.js';
|
|
5
7
|
import { getUserConfig } from '../user-config.js';
|
|
6
8
|
import { emitDecision } from '../live/detail-switch.js';
|
|
7
9
|
import { debug, redactSecretText } from '../debug/log.js';
|
|
10
|
+
import { loopEvent } from '../loops/observe.js';
|
|
8
11
|
import { effectiveInstanceRoot } from '../instance/resolve.js';
|
|
9
12
|
import { redactSecrets } from '../task-cards/card-store.js';
|
|
10
13
|
import { directiveHash } from './directive.js';
|
|
@@ -33,7 +36,8 @@ export interface TriageDecision {
|
|
|
33
36
|
}
|
|
34
37
|
export interface ScheduledDecision extends TriageDecision { disposition: 'now' | 'wait' | 'hitl' }
|
|
35
38
|
export interface StewardSettings {
|
|
36
|
-
|
|
39
|
+
/** `rescue` (HQ-SEAT): live launches/harvest/alerts/decision cards only — see ./rescue.ts. */
|
|
40
|
+
mode?: 'off' | 'shadow' | 'live' | 'rescue'; linearTeam?: string;
|
|
37
41
|
roles?: Record<string, { maxConcurrent?: number }>;
|
|
38
42
|
budget?: number;
|
|
39
43
|
tracks?: Record<string, string>;
|
|
@@ -62,11 +66,14 @@ export interface StewardDeps {
|
|
|
62
66
|
stageOwnedByCommand?: boolean;
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
/** rescue launches/harvests like live (HQ-SEAT). */
|
|
70
|
+
const liveLike = (mode: StewardSettings['mode']): boolean => mode !== undefined && launchModeOf(mode) === 'live';
|
|
71
|
+
|
|
65
72
|
export function stewardSettings(): StewardSettings {
|
|
66
73
|
return getUserConfig().loops?.steward ?? { mode: 'shadow' };
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
function effectiveStewardMode(settings: StewardSettings): 'off' | 'shadow' | 'live' {
|
|
76
|
+
function effectiveStewardMode(settings: StewardSettings): 'off' | 'shadow' | 'live' | 'rescue' {
|
|
70
77
|
return settings.mode ?? settings.launch ?? 'shadow';
|
|
71
78
|
}
|
|
72
79
|
|
|
@@ -115,6 +122,9 @@ export async function triageIssues(issues: TriageIssue[], judge?: NonNullable<St
|
|
|
115
122
|
// Inventory is shared by every classification in this batch; do not spawn --help per issue.
|
|
116
123
|
let inventory: ReturnType<typeof installedCapabilities> | undefined;
|
|
117
124
|
const signal = (result: TriageDecision): void => {
|
|
125
|
+
try { debug.log('steward.triage', 'decision', {
|
|
126
|
+
kind: String(result.rung), target: result.issue, wouldAct: false,
|
|
127
|
+
}); } catch { /* logging must not change the judgment */ }
|
|
118
128
|
decide({ kind: result.rung === 'hitl' ? 'ESCALATE' : 'ROUTE', what: result.issue, reason: result.why,
|
|
119
129
|
purpose: 'steward triage', target: result.owner ? `${result.rung} · ${result.owner}` : String(result.rung), refs: { issue: result.issue } });
|
|
120
130
|
};
|
|
@@ -279,6 +289,9 @@ export async function runStewardStage(stage: 'sync' | 'triage' | 'schedule' | 'r
|
|
|
279
289
|
const fetchFn = deps.fetch ?? fetch;
|
|
280
290
|
const skip = skippedPath(root);
|
|
281
291
|
if (stage !== 'sync' && existsSync(skip)) return;
|
|
292
|
+
const runId = (graphRunId() ?? process.env.ELANOUS_RUN_ID?.trim()) || `steward-stage-${randomUUID()}`;
|
|
293
|
+
let outcome: 'ok' | 'fail' = 'fail';
|
|
294
|
+
try {
|
|
282
295
|
const key = await (deps.getSecret ?? getSecretAsync)('connector.linear.apiKey');
|
|
283
296
|
if (!key) throw new Error('connector.linear.apiKey missing');
|
|
284
297
|
if (stage === 'sync') {
|
|
@@ -368,6 +381,9 @@ export async function runStewardStage(stage: 'sync' | 'triage' | 'schedule' | 'r
|
|
|
368
381
|
? { ...row, rung: 'hitl' as const, disposition: 'hitl' as const, hitlReason: 'other' as const, why: 'working-backwards draft invalid' }
|
|
369
382
|
: row);
|
|
370
383
|
}
|
|
384
|
+
for (const row of rows) try { debug.log('steward.schedule', 'decision', {
|
|
385
|
+
kind: row.disposition, target: row.issue, wouldAct: row.disposition === 'now' && liveLike(settings.mode),
|
|
386
|
+
}); } catch { /* logging must not change the schedule */ }
|
|
371
387
|
writeFileSync(schedule, JSON.stringify(rows));
|
|
372
388
|
const ledger = readLaunchLedger(root);
|
|
373
389
|
const launchDeps: LaunchDeps = { root, settings, ledger, command: deps.launchCommand, spawn: deps.spawnLaunch, gate: deps.launchGate };
|
|
@@ -384,6 +400,11 @@ export async function runStewardStage(stage: 'sync' | 'triage' | 'schedule' | 'r
|
|
|
384
400
|
const entry = launch(item, launchDeps);
|
|
385
401
|
recordLaunchOnCard(item.issue, entry, cardDeps);
|
|
386
402
|
}
|
|
403
|
+
if (settings.mode === 'shadow') {
|
|
404
|
+
const { recordShadowTick } = await import('./readiness.js');
|
|
405
|
+
const tick = recordShadowTick(root, rows, plan, (deps.now ?? (() => new Date()))());
|
|
406
|
+
debug.log('steward.readiness', 'shadow-tick', tick);
|
|
407
|
+
}
|
|
387
408
|
} else {
|
|
388
409
|
const rows = JSON.parse(readFileSync(schedule, 'utf8')) as ScheduledDecision[];
|
|
389
410
|
const path = reportPath(root);
|
|
@@ -422,7 +443,7 @@ export async function runStewardStage(stage: 'sync' | 'triage' | 'schedule' | 'r
|
|
|
422
443
|
const issue = issues.find(item => item.identifier === outcome.issue) ??
|
|
423
444
|
{ identifier: outcome.issue, title: outcome.title, ref: '', body: '' };
|
|
424
445
|
recordOutcomeOnCard(issue, outcome, { root, store: deps.cardStore, now: deps.now });
|
|
425
|
-
notifyOutcome(outcome, { root, ledger, shadow: settings.mode
|
|
446
|
+
notifyOutcome(outcome, { root, ledger, shadow: !(settings.mode === 'live' || settings.mode === 'rescue' && rescueAllows(settings.mode, 'alert', { issue: outcome.issue })), ...deps.outcomeNotify });
|
|
426
447
|
const prefix = ['telegram', 'pwa', 'tui', 'cli'].includes(outcome.source) ? `${outcome.source} · ` : '';
|
|
427
448
|
await (deps.sendDigest ?? sendStewardDigest)(`${prefix}${issue.title} · PR ${outcome.prNumber ?? '없음'} · ${outcome.status}`);
|
|
428
449
|
outcome.reported = true;
|
|
@@ -430,11 +451,11 @@ export async function runStewardStage(stage: 'sync' | 'triage' | 'schedule' | 'r
|
|
|
430
451
|
}
|
|
431
452
|
const justCollected = new Set(outcomes.map(outcome => outcome.issue));
|
|
432
453
|
for (const outcome of Object.values(ledger.launches)) {
|
|
433
|
-
if ((settings.mode
|
|
434
|
-
(settings.mode
|
|
454
|
+
if ((!liveLike(settings.mode) && outcome.status === 'shadow' && !outcome.notified) ||
|
|
455
|
+
(liveLike(settings.mode) && !justCollected.has(outcome.issue) && outcome.reported && outcome.notified !== 'shadow') ||
|
|
435
456
|
// A finished run whose PR waits for merge still owes the wish's chat its PR link (once; failures retry).
|
|
436
|
-
(settings.mode
|
|
437
|
-
notifyOutcome(outcome, { root, ledger, shadow: settings.mode
|
|
457
|
+
(liveLike(settings.mode) && outcome.awaitingMerge === true && !outcome.reported && outcome.notified !== 'sent')) {
|
|
458
|
+
notifyOutcome(outcome, { root, ledger, shadow: !(settings.mode === 'live' || settings.mode === 'rescue' && rescueAllows(settings.mode, 'alert', { issue: outcome.issue })), ...deps.outcomeNotify });
|
|
438
459
|
}
|
|
439
460
|
}
|
|
440
461
|
const day = at.slice(0, 10);
|
|
@@ -445,11 +466,17 @@ export async function runStewardStage(stage: 'sync' | 'triage' | 'schedule' | 'r
|
|
|
445
466
|
writeFileSync(path, JSON.stringify(state));
|
|
446
467
|
}
|
|
447
468
|
}
|
|
469
|
+
outcome = 'ok';
|
|
470
|
+
} finally {
|
|
471
|
+
try { loopEvent('steward', 'tick', { runId, stage, outcome, reason: outcome,
|
|
472
|
+
sourceRef: 'graphs/steward/steward.yaml', profile: settings.mode }); }
|
|
473
|
+
catch { /* Observation must not change the stage outcome. */ }
|
|
474
|
+
}
|
|
448
475
|
}
|
|
449
476
|
|
|
450
477
|
async function sendStewardDigest(text: string): Promise<void> {
|
|
451
478
|
const { deliver } = await import('../domains/outbound-alert.js');
|
|
452
|
-
if (!deliver(text, '
|
|
479
|
+
if (!deliver(text, 'ops-report')) throw new Error('steward digest delivery failed');
|
|
453
480
|
}
|
|
454
481
|
|
|
455
482
|
export interface StewardCommandDeps extends StewardDeps {
|
|
@@ -543,13 +570,25 @@ export async function runStewardStageCommand(stage: StewardStage, deps: StewardC
|
|
|
543
570
|
}, stage === 'sync' ? () => { skipOverlappingRun(root, currentOpen(root, stage)); return 0 as const; } : undefined);
|
|
544
571
|
}
|
|
545
572
|
|
|
573
|
+
export async function runStewardNodeCommand(
|
|
574
|
+
stage: StewardStage,
|
|
575
|
+
deps: StewardCommandDeps = {},
|
|
576
|
+
registerSink: () => Promise<unknown> = async () => (await import('../domains/standalone-log-sink.js')).registerStandaloneLogSink('steward'),
|
|
577
|
+
): Promise<0 | 1> {
|
|
578
|
+
try { await registerSink(); }
|
|
579
|
+
catch (error) {
|
|
580
|
+
console.error(`steward ${stage}: log sink registration failed — ${redactSecretText(error instanceof Error ? error.message : String(error))}`);
|
|
581
|
+
}
|
|
582
|
+
return runStewardStageCommand(stage, deps);
|
|
583
|
+
}
|
|
584
|
+
|
|
546
585
|
if (import.meta.main) {
|
|
547
586
|
const stage = process.argv[2];
|
|
548
587
|
if (!['sync', 'triage', 'schedule', 'report'].includes(stage ?? '')) {
|
|
549
588
|
console.error('steward: expected sync|triage|schedule|report');
|
|
550
589
|
process.exitCode = 2;
|
|
551
590
|
} else {
|
|
552
|
-
|
|
591
|
+
void runStewardNodeCommand(stage as StewardStage).then(code => { process.exitCode = code; }).catch((error: unknown) => {
|
|
553
592
|
console.error(`steward ${stage}: ${redactSecretText(error instanceof Error ? error.message : String(error))}`);
|
|
554
593
|
process.exitCode = 1;
|
|
555
594
|
});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
import { join, resolve } from 'node:path';
|
|
3
3
|
import { scanWishFolder } from '../intake-plane/wish-folder.js';
|
|
4
|
+
import { LINEAR_WISH_KEY_MISSING, scanLinearWishes } from '../intake-plane/linear-wish.js';
|
|
5
|
+
import type { fetchLinearIssues } from '../connectors/linear.js';
|
|
4
6
|
import { CardStore, type TaskCard } from './card-store.js';
|
|
5
7
|
|
|
6
8
|
export interface CardCliDeps {
|
|
7
9
|
createStore?: () => CardStore;
|
|
8
10
|
write?: (text: string) => void;
|
|
11
|
+
getApiKey?: () => Promise<string | undefined>;
|
|
12
|
+
fetchIssues?: typeof fetchLinearIssues;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
function formatCard(card: TaskCard): string {
|
|
@@ -84,5 +88,79 @@ export function registerCardCommand(program: Command, deps: CardCliDeps = {}): C
|
|
|
84
88
|
}
|
|
85
89
|
});
|
|
86
90
|
|
|
91
|
+
card.command('intake-scan')
|
|
92
|
+
.description('Scan Wish notes then Linear wishes in one scheduled invocation')
|
|
93
|
+
.option('--dir <path>', 'Wish folder path')
|
|
94
|
+
.option('--team <key>', 'Linear team key (omit to skip Linear)')
|
|
95
|
+
.option('--label <name>', 'Wish label or title prefix', 'wish')
|
|
96
|
+
.option('--json', 'Output JSON')
|
|
97
|
+
.action(async (options: { dir?: string; team?: string; label: string; json?: boolean }) => {
|
|
98
|
+
const result = {
|
|
99
|
+
folder: { added: 0, updated: 0, skipped: 0 },
|
|
100
|
+
linear: { added: 0, duplicate: 0, failed: 0 },
|
|
101
|
+
skipped: [] as string[],
|
|
102
|
+
failed: [] as string[],
|
|
103
|
+
};
|
|
104
|
+
let store: CardStore | undefined;
|
|
105
|
+
try {
|
|
106
|
+
const dir = resolve(options.dir ?? join(process.env.OBSIDIAN_VAULT_ROOT ?? '', '00. Inbox', '00. Wish'));
|
|
107
|
+
store = createStore();
|
|
108
|
+
result.folder = scanWishFolder({ dir, store });
|
|
109
|
+
} catch {
|
|
110
|
+
result.failed.push('Wish 폴더 스캔 실패');
|
|
111
|
+
} finally {
|
|
112
|
+
try { store?.close(); } catch {
|
|
113
|
+
if (!result.failed.includes('Wish 폴더 스캔 실패')) result.failed.push('Wish 폴더 스캔 실패');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
store = undefined;
|
|
118
|
+
if (!options.team?.trim()) {
|
|
119
|
+
result.skipped.push('Linear 팀 미지정');
|
|
120
|
+
} else {
|
|
121
|
+
try {
|
|
122
|
+
store = createStore();
|
|
123
|
+
result.linear = await scanLinearWishes({ teamKey: options.team, label: options.label, store,
|
|
124
|
+
deps: { getApiKey: deps.getApiKey, fetchIssues: deps.fetchIssues } });
|
|
125
|
+
if (result.linear.failed > 0) result.failed.push(`Linear 항목 ${result.linear.failed}건 실패`);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (error instanceof Error && error.message === LINEAR_WISH_KEY_MISSING) {
|
|
128
|
+
result.skipped.push('Linear 키 없음');
|
|
129
|
+
} else {
|
|
130
|
+
result.failed.push('Linear 스캔 실패');
|
|
131
|
+
}
|
|
132
|
+
} finally {
|
|
133
|
+
try { store?.close(); } catch {
|
|
134
|
+
if (!result.failed.includes('Linear 스캔 실패')) result.failed.push('Linear 스캔 실패');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
write(options.json ? `${JSON.stringify(result)}\n` :
|
|
140
|
+
`폴더 추가 ${result.folder.added} · Linear 추가 ${result.linear.added} · 건너뜀(${result.skipped.join(', ') || '없음'})${result.failed.length ? ` · 실패(${result.failed.join(', ')})` : ''}\n`);
|
|
141
|
+
if (result.failed.length) process.exitCode = 1;
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
card.command('linear-scan')
|
|
145
|
+
.description('Create wish cards from open Linear issues')
|
|
146
|
+
.requiredOption('--team <key>', 'Linear team key')
|
|
147
|
+
.option('--label <name>', 'Wish label or title prefix', 'wish')
|
|
148
|
+
.option('--json', 'Output JSON')
|
|
149
|
+
.action(async (options: { team: string; label: string; json?: boolean }) => {
|
|
150
|
+
let store: CardStore | undefined;
|
|
151
|
+
try {
|
|
152
|
+
store = createStore();
|
|
153
|
+
const result = await scanLinearWishes({ teamKey: options.team, label: options.label, store,
|
|
154
|
+
deps: { getApiKey: deps.getApiKey, fetchIssues: deps.fetchIssues } });
|
|
155
|
+
write(options.json ? `${JSON.stringify(result)}\n` : `추가 ${result.added} · 중복 ${result.duplicate} · 실패 ${result.failed}\n`);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
158
|
+
process.stderr.write(`${message.split(/\r?\n/, 1)[0]}\n`);
|
|
159
|
+
process.exitCode = message === LINEAR_WISH_KEY_MISSING ? 2 : 1;
|
|
160
|
+
} finally {
|
|
161
|
+
store?.close();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
87
165
|
return card;
|
|
88
166
|
}
|
|
@@ -304,13 +304,15 @@ export async function runPodCommand(options: RunPodCommandOptions): Promise<PodC
|
|
|
304
304
|
|
|
305
305
|
let member: PodPoolMember | null = null;
|
|
306
306
|
let pool = options.poolScheduler;
|
|
307
|
-
if (!pool
|
|
308
|
-
const spec = resolvePodPoolSpec(options.pool, env);
|
|
309
|
-
if (!spec) throw new Error('pod command: 풀 스펙이 비었다');
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
307
|
+
if (!pool) {
|
|
308
|
+
const spec = resolvePodPoolSpec(options.pool, env, () => options.kubectl ? undefined : getUserConfig().pod?.pool);
|
|
309
|
+
if (options.pool && !spec) throw new Error('pod command: 풀 스펙이 비었다');
|
|
310
|
+
if (spec) {
|
|
311
|
+
const members = parsePodPool(spec);
|
|
312
|
+
const checked = (options.checkPool ?? checkPodPool)(members, baseKubectl as PoolKubectl);
|
|
313
|
+
if (!checked.ok) throw new Error('pod command: 풀의 노드가 하나도 준비되지 않았다');
|
|
314
|
+
pool = new PodPoolScheduler(checked.ready);
|
|
315
|
+
}
|
|
314
316
|
}
|
|
315
317
|
if (pool) {
|
|
316
318
|
for (;;) {
|
|
@@ -357,6 +359,8 @@ export async function runPodCommand(options: RunPodCommandOptions): Promise<PodC
|
|
|
357
359
|
if (synced && !synced.ok) throw new Error(`pod command: 이미지 판을 못 맞췄다: ${synced.detail}`);
|
|
358
360
|
if (synced?.imageRef) member = { ...member, imageRef: synced.imageRef };
|
|
359
361
|
}
|
|
362
|
+
const imageRef = member?.imageRef;
|
|
363
|
+
if (!imageRef) log('pod.command-job', 'image-fallback-local', { reason: !member ? 'no-pool-member' : !imageCommit ? 'image-commit-unavailable' : 'registry-tag-unavailable' });
|
|
360
364
|
const ghToken = options.clone ? (options.ghToken ?? defaultGhToken)() : undefined;
|
|
361
365
|
const secret = commandJobSecret({ name, namespace, launch, skills, skillEnvText, ...(grokAuth !== undefined ? { grokAuth } : {}), ...(ghToken !== undefined ? { ghToken } : {}) });
|
|
362
366
|
if (secret) {
|
|
@@ -364,8 +368,8 @@ export async function runPodCommand(options: RunPodCommandOptions): Promise<PodC
|
|
|
364
368
|
if (applied.status !== 0) throw new Error(applied.stderr.trim() || 'pod command: Secret 적용 실패');
|
|
365
369
|
}
|
|
366
370
|
const manifest = podCommandJobManifest({
|
|
367
|
-
name, namespace, launch, image:
|
|
368
|
-
...(
|
|
371
|
+
name, namespace, launch, image: imageRef ?? image,
|
|
372
|
+
...(imageRef ? { imagePullPolicy: 'IfNotPresent' as const } : {}),
|
|
369
373
|
repoUrl, command, skills, ...(llm ? { llm } : {}), ...(options.clone ? { clone: true } : {}),
|
|
370
374
|
...(options.source ? { source: options.source } : {}), ...(hostMirror ? { hostMirror } : {}), ...(bunCache ? { bunCache } : {}), ...(memoryLimit ? { memoryLimit } : {}), deadlineSeconds,
|
|
371
375
|
...(options.runId ? { runId: options.runId } : {}),
|
|
@@ -398,7 +402,7 @@ export async function runPodCommand(options: RunPodCommandOptions): Promise<PodC
|
|
|
398
402
|
llm: llm ?? null,
|
|
399
403
|
command: command.join(' ').slice(0, COMMAND_LOG_CHARS),
|
|
400
404
|
});
|
|
401
|
-
return { exitCode, artifactsDir, job: name, image:
|
|
405
|
+
return { exitCode, artifactsDir, job: name, image: imageRef ?? image };
|
|
402
406
|
} catch (err) {
|
|
403
407
|
cleanupSecret();
|
|
404
408
|
throw err;
|
|
@@ -5,9 +5,9 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
5
5
|
import { closeSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { dlopen } from 'bun:ffi';
|
|
8
|
-
import { hostLeaseBaseDir } from '../../pod-lease/host-lease.js';
|
|
8
|
+
import { hostLeaseBaseDir, type PendingJobIdentity } from '../../pod-lease/host-lease.js';
|
|
9
9
|
|
|
10
|
-
/** Persisted on a Job admitted through the host lease; the file lease is
|
|
10
|
+
/** Persisted on a Job admitted through the host lease; the file lease remains until its Pod is observed Running or terminal. */
|
|
11
11
|
export const POD_HOST_LEASE_ANNOTATION = 'elanous.dev/host-lease-admitted';
|
|
12
12
|
|
|
13
13
|
// `get pods --all-namespaces -o json` on a busy cluster is several MB — the default spawnSync
|
|
@@ -25,6 +25,8 @@ export interface PodLeaseMember {
|
|
|
25
25
|
capacity: number;
|
|
26
26
|
running: number | null;
|
|
27
27
|
pending: number | null;
|
|
28
|
+
/** Job names of Pending harness Pods already included in pending (used to avoid counting the same Job's host lease twice). */
|
|
29
|
+
pendingJobs?: PendingJobIdentity[];
|
|
28
30
|
/** Running harness Pods whose Jobs predate host lease admission. */
|
|
29
31
|
unleasedRunning: number | null;
|
|
30
32
|
memoryLimitBytes: number | null;
|
|
@@ -52,6 +54,8 @@ export interface PoolLeaseRecommendation {
|
|
|
52
54
|
accountSlots: number | null;
|
|
53
55
|
running: number | null;
|
|
54
56
|
pending: number | null;
|
|
57
|
+
/** Names of Pending Jobs already counted in pending. */
|
|
58
|
+
pendingJobs?: PendingJobIdentity[];
|
|
55
59
|
/** Absent only for injected legacy status fixtures; real measurements always report a number or null. */
|
|
56
60
|
unleasedRunning?: number | null;
|
|
57
61
|
}
|
|
@@ -294,6 +298,7 @@ export function measurePoolLease(members: readonly PodPoolMember[], deps: { kube
|
|
|
294
298
|
}
|
|
295
299
|
if (!jobsValid) reasons.push('cluster jobs: missing name/labels');
|
|
296
300
|
let running = 0, pending = 0, unleasedRunning = 0, limits = 0, limitsValid = true, reservationsValid = nodeItems !== null && nodeNames.size === nodeItems.length;
|
|
301
|
+
const pendingJobs = new Map<string, PendingJobIdentity>();
|
|
297
302
|
let unknownPhase = false;
|
|
298
303
|
const seenPods = new Set<string>();
|
|
299
304
|
for (const pod of podItems) {
|
|
@@ -314,8 +319,14 @@ export function measurePoolLease(members: readonly PodPoolMember[], deps: { kube
|
|
|
314
319
|
const spec = object(pod.spec);
|
|
315
320
|
let limit: number | null = null;
|
|
316
321
|
if (harness) {
|
|
317
|
-
if (phase === 'Pending')
|
|
318
|
-
|
|
322
|
+
if (phase === 'Pending') {
|
|
323
|
+
pending++;
|
|
324
|
+
const jobName = labels?.['elanous.job'] ?? labels?.['job-name'];
|
|
325
|
+
if (typeof jobName === 'string' && jobName && typeof metadata.namespace === 'string' && metadata.namespace) {
|
|
326
|
+
const identity = { context: member.context, namespace: metadata.namespace, job: jobName };
|
|
327
|
+
pendingJobs.set(JSON.stringify(identity), identity);
|
|
328
|
+
}
|
|
329
|
+
} else {
|
|
319
330
|
running++;
|
|
320
331
|
const jobName = labels?.['elanous.job'] ?? labels?.['job-name'];
|
|
321
332
|
if (typeof jobName !== 'string' || !leasedJobs.has(jobName)) unleasedRunning++;
|
|
@@ -333,7 +344,7 @@ export function measurePoolLease(members: readonly PodPoolMember[], deps: { kube
|
|
|
333
344
|
if (nodeFree.has(nodeName)) nodeFree.set(nodeName, nodeFree.get(nodeName)! - Math.max(requested, limit ?? 0));
|
|
334
345
|
}
|
|
335
346
|
if (unknownPhase) reasons.push('cluster pods: missing/Unknown phase');
|
|
336
|
-
if (jobsValid && !unknownPhase) { result.running = running; result.pending = pending; result.unleasedRunning = unleasedRunning; }
|
|
347
|
+
if (jobsValid && !unknownPhase) { result.running = running; result.pending = pending; result.pendingJobs = [...pendingJobs.values()]; result.unleasedRunning = unleasedRunning; }
|
|
337
348
|
if (limitsValid && jobsValid && !unknownPhase) result.memoryLimitBytes = limits;
|
|
338
349
|
else if (!limitsValid) reasons.push('cluster pods: Running Pod memory limit missing/invalid');
|
|
339
350
|
if (reservationsValid && limitsValid && jobsValid && !unknownPhase) result.availableMemoryByNodeBytes = [...nodeFree.values()];
|
|
@@ -366,6 +377,7 @@ export function recommendConcurrency(measure: PoolLeaseMeasure, options: { capac
|
|
|
366
377
|
if (!Number.isSafeInteger(options.capacity) || options.capacity < 0) return { ...empty, reason: '측정 불가: capacity' };
|
|
367
378
|
const running = measure.members.reduce((sum, m) => sum + m.running!, 0);
|
|
368
379
|
const pending = measure.members.reduce((sum, m) => sum + m.pending!, 0);
|
|
380
|
+
const pendingJobs = measure.members.flatMap((m) => m.pendingJobs ?? []);
|
|
369
381
|
const unleasedRunning = measure.members.reduce((sum, m) => sum + m.unleasedRunning!, 0);
|
|
370
382
|
// Pool-wide free = sum of per-member free slots: a member over its cap counts as full, never negative,
|
|
371
383
|
// so it cannot zero another member's free slot (and its unleased Pods only consume its own free slots).
|
|
@@ -393,5 +405,5 @@ export function recommendConcurrency(measure: PoolLeaseMeasure, options: { capac
|
|
|
393
405
|
const recommended = Math.max(0, Math.min(capacitySlots, memoryBound) - eligibleUnleasedRunning);
|
|
394
406
|
const limitedBy = memoryBound < capacitySlots ? 'memory' : 'capacity';
|
|
395
407
|
if (unleasedRunning > 0) debug.log('pod-lease', 'unleased', { unleasedRunning, running, recommended });
|
|
396
|
-
return { recommended, limitedBy, reason: measure.members.some((m) => m.reason === 'dns') ? 'dns' : null, capacitySlots, memorySlots, liteMemorySlots, placeableSlots, accountSlots, running, pending, unleasedRunning };
|
|
408
|
+
return { recommended, limitedBy, reason: measure.members.some((m) => m.reason === 'dns') ? 'dns' : null, capacitySlots, memorySlots, liteMemorySlots, placeableSlots, accountSlots, running, pending, pendingJobs, unleasedRunning };
|
|
397
409
|
}
|