@repo-os/repoos 0.5.45
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/LICENSE.md +110 -0
- package/README.md +272 -0
- package/dist/.build-info.json +4 -0
- package/dist/.build-stamp.json +3 -0
- package/dist/cli/colors.d.ts +13 -0
- package/dist/cli/colors.js +37 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +221 -0
- package/dist/commands/check.d.ts +170 -0
- package/dist/commands/check.js +1227 -0
- package/dist/commands/docs.d.ts +2 -0
- package/dist/commands/docs.js +70 -0
- package/dist/commands/gc.d.ts +1 -0
- package/dist/commands/gc.js +57 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +699 -0
- package/dist/commands/screenshots.d.ts +7 -0
- package/dist/commands/screenshots.js +77 -0
- package/dist/commands/serve.d.ts +55 -0
- package/dist/commands/serve.js +204 -0
- package/dist/commands/status.d.ts +140 -0
- package/dist/commands/status.js +569 -0
- package/dist/commands/stop.d.ts +1 -0
- package/dist/commands/stop.js +59 -0
- package/dist/commands/tasks.d.ts +47 -0
- package/dist/commands/tasks.js +334 -0
- package/dist/commands/tunnel.d.ts +1 -0
- package/dist/commands/tunnel.js +1271 -0
- package/dist/commands/ui-harness.d.ts +53 -0
- package/dist/commands/ui-harness.js +62 -0
- package/dist/commands/ui-smoke.d.ts +6 -0
- package/dist/commands/ui-smoke.js +220 -0
- package/dist/commands/upgrade.d.ts +15 -0
- package/dist/commands/upgrade.js +188 -0
- package/dist/core/auth-store.d.ts +81 -0
- package/dist/core/auth-store.js +530 -0
- package/dist/core/auth.d.ts +75 -0
- package/dist/core/auth.js +124 -0
- package/dist/core/bootstrap.d.ts +41 -0
- package/dist/core/bootstrap.js +236 -0
- package/dist/core/build.d.ts +92 -0
- package/dist/core/build.js +249 -0
- package/dist/core/canary.d.ts +10 -0
- package/dist/core/canary.js +14 -0
- package/dist/core/check-failure-summary.d.ts +10 -0
- package/dist/core/check-failure-summary.js +34 -0
- package/dist/core/config.d.ts +160 -0
- package/dist/core/config.js +1288 -0
- package/dist/core/context-pack.d.ts +74 -0
- package/dist/core/context-pack.js +778 -0
- package/dist/core/db.d.ts +236 -0
- package/dist/core/db.js +747 -0
- package/dist/core/detect.d.ts +69 -0
- package/dist/core/detect.js +251 -0
- package/dist/core/docs.d.ts +76 -0
- package/dist/core/docs.js +225 -0
- package/dist/core/frontmatter.d.ts +29 -0
- package/dist/core/frontmatter.js +215 -0
- package/dist/core/git.d.ts +505 -0
- package/dist/core/git.js +1453 -0
- package/dist/core/indexer.d.ts +33 -0
- package/dist/core/indexer.js +282 -0
- package/dist/core/input.d.ts +66 -0
- package/dist/core/input.js +222 -0
- package/dist/core/logger.d.ts +70 -0
- package/dist/core/logger.js +138 -0
- package/dist/core/models.d.ts +45 -0
- package/dist/core/models.js +291 -0
- package/dist/core/net-probe.d.ts +4 -0
- package/dist/core/net-probe.js +20 -0
- package/dist/core/providers/deepinfra.d.ts +23 -0
- package/dist/core/providers/deepinfra.js +44 -0
- package/dist/core/providers/index.d.ts +24 -0
- package/dist/core/providers/index.js +59 -0
- package/dist/core/providers/openrouter.d.ts +28 -0
- package/dist/core/providers/openrouter.js +82 -0
- package/dist/core/providers/spend.d.ts +86 -0
- package/dist/core/providers/spend.js +286 -0
- package/dist/core/providers/types.d.ts +56 -0
- package/dist/core/providers/types.js +39 -0
- package/dist/core/repoos.d.ts +59 -0
- package/dist/core/repoos.js +221 -0
- package/dist/core/runtime.d.ts +35 -0
- package/dist/core/runtime.js +167 -0
- package/dist/core/skills-registry.d.ts +39 -0
- package/dist/core/skills-registry.js +148 -0
- package/dist/core/skills-registry.test.d.ts +1 -0
- package/dist/core/skills-registry.test.js +52 -0
- package/dist/core/sysmem.d.ts +7 -0
- package/dist/core/sysmem.js +55 -0
- package/dist/core/tailscale.d.ts +2 -0
- package/dist/core/tailscale.js +19 -0
- package/dist/core/task.d.ts +53 -0
- package/dist/core/task.js +310 -0
- package/dist/core/toml-line.d.ts +20 -0
- package/dist/core/toml-line.js +52 -0
- package/dist/core/toml-validate.d.ts +44 -0
- package/dist/core/toml-validate.js +335 -0
- package/dist/core/tunnel-assistant.d.ts +30 -0
- package/dist/core/tunnel-assistant.js +65 -0
- package/dist/core/tunnel-registry.d.ts +96 -0
- package/dist/core/tunnel-registry.js +267 -0
- package/dist/core/tunnel-registry.test.d.ts +1 -0
- package/dist/core/tunnel-registry.test.js +309 -0
- package/dist/core/tunnel.d.ts +103 -0
- package/dist/core/tunnel.js +320 -0
- package/dist/core/types.d.ts +811 -0
- package/dist/core/types.js +27 -0
- package/dist/core/worktree-gc.d.ts +57 -0
- package/dist/core/worktree-gc.js +194 -0
- package/dist/server/__tests__/integration-job.test.d.ts +1 -0
- package/dist/server/__tests__/integration-job.test.js +129 -0
- package/dist/server/agents.d.ts +1020 -0
- package/dist/server/agents.js +4070 -0
- package/dist/server/attachments.d.ts +51 -0
- package/dist/server/attachments.js +130 -0
- package/dist/server/auto-engineering.d.ts +45 -0
- package/dist/server/auto-engineering.js +275 -0
- package/dist/server/branchless-release.d.ts +22 -0
- package/dist/server/branchless-release.js +67 -0
- package/dist/server/built-in-agents.d.ts +305 -0
- package/dist/server/built-in-agents.js +1838 -0
- package/dist/server/cto-monitor.d.ts +35 -0
- package/dist/server/cto-monitor.js +281 -0
- package/dist/server/cto.d.ts +125 -0
- package/dist/server/cto.js +590 -0
- package/dist/server/deployments.d.ts +119 -0
- package/dist/server/deployments.js +325 -0
- package/dist/server/diff-snapshot.d.ts +20 -0
- package/dist/server/diff-snapshot.js +73 -0
- package/dist/server/done.d.ts +160 -0
- package/dist/server/done.js +488 -0
- package/dist/server/freeform.d.ts +55 -0
- package/dist/server/freeform.js +179 -0
- package/dist/server/handoff.d.ts +99 -0
- package/dist/server/handoff.js +575 -0
- package/dist/server/hetzner.d.ts +45 -0
- package/dist/server/hetzner.js +117 -0
- package/dist/server/icons.d.ts +8 -0
- package/dist/server/icons.js +195 -0
- package/dist/server/integration-job.d.ts +75 -0
- package/dist/server/integration-job.js +144 -0
- package/dist/server/integration-orchestrator.d.ts +211 -0
- package/dist/server/integration-orchestrator.js +1299 -0
- package/dist/server/integration-status.d.ts +48 -0
- package/dist/server/integration-status.js +71 -0
- package/dist/server/live-index.d.ts +295 -0
- package/dist/server/live-index.js +452 -0
- package/dist/server/model-test.d.ts +20 -0
- package/dist/server/model-test.js +100 -0
- package/dist/server/ntfy.d.ts +57 -0
- package/dist/server/ntfy.js +112 -0
- package/dist/server/pm-attachments.d.ts +35 -0
- package/dist/server/pm-attachments.js +181 -0
- package/dist/server/pm-runs.d.ts +58 -0
- package/dist/server/pm-runs.js +80 -0
- package/dist/server/preview.d.ts +174 -0
- package/dist/server/preview.js +641 -0
- package/dist/server/release.d.ts +88 -0
- package/dist/server/release.js +449 -0
- package/dist/server/reload.d.ts +194 -0
- package/dist/server/reload.js +586 -0
- package/dist/server/remote-validation.d.ts +132 -0
- package/dist/server/remote-validation.js +478 -0
- package/dist/server/repo-lock.d.ts +36 -0
- package/dist/server/repo-lock.js +141 -0
- package/dist/server/review-guard.d.ts +14 -0
- package/dist/server/review-guard.js +159 -0
- package/dist/server/review.d.ts +243 -0
- package/dist/server/review.js +1211 -0
- package/dist/server/routes/agents.d.ts +6 -0
- package/dist/server/routes/agents.js +28 -0
- package/dist/server/routes/auth.d.ts +60 -0
- package/dist/server/routes/auth.js +755 -0
- package/dist/server/routes/config.d.ts +20 -0
- package/dist/server/routes/config.js +347 -0
- package/dist/server/routes/debugger.d.ts +33 -0
- package/dist/server/routes/debugger.js +360 -0
- package/dist/server/routes/deployments.d.ts +3 -0
- package/dist/server/routes/deployments.js +16 -0
- package/dist/server/routes/docs.d.ts +8 -0
- package/dist/server/routes/docs.js +135 -0
- package/dist/server/routes/helpers.d.ts +21 -0
- package/dist/server/routes/helpers.js +171 -0
- package/dist/server/routes/index.d.ts +19 -0
- package/dist/server/routes/index.js +18 -0
- package/dist/server/routes/info.d.ts +17 -0
- package/dist/server/routes/info.js +177 -0
- package/dist/server/routes/inputs.d.ts +7 -0
- package/dist/server/routes/inputs.js +125 -0
- package/dist/server/routes/model-providers.d.ts +27 -0
- package/dist/server/routes/model-providers.js +94 -0
- package/dist/server/routes/models.d.ts +3 -0
- package/dist/server/routes/models.js +36 -0
- package/dist/server/routes/notify.d.ts +2 -0
- package/dist/server/routes/notify.js +17 -0
- package/dist/server/routes/playground.d.ts +29 -0
- package/dist/server/routes/playground.js +81 -0
- package/dist/server/routes/release.d.ts +20 -0
- package/dist/server/routes/release.js +86 -0
- package/dist/server/routes/router.d.ts +12 -0
- package/dist/server/routes/router.js +32 -0
- package/dist/server/routes/skill-registry.d.ts +5 -0
- package/dist/server/routes/skill-registry.js +51 -0
- package/dist/server/routes/tasks.d.ts +58 -0
- package/dist/server/routes/tasks.js +1442 -0
- package/dist/server/routes/transcribe.d.ts +2 -0
- package/dist/server/routes/transcribe.js +124 -0
- package/dist/server/routes/types.d.ts +68 -0
- package/dist/server/routes/types.js +1 -0
- package/dist/server/routes/ui.d.ts +5 -0
- package/dist/server/routes/ui.js +81 -0
- package/dist/server/routes/utils.d.ts +3 -0
- package/dist/server/routes/utils.js +23 -0
- package/dist/server/serve-reaper.d.ts +135 -0
- package/dist/server/serve-reaper.js +491 -0
- package/dist/server/server.d.ts +49 -0
- package/dist/server/server.js +2171 -0
- package/dist/server/supervisor.d.ts +89 -0
- package/dist/server/supervisor.js +231 -0
- package/dist/server/system.d.ts +198 -0
- package/dist/server/system.js +480 -0
- package/dist/server/task-check.d.ts +45 -0
- package/dist/server/task-check.js +71 -0
- package/dist/server/task-transitions.d.ts +51 -0
- package/dist/server/task-transitions.js +78 -0
- package/dist/server/task-watchdog.d.ts +158 -0
- package/dist/server/task-watchdog.js +681 -0
- package/dist/server/test-run.d.ts +28 -0
- package/dist/server/test-run.js +81 -0
- package/dist/server/watcher.d.ts +21 -0
- package/dist/server/watcher.js +194 -0
- package/dist/server/write.d.ts +94 -0
- package/dist/server/write.js +345 -0
- package/dist/ui/assets/AgentsView-CF4wRvHh.css +1 -0
- package/dist/ui/assets/AgentsView-D-myL-kA.js +1 -0
- package/dist/ui/assets/ContextView-D3TC-RSp.css +1 -0
- package/dist/ui/assets/ContextView-DsOqAdyE.js +4 -0
- package/dist/ui/assets/DashboardView-BOhsIJqO.js +1 -0
- package/dist/ui/assets/DashboardView-Ck9o0RP2.css +1 -0
- package/dist/ui/assets/DeploymentsView--iIUVfEH.css +1 -0
- package/dist/ui/assets/DeploymentsView-DXu_FYR2.js +1 -0
- package/dist/ui/assets/InputsView-24HVbVPk.js +1 -0
- package/dist/ui/assets/InputsView-BLb7GHtx.css +1 -0
- package/dist/ui/assets/LoginView-6QlGg6cx.css +1 -0
- package/dist/ui/assets/LoginView-BqupI0Lt.js +1 -0
- package/dist/ui/assets/ReleasesView-BEG1A0YH.css +1 -0
- package/dist/ui/assets/ReleasesView-CAgMuxpe.js +3 -0
- package/dist/ui/assets/SettingsView-CA-NYSMK.css +1 -0
- package/dist/ui/assets/SettingsView-O3iZSnjg.js +3 -0
- package/dist/ui/assets/WorkView-D8Tl6qwy.js +1 -0
- package/dist/ui/assets/WorkView-DMYL2s3W.css +1 -0
- package/dist/ui/assets/abnfDiagram-VCTEODGH-J5lkSnEE.js +1 -0
- package/dist/ui/assets/arc-BHZnmhhM.js +1 -0
- package/dist/ui/assets/architecture-7GRP2DOG-pLdFt-xS.js +1 -0
- package/dist/ui/assets/architectureDiagram-5GKGNRK7-C3k89uKX.js +36 -0
- package/dist/ui/assets/array-BifhSqXX.js +1 -0
- package/dist/ui/assets/blockDiagram-I7D4REHJ-AWNoBzop.js +129 -0
- package/dist/ui/assets/button-lbikqSph.js +1 -0
- package/dist/ui/assets/c4Diagram-7LVT6UL2-DKG1D5gd.js +38 -0
- package/dist/ui/assets/channel-gA4qBv3A.js +1 -0
- package/dist/ui/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/ui/assets/chunk-4HAMMTFA-D1YR8lF_.js +62 -0
- package/dist/ui/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/ui/assets/chunk-75Z2AOVW-5GuBxfsL.js +2 -0
- package/dist/ui/assets/chunk-DU6HZSFF-DfdNNqwa.js +127 -0
- package/dist/ui/assets/chunk-F27PBJKO-BPZzinQ4.js +1 -0
- package/dist/ui/assets/chunk-FOHPRMQF-l2z4K2jD.js +161 -0
- package/dist/ui/assets/chunk-GMAD6QVW-DGWvSKj5.js +72 -0
- package/dist/ui/assets/chunk-GVQU2GXP-D6Aw75wJ.js +1 -0
- package/dist/ui/assets/chunk-IMKFNOWR-B8mMBKCW.js +231 -0
- package/dist/ui/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/ui/assets/chunk-L3NEJ4N5-D5OJuXYE.js +1 -0
- package/dist/ui/assets/chunk-OSK3NFVY-B7r9w2UW.js +10 -0
- package/dist/ui/assets/chunk-P2QGCYS3-C74X4AQX.js +1 -0
- package/dist/ui/assets/chunk-POPQ4Y6H-C5_u1gUS.js +1 -0
- package/dist/ui/assets/chunk-PWAF6VOD-DfoTLtxn.js +1 -0
- package/dist/ui/assets/chunk-SHT3W25Y-D40m2eqz.js +168 -0
- package/dist/ui/assets/chunk-SVP7TREG-euxi0Kap.js +88 -0
- package/dist/ui/assets/chunk-TICWLB2K-fkdxngzN.js +206 -0
- package/dist/ui/assets/chunk-XXDRQBXY-DFBUG-OT.js +1 -0
- package/dist/ui/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/ui/assets/classDiagram-ZZMXUADV-BzW8bq2P.js +1 -0
- package/dist/ui/assets/classDiagram-v2-VYDZK3BY-BzW8bq2P.js +1 -0
- package/dist/ui/assets/cose-bilkent-JH36ORCC-BTcgMon1.js +1 -0
- package/dist/ui/assets/cynefin-OW5HDTMX-B5m_COsS.js +1 -0
- package/dist/ui/assets/cynefinDiagram-5FMLGOSQ-C-AG6CGe.js +62 -0
- package/dist/ui/assets/cytoscape.esm-FBntH-9t.js +321 -0
- package/dist/ui/assets/dagre-GXQ25YYZ-DDfDnp8L.js +4 -0
- package/dist/ui/assets/dagre-PrKaheQc.js +1 -0
- package/dist/ui/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/ui/assets/diagram-S7CK7UJ4-DjQZAlEY.js +30 -0
- package/dist/ui/assets/diagram-UQ7AKVKN-DAZ9yp1B.js +41 -0
- package/dist/ui/assets/diagram-VSXAHHWV-BWepUKJD.js +3 -0
- package/dist/ui/assets/diagram-VX7I27RA-EcV1J81b.js +24 -0
- package/dist/ui/assets/diagram-Z3DM3KII-Dbz7XU_K.js +24 -0
- package/dist/ui/assets/dist-DTg6UBE_.js +1 -0
- package/dist/ui/assets/ebnfDiagram-PWID7BFC-BUyQw8Mm.js +1 -0
- package/dist/ui/assets/erDiagram-RLTQ6QDP-WVf8ukKt.js +99 -0
- package/dist/ui/assets/eventmodeling-NTZA5JFV-DHqyLOAn.js +1 -0
- package/dist/ui/assets/flowDiagram-HODETNUW-CYk_ze5K.js +1 -0
- package/dist/ui/assets/ganttDiagram-EL5Y4UJY-rB4MZuB-.js +292 -0
- package/dist/ui/assets/gitGraph-4MIJSDKK-BOTWM8dY.js +1 -0
- package/dist/ui/assets/gitGraphDiagram-WWUBYQGX-eYscuhtP.js +106 -0
- package/dist/ui/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/ui/assets/index-BACBfnga.css +1 -0
- package/dist/ui/assets/index-BOQ-ust6.js +26 -0
- package/dist/ui/assets/info-A6RAGUB7-_67wOORe.js +1 -0
- package/dist/ui/assets/infoDiagram-27XIBGKW-XVXbddTA.js +2 -0
- package/dist/ui/assets/init-C-OQMol4.js +1 -0
- package/dist/ui/assets/ishikawaDiagram-5VMMS53U-ClLNiEru.js +70 -0
- package/dist/ui/assets/journeyDiagram-3NMN7TZE-NRawjR6i.js +139 -0
- package/dist/ui/assets/kanban-definition-UXKFOSKX-BgSzBfIx.js +89 -0
- package/dist/ui/assets/katex-DolUETbr.js +257 -0
- package/dist/ui/assets/line-KAyfuul4.js +1 -0
- package/dist/ui/assets/linear-cCCPOpu7.js +1 -0
- package/dist/ui/assets/mermaid-parser.core-CgXZk1iN.js +7 -0
- package/dist/ui/assets/mermaid.core-BUUkChHW.js +44 -0
- package/dist/ui/assets/mindmap-definition-YA3MSWOX-Cpn7vW4r.js +96 -0
- package/dist/ui/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/ui/assets/packet-AYTQ26CC-0lZwM-d6.js +1 -0
- package/dist/ui/assets/path-COt_16Va.js +1 -0
- package/dist/ui/assets/pegDiagram-XKGWAZYB-impy0inn.js +1 -0
- package/dist/ui/assets/pie-WAS4IAKB-CqfdGHYg.js +1 -0
- package/dist/ui/assets/pieDiagram-E7YTZNPT-CxjL4I1h.js +39 -0
- package/dist/ui/assets/quadrantDiagram-AXDQQJYC-Cjd1QMIe.js +7 -0
- package/dist/ui/assets/radar-RG4KPBEZ-CRkQIwiv.js +1 -0
- package/dist/ui/assets/railroad-74A4TZTK-i67XSWTB.js +1 -0
- package/dist/ui/assets/railroad-abnf-HS5TGJTU-Cv9m5aS3.js +1 -0
- package/dist/ui/assets/railroad-ebnf-LZEXJU2U-C5ZIn-Jh.js +1 -0
- package/dist/ui/assets/railroad-peg-WCYAUIDC-CGra9Oq-.js +1 -0
- package/dist/ui/assets/railroadDiagram-O6MQD6OU-_pK0qyaY.js +1 -0
- package/dist/ui/assets/releases-B0WNV-SY.js +1 -0
- package/dist/ui/assets/repoos-cto-square.webp +0 -0
- package/dist/ui/assets/repoos-helpful-pm-square.webp +0 -0
- package/dist/ui/assets/repoos-orchestrator-square.webp +0 -0
- package/dist/ui/assets/repoos-performance-agent-square.webp +0 -0
- package/dist/ui/assets/repoos-ross-from-friends-square.webp +0 -0
- package/dist/ui/assets/repoos-tech-debt-agent-square.webp +0 -0
- package/dist/ui/assets/requirementDiagram-BXWQKSXE-CRrFX-yw.js +84 -0
- package/dist/ui/assets/rough.esm-By172zw-.js +1 -0
- package/dist/ui/assets/sankeyDiagram-P5KCCOFB-X_xFRj9E.js +40 -0
- package/dist/ui/assets/sequenceDiagram-WJ2MYXX4-Byb49lKf.js +162 -0
- package/dist/ui/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- package/dist/ui/assets/src-BH-TyZbA.js +1 -0
- package/dist/ui/assets/stateDiagram-D77RDMKH-CzaPrqYF.js +1 -0
- package/dist/ui/assets/stateDiagram-v2-MP3YSRHH-BCXckz7K.js +1 -0
- package/dist/ui/assets/swimlanes-42K2YHIH-Cx_1lnqr.js +1 -0
- package/dist/ui/assets/swimlanesDiagram-VR7AAH4N-54qsKi6A.js +8 -0
- package/dist/ui/assets/timeline-definition-24CTP7MA-B1IbZPQ-.js +120 -0
- package/dist/ui/assets/treeView-Q6P3EWNA-DFWhVE3d.js +1 -0
- package/dist/ui/assets/treemap-WGGIJYW6-BmbYPThn.js +1 -0
- package/dist/ui/assets/vendor-ui-DPm7zLxi.js +3 -0
- package/dist/ui/assets/vendor-vue-CobgyEJp.js +1 -0
- package/dist/ui/assets/vennDiagram-4TSXK5OY-Ae2AtRpt.js +34 -0
- package/dist/ui/assets/wardley-WFR3VGLG-BtD4X4tL.js +1 -0
- package/dist/ui/assets/wardleyDiagram-VM6X3IG4-B3YN2fTd.js +78 -0
- package/dist/ui/assets/xychartDiagram-S5SC5T6Z-CIzJfMKA.js +7 -0
- package/dist/ui/favicon.svg +11 -0
- package/dist/ui/index.html +49 -0
- package/dist/ui/sw.js +48 -0
- package/package.json +91 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Supervisor: periodic reconciliation of active tasks against runner state,
|
|
3
|
+
* worktree progress, and process health. Emits heartbeat reports to the Control page.
|
|
4
|
+
*
|
|
5
|
+
* Responsibilities:
|
|
6
|
+
* - Classify tasks into health states (healthy, quiet-but-alive, stalled, orphaned, etc.)
|
|
7
|
+
* - Detect low-progress loops and resource constraints
|
|
8
|
+
* - Invoke diagnostic AI for ambiguous cases (bounded and rate-limited)
|
|
9
|
+
* - Apply safe recovery actions only within configured policy
|
|
10
|
+
* - Persist audit log in cache directory
|
|
11
|
+
* - Emit SSE events and UI feedback
|
|
12
|
+
*/
|
|
13
|
+
import type { RepoOSConfig, SupervisorConfig, TaskHealthStatus } from "../core/types.js";
|
|
14
|
+
import type { RepoEvent } from "./live-index.js";
|
|
15
|
+
import type { LiveIndex } from "./live-index.js";
|
|
16
|
+
/** Default supervisor configuration. */
|
|
17
|
+
export declare const DEFAULT_SUPERVISOR_CONFIG: SupervisorConfig;
|
|
18
|
+
/** Validated and normalized supervisor configuration. */
|
|
19
|
+
export declare class SupervisorConfig_ {
|
|
20
|
+
readonly enabled: boolean;
|
|
21
|
+
readonly interval: number;
|
|
22
|
+
readonly mode: "observe" | "recover";
|
|
23
|
+
readonly quietThreshold: number;
|
|
24
|
+
readonly stallThreshold: number;
|
|
25
|
+
readonly maxRestarts: number;
|
|
26
|
+
readonly cooldownSeconds: number;
|
|
27
|
+
readonly diagnosticAgent: string | null;
|
|
28
|
+
readonly fallbacks: Array<{
|
|
29
|
+
agent?: string;
|
|
30
|
+
model?: string;
|
|
31
|
+
}>;
|
|
32
|
+
constructor(cfg?: SupervisorConfig);
|
|
33
|
+
}
|
|
34
|
+
/** Task health state with evidence. */
|
|
35
|
+
export interface TaskHealthReport {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
status: TaskHealthStatus;
|
|
39
|
+
evidence: string[];
|
|
40
|
+
lastOutput?: string;
|
|
41
|
+
action?: string;
|
|
42
|
+
warning?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Supervisor cycle result. */
|
|
45
|
+
export interface SupervisorCycleResult {
|
|
46
|
+
id: string;
|
|
47
|
+
startedAt: string;
|
|
48
|
+
completedAt: string;
|
|
49
|
+
nextCheckAt: string;
|
|
50
|
+
mode: "observe" | "recover";
|
|
51
|
+
totalActive: number;
|
|
52
|
+
healthy: number;
|
|
53
|
+
warnings: number;
|
|
54
|
+
tasks: TaskHealthReport[];
|
|
55
|
+
}
|
|
56
|
+
/** The agent supervisor. */
|
|
57
|
+
export declare class AgentSupervisor {
|
|
58
|
+
readonly config: SupervisorConfig_;
|
|
59
|
+
private repoosCfg;
|
|
60
|
+
private index;
|
|
61
|
+
private emitEvent;
|
|
62
|
+
private timer;
|
|
63
|
+
private running;
|
|
64
|
+
private lastCycleId;
|
|
65
|
+
private auditLog;
|
|
66
|
+
/** Own logger, same pattern as ReviewManager (0187): the supervisor was the
|
|
67
|
+
* one agent in the system with no logging at all — its JSON audit log in
|
|
68
|
+
* the cache dir is a separate, UI-facing thing, not the NDJSON pipeline. */
|
|
69
|
+
private readonly logger;
|
|
70
|
+
constructor(cfg: RepoOSConfig, index: LiveIndex, emitEvent: (e: RepoEvent) => void);
|
|
71
|
+
/** Start the supervisor loop. */
|
|
72
|
+
start(): void;
|
|
73
|
+
/** Stop the supervisor loop. */
|
|
74
|
+
stop(): void;
|
|
75
|
+
/** Run one supervision cycle immediately. */
|
|
76
|
+
runCycle(): Promise<SupervisorCycleResult | null>;
|
|
77
|
+
private executeCycle;
|
|
78
|
+
/** Classify a task's health status. */
|
|
79
|
+
private classifyTask;
|
|
80
|
+
/** Get the most recent heartbeat. */
|
|
81
|
+
getLatestHeartbeat(): SupervisorCycleResult | null;
|
|
82
|
+
/** Get recent heartbeats. */
|
|
83
|
+
getRecentHeartbeats(limit?: number): SupervisorCycleResult[];
|
|
84
|
+
private emitHeartbeat;
|
|
85
|
+
private loadAuditLog;
|
|
86
|
+
private saveAuditLog;
|
|
87
|
+
private trimAuditLog;
|
|
88
|
+
private auditLogPath;
|
|
89
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Supervisor: periodic reconciliation of active tasks against runner state,
|
|
3
|
+
* worktree progress, and process health. Emits heartbeat reports to the Control page.
|
|
4
|
+
*
|
|
5
|
+
* Responsibilities:
|
|
6
|
+
* - Classify tasks into health states (healthy, quiet-but-alive, stalled, orphaned, etc.)
|
|
7
|
+
* - Detect low-progress loops and resource constraints
|
|
8
|
+
* - Invoke diagnostic AI for ambiguous cases (bounded and rate-limited)
|
|
9
|
+
* - Apply safe recovery actions only within configured policy
|
|
10
|
+
* - Persist audit log in cache directory
|
|
11
|
+
* - Emit SSE events and UI feedback
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { createLogger } from "../core/logger.js";
|
|
16
|
+
/** Default supervisor configuration. */
|
|
17
|
+
export const DEFAULT_SUPERVISOR_CONFIG = {
|
|
18
|
+
enabled: false,
|
|
19
|
+
interval: 300,
|
|
20
|
+
mode: "observe",
|
|
21
|
+
quietThreshold: 600,
|
|
22
|
+
stallThreshold: 3,
|
|
23
|
+
maxRestarts: 2,
|
|
24
|
+
cooldownSeconds: 60,
|
|
25
|
+
};
|
|
26
|
+
/** Validated and normalized supervisor configuration. */
|
|
27
|
+
export class SupervisorConfig_ {
|
|
28
|
+
enabled;
|
|
29
|
+
interval;
|
|
30
|
+
mode;
|
|
31
|
+
quietThreshold;
|
|
32
|
+
stallThreshold;
|
|
33
|
+
maxRestarts;
|
|
34
|
+
cooldownSeconds;
|
|
35
|
+
diagnosticAgent;
|
|
36
|
+
fallbacks;
|
|
37
|
+
constructor(cfg) {
|
|
38
|
+
const defaults = DEFAULT_SUPERVISOR_CONFIG;
|
|
39
|
+
this.enabled = cfg?.enabled ?? defaults.enabled ?? false;
|
|
40
|
+
this.interval = Math.max(60, cfg?.interval ?? defaults.interval ?? 300);
|
|
41
|
+
this.mode = cfg?.mode ?? defaults.mode ?? "observe";
|
|
42
|
+
this.quietThreshold = Math.max(60, cfg?.quietThreshold ?? defaults.quietThreshold ?? 600);
|
|
43
|
+
this.stallThreshold = Math.max(1, cfg?.stallThreshold ?? defaults.stallThreshold ?? 3);
|
|
44
|
+
this.maxRestarts = Math.max(0, cfg?.maxRestarts ?? defaults.maxRestarts ?? 2);
|
|
45
|
+
this.cooldownSeconds = Math.max(30, cfg?.cooldownSeconds ?? defaults.cooldownSeconds ?? 60);
|
|
46
|
+
this.diagnosticAgent = cfg?.diagnosticAgent ?? null;
|
|
47
|
+
this.fallbacks = cfg?.fallbacks ?? [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** The agent supervisor. */
|
|
51
|
+
export class AgentSupervisor {
|
|
52
|
+
config;
|
|
53
|
+
repoosCfg;
|
|
54
|
+
index;
|
|
55
|
+
emitEvent;
|
|
56
|
+
timer = null;
|
|
57
|
+
running = false;
|
|
58
|
+
lastCycleId = 0;
|
|
59
|
+
auditLog = [];
|
|
60
|
+
/** Own logger, same pattern as ReviewManager (0187): the supervisor was the
|
|
61
|
+
* one agent in the system with no logging at all — its JSON audit log in
|
|
62
|
+
* the cache dir is a separate, UI-facing thing, not the NDJSON pipeline. */
|
|
63
|
+
logger;
|
|
64
|
+
constructor(cfg, index, emitEvent) {
|
|
65
|
+
this.repoosCfg = cfg;
|
|
66
|
+
this.config = new SupervisorConfig_(cfg.supervisor);
|
|
67
|
+
this.index = index;
|
|
68
|
+
this.emitEvent = emitEvent;
|
|
69
|
+
this.logger = createLogger(cfg.root);
|
|
70
|
+
this.loadAuditLog();
|
|
71
|
+
}
|
|
72
|
+
/** Start the supervisor loop. */
|
|
73
|
+
start() {
|
|
74
|
+
if (!this.config.enabled || this.timer !== null)
|
|
75
|
+
return;
|
|
76
|
+
this.timer = setInterval(() => this.runCycle(), this.config.interval * 1000);
|
|
77
|
+
void this.runCycle();
|
|
78
|
+
}
|
|
79
|
+
/** Stop the supervisor loop. */
|
|
80
|
+
stop() {
|
|
81
|
+
if (this.timer !== null) {
|
|
82
|
+
clearInterval(this.timer);
|
|
83
|
+
this.timer = null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Run one supervision cycle immediately. */
|
|
87
|
+
async runCycle() {
|
|
88
|
+
if (this.running)
|
|
89
|
+
return null;
|
|
90
|
+
this.running = true;
|
|
91
|
+
try {
|
|
92
|
+
return await this.executeCycle();
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
this.running = false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async executeCycle() {
|
|
99
|
+
const cycleId = `cycle-${++this.lastCycleId}`;
|
|
100
|
+
const startedAt = new Date().toISOString();
|
|
101
|
+
const tasks = this.index.getTasks().filter((t) => t.status === "active");
|
|
102
|
+
const reports = [];
|
|
103
|
+
for (const task of tasks) {
|
|
104
|
+
const report = this.classifyTask(task);
|
|
105
|
+
reports.push(report);
|
|
106
|
+
}
|
|
107
|
+
const completedAt = new Date().toISOString();
|
|
108
|
+
const nextCheckAt = new Date(Date.now() + this.config.interval * 1000).toISOString();
|
|
109
|
+
const healthy = reports.filter((r) => r.status === "healthy").length;
|
|
110
|
+
const warnings = reports.filter((r) => r.warning || r.action).length;
|
|
111
|
+
const result = {
|
|
112
|
+
id: cycleId,
|
|
113
|
+
startedAt,
|
|
114
|
+
completedAt,
|
|
115
|
+
nextCheckAt,
|
|
116
|
+
mode: this.config.mode,
|
|
117
|
+
totalActive: tasks.length,
|
|
118
|
+
healthy,
|
|
119
|
+
warnings,
|
|
120
|
+
tasks: reports,
|
|
121
|
+
};
|
|
122
|
+
this.auditLog.push(result);
|
|
123
|
+
this.trimAuditLog();
|
|
124
|
+
this.saveAuditLog();
|
|
125
|
+
this.logger.agent("supervisor", warnings > 0 ? "warn" : "info", "supervision cycle complete", {
|
|
126
|
+
cycleId,
|
|
127
|
+
mode: result.mode,
|
|
128
|
+
totalActive: result.totalActive,
|
|
129
|
+
healthy,
|
|
130
|
+
warnings,
|
|
131
|
+
flagged: reports
|
|
132
|
+
.filter((r) => r.warning || r.action)
|
|
133
|
+
.map((r) => ({ id: r.id, status: r.status, warning: r.warning, action: r.action })),
|
|
134
|
+
});
|
|
135
|
+
this.emitHeartbeat(result);
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
/** Classify a task's health status. */
|
|
139
|
+
classifyTask(task) {
|
|
140
|
+
const evidence = [];
|
|
141
|
+
if (task.needsInput) {
|
|
142
|
+
return {
|
|
143
|
+
id: task.id,
|
|
144
|
+
title: task.title,
|
|
145
|
+
status: "waiting-for-human",
|
|
146
|
+
evidence: ["Task flagged needs_input; awaiting human decision."],
|
|
147
|
+
warning: "Waiting for human action",
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (task.needsMerge) {
|
|
151
|
+
return {
|
|
152
|
+
id: task.id,
|
|
153
|
+
title: task.title,
|
|
154
|
+
status: "blocked-on-merge",
|
|
155
|
+
evidence: ["Task branch has drifted from main; needs manual merge."],
|
|
156
|
+
warning: "Branch needs merge",
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
id: task.id,
|
|
161
|
+
title: task.title,
|
|
162
|
+
status: "healthy",
|
|
163
|
+
evidence: ["Task is active with no known issues."],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/** Get the most recent heartbeat. */
|
|
167
|
+
getLatestHeartbeat() {
|
|
168
|
+
return this.auditLog[this.auditLog.length - 1] ?? null;
|
|
169
|
+
}
|
|
170
|
+
/** Get recent heartbeats. */
|
|
171
|
+
getRecentHeartbeats(limit = 10) {
|
|
172
|
+
return this.auditLog.slice(-limit);
|
|
173
|
+
}
|
|
174
|
+
emitHeartbeat(result) {
|
|
175
|
+
const heartbeat = {
|
|
176
|
+
id: result.id,
|
|
177
|
+
startedAt: result.startedAt,
|
|
178
|
+
completedAt: result.completedAt,
|
|
179
|
+
nextCheckAt: result.nextCheckAt,
|
|
180
|
+
mode: result.mode,
|
|
181
|
+
totalActive: result.totalActive,
|
|
182
|
+
healthy: result.healthy,
|
|
183
|
+
warnings: result.warnings,
|
|
184
|
+
tasks: result.tasks.map((t) => ({
|
|
185
|
+
id: t.id,
|
|
186
|
+
title: t.title,
|
|
187
|
+
status: t.status,
|
|
188
|
+
lastOutput: t.lastOutput,
|
|
189
|
+
evidence: t.evidence.join(" "),
|
|
190
|
+
action: t.action || t.warning,
|
|
191
|
+
})),
|
|
192
|
+
};
|
|
193
|
+
this.emitEvent({
|
|
194
|
+
type: "supervisor.heartbeat",
|
|
195
|
+
heartbeat,
|
|
196
|
+
at: new Date().toISOString(),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
loadAuditLog() {
|
|
200
|
+
try {
|
|
201
|
+
const logPath = this.auditLogPath();
|
|
202
|
+
if (!existsSync(logPath)) {
|
|
203
|
+
this.auditLog = [];
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const data = JSON.parse(readFileSync(logPath, "utf8"));
|
|
207
|
+
this.auditLog = Array.isArray(data) ? data : [];
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
this.auditLog = [];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
saveAuditLog() {
|
|
214
|
+
try {
|
|
215
|
+
const logPath = this.auditLogPath();
|
|
216
|
+
mkdirSync(this.repoosCfg.cacheDir, { recursive: true });
|
|
217
|
+
writeFileSync(logPath, JSON.stringify(this.auditLog, null, 2), "utf8");
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
/* fail soft */
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
trimAuditLog() {
|
|
224
|
+
if (this.auditLog.length > 100) {
|
|
225
|
+
this.auditLog = this.auditLog.slice(-50);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
auditLogPath() {
|
|
229
|
+
return join(this.repoosCfg.root, this.repoosCfg.cacheDir, "supervisor-audit.json");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { RunningAgentInfo } from "./agents.js";
|
|
2
|
+
export interface MachineInfo {
|
|
3
|
+
cpuCount: number;
|
|
4
|
+
totalMem: number;
|
|
5
|
+
/** Truly-free pages only (`os.freemem()`). On macOS this is always tiny — the
|
|
6
|
+
* OS parks everything it can in cache — so it is a poor "headroom" signal. */
|
|
7
|
+
freeMem: number;
|
|
8
|
+
/** Memory the OS can hand back on demand without swapping: free + inactive +
|
|
9
|
+
* speculative + purgeable (macOS) or `MemAvailable` (Linux). Falls back to
|
|
10
|
+
* `freeMem` on other platforms or if the probe fails. This is the number to
|
|
11
|
+
* reason about for "is there room to run a build". */
|
|
12
|
+
availableMem: number;
|
|
13
|
+
loadavg: number[];
|
|
14
|
+
platform: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ProcessInfo {
|
|
17
|
+
pid: number;
|
|
18
|
+
taskId: string | null;
|
|
19
|
+
cpuPercent: number;
|
|
20
|
+
memBytes: number;
|
|
21
|
+
elapsed: string;
|
|
22
|
+
orphaned: boolean;
|
|
23
|
+
/** True when attributed by command-name match only, not by registry. */
|
|
24
|
+
unverified: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** A live `repoos serve` process found on the machine. */
|
|
27
|
+
export interface ServeProcessInfo {
|
|
28
|
+
pid: number;
|
|
29
|
+
ppid: number;
|
|
30
|
+
port: number | null;
|
|
31
|
+
/** Repo root the process is serving, parsed from its argv. */
|
|
32
|
+
root: string | null;
|
|
33
|
+
/** False when the root directory is gone — the process is definitively garbage. */
|
|
34
|
+
rootExists: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* `in-flight` is the one that stops this from crying wolf: the close-out
|
|
37
|
+
* gate's own test suite spawns fixture servers constantly, and while their
|
|
38
|
+
* spawning process is still alive they are doing legitimate work. Only a
|
|
39
|
+
* process whose parent has died (reparented to PID 1) is abandoned.
|
|
40
|
+
*
|
|
41
|
+
* `foreign` is a detached serve process for a DIFFERENT, still-present repo
|
|
42
|
+
* root — another repo's control plane started via `just serve` / `nohup`
|
|
43
|
+
* (so its ppid is also 1). It is not this server's to reap; never SIGTERMed,
|
|
44
|
+
* never counted as an abandoned stray.
|
|
45
|
+
*/
|
|
46
|
+
kind: "control-plane" | "known-preview" | "in-flight" | "stray" | "foreign";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Machine-wide census of `repoos serve` processes (#0216). Preview and fixture
|
|
50
|
+
* servers that outlive their owning task or test accumulate silently, and the
|
|
51
|
+
* load they generate makes the close-out gate fail on timing-sensitive tests
|
|
52
|
+
* that pass fine in isolation — a false failure that is indistinguishable from
|
|
53
|
+
* a real regression. Surfacing the count makes the accumulation visible before
|
|
54
|
+
* it starts costing close-outs.
|
|
55
|
+
*/
|
|
56
|
+
export interface ServeScan {
|
|
57
|
+
total: number;
|
|
58
|
+
/** Abandoned: unattributable AND the spawning process is gone. */
|
|
59
|
+
strays: number;
|
|
60
|
+
/** Unattributable but still supervised by a live parent — a running test or gate. */
|
|
61
|
+
inFlight: number;
|
|
62
|
+
/** Strays whose root directory no longer exists. */
|
|
63
|
+
deadRoot: number;
|
|
64
|
+
level: "ok" | "notice" | "warn";
|
|
65
|
+
processes: ServeProcessInfo[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Cheap "size of the codebase" facts for the Control page. Derived from git, so
|
|
69
|
+
* gitignored files (dist/, node_modules/, screenshots/) are excluded for free.
|
|
70
|
+
* Sampled behind a TTL cache — the numbers barely move between 5s polls.
|
|
71
|
+
*/
|
|
72
|
+
export interface RepoStats {
|
|
73
|
+
/** Registered git worktrees, including the main checkout. */
|
|
74
|
+
worktrees: number;
|
|
75
|
+
/** Files tracked by git on the checked-out branch. */
|
|
76
|
+
trackedFiles: number;
|
|
77
|
+
/** Total lines across tracked text files (binary files skipped). */
|
|
78
|
+
linesOfCode: number;
|
|
79
|
+
/**
|
|
80
|
+
* Advisory ceiling from config (`worktreeWarnThreshold`, default 20). The UI
|
|
81
|
+
* turns the worktree count amber when `worktrees` exceeds this. 0 disables.
|
|
82
|
+
*/
|
|
83
|
+
worktreeWarnThreshold: number;
|
|
84
|
+
}
|
|
85
|
+
export interface SystemStats {
|
|
86
|
+
machine: MachineInfo;
|
|
87
|
+
totals: {
|
|
88
|
+
cpuPercent: number;
|
|
89
|
+
memBytes: number;
|
|
90
|
+
memPercent: number;
|
|
91
|
+
};
|
|
92
|
+
processes: ProcessInfo[];
|
|
93
|
+
serve: ServeScan | null;
|
|
94
|
+
/** Codebase size facts, or null when the root is not a git repo / git is missing. */
|
|
95
|
+
repo: RepoStats | null;
|
|
96
|
+
serverPid: number;
|
|
97
|
+
at: string;
|
|
98
|
+
}
|
|
99
|
+
interface PsRecord {
|
|
100
|
+
pid: number;
|
|
101
|
+
ppid: number;
|
|
102
|
+
cpuPercent: number;
|
|
103
|
+
memPercent: number;
|
|
104
|
+
rssKB: number;
|
|
105
|
+
elapsed: string;
|
|
106
|
+
}
|
|
107
|
+
export interface OwnershipRecord {
|
|
108
|
+
pid: number;
|
|
109
|
+
taskId: string;
|
|
110
|
+
startedAt: string;
|
|
111
|
+
executable: string;
|
|
112
|
+
workdir: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Parse `ps -o pid=,ppid=,%cpu=,%mem=,rss=,etime=` output into records.
|
|
116
|
+
* One `ps` call covers all PIDs at once. Export for testing.
|
|
117
|
+
*/
|
|
118
|
+
export declare function parsePsOutput(output: string): PsRecord[];
|
|
119
|
+
/**
|
|
120
|
+
* git-derived codebase size: worktree count, tracked-file count, and total
|
|
121
|
+
* lines across tracked text files. Three `git` spawns, so memoised for 30s —
|
|
122
|
+
* the SSE loop calls this every 5s and these numbers change on the order of
|
|
123
|
+
* commits, not seconds. Returns the last good value (or null) on git failure.
|
|
124
|
+
*/
|
|
125
|
+
export declare function sampleRepoStats(root: string, worktreeWarnThreshold?: number): RepoStats | null;
|
|
126
|
+
/** Extract the repo root a serve process is running from, or null. */
|
|
127
|
+
export declare function parseServeRoot(command: string): string | null;
|
|
128
|
+
/** Extract `--port N` from a serve command line, or null. */
|
|
129
|
+
export declare function parseServePort(command: string): number | null;
|
|
130
|
+
/**
|
|
131
|
+
* Parse `ps ax -o pid=,ppid=,command=` output into serve-process records.
|
|
132
|
+
*
|
|
133
|
+
* Classification order matters. The control plane is checked first because the
|
|
134
|
+
* reload handoff deliberately detaches it, so it also runs with `ppid` 1 and
|
|
135
|
+
* would otherwise look abandoned. Everything else that RepoOS did not start is
|
|
136
|
+
* abandoned only if its parent is gone — a fixture server with a live vitest
|
|
137
|
+
* worker above it is the gate doing its job, not a leak.
|
|
138
|
+
*
|
|
139
|
+
* Exported for testing so classification can be exercised without spawning servers.
|
|
140
|
+
*/
|
|
141
|
+
export declare function parseServeScan(output: string, serverPid: number, knownPids: Set<number>, rootExists: (root: string | null) => boolean, ownRoot?: string): ServeScan;
|
|
142
|
+
/**
|
|
143
|
+
* Census live `repoos serve` processes. Cached — `ps ax` lists every process on
|
|
144
|
+
* the machine, which is much heavier than the targeted per-PID sample.
|
|
145
|
+
*/
|
|
146
|
+
export declare function scanServeProcesses(serverPid: number, knownPids: Set<number>, ownRoot?: string): ServeScan | null;
|
|
147
|
+
/** Drop the cached census. Exported for tests. */
|
|
148
|
+
export declare function resetServeScanCache(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Reap every `stray` process the census finds — a process whose spawning
|
|
151
|
+
* parent is confirmed dead (reparented to PID 1). This is safe by
|
|
152
|
+
* construction: `in-flight` processes (a live parent still supervising them,
|
|
153
|
+
* e.g. the close-out gate's own test suite mid-run) are never included, and
|
|
154
|
+
* neither is the control plane or a known preview. Killing a stray destroys
|
|
155
|
+
* no live work — nothing will ever come back to claim it.
|
|
156
|
+
*
|
|
157
|
+
* Root cause this offsets (#0216): a failed reload-replacement handoff kills
|
|
158
|
+
* only the direct child process (`ReloadManager.killChild`, plain SIGTERM,
|
|
159
|
+
* not a process-group kill), so anything that child spawned before failing
|
|
160
|
+
* its readiness check survives as an orphan. Under repeated failed reload
|
|
161
|
+
* attempts this accumulates fast enough to strain the whole machine, not just
|
|
162
|
+
* starve the close-out gate. This periodic sweep is the general safety net;
|
|
163
|
+
* the process-group fix in reload.ts is the more targeted root-cause fix,
|
|
164
|
+
* tracked separately.
|
|
165
|
+
*/
|
|
166
|
+
export declare function reapStrayServeProcesses(serverPid: number, knownPids: Set<number>, kill?: (pid: number, signal: string) => void, scan?: (serverPid: number, knownPids: Set<number>) => ServeScan | null, ownRoot?: string): number;
|
|
167
|
+
/**
|
|
168
|
+
* Kill a single process by PID: SIGTERM first, escalating to SIGKILL after a
|
|
169
|
+
* grace period if it hasn't exited. Same sequence AgentRunner.stop() and the
|
|
170
|
+
* stray-serve reaper already use elsewhere. Backs the manual "Kill" action in
|
|
171
|
+
* the System Resources panel — callers must verify the PID is one RepoOS
|
|
172
|
+
* itself is tracking (a fresh sampleSystem()/scanServeProcesses() result)
|
|
173
|
+
* before calling this; it does not re-check.
|
|
174
|
+
*/
|
|
175
|
+
export declare function killTrackedProcess(pid: number, kill?: (pid: number, signal: NodeJS.Signals) => void): boolean;
|
|
176
|
+
export interface SampleSystemOptions {
|
|
177
|
+
serverPid: number;
|
|
178
|
+
cacheDir: string;
|
|
179
|
+
runningAgents: RunningAgentInfo[];
|
|
180
|
+
/** PIDs of preview servers RepoOS knows it started — never counted as strays. */
|
|
181
|
+
knownServePids?: number[];
|
|
182
|
+
/** Repo root — enables the git-derived `repo` codebase-size stats. */
|
|
183
|
+
root?: string;
|
|
184
|
+
/** Advisory worktree ceiling surfaced in `repo.worktreeWarnThreshold`. */
|
|
185
|
+
worktreeWarnThreshold?: number;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Sample the system: machine facts, RepoOS process totals, and a per-process
|
|
189
|
+
* breakdown with orphan detection. One `ps` call covers all tracked + agent PIDs.
|
|
190
|
+
*/
|
|
191
|
+
export declare function sampleSystem(opts: SampleSystemOptions): SystemStats;
|
|
192
|
+
/**
|
|
193
|
+
* True when the current platform can run the `ps` command with the expected
|
|
194
|
+
* flags (pid=,ppid=,%cpu=,%mem=,rss=,etime=). Windows `ps` (PowerShell alias)
|
|
195
|
+
* does not support these flags, so per-process stats are unavailable there.
|
|
196
|
+
*/
|
|
197
|
+
export declare function psAvailable(): boolean;
|
|
198
|
+
export {};
|