elanous 0.3.5 → 0.3.6
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/03e0d6dd.700c7936da5b58dc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{2845ea08.c590f5c7ddc06b98.js → 08c5076c.5caa59440568d9fd.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/1133.3801860878ce88b3.js +90 -0
- package/apps/pwa/out/_next/static/chunks/122.8b918db079a217b3.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1262.382ab717777b7876.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1282.b1839574a7174818.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1289.90573260d680c2c4.js +104 -0
- package/apps/pwa/out/_next/static/chunks/1292.a5ad38120c4f4c91.js +8 -0
- package/apps/pwa/out/_next/static/chunks/{7015-6abc8f1809ff071f.js → 13-a66d199eb241ebdd.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/1407.738fdf1a0494400e.js +62 -0
- package/apps/pwa/out/_next/static/chunks/1544.b54c381a64374891.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1626-e27033153bdeace1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1709-9d15a13770cf351e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/174-48f4dbaadfd63cfe.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1791.2d4dc98bb4477808.js +64 -0
- package/apps/pwa/out/_next/static/chunks/{7746.c8b9b75e18472c54.js → 1895.8083fc998e96e187.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/20-e5b5cb74a2a5bb5d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{7250-70e47260b60cd47e.js → 2081-daa5ad7b1b89adff.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/2097.0b609686216a65c5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2157-e5b53879e832dcaf.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{9850.90badc8e9b213e5a.js → 2195.309f603cd694b342.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/2264-db91ffbe7db2bec9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2514-c999158b591411cc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2534-57d4eb7a68b899ac.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{5323.277ad337906fe70a.js → 2566.4bd6b4d466b415bf.js} +3 -3
- package/apps/pwa/out/_next/static/chunks/{1807-778f3031dc089a09.js → 2769-b57dccc1a2780bc9.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/3145.a1fae3cb5ff3e38f.js +74 -0
- package/apps/pwa/out/_next/static/chunks/{2999.c462d95ab66dba3a.js → 3273.01f6a479510f3745.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/332.dc6c432ef47a38bd.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3334.22d96c812cd3499d.js +149 -0
- package/apps/pwa/out/_next/static/chunks/337.e243cda2c1de2d72.js +24 -0
- package/apps/pwa/out/_next/static/chunks/3399-2aa9d084ec2b4f91.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{3483-f7f5f9a66e1780ad.js → 3425-79876b2e27c2bf21.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{7228.8cb7ac9d98e331d5.js → 3567.f123fed09c981929.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/3578-1c7b5d1f3177154a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3652-baf6f94c7ab62f8b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3819-0819a0e58e075bc4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/384.08e43ae443d798b7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{8389.af75612ea24ceba6.js → 392.88e4871679543f05.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/3955.a29bd2ca82a3b139.js +23 -0
- package/apps/pwa/out/_next/static/chunks/3970.3b0b5d94ea0b60cc.js +2 -0
- package/apps/pwa/out/_next/static/chunks/4042.d51c4afd58eb3c9d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4053-4f494b4b77904727.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{3176.fcf82fd6b3fcfff5.js → 4090.2ac256e4465ce23a.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/4171-341d135bb272be82.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4231.6c49fe66b025f465.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4317-d2132e3be869b36b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/436.bdfc3533c90ab95b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4406.1c70154db26f6ca3.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4469-361edcba09e0eb1b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{9376.35941fbddcbfe1d4.js → 4513.35e176155fcac151.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/4523.1de9ececca7bb35c.js +27 -0
- package/apps/pwa/out/_next/static/chunks/{5640.b32a01e556340532.js → 4743.202838e9e44d1890.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/4762.cfb596785785a35d.js +79 -0
- package/apps/pwa/out/_next/static/chunks/4859.e5532ce5f6dfb5c9.js +32 -0
- package/apps/pwa/out/_next/static/chunks/5002-8af817fe59d06e9c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5015.9843edccbdec9dcc.js +94 -0
- package/apps/pwa/out/_next/static/chunks/5046-129cd38c01b0e1a6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5226.21335a67dbd6769b.js +226 -0
- package/apps/pwa/out/_next/static/chunks/{1911-bc30f2d39d2b318e.js → 5268-60a68ca7fc42517d.js} +3 -3
- package/apps/pwa/out/_next/static/chunks/{259.ff45e655e5e41a4d.js → 5366.ebeeaf7de80d3ca9.js} +16 -16
- package/apps/pwa/out/_next/static/chunks/{7056-c994bfc3e3701439.js → 5411-713ef15cc7235cf6.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/5505-467d5b66c0f6604f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5665-700d710daec0a3a8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{abec6764.4a84c474be416fb7.js → 583d9398.977d3658a34faab6.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/584.760ea6f9640a2330.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5846-91344971864969a6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{8101.31728c5a01a6167b.js → 5902.99e8a94fe5a52f2d.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/60-0bd459e227e19e2b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6039.6b54b0dbd98ce3d9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6048.7bbaec360ac24a83.js +36 -0
- package/apps/pwa/out/_next/static/chunks/6067-ee1f7f126eb7edba.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6284.f8120f5daaea3e99.js +286 -0
- package/apps/pwa/out/_next/static/chunks/{4388.42598a55da8c47cf.js → 6299.ac4c5fb874605cb9.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/6397.7ea605814f73c962.js +148 -0
- package/apps/pwa/out/_next/static/chunks/6459.ddf3a045461f0277.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{1783.708de9a0182ac571.js → 6506.f32c4e8db47a4d04.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{7923.35fed012b66d1420.js → 6650.7c18ed630c8df5f6.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/6672.dc8faf8315bed1ec.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6720-9f2b574e2778c51e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6901.06042eea29545f49.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6964-ddcc66e773813bb9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{2c8c2385.34ce9456dac99420.js → 70160b1f.e9b0c3183f852774.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/726ffad1-541c403c50188556.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7370.5e62aa60f70eab3a.js +287 -0
- package/apps/pwa/out/_next/static/chunks/7398.0f969552779fc929.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7463-2d9010477f346643.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{6433.e0006a1e924a2131.js → 7616.90f498934db729c5.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/7636.a2019ded999e3313.js +93 -0
- package/apps/pwa/out/_next/static/chunks/7679.fff5f504d80d8efa.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{6841.ed452e7d06f598ee.js → 7680.8a882f1e69f29d04.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/780.fef3f7eab136cfb2.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7913.111fcb6384514824.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{c9c445f7.15a7d747f61c56e6.js → 79e58824.98894b54fea1ebeb.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/8053-787355829bcce0fc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/81.14ce7dd1f5f076b5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8155-e80f82cd593d37e0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8173.4cdfbe651f7b5b42.js +1 -0
- package/apps/pwa/out/_next/static/chunks/818-4680f45366d9d817.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8289.e422989d7d3a3b3e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8330-65b8ffc4adafddda.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8347-9d4560fee007a4a7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8634-fa442da5f7bf2646.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8641.2e059c30fc167758.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8702.b18812eda87d0d96.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{4647.a6e02754d5dcf398.js → 8868.53e897d2e917ba66.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/8991.ea9c4a7cd21e8ab0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{6c25ab46.9d19c4994d7f5495.js → 8d86c5fb.bb592b68be6b2dd1.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{6251.a547705e850c5149.js → 9041.fb24e17368fc7c0c.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/9061-52f95217516a27ea.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9147.5721390c3c3eb275.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9288.92a602e56f3c3235.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{8541.3a501dabd3140fd0.js → 9384.eca46b93339ff473.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/9441-11ce6d0c0489a635.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9633.e6c9740bd6532344.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9750-52fc8ea133cbdd10.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{9951-b903d4a257c01657.js → 9787-88bf04f4efec6a87.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/9866.26519d8848018524.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{7663.e4ea6f8c14df314c.js → 9932.53788b29e036cf7e.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{9052.0be41f794a5fb029.js → 9948.c9ce32e9de4d6112.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/9eb16190.04c6ae4915f4a9a3.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{01af03c4.71e22e1e1aca813e.js → ae5abe9f.937147329556d162.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/_not-found/page-47c27b54524c7fa5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-9f612bc57ce11518.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/apps/page-8f42d3f8a3c479b2.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/board/page-fca38e9721b2e291.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-d76f695cc9aa66da.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/bots/page-6a4a92e785e30a96.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-489f91f71cc95c1f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/chat/page-e26b02e36ed57ff7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/consult/page-8b6d2222230d6681.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/control/{page-90bff14d4d1104a9.js → page-b6d3b8924598e180.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/decisions/{page-bc7f2d53539f1599.js → page-99ae8ef441d501e1.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-e267c49dabb08ed1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/editor/page-7f93783cd38fd2b4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/exec/page-ad71c7f877d1ade8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/field/page-c46377fc61262679.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/healthz/route-47c27b54524c7fa5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/inside/page-65d6902d87acd8ae.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/intake/page-07c809fa1f01af06.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/layout-f7f6914dfccec337.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/live/page-122697e5567e1ff3.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/live-run/page-49562e02f95095bc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/loops/page-99ae848af2397c3d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/market/page-46d8a6d324c0e2f1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/morning/page-de6f870e5608e6de.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/not-found-ea2df30943a87c71.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-98b024890b62cf3b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/{page-5145d13713aa12ba.js → page-c8f0e20b66b28ffa.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/release/page-7c3611d8aad20b6b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/resources/page-e28c2e5e4b09d07b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-4c00dd145567e03c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/outputs/page-04897c35a1b0f31c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/page-cd3b5f3ffdd042f8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-481cefac3cfae8e2.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/scheduler/page-5d4e9f1acd8a3e76.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/sessions/page-508eac8c609008c8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/settings/devices/{page-7f03bb1e52c1a43d.js → page-2647b6064ec03f6d.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/page-06bd8804fb5461c0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/done/page-7f170c47d678308f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/layout-47c27b54524c7fa5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/page-2775bd94657214dd.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/share/page-3d4c64344a7849d1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/showroom/page-35ecc675ece7f1b1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/tasks/{page-e29cc254c3ee0054.js → page-212690c5984d0bb5.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/term/page-c3ce5e2d8719a62d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/today/page-20e0f8fd07394b92.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/trace/page-2e41cba602b85777.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/vault/{page-e093c97ee87aca70.js → page-cdfaf3c619b41ee3.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-3a0cad7feda4ba84.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workflows/page-b548ef224f7a2c4e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-840ebf9a8df1e608.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-9c92234d0c6fc211.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{e5a2a050-4b51c1f86f5cc4bb.js → cefbab05-d77e78efac6f0805.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{d1dc888b.cc6ca4afda9a5ef8.js → d80a33eb.43d7188f45a1df0f.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/framework-e606293b68d3c2a4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/main-4ee3ac293afcb363.js +1 -0
- package/apps/pwa/out/_next/static/chunks/main-app-fa9105027513fb32.js +1 -0
- package/apps/pwa/out/_next/static/chunks/pages/_app-259505853c97c4e1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/pages/_error-9189a5f75b31099d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/webpack-24fcc4e4a45c4fbb.js +1 -0
- package/apps/pwa/out/_next/static/css/694b79ddfe810a75.css +1 -0
- package/apps/pwa/out/_next/static/myEvhO9EDn1k6MAMqnQJd/_buildManifest.js +1 -0
- package/apps/pwa/out/_next/static/myEvhO9EDn1k6MAMqnQJd/_ssgManifest.js +1 -0
- package/apps/pwa/out/approvals/index.html +1 -1
- package/apps/pwa/out/approvals/index.txt +23 -23
- package/apps/pwa/out/apps/index.html +1 -0
- package/apps/pwa/out/apps/index.txt +33 -0
- package/apps/pwa/out/board/index.html +1 -1
- package/apps/pwa/out/board/index.txt +23 -23
- package/apps/pwa/out/botlab/index.html +1 -1
- package/apps/pwa/out/botlab/index.txt +22 -22
- package/apps/pwa/out/bots/index.html +1 -1
- package/apps/pwa/out/bots/index.txt +22 -22
- package/apps/pwa/out/ceo/index.html +1 -1
- package/apps/pwa/out/ceo/index.txt +23 -23
- package/apps/pwa/out/chat/index.html +1 -1
- package/apps/pwa/out/chat/index.txt +22 -22
- package/apps/pwa/out/consult/index.html +1 -1
- package/apps/pwa/out/consult/index.txt +23 -23
- package/apps/pwa/out/control/index.html +1 -1
- package/apps/pwa/out/control/index.txt +23 -23
- package/apps/pwa/out/decisions/index.html +1 -1
- package/apps/pwa/out/decisions/index.txt +22 -22
- package/apps/pwa/out/design-check/index.html +1 -1
- package/apps/pwa/out/design-check/index.txt +23 -23
- package/apps/pwa/out/editor/index.html +1 -1
- package/apps/pwa/out/editor/index.txt +23 -23
- package/apps/pwa/out/exec/index.html +1 -1
- package/apps/pwa/out/exec/index.txt +23 -23
- package/apps/pwa/out/field/index.html +1 -1
- package/apps/pwa/out/field/index.txt +23 -23
- package/apps/pwa/out/healthz +1 -1
- package/apps/pwa/out/index.html +1 -1
- package/apps/pwa/out/index.txt +22 -22
- package/apps/pwa/out/inside/index.html +1 -1
- package/apps/pwa/out/inside/index.txt +22 -22
- package/apps/pwa/out/intake/index.html +1 -1
- package/apps/pwa/out/intake/index.txt +23 -23
- package/apps/pwa/out/live/index.html +1 -1
- package/apps/pwa/out/live/index.txt +23 -23
- package/apps/pwa/out/live-run/index.html +1 -1
- package/apps/pwa/out/live-run/index.txt +23 -23
- package/apps/pwa/out/loops/index.html +1 -1
- package/apps/pwa/out/loops/index.txt +22 -22
- package/apps/pwa/out/market/index.html +1 -1
- package/apps/pwa/out/market/index.txt +22 -22
- package/apps/pwa/out/morning/index.html +1 -1
- package/apps/pwa/out/morning/index.txt +23 -23
- package/apps/pwa/out/observatory/index.html +1 -1
- package/apps/pwa/out/observatory/index.txt +23 -23
- package/apps/pwa/out/ops/checklist/index.html +1 -1
- package/apps/pwa/out/ops/checklist/index.txt +22 -22
- package/apps/pwa/out/ops/release/index.html +1 -1
- package/apps/pwa/out/ops/release/index.txt +22 -22
- package/apps/pwa/out/ops/resources/index.html +1 -1
- package/apps/pwa/out/ops/resources/index.txt +22 -22
- package/apps/pwa/out/ops/seats/index.html +1 -1
- package/apps/pwa/out/ops/seats/index.txt +22 -22
- package/apps/pwa/out/outputs/index.html +1 -1
- package/apps/pwa/out/outputs/index.txt +22 -22
- package/apps/pwa/out/reflection/index.html +1 -1
- package/apps/pwa/out/reflection/index.txt +23 -23
- package/apps/pwa/out/scheduler/index.html +1 -1
- package/apps/pwa/out/scheduler/index.txt +23 -23
- package/apps/pwa/out/sessions/index.html +1 -1
- package/apps/pwa/out/sessions/index.txt +22 -22
- package/apps/pwa/out/settings/devices/index.html +1 -1
- package/apps/pwa/out/settings/devices/index.txt +23 -23
- package/apps/pwa/out/settings/index.html +1 -1
- package/apps/pwa/out/settings/index.txt +23 -23
- package/apps/pwa/out/setup/done/index.html +1 -1
- package/apps/pwa/out/setup/done/index.txt +23 -23
- package/apps/pwa/out/setup/index.html +1 -1
- package/apps/pwa/out/setup/index.txt +23 -23
- package/apps/pwa/out/share/index.html +1 -1
- package/apps/pwa/out/share/index.txt +23 -23
- package/apps/pwa/out/showroom/index.html +1 -1
- package/apps/pwa/out/showroom/index.txt +22 -22
- package/apps/pwa/out/tasks/index.html +1 -1
- package/apps/pwa/out/tasks/index.txt +23 -23
- package/apps/pwa/out/term/index.html +1 -1
- package/apps/pwa/out/term/index.txt +23 -23
- package/apps/pwa/out/today/index.html +1 -1
- package/apps/pwa/out/today/index.txt +23 -23
- package/apps/pwa/out/trace/index.html +1 -1
- package/apps/pwa/out/trace/index.txt +23 -23
- package/apps/pwa/out/vault/index.html +1 -1
- package/apps/pwa/out/vault/index.txt +23 -23
- package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
- package/apps/pwa/out/workflows/chat-ui/index.txt +23 -23
- package/apps/pwa/out/workflows/index.html +1 -1
- package/apps/pwa/out/workflows/index.txt +23 -23
- package/apps/pwa/out/workspace/index.html +1 -1
- package/apps/pwa/out/workspace/index.txt +23 -23
- package/apps/pwa/out/worktrees/index.html +1 -1
- package/apps/pwa/out/worktrees/index.txt +23 -23
- package/graphs/release/macrophage-subscriber.yaml +17 -0
- package/graphs/release/release-loop.yaml +17 -28
- package/package.json +2 -1
- package/scripts/ci-typecheck-changed.ts +1 -1
- package/scripts/cron-run.ts +1 -1
- package/scripts/docs/generate-cli-anatomy.ts +2 -3
- package/scripts/install.sh +5 -0
- package/scripts/isolation-hardcode-baseline.txt +1 -1
- package/scripts/land-enqueue.test.sh +18 -4
- package/scripts/mission-request-judge.ts +6 -0
- package/scripts/release-loop/adaptive-gate-heal-adapter.ts +105 -0
- package/scripts/release-loop/adaptive-gate-heal.ts +140 -0
- package/scripts/release-loop/gate-baseline.ts +14 -0
- package/scripts/release-loop/gate-bisect-sidecar.ts +122 -0
- package/scripts/release-loop/gate-bisect.ts +146 -0
- package/scripts/release-loop/gate-image-repair-node.ts +104 -0
- package/scripts/release-loop/gate-node-sim.ts +29 -6
- package/scripts/release-loop/gate-node.ts +498 -58
- package/scripts/release-loop/gate-repair-node.ts +166 -0
- package/scripts/release-loop/gate-reuse-identity.ts +38 -0
- package/scripts/release-loop/gate-shard-dispatch.ts +72 -8
- package/scripts/release-loop/gate-shard-receipts.ts +98 -24
- package/scripts/release-loop/gate-triage-node.ts +37 -5
- package/scripts/release-loop/node-verdict.ts +7 -1
- package/scripts/release-loop/pwa-scenarios-node.ts +7 -2
- package/scripts/release-loop/repair-pr-landed.ts +93 -0
- package/scripts/release-loop/resume-release.ts +35 -8
- package/scripts/release-loop/resume.ts +2 -2
- package/scripts/release-loop/unattended-release.ts +9 -1
- package/scripts/release-loop/version-node.ts +41 -6
- package/scripts/test-census/similar-search.ts +375 -0
- package/scripts/test-census-similar-search.ts +128 -0
- package/scripts/test-census.ts +388 -0
- package/scripts/test-deterministic.ts +1 -1
- package/src/acp/codex-app-server-client.ts +157 -20
- package/src/agent/nest-depth.ts +2 -2
- package/src/autopilot/gh-rest-fallback.ts +8 -4
- package/src/autopilot/lineage/timeline.ts +1 -1
- package/src/autopilot/mission-arc-preflight.ts +7 -2
- package/src/autopilot/mission-grounding-ladder.ts +17 -329
- package/src/autopilot/mission-history.ts +1 -1
- package/src/autopilot/mission-incident-context.ts +2 -1
- package/src/autopilot/mission-trace.ts +1 -1
- package/src/autopilot/state-paths.ts +2 -2
- package/src/briefing/brief-items.ts +1 -1
- package/src/chat/index.ts +2 -7
- package/src/cli/cred-cli.ts +144 -0
- package/src/cli/logs-cli.ts +1 -1
- package/src/cli/logs-timeline.ts +1 -1
- package/src/cli/machine-apply-from-capture.ts +122 -0
- package/src/cli/machine-capture.ts +356 -0
- package/src/cli/machine-cli.ts +12 -1
- package/src/cli/machine-membership.ts +350 -0
- package/src/cli/machine-setup-apply.ts +176 -0
- package/src/cli/machine-setup-plan.ts +373 -0
- package/src/cli/machine-wsl-setup.ts +211 -0
- package/src/cli/ops-cli.ts +2 -34
- package/src/cli/ops-status-remote.ts +2 -41
- package/src/cli/pr-cli.ts +19 -1
- package/src/cli/pr-land-drift-repair.ts +6 -4
- package/src/cli/pr-land-heavy-remote.ts +21 -1
- package/src/cli/pr-land-overlap-evidence.ts +68 -2
- package/src/cli/release-cli.ts +42 -16
- package/src/cli/secret-cli.test-helpers.ts +7 -0
- package/src/cli/secret-cli.ts +194 -99
- package/src/cli/self-update.ts +1 -1
- package/src/cli/sim-cli.ts +32 -0
- package/src/context-bus/external-events.ts +22 -9
- package/src/core-turn/child-liveness-heartbeat.ts +4 -2
- package/src/core-turn/run-core-turn.ts +5 -5
- package/src/dashboard/index.ts +34 -1292
- package/src/dashboard/input/chat-main-acp-dispatch.ts +0 -120
- package/src/dashboard/input/chat-main-interaction-opts.ts +0 -32
- package/src/dashboard/input/chat-main-plain-turn-runtime.ts +0 -14
- package/src/dashboard/input/chat-main-visibility.ts +0 -2
- package/src/dashboard/input/dashboard-plain-turn-stream.ts +7 -97
- package/src/dashboard/input/dashboard-priority-key-route.ts +0 -56
- package/src/dashboard/input/mouse-wiring.ts +1 -14
- package/src/dashboard/slash-runtime/dashboard-handlers.ts +8 -45
- package/src/debug/log.ts +11 -91
- package/src/debug/secret-redaction.ts +98 -0
- package/src/decisions/decision-ledger.ts +83 -9
- package/src/domains/cron-match.ts +2 -1
- package/src/domains/finance-tools.ts +1 -1
- package/src/domains/guardian-tick.ts +2 -1
- package/src/domains/knowledge.ts +10 -0
- package/src/domains/market-quote.ts +1 -1
- package/src/domains/morning-synthesis.ts +1 -1
- package/src/domains/schedule-health-report.ts +1 -1
- package/src/domains/schedule-runner.ts +1 -1
- package/src/domains/schedule-state.ts +2 -1
- package/src/domains/watch-default-scheduler.ts +1 -1
- package/src/graph-runner/graph-events.ts +202 -0
- package/src/graph-runner/graph-subscriptions.ts +112 -0
- package/src/graph-runner/in-process-registry.ts +6 -0
- package/src/graph-runner/runner.ts +964 -37
- package/src/harness/browser-verify.ts +1 -1
- package/src/harness/grounding/mission-grounding-ladder.ts +350 -0
- package/src/harness/harness-cli-command.ts +0 -52
- package/src/harness/launch-stamp.ts +2 -1
- package/src/hq/fence.ts +1 -1
- package/src/index.ts +0 -72
- package/src/input-core/audit-tail.ts +1 -1
- package/src/instance/test-write-guard.ts +3 -3
- package/src/instance-identity.ts +2 -2
- package/src/intake-plane/linear-secretary-runtime.ts +3 -2
- package/src/intake-plane/requirement-funnel.ts +1 -1
- package/src/keybindings.ts +2 -5
- package/src/llm/wire/harmony.ts +365 -0
- package/src/llm.ts +2 -372
- package/src/loops/checker.ts +1 -1
- package/src/loops/orchestrator/coordinator-shadow.ts +4 -1
- package/src/loops/registry.ts +1 -1
- package/src/maturity/feature-maturity.ts +4 -7
- package/src/mss/{identity.ts → identity-store.ts} +3 -46
- package/src/mss/log-enrich.ts +1 -1
- package/src/mss/logging/diagnostic-sink.ts +90 -0
- package/src/mss/logging/horizon-watch.ts +4 -4
- package/src/mss/logging/log-federation.ts +6 -5
- package/src/mss/logging/log-safety-net.ts +7 -7
- package/src/mss/logging/log-store.ts +16 -13
- package/src/mss/logging/sinks/otel-genai-sink.ts +2 -2
- package/src/mss/trace-context.ts +1 -1
- package/src/mss/ulid.ts +36 -0
- package/src/mss/uri/builder.ts +1 -1
- package/src/nexus/api/audio-stt.ts +15 -13
- package/src/nexus/api/autopilot-api.ts +1 -68
- package/src/nexus/api/channel-ask-op.ts +3 -38
- package/src/nexus/api/field-uploads.ts +73 -0
- package/src/nexus/api/http-server.ts +65 -80
- package/src/nexus/api/ingest-token.ts +2 -2
- package/src/nexus/api/mcp-widget-call-route.ts +21 -16
- package/src/nexus/api/telegram-trigger-bot.ts +3 -1
- package/src/nexus/apps/app-actions.ts +235 -0
- package/src/nexus/apps/app-auth.ts +187 -0
- package/src/nexus/apps/app-contract.ts +63 -6
- package/src/nexus/apps/app-db.ts +326 -0
- package/src/nexus/apps/app-host.ts +153 -7
- package/src/nexus/apps/app-lifecycle-ledger.ts +243 -0
- package/src/nexus/apps/app-storage-route.ts +127 -0
- package/src/nexus/apps/app-storage.ts +407 -0
- package/src/nexus/apps/app-upload.ts +49 -0
- package/src/nexus/config/secrets/app-secret-ledger.ts +241 -0
- package/src/nexus/config/secrets/file-backend.ts +195 -9
- package/src/nexus/config/secrets/index.ts +13 -1
- package/src/nexus/config/secrets/registry.ts +32 -4
- package/src/nexus/config/secrets/types.ts +8 -0
- package/src/nexus/index.ts +115 -14
- package/src/onboarding/web-first.ts +12 -7
- package/src/platform/host-id.ts +1 -1
- package/src/release-loop/gate-host-reservation.ts +5 -0
- package/src/release-loop/gate-shard-ledger.ts +85 -3
- package/src/release-loop/graph-event-adapters.ts +128 -0
- package/src/release-loop/light-rc.ts +4 -2
- package/src/release-loop/macrophage-heal-node.ts +84 -0
- package/src/release-loop/macrophage-heal.ts +167 -0
- package/src/release-loop/macrophage-safe-cleanup.ts +150 -0
- package/src/release-loop/rehearsal.ts +27 -6
- package/src/release-loop/stage-mail.ts +15 -10
- package/src/roles/machine-name.ts +1 -1
- package/src/roles/machine-profile.ts +21 -3
- package/src/runtime-identity.ts +46 -0
- package/src/self-dev/entrance-baseline.ts +0 -52
- package/src/self-implement/gate-remote.ts +8 -1
- package/src/self-implement/graph-yaml.ts +142 -6
- package/src/session/channel-op-reply-route.ts +12 -0
- package/src/session/search-index.ts +16 -4
- package/src/session/session-context.ts +3 -1
- package/src/setup/service-key-catalog.ts +6 -3
- package/src/sim-world-device-catalogs.json +633 -0
- package/src/skills/tools/schedule-wakeup.ts +2 -3
- package/src/status/bar.ts +0 -43
- package/src/storage/object-store.ts +18 -1
- package/src/storage/s3.ts +1 -1
- package/src/task-orchestrator/surfaces/pod-gate-deps.ts +17 -2
- package/src/task-orchestrator/surfaces/pod-lease.ts +6 -1
- package/src/task-orchestrator/surfaces/pod-pool.ts +64 -23
- package/src/telegram-commands.ts +43 -0
- package/src/telegram.ts +50 -7
- package/src/time/calendar.ts +70 -0
- package/src/time/clock.ts +21 -0
- package/src/time/format-core.ts +44 -0
- package/src/time/format.ts +7 -227
- package/src/time/time-zone.ts +95 -0
- package/src/tool-runtime/elanous-autopilot-launch-runtime.ts +1 -1
- package/src/tui/core/registry.ts +193 -0
- package/src/tui/entry.ts +98 -36
- package/src/tui-client/next-wakeup.ts +5 -0
- package/src/tui.ts +2 -2
- package/src/user-config.ts +1 -1
- package/src/user-intent/logger.ts +1 -1
- package/src/ux-sim/app-contract-secret-entropy.ts +164 -0
- package/src/ux-sim/fake-app-auth.ts +12 -11
- package/src/ux-sim/fake-app-db-world.ts +103 -0
- package/src/ux-sim/fake-app-storage.ts +1 -1
- package/src/ux-sim/fake-data-guard-boundary.ts +111 -0
- package/src/ux-sim/gate-roster-second-pool.ts +219 -0
- package/src/ux-sim/gate-shard-host-reroute.ts +14 -3
- package/src/ux-sim/install-consent-device.ts +8 -5
- package/src/ux-sim/mock-scenario-catalog.json +621 -30
- package/src/ux-sim/next-tui-seat-scenarios.ts +1 -1
- package/src/ux-sim/pod-reuse-shared-fake-boundary.ts +69 -0
- package/src/ux-sim/pod-reuse-world.ts +149 -0
- package/src/ux-sim/pr-land-drift-gate-device.ts +14 -0
- package/src/ux-sim/release-event-trace.ts +79 -0
- package/src/ux-sim/release-publish-devices.ts +43 -0
- package/src/ux-sim/release-sim-rig.ts +769 -89
- package/src/ux-sim/rla-event-response-scorecard.ts +275 -0
- package/src/ux-sim/warm-si-reuse-sim.ts +92 -23
- package/src/ux-sim/world-watch.ts +95 -0
- package/src/ux-sim/world.ts +90 -7
- package/src/version/packed-revision.json +1 -1
- package/src/voice/channel-adapters/discord-voice-channel-harness.ts +1 -1
- package/src/workflow-runtime/triggers/scheduler.ts +1 -1
- package/templates/event-landing-editorial/DESIGN.md +12 -0
- package/templates/next-app-translator/app/layout.tsx +15 -0
- package/templates/next-app-translator/app/page.tsx +16 -0
- package/templates/next-app-translator/app.yaml +67 -0
- package/templates/next-app-translator/next.config.ts +8 -0
- package/templates/next-app-translator/package.json +21 -0
- package/templates/next-app-voice-note/app.yaml +88 -0
- package/templates/next-app-voice-note/package.json +22 -0
- package/apps/pwa/out/_next/static/chunks/0e3e9261.84afa98360d3b889.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1163.de587836684ae0e8.js +0 -74
- package/apps/pwa/out/_next/static/chunks/124-5c8fb000f2fef6fd.js +0 -1
- package/apps/pwa/out/_next/static/chunks/147.48bf376824f7df0a.js +0 -8
- package/apps/pwa/out/_next/static/chunks/1623-0cd4aabb94e3fc0d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1689-5ee3c3dd16ab8667.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1968.4f77d6f940c26d94.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1985.ab97a36d1b3a9458.js +0 -36
- package/apps/pwa/out/_next/static/chunks/2169.709268f6190a67e4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2215.90b2a595c9880580.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2233.061c80f2a79abb24.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2466.ff652b24ae9dee2a.js +0 -32
- package/apps/pwa/out/_next/static/chunks/2541-70d25b112ae1960d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2556-14a3c1858511d4b2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2592.cc0b9dc547aca123.js +0 -104
- package/apps/pwa/out/_next/static/chunks/2708-f51dd5bc56aed2a7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2856-d3c6d2706d6cc45e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2883-5b4aaa3950d416c2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3085.59001f746a9a2e8c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3162-94995e3e8f1524f3.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3177-151f3b49f3b2d2ef.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3196.4d0730f411899434.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3235.7b9c3e9c55ea6d98.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3414-037ce9f127904fe2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/348.b77e8e6b6ed5230c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3501.d2b92806ac1d949e.js +0 -287
- package/apps/pwa/out/_next/static/chunks/3552.e6be7ac885976039.js +0 -1
- package/apps/pwa/out/_next/static/chunks/366-eb724714d15eb3f4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3700.422355522e15e182.js +0 -2
- package/apps/pwa/out/_next/static/chunks/3789.443ac3d6037b503c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4278.5624379f0c23ee3d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4365-9e2bea90e6243b8e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4530.3a14a074896302f2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4557-3b576c4706df592d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4793-a77c3acf9ffc4454.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4806.d7a41078ec5f9e6f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4881.ad56fcbdcfb39a23.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4983.cb812be748dd07e5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5054.cef07be26f74f202.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5075.b30af8ae9aadc959.js +0 -226
- package/apps/pwa/out/_next/static/chunks/5464-5837a4fba34df983.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5535-3d077c5296902ba6.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5654.1b52dfa2ffb08352.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6.aa2a99e9454c9a8d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6208.70eba139a9c68af3.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6253.d4f0940b616f889d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6281-8492f70e843316fa.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6289-3c8732cbeeeb62a2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6332-d5edcc5c35500524.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6437.3cd4d04efb8ab871.js +0 -286
- package/apps/pwa/out/_next/static/chunks/6461-5584cf24a661817a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6618-9b8d9a46ede0c41e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6715-f1316dd169ff9f50.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6735-e62669175cce8686.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6937.0bdc3185f2ace9e4.js +0 -79
- package/apps/pwa/out/_next/static/chunks/712-4496b0c3ac3e4b75.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7151.d2511e5f23155242.js +0 -1
- package/apps/pwa/out/_next/static/chunks/725.63b4017563b04379.js +0 -93
- package/apps/pwa/out/_next/static/chunks/7263-34fefd269746719c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/77.b432098b663eb23e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/770.f7b4481b25fe01c4.js +0 -148
- package/apps/pwa/out/_next/static/chunks/7959.4e02edd1fdf86b05.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7974-b134a047264b1e55.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8089-c13a0ed6973e7490.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8231.297058c760d62aee.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8427.085d79f7afbb3825.js +0 -149
- package/apps/pwa/out/_next/static/chunks/8473.20a465ef76441b50.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8739-f0deba2b3e06427c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8818.02938c951b1000d1.js +0 -94
- package/apps/pwa/out/_next/static/chunks/8846.3103ace634243ee8.js +0 -64
- package/apps/pwa/out/_next/static/chunks/8847.72b1b3e33bcad95a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8883-30b5a763ec36eafa.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9086.b691a72402d521d5.js +0 -27
- package/apps/pwa/out/_next/static/chunks/9133.0be4ebb6c50cd78a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/916.3a04c642f0e5ff90.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9240.1637f5e69335d06b.js +0 -62
- package/apps/pwa/out/_next/static/chunks/9298-cd7b117f1a5be480.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9340-c2ac8651b03e94b2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9424.9062e8119fae997a.js +0 -24
- package/apps/pwa/out/_next/static/chunks/9486.8ef4e64969908842.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9488.98d1b3c092da470a.js +0 -23
- package/apps/pwa/out/_next/static/chunks/9648-42f1d4648cfa7eb8.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9781-946d591f1e66da8d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9844.72bbf73fd214af65.js +0 -90
- package/apps/pwa/out/_next/static/chunks/9868.027b845025f57183.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9948-dbde92fff6625cad.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9ccc18c7-87a6c1410d97d560.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/_not-found/page-a76e282302331a47.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-9c79d56c52c3b39c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/autopilot/page-cd45c61031d63214.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/board/page-e133c057c3c62663.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-89ff7827ff5f449f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/bots/page-0cd71686fa026045.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-a0b329a1295e9704.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/chat/page-f4b64283a86189e3.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/consult/page-c6567da3170d92b7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-51dd1cfa869e3e9e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/editor/page-734e98ce83fcb338.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/exec/page-0dbd78003825005e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/field/page-d716d9e3eebe01c9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/healthz/route-a76e282302331a47.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/inside/page-35ac985a392a23da.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/intake/page-8169a6d36aca9d00.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/layout-c07319ebc55c858f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/live/page-e74b1236e3318957.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/live-run/page-f2d9e65f2fa34919.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/loops/page-e44e85553f3d1747.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/market/page-9786452dd87449f8.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-c01f73b8ca382e89.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/morning/page-4ba4b24fc4aa2262.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-e4f1cff672c21cf5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-7408295e90c5f3da.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/release/page-4b40d62f2182addf.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/resources/page-cbf974b1f9c988e2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-e63ff6bd28f8c0c9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/outputs/page-a9dd827a1ab83e4f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/page-367850708c52c660.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-b1456fb9b51a4fd7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/scheduler/page-26867b3d37b1e7a8.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/sessions/page-82c9de5c8c37b051.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/page-8b9f729cfc8ebc14.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/done/page-f2dec730b93abfab.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/layout-a76e282302331a47.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/page-fa6f33a05e473556.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/share/page-5e0e3113bfda415d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/showroom/page-7864eff18ce702ba.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/term/page-cd2f7856a7dc4849.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/today/page-2de3d35eb5a86aae.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/trace/page-cdb70038ead4a184.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-fb97121241bc7cfc.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/page-3072b3b9e14ea04d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-a976e10f6c3f82bd.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-dfbc7268ba631190.js +0 -1
- package/apps/pwa/out/_next/static/chunks/dc5145c8.9547e252e2e1d3d1.js +0 -1
- package/apps/pwa/out/_next/static/chunks/framework-5a93f9a572271e1c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/main-1c2ba214755ef1d0.js +0 -1
- package/apps/pwa/out/_next/static/chunks/main-app-55b1247a78f22727.js +0 -1
- package/apps/pwa/out/_next/static/chunks/pages/_app-239264d5fa7469e1.js +0 -1
- package/apps/pwa/out/_next/static/chunks/pages/_error-8184168567215c6b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/webpack-0144ea4a99833df5.js +0 -1
- package/apps/pwa/out/_next/static/css/32b8e1b8996dbf5e.css +0 -1
- package/apps/pwa/out/_next/static/iXeJzCRg0ENSSl_RTbGIN/_buildManifest.js +0 -1
- package/apps/pwa/out/_next/static/iXeJzCRg0ENSSl_RTbGIN/_ssgManifest.js +0 -1
- package/apps/pwa/out/autopilot/index.html +0 -1
- package/apps/pwa/out/autopilot/index.txt +0 -33
- package/apps/pwa/out/missions/placeholder/index.html +0 -1
- package/apps/pwa/out/missions/placeholder/index.txt +0 -30
- package/src/autopilot/build/build-status-label.ts +0 -19
- package/src/autopilot/mission-replay-decision.ts +0 -136
- package/src/cli/autopilot-cli.ts +0 -839
- package/src/cli/autopilot-run.ts +0 -176
- package/src/dashboard/auto-tts/auto-tts-controller.ts +0 -347
- package/src/dashboard/auto-tts/auto-tts-host-boot.ts +0 -162
- package/src/dashboard/auto-tts/pfc-voice-runtime.ts +0 -138
- package/src/dashboard/input/chat-main-submit-control.ts +0 -24
- package/src/dashboard/input/control-signal-consumers.ts +0 -46
- package/src/dashboard/input/dashboard-plain-turn-settle-sink.ts +0 -96
- package/src/dashboard/input/dictation-surface-allowlist.ts +0 -78
- package/src/dashboard/input/space-longpress-detector.ts +0 -311
- package/src/dashboard/input/voice-dictation.ts +0 -80
- package/src/dashboard/voice-chat/voice-chat-host-boot.ts +0 -418
- package/src/dashboard/voice-chat/voice-chat-mode-controller.ts +0 -148
- package/src/dashboard/voice-chat/voice-chat-pipeline.ts +0 -357
- package/src/dashboard/voice-host-boot.ts +0 -109
- package/src/dashboard/voice-input-host.ts +0 -540
- package/src/dashboard/voice-runtime.ts +0 -174
- package/src/domains/conatus-verify.ts +0 -466
- package/src/grounding/ensure-grounding.ts +0 -131
- package/src/input/turn-output-bundle.ts +0 -105
- package/src/intake-plane/ref-prefetch.ts +0 -110
- package/src/nexus/api/mission-showroom.ts +0 -182
- package/src/nexus/api/missions-emit.ts +0 -214
- package/src/nexus/api/missions.ts +0 -230
- package/src/seat-dispatch/seat-request-eligibility.ts +0 -19
- package/src/self-dev/external-call-zero.ts +0 -77
- package/src/self-implement/run-controls.ts +0 -74
- /package/src/{dashboard/auto-tts → voice/tts}/sentence-segmenter.ts +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
3
3
|
import { execFile, spawnSync } from 'node:child_process';
|
|
4
|
-
import { existsSync, linkSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmdirSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { closeSync, existsSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, rmdirSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { dirname, join, resolve, sep } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
6
7
|
import { tmpdir } from 'node:os';
|
|
7
8
|
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
8
9
|
import { getElanousConfigDir, getElanousConfigDirOverride } from '../elanous-config-dir.js';
|
|
@@ -22,6 +23,9 @@ import type { ResearchEdgeDecisionRegistry } from '../research/edge-decision.js'
|
|
|
22
23
|
import { graphVersionHash, parseGraphTemplateYaml, type GraphEdgeSpec, type GraphNodeSpec, type GraphTemplateSpec } from '../self-implement/graph-yaml.js';
|
|
23
24
|
import { createGraphUnitResolver, resolveGraphUnit, UnitNotFoundError, type ResolvedGraphUnit } from '../self-implement/graph-unit-resolver.js';
|
|
24
25
|
import { flattenGraphUnits } from '../self-implement/graph-unit-flatten.js';
|
|
26
|
+
import { createGraphEventBus, createScopedGraphEventBus, publishNodeGraphEvent, type GraphEvent, type GraphEventBus } from './graph-events.js';
|
|
27
|
+
import { registerGraphSubscriptions, type GraphEdgeAdditionApi, type GraphSubgraphAppendProposal, type GraphSubscriptionDispatch } from './graph-subscriptions.js';
|
|
28
|
+
import { registerReleaseGraphEventAdapters } from '../release-loop/graph-event-adapters.js';
|
|
25
29
|
export { UnitNotFoundError } from '../self-implement/graph-unit-resolver.js';
|
|
26
30
|
import { createGraphVariant, type GraphVariantPlan } from '../self-implement/graph-variant.js';
|
|
27
31
|
import { psProcessStartMs, START_TOLERANCE_MS } from '../harness/harness-stop.js';
|
|
@@ -31,6 +35,7 @@ import { requireInProcessHandler, type InProcessHandlerRegistry } from './in-pro
|
|
|
31
35
|
import { interpolate } from '../workflow-runtime/variables.js';
|
|
32
36
|
import type { BashNode, ClassifyNode, NodeExecContext, NodeOutput, WorkflowDeps } from '../workflow-runtime/types.js';
|
|
33
37
|
import { releaseResumeAcceptedRegressions, releaseResumeGateExecutor, releaseResumeGatePodPool, releaseResumeGateShardReroute, releaseResumeWaiver, type AcceptedRegression, type GateExecutorOverride, type GatePodPoolOverride, type GateShardRerouteOverride } from '../../scripts/release-loop/resume.js';
|
|
38
|
+
import { registerAdaptiveGateHealAdapter, RELEASE_GATE_FAILED_EVENT, type AdaptiveGateHealAppendNodeRequest, type AdaptiveGateHealAppendNodeReceipt } from '../../scripts/release-loop/adaptive-gate-heal-adapter.js';
|
|
34
39
|
import { resolveChildAllowance } from './arg-allowance.js';
|
|
35
40
|
import { emitReleaseStageTransition, postReleaseStageMail, type ReleaseStageState } from '../release-loop/stage-mail.js';
|
|
36
41
|
import { openMsgStore } from '../msg/msg-store.js';
|
|
@@ -46,6 +51,66 @@ export function withGraphGrowthScope<T>(scope: GraphGrowthScope, work: () => T):
|
|
|
46
51
|
return graphGrowthScope.run(scope, work);
|
|
47
52
|
}
|
|
48
53
|
const DEFAULT_BASH_TIMEOUT_MS = 5 * 60 * 1_000;
|
|
54
|
+
const eventBusSequences = new WeakMap<GraphEventBus, number>();
|
|
55
|
+
|
|
56
|
+
function stableSha256(value: unknown): string {
|
|
57
|
+
return createHash('sha256').update(JSON.stringify(value) ?? 'undefined').digest('hex');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function completionCommit(state: GraphRunState): string | undefined {
|
|
61
|
+
const releaseCommit = state.nodes.find((record) => record.nodeId === 'version-release')?.output;
|
|
62
|
+
const commit = lastJsonObject(releaseCommit)?.commit;
|
|
63
|
+
return typeof commit === 'string' && /^[a-f0-9]{40}$/i.test(commit) ? commit : undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function actualSourceCommit(root: string, git?: (args: string[]) => string): string | undefined {
|
|
67
|
+
try {
|
|
68
|
+
const result = git ? undefined : spawnSync('git', ['rev-parse', 'HEAD'], { cwd: root, encoding: 'utf8' });
|
|
69
|
+
if (result && (result.status !== 0 || result.error)) return undefined;
|
|
70
|
+
const commit = git ? git(['rev-parse', 'HEAD']) : result?.stdout ?? '';
|
|
71
|
+
const value = commit.trim();
|
|
72
|
+
return /^[a-f0-9]{40}$/i.test(value) ? value.toLowerCase() : undefined;
|
|
73
|
+
} catch { return undefined; }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function completionArtifactSnapshot(output: unknown, baseDir: string): { sha256: string; valid: boolean } {
|
|
77
|
+
const files: Array<{ path: string; sha256: string | null }> = [];
|
|
78
|
+
const looksLikeArtifactPath = (value: string): boolean => /^(?:\/|\.\.?[\\/])/.test(value) || /[\\/]/.test(value) || /\.[A-Za-z0-9]{1,8}$/.test(value);
|
|
79
|
+
const isArtifactPath = (value: string): boolean => looksLikeArtifactPath(value) && !/^[a-z][a-z0-9+.-]*:\/\//i.test(value);
|
|
80
|
+
const recordArtifactPath = (value: string): void => {
|
|
81
|
+
const artifactPath = resolve(baseDir, value);
|
|
82
|
+
try {
|
|
83
|
+
if (lstatSync(artifactPath).isFile()) files.push({ path: artifactPath, sha256: createHash('sha256').update(readFileSync(artifactPath)).digest('hex') });
|
|
84
|
+
else files.push({ path: artifactPath, sha256: null });
|
|
85
|
+
} catch { files.push({ path: artifactPath, sha256: null }); }
|
|
86
|
+
};
|
|
87
|
+
const visit = (value: unknown): void => {
|
|
88
|
+
if (typeof value === 'string') {
|
|
89
|
+
try { visit(JSON.parse(value)); } catch { /* Plain text outputs have no structured artifact references. */ }
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (!value || typeof value !== 'object') return;
|
|
93
|
+
if (Array.isArray(value)) {
|
|
94
|
+
for (const entry of value) {
|
|
95
|
+
if (typeof entry === 'string' && isArtifactPath(entry)) recordArtifactPath(entry);
|
|
96
|
+
else visit(entry);
|
|
97
|
+
}
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {
|
|
101
|
+
const namedPath = /^(?:artifact|artifactpath|file(?:path)?|report(?:path)?|path)$/i.test(key) &&
|
|
102
|
+
(key.toLowerCase() !== 'artifact' || looksLikeArtifactPath(String(entry)));
|
|
103
|
+
const inferredPath = typeof entry === 'string' && isArtifactPath(entry);
|
|
104
|
+
if (typeof entry === 'string' && (namedPath || inferredPath)) {
|
|
105
|
+
recordArtifactPath(entry);
|
|
106
|
+
} else visit(entry);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
visit(output);
|
|
110
|
+
const valid = files.every((file) => file.sha256 !== null);
|
|
111
|
+
return { sha256: stableSha256({ output, files }), valid };
|
|
112
|
+
}
|
|
113
|
+
|
|
49
114
|
// Independent of graph YAML and recipe snapshots: an already-wrong saved binding must fail closed.
|
|
50
115
|
const RELEASE_NODE_COMMANDS: Readonly<Record<string, { recipe: string; command?: string }>> = {
|
|
51
116
|
'version-release': { recipe: 'cmd:version-release', command: 'bun scripts/release-loop/version-node.ts release --json' },
|
|
@@ -88,11 +153,19 @@ const RELEASE_NODE_COMMANDS: Readonly<Record<string, { recipe: string; command?:
|
|
|
88
153
|
};
|
|
89
154
|
|
|
90
155
|
function assertReleaseCommandBinding(node: GraphNodeSpec, command: string | undefined, terminal: boolean): void {
|
|
91
|
-
const
|
|
156
|
+
const adaptiveRepair = /^gate-repair-[a-f0-9]{12}$/.test(node.nodeId)
|
|
157
|
+
? { recipe: 'cmd:gate-repair', command: 'bun scripts/release-loop/gate-repair-node.ts' }
|
|
158
|
+
: /^gate-image-repair-[a-f0-9]{12}$/.test(node.nodeId)
|
|
159
|
+
? { recipe: 'cmd:gate-image-repair', command: 'bun scripts/release-loop/gate-image-repair-node.ts' }
|
|
160
|
+
: undefined;
|
|
161
|
+
const expected = RELEASE_NODE_COMMANDS[node.nodeId] ?? adaptiveRepair;
|
|
92
162
|
if (!expected || node.recipe !== expected.recipe || command !== expected.command ||
|
|
93
163
|
terminal !== (node.nodeId === 'done' || node.nodeId === 'failed')) {
|
|
94
164
|
throw new Error(`release node dispatch mismatch before execution: ${node.nodeId}`);
|
|
95
165
|
}
|
|
166
|
+
if (adaptiveRepair && !existsSync(fileURLToPath(new URL(`../../${adaptiveRepair.command.slice('bun '.length)}`, import.meta.url)))) {
|
|
167
|
+
throw new Error(`release node entrypoint is missing before execution: ${node.nodeId} -> ${adaptiveRepair.command}`);
|
|
168
|
+
}
|
|
96
169
|
}
|
|
97
170
|
|
|
98
171
|
const LOOP_TERMINAL_STATUS: Readonly<Record<string, Readonly<Record<string, 'done' | 'failed'>>>> = {
|
|
@@ -167,12 +240,14 @@ export interface GraphRunState {
|
|
|
167
240
|
/** Dry-run path with each fan-out branch's planned writes expanded before its join. */
|
|
168
241
|
plannedPath?: string[];
|
|
169
242
|
/** startedAt/endedAt (ISO) and seconds are written when the node runs; ledgers before GRAPH-NODE-TIMES (0.2.19) have none. */
|
|
170
|
-
nodes: Array<{ nodeId: string; ok: boolean; exit: number | null; executed: boolean; output?: unknown; error?: string; reason?: string;
|
|
243
|
+
nodes: Array<{ nodeId: string; executionId?: string; ok: boolean; exit: number | null; executed: boolean; output?: unknown; error?: string; reason?: string;
|
|
244
|
+
completionReceipt?: { inputSha256: string; commit: string; artifactSha256: string };
|
|
245
|
+
invalidatedByEvent?: string;
|
|
171
246
|
failure?: { errorCode: string; message: string; stage: string }; decidedBy?: string; decidedAt?: string;
|
|
172
247
|
startedAt?: string; endedAt?: string; seconds?: number;
|
|
173
248
|
waiver?: { reason: string; at: string; approvedBy?: string; introducedIds?: string[]; ownerWaived?: boolean; /** RELEASE-WAIVE-UNMEASURED — why the waived gate had no verdict. */ unmeasured?: string; original: { exit: number | null; output?: unknown; error?: string } } }>;
|
|
174
249
|
/** The node now running and when it started; cleared when its record is written. */
|
|
175
|
-
currentNode?: { nodeId: string; startedAt: string };
|
|
250
|
+
currentNode?: { nodeId: string; executionId?: string; startedAt: string };
|
|
176
251
|
input?: unknown;
|
|
177
252
|
pending?: { nodeId: string; message: string; since: string; notifiedAt?: string; decision?: 'approved' | 'rejected'; decidedBy?: string; decidedAt?: string };
|
|
178
253
|
approvalSourceHash?: string;
|
|
@@ -184,11 +259,32 @@ export interface GraphRunState {
|
|
|
184
259
|
parentRunId?: string;
|
|
185
260
|
/** The entry chosen by a parent call; absent for existing single-entry runs. */
|
|
186
261
|
entryNodeId?: string;
|
|
262
|
+
/** Monotonic graph event sequence; carried across resume for subscriber dedupe. */
|
|
263
|
+
graphEventSequence?: number;
|
|
264
|
+
/** Auditable dispositions for event-driven scheduler actions. */
|
|
265
|
+
subscriptionActions?: Array<{ eventId: string; subscriberId: string; nodeId: string;
|
|
266
|
+
action: GraphSubscriptionDispatch['action']; outcome: 'queued' | 'handled' | 'rejected'; reason?: string; at: string }>;
|
|
267
|
+
/** Durable undispatched actions and wake continuation, restored after interruption/resume. */
|
|
268
|
+
pendingSubscriptionActions?: Array<{ subscriberId: string; nodeId: string; action: GraphSubscriptionDispatch['action']; event: GraphEvent;
|
|
269
|
+
returnTo?: string; failureTo?: string; appendNodeIds?: string[] }>;
|
|
270
|
+
wakeContinuation?: { nodeId: string; returnTo?: string; failureTo?: string; appendNodeIds?: string[] };
|
|
271
|
+
/** Validated append-only subgraphs installed by a subscriber and restored on resume. */
|
|
272
|
+
subscriptionGraphAppends?: Array<{ proposal: GraphSubgraphAppendProposal; eventId: string; subscriberId: string }>;
|
|
273
|
+
/** Subscriber-proposed event vocabulary and direct edges, durable across run resume. */
|
|
274
|
+
adaptiveGraphVocabulary?: string[];
|
|
275
|
+
adaptiveGraphEdges?: Array<{ from: string; to: string; triggerEvent: string; rationale: string; eventId: string; subscriberId: string }>;
|
|
276
|
+
/** Release ARG append receipts keyed by the originating bus event identity. */
|
|
277
|
+
adaptiveGateNodeAppends?: Array<{ eventId: string; request: AdaptiveGateHealAppendNodeRequest; graphRevision: number }>;
|
|
278
|
+
/** Monotonic revision for run-local graph appends; starts at 1 for the loaded graph. */
|
|
279
|
+
graphRevision?: number;
|
|
280
|
+
/** Failed event envelopes remain byte-for-byte retryable so successful subscribers dedupe. */
|
|
281
|
+
pendingGraphEvents?: GraphEvent[];
|
|
187
282
|
unitCalls?: Array<{ node: string; unit: string; version: number; hash: string; childRunId: string; exit: string; steps: number; entry?: string; visit?: number; enteredAtMs?: number; exitedAtMs?: number; durationMs?: number }>;
|
|
188
283
|
/** Persisted fan-out child identities and terminal results; successful branches are immutable on resume. */
|
|
189
284
|
fanOuts?: Record<string, { from: string; join: string; branches: Record<string, {
|
|
190
285
|
runId: string; status: 'running' | 'done' | 'failed'; startedAt: string; endedAt?: string;
|
|
191
286
|
artifactSha256?: string; output?: unknown; error?: string; path?: string[];
|
|
287
|
+
completionReceipt?: { inputSha256: string; commit: string; artifactSha256: string };
|
|
192
288
|
}> }>;
|
|
193
289
|
/** Highest visit number handed to each unit in this run; not rewound by a restart, so
|
|
194
290
|
* a resumed run never reuses a (runId, unit, visit) span. */
|
|
@@ -262,6 +358,8 @@ export interface GraphRunOptions {
|
|
|
262
358
|
dryRun?: boolean;
|
|
263
359
|
variant?: { goal: string; plan: GraphVariantPlan };
|
|
264
360
|
runId?: string;
|
|
361
|
+
/** Optional structured event sink for actual node lifecycle events and declared subscriptions. */
|
|
362
|
+
eventBus?: GraphEventBus;
|
|
265
363
|
resumeRunId?: string;
|
|
266
364
|
resumeGraphId?: string;
|
|
267
365
|
fromNodeId?: string;
|
|
@@ -296,7 +394,59 @@ export interface GraphRunOptions {
|
|
|
296
394
|
branchParentOutputs?: Readonly<Record<string, unknown>>;
|
|
297
395
|
/** Optional per-run Bloom edge policy hook. */
|
|
298
396
|
researchEdgeDecisionRegistry?: ResearchEdgeDecisionRegistry;
|
|
299
|
-
deps?: {
|
|
397
|
+
deps?: {
|
|
398
|
+
root?: string;
|
|
399
|
+
runBash?: BashRun;
|
|
400
|
+
callLLM?: (prompt: string) => Promise<string>;
|
|
401
|
+
log?: (event: string, data: Record<string, unknown>) => void;
|
|
402
|
+
releaseStageMail?: (input: { runId: string; nodeId: string; state: ReleaseStageState }) => unknown;
|
|
403
|
+
releaseGraphEventAdapters?: boolean;
|
|
404
|
+
dispatchGraphSubscription?: (dispatch: GraphSubscriptionDispatch) => void | Promise<void>;
|
|
405
|
+
proposeGraphEdge?: GraphEdgeAdditionApi;
|
|
406
|
+
/** Observer failures are isolated; returned promises are serialized off the graph execution path. */
|
|
407
|
+
nodeLifecycle?: (event: GraphNodeLifecycleEvent) => void | Promise<void>;
|
|
408
|
+
/** Optional post-arrival binding check; used by callers that enforce additional dispatch constraints. */
|
|
409
|
+
validateNodeBinding?: (nodeId: string, command: string | undefined) => void;
|
|
410
|
+
/** Fault-injection hook for verifying lifecycle closure and persisted resume state. */
|
|
411
|
+
beforePersist?: (state: GraphRunState) => void;
|
|
412
|
+
beforeNode?: () => void;
|
|
413
|
+
processStartMs?: (pid: number) => number | null;
|
|
414
|
+
monotonicMs?: () => number;
|
|
415
|
+
growthProposer?: GrowthProposer;
|
|
416
|
+
growthLLM?: (prompt: string) => Promise<string>;
|
|
417
|
+
growthScope?: GraphGrowthScope;
|
|
418
|
+
classifyGrowthRecipe?: (node: GraphNodeSpec, resolved: { command?: string; approval?: string }) => GrowthRecipeEffect;
|
|
419
|
+
growthDecision?: GrowthDecisionDeps & { list?: (filters: { status: 'all' }) => DecisionEntry[] };
|
|
420
|
+
inProcessHandlers?: InProcessHandlerRegistry;
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Best-effort lifecycle signal consumed by release-loop observers. */
|
|
425
|
+
export type GraphNodeLifecyclePhase = 'arrival' | 'start' | 'end' | 'leave';
|
|
426
|
+
export interface GraphNodeLifecycleEvent {
|
|
427
|
+
eventId: string;
|
|
428
|
+
seq: number;
|
|
429
|
+
kind: 'node.lifecycle';
|
|
430
|
+
source: 'graph-runner';
|
|
431
|
+
phase: GraphNodeLifecyclePhase;
|
|
432
|
+
graphId: string;
|
|
433
|
+
runId: string;
|
|
434
|
+
nodeId: string;
|
|
435
|
+
attempt: number;
|
|
436
|
+
visit: number;
|
|
437
|
+
dryRun: boolean;
|
|
438
|
+
at: string;
|
|
439
|
+
outcome?: 'ok' | 'fail';
|
|
440
|
+
nextNodeId?: string;
|
|
441
|
+
reason?: string;
|
|
442
|
+
data: {
|
|
443
|
+
phase: GraphNodeLifecyclePhase;
|
|
444
|
+
visit: number;
|
|
445
|
+
dryRun: boolean;
|
|
446
|
+
at: string;
|
|
447
|
+
nextNodeId?: string;
|
|
448
|
+
reason?: string;
|
|
449
|
+
};
|
|
300
450
|
}
|
|
301
451
|
|
|
302
452
|
/** The command directory must itself be the checkout at the cut tip. */
|
|
@@ -360,6 +510,10 @@ function roleCommand(recipe: string, recipes: Record<string, Recipe>, catalogRol
|
|
|
360
510
|
|
|
361
511
|
function resolveNodeRecipe(node: GraphNodeSpec, recipes: Record<string, Recipe>, catalogRoles: ReadonlySet<string>): { command?: CommandRecipe; prompt?: PromptRecipe; approval?: { approval: string } } {
|
|
362
512
|
if (node.recipe === 'none') return {};
|
|
513
|
+
if (node.recipe === 'cmd:gate-repair' && /^gate-repair-[a-f0-9]{12}$/.test(node.nodeId))
|
|
514
|
+
return { command: { command: 'bun scripts/release-loop/gate-repair-node.ts', timeout_ms: 30 * 60 * 1_000 } };
|
|
515
|
+
if (node.recipe === 'cmd:gate-image-repair' && /^gate-image-repair-[a-f0-9]{12}$/.test(node.nodeId))
|
|
516
|
+
return { command: { command: 'bun scripts/release-loop/gate-image-repair-node.ts', timeout_ms: 30 * 60 * 1_000 } };
|
|
363
517
|
if (node.kind === 'prompt' && node.recipe.startsWith('prompt:')) {
|
|
364
518
|
const entry = recipes[node.recipe.slice('prompt:'.length)];
|
|
365
519
|
return entry && 'prompt' in entry ? { prompt: entry } : {};
|
|
@@ -619,6 +773,15 @@ export function lastJsonObject(stdout: unknown): Record<string, unknown> | undef
|
|
|
619
773
|
}
|
|
620
774
|
}
|
|
621
775
|
|
|
776
|
+
function hasActionableGateTriageEvidence(value: Record<string, unknown> | undefined): value is Record<string, unknown> {
|
|
777
|
+
const introduced = value?.introduced;
|
|
778
|
+
return typeof value?.classification === 'string' &&
|
|
779
|
+
['unmeasured', 'load', 'env', 'regression', 'clean', 'exhausted'].includes(value.classification) &&
|
|
780
|
+
typeof value.commit === 'string' && /^[0-9a-f]{40}$/i.test(value.commit) &&
|
|
781
|
+
Array.isArray(introduced) && (introduced.length > 0 || value.classification === 'unmeasured') &&
|
|
782
|
+
introduced.every((id) => typeof id === 'string' && id.trim().length > 0);
|
|
783
|
+
}
|
|
784
|
+
|
|
622
785
|
/** Reconstruct the run-local edges from the ledger without rewriting the YAML snapshot. */
|
|
623
786
|
/** Apply validated, run-local edge growth to a graph snapshot. Exported for the graph simulator device. */
|
|
624
787
|
export function withGrowth(graph: GraphTemplateSpec, growth: readonly GraphGrowth[]): GraphTemplateSpec {
|
|
@@ -636,6 +799,74 @@ export function withGrowth(graph: GraphTemplateSpec, growth: readonly GraphGrowt
|
|
|
636
799
|
}, graph);
|
|
637
800
|
}
|
|
638
801
|
|
|
802
|
+
/** Return scheduler order for a bounded linear subgraph that ends at its declared resume node. */
|
|
803
|
+
function subscriptionAppendNodeOrder(proposal: GraphSubgraphAppendProposal): string[] {
|
|
804
|
+
const nodeIds = proposal.nodes.map((node) => node.nodeId);
|
|
805
|
+
const added = new Set(nodeIds);
|
|
806
|
+
const edges = proposal.edges;
|
|
807
|
+
const outcomeEdges = edges.filter((edge) => edge.on !== undefined || edge.map !== undefined || edge.branches !== undefined);
|
|
808
|
+
const linearEdges = edges.filter((edge) => edge.on === undefined && edge.map === undefined && edge.branches === undefined);
|
|
809
|
+
if (!proposal.reason.trim() || nodeIds.length === 0 || added.size !== nodeIds.length ||
|
|
810
|
+
!added.has(proposal.entryNodeId) ||
|
|
811
|
+
proposal.nodes.some((node) => !Number.isSafeInteger(node.maxVisits) || node.maxVisits < 1 || !node.recipe || !node.kind) ||
|
|
812
|
+
linearEdges.some((edge) => edge.to === undefined || !added.has(edge.from) ||
|
|
813
|
+
(!added.has(edge.to) && edge.to !== proposal.returnTo)) ||
|
|
814
|
+
outcomeEdges.length > 1 || (outcomeEdges.length === 0 && proposal.failureTo !== undefined) ||
|
|
815
|
+
(outcomeEdges.length === 1 && (!proposal.failureTo || outcomeEdges[0]!.on !== 'outcome' ||
|
|
816
|
+
!outcomeEdges[0]!.map || outcomeEdges[0]!.branches !== undefined || outcomeEdges[0]!.to !== undefined ||
|
|
817
|
+
Object.keys(outcomeEdges[0]!.map).sort().join(',') !== 'error,fail,ok' ||
|
|
818
|
+
outcomeEdges[0]!.map.ok !== proposal.returnTo || outcomeEdges[0]!.map.fail !== proposal.failureTo ||
|
|
819
|
+
outcomeEdges[0]!.map.error !== proposal.failureTo || !added.has(outcomeEdges[0]!.from)))) {
|
|
820
|
+
throw new Error('invalid saved subscriber graph append');
|
|
821
|
+
}
|
|
822
|
+
const outgoing = new Map<string, string>();
|
|
823
|
+
for (const edge of linearEdges) {
|
|
824
|
+
if (outgoing.has(edge.from)) throw new Error('invalid saved subscriber graph append');
|
|
825
|
+
outgoing.set(edge.from, edge.to!);
|
|
826
|
+
}
|
|
827
|
+
const path: string[] = [];
|
|
828
|
+
let cursor = proposal.entryNodeId;
|
|
829
|
+
while (cursor !== proposal.returnTo) {
|
|
830
|
+
if (!added.has(cursor) || path.includes(cursor)) throw new Error('invalid saved subscriber graph append');
|
|
831
|
+
path.push(cursor);
|
|
832
|
+
const next = outgoing.get(cursor);
|
|
833
|
+
if (!next) {
|
|
834
|
+
if (outcomeEdges.length === 1 && outcomeEdges[0]!.from === cursor) break;
|
|
835
|
+
throw new Error('invalid saved subscriber graph append');
|
|
836
|
+
}
|
|
837
|
+
cursor = next;
|
|
838
|
+
}
|
|
839
|
+
if (path.length !== nodeIds.length || outgoing.size !== nodeIds.length - outcomeEdges.length ||
|
|
840
|
+
(outcomeEdges.length === 1 && path.at(-1) !== outcomeEdges[0]!.from))
|
|
841
|
+
throw new Error('invalid saved subscriber graph append');
|
|
842
|
+
return path;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/** Restore subscriber-owned run-local subgraphs; each append is a bounded linear path ending at returnTo. */
|
|
846
|
+
function withSubscriptionGraphAppends(graph: GraphTemplateSpec,
|
|
847
|
+
appends: NonNullable<GraphRunState['subscriptionGraphAppends']>): GraphTemplateSpec {
|
|
848
|
+
return appends.reduce<GraphTemplateSpec>((current, append) => {
|
|
849
|
+
const { proposal } = append;
|
|
850
|
+
subscriptionAppendNodeOrder(proposal);
|
|
851
|
+
const nodeIds = proposal.nodes.map((node) => node.nodeId);
|
|
852
|
+
if (!current.nodes.some((node) => node.nodeId === proposal.returnTo) ||
|
|
853
|
+
(proposal.failureTo !== undefined && !current.terminalNodes.includes(proposal.failureTo)) ||
|
|
854
|
+
nodeIds.some((nodeId) => !nodeId || current.nodes.some((node) => node.nodeId === nodeId)))
|
|
855
|
+
throw new Error('invalid saved subscriber graph append');
|
|
856
|
+
return { ...current, nodes: [...current.nodes, ...proposal.nodes], edges: [...current.edges, ...proposal.edges] };
|
|
857
|
+
}, graph);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function withAdaptiveGraphEdges(graph: GraphTemplateSpec,
|
|
861
|
+
edges: NonNullable<GraphRunState['adaptiveGraphEdges']>, vocabulary: readonly string[]): GraphTemplateSpec {
|
|
862
|
+
for (const edge of edges) {
|
|
863
|
+
if (!graph.nodes.some((node) => node.nodeId === edge.from) || !graph.nodes.some((node) => node.nodeId === edge.to) ||
|
|
864
|
+
!edge.triggerEvent.trim() || !edge.rationale.trim() || !vocabulary.includes(edge.triggerEvent))
|
|
865
|
+
throw new Error('invalid saved adaptive graph edge');
|
|
866
|
+
}
|
|
867
|
+
return graph;
|
|
868
|
+
}
|
|
869
|
+
|
|
639
870
|
/** 이름 붙은 결과: 산출의 `outcome` 이 그 간선 map 의 키면 그 목적지 — 아니면 종전 ok/fail(exit) → fallback. */
|
|
640
871
|
/** Production edge selection shared by runGraph and the graph simulator device. */
|
|
641
872
|
export function nextNode(edges: readonly GraphEdgeSpec[], nodeId: string, exitOutcome: 'ok' | 'fail', namedOutcome?: string): string | undefined {
|
|
@@ -675,6 +906,13 @@ function fanOutGraphSource(source: string, graph: GraphTemplateSpec, branchNode:
|
|
|
675
906
|
: terminals.find((terminal) => topLevelTerminalStatus(graph.graphId, terminal) === 'failed');
|
|
676
907
|
if (!done || !failed) throw new Error(`fan-out requires declared success and failure terminals: ${graph.graphId}`);
|
|
677
908
|
document.entry_node = branchNode;
|
|
909
|
+
if (Array.isArray(document.nodes)) {
|
|
910
|
+
document.nodes = document.nodes.map((entry) => {
|
|
911
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return entry;
|
|
912
|
+
const { needs: _needs, ...node } = entry as Record<string, unknown>;
|
|
913
|
+
return node;
|
|
914
|
+
});
|
|
915
|
+
}
|
|
678
916
|
document.edges = [{ from: branchNode, on: 'outcome', map: { ok: done, fail: failed, error: failed } }];
|
|
679
917
|
return stringifyYaml(document);
|
|
680
918
|
}
|
|
@@ -720,6 +958,7 @@ function validateUnitCallsWithResolver(graph: GraphTemplateSpec, path: string, a
|
|
|
720
958
|
}
|
|
721
959
|
|
|
722
960
|
export async function runGraph(path: string, options: GraphRunOptions = {}): Promise<GraphRunState> {
|
|
961
|
+
let lifecycleObserverQueue = Promise.resolve();
|
|
723
962
|
const scopedContext = options.deps?.growthScope ?? graphGrowthScope.getStore();
|
|
724
963
|
const envGrowthScope = process.env[GRAPH_GROWTH_SCOPE_ENV];
|
|
725
964
|
// A separate Pod process cannot inherit AsyncLocalStorage. Only the explicit
|
|
@@ -867,6 +1106,78 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
867
1106
|
throw new Error(`run identity mismatch: ${saved.graphId}/${saved.runId}`);
|
|
868
1107
|
}
|
|
869
1108
|
const runId = safeSegment(options.resumeRunId ?? options.runId ?? randomUUID());
|
|
1109
|
+
const eventSequenceBase = saved?.graphEventSequence ?? 0;
|
|
1110
|
+
let eventSequence = eventSequenceBase;
|
|
1111
|
+
let eventRunState: GraphRunState | undefined;
|
|
1112
|
+
let eventRunOwner: Pick<GraphRunState, 'pid' | 'pidStartedAt' | 'stoppedAt'> | undefined;
|
|
1113
|
+
let eventQueuePersistenceFailure: unknown;
|
|
1114
|
+
let persistEventState: (runState: GraphRunState, owner: Pick<GraphRunState, 'pid' | 'pidStartedAt' | 'stoppedAt'>) => void =
|
|
1115
|
+
(runState, owner) => {
|
|
1116
|
+
try {
|
|
1117
|
+
if (runState === eventRunState) options.deps?.beforePersist?.(runState);
|
|
1118
|
+
persistOwnedRun(runState, owner);
|
|
1119
|
+
} catch (error) {
|
|
1120
|
+
eventQueuePersistenceFailure = error;
|
|
1121
|
+
throw error;
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
const baseEventBus = options.eventBus ?? createGraphEventBus();
|
|
1125
|
+
const eventBus = createScopedGraphEventBus(baseEventBus, (input) => {
|
|
1126
|
+
const stableSequence = Math.max(eventBusSequences.get(baseEventBus) ?? 0,
|
|
1127
|
+
eventSequence, eventRunState?.graphEventSequence ?? eventSequenceBase) + 1;
|
|
1128
|
+
eventBusSequences.set(baseEventBus, stableSequence);
|
|
1129
|
+
eventSequence = stableSequence;
|
|
1130
|
+
if (eventRunState && eventRunOwner) {
|
|
1131
|
+
eventRunState.graphEventSequence = stableSequence;
|
|
1132
|
+
}
|
|
1133
|
+
return { ...input, eventId: `${graphId}:${runId}:${stableSequence}`, sequence: stableSequence,
|
|
1134
|
+
emittedAt: new Date().toISOString() } as GraphEvent;
|
|
1135
|
+
}, (event) => {
|
|
1136
|
+
if (!eventRunState || !eventRunOwner) return;
|
|
1137
|
+
eventRunState.pendingGraphEvents ??= [];
|
|
1138
|
+
if (!eventRunState.pendingGraphEvents.some((pending) => pending.eventId === event.eventId))
|
|
1139
|
+
eventRunState.pendingGraphEvents.push(event);
|
|
1140
|
+
persistEventState(eventRunState, eventRunOwner);
|
|
1141
|
+
}, (_scope, eventIds) => {
|
|
1142
|
+
if (!eventRunState || !eventRunOwner || eventIds.length === 0) return;
|
|
1143
|
+
const delivered = new Set(eventIds);
|
|
1144
|
+
const pendingApproval = eventRunState.pending;
|
|
1145
|
+
for (const event of eventRunState.pendingGraphEvents ?? []) {
|
|
1146
|
+
if (pendingApproval && delivered.has(event.eventId) && event.type === 'release-stage' && event.data?.state === 'wait' &&
|
|
1147
|
+
pendingApproval.nodeId === event.source.nodeId && !pendingApproval.notifiedAt) {
|
|
1148
|
+
eventRunState.pending = { ...pendingApproval, notifiedAt: new Date().toISOString() };
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
eventRunState.pendingGraphEvents = (eventRunState.pendingGraphEvents ?? []).filter((event) => !delivered.has(event.eventId));
|
|
1152
|
+
persistEventState(eventRunState, eventRunOwner);
|
|
1153
|
+
});
|
|
1154
|
+
const useReleaseGraphEventAdapters = options.deps?.releaseGraphEventAdapters ??
|
|
1155
|
+
(process.env.NODE_ENV !== 'test' && process.env.BUN_TEST === undefined);
|
|
1156
|
+
eventBus.registerType('node-arrival');
|
|
1157
|
+
eventBus.registerType('node-leave');
|
|
1158
|
+
eventBus.registerType(RELEASE_GATE_FAILED_EVENT);
|
|
1159
|
+
if (!eventBus.hasType('release.gate.progress')) eventBus.registerType('release.gate.progress');
|
|
1160
|
+
if (isReleaseLoop) eventBus.registerType('release-stage');
|
|
1161
|
+
const lifecyclePhaseByType: Readonly<Record<string, GraphNodeLifecyclePhase>> = {
|
|
1162
|
+
'node-arrival': 'arrival', 'node-start': 'start', 'node-end': 'end', 'node-leave': 'leave',
|
|
1163
|
+
};
|
|
1164
|
+
eventBus.subscribe((event) => {
|
|
1165
|
+
const phase = lifecyclePhaseByType[event.type];
|
|
1166
|
+
const nodeId = event.source.nodeId;
|
|
1167
|
+
if (!phase || !nodeId) return;
|
|
1168
|
+
const visit = typeof event.data?.visit === 'number' ? event.data.visit : 0;
|
|
1169
|
+
const dryRun = event.data?.dryRun === true;
|
|
1170
|
+
const at = event.emittedAt;
|
|
1171
|
+
const extra = {
|
|
1172
|
+
...(event.data?.outcome === 'ok' || event.data?.outcome === 'fail' ? { outcome: event.data.outcome } : {}),
|
|
1173
|
+
...(typeof event.data?.nextNodeId === 'string' ? { nextNodeId: event.data.nextNodeId } : {}),
|
|
1174
|
+
...(typeof event.data?.reason === 'string' ? { reason: event.data.reason } : {}),
|
|
1175
|
+
};
|
|
1176
|
+
publishInsideEvent({ kind: 'node.lifecycle', eventId: event.eventId, seq: event.sequence,
|
|
1177
|
+
source: 'graph-runner', phase, graphId: event.graphId, runId: event.runId, nodeId,
|
|
1178
|
+
attempt: visit, visit, dryRun, at, ...extra,
|
|
1179
|
+
data: { phase, visit, dryRun, at, ...extra } });
|
|
1180
|
+
});
|
|
870
1181
|
const statePath = graphRunPath(graphId, runId, root);
|
|
871
1182
|
// A resume owns the run from the first state read through its last write and command.
|
|
872
1183
|
// Fail closed on a concurrent (or interrupted) owner rather than replaying a command.
|
|
@@ -879,7 +1190,174 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
879
1190
|
throw error;
|
|
880
1191
|
}
|
|
881
1192
|
}
|
|
1193
|
+
const graphSubscriptionDisposers: (() => void)[] = [];
|
|
1194
|
+
const registeredGraphSubscriptionNodes = new Set<string>();
|
|
1195
|
+
const disposeGraphSubscriptions = (): void => { for (const dispose of graphSubscriptionDisposers.splice(0)) dispose(); };
|
|
1196
|
+
let disposeReleaseGraphEventAdapters: () => void = () => undefined;
|
|
1197
|
+
let disposeAdaptiveGateHealAdapter: () => void = () => undefined;
|
|
1198
|
+
type QueuedSubscriptionAction = NonNullable<GraphRunState['pendingSubscriptionActions']>[number];
|
|
1199
|
+
const pendingSubscriptionActions: QueuedSubscriptionAction[] = [];
|
|
1200
|
+
let subscriptionRunState: GraphRunState | undefined;
|
|
1201
|
+
const dispatchSubscription = async (dispatch: GraphSubscriptionDispatch): Promise<void> => {
|
|
1202
|
+
// A failed event delivery keeps the same envelope in the outbox. Its successful
|
|
1203
|
+
// subscribers must not enqueue the same durable action again when that envelope replays.
|
|
1204
|
+
const alreadyDispatched = subscriptionRunState?.subscriptionActions?.some((action) =>
|
|
1205
|
+
action.eventId === dispatch.event.eventId && action.subscriberId === dispatch.subscriberId) === true ||
|
|
1206
|
+
(subscriptionRunState?.pendingSubscriptionActions ?? []).some((action) =>
|
|
1207
|
+
action.event.eventId === dispatch.event.eventId && action.subscriberId === dispatch.subscriberId);
|
|
1208
|
+
// A subscriber may install a matching run-local edge in its callback below.
|
|
1209
|
+
// The scheduler validates reroutes after dispatch, once that proposal is durable.
|
|
1210
|
+
if (!alreadyDispatched) {
|
|
1211
|
+
if (dispatch.action === 'invalidate') {
|
|
1212
|
+
const record = [...(subscriptionRunState?.nodes ?? [])].reverse().find((item) => item.nodeId === dispatch.nodeId);
|
|
1213
|
+
if (!record) {
|
|
1214
|
+
logSubscriptionAction('rejected', dispatch, 'no prior node result exists to invalidate');
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
record.output = undefined;
|
|
1218
|
+
record.invalidatedByEvent = dispatch.event.eventId;
|
|
1219
|
+
}
|
|
1220
|
+
const queued: QueuedSubscriptionAction = { subscriberId: dispatch.subscriberId, nodeId: dispatch.nodeId,
|
|
1221
|
+
action: dispatch.action, event: dispatch.event };
|
|
1222
|
+
pendingSubscriptionActions.push(queued);
|
|
1223
|
+
if (subscriptionRunState) {
|
|
1224
|
+
subscriptionRunState.pendingSubscriptionActions = [...pendingSubscriptionActions];
|
|
1225
|
+
}
|
|
1226
|
+
logSubscriptionAction('queued', dispatch);
|
|
1227
|
+
if (subscriptionRunState) persistOwnedRun(subscriptionRunState, eventRunOwner!);
|
|
1228
|
+
}
|
|
1229
|
+
await options.deps?.dispatchGraphSubscription?.({ ...dispatch,
|
|
1230
|
+
eventVocabulary: { registerType: (type) => {
|
|
1231
|
+
if (!type.trim()) throw new Error('adaptive graph event type must be non-empty');
|
|
1232
|
+
if (!eventBus.hasType(type)) eventBus.registerType(type);
|
|
1233
|
+
const state = subscriptionRunState;
|
|
1234
|
+
if (state && eventRunOwner) {
|
|
1235
|
+
state.adaptiveGraphVocabulary ??= [];
|
|
1236
|
+
if (!state.adaptiveGraphVocabulary.includes(type)) {
|
|
1237
|
+
state.adaptiveGraphVocabulary.push(type);
|
|
1238
|
+
persistOwnedRun(state, eventRunOwner);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}, hasType: (type) => eventBus.hasType(type) },
|
|
1242
|
+
proposeEdge: async (proposal) => {
|
|
1243
|
+
const state = subscriptionRunState;
|
|
1244
|
+
if (!state || !eventRunOwner) return { disposition: 'rejected', reason: 'run state is not ready' };
|
|
1245
|
+
if (proposal.mode === 'shadow') {
|
|
1246
|
+
if (!proposal.unmeasuredAxis.trim()) throw new Error('shadow graph edge proposal requires a non-empty unmeasuredAxis');
|
|
1247
|
+
return { disposition: 'shadow', unmeasuredAxis: proposal.unmeasuredAxis, reason: 'N21 adaptive graph changes are live by default; shadow requires an explicitly measured simulation gap' };
|
|
1248
|
+
}
|
|
1249
|
+
if (!proposal.rationale.trim() || !proposal.triggerEvent.trim()) return { disposition: 'rejected', reason: 'edge proposal requires a trigger event and rationale' };
|
|
1250
|
+
if (proposal.from !== dispatch.event.source.nodeId || proposal.to !== dispatch.nodeId)
|
|
1251
|
+
return { disposition: 'rejected', reason: 'adaptive edge endpoints must be the triggering node and subscribed node' };
|
|
1252
|
+
if (!graph.nodes.some((node) => node.nodeId === proposal.from) || !graph.nodes.some((node) => node.nodeId === proposal.to))
|
|
1253
|
+
return { disposition: 'rejected', reason: 'adaptive edge endpoints must exist in the active graph' };
|
|
1254
|
+
const policyResult = await options.deps?.proposeGraphEdge?.(proposal);
|
|
1255
|
+
if (policyResult && policyResult.disposition !== 'added') return policyResult;
|
|
1256
|
+
const prior = (state.adaptiveGraphEdges ?? []).find((edge) => edge.eventId === dispatch.event.eventId && edge.subscriberId === dispatch.subscriberId);
|
|
1257
|
+
if (prior) {
|
|
1258
|
+
const sameProposal = prior.from === proposal.from && prior.to === proposal.to && prior.triggerEvent === proposal.triggerEvent && prior.rationale === proposal.rationale;
|
|
1259
|
+
return sameProposal ? { disposition: 'added', reason: 'duplicate proposal already installed' }
|
|
1260
|
+
: { disposition: 'rejected', reason: 'subscriber already proposed a different edge for this event' };
|
|
1261
|
+
}
|
|
1262
|
+
try {
|
|
1263
|
+
graph = withAdaptiveGraphEdges(graph, [{ ...proposal, eventId: dispatch.event.eventId, subscriberId: dispatch.subscriberId }],
|
|
1264
|
+
[...(state.adaptiveGraphVocabulary ?? []), proposal.triggerEvent]);
|
|
1265
|
+
} catch (error) { return { disposition: 'rejected', reason: error instanceof Error ? error.message : String(error) }; }
|
|
1266
|
+
if (!eventBus.hasType(proposal.triggerEvent)) eventBus.registerType(proposal.triggerEvent);
|
|
1267
|
+
state.adaptiveGraphVocabulary ??= [];
|
|
1268
|
+
if (!state.adaptiveGraphVocabulary.includes(proposal.triggerEvent)) state.adaptiveGraphVocabulary.push(proposal.triggerEvent);
|
|
1269
|
+
state.adaptiveGraphEdges ??= [];
|
|
1270
|
+
state.adaptiveGraphEdges.push({ ...proposal, eventId: dispatch.event.eventId, subscriberId: dispatch.subscriberId });
|
|
1271
|
+
state.graphRevision = (state.graphRevision ?? 1) + 1;
|
|
1272
|
+
persistOwnedRun(state, eventRunOwner);
|
|
1273
|
+
try { (options.deps?.log ?? ((event, data) => debug.log('graph.runner', event, data)))('adaptive-graph-edge-added', {
|
|
1274
|
+
graphId, runId, eventId: dispatch.event.eventId, subscriberId: dispatch.subscriberId, ...proposal,
|
|
1275
|
+
}); } catch { /* persisted graph mutation is authoritative */ }
|
|
1276
|
+
return { disposition: 'added', reason: 'event vocabulary and run-local edge persisted' };
|
|
1277
|
+
}, appendGraph: async (proposal: GraphSubgraphAppendProposal) => {
|
|
1278
|
+
const state = subscriptionRunState;
|
|
1279
|
+
if (!state || !eventRunOwner) return { disposition: 'rejected', reason: 'run state is not ready' };
|
|
1280
|
+
if (!proposal.reason?.trim() || !Array.isArray(proposal.nodes) || !Array.isArray(proposal.edges))
|
|
1281
|
+
return { disposition: 'rejected', reason: 'append requires nodes, edges, and a reason' };
|
|
1282
|
+
const prior = (state.subscriptionGraphAppends ?? []).find((append) =>
|
|
1283
|
+
append.eventId === dispatch.event.eventId && append.subscriberId === dispatch.subscriberId);
|
|
1284
|
+
if (prior) return { disposition: 'duplicate', nodeId: prior.proposal.entryNodeId };
|
|
1285
|
+
const nodeIds = proposal.nodes.map((node) => node.nodeId);
|
|
1286
|
+
if (nodeIds.length === 0) return { disposition: 'rejected', reason: 'append requires at least one node' };
|
|
1287
|
+
const existingAppend = (state.subscriptionGraphAppends ?? []).find((append) =>
|
|
1288
|
+
JSON.stringify(append.proposal) === JSON.stringify(proposal));
|
|
1289
|
+
if (existingAppend) return { disposition: 'duplicate', nodeId: existingAppend.proposal.entryNodeId };
|
|
1290
|
+
if (nodeIds.some((nodeId) => graph.nodes.some((node) => node.nodeId === nodeId)))
|
|
1291
|
+
return { disposition: 'rejected', nodeId: nodeIds[0], reason: 'append node id already exists in this run' };
|
|
1292
|
+
const record = { proposal, eventId: dispatch.event.eventId, subscriberId: dispatch.subscriberId };
|
|
1293
|
+
let appendedGraph: GraphTemplateSpec;
|
|
1294
|
+
let appendNodeOrder: string[];
|
|
1295
|
+
try {
|
|
1296
|
+
appendNodeOrder = subscriptionAppendNodeOrder(proposal);
|
|
1297
|
+
appendedGraph = withSubscriptionGraphAppends(graph, [record]);
|
|
1298
|
+
}
|
|
1299
|
+
catch (error) { return { disposition: 'rejected', nodeId: nodeIds[0], reason: error instanceof Error ? error.message : String(error) }; }
|
|
1300
|
+
for (const node of proposal.nodes) {
|
|
1301
|
+
try {
|
|
1302
|
+
const inProcessHandler = requireInProcessHandler(node.recipe, node.nodeId, options.deps?.inProcessHandlers);
|
|
1303
|
+
const resolved = resolveNodeRecipe(node, recipes, catalogRoles);
|
|
1304
|
+
if (!inProcessHandler && node.kind !== 'gate' && node.kind !== 'subgraph' && node.recipe !== 'none' &&
|
|
1305
|
+
!resolved.command && !resolved.prompt && !resolved.approval)
|
|
1306
|
+
return { disposition: 'rejected', nodeId: node.nodeId, reason: `unknown command recipe for ${node.nodeId}: ${node.recipe}` };
|
|
1307
|
+
if (enforceReleaseCommandBindings)
|
|
1308
|
+
assertReleaseCommandBinding(node, resolved.command?.command, appendedGraph.terminalNodes.includes(node.nodeId));
|
|
1309
|
+
} catch (error) {
|
|
1310
|
+
return { disposition: 'rejected', nodeId: node.nodeId, reason: error instanceof Error ? error.message : String(error) };
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
state.subscriptionGraphAppends ??= [];
|
|
1314
|
+
state.subscriptionGraphAppends.push(record);
|
|
1315
|
+
graph = appendedGraph;
|
|
1316
|
+
registerGraphSubscriptionNodes(proposal.nodes);
|
|
1317
|
+
const appendedAction = { subscriberId: `${dispatch.subscriberId}/append:${proposal.entryNodeId}`,
|
|
1318
|
+
nodeId: proposal.entryNodeId, action: 'wake' as const, event: dispatch.event, returnTo: proposal.returnTo,
|
|
1319
|
+
...(proposal.failureTo === undefined ? {} : { failureTo: proposal.failureTo }),
|
|
1320
|
+
appendNodeIds: appendNodeOrder };
|
|
1321
|
+
pendingSubscriptionActions.push(appendedAction);
|
|
1322
|
+
state.pendingSubscriptionActions = [...pendingSubscriptionActions];
|
|
1323
|
+
logSubscriptionAction('queued', { ...dispatch, subscriberId: appendedAction.subscriberId,
|
|
1324
|
+
nodeId: proposal.entryNodeId, action: 'wake' });
|
|
1325
|
+
persistOwnedRun(state, eventRunOwner);
|
|
1326
|
+
try { (options.deps?.log ?? ((event, data) => debug.log('graph.runner', event, data)))('subscription-graph-appended', {
|
|
1327
|
+
graphId, runId, eventId: dispatch.event.eventId, subscriberId: dispatch.subscriberId,
|
|
1328
|
+
entryNodeId: proposal.entryNodeId, nodeIds, returnTo: proposal.returnTo, reason: proposal.reason,
|
|
1329
|
+
}); } catch { /* append is persisted; observation must not undo it */ }
|
|
1330
|
+
return { disposition: 'appended', nodeId: proposal.entryNodeId };
|
|
1331
|
+
} });
|
|
1332
|
+
};
|
|
1333
|
+
const logSubscriptionAction = (outcome: 'queued' | 'handled' | 'rejected', dispatch: Pick<GraphSubscriptionDispatch, 'event' | 'subscriberId' | 'nodeId' | 'action'>, reason?: string): void => {
|
|
1334
|
+
const action = { eventId: dispatch.event.eventId, subscriberId: dispatch.subscriberId, nodeId: dispatch.nodeId,
|
|
1335
|
+
action: dispatch.action, outcome, ...(reason === undefined ? {} : { reason }), at: new Date().toISOString() };
|
|
1336
|
+
if (subscriptionRunState) {
|
|
1337
|
+
subscriptionRunState.subscriptionActions ??= [];
|
|
1338
|
+
subscriptionRunState.subscriptionActions.push(action);
|
|
1339
|
+
}
|
|
1340
|
+
try { (options.deps?.log ?? ((event, data) => debug.log('graph.runner', event, data)))('subscription-action', action); }
|
|
1341
|
+
catch { /* observation must not change graph execution */ }
|
|
1342
|
+
};
|
|
1343
|
+
const registerGraphSubscriptionNodes = (nodes: readonly GraphNodeSpec[]): void => {
|
|
1344
|
+
if (!eventBus) return;
|
|
1345
|
+
const fresh = nodes.filter((node) => !registeredGraphSubscriptionNodes.has(node.nodeId));
|
|
1346
|
+
for (const node of fresh) {
|
|
1347
|
+
registeredGraphSubscriptionNodes.add(node.nodeId);
|
|
1348
|
+
for (const eventType of [...(node.emits ?? []), ...(node.subscribes ?? []).map((subscription) => subscription.event)])
|
|
1349
|
+
if (!eventBus.hasType(eventType)) eventBus.registerType(eventType);
|
|
1350
|
+
}
|
|
1351
|
+
const subscribing = fresh.filter((node) => (node.subscribes?.length ?? 0) > 0);
|
|
1352
|
+
if (subscribing.length > 0) graphSubscriptionDisposers.push(registerGraphSubscriptions(eventBus, subscribing,
|
|
1353
|
+
dispatchSubscription, { scope: { graphId, runId }, proposeEdge: options.deps?.proposeGraphEdge }));
|
|
1354
|
+
};
|
|
882
1355
|
try {
|
|
1356
|
+
for (const eventType of saved?.adaptiveGraphVocabulary ?? []) if (!eventBus.hasType(eventType)) eventBus.registerType(eventType);
|
|
1357
|
+
registerGraphSubscriptionNodes(graph.nodes);
|
|
1358
|
+
if (eventBus && isReleaseLoop && useReleaseGraphEventAdapters) disposeReleaseGraphEventAdapters = registerReleaseGraphEventAdapters(eventBus,
|
|
1359
|
+
{ graphId, runId, dryRun: options.resumeRunId ? saved?.dryRun === true : options.dryRun === true }, { root, ...(options.deps?.releaseStageMail ? { stageMail: options.deps.releaseStageMail } : {}),
|
|
1360
|
+
...(options.deps?.log ? { log: options.deps.log } : {}) });
|
|
883
1361
|
const startMs = (options.deps?.processStartMs ?? psProcessStartMs)(process.pid);
|
|
884
1362
|
const runnerOwner = { pid: process.pid, pidStartedAt: new Date(startMs ?? Date.now() - process.uptime() * 1_000).toISOString() };
|
|
885
1363
|
const state: GraphRunState = options.resumeRunId
|
|
@@ -889,7 +1367,12 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
889
1367
|
graphPath: resolve(path), ...(variant?.ok ? { variant: { overlayId: variant.overlay.overlayId, ...options.variant! } } : {}),
|
|
890
1368
|
...(options.input === undefined ? {} : { input: options.input }),
|
|
891
1369
|
...(options.unitContext?.entryNodeId === undefined ? {} : { entryNodeId: options.unitContext.entryNodeId }),
|
|
892
|
-
executed: 0, dryRun: options.dryRun === true, statePath };
|
|
1370
|
+
executed: 0, dryRun: options.dryRun === true, graphRevision: 1, statePath };
|
|
1371
|
+
eventRunState = state;
|
|
1372
|
+
eventRunOwner = runnerOwner;
|
|
1373
|
+
subscriptionRunState = state;
|
|
1374
|
+
state.graphRevision ??= 1;
|
|
1375
|
+
pendingSubscriptionActions.push(...(state.pendingSubscriptionActions ?? []));
|
|
893
1376
|
const branchResume = options.fromNodeId ? Object.values(state.fanOuts ?? {}).flatMap((fanout) =>
|
|
894
1377
|
fanout.branches[options.fromNodeId!] !== undefined ? [{ fanout, branchId: options.fromNodeId! }] : [])[0] : undefined;
|
|
895
1378
|
if (branchResume) {
|
|
@@ -921,6 +1404,11 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
921
1404
|
state.parentRunId = options.unitContext.parentRunId;
|
|
922
1405
|
}
|
|
923
1406
|
if (state.growth?.length) graph = withGrowth(graph, state.growth);
|
|
1407
|
+
if (state.subscriptionGraphAppends?.length) {
|
|
1408
|
+
graph = withSubscriptionGraphAppends(graph, state.subscriptionGraphAppends);
|
|
1409
|
+
registerGraphSubscriptionNodes(state.subscriptionGraphAppends.flatMap((append) => append.proposal.nodes));
|
|
1410
|
+
}
|
|
1411
|
+
if (state.adaptiveGraphEdges?.length) graph = withAdaptiveGraphEdges(graph, state.adaptiveGraphEdges, state.adaptiveGraphVocabulary ?? []);
|
|
924
1412
|
let waivedRecord: GraphRunState['nodes'][number] | undefined;
|
|
925
1413
|
if (options.fromNodeId) {
|
|
926
1414
|
if (state.status !== 'failed' || state.pending || state.dryRun) throw new Error('--from requires a failed, non-dry run without pending approval');
|
|
@@ -1121,20 +1609,78 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1121
1609
|
if (options.resumeRunId) debug.log('graph.runs', 'resume', { graphId, runId, from: state.resume?.from, graph: graphMode });
|
|
1122
1610
|
const persist = () => {
|
|
1123
1611
|
if (state.status === 'done' || state.status === 'failed' || state.status === 'budget-exceeded') state.finishedAt ??= new Date().toISOString();
|
|
1124
|
-
|
|
1612
|
+
persistEventState(state, runnerOwner);
|
|
1125
1613
|
};
|
|
1126
|
-
const emitReleaseStage = (nodeId: string, stage: ReleaseStageState): boolean => {
|
|
1614
|
+
const emitReleaseStage = async (nodeId: string, stage: ReleaseStageState): Promise<boolean> => {
|
|
1615
|
+
if (eventBus && isReleaseLoop && useReleaseGraphEventAdapters) {
|
|
1616
|
+
try {
|
|
1617
|
+
await eventBus.publish({ graphId, runId, type: 'release-stage', source: { kind: 'runner', nodeId },
|
|
1618
|
+
data: { state: stage, dryRun: state.dryRun } });
|
|
1619
|
+
await eventBus.flush({ graphId, runId });
|
|
1620
|
+
return true;
|
|
1621
|
+
} catch (error) {
|
|
1622
|
+
try { debug.log('release-loop.stage-mail', 'event-delivery-failed', { runId, nodeId, state: stage, error: String(error).slice(0, 300) }, { level: 'warn' }); }
|
|
1623
|
+
catch { /* delivery failure must not change graph execution */ }
|
|
1624
|
+
return false;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1127
1627
|
return emitReleaseStageTransition(graphId, state.dryRun, { runId, nodeId, state: stage },
|
|
1128
1628
|
options.deps?.releaseStageMail ?? ((mail) => postReleaseStageMail(mail, {
|
|
1129
1629
|
configPath: join(root, 'config.json'),
|
|
1130
1630
|
openStore: () => openMsgStore(join(root, 'msg', 'messages.db')),
|
|
1131
1631
|
})));
|
|
1132
1632
|
};
|
|
1633
|
+
const publishLifecycleEvent = async (input: Parameters<GraphEventBus['publish']>[0]): Promise<GraphEvent | undefined> => {
|
|
1634
|
+
let published: GraphEvent | undefined;
|
|
1635
|
+
try {
|
|
1636
|
+
published = await eventBus.publish(input);
|
|
1637
|
+
await eventBus.flush({ graphId, runId });
|
|
1638
|
+
} catch (error) {
|
|
1639
|
+
if (eventQueuePersistenceFailure !== undefined) {
|
|
1640
|
+
const persistenceFailure = eventQueuePersistenceFailure;
|
|
1641
|
+
eventQueuePersistenceFailure = undefined;
|
|
1642
|
+
throw persistenceFailure;
|
|
1643
|
+
}
|
|
1644
|
+
if (input.type === RELEASE_GATE_FAILED_EVENT) throw error;
|
|
1645
|
+
try { debug.log('graph.runner', 'event-delivery-failed', { graphId, runId, type: input.type,
|
|
1646
|
+
error: String(error).slice(0, 300) }, { level: 'warn' }); } catch { /* graph execution is fail-open for observers */ }
|
|
1647
|
+
}
|
|
1648
|
+
return published;
|
|
1649
|
+
};
|
|
1133
1650
|
const baseLog = options.deps?.log ?? ((event: string, data: Record<string, unknown>) => debug.log('graph.runner', event, data));
|
|
1134
1651
|
// RFC §U: every event of a unit (child) run carries its parentRunId.
|
|
1135
1652
|
const log = options.unitContext
|
|
1136
1653
|
? (event: string, data: Record<string, unknown>) => baseLog(event, { ...data, parentRunId: options.unitContext!.parentRunId })
|
|
1137
1654
|
: baseLog;
|
|
1655
|
+
const emitNodeLifecycle = async (phase: GraphNodeLifecyclePhase, nodeId: string, visit: number,
|
|
1656
|
+
extra: Pick<GraphNodeLifecycleEvent, 'outcome' | 'nextNodeId' | 'reason'> = {},
|
|
1657
|
+
details: Readonly<Record<string, unknown>> = {}): Promise<void> => {
|
|
1658
|
+
const at = new Date().toISOString();
|
|
1659
|
+
const type = phase === 'arrival' ? 'node-arrival' : phase === 'leave' ? 'node-leave' : `node-${phase}`;
|
|
1660
|
+
const graphEvent = await publishLifecycleEvent({ graphId, runId, type, source: { kind: 'node', nodeId },
|
|
1661
|
+
data: { nodeId, phase, visit, dryRun: state.dryRun, ...extra, ...details } });
|
|
1662
|
+
const sequence = graphEvent?.sequence ?? state.graphEventSequence ?? eventSequenceBase;
|
|
1663
|
+
const emittedAt = graphEvent?.emittedAt ?? at;
|
|
1664
|
+
const event: GraphNodeLifecycleEvent = { eventId: graphEvent?.eventId ?? `${graphId}:${runId}:${sequence}`, seq: sequence,
|
|
1665
|
+
kind: 'node.lifecycle', source: 'graph-runner', phase, graphId, runId, nodeId, attempt: visit, visit,
|
|
1666
|
+
dryRun: state.dryRun, at: emittedAt, ...extra,
|
|
1667
|
+
data: { phase, visit, dryRun: state.dryRun, at: emittedAt,
|
|
1668
|
+
...(extra.nextNodeId === undefined ? {} : { nextNodeId: extra.nextNodeId }),
|
|
1669
|
+
...(extra.reason === undefined ? {} : { reason: extra.reason }) } };
|
|
1670
|
+
const reportHookFailure = (error: unknown): void => {
|
|
1671
|
+
try { log('node-lifecycle-hook-failed', { graphId, runId, nodeId, visit, phase, error: String(error).slice(0, 300) }); }
|
|
1672
|
+
catch { /* lifecycle reporting must not stop graph execution */ }
|
|
1673
|
+
};
|
|
1674
|
+
const hook = options.deps?.nodeLifecycle;
|
|
1675
|
+
if (hook) {
|
|
1676
|
+
lifecycleObserverQueue = lifecycleObserverQueue.then(async () => {
|
|
1677
|
+
try { await hook(event); }
|
|
1678
|
+
catch (error) { reportHookFailure(error); }
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
try { log('node-lifecycle', { ...event }); }
|
|
1682
|
+
catch (error) { reportHookFailure(error); }
|
|
1683
|
+
};
|
|
1138
1684
|
if (rejectedGrowthScopeEnv && document.grow === 'on') {
|
|
1139
1685
|
log('growth-scope-rejected', { graphId, runId, source: 'env', reason: 'not-allowlisted' });
|
|
1140
1686
|
}
|
|
@@ -1146,7 +1692,112 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1146
1692
|
// sequence is carried on the run state so a restart continues it.
|
|
1147
1693
|
const unitVisits = new Map<string, number>(Object.entries(state.unitVisitSeq ?? {}));
|
|
1148
1694
|
const monotonicMs = options.deps?.monotonicMs ?? (() => performance.now());
|
|
1149
|
-
let
|
|
1695
|
+
let wakeContinuation: { nodeId: string; returnTo?: string; failureTo?: string; appendNodeIds?: string[] } | undefined = state.wakeContinuation;
|
|
1696
|
+
let current: string | undefined = options.fromNodeId ?? state.pending?.nodeId ?? wakeContinuation?.nodeId ?? state.path.at(-1) ?? unitEntryNode;
|
|
1697
|
+
const storedGate = [...state.nodes].reverse().find((record) => record.nodeId === 'gate' && record.output !== undefined);
|
|
1698
|
+
const storedGateOutput = lastJsonObject(storedGate?.output);
|
|
1699
|
+
const legacyGateResumeNeedsRefresh = isReleaseLoop && options.resumeRunId !== undefined && !options.fromNodeId &&
|
|
1700
|
+
(state.path.at(-1) === 'gate' || state.path.at(-1) === 'gate-triage') &&
|
|
1701
|
+
(!storedGate?.executionId || typeof storedGateOutput?.executionId !== 'string' || storedGateOutput.executionId !== storedGate.executionId);
|
|
1702
|
+
if (legacyGateResumeNeedsRefresh) {
|
|
1703
|
+
if (current === 'gate-triage') current = 'gate';
|
|
1704
|
+
if (state.resume) {
|
|
1705
|
+
state.resume = { ...state.resume, from: 'gate' };
|
|
1706
|
+
persist();
|
|
1707
|
+
}
|
|
1708
|
+
debug.log('graph.runs', 'legacy-gate-execution-identity-refresh', { graphId, runId, from: state.path.at(-1) });
|
|
1709
|
+
}
|
|
1710
|
+
const appendAdaptiveGateNode = async (request: AdaptiveGateHealAppendNodeRequest): Promise<AdaptiveGateHealAppendNodeReceipt> => {
|
|
1711
|
+
const regressionRepair = request.node.recipe === 'cmd:gate-repair' && /^gate-repair-[a-f0-9]{12}$/.test(request.node.nodeId);
|
|
1712
|
+
const imageRepair = request.node.recipe === 'cmd:gate-image-repair' && /^gate-image-repair-[a-f0-9]{12}$/.test(request.node.nodeId);
|
|
1713
|
+
if (!isReleaseLoop || state.dryRun || request.graphId !== graphId || request.runId !== runId ||
|
|
1714
|
+
request.afterNodeId !== 'gate-triage' || request.resumeFrom !== request.node.nodeId || request.rerunGateAt !== 'gate' ||
|
|
1715
|
+
request.maxRepairRetries !== 1 || request.visitLimits.gate !== 2 || request.visitLimits.gateTriage !== 2 ||
|
|
1716
|
+
request.node.kind !== 'agent' || request.node.maxVisits !== 1 || !(regressionRepair || imageRepair)) {
|
|
1717
|
+
throw new Error('adaptive gate append request is outside the release ARG contract');
|
|
1718
|
+
}
|
|
1719
|
+
const prior = (state.adaptiveGateNodeAppends ?? []).find((append) => append.eventId === request.eventId);
|
|
1720
|
+
if (prior) {
|
|
1721
|
+
if (JSON.stringify(prior.request) !== JSON.stringify(request))
|
|
1722
|
+
throw new Error(`adaptive gate append identity conflict: ${graphId}/${runId}/${request.eventId}`);
|
|
1723
|
+
return { disposition: 'already-appended', graphRevision: prior.graphRevision };
|
|
1724
|
+
}
|
|
1725
|
+
const event = (state.pendingGraphEvents ?? []).find((pending) => pending.eventId === request.eventId);
|
|
1726
|
+
const data = event?.data;
|
|
1727
|
+
const gate = data?.gate;
|
|
1728
|
+
const triage = data?.triage;
|
|
1729
|
+
const input = request.node.input;
|
|
1730
|
+
if (!event || event.graphId !== graphId || event.runId !== runId || event.type !== RELEASE_GATE_FAILED_EVENT ||
|
|
1731
|
+
event.source.kind !== 'node' || event.source.nodeId !== 'gate-triage' || data?.dryRun === true ||
|
|
1732
|
+
current !== 'gate-triage' || state.path.at(-1) !== 'gate-triage' || state.nodes.at(-1)?.nodeId !== 'gate-triage' ||
|
|
1733
|
+
state.nodes.at(-1)?.executed !== true || !gate || typeof gate !== 'object' || !triage || typeof triage !== 'object' ||
|
|
1734
|
+
!input || typeof input !== 'object' || Array.isArray(input)) {
|
|
1735
|
+
throw new Error('adaptive gate append event is not the active completed gate-triage event');
|
|
1736
|
+
}
|
|
1737
|
+
const nodeInput = input as Record<string, unknown>;
|
|
1738
|
+
const gateRecord = gate as Record<string, unknown>;
|
|
1739
|
+
const triageRecord = triage as Record<string, unknown>;
|
|
1740
|
+
const actualVisits = { gate: visits.get('gate') ?? 0, gateTriage: visits.get('gate-triage') ?? 0 };
|
|
1741
|
+
const attributedFailureIds = nodeInput.failureIds;
|
|
1742
|
+
const triagedIntroduced = triageRecord.introduced;
|
|
1743
|
+
const commonPlanValid = Array.isArray(triageRecord.introduced) &&
|
|
1744
|
+
request.visitState.gate === actualVisits.gate && request.visitState.gateTriage === actualVisits.gateTriage &&
|
|
1745
|
+
actualVisits.gate >= 1 && actualVisits.gate < request.visitLimits.gate &&
|
|
1746
|
+
actualVisits.gateTriage >= 1 && actualVisits.gateTriage < request.visitLimits.gateTriage &&
|
|
1747
|
+
nodeInput.version === data?.version && nodeInput.runId === runId && nodeInput.commit === triageRecord.commit;
|
|
1748
|
+
const attributedRepairValid = regressionRepair && commonPlanValid && Array.isArray(attributedFailureIds)
|
|
1749
|
+
&& Array.isArray(triagedIntroduced)
|
|
1750
|
+
&& JSON.stringify([...attributedFailureIds].sort()) === JSON.stringify([...triagedIntroduced].sort());
|
|
1751
|
+
const releaseInput = state.input as Record<string, unknown>;
|
|
1752
|
+
const gateError = typeof gateRecord.error === 'string' ? gateRecord.error : '';
|
|
1753
|
+
const imageFailureCode = nodeInput.failureCode;
|
|
1754
|
+
const imageRepairValid = imageRepair && commonPlanValid && gateRecord.outcome === 'error' &&
|
|
1755
|
+
(imageFailureCode === 'pod-gate-missing-cut-image-pin' || imageFailureCode === 'pod-gate-missing-run-scope') &&
|
|
1756
|
+
gateError.includes(imageFailureCode) &&
|
|
1757
|
+
triageRecord.classification === 'unmeasured' &&
|
|
1758
|
+
Array.isArray(triageRecord.introduced) && triageRecord.introduced.length === 0 &&
|
|
1759
|
+
typeof nodeInput.pool === 'string' && nodeInput.pool.trim() !== '' && nodeInput.pool === releaseInput.gatePodPool &&
|
|
1760
|
+
releaseInput.gateExecutor !== 'host';
|
|
1761
|
+
if (!commonPlanValid || !(attributedRepairValid || imageRepairValid)) {
|
|
1762
|
+
throw new Error('adaptive gate append plan differs from the active release evidence or visit budget');
|
|
1763
|
+
}
|
|
1764
|
+
if (graph.nodes.some((node) => node.nodeId === request.node.nodeId))
|
|
1765
|
+
throw new Error(`adaptive gate repair node id already exists: ${request.node.nodeId}`);
|
|
1766
|
+
const proposal: GraphSubgraphAppendProposal = {
|
|
1767
|
+
nodes: [request.node],
|
|
1768
|
+
edges: [{ from: request.node.nodeId, on: 'outcome', map: { ok: request.rerunGateAt, fail: 'failed', error: 'failed' } }],
|
|
1769
|
+
entryNodeId: request.resumeFrom,
|
|
1770
|
+
returnTo: request.rerunGateAt,
|
|
1771
|
+
failureTo: 'failed',
|
|
1772
|
+
reason: `ARG repair for ${request.eventId}`,
|
|
1773
|
+
};
|
|
1774
|
+
const appendRecord = { proposal, eventId: request.eventId, subscriberId: 'arg-adaptive-gate-heal' };
|
|
1775
|
+
const appendedGraph = withSubscriptionGraphAppends(graph, [appendRecord]);
|
|
1776
|
+
const resolved = resolveNodeRecipe(request.node, recipes, catalogRoles);
|
|
1777
|
+
if (!resolved.command?.command) throw new Error(`adaptive repair command is not configured: ${request.node.recipe}`);
|
|
1778
|
+
assertReleaseCommandBinding(request.node, resolved.command.command, false);
|
|
1779
|
+
const graphRevision = (state.graphRevision ?? 1) + 1;
|
|
1780
|
+
const action: QueuedSubscriptionAction = { subscriberId: appendRecord.subscriberId, nodeId: request.resumeFrom,
|
|
1781
|
+
action: 'wake', event, returnTo: request.rerunGateAt, failureTo: 'failed', appendNodeIds: [request.node.nodeId] };
|
|
1782
|
+
state.adaptiveGateNodeAppends ??= [];
|
|
1783
|
+
const priorGate = [...state.nodes].reverse().find((record) => record.nodeId === 'gate' && record.output !== undefined);
|
|
1784
|
+
if (!priorGate) throw new Error('adaptive gate repair cannot invalidate a missing prior gate result');
|
|
1785
|
+
priorGate.output = undefined;
|
|
1786
|
+
priorGate.invalidatedByEvent = request.eventId;
|
|
1787
|
+
state.adaptiveGateNodeAppends.push({ eventId: request.eventId, request, graphRevision });
|
|
1788
|
+
state.subscriptionGraphAppends ??= [];
|
|
1789
|
+
state.subscriptionGraphAppends.push(appendRecord);
|
|
1790
|
+
state.graphRevision = graphRevision;
|
|
1791
|
+
graph = appendedGraph;
|
|
1792
|
+
registerGraphSubscriptionNodes([request.node]);
|
|
1793
|
+
pendingSubscriptionActions.push(action);
|
|
1794
|
+
state.pendingSubscriptionActions = [...pendingSubscriptionActions];
|
|
1795
|
+
logSubscriptionAction('queued', { event, subscriberId: action.subscriberId, nodeId: action.nodeId, action: 'wake' });
|
|
1796
|
+
persistOwnedRun(state, eventRunOwner!);
|
|
1797
|
+
return { disposition: 'appended', graphRevision };
|
|
1798
|
+
};
|
|
1799
|
+
if (eventBus && isReleaseLoop) disposeAdaptiveGateHealAdapter = registerAdaptiveGateHealAdapter(eventBus,
|
|
1800
|
+
{ graphId, runId, dryRun: state.dryRun }, { appendNode: appendAdaptiveGateNode });
|
|
1150
1801
|
let growthScopeSkipLogged = false;
|
|
1151
1802
|
let growthCapReachedLogged = state.growthRejections?.some((item) =>
|
|
1152
1803
|
item.reason === 'growth proposal limit 8 reached' || item.reason === 'growth limit 3 reached') ?? false;
|
|
@@ -1164,6 +1815,27 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1164
1815
|
writeFileSync(join(`${statePath}.graph`, 'graph.yaml'), variantSource, { flag: 'wx' });
|
|
1165
1816
|
writeFileSync(join(`${statePath}.graph`, 'recipes.yaml'), recipeSource, { flag: 'wx' });
|
|
1166
1817
|
}
|
|
1818
|
+
if (eventBus && (state.pendingGraphEvents?.length ?? 0) > 0) {
|
|
1819
|
+
for (const pendingEvent of [...state.pendingGraphEvents!]) {
|
|
1820
|
+
try {
|
|
1821
|
+
await eventBus.publish(pendingEvent);
|
|
1822
|
+
await eventBus.flush({ graphId, runId });
|
|
1823
|
+
} catch (error) {
|
|
1824
|
+
log('event-replay-pending', { graphId, runId, eventId: pendingEvent.eventId,
|
|
1825
|
+
error: error instanceof Error ? error.message : String(error) });
|
|
1826
|
+
state.status = 'failed';
|
|
1827
|
+
state.reason = 'graph-event-delivery-pending';
|
|
1828
|
+
persist();
|
|
1829
|
+
disposeGraphSubscriptions();
|
|
1830
|
+
disposeReleaseGraphEventAdapters();
|
|
1831
|
+
disposeAdaptiveGateHealAdapter();
|
|
1832
|
+
if (options.resumeRunId && existsSync(resumeLock)) rmdirSync(resumeLock);
|
|
1833
|
+
return state;
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
let activeLifecycleNode: { nodeId: string; visit: number } | undefined;
|
|
1838
|
+
try {
|
|
1167
1839
|
while (current !== undefined) {
|
|
1168
1840
|
if (options.signal?.aborted) {
|
|
1169
1841
|
state.status = 'failed';
|
|
@@ -1176,8 +1848,22 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1176
1848
|
if (!node) throw new Error(`undeclared node: ${current}`);
|
|
1177
1849
|
const resumingPending = state.pending?.nodeId === current;
|
|
1178
1850
|
const completed = state.nodes.at(-1);
|
|
1179
|
-
const
|
|
1851
|
+
const nodeCompletionInputSha256 = stableSha256({ graphId, nodeId: current, input: state.input ?? null,
|
|
1852
|
+
nodeInput: Object.hasOwn(node, 'input') ? node.input : null,
|
|
1853
|
+
outputs: state.nodes.map((record) => [record.nodeId, record.output ?? null]), sourceHash: state.sourceHash ?? null });
|
|
1854
|
+
const resumingCompleted = options.resumeRunId !== undefined && !options.fromNodeId &&
|
|
1855
|
+
!(legacyGateResumeNeedsRefresh && current === 'gate') && completed?.nodeId === current &&
|
|
1180
1856
|
state.path.at(-1) === current && !resumingPending;
|
|
1857
|
+
const emitVisitLifecycle = async (phase: GraphNodeLifecyclePhase, nodeId: string, visit: number,
|
|
1858
|
+
extra: Pick<GraphNodeLifecycleEvent, 'outcome' | 'nextNodeId' | 'reason'> = {},
|
|
1859
|
+
details: Readonly<Record<string, unknown>> = {}): Promise<void> => {
|
|
1860
|
+
if (resumingCompleted) return;
|
|
1861
|
+
if (phase === 'arrival') activeLifecycleNode = { nodeId, visit };
|
|
1862
|
+
await emitNodeLifecycle(phase, nodeId, visit, extra, details);
|
|
1863
|
+
if (phase === 'leave' && activeLifecycleNode?.nodeId === nodeId && activeLifecycleNode.visit === visit) activeLifecycleNode = undefined;
|
|
1864
|
+
};
|
|
1865
|
+
const executionId = randomUUID();
|
|
1866
|
+
const visit = (visits.get(current) ?? 0) + (resumingPending || resumingCompleted ? 0 : 1);
|
|
1181
1867
|
const usedSteps = state.path.length + (state.unitCalls ?? []).reduce((sum, call) => sum + call.steps, 0);
|
|
1182
1868
|
const effectiveRemaining = Math.min(
|
|
1183
1869
|
graph.allowance ? graph.allowance.innerSteps - usedSteps : Infinity,
|
|
@@ -1185,6 +1871,8 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1185
1871
|
);
|
|
1186
1872
|
if (!resumingPending && !resumingCompleted && ((visits.get(current) ?? 0) >= node.maxVisits ||
|
|
1187
1873
|
(effectiveRemaining <= 0 && !graph.terminalNodes.includes(current)))) {
|
|
1874
|
+
await emitVisitLifecycle('arrival', current, visit, { reason: 'budget-exceeded' });
|
|
1875
|
+
await emitVisitLifecycle('leave', current, visit, { reason: 'budget-exceeded' });
|
|
1188
1876
|
state.status = 'budget-exceeded';
|
|
1189
1877
|
log('budget-exceeded', { graphId, runId, nodeId: current });
|
|
1190
1878
|
persist();
|
|
@@ -1194,9 +1882,17 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1194
1882
|
visits.set(current, (visits.get(current) ?? 0) + 1);
|
|
1195
1883
|
state.path.push(current);
|
|
1196
1884
|
}
|
|
1197
|
-
|
|
1885
|
+
await emitVisitLifecycle('arrival', current, visit);
|
|
1886
|
+
let resolved: ReturnType<typeof resolveNodeRecipe>;
|
|
1887
|
+
try {
|
|
1888
|
+
resolved = resolveNodeRecipe(node, recipes, catalogRoles);
|
|
1889
|
+
if (enforceReleaseCommandBindings) assertReleaseCommandBinding(node, resolved.command?.command, graph.terminalNodes.includes(current));
|
|
1890
|
+
options.deps?.validateNodeBinding?.(node.nodeId, resolved.command?.command);
|
|
1891
|
+
} catch (error) {
|
|
1892
|
+
await emitVisitLifecycle('leave', current, visit, { reason: 'pre-dispatch-validation-failed' });
|
|
1893
|
+
throw error;
|
|
1894
|
+
}
|
|
1198
1895
|
const command = resolved.command;
|
|
1199
|
-
if (enforceReleaseCommandBindings) assertReleaseCommandBinding(node, command?.command, graph.terminalNodes.includes(current));
|
|
1200
1896
|
const prompt = resolved.prompt;
|
|
1201
1897
|
const approval = resolved.approval ? { approval: approvalMessage(resolved.approval.approval, state.input) } : undefined;
|
|
1202
1898
|
if (resumingPending && (!approval || approval.approval !== state.pending?.message)) {
|
|
@@ -1212,24 +1908,26 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1212
1908
|
if (!state.dryRun && !state.pending.notifiedAt) {
|
|
1213
1909
|
try {
|
|
1214
1910
|
log('approval-pending', { graphId, runId, nodeId: current, message: state.pending.message, since: state.pending.since });
|
|
1215
|
-
if (emitReleaseStage(current, 'wait')) state.pending = { ...state.pending, notifiedAt: new Date().toISOString() };
|
|
1911
|
+
if (await emitReleaseStage(current, 'wait')) state.pending = { ...state.pending, notifiedAt: new Date().toISOString() };
|
|
1216
1912
|
} catch (error) {
|
|
1217
1913
|
persist();
|
|
1218
1914
|
throw error;
|
|
1219
1915
|
}
|
|
1220
1916
|
}
|
|
1221
1917
|
persist();
|
|
1918
|
+
await emitVisitLifecycle('leave', current, visit, { reason: 'awaiting-approval' });
|
|
1222
1919
|
break;
|
|
1223
1920
|
}
|
|
1224
1921
|
state.status = 'running';
|
|
1225
1922
|
const startedAt = performance.now();
|
|
1226
1923
|
const nodeStartedAt = new Date().toISOString();
|
|
1227
|
-
if (!resumingCompleted) state.currentNode = { nodeId: current, startedAt: nodeStartedAt };
|
|
1924
|
+
if (!resumingCompleted) state.currentNode = { nodeId: current, executionId, startedAt: nodeStartedAt };
|
|
1925
|
+
await emitVisitLifecycle('start', current, visit);
|
|
1228
1926
|
if (!options.quiet) console.error(`[graph] ${current} start (0.00s)`);
|
|
1229
1927
|
debug.log('graph.run', 'node', { graphId, runId, nodeId: current, phase: 'start', dryRun: state.dryRun });
|
|
1230
1928
|
publishInsideEvent({ kind: 'node', graphId, runId, nodeId: current, phase: 'start' });
|
|
1231
1929
|
log('node-start', { graphId, runId, nodeId: current, visit: visits.get(current), dryRun: state.dryRun });
|
|
1232
|
-
emitReleaseStage(current, 'start');
|
|
1930
|
+
await emitReleaseStage(current, 'start');
|
|
1233
1931
|
persist();
|
|
1234
1932
|
const joinedFanout = Object.values(state.fanOuts ?? {}).find((fanout) => fanout.join === current &&
|
|
1235
1933
|
Object.values(fanout.branches).every((branch) => branch.status === 'done' || branch.status === 'failed'));
|
|
@@ -1246,6 +1944,7 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1246
1944
|
const inProcessHandler = requireInProcessHandler(node.recipe, current, options.deps?.inProcessHandlers);
|
|
1247
1945
|
let handlerExecuted = false;
|
|
1248
1946
|
if (inProcessHandler && !waiving && !state.dryRun && !resumingCompleted) {
|
|
1947
|
+
const eventNodeId = node.nodeId;
|
|
1249
1948
|
const outputs: Record<string, unknown> = Object.assign(Object.create(null), options.branchParentOutputs ?? {});
|
|
1250
1949
|
for (const previous of state.nodes) outputs[previous.nodeId] = lastJsonObject(previous.output) ?? previous.output ?? null;
|
|
1251
1950
|
for (const fanout of Object.values(state.fanOuts ?? {})) for (const [branchId, branch] of Object.entries(fanout.branches))
|
|
@@ -1253,7 +1952,11 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1253
1952
|
handlerExecuted = true;
|
|
1254
1953
|
debug.log('graph.run', 'handler-dispatch', { graphId, runId, nodeId: current, recipe: node.recipe });
|
|
1255
1954
|
try {
|
|
1256
|
-
const result = await inProcessHandler({ graphId, runId, nodeId: current, input: state.input ?? null,
|
|
1955
|
+
const result = await inProcessHandler({ graphId, runId, nodeId: current, input: state.input ?? null,
|
|
1956
|
+
...(Object.hasOwn(node, 'input') ? { nodeInput: node.input } : {}), outputs,
|
|
1957
|
+
...(eventBus === undefined ? {} : { emitEvent: (type, data) => publishNodeGraphEvent(eventBus,
|
|
1958
|
+
{ graphId, runId, type, source: { kind: 'node', nodeId: eventNodeId }, ...(data === undefined ? {} : { data }) }, node.emits ?? []) }) });
|
|
1959
|
+
await eventBus?.flush({ graphId, runId });
|
|
1257
1960
|
if (!result || typeof result.ok !== 'boolean' || typeof result.outcome !== 'string' || !result.outcome.trim())
|
|
1258
1961
|
throw new Error(`invalid in-process handler result: ${current}`);
|
|
1259
1962
|
output = JSON.stringify({ ...(result.evidence === undefined ? {} : { evidence: result.evidence }), outcome: result.outcome });
|
|
@@ -1278,7 +1981,19 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1278
1981
|
if (branch.output !== undefined) outputs[branchId] = lastJsonObject(branch.output) ?? branch.output;
|
|
1279
1982
|
const contextPath = join(`${statePath}.contexts`, `${state.path.length}.json`);
|
|
1280
1983
|
mkdirSync(dirname(contextPath), { recursive: true });
|
|
1281
|
-
|
|
1984
|
+
const latestGate = current === 'gate-triage' ? [...state.nodes].reverse().find((record) => record.nodeId === 'gate' && record.output !== undefined) : undefined;
|
|
1985
|
+
const latestGateOutput = latestGate ? lastJsonObject(latestGate.output) : undefined;
|
|
1986
|
+
const latestGateOutputExecutionId = latestGateOutput?.executionId;
|
|
1987
|
+
if (isReleaseLoop && latestGate && latestGateOutputExecutionId !== latestGate.executionId) {
|
|
1988
|
+
throw new Error('latest gate output execution id does not match its recorded execution');
|
|
1989
|
+
}
|
|
1990
|
+
const nodeRunInput = isReleaseLoop && current === 'gate-triage' && state.input && typeof state.input === 'object' && !Array.isArray(state.input)
|
|
1991
|
+
? { ...(state.input as Record<string, unknown>), adaptiveHealVisitState: {
|
|
1992
|
+
gate: visits.get('gate') ?? 0, gateTriage: visits.get('gate-triage') ?? 0,
|
|
1993
|
+
}, ...(typeof latestGateOutputExecutionId === 'string' ? { adaptiveGateExecutionId: latestGateOutputExecutionId } : {}) }
|
|
1994
|
+
: state.input ?? null;
|
|
1995
|
+
writeFileSync(contextPath, JSON.stringify({ graphId, runId, startedAt: state.startedAt, executionId, nodeId: current,
|
|
1996
|
+
input: nodeRunInput, ...(Object.hasOwn(node, 'input') ? { nodeInput: node.input } : {}), outputs }, null, 2) + '\n');
|
|
1282
1997
|
let code: number | null = null;
|
|
1283
1998
|
const runBash: BashRun = async (body, opts) => {
|
|
1284
1999
|
const commandRoot = verifyReleaseSource();
|
|
@@ -1299,13 +2014,57 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1299
2014
|
persist();
|
|
1300
2015
|
return true;
|
|
1301
2016
|
});
|
|
2017
|
+
const gateProgressPath = isReleaseLoop && current === 'gate' ? `${contextPath}.gate-progress.jsonl` : undefined;
|
|
2018
|
+
const childOpts = commandRoot ? { ...opts, cwd: commandRoot } : { ...opts };
|
|
2019
|
+
if (gateProgressPath) {
|
|
2020
|
+
childOpts.env = { ...process.env, ...childOpts.env, ELANOUS_GATE_PROGRESS_FILE: gateProgressPath };
|
|
2021
|
+
}
|
|
2022
|
+
let readingProgress = gateProgressPath !== undefined;
|
|
2023
|
+
let progressOffset = 0;
|
|
2024
|
+
let progressRemainder = Buffer.alloc(0);
|
|
2025
|
+
const pumpGateProgress = async (): Promise<void> => {
|
|
2026
|
+
if (!gateProgressPath) return;
|
|
2027
|
+
try {
|
|
2028
|
+
if (!existsSync(gateProgressPath)) return;
|
|
2029
|
+
const size = statSync(gateProgressPath).size;
|
|
2030
|
+
if (size < progressOffset) { progressOffset = 0; progressRemainder = Buffer.alloc(0); }
|
|
2031
|
+
if (size === progressOffset) return;
|
|
2032
|
+
const fd = openSync(gateProgressPath, 'r');
|
|
2033
|
+
const bytes = Buffer.alloc(size - progressOffset);
|
|
2034
|
+
let bytesRead: number;
|
|
2035
|
+
try { bytesRead = readSync(fd, bytes, 0, bytes.length, progressOffset); }
|
|
2036
|
+
finally { closeSync(fd); }
|
|
2037
|
+
progressOffset += bytesRead;
|
|
2038
|
+
const complete = Buffer.concat([progressRemainder, bytes.subarray(0, bytesRead)]);
|
|
2039
|
+
const lastNewline = complete.lastIndexOf(0x0a);
|
|
2040
|
+
if (lastNewline < 0) { progressRemainder = complete; return; }
|
|
2041
|
+
progressRemainder = complete.subarray(lastNewline + 1);
|
|
2042
|
+
for (const line of complete.subarray(0, lastNewline).toString('utf8').split('\n')) {
|
|
2043
|
+
if (!line.trim()) continue;
|
|
2044
|
+
let data: Record<string, unknown>;
|
|
2045
|
+
try { data = JSON.parse(line) as Record<string, unknown>; } catch { continue; }
|
|
2046
|
+
const phase = typeof data.phase === 'string' ? data.phase : 'progress';
|
|
2047
|
+
try {
|
|
2048
|
+
await eventBus.publish({ graphId, runId, type: 'release.gate.progress', source: { kind: 'node', nodeId: current! }, data });
|
|
2049
|
+
} catch (error) { debug.log('graph.event', 'release-gate-progress-delivery-failed', { graphId, runId, phase, error: String(error) }, { level: 'warn' }); }
|
|
2050
|
+
}
|
|
2051
|
+
} catch (error) { debug.log('graph.event', 'release-gate-progress-read-failed', { graphId, runId, error: String(error) }, { level: 'warn' }); }
|
|
2052
|
+
};
|
|
2053
|
+
const progressPump = (async () => {
|
|
2054
|
+
while (readingProgress) { await pumpGateProgress(); await new Promise((resolve) => setTimeout(resolve, 100)); }
|
|
2055
|
+
await pumpGateProgress();
|
|
2056
|
+
})();
|
|
1302
2057
|
try {
|
|
1303
|
-
const result = await execute(body,
|
|
2058
|
+
const result = await execute(body, childOpts);
|
|
2059
|
+
readingProgress = false;
|
|
2060
|
+
await progressPump;
|
|
1304
2061
|
code = result.exitCode;
|
|
1305
2062
|
const stderr = redactCredentials(result.stderr);
|
|
1306
2063
|
commandFailureReason = failedCommandStderrTail(result.exitCode, stderr);
|
|
1307
2064
|
return { ...result, stdout: redactCredentials(result.stdout), stderr };
|
|
1308
2065
|
} finally {
|
|
2066
|
+
readingProgress = false;
|
|
2067
|
+
await progressPump;
|
|
1309
2068
|
if (state.activeNode?.nodeId === current) {
|
|
1310
2069
|
delete state.activeNode;
|
|
1311
2070
|
persist();
|
|
@@ -1336,6 +2095,15 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1336
2095
|
const result = await executeBashNode({ id: current, type: 'bash', bash: state.dryRun ? command.dry_run_command! : command.command,
|
|
1337
2096
|
idle_timeout: command.timeout_ms ?? DEFAULT_BASH_TIMEOUT_MS } as BashNode, ctx, { runBash } as WorkflowDeps);
|
|
1338
2097
|
output = result.output;
|
|
2098
|
+
if (isReleaseLoop && current === 'gate' && typeof output === 'string') {
|
|
2099
|
+
const gateOutput = lastJsonObject(output);
|
|
2100
|
+
if (gateOutput) {
|
|
2101
|
+
if (gateOutput.executionId !== undefined && gateOutput.executionId !== executionId) {
|
|
2102
|
+
throw new Error('gate output execution id does not match the current gate execution');
|
|
2103
|
+
}
|
|
2104
|
+
output = JSON.stringify({ ...gateOutput, executionId });
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
1339
2107
|
ok = result.ok;
|
|
1340
2108
|
exit = code;
|
|
1341
2109
|
error = result.error ? redactCredentials(result.error) : undefined;
|
|
@@ -1406,6 +2174,7 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1406
2174
|
}
|
|
1407
2175
|
entered = true;
|
|
1408
2176
|
const child = await runGraph(unit.path, { runId: childRunId, input: inputs, dryRun: false,
|
|
2177
|
+
...(baseEventBus === undefined ? {} : { eventBus: baseEventBus }),
|
|
1409
2178
|
...(options.signal ? { signal: options.signal } : {}),
|
|
1410
2179
|
pinChildUniverse: options.pinChildUniverse,
|
|
1411
2180
|
unitContext: { parentRunId: runId, ancestors: [...(options.unitContext?.ancestors ?? []), graphId],
|
|
@@ -1549,7 +2318,16 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1549
2318
|
message: failureMessage,
|
|
1550
2319
|
stage: units.has(current) ? 'unit-invocation' : command ? 'command-execution' : prompt ? 'prompt-execution' : 'node-execution',
|
|
1551
2320
|
};
|
|
1552
|
-
|
|
2321
|
+
const hasOutput = waiving || harnessLoopRoute || units.has(current) || handlerExecuted ||
|
|
2322
|
+
((command || prompt || approval || node.kind === 'classify') && (!state.dryRun || !!command?.dry_run_command));
|
|
2323
|
+
const storedOutput = hasOutput ? output : undefined;
|
|
2324
|
+
const rawReceiptCommit = current === 'version-release' ? lastJsonObject(output)?.commit : completionCommit(state) ?? options.branchCutTip;
|
|
2325
|
+
const receiptCommit = typeof rawReceiptCommit === 'string' && /^[a-f0-9]{40}$/i.test(rawReceiptCommit) ? rawReceiptCommit : undefined;
|
|
2326
|
+
const artifactSnapshot = completionArtifactSnapshot(storedOutput ?? null, options.deps?.root ?? process.cwd());
|
|
2327
|
+
const completionReceipt = ok && receiptCommit !== undefined && artifactSnapshot.valid
|
|
2328
|
+
? { inputSha256: nodeCompletionInputSha256, commit: receiptCommit, artifactSha256: artifactSnapshot.sha256 }
|
|
2329
|
+
: undefined;
|
|
2330
|
+
state.nodes.push({ nodeId: current, executionId, ok, exit, executed: !waiving && (handlerExecuted || (!!command && (!state.dryRun || !!command.dry_run_command)) || (!!prompt && !state.dryRun) || (node.kind === 'classify' && !state.dryRun) || unitExecuted), ...(storedOutput === undefined ? {} : { output: storedOutput }), ...(completionReceipt === undefined ? {} : { completionReceipt }), ...(error ? { error } : {}),
|
|
1553
2331
|
...(failure ? { reason: failure.message, failure } : {}), ...(commandFailureReason && !failure ? { reason: commandFailureReason } : {}),
|
|
1554
2332
|
...(waiving ? { waiver: { reason: options.releaseWaiver!.reason, at: nodeEndedAt, ...(options.releaseWaiver!.approvedBy === undefined ? {} : { approvedBy: options.releaseWaiver!.approvedBy }), ...(options.releaseWaiver!.ownerWaived ? { ownerWaived: true } : {}), ...(options.releaseWaiver!.introducedIds === undefined ? {} : { introducedIds: options.releaseWaiver!.introducedIds }), ...(options.releaseWaiver!.unmeasured === undefined ? {} : { unmeasured: options.releaseWaiver!.unmeasured }), original: { exit: waivedRecord!.exit, ...(waivedRecord!.output === undefined ? {} : { output: waivedRecord!.output }), ...(waivedRecord!.error === undefined ? {} : { error: waivedRecord!.error }) } } } : {}),
|
|
1555
2333
|
...(approval && state.pending ? { ...(state.pending.decidedBy === undefined ? {} : { decidedBy: state.pending.decidedBy }), decidedAt: state.pending.decidedAt } : {}),
|
|
@@ -1558,10 +2336,10 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1558
2336
|
const completedRecord = [...state.nodes].reverse().find(record => record.nodeId === current);
|
|
1559
2337
|
if (isReleaseLoop && graph.terminalNodes.includes(current) && node.recipe === 'none' &&
|
|
1560
2338
|
(exit !== null || output !== undefined || error !== undefined || completedRecord?.executed)) {
|
|
1561
|
-
emitReleaseStage(current, 'fail');
|
|
2339
|
+
await emitReleaseStage(current, 'fail');
|
|
1562
2340
|
throw new Error(`release terminal received command output: ${current}`);
|
|
1563
2341
|
}
|
|
1564
|
-
emitReleaseStage(current, !ok ? 'fail' : (waiving || approval || joinedFanout || graph.terminalNodes.includes(current) || completedRecord?.executed) ? 'ok' : 'skip');
|
|
2342
|
+
await emitReleaseStage(current, !ok ? 'fail' : (waiving || approval || joinedFanout || graph.terminalNodes.includes(current) || completedRecord?.executed) ? 'ok' : 'skip');
|
|
1565
2343
|
if (approval) {
|
|
1566
2344
|
delete state.pending;
|
|
1567
2345
|
delete state.approvalSourceHash;
|
|
@@ -1578,12 +2356,44 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1578
2356
|
log('node-end', { graphId, runId, nodeId: current, ok, exit,
|
|
1579
2357
|
...(nodeReason ? { reason: nodeReason } : {}), ...(nodeFailure ? { failure: nodeFailure } : {}),
|
|
1580
2358
|
...(namedOutcome === undefined ? {} : { outcome: namedOutcome }), dryRun: state.dryRun });
|
|
2359
|
+
await emitVisitLifecycle('end', current, visit, { outcome: ok ? 'ok' : 'fail', ...(nodeReason ? { reason: nodeReason } : {}) },
|
|
2360
|
+
{ nodeId: current, ok, exit, ...(nodeReason === undefined ? {} : { reason: nodeReason }),
|
|
2361
|
+
...(namedOutcome === undefined ? {} : { outcome: namedOutcome }), dryRun: state.dryRun });
|
|
1581
2362
|
if (!resumingCompleted) {
|
|
1582
2363
|
// Recipe commands expose stdout/exit but no provider usage; never infer zero from success.
|
|
1583
2364
|
observeModelInputTokens({ scope: 'harness-node', nodeKind: node.kind, runId, nodeId: current });
|
|
1584
2365
|
}
|
|
2366
|
+
let releaseGateFailedEvent: GraphEvent | undefined;
|
|
2367
|
+
const triageOutput = lastJsonObject(completedRecord?.output);
|
|
2368
|
+
if (isReleaseLoop && current === 'gate-triage' && !state.dryRun && !resumingCompleted &&
|
|
2369
|
+
hasActionableGateTriageEvidence(triageOutput)) {
|
|
2370
|
+
const gateRecord = [...state.nodes].reverse().find((record) => record.nodeId === 'gate' && record.output !== undefined);
|
|
2371
|
+
const gateOutput = lastJsonObject(gateRecord?.output);
|
|
2372
|
+
if (!gateOutput || !triageOutput || typeof state.input !== 'object' || state.input === null || Array.isArray(state.input))
|
|
2373
|
+
throw new Error('release.gate.failed cannot be emitted without gate, triage, and release input evidence');
|
|
2374
|
+
if (!gateRecord?.executionId || gateOutput.executionId !== gateRecord.executionId || triageOutput.gateExecutionId !== gateRecord.executionId)
|
|
2375
|
+
throw new Error('release.gate.failed requires triage evidence from the latest gate execution id');
|
|
2376
|
+
const releaseInput = state.input as Record<string, unknown>;
|
|
2377
|
+
const sourceOutcome = gateOutput.outcome;
|
|
2378
|
+
const normalizedGate = { ...gateOutput, outcome: sourceOutcome === 'fail' ? 'regression' : sourceOutcome };
|
|
2379
|
+
releaseGateFailedEvent = eventBus.prepare({ graphId, runId, type: RELEASE_GATE_FAILED_EVENT,
|
|
2380
|
+
source: { kind: 'node', nodeId: 'gate-triage' },
|
|
2381
|
+
data: { version: releaseInput.version, gate: normalizedGate, triage: triageOutput,
|
|
2382
|
+
...(sourceOutcome === 'ok' || sourceOutcome === 'regression' || sourceOutcome === 'error' || sourceOutcome === 'fail'
|
|
2383
|
+
? { sourceOutcome } : {}),
|
|
2384
|
+
...(releaseInput.gateExecutor === 'host' || releaseInput.gateExecutor === 'pod' ? { gateExecutor: releaseInput.gateExecutor } : {}),
|
|
2385
|
+
...(typeof releaseInput.gatePodPool === 'string' ? { gatePodPool: releaseInput.gatePodPool } : {}),
|
|
2386
|
+
visitState: { gate: visits.get('gate') ?? 0, gateTriage: visits.get('gate-triage') ?? 0 },
|
|
2387
|
+
dryRun: false } });
|
|
2388
|
+
state.pendingGraphEvents ??= [];
|
|
2389
|
+
if (!state.pendingGraphEvents.some((pending) => pending.eventId === releaseGateFailedEvent!.eventId))
|
|
2390
|
+
state.pendingGraphEvents.push(releaseGateFailedEvent);
|
|
2391
|
+
}
|
|
2392
|
+
// Persist the completed triage record and its ARG event outbox entry in one ledger write.
|
|
1585
2393
|
persist();
|
|
2394
|
+
if (releaseGateFailedEvent) await publishLifecycleEvent(releaseGateFailedEvent);
|
|
1586
2395
|
if (options.signal?.aborted) {
|
|
2396
|
+
await emitVisitLifecycle('leave', current, visit, { outcome: ok ? 'ok' : 'fail', reason: 'cancelled' });
|
|
1587
2397
|
state.status = 'failed';
|
|
1588
2398
|
state.reason = 'cancelled';
|
|
1589
2399
|
persist();
|
|
@@ -1594,6 +2404,7 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1594
2404
|
: topLevelTerminalStatus(graph.graphId, current)!;
|
|
1595
2405
|
if (!graph.unit && current !== 'done' && current !== 'failed') state.reason = current;
|
|
1596
2406
|
else delete state.reason;
|
|
2407
|
+
await emitVisitLifecycle('leave', current, visit, { outcome: ok ? 'ok' : 'fail', reason: 'terminal' });
|
|
1597
2408
|
persist();
|
|
1598
2409
|
if (state.status === 'failed' && !state.dryRun && graphId === 'release-loop') {
|
|
1599
2410
|
recordReleaseRunFailure(state, root, `Graph ${graphId}/${runId} failed at ${current}`);
|
|
@@ -1664,6 +2475,7 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1664
2475
|
growth: result.growth, decisionId: result.decisionId, decisionRef: result.decisionRef,
|
|
1665
2476
|
...(result.command ? { command: result.command } : {}), ...(result.approval ? { approval: result.approval } : {}) };
|
|
1666
2477
|
persist();
|
|
2478
|
+
await emitVisitLifecycle('leave', current, visit, { outcome: ok ? 'ok' : 'fail', reason: 'awaiting-growth-approval' });
|
|
1667
2479
|
break;
|
|
1668
2480
|
}
|
|
1669
2481
|
state.growthEvents.push({ phase: 'rejected', from: current, outcome: namedOutcome, at: new Date().toISOString(), reason: result.reason,
|
|
@@ -1671,6 +2483,7 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1671
2483
|
}
|
|
1672
2484
|
persist();
|
|
1673
2485
|
}
|
|
2486
|
+
const completedNodeId: string = current;
|
|
1674
2487
|
// A planned harness loop follows its route directly: `changed-files` edges have no runner condition.
|
|
1675
2488
|
const edgeOutcome: 'ok' | 'fail' = state.dryRun && !command?.dry_run_command ? 'ok' : ok ? 'ok' : 'fail';
|
|
1676
2489
|
const outgoing = graph.edges.find((candidate) => candidate.from === current);
|
|
@@ -1685,17 +2498,41 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1685
2498
|
if (runningBranch) throw new Error(`fan-out branch ${runningBranch} is still marked running; crashed-child recovery is not supported`);
|
|
1686
2499
|
state.fanOuts ??= {};
|
|
1687
2500
|
state.fanOuts[fanOutKey] = fanout;
|
|
1688
|
-
const
|
|
1689
|
-
const
|
|
2501
|
+
const parentOutputs = state.nodes.map((record) => [record.nodeId, record.output ?? null]);
|
|
2502
|
+
const sourceCommit = completionCommit(state);
|
|
2503
|
+
const hasCompletedBranch = destinations.some((branchId) => fanout.branches[branchId]?.status === 'done');
|
|
2504
|
+
const sourceRoot = options.releaseCommandSource?.root ?? options.deps?.root ?? process.cwd();
|
|
2505
|
+
const verifiedSourceCommit = sourceCommit && hasCompletedBranch
|
|
2506
|
+
? actualSourceCommit(sourceRoot, options.releaseCommandSource?.git)
|
|
2507
|
+
: undefined;
|
|
2508
|
+
const branchInputSha256 = (branchId: string) => stableSha256({ graphId, sourceHash: state.sourceHash ?? null,
|
|
2509
|
+
input: state.input ?? null, from: current, branchId, outputs: parentOutputs });
|
|
2510
|
+
const selected = destinations.filter((branchId) => {
|
|
2511
|
+
const branch = fanout.branches[branchId];
|
|
2512
|
+
if (branch?.status !== 'done') return true;
|
|
2513
|
+
const receipt = branch.completionReceipt;
|
|
2514
|
+
const artifactSnapshot = completionArtifactSnapshot(branch.output, options.deps?.root ?? process.cwd());
|
|
2515
|
+
return !sourceCommit || !verifiedSourceCommit || verifiedSourceCommit !== sourceCommit || !receipt ||
|
|
2516
|
+
receipt.inputSha256 !== branchInputSha256(branchId) || receipt.commit !== sourceCommit ||
|
|
2517
|
+
!branch.artifactSha256 || receipt.artifactSha256 !== branch.artifactSha256 ||
|
|
2518
|
+
!artifactSnapshot.valid || branch.artifactSha256 !== artifactSnapshot.sha256;
|
|
2519
|
+
});
|
|
2520
|
+
const pending = [...selected];
|
|
2521
|
+
const active = new Map<Promise<string>, { branchId: string; locks: readonly string[] }>();
|
|
2522
|
+
const activeLocks = new Set<string>();
|
|
2523
|
+
const maxParallel = graph.maxParallelNodes ?? Math.max(1, selected.length);
|
|
2524
|
+
const launch = (branchId: string): void => {
|
|
1690
2525
|
const runId = randomUUID();
|
|
1691
2526
|
fanout.branches[branchId] = { runId, status: 'running', startedAt: new Date().toISOString() };
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
2527
|
+
const locks = graph.nodes.find((node) => node.nodeId === branchId)?.resourceLocks ?? [];
|
|
2528
|
+
for (const lock of locks) activeLocks.add(lock);
|
|
2529
|
+
persist();
|
|
2530
|
+
const work = (async () => {
|
|
2531
|
+
const branch = fanout.branches[branchId]!;
|
|
2532
|
+
try {
|
|
2533
|
+
// Each branch's fresh runId owns its registrations; parent subscriptions remain scoped to the parent run.
|
|
1698
2534
|
const child = await runGraph(path, { runId, graphSource: fanOutGraphSource(variantSource, graph, branchId), input: state.input,
|
|
2535
|
+
...(baseEventBus === undefined ? {} : { eventBus: baseEventBus }),
|
|
1699
2536
|
dryRun: state.dryRun, quiet: true, signal: options.signal, pinChildUniverse: options.pinChildUniverse,
|
|
1700
2537
|
releaseCommandSource: options.releaseCommandSource,
|
|
1701
2538
|
branchCutTip: lastJsonObject(state.nodes.find((record) => record.nodeId === 'version-release')?.output)?.commit as string | undefined,
|
|
@@ -1708,27 +2545,100 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1708
2545
|
branch.status = child.status === 'done' && record?.ok ? 'done' : 'failed';
|
|
1709
2546
|
if (record?.output !== undefined) {
|
|
1710
2547
|
branch.output = record.output;
|
|
1711
|
-
|
|
2548
|
+
const artifactSnapshot = completionArtifactSnapshot(record.output, options.deps?.root ?? process.cwd());
|
|
2549
|
+
branch.artifactSha256 = artifactSnapshot.sha256;
|
|
2550
|
+
if (sourceCommit && artifactSnapshot.valid) branch.completionReceipt = { inputSha256: branchInputSha256(branchId), commit: sourceCommit,
|
|
2551
|
+
artifactSha256: branch.artifactSha256 };
|
|
1712
2552
|
}
|
|
1713
2553
|
if (record?.error) branch.error = record.error;
|
|
1714
2554
|
else if (child.status !== 'done') branch.error = `branch child run ended ${child.status}`;
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
2555
|
+
} catch (cause) {
|
|
2556
|
+
branch.status = 'failed';
|
|
2557
|
+
branch.error = cause instanceof Error ? cause.message : String(cause);
|
|
2558
|
+
}
|
|
2559
|
+
branch.endedAt = new Date().toISOString();
|
|
2560
|
+
persist();
|
|
2561
|
+
return branchId;
|
|
2562
|
+
})();
|
|
2563
|
+
active.set(work, { branchId, locks });
|
|
2564
|
+
};
|
|
2565
|
+
while (pending.length || active.size) {
|
|
2566
|
+
while (active.size < maxParallel) {
|
|
2567
|
+
const readyIndex = pending.findIndex((branchId) =>
|
|
2568
|
+
(graph.nodes.find((node) => node.nodeId === branchId)?.resourceLocks ?? []).every((lock) => !activeLocks.has(lock)));
|
|
2569
|
+
if (readyIndex < 0) break;
|
|
2570
|
+
const [branchId] = pending.splice(readyIndex, 1);
|
|
2571
|
+
if (branchId !== undefined) launch(branchId);
|
|
1718
2572
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
2573
|
+
if (active.size === 0) throw new Error(`fan-out scheduler has pending nodes but no runnable node: ${fanOutKey}`);
|
|
2574
|
+
const completed = await Promise.race(active.keys());
|
|
2575
|
+
const completedTask = [...active].find(([, task]) => task.branchId === completed);
|
|
2576
|
+
if (completedTask) active.delete(completedTask[0]);
|
|
2577
|
+
for (const lock of completedTask?.[1].locks ?? []) activeLocks.delete(lock);
|
|
2578
|
+
}
|
|
1723
2579
|
persist();
|
|
1724
2580
|
current = outgoing.join;
|
|
1725
2581
|
} else {
|
|
1726
2582
|
current = plannedStep ? plannedStep.to
|
|
1727
2583
|
: nextNode(graph.edges, current, edgeOutcome, namedOutcome);
|
|
1728
2584
|
}
|
|
2585
|
+
const naturalNext: string | undefined = current;
|
|
2586
|
+
const continuation = wakeContinuation;
|
|
2587
|
+
let scheduledNext: string | undefined = naturalNext;
|
|
2588
|
+
if (continuation && (continuation.nodeId === completedNodeId || continuation.appendNodeIds?.includes(completedNodeId))) {
|
|
2589
|
+
const isAppendedNode = continuation.appendNodeIds?.includes(completedNodeId) === true;
|
|
2590
|
+
const isLastAppendedNode = !isAppendedNode || continuation.appendNodeIds?.at(-1) === completedNodeId;
|
|
2591
|
+
if (isLastAppendedNode && continuation.failureTo !== undefined && naturalNext === continuation.failureTo) {
|
|
2592
|
+
// Preserve a fail-closed outcome edge instead of resuming its success continuation.
|
|
2593
|
+
wakeContinuation = undefined;
|
|
2594
|
+
delete state.wakeContinuation;
|
|
2595
|
+
} else if (isLastAppendedNode) {
|
|
2596
|
+
scheduledNext = continuation.returnTo;
|
|
2597
|
+
wakeContinuation = undefined;
|
|
2598
|
+
delete state.wakeContinuation;
|
|
2599
|
+
} else {
|
|
2600
|
+
scheduledNext = naturalNext;
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
const action = pendingSubscriptionActions.shift();
|
|
2604
|
+
state.pendingSubscriptionActions = [...pendingSubscriptionActions];
|
|
2605
|
+
if (action) {
|
|
2606
|
+
const target = graph.nodes.find((candidate) => candidate.nodeId === action.nodeId);
|
|
2607
|
+
if (!target || ((visits.get(action.nodeId) ?? 0) >= target.maxVisits && scheduledNext !== action.nodeId)) {
|
|
2608
|
+
logSubscriptionAction('rejected', action, !target ? 'subscriber node no longer exists' : 'subscriber node visit limit reached');
|
|
2609
|
+
} else if (action.action === 'reroute') {
|
|
2610
|
+
const rerouteIsCurrentAndDeclared = action.event.source.nodeId === completedNodeId &&
|
|
2611
|
+
(graph.edges.some((edge) => edge.from === completedNodeId && edge.to === action.nodeId) ||
|
|
2612
|
+
(state.adaptiveGraphEdges ?? []).some((edge) => edge.from === completedNodeId && edge.to === action.nodeId && edge.triggerEvent === action.event.type));
|
|
2613
|
+
if (!rerouteIsCurrentAndDeclared) {
|
|
2614
|
+
logSubscriptionAction('rejected', action, 'reroute is no longer a declared edge from the current node');
|
|
2615
|
+
} else {
|
|
2616
|
+
scheduledNext = action.nodeId;
|
|
2617
|
+
logSubscriptionAction('handled', action);
|
|
2618
|
+
}
|
|
2619
|
+
} else if (scheduledNext !== action.nodeId || action.returnTo !== undefined) {
|
|
2620
|
+
wakeContinuation = { nodeId: action.nodeId, returnTo: action.returnTo ?? scheduledNext,
|
|
2621
|
+
...(action.failureTo === undefined ? {} : { failureTo: action.failureTo }),
|
|
2622
|
+
...(action.appendNodeIds === undefined ? {} : { appendNodeIds: [...action.appendNodeIds] }) };
|
|
2623
|
+
state.wakeContinuation = wakeContinuation;
|
|
2624
|
+
scheduledNext = action.nodeId;
|
|
2625
|
+
logSubscriptionAction('handled', action);
|
|
2626
|
+
} else {
|
|
2627
|
+
logSubscriptionAction('handled', action);
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
current = scheduledNext;
|
|
2631
|
+
persist();
|
|
1729
2632
|
resumedGrowth = false;
|
|
2633
|
+
await emitVisitLifecycle('leave', fromNodeId, visit, { outcome: ok ? 'ok' : 'fail', ...(current === undefined ? {} : { nextNodeId: current }),
|
|
2634
|
+
...(current === undefined ? { reason: 'no-outgoing-edge' } : {}) });
|
|
1730
2635
|
if (current !== undefined) publishInsideEvent({ kind: 'edge', graphId, runId, from: fromNodeId, to: current });
|
|
1731
2636
|
if (current === undefined) {
|
|
2637
|
+
while (pendingSubscriptionActions.length > 0) {
|
|
2638
|
+
const unhandled = pendingSubscriptionActions.shift()!;
|
|
2639
|
+
logSubscriptionAction('rejected', unhandled, 'run has no remaining scheduler path');
|
|
2640
|
+
}
|
|
2641
|
+
state.pendingSubscriptionActions = [];
|
|
1732
2642
|
state.status = 'failed';
|
|
1733
2643
|
persist();
|
|
1734
2644
|
if (!state.dryRun && graphId === 'release-loop') {
|
|
@@ -1736,6 +2646,18 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1736
2646
|
}
|
|
1737
2647
|
}
|
|
1738
2648
|
}
|
|
2649
|
+
} catch (error) {
|
|
2650
|
+
if (activeLifecycleNode) {
|
|
2651
|
+
try { await emitNodeLifecycle('leave', activeLifecycleNode.nodeId, activeLifecycleNode.visit,
|
|
2652
|
+
{ outcome: 'fail', reason: 'execution-failed' }); }
|
|
2653
|
+
catch { /* preserve the original graph failure if lifecycle reporting also fails */ }
|
|
2654
|
+
try { persist(); }
|
|
2655
|
+
catch { /* preserve the original error if the run ledger is still unavailable */ }
|
|
2656
|
+
activeLifecycleNode = undefined;
|
|
2657
|
+
await lifecycleObserverQueue;
|
|
2658
|
+
}
|
|
2659
|
+
throw error;
|
|
2660
|
+
}
|
|
1739
2661
|
if (state.dryRun && Object.keys(state.fanOuts ?? {}).length > 0) {
|
|
1740
2662
|
const fanoutsBySource = new Map<string, NonNullable<GraphRunState['fanOuts']>[string][]>();
|
|
1741
2663
|
for (const fanout of Object.values(state.fanOuts!)) {
|
|
@@ -1747,8 +2669,13 @@ export async function runGraph(path: string, options: GraphRunOptions = {}): Pro
|
|
|
1747
2669
|
Object.values(fanout.branches).flatMap((branch) => (branch.path ?? []).filter((branchNode) => !graph.terminalNodes.includes(branchNode))))]);
|
|
1748
2670
|
persist();
|
|
1749
2671
|
}
|
|
2672
|
+
await lifecycleObserverQueue;
|
|
1750
2673
|
return state;
|
|
1751
2674
|
} finally {
|
|
2675
|
+
await lifecycleObserverQueue;
|
|
2676
|
+
disposeGraphSubscriptions();
|
|
2677
|
+
disposeReleaseGraphEventAdapters();
|
|
2678
|
+
disposeAdaptiveGateHealAdapter();
|
|
1752
2679
|
if (options.resumeRunId && existsSync(resumeLock)) rmdirSync(resumeLock);
|
|
1753
2680
|
}
|
|
1754
2681
|
}
|