@wildo-ai/platform-core-shared 1.1.11 → 1.1.13

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.
Files changed (142) hide show
  1. package/dist/esm/core/resources/resources-operations.custom.shared.definitions.d.ts.map +1 -1
  2. package/dist/esm/core/resources/resources-operations.custom.shared.definitions.js.map +1 -1
  3. package/dist/esm/core/resources/resources-relationships.custom.shared.definitions.d.ts.map +1 -1
  4. package/dist/esm/core/resources/resources-relationships.custom.shared.definitions.js.map +1 -1
  5. package/dist/esm/core/resources/resources-types.custom.shared.schemas.d.ts.map +1 -1
  6. package/dist/esm/core/resources/resources-types.custom.shared.schemas.js.map +1 -1
  7. package/dist/esm/dev-runtime/dependency-install-record.d.ts +111 -0
  8. package/dist/esm/dev-runtime/dependency-install-record.d.ts.map +1 -0
  9. package/dist/esm/dev-runtime/dependency-install-record.js +185 -0
  10. package/dist/esm/dev-runtime/dependency-install-record.js.map +1 -0
  11. package/dist/esm/dev-runtime/dev-runtime-command.d.ts +50 -0
  12. package/dist/esm/dev-runtime/dev-runtime-command.d.ts.map +1 -0
  13. package/dist/esm/dev-runtime/dev-runtime-command.js +147 -0
  14. package/dist/esm/dev-runtime/dev-runtime-command.js.map +1 -0
  15. package/dist/esm/dev-runtime/dev-runtime-processes.d.ts +47 -0
  16. package/dist/esm/dev-runtime/dev-runtime-processes.d.ts.map +1 -0
  17. package/dist/esm/dev-runtime/dev-runtime-processes.js +163 -0
  18. package/dist/esm/dev-runtime/dev-runtime-processes.js.map +1 -0
  19. package/dist/esm/dev-runtime/dev-runtime-signals.d.ts +54 -0
  20. package/dist/esm/dev-runtime/dev-runtime-signals.d.ts.map +1 -0
  21. package/dist/esm/dev-runtime/dev-runtime-signals.js +113 -0
  22. package/dist/esm/dev-runtime/dev-runtime-signals.js.map +1 -0
  23. package/dist/esm/dev-runtime/emitted-relative-specifiers.d.ts +14 -0
  24. package/dist/esm/dev-runtime/emitted-relative-specifiers.d.ts.map +1 -0
  25. package/dist/esm/dev-runtime/emitted-relative-specifiers.js +71 -0
  26. package/dist/esm/dev-runtime/emitted-relative-specifiers.js.map +1 -0
  27. package/dist/esm/dev-runtime/frontend-dev-runtime.d.ts +43 -0
  28. package/dist/esm/dev-runtime/frontend-dev-runtime.d.ts.map +1 -0
  29. package/dist/esm/dev-runtime/frontend-dev-runtime.js +42 -0
  30. package/dist/esm/dev-runtime/frontend-dev-runtime.js.map +1 -0
  31. package/dist/esm/dev-runtime/node-runtime-dev-supervisor.d.ts +233 -0
  32. package/dist/esm/dev-runtime/node-runtime-dev-supervisor.d.ts.map +1 -0
  33. package/dist/esm/dev-runtime/node-runtime-dev-supervisor.js +578 -0
  34. package/dist/esm/dev-runtime/node-runtime-dev-supervisor.js.map +1 -0
  35. package/dist/esm/dev-runtime/package-compile-loop.d.ts +125 -0
  36. package/dist/esm/dev-runtime/package-compile-loop.d.ts.map +1 -0
  37. package/dist/esm/dev-runtime/package-compile-loop.js +386 -0
  38. package/dist/esm/dev-runtime/package-compile-loop.js.map +1 -0
  39. package/dist/esm/dev-runtime.exports.d.ts +19 -0
  40. package/dist/esm/dev-runtime.exports.d.ts.map +1 -0
  41. package/dist/esm/dev-runtime.exports.js +19 -0
  42. package/dist/esm/dev-runtime.exports.js.map +1 -0
  43. package/dist/esm/index.d.ts +4 -0
  44. package/dist/esm/index.d.ts.map +1 -1
  45. package/dist/esm/index.js +4 -0
  46. package/dist/esm/index.js.map +1 -1
  47. package/dist/esm/runtime/application-backend-env.contracts.d.ts +9 -2
  48. package/dist/esm/runtime/application-backend-env.contracts.d.ts.map +1 -1
  49. package/dist/esm/runtime/application-backend-env.contracts.js +8 -1
  50. package/dist/esm/runtime/application-backend-env.contracts.js.map +1 -1
  51. package/dist/esm/runtime/application-worker-env.contracts.d.ts +11 -3
  52. package/dist/esm/runtime/application-worker-env.contracts.d.ts.map +1 -1
  53. package/dist/esm/runtime/application-worker-env.contracts.js +9 -0
  54. package/dist/esm/runtime/application-worker-env.contracts.js.map +1 -1
  55. package/dist/esm/runtime/backend-start-outcome.contracts.d.ts +27 -0
  56. package/dist/esm/runtime/backend-start-outcome.contracts.d.ts.map +1 -1
  57. package/dist/esm/runtime/backend-start-outcome.contracts.js +34 -0
  58. package/dist/esm/runtime/backend-start-outcome.contracts.js.map +1 -1
  59. package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.d.ts +28 -0
  60. package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.d.ts.map +1 -0
  61. package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.js +35 -0
  62. package/dist/esm/runtime/frontend-settings-hub-wiring.contracts.js.map +1 -0
  63. package/dist/esm/runtime/http-server-env.contracts.d.ts +14 -1
  64. package/dist/esm/runtime/http-server-env.contracts.d.ts.map +1 -1
  65. package/dist/esm/runtime/http-server-env.contracts.js +13 -0
  66. package/dist/esm/runtime/http-server-env.contracts.js.map +1 -1
  67. package/dist/esm/runtime/local-dev-runtime-signals.contracts.d.ts +239 -0
  68. package/dist/esm/runtime/local-dev-runtime-signals.contracts.d.ts.map +1 -0
  69. package/dist/esm/runtime/local-dev-runtime-signals.contracts.js +256 -0
  70. package/dist/esm/runtime/local-dev-runtime-signals.contracts.js.map +1 -0
  71. package/dist/esm/runtime/runtime-topology.contracts.d.ts.map +1 -1
  72. package/dist/esm/runtime/runtime-topology.contracts.js.map +1 -1
  73. package/dist/esm/security/authorizations/roles.custom.shared.definitions.d.ts.map +1 -1
  74. package/dist/esm/security/authorizations/roles.custom.shared.definitions.js.map +1 -1
  75. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.d.ts +112 -104
  76. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.d.ts.map +1 -1
  77. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.js +4 -3
  78. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.js.map +1 -1
  79. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.d.ts +112 -104
  80. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.d.ts.map +1 -1
  81. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.js.map +1 -1
  82. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.d.ts +24 -34
  83. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.d.ts.map +1 -1
  84. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.js +4 -3
  85. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.js.map +1 -1
  86. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.d.ts +24 -34
  87. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.d.ts.map +1 -1
  88. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.js.map +1 -1
  89. package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.d.ts +3 -3
  90. package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.d.ts.map +1 -1
  91. package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.js +30 -42
  92. package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.js.map +1 -1
  93. package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.d.ts +9 -9
  94. package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.d.ts.map +1 -1
  95. package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.js.map +1 -1
  96. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.resources-config.schemas.d.ts.map +1 -1
  97. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.resources-config.schemas.js.map +1 -1
  98. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.d.ts +7 -7
  99. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.d.ts.map +1 -1
  100. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.js.map +1 -1
  101. package/dist/esm/workbench/creation-drive.custom.shared.schemas.d.ts +82 -0
  102. package/dist/esm/workbench/creation-drive.custom.shared.schemas.d.ts.map +1 -0
  103. package/dist/esm/workbench/creation-drive.custom.shared.schemas.js +73 -0
  104. package/dist/esm/workbench/creation-drive.custom.shared.schemas.js.map +1 -0
  105. package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.d.ts +183 -0
  106. package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.d.ts.map +1 -0
  107. package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.js +188 -0
  108. package/dist/esm/workbench/creation-journey-timeline.custom.shared.schemas.js.map +1 -0
  109. package/dist/esm/workbench/workbench-aspect-resources.custom.shared.schemas.d.ts.map +1 -1
  110. package/dist/esm/workbench/workbench-aspect-resources.custom.shared.schemas.js +46 -0
  111. package/dist/esm/workbench/workbench-aspect-resources.custom.shared.schemas.js.map +1 -1
  112. package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.d.ts +170 -7
  113. package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.d.ts.map +1 -1
  114. package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.js +177 -7
  115. package/dist/esm/workbench/workbench-creation-console.custom.shared.schemas.js.map +1 -1
  116. package/dist/esm/workbench/workbench-creation-conversation.custom.shared.schemas.d.ts.map +1 -1
  117. package/dist/esm/workbench/workbench-creation-conversation.custom.shared.schemas.js.map +1 -1
  118. package/dist/esm/workbench/workbench-creation-dossier.custom.shared.schemas.d.ts.map +1 -1
  119. package/dist/esm/workbench/workbench-creation-dossier.custom.shared.schemas.js.map +1 -1
  120. package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.d.ts +480 -459
  121. package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.d.ts.map +1 -1
  122. package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.js +21 -16
  123. package/dist/esm/workbench/workbench-creation-plane.custom.shared.resources-config.schemas.js.map +1 -1
  124. package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.d.ts +480 -278
  125. package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.d.ts.map +1 -1
  126. package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.js +316 -46
  127. package/dist/esm/workbench/workbench-creation-plane.custom.shared.schemas.js.map +1 -1
  128. package/dist/esm/workbench/workbench-domain-model.custom.shared.schemas.d.ts.map +1 -1
  129. package/dist/esm/workbench/workbench-domain-model.custom.shared.schemas.js.map +1 -1
  130. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.d.ts +7 -0
  131. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.d.ts.map +1 -1
  132. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.js +13 -1
  133. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.js.map +1 -1
  134. package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.d.ts +287 -277
  135. package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.d.ts.map +1 -1
  136. package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.js.map +1 -1
  137. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.d.ts +34 -29
  138. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.d.ts.map +1 -1
  139. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.js +9 -5
  140. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.js.map +1 -1
  141. package/dist/tsconfig.build.tsbuildinfo +1 -1
  142. package/package.json +13 -8
