@wildo-ai/platform-core-shared 1.1.10 → 1.1.12
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/dist/esm/core/resources/resources-operations.custom.shared.definitions.js.map +1 -1
- package/dist/esm/core/resources/resources-relationships.custom.shared.definitions.js.map +1 -1
- package/dist/esm/core/resources/resources-types.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/core/resources/resources-types.custom.shared.schemas.js.map +1 -1
- package/dist/esm/dev-runtime/dependency-install-record.d.ts +111 -0
- package/dist/esm/dev-runtime/dependency-install-record.d.ts.map +1 -0
- package/dist/esm/dev-runtime/dependency-install-record.js +185 -0
- package/dist/esm/dev-runtime/dependency-install-record.js.map +1 -0
- package/dist/esm/dev-runtime/dev-runtime-command.d.ts +50 -0
- package/dist/esm/dev-runtime/dev-runtime-command.d.ts.map +1 -0
- package/dist/esm/dev-runtime/dev-runtime-command.js +147 -0
- package/dist/esm/dev-runtime/dev-runtime-command.js.map +1 -0
- package/dist/esm/dev-runtime/dev-runtime-processes.d.ts +47 -0
- package/dist/esm/dev-runtime/dev-runtime-processes.d.ts.map +1 -0
- package/dist/esm/dev-runtime/dev-runtime-processes.js +163 -0
- package/dist/esm/dev-runtime/dev-runtime-processes.js.map +1 -0
- package/dist/esm/dev-runtime/dev-runtime-signals.d.ts +54 -0
- package/dist/esm/dev-runtime/dev-runtime-signals.d.ts.map +1 -0
- package/dist/esm/dev-runtime/dev-runtime-signals.js +113 -0
- package/dist/esm/dev-runtime/dev-runtime-signals.js.map +1 -0
- package/dist/esm/dev-runtime/emitted-relative-specifiers.d.ts +14 -0
- package/dist/esm/dev-runtime/emitted-relative-specifiers.d.ts.map +1 -0
- package/dist/esm/dev-runtime/emitted-relative-specifiers.js +71 -0
- package/dist/esm/dev-runtime/emitted-relative-specifiers.js.map +1 -0
- package/dist/esm/dev-runtime/frontend-dev-runtime.d.ts +43 -0
- package/dist/esm/dev-runtime/frontend-dev-runtime.d.ts.map +1 -0
- package/dist/esm/dev-runtime/frontend-dev-runtime.js +42 -0
- package/dist/esm/dev-runtime/frontend-dev-runtime.js.map +1 -0
- package/dist/esm/dev-runtime/node-runtime-dev-supervisor.d.ts +233 -0
- package/dist/esm/dev-runtime/node-runtime-dev-supervisor.d.ts.map +1 -0
- package/dist/esm/dev-runtime/node-runtime-dev-supervisor.js +578 -0
- package/dist/esm/dev-runtime/node-runtime-dev-supervisor.js.map +1 -0
- package/dist/esm/dev-runtime/package-compile-loop.d.ts +125 -0
- package/dist/esm/dev-runtime/package-compile-loop.d.ts.map +1 -0
- package/dist/esm/dev-runtime/package-compile-loop.js +386 -0
- package/dist/esm/dev-runtime/package-compile-loop.js.map +1 -0
- package/dist/esm/dev-runtime.exports.d.ts +19 -0
- package/dist/esm/dev-runtime.exports.d.ts.map +1 -0
- package/dist/esm/dev-runtime.exports.js +19 -0
- package/dist/esm/dev-runtime.exports.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/runtime/application-backend-env.contracts.d.ts +16 -2
- package/dist/esm/runtime/application-backend-env.contracts.d.ts.map +1 -1
- package/dist/esm/runtime/application-backend-env.contracts.js +20 -1
- package/dist/esm/runtime/application-backend-env.contracts.js.map +1 -1
- package/dist/esm/runtime/application-worker-env.contracts.d.ts +14 -4
- package/dist/esm/runtime/application-worker-env.contracts.d.ts.map +1 -1
- package/dist/esm/runtime/application-worker-env.contracts.js +12 -0
- package/dist/esm/runtime/application-worker-env.contracts.js.map +1 -1
- package/dist/esm/runtime/backend-start-outcome.contracts.d.ts +27 -0
- package/dist/esm/runtime/backend-start-outcome.contracts.d.ts.map +1 -1
- package/dist/esm/runtime/backend-start-outcome.contracts.js +34 -0
- package/dist/esm/runtime/backend-start-outcome.contracts.js.map +1 -1
- package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.d.ts +28 -0
- package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.d.ts.map +1 -0
- package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.js +35 -0
- package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.js.map +1 -0
- package/dist/esm/runtime/http-server-env.contracts.d.ts +14 -1
- package/dist/esm/runtime/http-server-env.contracts.d.ts.map +1 -1
- package/dist/esm/runtime/http-server-env.contracts.js +13 -0
- package/dist/esm/runtime/http-server-env.contracts.js.map +1 -1
- package/dist/esm/runtime/local-dev-runtime-signals.contracts.d.ts +239 -0
- package/dist/esm/runtime/local-dev-runtime-signals.contracts.d.ts.map +1 -0
- package/dist/esm/runtime/local-dev-runtime-signals.contracts.js +256 -0
- package/dist/esm/runtime/local-dev-runtime-signals.contracts.js.map +1 -0
- package/dist/esm/runtime/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/security/authorizations/roles.custom.shared.definitions.js.map +1 -1
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.d.ts +362 -36
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.js +4 -3
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.d.ts +400 -37
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.js +107 -1
- package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.js.map +1 -1
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.d.ts +26 -26
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.js +4 -3
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.d.ts +33 -27
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.js +26 -2
- package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.js.map +1 -1
- package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.d.ts +3 -3
- package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.js +30 -42
- package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.d.ts +9 -9
- package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.js.map +1 -1
- package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.d.ts +7 -7
- package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/creation-drive.custom.shared.schemas.d.ts +52 -0
- package/dist/esm/workbench/creation-drive.custom.shared.schemas.d.ts.map +1 -0
- package/dist/esm/workbench/creation-drive.custom.shared.schemas.js +49 -0
- package/dist/esm/workbench/creation-drive.custom.shared.schemas.js.map +1 -0
- package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.d.ts +183 -0
- package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.d.ts.map +1 -0
- package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.js +188 -0
- package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.js.map +1 -0
- package/dist/esm/workbench/workbench-aspect-resources.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-aspect-resources.custom.shared.schemas.js +76 -0
- package/dist/esm/workbench/workbench-aspect-resources.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.d.ts +170 -7
- package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.js +177 -7
- package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-creation-conversation.custom.shared.schemas.d.ts +21 -3
- package/dist/esm/workbench/workbench-creation-conversation.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-creation-conversation.custom.shared.schemas.js +7 -0
- package/dist/esm/workbench/workbench-creation-conversation.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-creation-dossier.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-creation-dossier.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.d.ts +611 -405
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.js +98 -17
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.d.ts +821 -240
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.js +795 -41
- package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-domain-model.custom.shared.schemas.d.ts +34 -0
- package/dist/esm/workbench/workbench-domain-model.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-domain-model.custom.shared.schemas.js +31 -0
- package/dist/esm/workbench/workbench-domain-model.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.d.ts +14 -2
- package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.js +25 -3
- package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.d.ts +353 -250
- package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.js +1 -0
- package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/workbench/workbench-resources.custom.shared.schemas.d.ts +34 -29
- package/dist/esm/workbench/workbench-resources.custom.shared.schemas.d.ts.map +1 -1
- package/dist/esm/workbench/workbench-resources.custom.shared.schemas.js +9 -5
- package/dist/esm/workbench/workbench-resources.custom.shared.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +13 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runtime-dev-supervisor.js","sourceRoot":"","sources":["../../../src/dev-runtime/node-runtime-dev-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,mBAAmB,EACnB,gCAAgC,GAEjC,MAAM,4CAA4C,CAAC;AACpD,OAA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 'node:crypto';\nimport { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative, resolve } from 'node:path';\n\nimport {\n BACKEND_START_OUTCOME_DIRECTORY,\n BackendStartFailureCause,\n BackendStartOutcome,\n BackendStartOutcomeRecord_Schema,\n type BackendStartOutcomeRecord,\n} from '../runtime/backend-start-outcome.contracts';\nimport {\n APPLICATION_RUNTIME_SIGNALS_RELATIVE_DIRECTORY,\n LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION,\n LOCAL_DEV_SUPERVISOR_OBSERVATION_KIND,\n LocalDevCompileState,\n LocalDevSupervisorBlocker,\n LocalDevSupervisorState,\n type LocalDevCompileObservation,\n type LocalDevPortHolder,\n type LocalDevSupervisorObservation,\n} from '../runtime/local-dev-runtime-signals.contracts';\nimport {\n compileObservationPath,\n isLiveCompileObservation,\n isLiveSupervisorObservation,\n readCompileObservation,\n readSupervisorObservation,\n runtimeRestartSignalPath,\n supervisorObservationPath,\n writeRuntimeSignalRecord,\n} from './dev-runtime-signals';\nimport { identifyPortHolder, isProcessAlive, killProcessGroupNow, readProcessIdentity, terminateProcessGroup, usesProcessGroups } from './dev-runtime-processes';\nimport {\n classifyDependencyInstall,\n decideRuntimeAfterDependencyInstall,\n readDependencyInstallRecord,\n RuntimeDependencyInstallDecision,\n} from './dependency-install-record';\nimport { LocalDevDependencyInstallPhase } from '../runtime/local-dev-runtime-signals.contracts';\nimport type { PackageCompileLoop } from './package-compile-loop';\n\n/**\n * The dev supervisor of one NODE RUNTIME of an app-creator install — the backend, a minion, a node worker (#3214, #3215,\n * #3216, #3257).\n *\n * It owns the runtime's process the way the monorepo's `runtime-supervisor.mjs` does for a framework developer, and keeps\n * the promises the old `tsc-watch --onSuccess \"node dist/index.js\"` could not. They are written about the backend, where\n * every one of them was measured; each holds for any runtime it supervises, see below:\n *\n * 1. **It starts the backend only on PUBLISHED builds.** The backend's own package and every workspace package it\n * depends on must report `READY` (emitted, rewritten, verified — see `PackageCompileLoop`). A backend therefore never\n * starts between `tsc` and its alias pass, which is how `ERR_MODULE_NOT_FOUND` reached it (#3216).\n * 2. **It restarts the backend when ANY package it loads publishes a newer build**, the shared library included. Before\n * this, only a change to the backend's own sources restarted it, and a fix landed in the shared library left the\n * backend down on a tree that already booted (#3215).\n * 3. **It owns the backend's process group**: the child leads its own group, and a restart or a stop signals the whole\n * group. A second supervisor for the same package refuses to start, and a backend an earlier generation left behind\n * (its supervisor killed outright) is stopped before a new one starts (#3214).\n * 4. **A port another process holds is named, not retried into the ground.** When a start fails binding its port, the\n * supervisor asks the operating system who listens there. The orphan of an earlier generation — `node <entry>` in this\n * package — is stopped and the backend restarted; anything else pauses the supervisor with\n * `PORT_HELD_BY_FOREIGN_PROCESS`, the holder's pid, parent, start time and working directory in its record and its\n * log, and the backend starts the moment the port is free.\n * 5. **A crash recovers by itself on the next build, and a dependency outage by itself (#3365).** A failed start is\n * respawned with a bounded backoff. A spent budget pauses the supervisor only when the start record says the\n * backend's own startup refused; the next published build of any package it loads starts it again. Any other cause\n * (a dependency that did not answer, or no record) crash-loops: the delay keeps doubling up to\n * {@link CRASH_LOOP_MAX_DELAY_MS} and never stops, so a database that comes back brings the backend back. A child\n * resets the budget only once its own start record says it STARTED — or, for a runtime that writes no start record\n * at all, once it stayed up {@link DEFAULT_HEALTHY_UPTIME_WITHOUT_START_RECORD_MS}.\n * 6. **Nothing outlives it.** A stop terminates the backend and the compiler in parallel; an exit without one (an\n * uncaught error, a forced stop) kills both groups synchronously on the way out.\n *\n * Its state is published at `<app>/.wildo-saas/runtime-signals/supervisors/<label>.json`, the record the dev companion's\n * boot guard already reads, so a paused backend is visible to the build lane in this mode too.\n *\n * 7. **A restart can be ASKED for (#2134).** The supervisor creates `<app>/.wildo-saas/runtime-signals/<label>.signal`,\n * names it in its record (`signalFilePath`), and restarts the runtime when the file's modification time changes, on\n * the build it is already running, with a fresh crash budget. That is the door `wildo secrets set` uses: it regenerates\n * the runtime's `.env` and touches the signal of every runtime that reads the key and whose supervisor is live, so the\n * restarted process reads the new value. Before this the backend of a created application kept its boot-time value\n * until `wildo local dev` was restarted, because this supervisor honoured no request and the CLI found no signal.\n * A request arriving while a package it loads is not publishable waits for it, like any start (promise 1); one\n * arriving while paused or backing off starts the runtime now; one arriving while a foreign process holds the port\n * re-checks the port now. The same file the monorepo's `runtime-supervisor.mjs` honours under the same name, so the\n * CLI needs no branch per mode.\n *\n * Rejected: a route per runtime that reloads its environment in place, as the companion has\n * (`POST /api/companion/runtime/env/apply`). The backend's configuration is read once into services built at boot\n * (provider clients, the mailer), so reloading `process.env` would change nothing they hold, and every runtime would\n * need its own. A restart is the one remedy that is right for every runtime.\n *\n * ## Why one supervisor for every node runtime (#3257)\n *\n * Promises 1, 2, 3, 5 and 6 say nothing about HTTP, so a minion and a node worker get them by construction rather than\n * through a copy that would drift: they start only on published builds of every workspace package they load (the\n * shared library, and the backend whose companion exports a minion imports), restart when one of them publishes, and\n * own their process group, so `wildo local dev` stopping leaves none of them re-parented to init.\n *\n * Promise 4 is the one backend-shaped decision, and it is taken from the START RECORD the engine's\n * `StartApplicationBackendService.initialize` writes for the process (`failureCause: port-in-use`, with the port),\n * looked up by the child's pid. A runtime whose start writes no such record never enters the branch; nothing has to be\n * switched off. A minion binds no port and so never writes that cause. A node worker listens on its declared port and\n * records its start through the same writer since #3288 (`StartWorkerApplicationBackendService.initialize`, filed as\n * `workers.<name>`), so a port another process holds is named for it exactly as for the backend. The orphan of a\n * supervisor killed outright is also stopped at {@link NodeRuntimeDevSupervisor.start}, through the supervisor record.\n *\n * The crash budget's reset (promise 5) also keys on the start record. The backend, a minion and a node worker all write\n * one, but none does when its environment carries no runtime-signals home (a `.env` generated before #3288, an\n * environment that is not LOCAL), and a child that dies before its bootstrap reaches the writer leaves none. Such a\n * runtime would otherwise never reset the budget: five crashes spread over a day would spend it.\n * For a process that left NO record at all, staying up {@link DEFAULT_HEALTHY_UPTIME_WITHOUT_START_RECORD_MS}\n * counts as having started. Uptime stays out of the decision whenever a record exists, which is the case the uptime\n * rule was wrong for (a start refused after twenty seconds of registry initialization).\n */\n\nexport const CRASH_RESPAWN_MAX_ATTEMPTS = 5;\n/**\n * How long a child that wrote NO start record must stay up before its exit counts as a fresh failure with a fresh\n * budget. Only consulted when the process left no record at all; see the class JSDoc.\n */\nexport const DEFAULT_HEALTHY_UPTIME_WITHOUT_START_RECORD_MS = 60_000;\nconst CRASH_RESPAWN_BASE_DELAY_MS = 1_000;\nconst CRASH_RESPAWN_MAX_DELAY_MS = 30_000;\n/**\n * The crash-loop cap (#3365): past the budget, a crash whose cause is a dependency (or cannot be told) keeps being\n * restarted with the delay doubling up to five minutes, Kubernetes' CrashLoopBackOff ceiling, and never stops.\n */\nexport const CRASH_LOOP_MAX_DELAY_MS = 300_000;\n\n/** The cause a crash-loop log line names, from the crashed child's start record. */\nfunction describeCrashLoopCause(started: { readonly outcome: BackendStartOutcome; readonly failureCause?: BackendStartFailureCause } | undefined): string {\n if (started?.failureCause === BackendStartFailureCause.DEPENDENCY_UNREACHABLE) return 'a service it connects to did not answer or was not ready';\n if (started?.failureCause === BackendStartFailureCause.PORT_IN_USE) return 'its port was held and no holder could be identified';\n return started === undefined ? 'it left no start record' : 'its start record names no cause';\n}\n\n/**\n * Whether a spent crash budget may PAUSE the runtime (#3365): only when its own start record says its startup refused,\n * which a new build is what fixes. A dependency that did not answer or was not ready yet (`dependency-unreachable`,\n * #3377), and a crash that left\n * no record or one from an engine that names no cause, crash-loop instead: a database that comes back must bring its\n * runtime back by itself. A port held by another process is decided before the budget is read (promise 4).\n */\nexport function spentCrashBudgetPauses(started: { readonly outcome: BackendStartOutcome; readonly failureCause?: BackendStartFailureCause } | undefined): boolean {\n return started?.outcome === BackendStartOutcome.FAILED && started.failureCause === BackendStartFailureCause.STARTUP_REFUSED;\n}\n\nexport interface NodeRuntimeDevSupervisorOptions {\n readonly appRoot: string;\n readonly packageRoot: string;\n readonly packageName: string;\n /**\n * The runtime's name in the dev loop and the supervisor record's file name: `backend-api` for the backend, the\n * minion's or worker's directory name otherwise. Two runtimes of one application must never share it — the record\n * is how a second supervisor of the same runtime is refused.\n */\n readonly label: string;\n /** The entry module, absolute or relative to the package root (`dist/index.js`). */\n readonly entry: string;\n /** Arguments for `node` before the entry (`--import`, `--enable-source-maps`). */\n readonly nodeArguments?: readonly string[];\n /** The runtime package's own compiler, run in this process. */\n readonly compileLoop: Pick<PackageCompileLoop, 'observation' | 'start' | 'stop' | 'killChildrenNow'>;\n /** The workspace packages the runtime imports, whose compilers run in their own dev processes. */\n readonly dependencyPackageNames: readonly string[];\n /** How long to wait for a dependency's compile record before starting on the `dist` already on disk. */\n readonly absentDependencyGraceMs?: number;\n readonly pollIntervalMs?: number;\n /** How long a new build must be settled before the runtime restarts on it (a burst of compilations restarts it once). */\n readonly restartDebounceMs?: number;\n /** See {@link DEFAULT_HEALTHY_UPTIME_WITHOUT_START_RECORD_MS}. */\n readonly healthyUptimeWithoutStartRecordMs?: number;\n readonly portRecheckIntervalMs?: number;\n readonly log?: (line: string) => void;\n}\n\n/** Whether the packages a runtime loads are publishable, and the newest build among them. Pure. */\nexport function assessRuntimeBuilds(input: {\n readonly own: LocalDevCompileObservation;\n readonly dependencies: ReadonlyArray<{ readonly packageName: string; readonly observation: LocalDevCompileObservation | undefined }>;\n readonly dependencyGraceElapsed: boolean;\n}): { readonly ready: boolean; readonly waitingFor: string | null; readonly newestBuildAtMs: number } {\n let newestBuildAtMs = 0;\n let waitingFor: string | null = null;\n const consider = (packageName: string, observation: LocalDevCompileObservation): void => {\n const builtAtMs = observation.lastSuccessfulCompileAt ? Date.parse(observation.lastSuccessfulCompileAt) : 0;\n if (builtAtMs > newestBuildAtMs) newestBuildAtMs = builtAtMs;\n if (waitingFor === null && observation.state !== LocalDevCompileState.READY) waitingFor = `${packageName} (${observation.state})`;\n };\n consider(input.own.packageName, input.own);\n for (const dependency of input.dependencies) {\n if (dependency.observation) consider(dependency.packageName, dependency.observation);\n else if (!input.dependencyGraceElapsed && waitingFor === null) waitingFor = `${dependency.packageName} (no compiler record yet)`;\n }\n return { ready: waitingFor === null, waitingFor, newestBuildAtMs };\n}\n\n/**\n * Is the process on the port an orphaned runtime of THIS package — `node … <entry>` whose working directory is the\n * package root — rather than something the supervisor must not touch? Pure.\n */\nexport function isOrphanedRuntimeOfPackage(holder: Pick<LocalDevPortHolder, 'cwd' | 'command'>, input: { readonly packageRoot: string; readonly entry: string }): boolean {\n if (holder.cwd === null || resolve(holder.cwd) !== resolve(input.packageRoot)) return false;\n const command = holder.command ?? '';\n const entryRelative = relative(input.packageRoot, resolve(input.packageRoot, input.entry));\n return /\\bnode\\b/u.test(command) && (command.includes(entryRelative) || command.includes(resolve(input.packageRoot, input.entry)));\n}\n\n/** The start record this runtime process wrote, if any (the supervisor reads it to learn why a start failed). */\nexport function readBackendStartRecordOfProcess(appRoot: string, pid: number): BackendStartOutcomeRecord | undefined {\n const directory = join(appRoot, APPLICATION_RUNTIME_SIGNALS_RELATIVE_DIRECTORY, BACKEND_START_OUTCOME_DIRECTORY);\n let entries: string[];\n try {\n entries = readdirSync(directory).filter((name) => name.endsWith('.json'));\n } catch {\n return undefined;\n }\n for (const entry of entries) {\n try {\n const parsed = BackendStartOutcomeRecord_Schema.safeParse(JSON.parse(readFileSync(join(directory, entry), 'utf8')));\n if (parsed.success && parsed.data.pid === pid) return parsed.data;\n } catch {\n // A record mid-rename is the next poll's.\n }\n }\n return undefined;\n}\n\nexport class NodeRuntimeDevSupervisor {\n private readonly recordPath: string;\n private readonly entryPath: string;\n private readonly log: (line: string) => void;\n private readonly startedAtMs = Date.now();\n private record: LocalDevSupervisorObservation;\n private child: ChildProcess | null = null;\n private childStartedAtMs = 0;\n private expectedExit = new WeakSet<ChildProcess>();\n private stopping = false;\n /**\n * Held while ONE decision runs — a poll, or the handling of a child's exit. Both start children, so they must never\n * interleave: a poll that spawned while an exit handler was stopping an orphan would put a second runtime on the port,\n * and that one's failure would then name the first as the orphan.\n */\n private busy = false;\n private pollTimer: NodeJS.Timeout | null = null;\n private heartbeatTimer: NodeJS.Timeout | null = null;\n private backoffTimer: NodeJS.Timeout | null = null;\n private crashCount = 0;\n /** The newest build the supervisor was paused against; a build newer than it lifts a crash pause. */\n private pausedAgainstBuildAtMs: number | null = null;\n private heldPort: number | null = null;\n private lastPortCheckAtMs = 0;\n private lastWaitingFor: string | null = null;\n private loggedAbsentDependencies = false;\n /** The restart-request file (promise 7) and its modification time when last read; `null` while it cannot be read. */\n private readonly signalPath: string;\n private lastSignalStamp: number | null = null;\n /** A restart was asked for and is not served yet: the next start serves it. */\n private restartRequested = false;\n /**\n * The dependency install (#3552) this supervisor already acted on, by its key. Seeded at {@link start} with an install\n * that had already ended, so a supervisor started after an install never relaunches onto it.\n */\n private handledInstallKey: string | null = null;\n /** Whether the current install hold has been logged, so a 16 s install logs once rather than every poll. */\n private loggedInstallHold = false;\n\n public constructor(private readonly options: NodeRuntimeDevSupervisorOptions) {\n this.recordPath = supervisorObservationPath(options.appRoot, options.label);\n this.signalPath = runtimeRestartSignalPath(options.appRoot, options.label);\n this.entryPath = resolve(options.packageRoot, options.entry);\n this.log = options.log ?? ((line) => process.stdout.write(`[wildo-dev-runtime] ${options.label}: ${line}\\n`));\n const now = new Date().toISOString();\n this.record = {\n kind: LOCAL_DEV_SUPERVISOR_OBSERVATION_KIND,\n schemaVersion: LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION,\n producerKind: 'wildo-dev-runtime',\n producerInstanceId: randomUUID(),\n producerPid: process.pid,\n frameworkRoot: null,\n appRoot: options.appRoot,\n label: options.label,\n runtimeTarget: options.packageName,\n workingDirectory: options.packageRoot,\n state: LocalDevSupervisorState.STARTING,\n childPid: null,\n childStartedAt: null,\n retryCount: 0,\n blocker: null,\n portHolder: null,\n signalFilePath: this.signalPath,\n heartbeatAt: now,\n updatedAt: now,\n };\n }\n\n public get observation(): LocalDevSupervisorObservation {\n return this.record;\n }\n\n /**\n * Start supervising. REFUSES when another live supervisor already owns this runtime: two runtimes of one package is\n * the defect this exists to prevent. A runtime left by a dead supervisor is stopped first.\n */\n public async start(): Promise<void> {\n const previous = readSupervisorObservation(this.recordPath);\n if (previous && previous.producerPid !== process.pid && isLiveSupervisorObservation(previous)) {\n throw new Error(`A supervisor already runs ${this.options.label} (process ${previous.producerPid}, ${this.recordPath}). Stop that dev process first: a second one would start a second runtime.`);\n }\n if (previous?.childPid && isProcessAlive(previous.childPid)) {\n const identity = readProcessIdentity(previous.childPid);\n if (identity && isOrphanedRuntimeOfPackage(identity, { packageRoot: this.options.packageRoot, entry: this.options.entry })) {\n this.log(`stopping the runtime an earlier dev run left behind (pid ${previous.childPid}, parent ${identity.ppid ?? 'unknown'}, started ${identity.startedAt ?? 'unknown'})`);\n await terminateProcessGroup(previous.childPid);\n }\n }\n this.prepareRestartSignal();\n const installAtStart = classifyDependencyInstall(readDependencyInstallRecord(this.options.appRoot), Date.now());\n if (installAtStart.phase === LocalDevDependencyInstallPhase.ENDED) this.handledInstallKey = installAtStart.key;\n this.publish({ state: LocalDevSupervisorState.STARTING, blocker: null });\n this.heartbeatTimer = setInterval(() => this.publish({}), 5_000);\n this.heartbeatTimer.unref();\n await this.options.compileLoop.start();\n // A stop that arrived while the compiler was starting wins: nothing more is started.\n if (this.stopping) return;\n this.pollTimer = setInterval(() => void this.serialized(() => this.decide()), this.options.pollIntervalMs ?? 500);\n await this.serialized(() => this.decide());\n }\n\n /** Stop the runtime and the compiler, IN PARALLEL so a caller's stop deadline covers both. */\n public async stop(): Promise<void> {\n if (this.stopping) return;\n this.stopping = true;\n for (const timer of [this.pollTimer, this.heartbeatTimer, this.backoffTimer]) if (timer) clearTimeout(timer);\n await Promise.all([this.stopChild(3_000), this.options.compileLoop.stop()]);\n this.publish({ state: LocalDevSupervisorState.STOPPED, childPid: null, blocker: null });\n }\n\n /**\n * Kill the runtime and the compiler synchronously: the last act of a supervisor that is exiting without a clean stop\n * (an uncaught error, a forced stop), so neither outlives it re-parented to init (#3214).\n */\n public killChildrenNow(): void {\n killProcessGroupNow(this.child?.pid);\n this.options.compileLoop.killChildrenNow();\n }\n\n private publish(updates: Partial<LocalDevSupervisorObservation>): void {\n const now = new Date().toISOString();\n const transition = Object.keys(updates).length > 0;\n this.record = { ...this.record, ...updates, retryCount: this.crashCount, heartbeatAt: now, ...(transition ? { updatedAt: now } : {}) };\n try {\n writeRuntimeSignalRecord(this.recordPath, this.record);\n } catch (error) {\n this.log(`could not publish the supervisor record (${(error as Error).message})`);\n }\n }\n\n /** Run one decision at a time (see {@link busy}); a decision asked for while one runs is dropped, the next poll asks again. */\n private async serialized(work: () => Promise<void>): Promise<void> {\n if (this.stopping || this.busy) return;\n this.busy = true;\n try {\n await work();\n } finally {\n this.busy = false;\n }\n }\n\n /**\n * Create the restart-request file when absent, and take its current modification time as the baseline, so only a\n * change made AFTER this supervisor started is a request. A file the supervisor cannot create leaves the runtime\n * supervised as before, with the reason logged: a missing door must never stop the runtime.\n */\n private prepareRestartSignal(): void {\n try {\n if (!existsSync(this.signalPath)) {\n mkdirSync(dirname(this.signalPath), { recursive: true, mode: 0o700 });\n writeFileSync(this.signalPath, 'initial\\n', { encoding: 'utf8', mode: 0o600 });\n }\n } catch (error) {\n this.log(`could not create the restart signal ${this.signalPath} (${(error as Error).message}); a restart cannot be requested`);\n }\n this.lastSignalStamp = this.readSignalStamp();\n }\n\n private readSignalStamp(): number | null {\n try {\n return statSync(this.signalPath).mtimeMs;\n } catch {\n return null;\n }\n }\n\n /** Whether the restart-request file changed since it was last read (promise 7). A file that vanished asks nothing. */\n private takeRestartRequest(): boolean {\n const stamp = this.readSignalStamp();\n if (stamp === null || stamp === this.lastSignalStamp) {\n if (stamp !== null) this.lastSignalStamp = stamp;\n return false;\n }\n this.lastSignalStamp = stamp;\n return true;\n }\n\n /** The workspace dependencies' compile records, a record nobody live stands behind read as absent. */\n private readDependencyObservations(nowMs: number): Array<{ packageName: string; observation: LocalDevCompileObservation | undefined }> {\n return this.options.dependencyPackageNames.map((packageName) => {\n const observation = readCompileObservation(compileObservationPath(this.options.appRoot, packageName));\n return { packageName, observation: observation !== undefined && isLiveCompileObservation(observation, nowMs) ? observation : undefined };\n });\n }\n\n private async decide(): Promise<void> {\n const nowMs = Date.now();\n const dependencyGraceElapsed = nowMs - this.startedAtMs >= (this.options.absentDependencyGraceMs ?? 30_000);\n const dependencies = this.readDependencyObservations(nowMs);\n if (dependencyGraceElapsed && !this.loggedAbsentDependencies) {\n const absent = dependencies.filter((dependency) => dependency.observation === undefined).map((dependency) => dependency.packageName);\n if (absent.length > 0) {\n this.loggedAbsentDependencies = true;\n this.log(`no live compiler reports for ${absent.join(', ')} (is its dev process running?); starting on the dist already on disk, and the runtime will not be restarted when it changes`);\n }\n }\n const builds = assessRuntimeBuilds({ own: this.options.compileLoop.observation, dependencies, dependencyGraceElapsed });\n\n if (this.applyDependencyInstall(nowMs) === RuntimeDependencyInstallDecision.HOLD) return;\n\n if (this.takeRestartRequest()) {\n this.restartRequested = true;\n this.log(`a restart was requested (${this.signalPath} changed); the next start serves it, so the runtime reads its environment again`);\n // A request re-checks a held port now, and lifts a crash pause: whoever asked expects an attempt, not a wait.\n this.lastPortCheckAtMs = 0;\n if (this.pausedAgainstBuildAtMs !== null) {\n this.pausedAgainstBuildAtMs = null;\n this.crashCount = 0;\n }\n }\n\n if (this.heldPort !== null) {\n if (nowMs - this.lastPortCheckAtMs < (this.options.portRecheckIntervalMs ?? 5_000)) return;\n this.lastPortCheckAtMs = nowMs;\n const holder = await identifyPortHolder(this.heldPort);\n if (holder !== null) {\n this.publish({ state: LocalDevSupervisorState.PAUSED, blocker: LocalDevSupervisorBlocker.PORT_HELD_BY_FOREIGN_PROCESS, portHolder: holder });\n return;\n }\n this.log(`port ${this.heldPort} is free again; starting the runtime`);\n this.heldPort = null;\n this.crashCount = 0;\n this.publish({ portHolder: null, blocker: null });\n }\n\n if (this.pausedAgainstBuildAtMs !== null) {\n if (builds.newestBuildAtMs <= this.pausedAgainstBuildAtMs) return;\n this.log('a newer build was published; starting the runtime again');\n this.pausedAgainstBuildAtMs = null;\n this.crashCount = 0;\n }\n\n if (!builds.ready) {\n if (this.child === null && this.lastWaitingFor !== builds.waitingFor) {\n this.lastWaitingFor = builds.waitingFor;\n this.log(`waiting for ${builds.waitingFor} to publish before starting the runtime`);\n this.publish({ state: LocalDevSupervisorState.STARTING, blocker: `WAITING_FOR_BUILD ${builds.waitingFor}` });\n }\n // A running runtime keeps serving its last good build until every package it loads is publishable again.\n return;\n }\n this.lastWaitingFor = null;\n\n if (this.child !== null) {\n if (this.restartRequested) {\n this.crashCount = 0;\n await this.stopChild();\n this.spawnChild();\n return;\n }\n const settled = nowMs - builds.newestBuildAtMs >= (this.options.restartDebounceMs ?? 750);\n if (builds.newestBuildAtMs > this.childStartedAtMs && settled) {\n this.log('a package the runtime loads published a newer build; restarting the runtime');\n this.crashCount = 0;\n await this.stopChild();\n this.spawnChild();\n }\n return;\n }\n if (this.backoffTimer !== null) {\n // A build newer than the start that crashed is what a backoff waits for: start on it now, with a fresh budget.\n // So is a requested restart (promise 7).\n if (builds.newestBuildAtMs <= this.childStartedAtMs && !this.restartRequested) return;\n clearTimeout(this.backoffTimer);\n this.backoffTimer = null;\n this.crashCount = 0;\n }\n this.spawnChild();\n }\n\n /**\n * A dependency install is a stack event (#3552). While one re-creates `node_modules`, nothing is started or restarted:\n * a start would read a half-installed tree, and a running runtime keeps serving what it loaded. When it ends, the\n * runtime is relaunched with a fresh crash budget — it loaded modules from the tree the install replaced, and a crash\n * the install caused must not leave it paused. The relaunch waits, like every start, until every package it loads is\n * publishable again (the compile loops recompile after an install too).\n */\n private applyDependencyInstall(nowMs: number): RuntimeDependencyInstallDecision {\n const install = classifyDependencyInstall(readDependencyInstallRecord(this.options.appRoot), nowMs);\n const decision = decideRuntimeAfterDependencyInstall({ install, runtimeStartedAtMs: this.childStartedAtMs, handledInstallKey: this.handledInstallKey });\n if (decision === RuntimeDependencyInstallDecision.HOLD) {\n if (!this.loggedInstallHold) {\n this.loggedInstallHold = true;\n this.log('a dependency install is re-creating node_modules; the runtime is held until it ends');\n }\n if (this.child === null) this.publish({ state: LocalDevSupervisorState.PAUSED, childPid: null, blocker: LocalDevSupervisorBlocker.DEPENDENCY_INSTALL_IN_FLIGHT });\n return decision;\n }\n this.loggedInstallHold = false;\n if (install.phase === LocalDevDependencyInstallPhase.ENDED) this.handledInstallKey = install.key;\n if (decision === RuntimeDependencyInstallDecision.RELAUNCH) {\n this.log('a dependency install ended after the runtime started; relaunching it on the installed tree with a fresh crash budget');\n this.restartRequested = true;\n this.crashCount = 0;\n this.pausedAgainstBuildAtMs = null;\n if (this.child === null) this.publish({ state: LocalDevSupervisorState.STARTING, blocker: null });\n }\n return decision;\n }\n\n private spawnChild(): void {\n if (this.stopping) return;\n // Any start reads the environment afresh, so it serves a pending restart request.\n this.restartRequested = false;\n const child = spawn(process.execPath, [...(this.options.nodeArguments ?? []), this.entryPath], {\n cwd: this.options.packageRoot,\n detached: usesProcessGroups(),\n stdio: ['ignore', 'inherit', 'inherit'],\n });\n this.child = child;\n this.childStartedAtMs = Date.now();\n const spawnedAtMs = this.childStartedAtMs;\n this.publish({ state: LocalDevSupervisorState.RUNNING, childPid: child.pid ?? null, childStartedAt: new Date(spawnedAtMs).toISOString(), blocker: null });\n // Uptime is taken when the child EXITS, not when the exit is handled: handling may wait out a decision that runs `lsof`\n // or stops a process group, which would otherwise count as time the child stayed up.\n child.once('exit', (code, signal) => void this.handleChildExitWhenFree(child, code, signal, Date.now() - spawnedAtMs));\n }\n\n private async stopChild(graceMs?: number): Promise<void> {\n const child = this.child;\n if (child === null) return;\n this.child = null;\n this.expectedExit.add(child);\n if (child.pid) await terminateProcessGroup(child.pid, graceMs);\n }\n\n /** An exit is a decision too: it waits for a running poll to finish rather than interleave with it (see {@link busy}). */\n private async handleChildExitWhenFree(child: ChildProcess, code: number | null, signal: NodeJS.Signals | null, uptimeMs: number): Promise<void> {\n while (this.busy && !this.stopping) await new Promise((resolve) => setTimeout(resolve, 20));\n await this.serialized(() => this.handleChildExit(child, code, signal, uptimeMs));\n }\n\n private async handleChildExit(child: ChildProcess, code: number | null, signal: NodeJS.Signals | null, uptimeMs: number): Promise<void> {\n if (this.expectedExit.has(child) || this.stopping) return;\n if (this.child === child) this.child = null;\n const started = child.pid ? readBackendStartRecordOfProcess(this.options.appRoot, child.pid) : undefined;\n if (started?.outcome === BackendStartOutcome.FAILED && started.failureCause === BackendStartFailureCause.PORT_IN_USE && started.port) {\n const holder = await identifyPortHolder(started.port);\n // Never this supervisor's own current child: only a process it did not start can be an orphan or a foreigner.\n const ownChild = holder !== null && holder.pid !== null && holder.pid === this.child?.pid;\n if (holder !== null && !ownChild && holder.pid !== null && isOrphanedRuntimeOfPackage(holder, { packageRoot: this.options.packageRoot, entry: this.options.entry })) {\n this.log(`port ${started.port} is held by a runtime an earlier dev run left behind (pid ${holder.pid}, parent ${holder.ppid ?? 'unknown'}, started ${holder.startedAt ?? 'unknown'}); stopping it and starting the current build`);\n await terminateProcessGroup(holder.pid);\n if (this.child === null) this.spawnChild();\n return;\n }\n if (holder !== null && !ownChild) {\n this.heldPort = started.port;\n this.lastPortCheckAtMs = Date.now();\n this.log(\n `a process this supervisor did not spawn holds port ${started.port}: pid ${holder.pid ?? 'unknown (lsof unavailable)'}, parent ${holder.ppid ?? 'unknown'}${holder.ppid === 1 ? ' (an orphan)' : ''}, `\n + `started ${holder.startedAt ?? 'unknown'}, cwd ${holder.cwd ?? 'unknown'}, command ${holder.command ?? 'unknown'}. `\n + 'The runtime is NOT running this tree. Stop that process (or restart `wildo local dev`); the runtime starts as soon as the port is free.',\n );\n this.publish({ state: LocalDevSupervisorState.PAUSED, childPid: null, blocker: LocalDevSupervisorBlocker.PORT_HELD_BY_FOREIGN_PROCESS, portHolder: holder });\n return;\n }\n }\n if (this.child !== null) return;\n // A crash while an install re-creates node_modules is the install's, not the runtime's (#3552): count nothing, and let\n // the end of the install start it again with a fresh budget (see `applyDependencyInstall`).\n if (classifyDependencyInstall(readDependencyInstallRecord(this.options.appRoot), Date.now()).phase === LocalDevDependencyInstallPhase.IN_FLIGHT) {\n this.log(`the runtime exited (${signal ?? `code ${code}`}) while a dependency install is running; not counted, it starts again when the install ends`);\n this.publish({ state: LocalDevSupervisorState.PAUSED, childPid: null, blocker: LocalDevSupervisorBlocker.DEPENDENCY_INSTALL_IN_FLIGHT });\n return;\n }\n /*\n * A child that STARTED (its own record says so) and later died is a fresh failure with a fresh budget. Uptime is not\n * the test: a start refused after registry initialization takes twenty seconds, and counting that as healthy reset\n * the budget at every attempt, so a backend that could never start was respawned forever. Uptime decides only for a\n * child that left no record at all (#3257): a runtime with no runtime-signals home writes none, and would otherwise\n * never reset its budget, so five crashes spread over a day would spend it.\n */\n const stayedUpWithoutStartRecord = started === undefined\n && uptimeMs >= (this.options.healthyUptimeWithoutStartRecordMs ?? DEFAULT_HEALTHY_UPTIME_WITHOUT_START_RECORD_MS);\n if (started?.outcome === BackendStartOutcome.STARTED || stayedUpWithoutStartRecord) this.crashCount = 0;\n this.crashCount += 1;\n if (this.crashCount > CRASH_RESPAWN_MAX_ATTEMPTS && spentCrashBudgetPauses(started)) {\n this.pausedAgainstBuildAtMs = assessRuntimeBuilds({\n own: this.options.compileLoop.observation,\n dependencies: this.readDependencyObservations(Date.now()),\n dependencyGraceElapsed: true,\n }).newestBuildAtMs;\n this.log(`the runtime exited (${signal ?? `code ${code}`}) at ${this.crashCount} consecutive starts; paused until a package it loads publishes a newer build`);\n this.publish({ state: LocalDevSupervisorState.PAUSED, childPid: null, blocker: LocalDevSupervisorBlocker.CRASH_RESPAWN_EXHAUSTED });\n return;\n }\n const crashLoop = this.crashCount > CRASH_RESPAWN_MAX_ATTEMPTS;\n const delayMs = Math.min(CRASH_RESPAWN_BASE_DELAY_MS * 2 ** (this.crashCount - 1), crashLoop ? CRASH_LOOP_MAX_DELAY_MS : CRASH_RESPAWN_MAX_DELAY_MS);\n if (crashLoop) {\n this.log(\n `the runtime exited (${signal ?? `code ${code}`}) at ${this.crashCount} consecutive starts, `\n + `${describeCrashLoopCause(started)}; `\n + `crash-loop backoff, restarting in ${Math.round(delayMs / 1000)}s (the delay doubles up to ${CRASH_LOOP_MAX_DELAY_MS / 60_000} min and never stops)`,\n );\n this.publish({ state: LocalDevSupervisorState.BACKOFF, childPid: null, blocker: LocalDevSupervisorBlocker.CRASH_LOOP_BACKOFF });\n } else {\n this.log(`the runtime exited (${signal ?? `code ${code}`}); restarting in ${Math.round(delayMs / 1000)}s (${this.crashCount}/${CRASH_RESPAWN_MAX_ATTEMPTS})`);\n this.publish({ state: LocalDevSupervisorState.BACKOFF, childPid: null, blocker: null });\n }\n this.backoffTimer = setTimeout(() => {\n this.backoffTimer = null;\n void this.serialized(() => this.decide());\n }, delayMs);\n }\n}\n"]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type LocalDevCompileObservation } from '../runtime/local-dev-runtime-signals.contracts';
|
|
2
|
+
/**
|
|
3
|
+
* One application package's compiler, run so that its `dist` is never READ half-published (#3216) and never silently
|
|
4
|
+
* stops being kept current (#3214).
|
|
5
|
+
*
|
|
6
|
+
* ## What it replaces, and why the replacement owns `tsc` directly
|
|
7
|
+
*
|
|
8
|
+
* An app-creator package compiled with `tsc-watch -p … --onSuccess "tsc-alias …"`: `tsc` writes extensionless relative
|
|
9
|
+
* imports, the alias pass rewrites them a moment later, and NOTHING said which of the two states `dist` was in. A backend
|
|
10
|
+
* starting in between read `./x` and died with `ERR_MODULE_NOT_FOUND` (#3216). And when the watcher went deaf after a
|
|
11
|
+
* laptop sleep (a file-watch subscription that outlived the daemon behind it — see
|
|
12
|
+
* `.claude/rules/staleness-presents-as-a-logic-defect.md`), nothing noticed: `touch backend-api/src/index.ts` changed
|
|
13
|
+
* nothing for an hour (#3214).
|
|
14
|
+
*
|
|
15
|
+
* So this loop runs `tsc --watch` itself, reads the compiler's own start/end lines, runs the alias pass, VERIFIES the
|
|
16
|
+
* emitted tree, and publishes one compile observation — the same record, at the same path, that a framework developer's
|
|
17
|
+
* observer publishes — whose `READY` means "emitted, rewritten and verified". A reader (the backend supervisor, the dev
|
|
18
|
+
* companion) reads `dist` only on `READY`.
|
|
19
|
+
*
|
|
20
|
+
* ## Rejected: an atomic staging swap of the whole tree
|
|
21
|
+
*
|
|
22
|
+
* Emitting into a staging directory and renaming it over `dist` would make publication atomic for a reader that never
|
|
23
|
+
* consults the record. It was rejected for two measured costs: `tsc --watch` keeps its incremental state against ONE
|
|
24
|
+
* output directory, so every cycle would copy the whole tree (thousands of files in a grown application); and a rename
|
|
25
|
+
* replaces the directory inode that the companion's module-generation reader and Vite's dependency watcher are bound to.
|
|
26
|
+
* The record is the publication instead, and every reader in the dev loop consults it.
|
|
27
|
+
*
|
|
28
|
+
* ## A deaf watcher is restarted on evidence
|
|
29
|
+
*
|
|
30
|
+
* While idle, the loop compares the newest source mtime with the last compilation start. A source changed more than
|
|
31
|
+
* {@link DEFAULT_BLIND_WATCHER_GRACE_MS} ago that started no compilation is a watcher that did not see it, and the
|
|
32
|
+
* compiler is restarted. `tsc`'s own debounce is 250 ms, so the grace is generous by two orders of magnitude.
|
|
33
|
+
*/
|
|
34
|
+
/** How long a source change may go unanswered before the compiler is judged deaf and restarted. */
|
|
35
|
+
export declare const DEFAULT_BLIND_WATCHER_GRACE_MS = 30000;
|
|
36
|
+
/** How often an idle compiler is checked for deafness. */
|
|
37
|
+
export declare const DEFAULT_BLIND_WATCHER_CHECK_INTERVAL_MS = 15000;
|
|
38
|
+
export interface PackageCompileLoopOptions {
|
|
39
|
+
readonly appRoot: string;
|
|
40
|
+
readonly packageRoot: string;
|
|
41
|
+
readonly packageName: string;
|
|
42
|
+
/** The tsconfig the package builds with, relative to the package root (`tsconfig.build.json`). */
|
|
43
|
+
readonly project: string;
|
|
44
|
+
/** The emitted tree, absolute or relative to the package root (`dist/esm`). */
|
|
45
|
+
readonly dist: string;
|
|
46
|
+
/** Source roots whose changes the compiler must answer; defaults to `<package>/src`. */
|
|
47
|
+
readonly sourceRoots?: readonly string[];
|
|
48
|
+
/** Resolved from the package by default; injectable for tests that compile a package with no `node_modules`. */
|
|
49
|
+
readonly typescriptCompilerPath?: string;
|
|
50
|
+
readonly aliasCompilerPath?: string;
|
|
51
|
+
readonly blindWatcherGraceMs?: number;
|
|
52
|
+
readonly blindWatcherCheckIntervalMs?: number;
|
|
53
|
+
/** Where the compiler's own output goes; standard output by default. */
|
|
54
|
+
readonly output?: (text: string) => void;
|
|
55
|
+
readonly log?: (line: string) => void;
|
|
56
|
+
}
|
|
57
|
+
/** The newest program source under `roots`, with its mtime; `undefined` when there is none. */
|
|
58
|
+
export declare function findNewestProgramSource(roots: readonly string[]): {
|
|
59
|
+
readonly path: string;
|
|
60
|
+
readonly mtimeMs: number;
|
|
61
|
+
} | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Is the compiler deaf? True when the newest program source changed after the last compilation START, and longer ago
|
|
64
|
+
* than the grace: the compiler had every chance to see it and did not. Pure, so the rule is pinned without a clock.
|
|
65
|
+
*/
|
|
66
|
+
export declare function compilerMissedSourceChange(input: {
|
|
67
|
+
readonly newestSourceMtimeMs: number | undefined;
|
|
68
|
+
readonly lastCompilationStartedAtMs: number | undefined;
|
|
69
|
+
readonly nowMs: number;
|
|
70
|
+
readonly graceMs: number;
|
|
71
|
+
}): boolean;
|
|
72
|
+
export declare class PackageCompileLoop {
|
|
73
|
+
private readonly options;
|
|
74
|
+
private readonly recordPath;
|
|
75
|
+
private readonly distRoot;
|
|
76
|
+
private readonly sourceRoots;
|
|
77
|
+
private readonly typescriptCompilerPath;
|
|
78
|
+
private readonly aliasCompilerPath;
|
|
79
|
+
private readonly output;
|
|
80
|
+
private readonly log;
|
|
81
|
+
private readonly listeners;
|
|
82
|
+
private state;
|
|
83
|
+
private compiler;
|
|
84
|
+
private aliasPass;
|
|
85
|
+
/** Bumped at every compilation start, so an alias pass that finishes after a newer start publishes nothing. */
|
|
86
|
+
private generation;
|
|
87
|
+
private compilationStartedAtMs;
|
|
88
|
+
private stdoutBuffer;
|
|
89
|
+
private stopping;
|
|
90
|
+
private respawnDelayMs;
|
|
91
|
+
private respawnTimer;
|
|
92
|
+
private heartbeatTimer;
|
|
93
|
+
private blindWatcherTimer;
|
|
94
|
+
/** When the current compiler process was spawned: what an ended dependency install is compared against (#3552). */
|
|
95
|
+
private compilerStartedAtMs;
|
|
96
|
+
constructor(options: PackageCompileLoopOptions);
|
|
97
|
+
get observation(): LocalDevCompileObservation;
|
|
98
|
+
onChange(listener: (observation: LocalDevCompileObservation) => void): () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Start compiling. REFUSES when another live process already compiles this package (two writers of one `dist` is the
|
|
101
|
+
* defect, not a configuration), and stops the compiler an earlier generation left behind when its owner died.
|
|
102
|
+
*/
|
|
103
|
+
start(): Promise<void>;
|
|
104
|
+
/** Kill the compiler and an alias pass synchronously: for a process that is exiting and cannot await {@link stop}. */
|
|
105
|
+
killChildrenNow(): void;
|
|
106
|
+
stop(): Promise<void>;
|
|
107
|
+
private publish;
|
|
108
|
+
private spawnCompiler;
|
|
109
|
+
private handleCompilerOutput;
|
|
110
|
+
private handleCompilationStarted;
|
|
111
|
+
private handleCompilationEnded;
|
|
112
|
+
/**
|
|
113
|
+
* Restart a compiler that did not answer a source change (see the class comment), or that last read the tree before a
|
|
114
|
+
* dependency install ended (#3552).
|
|
115
|
+
*
|
|
116
|
+
* The second rule: an install re-creates `node_modules`, and a compiler that compiled while it ran read a half-installed
|
|
117
|
+
* tree (`TS2318 Cannot find global type 'Array'` once `typescript/lib` was gone) and records nothing that changes after
|
|
118
|
+
* the install. Measured on reference run 42666728304: three packages stayed FAILED on that error, so the backend was
|
|
119
|
+
* never allowed to start again. A watcher that compiled before the install also resolved modules the install moved.
|
|
120
|
+
* Self-limiting: the restarted compiler starts after the install ended.
|
|
121
|
+
*/
|
|
122
|
+
private checkForDeafCompiler;
|
|
123
|
+
private restartCompiler;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=package-compile-loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-compile-loop.d.ts","sourceRoot":"","sources":["../../../src/dev-runtime/package-compile-loop.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,gDAAgD,CAAC;AAMxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,mGAAmG;AACnG,eAAO,MAAM,8BAA8B,QAAS,CAAC;AACrD,0DAA0D;AAC1D,eAAO,MAAM,uCAAuC,QAAS,CAAC;AAiB9D,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,gHAAgH;IAChH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAC9C,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAOD,+FAA+F;AAC/F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE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