@owlmeans/viable-sdk 0.1.18-rc.8 → 0.1.18
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/README.md +29 -11
- package/agent-meta/manifest.json +16 -0
- package/agent-meta/skills/viable-sdk/SKILL.md +1033 -0
- package/build/api/collect/types.d.ts +30 -0
- package/build/api/collect/types.d.ts.map +1 -0
- package/build/api/collect/types.js +2 -0
- package/build/api/collect/types.js.map +1 -0
- package/build/api/collect.d.ts +14 -0
- package/build/api/collect.d.ts.map +1 -0
- package/build/api/collect.js +132 -0
- package/build/api/collect.js.map +1 -0
- package/build/api/consts.local.d.ts +21 -0
- package/build/api/consts.local.d.ts.map +1 -0
- package/build/api/consts.local.js +25 -0
- package/build/api/consts.local.js.map +1 -0
- package/build/api/index.d.ts +5 -0
- package/build/api/index.d.ts.map +1 -1
- package/build/api/index.js +2 -0
- package/build/api/index.js.map +1 -1
- package/build/api/remote.d.ts +13 -6
- package/build/api/remote.d.ts.map +1 -1
- package/build/api/remote.js +302 -35
- package/build/api/remote.js.map +1 -1
- package/build/api/transport/types.d.ts +14 -0
- package/build/api/transport/types.d.ts.map +1 -0
- package/build/api/transport/types.js +2 -0
- package/build/api/transport/types.js.map +1 -0
- package/build/api/transport.d.ts +4 -0
- package/build/api/transport.d.ts.map +1 -0
- package/build/api/transport.js +32 -0
- package/build/api/transport.js.map +1 -0
- package/build/api/types.d.ts +9 -0
- package/build/api/types.d.ts.map +1 -0
- package/build/api/types.js +2 -0
- package/build/api/types.js.map +1 -0
- package/build/api/types.local.d.ts +3 -0
- package/build/api/types.local.d.ts.map +1 -0
- package/build/api/types.local.js +2 -0
- package/build/api/types.local.js.map +1 -0
- package/build/consts.d.ts +29 -14
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +30 -14
- package/build/consts.js.map +1 -1
- package/build/context/consts.local.d.ts +18 -0
- package/build/context/consts.local.d.ts.map +1 -0
- package/build/context/consts.local.js +18 -0
- package/build/context/consts.local.js.map +1 -0
- package/build/context/index.d.ts +3 -7
- package/build/context/index.d.ts.map +1 -1
- package/build/context/index.js +58 -25
- package/build/context/index.js.map +1 -1
- package/build/context/types.d.ts +26 -0
- package/build/context/types.d.ts.map +1 -0
- package/build/context/types.js +2 -0
- package/build/context/types.js.map +1 -0
- package/build/executor/boot-check.d.ts +1 -40
- package/build/executor/boot-check.d.ts.map +1 -1
- package/build/executor/boot-check.js +22 -19
- package/build/executor/boot-check.js.map +1 -1
- package/build/executor/consts.d.ts +55 -0
- package/build/executor/consts.d.ts.map +1 -0
- package/build/executor/consts.js +66 -0
- package/build/executor/consts.js.map +1 -0
- package/build/executor/consts.local.d.ts +63 -0
- package/build/executor/consts.local.d.ts.map +1 -0
- package/build/executor/consts.local.js +69 -0
- package/build/executor/consts.local.js.map +1 -0
- package/build/executor/env/types.d.ts +40 -0
- package/build/executor/env/types.d.ts.map +1 -0
- package/build/executor/env/types.js +2 -0
- package/build/executor/env/types.js.map +1 -0
- package/build/executor/env.d.ts +11 -20
- package/build/executor/env.d.ts.map +1 -1
- package/build/executor/env.js +39 -59
- package/build/executor/env.js.map +1 -1
- package/build/executor/errors.d.ts +15 -0
- package/build/executor/errors.d.ts.map +1 -1
- package/build/executor/errors.js +19 -2
- package/build/executor/errors.js.map +1 -1
- package/build/executor/files/types.d.ts +106 -0
- package/build/executor/files/types.d.ts.map +1 -0
- package/build/executor/files/types.js +2 -0
- package/build/executor/files/types.js.map +1 -0
- package/build/executor/files.d.ts +2 -50
- package/build/executor/files.d.ts.map +1 -1
- package/build/executor/files.js +225 -68
- package/build/executor/files.js.map +1 -1
- package/build/executor/git/types.d.ts +19 -0
- package/build/executor/git/types.d.ts.map +1 -0
- package/build/executor/git/types.js +2 -0
- package/build/executor/git/types.js.map +1 -0
- package/build/executor/git.d.ts +4 -36
- package/build/executor/git.d.ts.map +1 -1
- package/build/executor/git.js +206 -241
- package/build/executor/git.js.map +1 -1
- package/build/executor/glob/types.d.ts +12 -0
- package/build/executor/glob/types.d.ts.map +1 -0
- package/build/executor/glob/types.js +2 -0
- package/build/executor/glob/types.js.map +1 -0
- package/build/executor/glob.d.ts +4 -0
- package/build/executor/glob.d.ts.map +1 -0
- package/build/executor/glob.js +11 -0
- package/build/executor/glob.js.map +1 -0
- package/build/executor/health/types.d.ts +39 -0
- package/build/executor/health/types.d.ts.map +1 -0
- package/build/executor/health/types.js +2 -0
- package/build/executor/health/types.js.map +1 -0
- package/build/executor/health.d.ts +3 -83
- package/build/executor/health.d.ts.map +1 -1
- package/build/executor/health.js +76 -91
- package/build/executor/health.js.map +1 -1
- package/build/executor/index.d.ts +14 -15
- package/build/executor/index.d.ts.map +1 -1
- package/build/executor/index.js +36 -18
- package/build/executor/index.js.map +1 -1
- package/build/executor/integrity/types.d.ts +25 -0
- package/build/executor/integrity/types.d.ts.map +1 -0
- package/build/executor/integrity/types.js +2 -0
- package/build/executor/integrity/types.js.map +1 -0
- package/build/executor/integrity.d.ts +5 -15
- package/build/executor/integrity.d.ts.map +1 -1
- package/build/executor/integrity.js +28 -39
- package/build/executor/integrity.js.map +1 -1
- package/build/executor/layout/types.d.ts +69 -0
- package/build/executor/layout/types.d.ts.map +1 -0
- package/build/executor/layout/types.js +2 -0
- package/build/executor/layout/types.js.map +1 -0
- package/build/executor/layout.d.ts +9 -56
- package/build/executor/layout.d.ts.map +1 -1
- package/build/executor/layout.js +35 -82
- package/build/executor/layout.js.map +1 -1
- package/build/executor/shell/types.d.ts +76 -0
- package/build/executor/shell/types.d.ts.map +1 -0
- package/build/executor/shell/types.js +2 -0
- package/build/executor/shell/types.js.map +1 -0
- package/build/executor/shell.d.ts +3 -78
- package/build/executor/shell.d.ts.map +1 -1
- package/build/executor/shell.js +61 -91
- package/build/executor/shell.js.map +1 -1
- package/build/executor/spawn/types.d.ts +98 -0
- package/build/executor/spawn/types.d.ts.map +1 -0
- package/build/executor/spawn/types.js +2 -0
- package/build/executor/spawn/types.js.map +1 -0
- package/build/executor/spawn.d.ts +3 -103
- package/build/executor/spawn.d.ts.map +1 -1
- package/build/executor/spawn.js +192 -274
- package/build/executor/spawn.js.map +1 -1
- package/build/executor/types.d.ts +123 -0
- package/build/executor/types.d.ts.map +1 -0
- package/build/executor/types.js +2 -0
- package/build/executor/types.js.map +1 -0
- package/build/executor/types.local.d.ts +6 -0
- package/build/executor/types.local.d.ts.map +1 -0
- package/build/executor/types.local.js +2 -0
- package/build/executor/types.local.js.map +1 -0
- package/build/index.d.ts +14 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -1
- package/build/index.js.map +1 -1
- package/build/project/consts.d.ts +17 -0
- package/build/project/consts.d.ts.map +1 -0
- package/build/project/consts.js +17 -0
- package/build/project/consts.js.map +1 -0
- package/build/project/consts.local.d.ts +4 -0
- package/build/project/consts.local.d.ts.map +1 -0
- package/build/project/consts.local.js +4 -0
- package/build/project/consts.local.js.map +1 -0
- package/build/project/dotenv/types.d.ts +39 -0
- package/build/project/dotenv/types.d.ts.map +1 -0
- package/build/project/dotenv/types.js +2 -0
- package/build/project/dotenv/types.js.map +1 -0
- package/build/project/dotenv.d.ts +4 -0
- package/build/project/dotenv.d.ts.map +1 -0
- package/build/project/dotenv.js +56 -0
- package/build/project/dotenv.js.map +1 -0
- package/build/project/env/types.d.ts +40 -0
- package/build/project/env/types.d.ts.map +1 -0
- package/build/project/env/types.js +2 -0
- package/build/project/env/types.js.map +1 -0
- package/build/project/env.d.ts +2 -98
- package/build/project/env.d.ts.map +1 -1
- package/build/project/env.js +63 -215
- package/build/project/env.js.map +1 -1
- package/build/project/marker/types.d.ts +33 -0
- package/build/project/marker/types.d.ts.map +1 -0
- package/build/project/marker/types.js +2 -0
- package/build/project/marker/types.js.map +1 -0
- package/build/project/marker.d.ts +4 -25
- package/build/project/marker.d.ts.map +1 -1
- package/build/project/marker.js +40 -43
- package/build/project/marker.js.map +1 -1
- package/build/project/probe/types.d.ts +22 -0
- package/build/project/probe/types.d.ts.map +1 -0
- package/build/project/probe/types.js +2 -0
- package/build/project/probe/types.js.map +1 -0
- package/build/project/probe.d.ts +4 -0
- package/build/project/probe.d.ts.map +1 -0
- package/build/project/probe.js +39 -0
- package/build/project/probe.js.map +1 -0
- package/build/project/report/types.d.ts +18 -0
- package/build/project/report/types.d.ts.map +1 -0
- package/build/project/report/types.js +2 -0
- package/build/project/report/types.js.map +1 -0
- package/build/project/report.d.ts +7 -0
- package/build/project/report.d.ts.map +1 -0
- package/build/project/report.js +68 -0
- package/build/project/report.js.map +1 -0
- package/build/project/setup/types.d.ts +32 -0
- package/build/project/setup/types.d.ts.map +1 -0
- package/build/project/setup/types.js +2 -0
- package/build/project/setup/types.js.map +1 -0
- package/build/project/setup.d.ts +4 -53
- package/build/project/setup.d.ts.map +1 -1
- package/build/project/setup.js +112 -175
- package/build/project/setup.js.map +1 -1
- package/build/project/types.d.ts +37 -0
- package/build/project/types.d.ts.map +1 -0
- package/build/project/types.js +2 -0
- package/build/project/types.js.map +1 -0
- package/build/run/consts.local.d.ts +3 -0
- package/build/run/consts.local.d.ts.map +1 -0
- package/build/run/consts.local.js +26 -0
- package/build/run/consts.local.js.map +1 -0
- package/build/run/index.d.ts +11 -69
- package/build/run/index.d.ts.map +1 -1
- package/build/run/index.js +9 -147
- package/build/run/index.js.map +1 -1
- package/build/run/local/types.d.ts +39 -0
- package/build/run/local/types.d.ts.map +1 -0
- package/build/run/local/types.js +2 -0
- package/build/run/local/types.js.map +1 -0
- package/build/run/local.d.ts +3 -0
- package/build/run/local.d.ts.map +1 -0
- package/build/run/local.js +130 -0
- package/build/run/local.js.map +1 -0
- package/build/run/process/types.d.ts +15 -0
- package/build/run/process/types.d.ts.map +1 -0
- package/build/run/process/types.js +2 -0
- package/build/run/process/types.js.map +1 -0
- package/build/run/process.d.ts +4 -0
- package/build/run/process.d.ts.map +1 -0
- package/build/run/process.js +20 -0
- package/build/run/process.js.map +1 -0
- package/build/run/serve.d.ts +14 -9
- package/build/run/serve.d.ts.map +1 -1
- package/build/run/serve.js +1 -25
- package/build/run/serve.js.map +1 -1
- package/build/run/state/types.d.ts +35 -0
- package/build/run/state/types.d.ts.map +1 -0
- package/build/run/state/types.js +2 -0
- package/build/run/state/types.js.map +1 -0
- package/build/run/state.d.ts +3 -62
- package/build/run/state.d.ts.map +1 -1
- package/build/run/state.js +96 -123
- package/build/run/state.js.map +1 -1
- package/build/run/types.d.ts +78 -0
- package/build/run/types.d.ts.map +1 -0
- package/build/run/types.js +2 -0
- package/build/run/types.js.map +1 -0
- package/build/session/consts.local.d.ts +5 -0
- package/build/session/consts.local.d.ts.map +1 -0
- package/build/session/consts.local.js +5 -0
- package/build/session/consts.local.js.map +1 -0
- package/build/session/index.d.ts +5 -10
- package/build/session/index.d.ts.map +1 -1
- package/build/session/index.js +84 -15
- package/build/session/index.js.map +1 -1
- package/build/session/questions.d.ts +16 -0
- package/build/session/questions.d.ts.map +1 -0
- package/build/session/questions.js +17 -0
- package/build/session/questions.js.map +1 -0
- package/build/session/queue.d.ts +61 -0
- package/build/session/queue.d.ts.map +1 -0
- package/build/session/queue.js +156 -0
- package/build/session/queue.js.map +1 -0
- package/build/session/tasks.d.ts +11 -30
- package/build/session/tasks.d.ts.map +1 -1
- package/build/session/tasks.js +18 -78
- package/build/session/tasks.js.map +1 -1
- package/build/session/types.d.ts +20 -0
- package/build/session/types.d.ts.map +1 -0
- package/build/session/types.js +2 -0
- package/build/session/types.js.map +1 -0
- package/build/task/consts.d.ts +12 -0
- package/build/task/consts.d.ts.map +1 -0
- package/build/task/consts.js +12 -0
- package/build/task/consts.js.map +1 -0
- package/build/task/consts.local.d.ts +19 -0
- package/build/task/consts.local.d.ts.map +1 -0
- package/build/task/consts.local.js +72 -0
- package/build/task/consts.local.js.map +1 -0
- package/build/task/driver.d.ts +1 -28
- package/build/task/driver.d.ts.map +1 -1
- package/build/task/driver.js +2 -9
- package/build/task/driver.js.map +1 -1
- package/build/task/envelope/types.d.ts +29 -0
- package/build/task/envelope/types.d.ts.map +1 -0
- package/build/task/envelope/types.js +2 -0
- package/build/task/envelope/types.js.map +1 -0
- package/build/task/envelope.d.ts +4 -34
- package/build/task/envelope.d.ts.map +1 -1
- package/build/task/envelope.js +103 -165
- package/build/task/envelope.js.map +1 -1
- package/build/task/index.d.ts +5 -0
- package/build/task/index.d.ts.map +1 -1
- package/build/task/index.js +2 -0
- package/build/task/index.js.map +1 -1
- package/build/task/inquiry/types.d.ts +38 -0
- package/build/task/inquiry/types.d.ts.map +1 -0
- package/build/task/inquiry/types.js +2 -0
- package/build/task/inquiry/types.js.map +1 -0
- package/build/task/inquiry.d.ts +5 -0
- package/build/task/inquiry.d.ts.map +1 -0
- package/build/task/inquiry.js +188 -0
- package/build/task/inquiry.js.map +1 -0
- package/build/task/types.d.ts +48 -0
- package/build/task/types.d.ts.map +1 -0
- package/build/task/types.js +2 -0
- package/build/task/types.js.map +1 -0
- package/build/tools/account/types.d.ts +24 -0
- package/build/tools/account/types.d.ts.map +1 -0
- package/build/tools/account/types.js +2 -0
- package/build/tools/account/types.js.map +1 -0
- package/build/tools/account.d.ts +4 -0
- package/build/tools/account.d.ts.map +1 -0
- package/build/tools/account.js +72 -0
- package/build/tools/account.js.map +1 -0
- package/build/tools/blueprints/types.d.ts +5 -0
- package/build/tools/blueprints/types.d.ts.map +1 -0
- package/build/tools/blueprints/types.js +2 -0
- package/build/tools/blueprints/types.js.map +1 -0
- package/build/tools/blueprints.d.ts +4 -0
- package/build/tools/blueprints.d.ts.map +1 -0
- package/build/tools/blueprints.js +23 -0
- package/build/tools/blueprints.js.map +1 -0
- package/build/tools/catalogue/types.d.ts +8 -0
- package/build/tools/catalogue/types.d.ts.map +1 -0
- package/build/tools/catalogue/types.js +2 -0
- package/build/tools/catalogue/types.js.map +1 -0
- package/build/tools/catalogue.d.ts +8 -6
- package/build/tools/catalogue.d.ts.map +1 -1
- package/build/tools/catalogue.js +2565 -213
- package/build/tools/catalogue.js.map +1 -1
- package/build/tools/config/types.d.ts +19 -0
- package/build/tools/config/types.d.ts.map +1 -0
- package/build/tools/config/types.js +2 -0
- package/build/tools/config/types.js.map +1 -0
- package/build/tools/config.d.ts +4 -0
- package/build/tools/config.d.ts.map +1 -0
- package/build/tools/config.js +42 -0
- package/build/tools/config.js.map +1 -0
- package/build/tools/consts.d.ts +61 -0
- package/build/tools/consts.d.ts.map +1 -0
- package/build/tools/consts.js +515 -0
- package/build/tools/consts.js.map +1 -0
- package/build/tools/consts.local.d.ts +131 -0
- package/build/tools/consts.local.d.ts.map +1 -0
- package/build/tools/consts.local.js +236 -0
- package/build/tools/consts.local.js.map +1 -0
- package/build/tools/control/types.d.ts +17 -0
- package/build/tools/control/types.d.ts.map +1 -0
- package/build/tools/control/types.js +2 -0
- package/build/tools/control/types.js.map +1 -0
- package/build/tools/control.d.ts +4 -0
- package/build/tools/control.d.ts.map +1 -0
- package/build/tools/control.js +44 -0
- package/build/tools/control.js.map +1 -0
- package/build/tools/feed/types.d.ts +21 -0
- package/build/tools/feed/types.d.ts.map +1 -0
- package/build/tools/feed/types.js +2 -0
- package/build/tools/feed/types.js.map +1 -0
- package/build/tools/feed.d.ts +4 -0
- package/build/tools/feed.d.ts.map +1 -0
- package/build/tools/feed.js +75 -0
- package/build/tools/feed.js.map +1 -0
- package/build/tools/git/types.d.ts +25 -0
- package/build/tools/git/types.d.ts.map +1 -0
- package/build/tools/git/types.js +2 -0
- package/build/tools/git/types.js.map +1 -0
- package/build/tools/git.d.ts +4 -0
- package/build/tools/git.d.ts.map +1 -0
- package/build/tools/git.js +83 -0
- package/build/tools/git.js.map +1 -0
- package/build/tools/handover/types.d.ts +49 -0
- package/build/tools/handover/types.d.ts.map +1 -0
- package/build/tools/handover/types.js +2 -0
- package/build/tools/handover/types.js.map +1 -0
- package/build/tools/handover.d.ts +8 -0
- package/build/tools/handover.d.ts.map +1 -0
- package/build/tools/handover.js +138 -0
- package/build/tools/handover.js.map +1 -0
- package/build/tools/host/types.d.ts +34 -0
- package/build/tools/host/types.d.ts.map +1 -0
- package/build/tools/host/types.js +2 -0
- package/build/tools/host/types.js.map +1 -0
- package/build/tools/host.d.ts +4 -0
- package/build/tools/host.d.ts.map +1 -0
- package/build/tools/host.js +13 -0
- package/build/tools/host.js.map +1 -0
- package/build/tools/iam/types.d.ts +44 -0
- package/build/tools/iam/types.d.ts.map +1 -0
- package/build/tools/iam/types.js +2 -0
- package/build/tools/iam/types.js.map +1 -0
- package/build/tools/iam.d.ts +4 -0
- package/build/tools/iam.d.ts.map +1 -0
- package/build/tools/iam.js +229 -0
- package/build/tools/iam.js.map +1 -0
- package/build/tools/index.d.ts +27 -1
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +14 -1
- package/build/tools/index.js.map +1 -1
- package/build/tools/inflight/types.d.ts +47 -0
- package/build/tools/inflight/types.d.ts.map +1 -0
- package/build/tools/inflight/types.js +2 -0
- package/build/tools/inflight/types.js.map +1 -0
- package/build/tools/inflight.d.ts +3 -0
- package/build/tools/inflight.d.ts.map +1 -0
- package/build/tools/inflight.js +88 -0
- package/build/tools/inflight.js.map +1 -0
- package/build/tools/kits/types.d.ts +12 -0
- package/build/tools/kits/types.d.ts.map +1 -0
- package/build/tools/kits/types.js +2 -0
- package/build/tools/kits/types.js.map +1 -0
- package/build/tools/kits.d.ts +4 -0
- package/build/tools/kits.d.ts.map +1 -0
- package/build/tools/kits.js +33 -0
- package/build/tools/kits.js.map +1 -0
- package/build/tools/mcp.d.ts +13 -19
- package/build/tools/mcp.d.ts.map +1 -1
- package/build/tools/mcp.js +117 -38
- package/build/tools/mcp.js.map +1 -1
- package/build/tools/platform.d.ts +14 -0
- package/build/tools/platform.d.ts.map +1 -0
- package/build/tools/platform.js +90 -0
- package/build/tools/platform.js.map +1 -0
- package/build/tools/production/types.d.ts +22 -0
- package/build/tools/production/types.d.ts.map +1 -0
- package/build/tools/production/types.js +2 -0
- package/build/tools/production/types.js.map +1 -0
- package/build/tools/production.d.ts +4 -0
- package/build/tools/production.d.ts.map +1 -0
- package/build/tools/production.js +80 -0
- package/build/tools/production.js.map +1 -0
- package/build/tools/refusal/types.d.ts +95 -0
- package/build/tools/refusal/types.d.ts.map +1 -0
- package/build/tools/refusal/types.js +2 -0
- package/build/tools/refusal/types.js.map +1 -0
- package/build/tools/refusal.d.ts +4 -0
- package/build/tools/refusal.d.ts.map +1 -0
- package/build/tools/refusal.js +663 -0
- package/build/tools/refusal.js.map +1 -0
- package/build/tools/settings/types.d.ts +42 -0
- package/build/tools/settings/types.d.ts.map +1 -0
- package/build/tools/settings/types.js +2 -0
- package/build/tools/settings/types.js.map +1 -0
- package/build/tools/settings.d.ts +4 -0
- package/build/tools/settings.d.ts.map +1 -0
- package/build/tools/settings.js +71 -0
- package/build/tools/settings.js.map +1 -0
- package/build/tools/status/types.d.ts +25 -0
- package/build/tools/status/types.d.ts.map +1 -0
- package/build/tools/status/types.js +2 -0
- package/build/tools/status/types.js.map +1 -0
- package/build/tools/status.d.ts +4 -0
- package/build/tools/status.d.ts.map +1 -0
- package/build/tools/status.js +183 -0
- package/build/tools/status.js.map +1 -0
- package/build/tools/stories/types.d.ts +48 -0
- package/build/tools/stories/types.d.ts.map +1 -0
- package/build/tools/stories/types.js +2 -0
- package/build/tools/stories/types.js.map +1 -0
- package/build/tools/stories.d.ts +8 -0
- package/build/tools/stories.d.ts.map +1 -0
- package/build/tools/stories.js +79 -0
- package/build/tools/stories.js.map +1 -0
- package/build/tools/types.d.ts +177 -26
- package/build/tools/types.d.ts.map +1 -1
- package/build/tools/types.js +1 -32
- package/build/tools/types.js.map +1 -1
- package/build/types.d.ts +391 -26
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +8 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +12 -0
- package/build/utils.js.map +1 -0
- package/package.json +30 -34
- package/build/harness/index.d.ts +0 -28
- package/build/harness/index.d.ts.map +0 -1
- package/build/harness/index.js +0 -83
- package/build/harness/index.js.map +0 -1
- package/build/harness/templates.d.ts +0 -30
- package/build/harness/templates.d.ts.map +0 -1
- package/build/harness/templates.js +0 -154
- package/build/harness/templates.js.map +0 -1
- package/build/tools/jobs.d.ts +0 -12
- package/build/tools/jobs.d.ts.map +0 -1
- package/build/tools/jobs.js +0 -47
- package/build/tools/jobs.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SpawnHelper } from './spawn/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Everything that starts, bounds or ends a child process on the developer's machine.
|
|
4
4
|
*
|
|
@@ -6,106 +6,6 @@ import type { ChildProcess } from 'node:child_process';
|
|
|
6
6
|
* about what a failure looks like or when a port is free — the publisher learned both lessons the
|
|
7
7
|
* expensive way, and neither of them is about Kubernetes.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* Node's default is 1 MiB, and a target project with a few hundred type errors exceeds it: the
|
|
13
|
-
* child is killed and the fixer receives `stdout maxBuffer length exceeded` instead of the errors
|
|
14
|
-
* it is supposed to repair.
|
|
15
|
-
*/
|
|
16
|
-
export declare const MAX_OUTPUT_BUFFER: number;
|
|
17
|
-
/** One-shot script ceiling. A build that outlives it is wedged, not slow. */
|
|
18
|
-
export declare const BUILD_TIMEOUT = 300000;
|
|
19
|
-
/**
|
|
20
|
-
* Compose a failed command's output into the text a fixer reads.
|
|
21
|
-
*
|
|
22
|
-
* Never interpolate the `ExecException` beside `stderr`: its string form is
|
|
23
|
-
* `Error: Command failed: <cmd>\n<stderr>`, so the naive `${stdout} ${error} ${stderr}` shape
|
|
24
|
-
* emitted every diagnostic twice and prefixed a runner sentence that is not a diagnostic at all.
|
|
25
|
-
* Both survive into the fix conversation — the duplicate doubles the prompt for nothing, and the
|
|
26
|
-
* preamble is what a model latches onto when it cannot see a real cause. Say it once, and say
|
|
27
|
-
* what actually ran only when there is nothing else to report.
|
|
28
|
-
*/
|
|
29
|
-
export declare const failureOutput: (error: unknown, stdout: string, stderr: string, cmd: string) => string;
|
|
30
|
-
export interface RunOptions {
|
|
31
|
-
cwd: string;
|
|
32
|
-
env?: Record<string, string>;
|
|
33
|
-
/** Answer with stdout alone on failure — what a type check's diagnostics are. */
|
|
34
|
-
stdoutOnly?: boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Run a shell command and answer "error text, or null".
|
|
38
|
-
*
|
|
39
|
-
* The one contract every shell command here shares. A caller never has to know whether the child
|
|
40
|
-
* exited non-zero, failed to spawn or produced nothing — those are all one answer.
|
|
41
|
-
*/
|
|
42
|
-
export declare const runCommand: (cmd: string, options: RunOptions) => Promise<string | null>;
|
|
43
|
-
/**
|
|
44
|
-
* Run one of the target's own `scripts.*`, bounded.
|
|
45
|
-
*
|
|
46
|
-
* `spawn` rather than `exec` because a build's output is unbounded and streaming it costs nothing,
|
|
47
|
-
* and because a wedged `bunx` resolving forever must die rather than hold the caller open. The
|
|
48
|
-
* timeout is reported as a verdict, not thrown, so it reaches the same channel a failed build does.
|
|
49
|
-
*/
|
|
50
|
-
export declare const runScript: (script: string, cwd: string, env?: Record<string, string>) => Promise<string | null>;
|
|
51
|
-
/**
|
|
52
|
-
* Bound one whole dispatch, whatever it is.
|
|
53
|
-
*
|
|
54
|
-
* Every operation below already bounds itself, but one that wedges AROUND its own bound — a lock
|
|
55
|
-
* nothing releases, a promise that never settles — holds the caller open with nothing to report,
|
|
56
|
-
* and the caller's timeout becomes the only limit. Reaching this means the operation failed to
|
|
57
|
-
* bound itself, not that it needed longer.
|
|
58
|
-
*/
|
|
59
|
-
export declare const withDeadline: <T>(label: string, ms: number, fn: () => Promise<T>) => Promise<T>;
|
|
60
|
-
/** Whether anything answers a TCP connect on a local port. */
|
|
61
|
-
export declare const probeListening: (port: number, timeoutMs?: number) => Promise<boolean>;
|
|
62
|
-
/**
|
|
63
|
-
* Wait until nothing answers on a local port.
|
|
64
|
-
*
|
|
65
|
-
* The child spawned here is a shell wrapping `bun`, so the shell's exit is not proof the target is
|
|
66
|
-
* gone: a signal the shell dies from and `bun` survives leaves an orphan that still owns the port.
|
|
67
|
-
* Whether the port answers is the only fact that decides whether a replacement can bind, so a
|
|
68
|
-
* restart waits on that and never on an exit event.
|
|
69
|
-
*/
|
|
70
|
-
export declare const waitForPortFree: (port: number, timeoutMs?: number, pollMs?: number) => Promise<boolean>;
|
|
71
|
-
/**
|
|
72
|
-
* Terminate a detached child's whole process group and wait until it is actually gone.
|
|
73
|
-
*
|
|
74
|
-
* Awaiting matters: the caller restarts right after, and a process still holding the port makes
|
|
75
|
-
* the replacement lose the bind and exit — leaving nothing listening and no error anyone reads.
|
|
76
|
-
*/
|
|
77
|
-
export declare const killGroupAndWait: (proc: ChildProcess, options?: {
|
|
78
|
-
term?: number;
|
|
79
|
-
kill?: number;
|
|
80
|
-
}) => Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Take a port back from a leftover running the same command.
|
|
83
|
-
*
|
|
84
|
-
* A connector that was killed — a host restart, a Ctrl-C, a crashed run — leaves its DETACHED
|
|
85
|
-
* children alive, because detaching them is what keeps a build from dying with the tool that
|
|
86
|
-
* started it. What survives holds the target's port, and every later attempt then fails with the
|
|
87
|
-
* target's own "the api port is already in use", which reads as a defect in the generated app.
|
|
88
|
-
*
|
|
89
|
-
* Matched by the marker the spawn carries, never by the port alone: a process this connector did
|
|
90
|
-
* not start is not ours to signal, whatever it is sitting on.
|
|
91
|
-
*/
|
|
92
|
-
export declare const reclaimPort: (port: number, marker: string) => Promise<boolean>;
|
|
93
|
-
/**
|
|
94
|
-
* The pids whose command line carries a marker.
|
|
95
|
-
*
|
|
96
|
-
* `/proc` rather than `ps`, for the same reason the publisher reads it: no shell, no parsing of a
|
|
97
|
-
* format that differs per platform. Somewhere without `/proc` simply has nothing to reclaim, which
|
|
98
|
-
* is the honest answer there.
|
|
99
|
-
*/
|
|
100
|
-
export declare const findProcesses: (needles: string | string[]) => Promise<number[]>;
|
|
101
|
-
/**
|
|
102
|
-
* Signal a process GROUP, falling back to the process.
|
|
103
|
-
*
|
|
104
|
-
* The negative pid is the point: a child spawned detached through a shell survives a signal aimed
|
|
105
|
-
* at the shell's own pid, and what survives is the `bun` process holding the port.
|
|
106
|
-
*/
|
|
107
|
-
export declare const signalGroup: (pid: number | undefined, signal: NodeJS.Signals) => boolean;
|
|
108
|
-
/** Whether a recorded pid is still a live process. */
|
|
109
|
-
export declare const isAlive: (pid: number | undefined) => boolean;
|
|
110
|
-
export declare const delay: (ms: number) => Promise<void>;
|
|
9
|
+
export declare const createSpawnHelper: () => SpawnHelper;
|
|
10
|
+
export declare const spawnHelper: SpawnHelper;
|
|
111
11
|
//# sourceMappingURL=spawn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/executor/spawn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/executor/spawn.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;;;GAMG;AAEH,eAAO,MAAM,iBAAiB,QAAO,WA+OpC,CAAA;AAED,eAAO,MAAM,WAAW,aAAsB,CAAA"}
|
package/build/executor/spawn.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { exec, spawn } from 'node:child_process';
|
|
2
2
|
import net from 'node:net';
|
|
3
3
|
import fsp from 'node:fs/promises';
|
|
4
|
+
import { KILL_TIMEOUT, PORT_FREE_TIMEOUT, PORT_POLL_MS, TARGET_SCRIPT, TERM_TIMEOUT } from './consts.local.js';
|
|
5
|
+
import { BUILD_TIMEOUT, MAX_OUTPUT_BUFFER } from './consts.js';
|
|
4
6
|
/**
|
|
5
7
|
* Everything that starts, bounds or ends a child process on the developer's machine.
|
|
6
8
|
*
|
|
@@ -8,307 +10,223 @@ import fsp from 'node:fs/promises';
|
|
|
8
10
|
* about what a failure looks like or when a port is free — the publisher learned both lessons the
|
|
9
11
|
* expensive way, and neither of them is about Kubernetes.
|
|
10
12
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* `Error: Command failed: <cmd>\n<stderr>`, so the naive `${stdout} ${error} ${stderr}` shape
|
|
31
|
-
* emitted every diagnostic twice and prefixed a runner sentence that is not a diagnostic at all.
|
|
32
|
-
* Both survive into the fix conversation — the duplicate doubles the prompt for nothing, and the
|
|
33
|
-
* preamble is what a model latches onto when it cannot see a real cause. Say it once, and say
|
|
34
|
-
* what actually ran only when there is nothing else to report.
|
|
35
|
-
*/
|
|
36
|
-
export const failureOutput = (error, stdout, stderr, cmd) => {
|
|
37
|
-
const body = [stdout, stderr].map(part => part.trim()).filter(Boolean).join('\n');
|
|
38
|
-
const code = error?.code ?? 1;
|
|
39
|
-
return body !== '' ? `${body}\nexit ${code}: ${cmd}` : `exit ${code}: ${cmd}`;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Run a shell command and answer "error text, or null".
|
|
43
|
-
*
|
|
44
|
-
* The one contract every shell command here shares. A caller never has to know whether the child
|
|
45
|
-
* exited non-zero, failed to spawn or produced nothing — those are all one answer.
|
|
46
|
-
*/
|
|
47
|
-
export const runCommand = async (cmd, options) => await new Promise(resolve => {
|
|
48
|
-
exec(cmd, {
|
|
49
|
-
cwd: options.cwd,
|
|
50
|
-
maxBuffer: MAX_OUTPUT_BUFFER,
|
|
51
|
-
env: options.env != null ? { ...process.env, ...options.env } : process.env,
|
|
52
|
-
}, (error, stdout, stderr) => {
|
|
53
|
-
if (error != null) {
|
|
54
|
-
return resolve(options.stdoutOnly === true
|
|
55
|
-
? stdout
|
|
56
|
-
: failureOutput(error, stdout, stderr, cmd));
|
|
57
|
-
}
|
|
58
|
-
resolve(null);
|
|
13
|
+
export const createSpawnHelper = () => {
|
|
14
|
+
const failureOutput = (error, stdout, stderr, cmd) => {
|
|
15
|
+
const body = [stdout, stderr].map(part => part.trim()).filter(Boolean).join('\n');
|
|
16
|
+
const code = error?.code ?? 1;
|
|
17
|
+
return body !== '' ? `${body}\nexit ${code}: ${cmd}` : `exit ${code}: ${cmd}`;
|
|
18
|
+
};
|
|
19
|
+
const runCommand = async (cmd, options) => await new Promise(resolve => {
|
|
20
|
+
exec(cmd, {
|
|
21
|
+
cwd: options.cwd,
|
|
22
|
+
maxBuffer: MAX_OUTPUT_BUFFER,
|
|
23
|
+
env: options.env != null ? { ...process.env, ...options.env } : process.env,
|
|
24
|
+
}, (error, stdout, stderr) => {
|
|
25
|
+
if (error != null) {
|
|
26
|
+
return resolve(options.stdoutOnly === true
|
|
27
|
+
? stdout
|
|
28
|
+
: failureOutput(error, stdout, stderr, cmd));
|
|
29
|
+
}
|
|
30
|
+
resolve(null);
|
|
31
|
+
});
|
|
59
32
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
33
|
+
const runScript = async (script, cwd, env) => await new Promise(resolve => {
|
|
34
|
+
const proc = spawn('bun', ['run', script], {
|
|
35
|
+
cwd,
|
|
36
|
+
shell: true,
|
|
37
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
38
|
+
env: { ...process.env, ...(env ?? {}) },
|
|
39
|
+
});
|
|
40
|
+
let out = '';
|
|
41
|
+
let err = '';
|
|
42
|
+
let settled = false;
|
|
43
|
+
const finish = (value) => {
|
|
44
|
+
if (settled)
|
|
45
|
+
return;
|
|
46
|
+
settled = true;
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
resolve(value);
|
|
49
|
+
};
|
|
50
|
+
const timer = setTimeout(() => {
|
|
51
|
+
try {
|
|
52
|
+
proc.kill('SIGKILL');
|
|
53
|
+
}
|
|
54
|
+
catch { /* already gone */ }
|
|
55
|
+
finish(`${script} timed out after ${BUILD_TIMEOUT}ms`);
|
|
56
|
+
}, BUILD_TIMEOUT);
|
|
57
|
+
timer.unref?.();
|
|
58
|
+
proc.stdout?.on('data', chunk => { out += chunk.toString(); });
|
|
59
|
+
proc.stderr?.on('data', chunk => { err += chunk.toString(); });
|
|
60
|
+
// A spawn error never reaches the exit handler, so it is answered here or it is lost.
|
|
61
|
+
proc.on('error', error => finish(`${error}`));
|
|
62
|
+
proc.on('exit', code => finish(code === 0 ? null : `${out}\n${err}`));
|
|
74
63
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
let settled = false;
|
|
78
|
-
const finish = (value) => {
|
|
79
|
-
if (settled)
|
|
80
|
-
return;
|
|
81
|
-
settled = true;
|
|
82
|
-
clearTimeout(timer);
|
|
83
|
-
resolve(value);
|
|
84
|
-
};
|
|
85
|
-
const timer = setTimeout(() => {
|
|
64
|
+
const withDeadline = async (label, ms, fn) => {
|
|
65
|
+
let timer;
|
|
86
66
|
try {
|
|
87
|
-
|
|
67
|
+
return await Promise.race([
|
|
68
|
+
fn(),
|
|
69
|
+
new Promise((_, reject) => {
|
|
70
|
+
timer = setTimeout(() => reject(new Error(`Slot command timed out: ${label} after ${ms}ms`)), ms);
|
|
71
|
+
timer.unref?.();
|
|
72
|
+
}),
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
if (timer != null)
|
|
77
|
+
clearTimeout(timer);
|
|
88
78
|
}
|
|
89
|
-
catch { /* already gone */ }
|
|
90
|
-
finish(`${script} timed out after ${BUILD_TIMEOUT}ms`);
|
|
91
|
-
}, BUILD_TIMEOUT);
|
|
92
|
-
timer.unref?.();
|
|
93
|
-
proc.stdout?.on('data', chunk => { out += chunk.toString(); });
|
|
94
|
-
proc.stderr?.on('data', chunk => { err += chunk.toString(); });
|
|
95
|
-
// A spawn error never reaches the exit handler, so it is answered here or it is lost.
|
|
96
|
-
proc.on('error', error => finish(`${error}`));
|
|
97
|
-
proc.on('exit', code => finish(code === 0 ? null : `${out}\n${err}`));
|
|
98
|
-
});
|
|
99
|
-
/**
|
|
100
|
-
* Bound one whole dispatch, whatever it is.
|
|
101
|
-
*
|
|
102
|
-
* Every operation below already bounds itself, but one that wedges AROUND its own bound — a lock
|
|
103
|
-
* nothing releases, a promise that never settles — holds the caller open with nothing to report,
|
|
104
|
-
* and the caller's timeout becomes the only limit. Reaching this means the operation failed to
|
|
105
|
-
* bound itself, not that it needed longer.
|
|
106
|
-
*/
|
|
107
|
-
export const withDeadline = async (label, ms, fn) => {
|
|
108
|
-
let timer;
|
|
109
|
-
try {
|
|
110
|
-
return await Promise.race([
|
|
111
|
-
fn(),
|
|
112
|
-
new Promise((_, reject) => {
|
|
113
|
-
timer = setTimeout(() => reject(new Error(`Slot command timed out: ${label} after ${ms}ms`)), ms);
|
|
114
|
-
timer.unref?.();
|
|
115
|
-
}),
|
|
116
|
-
]);
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
if (timer != null)
|
|
120
|
-
clearTimeout(timer);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
/** Whether anything answers a TCP connect on a local port. */
|
|
124
|
-
export const probeListening = async (port, timeoutMs = 1_000) => await new Promise(resolve => {
|
|
125
|
-
const socket = net.connect({ host: '127.0.0.1', port });
|
|
126
|
-
const done = (value) => {
|
|
127
|
-
socket.removeAllListeners();
|
|
128
|
-
socket.destroy();
|
|
129
|
-
resolve(value);
|
|
130
79
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
80
|
+
const probeListening = async (port, timeoutMs = 1_000) => await new Promise(resolve => {
|
|
81
|
+
const socket = net.connect({ host: '127.0.0.1', port });
|
|
82
|
+
const done = (value) => {
|
|
83
|
+
socket.removeAllListeners();
|
|
84
|
+
socket.destroy();
|
|
85
|
+
resolve(value);
|
|
86
|
+
};
|
|
87
|
+
socket.setTimeout(timeoutMs);
|
|
88
|
+
socket.once('connect', () => done(true));
|
|
89
|
+
socket.once('timeout', () => done(false));
|
|
90
|
+
socket.once('error', () => done(false));
|
|
91
|
+
});
|
|
92
|
+
const waitForPortFree = async (port, timeoutMs = PORT_FREE_TIMEOUT, pollMs = PORT_POLL_MS) => {
|
|
93
|
+
const deadline = Date.now() + timeoutMs;
|
|
94
|
+
for (;;) {
|
|
95
|
+
if (!await probeListening(port)) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
if (Date.now() >= deadline) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
await delay(pollMs);
|
|
149
102
|
}
|
|
150
|
-
|
|
103
|
+
};
|
|
104
|
+
const killGroupAndWait = async (proc, options = {}) => {
|
|
105
|
+
const term = options.term ?? TERM_TIMEOUT;
|
|
106
|
+
const kill = options.kill ?? KILL_TIMEOUT;
|
|
107
|
+
const pid = proc.pid;
|
|
108
|
+
// NEVER an early return on the child's own exit code. The child is a shell wrapping `bun`, so a
|
|
109
|
+
// signal the shell dies from leaves `bun` alive and holding the port while `exitCode` says it is
|
|
110
|
+
// gone — the exact shape that leaves a stray server running on somebody's machine and every
|
|
111
|
+
// later boot check failing with "the api port is already in use".
|
|
112
|
+
signalGroup(pid, 'SIGTERM');
|
|
113
|
+
if (await gone(pid, term))
|
|
114
|
+
return;
|
|
115
|
+
signalGroup(pid, 'SIGKILL');
|
|
116
|
+
await gone(pid, kill);
|
|
117
|
+
};
|
|
118
|
+
/** Whether a process group is still around. EPERM counts as alive: it exists and is not ours. */
|
|
119
|
+
const groupAlive = (pid) => {
|
|
120
|
+
if (pid == null)
|
|
151
121
|
return false;
|
|
152
|
-
}
|
|
153
|
-
await delay(pollMs);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Terminate a detached child's whole process group and wait until it is actually gone.
|
|
158
|
-
*
|
|
159
|
-
* Awaiting matters: the caller restarts right after, and a process still holding the port makes
|
|
160
|
-
* the replacement lose the bind and exit — leaving nothing listening and no error anyone reads.
|
|
161
|
-
*/
|
|
162
|
-
export const killGroupAndWait = async (proc, options = {}) => {
|
|
163
|
-
const term = options.term ?? TERM_TIMEOUT;
|
|
164
|
-
const kill = options.kill ?? KILL_TIMEOUT;
|
|
165
|
-
const pid = proc.pid;
|
|
166
|
-
// NEVER an early return on the child's own exit code. The child is a shell wrapping `bun`, so a
|
|
167
|
-
// signal the shell dies from leaves `bun` alive and holding the port while `exitCode` says it is
|
|
168
|
-
// gone — the exact shape that leaves a stray server running on somebody's machine and every
|
|
169
|
-
// later boot check failing with "the api port is already in use".
|
|
170
|
-
signalGroup(pid, 'SIGTERM');
|
|
171
|
-
if (await gone(pid, term))
|
|
172
|
-
return;
|
|
173
|
-
signalGroup(pid, 'SIGKILL');
|
|
174
|
-
await gone(pid, kill);
|
|
175
|
-
};
|
|
176
|
-
/** Whether a process group is still around. EPERM counts as alive: it exists and is not ours. */
|
|
177
|
-
const groupAlive = (pid) => {
|
|
178
|
-
if (pid == null)
|
|
179
|
-
return false;
|
|
180
|
-
try {
|
|
181
|
-
process.kill(-pid, 0);
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
catch (e) {
|
|
185
|
-
if (e.code === 'EPERM')
|
|
186
|
-
return true;
|
|
187
122
|
try {
|
|
188
|
-
process.kill(pid, 0);
|
|
123
|
+
process.kill(-pid, 0);
|
|
189
124
|
return true;
|
|
190
125
|
}
|
|
191
|
-
catch (
|
|
192
|
-
|
|
126
|
+
catch (e) {
|
|
127
|
+
if (e.code === 'EPERM')
|
|
128
|
+
return true;
|
|
129
|
+
try {
|
|
130
|
+
process.kill(pid, 0);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
catch (own) {
|
|
134
|
+
return own.code === 'EPERM';
|
|
135
|
+
}
|
|
193
136
|
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Wait until the whole GROUP is gone, or the budget runs out.
|
|
140
|
+
*
|
|
141
|
+
* Polled rather than awaited on the child's `exit` event, because that event is about the shell
|
|
142
|
+
* and the thing worth waiting for is whatever it started.
|
|
143
|
+
*/
|
|
144
|
+
const gone = async (pid, budgetMs) => {
|
|
145
|
+
const deadline = Date.now() + budgetMs;
|
|
146
|
+
for (;;) {
|
|
147
|
+
if (!groupAlive(pid))
|
|
148
|
+
return true;
|
|
149
|
+
if (Date.now() >= deadline)
|
|
150
|
+
return false;
|
|
151
|
+
await delay(50);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const reclaimPort = async (port, marker) => {
|
|
155
|
+
if (!await probeListening(port))
|
|
206
156
|
return true;
|
|
207
|
-
|
|
157
|
+
// BOTH the script and the marker. A marker alone would match any process whose command line
|
|
158
|
+
// merely mentions it — a shell the user is typing in, a grep, an editor — and this sends SIGKILL.
|
|
159
|
+
const orphans = await findProcesses([TARGET_SCRIPT, marker]);
|
|
160
|
+
if (orphans.length < 1)
|
|
208
161
|
return false;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
* not start is not ours to signal, whatever it is sitting on.
|
|
224
|
-
*/
|
|
225
|
-
export const reclaimPort = async (port, marker) => {
|
|
226
|
-
if (!await probeListening(port))
|
|
227
|
-
return true;
|
|
228
|
-
// BOTH the script and the marker. A marker alone would match any process whose command line
|
|
229
|
-
// merely mentions it — a shell the user is typing in, a grep, an editor — and this sends SIGKILL.
|
|
230
|
-
const orphans = await findProcesses([TARGET_SCRIPT, marker]);
|
|
231
|
-
if (orphans.length < 1)
|
|
232
|
-
return false;
|
|
233
|
-
for (const pid of orphans) {
|
|
162
|
+
for (const pid of orphans) {
|
|
163
|
+
try {
|
|
164
|
+
process.kill(pid, 'SIGKILL');
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// Already gone.
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return await waitForPortFree(port);
|
|
171
|
+
};
|
|
172
|
+
const findProcesses = async (needles) => {
|
|
173
|
+
const wanted = Array.isArray(needles) ? needles : [needles];
|
|
174
|
+
const pids = [];
|
|
175
|
+
let entries;
|
|
234
176
|
try {
|
|
235
|
-
|
|
177
|
+
entries = await fsp.readdir('/proc');
|
|
236
178
|
}
|
|
237
179
|
catch {
|
|
238
|
-
|
|
180
|
+
return pids;
|
|
181
|
+
}
|
|
182
|
+
for (const entry of entries) {
|
|
183
|
+
const pid = Number(entry);
|
|
184
|
+
if (!Number.isInteger(pid) || pid === process.pid)
|
|
185
|
+
continue;
|
|
186
|
+
try {
|
|
187
|
+
const cmdline = (await fsp.readFile(`/proc/${entry}/cmdline`, 'utf8')).replace(/\0/g, ' ').trim();
|
|
188
|
+
if (cmdline !== '' && wanted.every(needle => cmdline.includes(needle)))
|
|
189
|
+
pids.push(pid);
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
// Ended mid-scan, or not ours to read — either way not a target.
|
|
193
|
+
}
|
|
239
194
|
}
|
|
240
|
-
}
|
|
241
|
-
return await waitForPortFree(port);
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* The pids whose command line carries a marker.
|
|
245
|
-
*
|
|
246
|
-
* `/proc` rather than `ps`, for the same reason the publisher reads it: no shell, no parsing of a
|
|
247
|
-
* format that differs per platform. Somewhere without `/proc` simply has nothing to reclaim, which
|
|
248
|
-
* is the honest answer there.
|
|
249
|
-
*/
|
|
250
|
-
export const findProcesses = async (needles) => {
|
|
251
|
-
const wanted = Array.isArray(needles) ? needles : [needles];
|
|
252
|
-
const pids = [];
|
|
253
|
-
let entries;
|
|
254
|
-
try {
|
|
255
|
-
entries = await fsp.readdir('/proc');
|
|
256
|
-
}
|
|
257
|
-
catch {
|
|
258
195
|
return pids;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
continue;
|
|
196
|
+
};
|
|
197
|
+
const signalGroup = (pid, signal) => {
|
|
198
|
+
if (pid == null)
|
|
199
|
+
return false;
|
|
264
200
|
try {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
pids.push(pid);
|
|
201
|
+
process.kill(-pid, signal);
|
|
202
|
+
return true;
|
|
268
203
|
}
|
|
269
204
|
catch {
|
|
270
|
-
|
|
205
|
+
try {
|
|
206
|
+
process.kill(pid, signal);
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
271
212
|
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
* Signal a process GROUP, falling back to the process.
|
|
277
|
-
*
|
|
278
|
-
* The negative pid is the point: a child spawned detached through a shell survives a signal aimed
|
|
279
|
-
* at the shell's own pid, and what survives is the `bun` process holding the port.
|
|
280
|
-
*/
|
|
281
|
-
export const signalGroup = (pid, signal) => {
|
|
282
|
-
if (pid == null)
|
|
283
|
-
return false;
|
|
284
|
-
try {
|
|
285
|
-
process.kill(-pid, signal);
|
|
286
|
-
return true;
|
|
287
|
-
}
|
|
288
|
-
catch {
|
|
213
|
+
};
|
|
214
|
+
const isAlive = (pid) => {
|
|
215
|
+
if (pid == null)
|
|
216
|
+
return false;
|
|
289
217
|
try {
|
|
290
|
-
process.kill(pid,
|
|
218
|
+
process.kill(pid, 0);
|
|
291
219
|
return true;
|
|
292
220
|
}
|
|
293
221
|
catch {
|
|
294
222
|
return false;
|
|
295
223
|
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
try {
|
|
303
|
-
process.kill(pid, 0);
|
|
304
|
-
return true;
|
|
305
|
-
}
|
|
306
|
-
catch {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
224
|
+
};
|
|
225
|
+
const delay = async (ms) => await new Promise(resolve => {
|
|
226
|
+
const timer = setTimeout(resolve, ms);
|
|
227
|
+
timer.unref?.();
|
|
228
|
+
});
|
|
229
|
+
return { failureOutput, runCommand, runScript, withDeadline, probeListening, waitForPortFree, killGroupAndWait, reclaimPort, findProcesses, signalGroup, isAlive, delay };
|
|
309
230
|
};
|
|
310
|
-
export const
|
|
311
|
-
const timer = setTimeout(resolve, ms);
|
|
312
|
-
timer.unref?.();
|
|
313
|
-
});
|
|
231
|
+
export const spawnHelper = createSpawnHelper();
|
|
314
232
|
//# sourceMappingURL=spawn.js.map
|