@@ -18,6 +18,19 @@ export var HttpServerEnvKey;
18
18
  (function (HttpServerEnvKey) {
19
19
  /** Non-negative integer: the number of trusted reverse-proxy hops in front of this runtime. */
20
20
  HttpServerEnvKey["HTTP_TRUSTED_PROXY_HOPS"] = "HTTP_TRUSTED_PROXY_HOPS";
21
+ /**
22
+ * A SECOND address a host-run application backend accepts connections on, besides `HOST` (#3387): the host's Docker
23
+ * bridge gateway, so a compose minion or worker reaches the backend through `host.docker.internal`.
24
+ *
25
+ * On Docker Engine for Linux `host-gateway` resolves to the bridge gateway (for example `172.17.0.1`), and a process
26
+ * bound to the IPv4 loopback alone does not serve that address. Docker Desktop forwards the gateway to the host's
27
+ * loopback, so there the key is never written.
28
+ *
29
+ * Written by the native LOCAL lane only, when the CLI finds the bridge gateway assigned to an interface of this host.
30
+ * The HTTP server refuses a value that is not an IP literal or is an any-address, since either could serve the
31
+ * developer's network, and keeps serving its loopback when the address cannot be bound.
32
+ */
33
+ HttpServerEnvKey["CONTAINER_HOST_GATEWAY_LISTEN_HOST"] = "CONTAINER_HOST_GATEWAY_LISTEN_HOST";
21
34
  })(HttpServerEnvKey || (HttpServerEnvKey = {}));
