@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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ConnectMarker } from '@owlmeans/viable-common';
|
|
2
|
+
export interface TargetEnv {
|
|
3
|
+
/** Project-relative path → the values that file declares. */
|
|
4
|
+
files: Record<string, Record<string, string>>;
|
|
5
|
+
/** Everything the target's processes see, later files overriding earlier ones. */
|
|
6
|
+
values: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export interface DiscoveredProject {
|
|
9
|
+
/** The directory holding `.viable/connect.json` — the project root, not where the search began. */
|
|
10
|
+
dir: string;
|
|
11
|
+
marker: ConnectMarker;
|
|
12
|
+
}
|
|
13
|
+
export interface ServiceState {
|
|
14
|
+
/** A connection string is present in the project's own half of the `.env`. */
|
|
15
|
+
configured: boolean;
|
|
16
|
+
/** Something answers where it points. False for an unset URL and for one nothing listens on. */
|
|
17
|
+
reachable: boolean;
|
|
18
|
+
/** The value, with everything between the scheme and the host removed. */
|
|
19
|
+
redacted?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SetupReport {
|
|
22
|
+
dir: string;
|
|
23
|
+
/** Only a project with a worker needs a queue store; for the rest it is noise. */
|
|
24
|
+
needsWorker: boolean;
|
|
25
|
+
database: ServiceState;
|
|
26
|
+
queue: ServiceState;
|
|
27
|
+
/** The command-line tools the paths below depend on. */
|
|
28
|
+
tools: {
|
|
29
|
+
bun: boolean;
|
|
30
|
+
git: boolean;
|
|
31
|
+
docker: boolean;
|
|
32
|
+
};
|
|
33
|
+
platform: NodeJS.Platform;
|
|
34
|
+
/** Whether the file holding these values is kept out of the project's history. */
|
|
35
|
+
envIgnored: boolean;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/project/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC7C,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,mGAAmG;IACnG,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,aAAa,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,UAAU,EAAE,OAAO,CAAA;IACnB,gGAAgG;IAChG,SAAS,EAAE,OAAO,CAAA;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,kFAAkF;IAClF,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,YAAY,CAAA;IACtB,KAAK,EAAE,YAAY,CAAA;IACnB,wDAAwD;IACxD,KAAK,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAA;IACtD,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IACzB,kFAAkF;IAClF,UAAU,EAAE,OAAO,CAAA;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/project/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../../src/run/consts.local.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmBvC,CAAA;AAED,eAAO,MAAM,WAAW,QAIJ,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const MIME = {
|
|
2
|
+
'.html': 'text/html; charset=utf-8',
|
|
3
|
+
'.js': 'application/javascript; charset=utf-8',
|
|
4
|
+
'.mjs': 'application/javascript; charset=utf-8',
|
|
5
|
+
'.css': 'text/css; charset=utf-8',
|
|
6
|
+
'.json': 'application/json; charset=utf-8',
|
|
7
|
+
'.map': 'application/json; charset=utf-8',
|
|
8
|
+
'.webmanifest': 'application/manifest+json',
|
|
9
|
+
'.svg': 'image/svg+xml',
|
|
10
|
+
'.png': 'image/png',
|
|
11
|
+
'.jpg': 'image/jpeg',
|
|
12
|
+
'.jpeg': 'image/jpeg',
|
|
13
|
+
'.gif': 'image/gif',
|
|
14
|
+
'.webp': 'image/webp',
|
|
15
|
+
'.ico': 'image/x-icon',
|
|
16
|
+
'.woff': 'font/woff',
|
|
17
|
+
'.woff2': 'font/woff2',
|
|
18
|
+
'.ttf': 'font/ttf',
|
|
19
|
+
'.txt': 'text/plain; charset=utf-8',
|
|
20
|
+
};
|
|
21
|
+
export const PLACEHOLDER = '<!doctype html><html lang="en"><head><meta charset="UTF-8"/>'
|
|
22
|
+
+ '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'
|
|
23
|
+
+ '<title>Not built yet</title></head><body style="font-family:sans-serif">'
|
|
24
|
+
+ '<p style="padding:2rem">This project has not been built yet. Run a build and reload.</p>'
|
|
25
|
+
+ '</body></html>';
|
|
26
|
+
//# sourceMappingURL=consts.local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/run/consts.local.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAA2B;IAC1C,OAAO,EAAE,0BAA0B;IACnC,KAAK,EAAE,uCAAuC;IAC9C,MAAM,EAAE,uCAAuC;IAC/C,MAAM,EAAE,yBAAyB;IACjC,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,iCAAiC;IACzC,cAAc,EAAE,2BAA2B;IAC3C,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,2BAA2B;CACpC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,8DAA8D;MACrF,yEAAyE;MACzE,0EAA0E;MAC1E,0FAA0F;MAC1F,gBAAgB,CAAA"}
|
package/build/run/index.d.ts
CHANGED
|
@@ -1,75 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LocalRunStatus, RunLocalOptions, RunLocalResult } from './types.js';
|
|
2
2
|
export * from './state.js';
|
|
3
|
+
export type * from './state/types.js';
|
|
4
|
+
export * from './process.js';
|
|
5
|
+
export type * from './process/types.js';
|
|
6
|
+
export * from './local.js';
|
|
7
|
+
export type * from './local/types.js';
|
|
8
|
+
export type * from './types.js';
|
|
3
9
|
export * from './serve.js';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
build?: boolean;
|
|
7
|
-
log?: (line: string) => void;
|
|
8
|
-
}
|
|
9
|
-
export interface RunLocalResult {
|
|
10
|
-
record: LocalRunRecord | null;
|
|
11
|
-
/**
|
|
12
|
-
* The ports the run uses, so a caller can print an address without composing one.
|
|
13
|
-
*
|
|
14
|
-
* Stated even when a process did not come up: they are where the app WILL answer, and whether
|
|
15
|
-
* it does yet is what `error`, `buildError` and {@link localStatus} are for.
|
|
16
|
-
*/
|
|
17
|
-
api: number;
|
|
18
|
-
web: number;
|
|
19
|
-
worker?: number;
|
|
20
|
-
/** The reason nothing was started, or the tree was refused. */
|
|
21
|
-
error?: string;
|
|
22
|
-
/** A build ran and failed. The web server still comes up so the state is visible. */
|
|
23
|
-
buildError?: string;
|
|
24
|
-
}
|
|
25
|
-
/** One supervised process, as a status read finds it. */
|
|
26
|
-
export interface LocalProcessStatus {
|
|
27
|
-
pid: number;
|
|
28
|
-
port: number;
|
|
29
|
-
alive: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface LocalRunStatus {
|
|
32
|
-
running: boolean;
|
|
33
|
-
startedAt?: string;
|
|
34
|
-
/** Ports, flat, for a caller composing an address or a one-line report. */
|
|
35
|
-
api?: number;
|
|
36
|
-
worker?: number;
|
|
37
|
-
web?: number;
|
|
38
|
-
/** The target's own boot phase, when it got far enough to report one. */
|
|
39
|
-
phase?: string;
|
|
40
|
-
/** Whether the target says it is serving — never the same question as "the pid is alive". */
|
|
41
|
-
ready?: boolean;
|
|
42
|
-
/** Why it is not ready. Absent when it is. */
|
|
43
|
-
reason?: string;
|
|
44
|
-
processes: {
|
|
45
|
-
api?: LocalProcessStatus;
|
|
46
|
-
worker?: LocalProcessStatus;
|
|
47
|
-
web?: LocalProcessStatus;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Build the target, start its processes, serve its browser app.
|
|
52
|
-
*
|
|
53
|
-
* A previous run is stopped first: both halves bind fixed ports, and a replacement that races the
|
|
54
|
-
* process it is replacing loses the bind and exits — with nothing announcing it, since a failed
|
|
55
|
-
* `listen` says nothing on its own.
|
|
56
|
-
*/
|
|
10
|
+
export type { LocalProcessStatus, LocalRunStatus, RunLocalOptions, RunLocalResult } from './types.js';
|
|
11
|
+
/** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).runLocal(…)` */
|
|
57
12
|
export declare const runLocal: (dir: string, options?: RunLocalOptions) => Promise<RunLocalResult>;
|
|
58
|
-
/**
|
|
59
|
-
* Stop whatever the run record names, and forget it.
|
|
60
|
-
*
|
|
61
|
-
* Safe to call when nothing is running: the record is the only authority, and a stale one names
|
|
62
|
-
* pids that are simply not alive. The children are detached, so they outlive the process that
|
|
63
|
-
* started them — which is exactly why the record is a file and this is the only way to end them.
|
|
64
|
-
*/
|
|
13
|
+
/** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).stopLocal()` */
|
|
65
14
|
export declare const stopLocal: (dir: string) => Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* What is running, and whether the target is actually serving.
|
|
68
|
-
*
|
|
69
|
-
* Two independent facts, because either one alone lies. A live pid says nothing about a target
|
|
70
|
-
* that bound its port and then failed to reach its database — it answers `200` with `db.ok:false`
|
|
71
|
-
* and would otherwise read as healthy. A health answer says nothing about a process that died
|
|
72
|
-
* while something else holds the port.
|
|
73
|
-
*/
|
|
15
|
+
/** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).localStatus()` */
|
|
74
16
|
export declare const localStatus: (dir: string) => Promise<LocalRunStatus>;
|
|
75
17
|
//# sourceMappingURL=index.d.ts.map
|
package/build/run/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEjF,cAAc,YAAY,CAAA;AAC1B,mBAAmB,kBAAkB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,mBAAmB,oBAAoB,CAAA;AACvC,cAAc,YAAY,CAAA;AAC1B,mBAAmB,kBAAkB,CAAA;AACrC,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA;AAE1B,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAErG,sFAAsF;AACtF,eAAO,MAAM,QAAQ,QAAe,MAAM,YAAW,eAAe,KAAQ,OAAO,CAAC,cAAc,CACjD,CAAA;AAEjD,sFAAsF;AACtF,eAAO,MAAM,SAAS,QAAe,MAAM,KAAG,OAAO,CAAC,IAAI,CAA8C,CAAA;AAExG,wFAAwF;AACxF,eAAO,MAAM,WAAW,QAAe,MAAM,KAAG,OAAO,CAAC,cAAc,CAAgD,CAAA"}
|
package/build/run/index.js
CHANGED
|
@@ -1,150 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import p from 'node:path';
|
|
3
|
-
import { SlotCommandType, SlotShellCommand, TARGET_API_PORT, TARGET_WEB_PORT, TARGET_WORKER_PORT } from '@owlmeans/viable-common';
|
|
4
|
-
import { makeLocalSlotExecutor } from '../executor/index.js';
|
|
5
|
-
import { readTargetHealth } from '../executor/health.js';
|
|
6
|
-
import { integrityRefusal } from '../executor/integrity.js';
|
|
7
|
-
import { apiPath, webPath } from '../executor/layout.js';
|
|
8
|
-
import { isAlive } from '../executor/spawn.js';
|
|
9
|
-
import { createLocalServer } from './serve.js';
|
|
10
|
-
import { apiRunning, clearRun, readRun, startApi, startWorker, stopProcess, writeRun } from './state.js';
|
|
1
|
+
import { makeLocalRunHelper } from './local.js';
|
|
11
2
|
export * from './state.js';
|
|
3
|
+
export * from './process.js';
|
|
4
|
+
export * from './local.js';
|
|
12
5
|
export * from './serve.js';
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* because a developer watching their own terminal is the supervisor. What IS reproduced is the
|
|
20
|
-
* shape: the same ports, the same argv marker, the same environment, and the same "port ownership
|
|
21
|
-
* is the only proof" rule about restarts.
|
|
22
|
-
*/
|
|
23
|
-
/** Servers this process is holding, so a stop can close what a run opened. */
|
|
24
|
-
const _servers = new Map();
|
|
25
|
-
/**
|
|
26
|
-
* Build the target, start its processes, serve its browser app.
|
|
27
|
-
*
|
|
28
|
-
* A previous run is stopped first: both halves bind fixed ports, and a replacement that races the
|
|
29
|
-
* process it is replacing loses the bind and exits — with nothing announcing it, since a failed
|
|
30
|
-
* `listen` says nothing on its own.
|
|
31
|
-
*/
|
|
32
|
-
export const runLocal = async (dir, options = {}) => {
|
|
33
|
-
const root = p.resolve(dir);
|
|
34
|
-
const log = options.log ?? (() => undefined);
|
|
35
|
-
const ports = { api: TARGET_API_PORT, web: TARGET_WEB_PORT };
|
|
36
|
-
const refused = await integrityRefusal(root, 'Refused to run');
|
|
37
|
-
if (refused != null) {
|
|
38
|
-
return { record: null, ...ports, error: refused };
|
|
39
|
-
}
|
|
40
|
-
await stopLocal(root);
|
|
41
|
-
let buildError;
|
|
42
|
-
if (options.build !== false) {
|
|
43
|
-
log('Building the target project…');
|
|
44
|
-
const result = await makeLocalSlotExecutor(root, { log }).execute({
|
|
45
|
-
type: SlotCommandType.Shell, command: SlotShellCommand.Build,
|
|
46
|
-
});
|
|
47
|
-
if (result.result != null) {
|
|
48
|
-
buildError = result.result;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const record = { dir: root, startedAt: new Date().toISOString() };
|
|
52
|
-
// Only when the last build left something to spawn. Starting `bun dist/index.js` against a
|
|
53
|
-
// missing bundle fails with a message about a file rather than about the build that never
|
|
54
|
-
// produced it.
|
|
55
|
-
if (await fs.pathExists(p.resolve(apiPath(root), 'dist', 'index.js'))) {
|
|
56
|
-
record.api = await startApi(root);
|
|
57
|
-
log(`Target api started on port ${record.api.port}`);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
buildError ??= 'The target api has no build output — nothing was started.';
|
|
61
|
-
}
|
|
62
|
-
const worker = await startWorker(root);
|
|
63
|
-
if (worker != null) {
|
|
64
|
-
record.worker = worker;
|
|
65
|
-
log(`Target worker started on port ${worker.port}`);
|
|
66
|
-
}
|
|
67
|
-
const server = createLocalServer(() => p.resolve(webPath(root), 'dist'), { apiPort: TARGET_API_PORT });
|
|
68
|
-
await server.listen(TARGET_WEB_PORT);
|
|
69
|
-
_servers.set(root, server);
|
|
70
|
-
// The web server is this process, not a child: whoever called `runLocal` is holding it, and its
|
|
71
|
-
// pid is what a later `localStatus` from another process checks for liveness.
|
|
72
|
-
record.web = { pid: process.pid, port: TARGET_WEB_PORT };
|
|
73
|
-
log(`Target app served at http://localhost:${TARGET_WEB_PORT}`);
|
|
74
|
-
await writeRun(root, record);
|
|
75
|
-
return {
|
|
76
|
-
record,
|
|
77
|
-
...ports,
|
|
78
|
-
...(worker != null ? { worker: worker.port } : {}),
|
|
79
|
-
...(buildError != null ? { buildError } : {}),
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Stop whatever the run record names, and forget it.
|
|
84
|
-
*
|
|
85
|
-
* Safe to call when nothing is running: the record is the only authority, and a stale one names
|
|
86
|
-
* pids that are simply not alive. The children are detached, so they outlive the process that
|
|
87
|
-
* started them — which is exactly why the record is a file and this is the only way to end them.
|
|
88
|
-
*/
|
|
89
|
-
export const stopLocal = async (dir) => {
|
|
90
|
-
const root = p.resolve(dir);
|
|
91
|
-
const server = _servers.get(root);
|
|
92
|
-
if (server != null) {
|
|
93
|
-
_servers.delete(root);
|
|
94
|
-
await server.close();
|
|
95
|
-
}
|
|
96
|
-
const record = await readRun(root);
|
|
97
|
-
if (record == null)
|
|
98
|
-
return;
|
|
99
|
-
await stopProcess(record.worker);
|
|
100
|
-
await stopProcess(record.api);
|
|
101
|
-
await clearRun(root);
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* What is running, and whether the target is actually serving.
|
|
105
|
-
*
|
|
106
|
-
* Two independent facts, because either one alone lies. A live pid says nothing about a target
|
|
107
|
-
* that bound its port and then failed to reach its database — it answers `200` with `db.ok:false`
|
|
108
|
-
* and would otherwise read as healthy. A health answer says nothing about a process that died
|
|
109
|
-
* while something else holds the port.
|
|
110
|
-
*/
|
|
111
|
-
export const localStatus = async (dir) => {
|
|
112
|
-
const root = p.resolve(dir);
|
|
113
|
-
const record = await readRun(root);
|
|
114
|
-
if (record == null) {
|
|
115
|
-
return { running: false, processes: {} };
|
|
116
|
-
}
|
|
117
|
-
const status = {
|
|
118
|
-
running: apiRunning(record),
|
|
119
|
-
startedAt: record.startedAt,
|
|
120
|
-
processes: {},
|
|
121
|
-
};
|
|
122
|
-
if (record.api != null) {
|
|
123
|
-
const port = record.api.port ?? TARGET_API_PORT;
|
|
124
|
-
const health = await readTargetHealth(port, record.api.bootId ?? '', 2_000);
|
|
125
|
-
status.api = port;
|
|
126
|
-
status.ready = health.ready;
|
|
127
|
-
if (health.phase != null)
|
|
128
|
-
status.phase = health.phase;
|
|
129
|
-
if (!health.ready)
|
|
130
|
-
status.reason = health.reason;
|
|
131
|
-
status.processes.api = {
|
|
132
|
-
pid: record.api.pid, port, alive: isAlive(record.api.pid),
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
if (record.worker != null) {
|
|
136
|
-
const port = record.worker.port ?? TARGET_WORKER_PORT;
|
|
137
|
-
status.worker = port;
|
|
138
|
-
status.processes.worker = {
|
|
139
|
-
pid: record.worker.pid, port, alive: isAlive(record.worker.pid),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
if (record.web != null) {
|
|
143
|
-
status.web = record.web.port;
|
|
144
|
-
status.processes.web = {
|
|
145
|
-
pid: record.web.pid, port: record.web.port, alive: isAlive(record.web.pid),
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return status;
|
|
149
|
-
};
|
|
6
|
+
/** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).runLocal(…)` */
|
|
7
|
+
export const runLocal = async (dir, options = {}) => await makeLocalRunHelper(dir).runLocal(options);
|
|
8
|
+
/** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).stopLocal()` */
|
|
9
|
+
export const stopLocal = async (dir) => await makeLocalRunHelper(dir).stopLocal();
|
|
10
|
+
/** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).localStatus()` */
|
|
11
|
+
export const localStatus = async (dir) => await makeLocalRunHelper(dir).localStatus();
|
|
150
12
|
//# sourceMappingURL=index.js.map
|
package/build/run/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAG/C,cAAc,YAAY,CAAA;AAE1B,cAAc,cAAc,CAAA;AAE5B,cAAc,YAAY,CAAA;AAG1B,cAAc,YAAY,CAAA;AAI1B,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAW,EAAE,OAAO,GAAoB,EAAE,EAA2B,EAAE,CACpG,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAEjD,sFAAsF;AACtF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,GAAW,EAAiB,EAAE,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAA;AAExG,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,GAAW,EAA2B,EAAE,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { LocalRunStatus, RunLocalOptions, RunLocalResult } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Run the generated application of ONE project directory on the developer's own machine.
|
|
4
|
+
*
|
|
5
|
+
* The slot's equivalent is a pod: a publisher supervising two children and a static server, with
|
|
6
|
+
* Kubernetes underneath. None of that exists here, and the parts that were about the pod are
|
|
7
|
+
* deliberately not reproduced — there is no respawn ladder, no reconciler and no health route,
|
|
8
|
+
* because a developer watching their own terminal is the supervisor. What IS reproduced is the
|
|
9
|
+
* shape: the same ports, the same argv marker, the same environment, and the same "port ownership
|
|
10
|
+
* is the only proof" rule about restarts.
|
|
11
|
+
*/
|
|
12
|
+
export interface LocalRunHelper {
|
|
13
|
+
/**
|
|
14
|
+
* Build the target, start its processes, serve its browser app.
|
|
15
|
+
*
|
|
16
|
+
* A previous run is stopped first: both halves bind fixed ports, and a replacement that races the
|
|
17
|
+
* process it is replacing loses the bind and exits — with nothing announcing it, since a failed
|
|
18
|
+
* `listen` says nothing on its own.
|
|
19
|
+
*/
|
|
20
|
+
runLocal: (options?: RunLocalOptions) => Promise<RunLocalResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Stop whatever the run record names, and forget it.
|
|
23
|
+
*
|
|
24
|
+
* Safe to call when nothing is running: the record is the only authority, and a stale one names
|
|
25
|
+
* pids that are simply not alive. The children are detached, so they outlive the process that
|
|
26
|
+
* started them — which is exactly why the record is a file and this is the only way to end them.
|
|
27
|
+
*/
|
|
28
|
+
stopLocal: () => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* What is running, and whether the target is actually serving.
|
|
31
|
+
*
|
|
32
|
+
* Two independent facts, because either one alone lies. A live pid says nothing about a target
|
|
33
|
+
* that bound its port and then failed to reach its database — it answers `200` with `db.ok:false`
|
|
34
|
+
* and would otherwise read as healthy. A health answer says nothing about a process that died
|
|
35
|
+
* while something else holds the port.
|
|
36
|
+
*/
|
|
37
|
+
localStatus: () => Promise<LocalRunStatus>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/run/local/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAElF;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;IAChE;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B;;;;;;;OAOG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/run/local/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/run/local.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAgBtD,eAAO,MAAM,kBAAkB,QAAS,MAAM,KAAG,cA4HhD,CAAA"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import p from 'node:path';
|
|
3
|
+
import { SlotCommandType, SlotShellCommand, TARGET_API_PORT, TARGET_WEB_PORT, TARGET_WORKER_PORT } from '@owlmeans/viable-common';
|
|
4
|
+
import { makeLocalSlotExecutor } from '../executor/index.js';
|
|
5
|
+
import { healthHelper } from '../executor/health.js';
|
|
6
|
+
import { integrityHelper } from '../executor/integrity.js';
|
|
7
|
+
import { makeLayoutHelper } from '../executor/layout.js';
|
|
8
|
+
import { spawnHelper } from '../executor/spawn.js';
|
|
9
|
+
import { createLocalServer } from './serve.js';
|
|
10
|
+
import { runProcessHelper } from './process.js';
|
|
11
|
+
import { makeRunStateHelper } from './state.js';
|
|
12
|
+
/**
|
|
13
|
+
* Run the generated application on the developer's own machine.
|
|
14
|
+
*
|
|
15
|
+
* The slot's equivalent is a pod: a publisher supervising two children and a static server, with
|
|
16
|
+
* Kubernetes underneath. None of that exists here, and the parts that were about the pod are
|
|
17
|
+
* deliberately not reproduced — there is no respawn ladder, no reconciler and no health route,
|
|
18
|
+
* because a developer watching their own terminal is the supervisor. What IS reproduced is the
|
|
19
|
+
* shape: the same ports, the same argv marker, the same environment, and the same "port ownership
|
|
20
|
+
* is the only proof" rule about restarts.
|
|
21
|
+
*/
|
|
22
|
+
/** Servers this process is holding, so a stop can close what a run opened. */
|
|
23
|
+
const _servers = new Map();
|
|
24
|
+
export const makeLocalRunHelper = (dir) => {
|
|
25
|
+
const root = p.resolve(dir);
|
|
26
|
+
const layout = makeLayoutHelper(root);
|
|
27
|
+
const state = makeRunStateHelper(root);
|
|
28
|
+
const runLocal = async (options = {}) => {
|
|
29
|
+
const log = options.log ?? (() => undefined);
|
|
30
|
+
const ports = { api: TARGET_API_PORT, web: TARGET_WEB_PORT };
|
|
31
|
+
const refused = await integrityHelper.integrityRefusal(root, 'Refused to run');
|
|
32
|
+
if (refused != null) {
|
|
33
|
+
return { record: null, ...ports, error: refused };
|
|
34
|
+
}
|
|
35
|
+
await stopLocal();
|
|
36
|
+
let buildError;
|
|
37
|
+
if (options.build !== false) {
|
|
38
|
+
log('Building the target project…');
|
|
39
|
+
const result = await makeLocalSlotExecutor(root, { log }).execute({
|
|
40
|
+
type: SlotCommandType.Shell, command: SlotShellCommand.Build,
|
|
41
|
+
});
|
|
42
|
+
if (result.result != null) {
|
|
43
|
+
buildError = result.result;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const record = { dir: root, startedAt: new Date().toISOString() };
|
|
47
|
+
// Only when the last build left something to spawn. Starting `bun dist/index.js` against a
|
|
48
|
+
// missing bundle fails with a message about a file rather than about the build that never
|
|
49
|
+
// produced it.
|
|
50
|
+
if (await fs.pathExists(p.resolve(layout.apiPath(), 'dist', 'index.js'))) {
|
|
51
|
+
record.api = await state.startApi();
|
|
52
|
+
log(`Target api started on port ${record.api.port}`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
buildError ??= 'The target api has no build output — nothing was started.';
|
|
56
|
+
}
|
|
57
|
+
const worker = await state.startWorker();
|
|
58
|
+
if (worker != null) {
|
|
59
|
+
record.worker = worker;
|
|
60
|
+
log(`Target worker started on port ${worker.port}`);
|
|
61
|
+
}
|
|
62
|
+
const server = createLocalServer(() => p.resolve(layout.webPath(), 'dist'), { apiPort: TARGET_API_PORT });
|
|
63
|
+
await server.listen(TARGET_WEB_PORT);
|
|
64
|
+
_servers.set(root, server);
|
|
65
|
+
// The web server is this process, not a child: whoever called `runLocal` is holding it, and its
|
|
66
|
+
// pid is what a later `localStatus` from another process checks for liveness.
|
|
67
|
+
record.web = { pid: process.pid, port: TARGET_WEB_PORT };
|
|
68
|
+
log(`Target app served at http://localhost:${TARGET_WEB_PORT}`);
|
|
69
|
+
await state.writeRun(record);
|
|
70
|
+
return {
|
|
71
|
+
record,
|
|
72
|
+
...ports,
|
|
73
|
+
...(worker != null ? { worker: worker.port } : {}),
|
|
74
|
+
...(buildError != null ? { buildError } : {}),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const stopLocal = async () => {
|
|
78
|
+
const server = _servers.get(root);
|
|
79
|
+
if (server != null) {
|
|
80
|
+
_servers.delete(root);
|
|
81
|
+
await server.close();
|
|
82
|
+
}
|
|
83
|
+
const record = await state.readRun();
|
|
84
|
+
if (record == null)
|
|
85
|
+
return;
|
|
86
|
+
await runProcessHelper.stopProcess(record.worker);
|
|
87
|
+
await runProcessHelper.stopProcess(record.api);
|
|
88
|
+
await state.clearRun();
|
|
89
|
+
};
|
|
90
|
+
const localStatus = async () => {
|
|
91
|
+
const record = await state.readRun();
|
|
92
|
+
if (record == null) {
|
|
93
|
+
return { running: false, processes: {} };
|
|
94
|
+
}
|
|
95
|
+
const status = {
|
|
96
|
+
running: runProcessHelper.apiRunning(record),
|
|
97
|
+
startedAt: record.startedAt,
|
|
98
|
+
processes: {},
|
|
99
|
+
};
|
|
100
|
+
if (record.api != null) {
|
|
101
|
+
const port = record.api.port ?? TARGET_API_PORT;
|
|
102
|
+
const health = await healthHelper.readTargetHealth(port, record.api.bootId ?? '', 2_000);
|
|
103
|
+
status.api = port;
|
|
104
|
+
status.ready = health.ready;
|
|
105
|
+
if (health.phase != null)
|
|
106
|
+
status.phase = health.phase;
|
|
107
|
+
if (!health.ready)
|
|
108
|
+
status.reason = health.reason;
|
|
109
|
+
status.processes.api = {
|
|
110
|
+
pid: record.api.pid, port, alive: spawnHelper.isAlive(record.api.pid),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (record.worker != null) {
|
|
114
|
+
const port = record.worker.port ?? TARGET_WORKER_PORT;
|
|
115
|
+
status.worker = port;
|
|
116
|
+
status.processes.worker = {
|
|
117
|
+
pid: record.worker.pid, port, alive: spawnHelper.isAlive(record.worker.pid),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (record.web != null) {
|
|
121
|
+
status.web = record.web.port;
|
|
122
|
+
status.processes.web = {
|
|
123
|
+
pid: record.web.pid, port: record.web.port, alive: spawnHelper.isAlive(record.web.pid),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return status;
|
|
127
|
+
};
|
|
128
|
+
return { runLocal, stopLocal, localStatus };
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/run/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,CAAC,MAAM,WAAW,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAwB,MAAM,yBAAyB,CAAA;AAEvJ,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE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BACxB,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;aAC5E,CAAA;QACH,CAAC;QAED,IAAI,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAA;YAC5B,MAAM,CAAC,SAAS,CAAC,GAAG,GAAG;gBACrB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;aACvF,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,CAAA;AAC7C,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LocalProcessRecord, LocalRunRecord } from '../types.js';
|
|
2
|
+
/** The liveness of the processes a run record names. */
|
|
3
|
+
export interface RunProcessHelper {
|
|
4
|
+
/** Whether the api recorded here is still a live process. */
|
|
5
|
+
apiRunning: (record: LocalRunRecord | null) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Stop a recorded process and wait for its port to actually free.
|
|
8
|
+
*
|
|
9
|
+
* The port and not the pid is what a replacement needs, so that is what is waited on.
|
|
10
|
+
*/
|
|
11
|
+
stopProcess: (record: LocalProcessRecord | undefined) => Promise<void>;
|
|
12
|
+
/** Whether anything is answering on the api's port right now. */
|
|
13
|
+
apiListening: (port?: number) => Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/run/process/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAErE,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,KAAK,OAAO,CAAA;IACtD;;;;OAIG;IACH,WAAW,EAAE,CAAC,MAAM,EAAE,kBAAkB,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE,iEAAiE;IACjE,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/run/process/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/run/process.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,eAAO,MAAM,sBAAsB,QAAO,gBAqBzC,CAAA;AAED,eAAO,MAAM,gBAAgB,kBAA2B,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TARGET_API_PORT } from '@owlmeans/viable-common';
|
|
2
|
+
import { spawnHelper } from '../executor/spawn.js';
|
|
3
|
+
export const createRunProcessHelper = () => {
|
|
4
|
+
const apiRunning = (record) => record != null && spawnHelper.isAlive(record.api?.pid);
|
|
5
|
+
const stopProcess = async (record) => {
|
|
6
|
+
if (record == null)
|
|
7
|
+
return;
|
|
8
|
+
if (spawnHelper.isAlive(record.pid)) {
|
|
9
|
+
spawnHelper.signalGroup(record.pid, 'SIGTERM');
|
|
10
|
+
if (!await spawnHelper.waitForPortFree(record.port, 5_000)) {
|
|
11
|
+
spawnHelper.signalGroup(record.pid, 'SIGKILL');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
await spawnHelper.waitForPortFree(record.port, 5_000);
|
|
15
|
+
};
|
|
16
|
+
const apiListening = async (port = TARGET_API_PORT) => await spawnHelper.probeListening(port);
|
|
17
|
+
return { apiRunning, stopProcess, apiListening };
|
|
18
|
+
};
|
|
19
|
+
export const runProcessHelper = createRunProcessHelper();
|
|
20
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/run/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAIlD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAqB,EAAE;IAC3D,MAAM,UAAU,GAAG,CAAC,MAA6B,EAAW,EAAE,CAC5D,MAAM,IAAI,IAAI,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAExD,MAAM,WAAW,GAAG,KAAK,EAAE,MAAsC,EAAiB,EAAE;QAClF,IAAI,MAAM,IAAI,IAAI;YAAE,OAAM;QAE1B,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YAC9C,IAAI,CAAC,MAAM,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;gBAC3D,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YAChD,CAAC;QACH,CAAC;QACD,MAAM,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvD,CAAC,CAAA;IAED,MAAM,YAAY,GAAG,KAA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