22
35
  /**
23
36
  * The hops in front of a REMOTE runtime: both remote deployment lanes put exactly ONE HTTP reverse proxy
@@ -1 +1 @@
1
- {"version":3,"file":"http-server-env.contracts.js","sourceRoot":"","sources":["../../../../src/runtime/http-server-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+FAA+F;IAC/F,uEAAmD,CAAA;AACrD,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAyB;IAC7D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,gBAAgB,CAAC,uBAAuB,yCAAyC,KAAK,KAAK,CAAC,CAAC;IAClH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/**\n * How many HTTP reverse proxies sit in front of a runtime's HTTP server — the deployment fact Express's\n * `trust proxy` needs, and the only thing that makes `req.ip` the CLIENT's address rather than the last\n * proxy's (#1788).\n *\n * Every per-client-IP control in the engine — the machine-credential failure lockout, the per-endpoint\n * rate limits, the global HTTP limiter, the audit trail's client address — keys on `req.ip`. Behind a\n * proxy with `trust proxy` unset, `req.ip` is the proxy for EVERY caller, so all of them share one\n * bucket: one client presenting bad keys locks every machine caller out.\n *\n * It is a property of the DEPLOYMENT, not of the application, so it arrives in the process environment,\n * rendered by the lane that put the proxy there — like `HOST` and `PORT` — and is read at the one HTTP\n * server every runtime shares (applications, the dev companion and the platform services alike).\n * Absent means zero: no proxy is trusted, which is the safe reading — a trusted hop that is not really\n * there would let a client choose its own address through `X-Forwarded-For`.\n */\nexport enum HttpServerEnvKey {\n /** Non-negative integer: the number of trusted reverse-proxy hops in front of this runtime. */\n HTTP_TRUSTED_PROXY_HOPS = 'HTTP_TRUSTED_PROXY_HOPS',\n}\n\n/**\n * The hops in front of a REMOTE runtime: both remote deployment lanes put exactly ONE HTTP reverse proxy\n * (Traefik) before the backend — as the cluster ingress in the Kubernetes lane, as the TLS-terminating\n * edge in the remote compose lane. A local runtime is reached directly and trusts none.\n *\n * One hop is only the client's address if Traefik itself SAW the client. A cloud load balancer in front\n * of it works at TCP level and adds no forwarded header, so it is not a hop — but kube-proxy source-NATs\n * a LoadBalancer Service by default, and Traefik would then see a node. The Kubernetes lane's Traefik\n * values set `externalTrafficPolicy: Local` for exactly this reason; the compose lane publishes Traefik's\n * ports directly, which keeps the source address (#1788 review).\n *\n * The limit, stated rather than implied: trusting a hop COUNT means a caller that reaches the backend\n * WITHOUT Traefik — another pod in the same cluster — can name its own address in `X-Forwarded-For`.\n * Every such caller is one of this application's own runtimes or the platform, not an internet client,\n * and trusting Traefik's own addresses instead would need the cluster's pod network, which no lane\n * knows. The controls this protects are the ones aimed at the internet.\n */\nexport const REMOTE_EDGE_PROXY_HOPS = 1;\n\n/**\n * Read {@link HttpServerEnvKey.HTTP_TRUSTED_PROXY_HOPS}: an absent or empty value is 0; anything that is\n * not a non-negative integer is REFUSED, because silently reading a typo as 0 would collapse every\n * client into one rate-limit bucket without a word, and reading it as anything else would trust hops\n * that are not there.\n */\nexport function parseTrustedProxyHops(value: string | undefined): number {\n if (value === undefined || value.trim() === '') return 0;\n const trimmed = value.trim();\n if (!/^\\d+$/.test(trimmed)) {\n throw new Error(`${HttpServerEnvKey.HTTP_TRUSTED_PROXY_HOPS} must be a non-negative integer (got \"${value}\").`);\n }\n return Number(trimmed);\n}\n"]}
1
+ {"version":3,"file":"http-server-env.contracts.js","sourceRoot":"","sources":["../../../src/runtime/http-server-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAN,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IAC1B,+FAA+F;IAC/F,uEAAmD,CAAA;IACnD;;;;;;;;;;;OAWG;IACH,6FAAyE,CAAA;AAC3E,CAAC,EAhBW,gBAAgB,KAAhB,gBAAgB,QAgB3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAyB;IAC7D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,gBAAgB,CAAC,uBAAuB,yCAAyC,KAAK,KAAK,CAAC,CAAC;IAClH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/**\n * How many HTTP reverse proxies sit in front of a runtime's HTTP server — the deployment fact Express's\n * `trust proxy` needs, and the only thing that makes `req.ip` the CLIENT's address rather than the last\n * proxy's (#1788).\n *\n * Every per-client-IP control in the engine — the machine-credential failure lockout, the per-endpoint\n * rate limits, the global HTTP limiter, the audit trail's client address — keys on `req.ip`. Behind a\n * proxy with `trust proxy` unset, `req.ip` is the proxy for EVERY caller, so all of them share one\n * bucket: one client presenting bad keys locks every machine caller out.\n *\n * It is a property of the DEPLOYMENT, not of the application, so it arrives in the process environment,\n * rendered by the lane that put the proxy there — like `HOST` and `PORT` — and is read at the one HTTP\n * server every runtime shares (applications, the dev companion and the platform services alike).\n * Absent means zero: no proxy is trusted, which is the safe reading — a trusted hop that is not really\n * there would let a client choose its own address through `X-Forwarded-For`.\n */\nexport enum HttpServerEnvKey {\n /** Non-negative integer: the number of trusted reverse-proxy hops in front of this runtime. */\n HTTP_TRUSTED_PROXY_HOPS = 'HTTP_TRUSTED_PROXY_HOPS',\n /**\n * A SECOND address a host-run application backend accepts connections on, besides `HOST` (#3387): the host's Docker\n * bridge gateway, so a compose minion or worker reaches the backend through `host.docker.internal`.\n *\n * On Docker Engine for Linux `host-gateway` resolves to the bridge gateway (for example `172.17.0.1`), and a process\n * bound to the IPv4 loopback alone does not serve that address. Docker Desktop forwards the gateway to the host's\n * loopback, so there the key is never written.\n *\n * Written by the native LOCAL lane only, when the CLI finds the bridge gateway assigned to an interface of this host.\n * The HTTP server refuses a value that is not an IP literal or is an any-address, since either could serve the\n * developer's network, and keeps serving its loopback when the address cannot be bound.\n */\n CONTAINER_HOST_GATEWAY_LISTEN_HOST = 'CONTAINER_HOST_GATEWAY_LISTEN_HOST',\n}\n\n/**\n * The hops in front of a REMOTE runtime: both remote deployment lanes put exactly ONE HTTP reverse proxy\n * (Traefik) before the backend — as the cluster ingress in the Kubernetes lane, as the TLS-terminating\n * edge in the remote compose lane. A local runtime is reached directly and trusts none.\n *\n * One hop is only the client's address if Traefik itself SAW the client. A cloud load balancer in front\n * of it works at TCP level and adds no forwarded header, so it is not a hop — but kube-proxy source-NATs\n * a LoadBalancer Service by default, and Traefik would then see a node. The Kubernetes lane's Traefik\n * values set `externalTrafficPolicy: Local` for exactly this reason; the compose lane publishes Traefik's\n * ports directly, which keeps the source address (#1788 review).\n *\n * The limit, stated rather than implied: trusting a hop COUNT means a caller that reaches the backend\n * WITHOUT Traefik — another pod in the same cluster — can name its own address in `X-Forwarded-For`.\n * Every such caller is one of this application's own runtimes or the platform, not an internet client,\n * and trusting Traefik's own addresses instead would need the cluster's pod network, which no lane\n * knows. The controls this protects are the ones aimed at the internet.\n */\nexport const REMOTE_EDGE_PROXY_HOPS = 1;\n\n/**\n * Read {@link HttpServerEnvKey.HTTP_TRUSTED_PROXY_HOPS}: an absent or empty value is 0; anything that is\n * not a non-negative integer is REFUSED, because silently reading a typo as 0 would collapse every\n * client into one rate-limit bucket without a word, and reading it as anything else would trust hops\n * that are not there.\n */\nexport function parseTrustedProxyHops(value: string | undefined): number {\n if (value === undefined || value.trim() === '') return 0;\n const trimmed = value.trim();\n if (!/^\\d+$/.test(trimmed)) {\n throw new Error(`${HttpServerEnvKey.HTTP_TRUSTED_PROXY_HOPS} must be a non-negative integer (got \"${value}\").`);\n }\n return Number(trimmed);\n}\n"]}
@@ -0,0 +1,239 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The local dev loop's two RUNTIME-SIGNAL records: what an application package's compiler last did, and what the
4
+ * supervisor of an application runtime (the backend) is doing (#3212, #3214, #3215, #3216).
5
+ *
6
+ * ## Why these live here, beside the backend's start record
7
+ *
8
+ * Both records were born in the monorepo's dev orchestrator (`scripts/dev-orchestrator/local-dev-protocol.mjs`), a
9
+ * dependency-free script that only a FRAMEWORK DEVELOPER's application runs. An application created from the published
10
+ * framework (app-creator mode) ran neither: its shared library was `tsc-watch` plus a `tsc-alias` pass, and its backend
11
+ * was `node dist/index.js` started from the backend's own `tsc-watch --onSuccess`. Four defects of
12
+ * `app-creation-test-007` followed from that one absence:
13
+ *
14
+ * - nothing restarted the backend when the shared library it imports was rebuilt, so a tree that was already fixed stayed
15
+ * down for 46 minutes (#3215);
16
+ * - the backend could start between the shared library's `tsc` emit and its alias pass, read extensionless imports and
17
+ * die with `ERR_MODULE_NOT_FOUND`, and nothing brought it back (#3216);
18
+ * - a backend left behind by an earlier generation kept the port and served stale code while every rebuild's start died
19
+ * on "port in use", and a watcher dead since a laptop sleep was never noticed (#3214);
20
+ * - the companion read the application's packages the instant a playbook had written their sources, before their
21
+ * compiler had published, and stopped the whole creation loop on one stale read (#3212).
22
+ *
23
+ * The published framework now ships the writer of both records (`wildo-dev-runtime`, the program of
24
+ * `@wildo-ai/wildo-dev-runtime`, which runs this package's `./dev-runtime` code, #3263), so the same files exist in both
25
+ * modes, at the same paths, in the same shape. The companion reads them through THIS module and the
26
+ * framework-developer scripts keep writing them from their own copy of the vocabulary, which is why the values below
27
+ * are pinned against that script by a test rather than restated by hand.
28
+ *
29
+ * ## Where they live
30
+ *
31
+ * Under the application's runtime-signals home, `<app>/.wildo-saas/runtime-signals/`:
32
+ * `compilers/<package file name>.json` for a compiler, `supervisors/<label>.json` for a runtime supervisor.
33
+ */
34
+ /** The protocol version both records carry. A reader refuses any other value rather than guessing its meaning. */
35
+ export declare const LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION = 1;
36
+ /** The application-relative runtime-signals home every record below lives under. */
37
+ export declare const APPLICATION_RUNTIME_SIGNALS_RELATIVE_DIRECTORY = ".wildo-saas/runtime-signals";
38
+ /** The directory, under the runtime-signals home, holding one compile observation per application package. */
39
+ export declare const LOCAL_DEV_COMPILE_OBSERVATIONS_DIRECTORY = "compilers";
40
+ /** The directory, under the runtime-signals home, holding one record per supervised runtime. */
41
+ export declare const LOCAL_DEV_SUPERVISOR_OBSERVATIONS_DIRECTORY = "supervisors";
42
+ export declare const LOCAL_DEV_COMPILE_OBSERVATION_KIND = "wildo.local-dev.compile-observation";
43
+ export declare const LOCAL_DEV_SUPERVISOR_OBSERVATION_KIND = "wildo.local-dev.supervisor-observation";
44
+ /**
45
+ * What an application package's compiler is doing. A package's `dist` may be READ only while its compiler is `READY`:
46
+ * every other state means the output is being written, or was left half-written, or is not being kept current at all.
47
+ */
48
+ export declare enum LocalDevCompileState {
49
+ /** The compiler is starting and has not finished its first compilation. */
50
+ STARTING = "STARTING",
51
+ /** `tsc` reported a compilation START and has not reported its end: it may be writing `dist` right now. */
52
+ COMPILING = "COMPILING",
53
+ /**
54
+ * `tsc` finished with no error and the post-emit pass (the import-specifier rewrite) is running. The emitted files
55
+ * still carry extensionless relative imports that Node cannot resolve until this pass ends — the window #3216 measured.
56
+ */
57
+ FINALIZING = "FINALIZING",
58
+ /** The last compilation finished, its post-emit pass completed, and the emitted tree was verified. `dist` is current. */
59
+ READY = "READY",
60
+ /** The last compilation reported errors, or its post-emit pass failed. `dist` holds an earlier or a partial build. */
61
+ FAILED = "FAILED",
62
+ /** The compiler is not running. Nothing keeps `dist` current. */
63
+ STOPPED = "STOPPED"
64
+ }
65
+ /** What a runtime supervisor is doing with the runtime it owns. */
66
+ export declare enum LocalDevSupervisorState {
67
+ /** Waiting to start the runtime: its build or a dependency's is not published yet, or a restart is under way. */
68
+ STARTING = "STARTING",
69
+ /** The runtime is running and was started by this supervisor. */
70
+ RUNNING = "RUNNING",
71
+ /** The runtime exited unexpectedly and a respawn is scheduled after a backoff. */
72
+ BACKOFF = "BACKOFF",
73
+ /**
74
+ * The supervisor will not start the runtime until something changes: `blocker` says what (a crash budget spent, a
75
+ * port another process holds). A new build of a package it loads resets it.
76
+ */
77
+ PAUSED = "PAUSED",
78
+ /** The supervisor stopped and its runtime with it. */
79
+ STOPPED = "STOPPED"
80
+ }
81
+ /**
82
+ * Why a supervisor is not running its runtime, as a closed vocabulary a reader can branch on.
83
+ *
84
+ * Kept apart from the free-text blockers the monorepo's supervisor publishes (a readiness reason, a migration owed)
85
+ * because the remedy differs per member: a held port is the dev stack's, a crash loop is usually a dependency that is
86
+ * down (#3365), and a spent budget is the application's own startup refusing. The `.mjs` mirror is
87
+ * `LocalDevSupervisorBlocker` in `scripts/dev-orchestrator/local-dev-protocol.mjs`.
88
+ */
89
+ export declare enum LocalDevSupervisorBlocker {
90
+ /**
91
+ * PAUSED: the runtime crashed at every respawn of its budget AND its own startup refused (its start record says
92
+ * `startup-refused`), so a new build of a package it loads is what fixes it, and starts it again.
93
+ */
94
+ CRASH_RESPAWN_EXHAUSTED = "CRASH_RESPAWN_EXHAUSTED",
95
+ /**
96
+ * BACKOFF past the budget (#3365): the runtime keeps crashing and the supervisor keeps restarting it, the delay
97
+ * doubling up to a cap and never stopping (Kubernetes' CrashLoopBackOff). Published when the cause is a dependency
98
+ * that did not answer, or cannot be told: a database that comes back must bring its runtime back by itself.
99
+ * A reader treats it like a pause for "is the application up?": the runtime is not running between attempts.
100
+ */
101
+ CRASH_LOOP_BACKOFF = "CRASH_LOOP_BACKOFF",
102
+ /**
103
+ * A process this supervisor did not spawn listens on the runtime's port, so every start dies binding it. The record's
104
+ * `portHolder` names it. The supervisor starts the runtime the moment the port is free.
105
+ */
106
+ PORT_HELD_BY_FOREIGN_PROCESS = "PORT_HELD_BY_FOREIGN_PROCESS",
107
+ /**
108
+ * STOPPED (#2149): an app-creator COMPANION's supervisor (`wildo-dev-companion-supervised`) saw it crash more times
109
+ * than its window tolerates, stopped restarting it, and exited. Unlike {@link CRASH_RESPAWN_EXHAUSTED}, no build
110
+ * starts it again: only restarting `wildo local dev` does, after the cause in its log is fixed. The record outlives
111
+ * its producer on purpose, which is how `wildo local dev-status` can say the companion is down and why.
112
+ */
113
+ CRASH_LOOP_GAVE_UP = "CRASH_LOOP_GAVE_UP",
114
+ /**
115
+ * PAUSED (#3552): a dependency install is re-creating the application's `node_modules` (the build applied a
116
+ * composition scenario, or a person ran an install). A start now would boot against a half-installed tree, so the
117
+ * runtime is held, and a crash in this window is not counted against its budget. It starts again, with a fresh
118
+ * budget, the moment the install ends. See {@link LocalDevDependencyInstallRecord_Schema}.
119
+ */
120
+ DEPENDENCY_INSTALL_IN_FLIGHT = "DEPENDENCY_INSTALL_IN_FLIGHT"
121
+ }
122
+ /**
123
+ * The application-relative file, under the runtime-signals home, that says a dependency install is running in the
124
+ * application, or when the last one ended (#3552). See {@link LocalDevDependencyInstallRecord_Schema}.
125
+ */
126
+ export declare const LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_FILE = "dependency-install.json";
127
+ export declare const LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_KIND = "wildo.local-dev.dependency-install";
128
+ /**
129
+ * Where a dependency install stands, as every dev-loop reader of {@link LocalDevDependencyInstallRecord_Schema} judges it.
130
+ */
131
+ export declare enum LocalDevDependencyInstallPhase {
132
+ /** No install has been recorded in this application. */
133
+ NONE = "NONE",
134
+ /** An install is running: its writer is alive and its deadline has not passed. Nothing may start on the tree. */
135
+ IN_FLIGHT = "IN_FLIGHT",
136
+ /**
137
+ * The install is over: it finished (successfully or not), its writer died without finishing, or it outlived its
138
+ * deadline. Everything that compiled or started before it ended read a tree that has since changed.
139
+ */
140
+ ENDED = "ENDED"
141
+ }
142
+ /**
143
+ * The process found listening on a port. That SOMETHING listens is established by connecting to it; who it is comes
144
+ * from the operating system's tools (`lsof`, `ps`), which a host may lack, so every field but `port` may be unknown.
145
+ */
146
+ export declare const LocalDevPortHolder_Schema: z.ZodObject<{
147
+ port: z.ZodNumber;
148
+ pid: z.ZodNullable<z.ZodNumber>;
149
+ ppid: z.ZodNullable<z.ZodNumber>;
150
+ startedAt: z.ZodNullable<z.ZodString>;
151
+ cwd: z.ZodNullable<z.ZodString>;
152
+ command: z.ZodNullable<z.ZodString>;
153
+ }, z.core.$strip>;
154
+ export type LocalDevPortHolder = z.infer<typeof LocalDevPortHolder_Schema>;
155
+ /**
156
+ * One application package's compiler, as its observer last published it. Loose (unknown keys kept) because the framework
157
+ * developer's observer writes further fields (its diagnostic, its producer kind) that no reader here depends on.
158
+ */
159
+ export declare const LocalDevCompileObservation_Schema: z.ZodObject<{
160
+ kind: z.ZodLiteral<"wildo.local-dev.compile-observation">;
161
+ schemaVersion: z.ZodLiteral<1>;
162
+ producerPid: z.ZodNumber;
163
+ childPid: z.ZodNullable<z.ZodNumber>;
164
+ appRoot: z.ZodString;
165
+ packageRoot: z.ZodString;
166
+ packageName: z.ZodString;
167
+ state: z.ZodEnum<typeof LocalDevCompileState>;
168
+ heartbeatAt: z.ZodString;
169
+ updatedAt: z.ZodString;
170
+ lastCompilationStartedAt: z.ZodNullable<z.ZodString>;
171
+ lastSuccessfulCompileAt: z.ZodNullable<z.ZodString>;
172
+ lastFailureAt: z.ZodNullable<z.ZodString>;
173
+ lastErrorCount: z.ZodNullable<z.ZodNumber>;
174
+ }, z.core.$loose>;
175
+ export type LocalDevCompileObservation = z.infer<typeof LocalDevCompileObservation_Schema>;
176
+ /** One supervised runtime. Loose for the same reason as the compile observation. */
177
+ export declare const LocalDevSupervisorObservation_Schema: z.ZodObject<{
178
+ kind: z.ZodLiteral<"wildo.local-dev.supervisor-observation">;
179
+ schemaVersion: z.ZodLiteral<1>;
180
+ producerPid: z.ZodNumber;
181
+ label: z.ZodString;
182
+ state: z.ZodEnum<typeof LocalDevSupervisorState>;
183
+ childPid: z.ZodNullable<z.ZodNumber>;
184
+ childStartedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
185
+ blocker: z.ZodNullable<z.ZodString>;
186
+ portHolder: z.ZodOptional<z.ZodNullable<z.ZodObject<{
187
+ port: z.ZodNumber;
188
+ pid: z.ZodNullable<z.ZodNumber>;
189
+ ppid: z.ZodNullable<z.ZodNumber>;
190
+ startedAt: z.ZodNullable<z.ZodString>;
191
+ cwd: z.ZodNullable<z.ZodString>;
192
+ command: z.ZodNullable<z.ZodString>;
193
+ }, z.core.$strip>>>;
194
+ signalFilePath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ updatedAt: z.ZodString;
196
+ }, z.core.$loose>;
197
+ export type LocalDevSupervisorObservation = z.infer<typeof LocalDevSupervisorObservation_Schema>;
198
+ /**
199
+ * A dependency install in an application, as its installer records it (#3552).
200
+ *
201
+ * ## Why it exists
202
+ *
203
+ * `pnpm install` re-creates the application's `node_modules` while `wildo local dev` runs against it. Measured on
204
+ * reference run 42666728304 (2026-11-09): the build's foundation step applied composition scenarios that added four
205
+ * minions and a documentation site, and installed them (16 s). In that window every compile watcher compiled against a
206
+ * half-installed tree (`TS2318 Cannot find global type 'Array'`, `TS6053 lib.dom.d.ts not found`) and nothing ever asked
207
+ * it to compile again; the backend's readiness stayed blocked on those failures; every companion introspection worker
208
+ * died on `Cannot find package 'zod'`; and the install re-created the virtual-store key of `@wildo-ai/framework-knowledge`
209
+ * without its compiled knowledge tree, so `GET /api/companion/creation/questions` answered 500 for as long as the run
210
+ * was watched. Nothing tied the install to the running stack.
211
+ *
212
+ * So the installer writes this record before the install (`finishedAt: null`) and again when it ends, and every dev-loop
213
+ * process reads it: a runtime supervisor HOLDS its runtime while the install is in flight and does not count a crash
214
+ * against its budget, then relaunches it (and, in a framework checkout, repairs the injected snapshots first); a
215
+ * compile observer restarts a watcher whose last compile began before the install ended.
216
+ *
217
+ * ## Why a pid and a deadline rather than a heartbeat
218
+ *
219
+ * Every other in-flight signal here is a heartbeat refreshed from a timer. An install is often run SYNCHRONOUSLY
220
+ * (`spawnSync` in the CLI), so no timer would beat during it. The writer's pid answers "still running?" and the
221
+ * deadline bounds a writer that hangs, so a record can never hold the stack for good.
222
+ *
223
+ * ## Why it is never removed
224
+ *
225
+ * The finished record is what tells a watcher that started compiling before the install ended to compile again. It is a
226
+ * cache in the sense of `one-source-of-truth.md`: deleting it costs one missed relaunch, never a fact.
227
+ */
228
+ export declare const LocalDevDependencyInstallRecord_Schema: z.ZodObject<{
229
+ kind: z.ZodLiteral<"wildo.local-dev.dependency-install">;
230
+ schemaVersion: z.ZodLiteral<1>;
231
+ pid: z.ZodNumber;
232
+ startedAt: z.ZodString;
233
+ deadlineAt: z.ZodString;
234
+ finishedAt: z.ZodNullable<z.ZodString>;
235
+ succeeded: z.ZodNullable<z.ZodBoolean>;
236
+ initiator: z.ZodString;
237
+ }, z.core.$loose>;
238
+ export type LocalDevDependencyInstallRecord = z.infer<typeof LocalDevDependencyInstallRecord_Schema>;
239
+ //# sourceMappingURL=local-dev-runtime-signals.contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-dev-runtime-signals.contracts.d.ts","sourceRoot":"","sources":["../../../src/runtime/local-dev-runtime-signals.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,kHAAkH;AAClH,eAAO,MAAM,0CAA0C,IAAI,CAAC;AAE5D,oFAAoF;AACpF,eAAO,MAAM,8CAA8C,gCAAgC,CAAC;AAE5F,8GAA8G;AAC9G,eAAO,MAAM,wCAAwC,cAAc,CAAC;AAEpE,gGAAgG;AAChG,eAAO,MAAM,2CAA2C,gBAAgB,CAAC;AAEzE,eAAO,MAAM,kCAAkC,wCAAwC,CAAC;AACxF,eAAO,MAAM,qCAAqC,2CAA2C,CAAC;AAE9F;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,2EAA2E;IAC3E,QAAQ,aAAa;IACrB,2GAA2G;IAC3G,SAAS,cAAc;IACvB;;;OAGG;IACH,UAAU,eAAe;IACzB,yHAAyH;IACzH,KAAK,UAAU;IACf,sHAAsH;IACtH,MAAM,WAAW;IACjB,iEAAiE;IACjE,OAAO,YAAY;CACpB;AAED,mEAAmE;AACnE,oBAAY,uBAAuB;IACjC,iHAAiH;IACjH,QAAQ,aAAa;IACrB,iEAAiE;IACjE,OAAO,YAAY;IAC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} from 'zod';
2
+ /**
3
+ * The local dev loop's two RUNTIME-SIGNAL records: what an application package's compiler last did, and what the
4
+ * supervisor of an application runtime (the backend) is doing (#3212, #3214, #3215, #3216).
5
+ *
6
+ * ## Why these live here, beside the backend's start record
7
+ *
8
+ * Both records were born in the monorepo's dev orchestrator (`scripts/dev-orchestrator/local-dev-protocol.mjs`), a
9
+ * dependency-free script that only a FRAMEWORK DEVELOPER's application runs. An application created from the published
10
+ * framework (app-creator mode) ran neither: its shared library was `tsc-watch` plus a `tsc-alias` pass, and its backend
11
+ * was `node dist/index.js` started from the backend's own `tsc-watch --onSuccess`. Four defects of
12
+ * `app-creation-test-007` followed from that one absence:
13
+ *
14
+ * - nothing restarted the backend when the shared library it imports was rebuilt, so a tree that was already fixed stayed
15
+ * down for 46 minutes (#3215);
16
+ * - the backend could start between the shared library's `tsc` emit and its alias pass, read extensionless imports and
17
+ * die with `ERR_MODULE_NOT_FOUND`, and nothing brought it back (#3216);
18
+ * - a backend left behind by an earlier generation kept the port and served stale code while every rebuild's start died
19
+ * on "port in use", and a watcher dead since a laptop sleep was never noticed (#3214);
20
+ * - the companion read the application's packages the instant a playbook had written their sources, before their
21
+ * compiler had published, and stopped the whole creation loop on one stale read (#3212).
22
+ *
23
+ * The published framework now ships the writer of both records (`wildo-dev-runtime`, the program of
24
+ * `@wildo-ai/wildo-dev-runtime`, which runs this package's `./dev-runtime` code, #3263), so the same files exist in both
25
+ * modes, at the same paths, in the same shape. The companion reads them through THIS module and the
26
+ * framework-developer scripts keep writing them from their own copy of the vocabulary, which is why the values below
27
+ * are pinned against that script by a test rather than restated by hand.
28
+ *
29
+ * ## Where they live
30
+ *
31
+ * Under the application's runtime-signals home, `<app>/.wildo-saas/runtime-signals/`:
32
+ * `compilers/<package file name>.json` for a compiler, `supervisors/<label>.json` for a runtime supervisor.
33
+ */
34
+ /** The protocol version both records carry. A reader refuses any other value rather than guessing its meaning. */
35
+ export const LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION = 1;
36
+ /** The application-relative runtime-signals home every record below lives under. */
37
+ export const APPLICATION_RUNTIME_SIGNALS_RELATIVE_DIRECTORY = '.wildo-saas/runtime-signals';
38
+ /** The directory, under the runtime-signals home, holding one compile observation per application package. */
39
+ export const LOCAL_DEV_COMPILE_OBSERVATIONS_DIRECTORY = 'compilers';
40
+ /** The directory, under the runtime-signals home, holding one record per supervised runtime. */
41
+ export const LOCAL_DEV_SUPERVISOR_OBSERVATIONS_DIRECTORY = 'supervisors';
42
+ export const LOCAL_DEV_COMPILE_OBSERVATION_KIND = 'wildo.local-dev.compile-observation';
43
+ export const LOCAL_DEV_SUPERVISOR_OBSERVATION_KIND = 'wildo.local-dev.supervisor-observation';
44
+ /**
45
+ * What an application package's compiler is doing. A package's `dist` may be READ only while its compiler is `READY`:
46
+ * every other state means the output is being written, or was left half-written, or is not being kept current at all.
47
+ */
48
+ export var LocalDevCompileState;
49
+ (function (LocalDevCompileState) {
50
+ /** The compiler is starting and has not finished its first compilation. */
51
+ LocalDevCompileState["STARTING"] = "STARTING";
52
+ /** `tsc` reported a compilation START and has not reported its end: it may be writing `dist` right now. */
53
+ LocalDevCompileState["COMPILING"] = "COMPILING";
54
+ /**
55
+ * `tsc` finished with no error and the post-emit pass (the import-specifier rewrite) is running. The emitted files
56
+ * still carry extensionless relative imports that Node cannot resolve until this pass ends — the window #3216 measured.
57
+ */
58
+ LocalDevCompileState["FINALIZING"] = "FINALIZING";
59
+ /** The last compilation finished, its post-emit pass completed, and the emitted tree was verified. `dist` is current. */
60
+ LocalDevCompileState["READY"] = "READY";
61
+ /** The last compilation reported errors, or its post-emit pass failed. `dist` holds an earlier or a partial build. */
62
+ LocalDevCompileState["FAILED"] = "FAILED";
63
+ /** The compiler is not running. Nothing keeps `dist` current. */
64
+ LocalDevCompileState["STOPPED"] = "STOPPED";
65
+ })(LocalDevCompileState || (LocalDevCompileState = {}));
66
+ /** What a runtime supervisor is doing with the runtime it owns. */
67
+ export var LocalDevSupervisorState;
68
+ (function (LocalDevSupervisorState) {
69
+ /** Waiting to start the runtime: its build or a dependency's is not published yet, or a restart is under way. */
70
+ LocalDevSupervisorState["STARTING"] = "STARTING";
71
+ /** The runtime is running and was started by this supervisor. */
72
+ LocalDevSupervisorState["RUNNING"] = "RUNNING";
73
+ /** The runtime exited unexpectedly and a respawn is scheduled after a backoff. */
74
+ LocalDevSupervisorState["BACKOFF"] = "BACKOFF";
75
+ /**
76
+ * The supervisor will not start the runtime until something changes: `blocker` says what (a crash budget spent, a
77
+ * port another process holds). A new build of a package it loads resets it.
78
+ */
79
+ LocalDevSupervisorState["PAUSED"] = "PAUSED";
80
+ /** The supervisor stopped and its runtime with it. */
81
+ LocalDevSupervisorState["STOPPED"] = "STOPPED";
82
+ })(LocalDevSupervisorState || (LocalDevSupervisorState = {}));
83
+ /**
84
+ * Why a supervisor is not running its runtime, as a closed vocabulary a reader can branch on.
85
+ *
86
+ * Kept apart from the free-text blockers the monorepo's supervisor publishes (a readiness reason, a migration owed)
87
+ * because the remedy differs per member: a held port is the dev stack's, a crash loop is usually a dependency that is
88
+ * down (#3365), and a spent budget is the application's own startup refusing. The `.mjs` mirror is
89
+ * `LocalDevSupervisorBlocker` in `scripts/dev-orchestrator/local-dev-protocol.mjs`.
90
+ */
91
+ export var LocalDevSupervisorBlocker;
92
+ (function (LocalDevSupervisorBlocker) {
93
+ /**
94
+ * PAUSED: the runtime crashed at every respawn of its budget AND its own startup refused (its start record says
95
+ * `startup-refused`), so a new build of a package it loads is what fixes it, and starts it again.
96
+ */
97
+ LocalDevSupervisorBlocker["CRASH_RESPAWN_EXHAUSTED"] = "CRASH_RESPAWN_EXHAUSTED";
98
+ /**
99
+ * BACKOFF past the budget (#3365): the runtime keeps crashing and the supervisor keeps restarting it, the delay
100
+ * doubling up to a cap and never stopping (Kubernetes' CrashLoopBackOff). Published when the cause is a dependency
101
+ * that did not answer, or cannot be told: a database that comes back must bring its runtime back by itself.
102
+ * A reader treats it like a pause for "is the application up?": the runtime is not running between attempts.
103
+ */
104
+ LocalDevSupervisorBlocker["CRASH_LOOP_BACKOFF"] = "CRASH_LOOP_BACKOFF";
105
+ /**
106
+ * A process this supervisor did not spawn listens on the runtime's port, so every start dies binding it. The record's
107
+ * `portHolder` names it. The supervisor starts the runtime the moment the port is free.
108
+ */
109
+ LocalDevSupervisorBlocker["PORT_HELD_BY_FOREIGN_PROCESS"] = "PORT_HELD_BY_FOREIGN_PROCESS";
110
+ /**
111
+ * STOPPED (#2149): an app-creator COMPANION's supervisor (`wildo-dev-companion-supervised`) saw it crash more times
112
+ * than its window tolerates, stopped restarting it, and exited. Unlike {@link CRASH_RESPAWN_EXHAUSTED}, no build
113
+ * starts it again: only restarting `wildo local dev` does, after the cause in its log is fixed. The record outlives
114
+ * its producer on purpose, which is how `wildo local dev-status` can say the companion is down and why.
115
+ */
116
+ LocalDevSupervisorBlocker["CRASH_LOOP_GAVE_UP"] = "CRASH_LOOP_GAVE_UP";
117
+ /**
118
+ * PAUSED (#3552): a dependency install is re-creating the application's `node_modules` (the build applied a
119
+ * composition scenario, or a person ran an install). A start now would boot against a half-installed tree, so the
120
+ * runtime is held, and a crash in this window is not counted against its budget. It starts again, with a fresh
121
+ * budget, the moment the install ends. See {@link LocalDevDependencyInstallRecord_Schema}.
122
+ */
123
+ LocalDevSupervisorBlocker["DEPENDENCY_INSTALL_IN_FLIGHT"] = "DEPENDENCY_INSTALL_IN_FLIGHT";
124
+ })(LocalDevSupervisorBlocker || (LocalDevSupervisorBlocker = {}));
125
+ /**
126
+ * The application-relative file, under the runtime-signals home, that says a dependency install is running in the
127
+ * application, or when the last one ended (#3552). See {@link LocalDevDependencyInstallRecord_Schema}.
128
+ */
129
+ export const LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_FILE = 'dependency-install.json';
130
+ export const LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_KIND = 'wildo.local-dev.dependency-install';
131
+ /**
132
+ * Where a dependency install stands, as every dev-loop reader of {@link LocalDevDependencyInstallRecord_Schema} judges it.
133
+ */
134
+ export var LocalDevDependencyInstallPhase;
135
+ (function (LocalDevDependencyInstallPhase) {
136
+ /** No install has been recorded in this application. */
137
+ LocalDevDependencyInstallPhase["NONE"] = "NONE";
138
+ /** An install is running: its writer is alive and its deadline has not passed. Nothing may start on the tree. */
139
+ LocalDevDependencyInstallPhase["IN_FLIGHT"] = "IN_FLIGHT";
140
+ /**
141
+ * The install is over: it finished (successfully or not), its writer died without finishing, or it outlived its
142
+ * deadline. Everything that compiled or started before it ended read a tree that has since changed.
143
+ */
144
+ LocalDevDependencyInstallPhase["ENDED"] = "ENDED";
145
+ })(LocalDevDependencyInstallPhase || (LocalDevDependencyInstallPhase = {}));
146
+ const isoTimestamp = z.string().refine((value) => Number.isFinite(Date.parse(value)), 'an ISO-8601 timestamp');
147
+ /**
148
+ * The process found listening on a port. That SOMETHING listens is established by connecting to it; who it is comes
149
+ * from the operating system's tools (`lsof`, `ps`), which a host may lack, so every field but `port` may be unknown.
150
+ */
151
+ export const LocalDevPortHolder_Schema = z.object({
152
+ port: z.number().int().positive(),
153
+ pid: z.number().int().positive().nullable(),
154
+ /** The holder's parent. `1` means it was re-parented to the init process: its own parent is gone (an orphan). */
155
+ ppid: z.number().int().nonnegative().nullable(),
156
+ /** When the holder started, as `ps` reports it. */
157
+ startedAt: z.string().nullable(),
158
+ /** The holder's working directory. */
159
+ cwd: z.string().nullable(),
160
+ /** The holder's command line, truncated. */
161
+ command: z.string().nullable(),
162
+ });
163
+ /**
164
+ * One application package's compiler, as its observer last published it. Loose (unknown keys kept) because the framework
165
+ * developer's observer writes further fields (its diagnostic, its producer kind) that no reader here depends on.
166
+ */
167
+ export const LocalDevCompileObservation_Schema = z.looseObject({
168
+ kind: z.literal(LOCAL_DEV_COMPILE_OBSERVATION_KIND),
169
+ schemaVersion: z.literal(LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION),
170
+ producerPid: z.number().int().positive(),
171
+ /** The compiler process the producer owns, or null when none runs. */
172
+ childPid: z.number().int().positive().nullable(),
173
+ appRoot: z.string().min(1),
174
+ packageRoot: z.string().min(1),
175
+ packageName: z.string().min(1),
176
+ state: z.enum(LocalDevCompileState),
177
+ heartbeatAt: isoTimestamp,
178
+ updatedAt: isoTimestamp,
179
+ /** When the compiler last reported a compilation start. */
180
+ lastCompilationStartedAt: isoTimestamp.nullable(),
181
+ /** When a compilation last ended READY: emitted, post-processed and verified. */
182
+ lastSuccessfulCompileAt: isoTimestamp.nullable(),
183
+ lastFailureAt: isoTimestamp.nullable(),
184
+ lastErrorCount: z.number().int().nonnegative().nullable(),
185
+ });
186
+ /** One supervised runtime. Loose for the same reason as the compile observation. */
187
+ export const LocalDevSupervisorObservation_Schema = z.looseObject({
188
+ kind: z.literal(LOCAL_DEV_SUPERVISOR_OBSERVATION_KIND),
189
+ schemaVersion: z.literal(LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION),
190
+ producerPid: z.number().int().positive(),
191
+ label: z.string().min(1),
192
+ state: z.enum(LocalDevSupervisorState),
193
+ childPid: z.number().int().positive().nullable(),
194
+ /** When the current (or last) runtime child was started. */
195
+ childStartedAt: isoTimestamp.nullable().optional(),
196
+ /** A free-text reason (the monorepo supervisor's), or one of {@link LocalDevSupervisorBlocker}. */
197
+ blocker: z.string().nullable(),
198
+ /** Set with {@link LocalDevSupervisorBlocker.PORT_HELD_BY_FOREIGN_PROCESS}: the process that holds the port. */
199
+ portHolder: LocalDevPortHolder_Schema.nullable().optional(),
200
+ /**
201
+ * The file whose change asks this supervisor to restart its runtime (`<runtime-signals home>/<label>.signal`); `null`
202
+ * when the supervisor honours no such request. ABSENT from a writer that predates the field, which a reader treats as
203
+ * the conventional `<label>.signal` (the CLI does). Three writers set it: the monorepo's `runtime-supervisor.mjs`
204
+ * since #1031 and `wildo-dev-runtime serve` since #2134, each to its file (which is how `wildo secrets set` brings a
205
+ * changed key to a created application's running backend, minion or worker), and the app-creator companion's
206
+ * supervisor since #2149, to `null`: it honours no request, because the companion loads a changed key in place.
207
+ */
208
+ signalFilePath: z.string().min(1).nullable().optional(),
209
+ updatedAt: isoTimestamp,
210
+ });
211
+ /**
212
+ * A dependency install in an application, as its installer records it (#3552).
213
+ *
214
+ * ## Why it exists
215
+ *
216
+ * `pnpm install` re-creates the application's `node_modules` while `wildo local dev` runs against it. Measured on
217
+ * reference run 42666728304 (2026-11-09): the build's foundation step applied composition scenarios that added four
218
+ * minions and a documentation site, and installed them (16 s). In that window every compile watcher compiled against a
219
+ * half-installed tree (`TS2318 Cannot find global type 'Array'`, `TS6053 lib.dom.d.ts not found`) and nothing ever asked
220
+ * it to compile again; the backend's readiness stayed blocked on those failures; every companion introspection worker
221
+ * died on `Cannot find package 'zod'`; and the install re-created the virtual-store key of `@wildo-ai/framework-knowledge`
222
+ * without its compiled knowledge tree, so `GET /api/companion/creation/questions` answered 500 for as long as the run
223
+ * was watched. Nothing tied the install to the running stack.
224
+ *
225
+ * So the installer writes this record before the install (`finishedAt: null`) and again when it ends, and every dev-loop
226
+ * process reads it: a runtime supervisor HOLDS its runtime while the install is in flight and does not count a crash
227
+ * against its budget, then relaunches it (and, in a framework checkout, repairs the injected snapshots first); a
228
+ * compile observer restarts a watcher whose last compile began before the install ended.
229
+ *
230
+ * ## Why a pid and a deadline rather than a heartbeat
231
+ *
232
+ * Every other in-flight signal here is a heartbeat refreshed from a timer. An install is often run SYNCHRONOUSLY
233
+ * (`spawnSync` in the CLI), so no timer would beat during it. The writer's pid answers "still running?" and the
234
+ * deadline bounds a writer that hangs, so a record can never hold the stack for good.
235
+ *
236
+ * ## Why it is never removed
237
+ *
238
+ * The finished record is what tells a watcher that started compiling before the install ended to compile again. It is a
239
+ * cache in the sense of `one-source-of-truth.md`: deleting it costs one missed relaunch, never a fact.
240
+ */
241
+ export const LocalDevDependencyInstallRecord_Schema = z.looseObject({
242
+ kind: z.literal(LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_KIND),
243
+ schemaVersion: z.literal(LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION),
244
+ /** The process running the install (the companion, or the CLI). */
245
+ pid: z.number().int().positive(),
246
+ startedAt: isoTimestamp,
247
+ /** Past this instant the install is treated as ended, whatever its writer says. */
248
+ deadlineAt: isoTimestamp,
249
+ /** When the install ended, or `null` while it runs. */
250
+ finishedAt: isoTimestamp.nullable(),
251
+ /** Whether it succeeded, or `null` while it runs. */
252
+ succeeded: z.boolean().nullable(),
253
+ /** Who installed, for a reader of the record: `foundation`, `wildo update`, … */
254
+ initiator: z.string().min(1),
255
+ });
256
+ //# sourceMappingURL=local-dev-runtime-signals.contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-dev-runtime-signals.contracts.js","sourceRoot":"","sources":["../../../src/runtime/local-dev-runtime-signals.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,kHAAkH;AAClH,MAAM,CAAC,MAAM,0CAA0C,GAAG,CAAC,CAAC;AAE5D,oFAAoF;AACpF,MAAM,CAAC,MAAM,8CAA8C,GAAG,6BAA6B,CAAC;AAE5F,8GAA8G;AAC9G,MAAM,CAAC,MAAM,wCAAwC,GAAG,WAAW,CAAC;AAEpE,gGAAgG;AAChG,MAAM,CAAC,MAAM,2CAA2C,GAAG,aAAa,CAAC;AAEzE,MAAM,CAAC,MAAM,kCAAkC,GAAG,qCAAqC,CAAC;AACxF,MAAM,CAAC,MAAM,qCAAqC,GAAG,wCAAwC,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAN,IAAY,oBAgBX;AAhBD,WAAY,oBAAoB;IAC9B,2EAA2E;IAC3E,6CAAqB,CAAA;IACrB,2GAA2G;IAC3G,+CAAuB,CAAA;IACvB;;;OAGG;IACH,iDAAyB,CAAA;IACzB,yHAAyH;IACzH,uCAAe,CAAA;IACf,sHAAsH;IACtH,yCAAiB,CAA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,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,WAAW,CAAC;IAClE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,wCAAwC,CAAC;IACzD,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,0CAA0C,CAAC;IACpE,mEAAmE;IACnE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,YAAY;IACvB,mFAAmF;IACnF,UAAU,EAAE,YAAY;IACxB,uDAAuD;IACvD,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE;IACnC,qDAAqD;IACrD,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACjC,iFAAiF;IACjF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC7B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * The local dev loop's two RUNTIME-SIGNAL records: what an application package's compiler last did, and what the\n * supervisor of an application runtime (the backend) is doing (#3212, #3214, #3215, #3216).\n *\n * ## Why these live here, beside the backend's start record\n *\n * Both records were born in the monorepo's dev orchestrator (`scripts/dev-orchestrator/local-dev-protocol.mjs`), a\n * dependency-free script that only a FRAMEWORK DEVELOPER's application runs. An application created from the published\n * framework (app-creator mode) ran neither: its shared library was `tsc-watch` plus a `tsc-alias` pass, and its backend\n * was `node dist/index.js` started from the backend's own `tsc-watch --onSuccess`. Four defects of\n * `app-creation-test-007` followed from that one absence:\n *\n * - nothing restarted the backend when the shared library it imports was rebuilt, so a tree that was already fixed stayed\n * down for 46 minutes (#3215);\n * - the backend could start between the shared library's `tsc` emit and its alias pass, read extensionless imports and\n * die with `ERR_MODULE_NOT_FOUND`, and nothing brought it back (#3216);\n * - a backend left behind by an earlier generation kept the port and served stale code while every rebuild's start died\n * on \"port in use\", and a watcher dead since a laptop sleep was never noticed (#3214);\n * - the companion read the application's packages the instant a playbook had written their sources, before their\n * compiler had published, and stopped the whole creation loop on one stale read (#3212).\n *\n * The published framework now ships the writer of both records (`wildo-dev-runtime`, the program of\n * `@wildo-ai/wildo-dev-runtime`, which runs this package's `./dev-runtime` code, #3263), so the same files exist in both\n * modes, at the same paths, in the same shape. The companion reads them through THIS module and the\n * framework-developer scripts keep writing them from their own copy of the vocabulary, which is why the values below\n * are pinned against that script by a test rather than restated by hand.\n *\n * ## Where they live\n *\n * Under the application's runtime-signals home, `<app>/.wildo-saas/runtime-signals/`:\n * `compilers/<package file name>.json` for a compiler, `supervisors/<label>.json` for a runtime supervisor.\n */\n\n/** The protocol version both records carry. A reader refuses any other value rather than guessing its meaning. */\nexport const LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION = 1;\n\n/** The application-relative runtime-signals home every record below lives under. */\nexport const APPLICATION_RUNTIME_SIGNALS_RELATIVE_DIRECTORY = '.wildo-saas/runtime-signals';\n\n/** The directory, under the runtime-signals home, holding one compile observation per application package. */\nexport const LOCAL_DEV_COMPILE_OBSERVATIONS_DIRECTORY = 'compilers';\n\n/** The directory, under the runtime-signals home, holding one record per supervised runtime. */\nexport const LOCAL_DEV_SUPERVISOR_OBSERVATIONS_DIRECTORY = 'supervisors';\n\nexport const LOCAL_DEV_COMPILE_OBSERVATION_KIND = 'wildo.local-dev.compile-observation';\nexport const LOCAL_DEV_SUPERVISOR_OBSERVATION_KIND = 'wildo.local-dev.supervisor-observation';\n\n/**\n * What an application package's compiler is doing. A package's `dist` may be READ only while its compiler is `READY`:\n * every other state means the output is being written, or was left half-written, or is not being kept current at all.\n */\nexport enum LocalDevCompileState {\n /** The compiler is starting and has not finished its first compilation. */\n STARTING = 'STARTING',\n /** `tsc` reported a compilation START and has not reported its end: it may be writing `dist` right now. */\n COMPILING = 'COMPILING',\n /**\n * `tsc` finished with no error and the post-emit pass (the import-specifier rewrite) is running. The emitted files\n * still carry extensionless relative imports that Node cannot resolve until this pass ends — the window #3216 measured.\n */\n FINALIZING = 'FINALIZING',\n /** The last compilation finished, its post-emit pass completed, and the emitted tree was verified. `dist` is current. */\n READY = 'READY',\n /** The last compilation reported errors, or its post-emit pass failed. `dist` holds an earlier or a partial build. */\n FAILED = 'FAILED',\n /** The compiler is not running. Nothing keeps `dist` current. */\n STOPPED = 'STOPPED',\n}\n\n/** What a runtime supervisor is doing with the runtime it owns. */\nexport enum LocalDevSupervisorState {\n /** Waiting to start the runtime: its build or a dependency's is not published yet, or a restart is under way. */\n STARTING = 'STARTING',\n /** The runtime is running and was started by this supervisor. */\n RUNNING = 'RUNNING',\n /** The runtime exited unexpectedly and a respawn is scheduled after a backoff. */\n BACKOFF = 'BACKOFF',\n /**\n * The supervisor will not start the runtime until something changes: `blocker` says what (a crash budget spent, a\n * port another process holds). A new build of a package it loads resets it.\n */\n PAUSED = 'PAUSED',\n /** The supervisor stopped and its runtime with it. */\n STOPPED = 'STOPPED',\n}\n\n/**\n * Why a supervisor is not running its runtime, as a closed vocabulary a reader can branch on.\n *\n * Kept apart from the free-text blockers the monorepo's supervisor publishes (a readiness reason, a migration owed)\n * because the remedy differs per member: a held port is the dev stack's, a crash loop is usually a dependency that is\n * down (#3365), and a spent budget is the application's own startup refusing. The `.mjs` mirror is\n * `LocalDevSupervisorBlocker` in `scripts/dev-orchestrator/local-dev-protocol.mjs`.\n */\nexport enum LocalDevSupervisorBlocker {\n /**\n * PAUSED: the runtime crashed at every respawn of its budget AND its own startup refused (its start record says\n * `startup-refused`), so a new build of a package it loads is what fixes it, and starts it again.\n */\n CRASH_RESPAWN_EXHAUSTED = 'CRASH_RESPAWN_EXHAUSTED',\n /**\n * BACKOFF past the budget (#3365): the runtime keeps crashing and the supervisor keeps restarting it, the delay\n * doubling up to a cap and never stopping (Kubernetes' CrashLoopBackOff). Published when the cause is a dependency\n * that did not answer, or cannot be told: a database that comes back must bring its runtime back by itself.\n * A reader treats it like a pause for \"is the application up?\": the runtime is not running between attempts.\n */\n CRASH_LOOP_BACKOFF = 'CRASH_LOOP_BACKOFF',\n /**\n * A process this supervisor did not spawn listens on the runtime's port, so every start dies binding it. The record's\n * `portHolder` names it. The supervisor starts the runtime the moment the port is free.\n */\n PORT_HELD_BY_FOREIGN_PROCESS = 'PORT_HELD_BY_FOREIGN_PROCESS',\n /**\n * STOPPED (#2149): an app-creator COMPANION's supervisor (`wildo-dev-companion-supervised`) saw it crash more times\n * than its window tolerates, stopped restarting it, and exited. Unlike {@link CRASH_RESPAWN_EXHAUSTED}, no build\n * starts it again: only restarting `wildo local dev` does, after the cause in its log is fixed. The record outlives\n * its producer on purpose, which is how `wildo local dev-status` can say the companion is down and why.\n */\n CRASH_LOOP_GAVE_UP = 'CRASH_LOOP_GAVE_UP',\n /**\n * PAUSED (#3552): a dependency install is re-creating the application's `node_modules` (the build applied a\n * composition scenario, or a person ran an install). A start now would boot against a half-installed tree, so the\n * runtime is held, and a crash in this window is not counted against its budget. It starts again, with a fresh\n * budget, the moment the install ends. See {@link LocalDevDependencyInstallRecord_Schema}.\n */\n DEPENDENCY_INSTALL_IN_FLIGHT = 'DEPENDENCY_INSTALL_IN_FLIGHT',\n}\n\n/**\n * The application-relative file, under the runtime-signals home, that says a dependency install is running in the\n * application, or when the last one ended (#3552). See {@link LocalDevDependencyInstallRecord_Schema}.\n */\nexport const LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_FILE = 'dependency-install.json';\nexport const LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_KIND = 'wildo.local-dev.dependency-install';\n\n/**\n * Where a dependency install stands, as every dev-loop reader of {@link LocalDevDependencyInstallRecord_Schema} judges it.\n */\nexport enum LocalDevDependencyInstallPhase {\n /** No install has been recorded in this application. */\n NONE = 'NONE',\n /** An install is running: its writer is alive and its deadline has not passed. Nothing may start on the tree. */\n IN_FLIGHT = 'IN_FLIGHT',\n /**\n * The install is over: it finished (successfully or not), its writer died without finishing, or it outlived its\n * deadline. Everything that compiled or started before it ended read a tree that has since changed.\n */\n ENDED = 'ENDED',\n}\n\nconst isoTimestamp = z.string().refine((value) => Number.isFinite(Date.parse(value)), 'an ISO-8601 timestamp');\n\n/**\n * The process found listening on a port. That SOMETHING listens is established by connecting to it; who it is comes\n * from the operating system's tools (`lsof`, `ps`), which a host may lack, so every field but `port` may be unknown.\n */\nexport const LocalDevPortHolder_Schema = z.object({\n port: z.number().int().positive(),\n pid: z.number().int().positive().nullable(),\n /** The holder's parent. `1` means it was re-parented to the init process: its own parent is gone (an orphan). */\n ppid: z.number().int().nonnegative().nullable(),\n /** When the holder started, as `ps` reports it. */\n startedAt: z.string().nullable(),\n /** The holder's working directory. */\n cwd: z.string().nullable(),\n /** The holder's command line, truncated. */\n command: z.string().nullable(),\n});\nexport type LocalDevPortHolder = z.infer<typeof LocalDevPortHolder_Schema>;\n\n/**\n * One application package's compiler, as its observer last published it. Loose (unknown keys kept) because the framework\n * developer's observer writes further fields (its diagnostic, its producer kind) that no reader here depends on.\n */\nexport const LocalDevCompileObservation_Schema = z.looseObject({\n kind: z.literal(LOCAL_DEV_COMPILE_OBSERVATION_KIND),\n schemaVersion: z.literal(LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION),\n producerPid: z.number().int().positive(),\n /** The compiler process the producer owns, or null when none runs. */\n childPid: z.number().int().positive().nullable(),\n appRoot: z.string().min(1),\n packageRoot: z.string().min(1),\n packageName: z.string().min(1),\n state: z.enum(LocalDevCompileState),\n heartbeatAt: isoTimestamp,\n updatedAt: isoTimestamp,\n /** When the compiler last reported a compilation start. */\n lastCompilationStartedAt: isoTimestamp.nullable(),\n /** When a compilation last ended READY: emitted, post-processed and verified. */\n lastSuccessfulCompileAt: isoTimestamp.nullable(),\n lastFailureAt: isoTimestamp.nullable(),\n lastErrorCount: z.number().int().nonnegative().nullable(),\n});\nexport type LocalDevCompileObservation = z.infer<typeof LocalDevCompileObservation_Schema>;\n\n/** One supervised runtime. Loose for the same reason as the compile observation. */\nexport const LocalDevSupervisorObservation_Schema = z.looseObject({\n kind: z.literal(LOCAL_DEV_SUPERVISOR_OBSERVATION_KIND),\n schemaVersion: z.literal(LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION),\n producerPid: z.number().int().positive(),\n label: z.string().min(1),\n state: z.enum(LocalDevSupervisorState),\n childPid: z.number().int().positive().nullable(),\n /** When the current (or last) runtime child was started. */\n childStartedAt: isoTimestamp.nullable().optional(),\n /** A free-text reason (the monorepo supervisor's), or one of {@link LocalDevSupervisorBlocker}. */\n blocker: z.string().nullable(),\n /** Set with {@link LocalDevSupervisorBlocker.PORT_HELD_BY_FOREIGN_PROCESS}: the process that holds the port. */\n portHolder: LocalDevPortHolder_Schema.nullable().optional(),\n /**\n * The file whose change asks this supervisor to restart its runtime (`<runtime-signals home>/<label>.signal`); `null`\n * when the supervisor honours no such request. ABSENT from a writer that predates the field, which a reader treats as\n * the conventional `<label>.signal` (the CLI does). Three writers set it: the monorepo's `runtime-supervisor.mjs`\n * since #1031 and `wildo-dev-runtime serve` since #2134, each to its file (which is how `wildo secrets set` brings a\n * changed key to a created application's running backend, minion or worker), and the app-creator companion's\n * supervisor since #2149, to `null`: it honours no request, because the companion loads a changed key in place.\n */\n signalFilePath: z.string().min(1).nullable().optional(),\n updatedAt: isoTimestamp,\n});\nexport type LocalDevSupervisorObservation = z.infer<typeof LocalDevSupervisorObservation_Schema>;\n\n/**\n * A dependency install in an application, as its installer records it (#3552).\n *\n * ## Why it exists\n *\n * `pnpm install` re-creates the application's `node_modules` while `wildo local dev` runs against it. Measured on\n * reference run 42666728304 (2026-11-09): the build's foundation step applied composition scenarios that added four\n * minions and a documentation site, and installed them (16 s). In that window every compile watcher compiled against a\n * half-installed tree (`TS2318 Cannot find global type 'Array'`, `TS6053 lib.dom.d.ts not found`) and nothing ever asked\n * it to compile again; the backend's readiness stayed blocked on those failures; every companion introspection worker\n * died on `Cannot find package 'zod'`; and the install re-created the virtual-store key of `@wildo-ai/framework-knowledge`\n * without its compiled knowledge tree, so `GET /api/companion/creation/questions` answered 500 for as long as the run\n * was watched. Nothing tied the install to the running stack.\n *\n * So the installer writes this record before the install (`finishedAt: null`) and again when it ends, and every dev-loop\n * process reads it: a runtime supervisor HOLDS its runtime while the install is in flight and does not count a crash\n * against its budget, then relaunches it (and, in a framework checkout, repairs the injected snapshots first); a\n * compile observer restarts a watcher whose last compile began before the install ended.\n *\n * ## Why a pid and a deadline rather than a heartbeat\n *\n * Every other in-flight signal here is a heartbeat refreshed from a timer. An install is often run SYNCHRONOUSLY\n * (`spawnSync` in the CLI), so no timer would beat during it. The writer's pid answers \"still running?\" and the\n * deadline bounds a writer that hangs, so a record can never hold the stack for good.\n *\n * ## Why it is never removed\n *\n * The finished record is what tells a watcher that started compiling before the install ended to compile again. It is a\n * cache in the sense of `one-source-of-truth.md`: deleting it costs one missed relaunch, never a fact.\n */\nexport const LocalDevDependencyInstallRecord_Schema = z.looseObject({\n kind: z.literal(LOCAL_DEV_DEPENDENCY_INSTALL_RECORD_KIND),\n schemaVersion: z.literal(LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION),\n /** The process running the install (the companion, or the CLI). */\n pid: z.number().int().positive(),\n startedAt: isoTimestamp,\n /** Past this instant the install is treated as ended, whatever its writer says. */\n deadlineAt: isoTimestamp,\n /** When the install ended, or `null` while it runs. */\n finishedAt: isoTimestamp.nullable(),\n /** Whether it succeeded, or `null` while it runs. */\n succeeded: z.boolean().nullable(),\n /** Who installed, for a reader of the record: `foundation`, `wildo update`, … */\n initiator: z.string().min(1),\n});\nexport type LocalDevDependencyInstallRecord = z.infer<typeof LocalDevDependencyInstallRecord_Schema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-topology.contracts.d.ts","sourceRoot":"","sources":["../../../../src/runtime/runtime-topology.contracts.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,oBAAY,uBAAuB;IACjC,qBAAqB,0BAA0B;IAC/C,iCAAiC,sCAAsC;IACvE,wBAAwB,6BAA6B;IACrD,qBAAqB,0BAA0B;IAC/C,QAAQ,aAAa;IACrB,aAAa,kBAAkB;CAChC;AAED;;;;;GAKG;AACH,oBAAY,0BAA0B;IACpC,qBAAqB,0BAAgD;IACrE,iCAAiC,sCAA4D;IAC7F,wBAAwB,6BAAmD;CAC5E;AAED,MAAM,WAAW,6BAA6B;IAC5C,WAAW,EAAE,mBAAmB,CAAC;IACjC,sBAAsB,EAAE,mBAAmB,CAAC;IAC5C;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,6BAA6B,GACnC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CASrC;AAED,MAAM,WAAW,gCAAgC;IAC/C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,SAAS,CAAC;IACvE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC1C,sBAAsB,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACzD,cAAc,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAClD;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,gCAAgC,GACtC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAerC;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAC7C,MAAM,CAER;AAED,wBAAgB,2BAA2B,CACzC,0BAA0B,EAAE,MAAM,GACjC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAsBrC"}
1
+ {"version":3,"file":"runtime-topology.contracts.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime-topology.contracts.ts"],"names":[],"mappings":"AAK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