@wildo-ai/platform-core-shared 1.1.11 → 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.
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 +52 -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 +49 -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 +457 -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 +291 -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
@@ -0,0 +1,386 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { readdirSync, statSync } from 'node:fs';
4
+ import { createRequire } from 'node:module';
5
+ import { join, resolve } from 'node:path';
6
+ import { LOCAL_DEV_COMPILE_OBSERVATION_KIND, LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION, LocalDevCompileState, } from '../runtime/local-dev-runtime-signals.contracts.js';
7
+ import { compileObservationPath, isLiveCompileObservation, readCompileObservation, writeRuntimeSignalRecord } from './dev-runtime-signals.js';
8
+ import { childExited, isProcessAlive, killProcessGroupNow, readProcessIdentity, terminateProcessGroup, usesProcessGroups } from './dev-runtime-processes.js';
9
+ import { scanEmittedTreeForUnresolvableSpecifiers } from './emitted-relative-specifiers.js';
10
+ import { classifyDependencyInstall, compilerReadTreeBeforeDependencyInstallEnded, readDependencyInstallRecord, readNodeModulesInstalledAtMs } from './dependency-install-record.js';
11
+ /**
12
+ * One application package's compiler, run so that its `dist` is never READ half-published (#3216) and never silently
13
+ * stops being kept current (#3214).
14
+ *
15
+ * ## What it replaces, and why the replacement owns `tsc` directly
16
+ *
17
+ * An app-creator package compiled with `tsc-watch -p … --onSuccess "tsc-alias …"`: `tsc` writes extensionless relative
18
+ * imports, the alias pass rewrites them a moment later, and NOTHING said which of the two states `dist` was in. A backend
19
+ * starting in between read `./x` and died with `ERR_MODULE_NOT_FOUND` (#3216). And when the watcher went deaf after a
20
+ * laptop sleep (a file-watch subscription that outlived the daemon behind it — see
21
+ * `.claude/rules/staleness-presents-as-a-logic-defect.md`), nothing noticed: `touch backend-api/src/index.ts` changed
22
+ * nothing for an hour (#3214).
23
+ *
24
+ * So this loop runs `tsc --watch` itself, reads the compiler's own start/end lines, runs the alias pass, VERIFIES the
25
+ * emitted tree, and publishes one compile observation — the same record, at the same path, that a framework developer's
26
+ * observer publishes — whose `READY` means "emitted, rewritten and verified". A reader (the backend supervisor, the dev
27
+ * companion) reads `dist` only on `READY`.
28
+ *
29
+ * ## Rejected: an atomic staging swap of the whole tree
30
+ *
31
+ * Emitting into a staging directory and renaming it over `dist` would make publication atomic for a reader that never
32
+ * consults the record. It was rejected for two measured costs: `tsc --watch` keeps its incremental state against ONE
33
+ * output directory, so every cycle would copy the whole tree (thousands of files in a grown application); and a rename
34
+ * replaces the directory inode that the companion's module-generation reader and Vite's dependency watcher are bound to.
35
+ * The record is the publication instead, and every reader in the dev loop consults it.
36
+ *
37
+ * ## A deaf watcher is restarted on evidence
38
+ *
39
+ * While idle, the loop compares the newest source mtime with the last compilation start. A source changed more than
40
+ * {@link DEFAULT_BLIND_WATCHER_GRACE_MS} ago that started no compilation is a watcher that did not see it, and the
41
+ * compiler is restarted. `tsc`'s own debounce is 250 ms, so the grace is generous by two orders of magnitude.
42
+ */
43
+ /** How long a source change may go unanswered before the compiler is judged deaf and restarted. */
44
+ export const DEFAULT_BLIND_WATCHER_GRACE_MS = 30_000;
45
+ /** How often an idle compiler is checked for deafness. */
46
+ export const DEFAULT_BLIND_WATCHER_CHECK_INTERVAL_MS = 15_000;
47
+ /** How often the record's `heartbeatAt` is refreshed, so a reader can tell a live record from a stopped one. */
48
+ const HEARTBEAT_INTERVAL_MS = 5_000;
49
+ const COMPILER_RESPAWN_BASE_DELAY_MS = 2_000;
50
+ const COMPILER_RESPAWN_MAX_DELAY_MS = 30_000;
51
+ /** `tsc --watch` start lines (TS6031 / TS6032), as printed with `--preserveWatchOutput`. */
52
+ const COMPILATION_STARTED_PATTERN = /Starting compilation in watch mode|File change detected\. Starting incremental compilation/u;
53
+ /** `tsc --watch` end line (TS6193 / TS6194). */
54
+ const COMPILATION_ENDED_PATTERN = /Found (\d+) errors?\. Watching for file changes/u;
55
+ /** ANSI colour codes, which `tsc` writes when it believes it has a terminal. */
56
+ const ANSI_PATTERN = /\u001b\[[0-9;]*m/gu;
57
+ /** Source files that are not part of the package's compiled program and must not count as an unanswered change. */
58
+ const NON_PROGRAM_SOURCE_PATTERN = /(?:^|\/)(?:__tests__|__mocks__)(?:\/|$)|\.(?:test|spec)\.[cm]?tsx?$/u;
59
+ const PROGRAM_SOURCE_PATTERN = /\.(?:[cm]?tsx?|json)$/u;
60
+ /** Resolve a dependency's file from the package that declares it, the way `pnpm exec` would find its binary. */
61
+ function resolveFromPackage(packageRoot, specifier) {
62
+ return createRequire(join(packageRoot, 'package.json')).resolve(specifier);
63
+ }
64
+ /** The newest program source under `roots`, with its mtime; `undefined` when there is none. */
65
+ export function findNewestProgramSource(roots) {
66
+ let newest;
67
+ const walk = (directory) => {
68
+ let entries;
69
+ try {
70
+ entries = readdirSync(directory, { withFileTypes: true });
71
+ }
72
+ catch {
73
+ return;
74
+ }
75
+ for (const entry of entries) {
76
+ const path = join(directory, entry.name);
77
+ if (entry.isDirectory()) {
78
+ if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name.startsWith('.'))
79
+ continue;
80
+ if (NON_PROGRAM_SOURCE_PATTERN.test(`${entry.name}/`))
81
+ continue;
82
+ walk(path);
83
+ continue;
84
+ }
85
+ if (!entry.isFile() || !PROGRAM_SOURCE_PATTERN.test(entry.name) || NON_PROGRAM_SOURCE_PATTERN.test(entry.name))
86
+ continue;
87
+ try {
88
+ const { mtimeMs } = statSync(path);
89
+ if (newest === undefined || mtimeMs > newest.mtimeMs)
90
+ newest = { path, mtimeMs };
91
+ }
92
+ catch {
93
+ // Removed mid-walk.
94
+ }
95
+ }
96
+ };
97
+ for (const root of roots)
98
+ walk(root);
99
+ return newest;
100
+ }
101
+ /**
102
+ * Is the compiler deaf? True when the newest program source changed after the last compilation START, and longer ago
103
+ * than the grace: the compiler had every chance to see it and did not. Pure, so the rule is pinned without a clock.
104
+ */
105
+ export function compilerMissedSourceChange(input) {
106
+ if (input.newestSourceMtimeMs === undefined || input.lastCompilationStartedAtMs === undefined)
107
+ return false;
108
+ if (input.newestSourceMtimeMs <= input.lastCompilationStartedAtMs)
109
+ return false;
110
+ return input.nowMs - input.newestSourceMtimeMs > input.graceMs;
111
+ }
112
+ export class PackageCompileLoop {
113
+ options;
114
+ recordPath;
115
+ distRoot;
116
+ sourceRoots;
117
+ typescriptCompilerPath;
118
+ aliasCompilerPath;
119
+ output;
120
+ log;
121
+ listeners = new Set();
122
+ state;
123
+ compiler = null;
124
+ aliasPass = null;
125
+ /** Bumped at every compilation start, so an alias pass that finishes after a newer start publishes nothing. */
126
+ generation = 0;
127
+ compilationStartedAtMs = 0;
128
+ stdoutBuffer = '';
129
+ stopping = false;
130
+ respawnDelayMs = COMPILER_RESPAWN_BASE_DELAY_MS;
131
+ respawnTimer = null;
132
+ heartbeatTimer = null;
133
+ blindWatcherTimer = null;
134
+ /** When the current compiler process was spawned: what an ended dependency install is compared against (#3552). */
135
+ compilerStartedAtMs = Number.NaN;
136
+ constructor(options) {
137
+ this.options = options;
138
+ this.recordPath = compileObservationPath(options.appRoot, options.packageName);
139
+ this.distRoot = resolve(options.packageRoot, options.dist);
140
+ this.sourceRoots = options.sourceRoots ?? [join(options.packageRoot, 'src')];
141
+ this.typescriptCompilerPath = options.typescriptCompilerPath ?? resolveFromPackage(options.packageRoot, 'typescript/bin/tsc');
142
+ this.aliasCompilerPath = options.aliasCompilerPath ?? resolveFromPackage(options.packageRoot, 'tsc-alias/dist/bin/index.js');
143
+ this.output = options.output ?? ((text) => process.stdout.write(text));
144
+ this.log = options.log ?? ((line) => process.stdout.write(`[wildo-dev-runtime] ${options.packageName}: ${line}\n`));
145
+ const now = new Date().toISOString();
146
+ this.state = {
147
+ kind: LOCAL_DEV_COMPILE_OBSERVATION_KIND,
148
+ schemaVersion: LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION,
149
+ producerKind: 'wildo-dev-runtime',
150
+ producerInstanceId: randomUUID(),
151
+ producerPid: process.pid,
152
+ childPid: null,
153
+ appRoot: options.appRoot,
154
+ packageRoot: options.packageRoot,
155
+ packageName: options.packageName,
156
+ state: LocalDevCompileState.STARTING,
157
+ heartbeatAt: now,
158
+ updatedAt: now,
159
+ lastCompilationStartedAt: null,
160
+ lastSuccessfulCompileAt: null,
161
+ lastFailureAt: null,
162
+ lastErrorCount: null,
163
+ failureSummary: null,
164
+ diagnostic: null,
165
+ };
166
+ }
167
+ get observation() {
168
+ return this.state;
169
+ }
170
+ onChange(listener) {
171
+ this.listeners.add(listener);
172
+ return () => this.listeners.delete(listener);
173
+ }
174
+ /**
175
+ * Start compiling. REFUSES when another live process already compiles this package (two writers of one `dist` is the
176
+ * defect, not a configuration), and stops the compiler an earlier generation left behind when its owner died.
177
+ */
178
+ async start() {
179
+ const previous = readCompileObservation(this.recordPath);
180
+ // A pid alone is not a live producer (pids are reused); a fresh heartbeat on a record that has not STOPPED is.
181
+ if (previous && previous.producerPid !== process.pid && isLiveCompileObservation(previous)) {
182
+ throw new Error(`${this.options.packageName} is already compiled by process ${previous.producerPid} (${this.recordPath}). Stop that dev process first: two compilers writing one dist is what this refuses.`);
183
+ }
184
+ if (previous?.childPid && isProcessAlive(previous.childPid)) {
185
+ const identity = readProcessIdentity(previous.childPid);
186
+ if (identity?.cwd === this.options.packageRoot && /--watch/u.test(identity.command ?? '')) {
187
+ this.log(`stopping the compiler an earlier dev run left behind (pid ${previous.childPid}, parent ${identity.ppid ?? 'unknown'})`);
188
+ await terminateProcessGroup(previous.childPid);
189
+ }
190
+ }
191
+ this.publish({});
192
+ this.heartbeatTimer = setInterval(() => this.publish({}, false), HEARTBEAT_INTERVAL_MS);
193
+ this.heartbeatTimer.unref();
194
+ this.blindWatcherTimer = setInterval(() => void this.checkForDeafCompiler(), this.options.blindWatcherCheckIntervalMs ?? DEFAULT_BLIND_WATCHER_CHECK_INTERVAL_MS);
195
+ this.blindWatcherTimer.unref();
196
+ this.spawnCompiler();
197
+ }
198
+ /** Kill the compiler and an alias pass synchronously: for a process that is exiting and cannot await {@link stop}. */
199
+ killChildrenNow() {
200
+ killProcessGroupNow(this.aliasPass?.pid);
201
+ killProcessGroupNow(this.compiler?.pid);
202
+ }
203
+ async stop() {
204
+ this.stopping = true;
205
+ for (const timer of [this.respawnTimer, this.heartbeatTimer, this.blindWatcherTimer])
206
+ if (timer)
207
+ clearTimeout(timer);
208
+ const children = [this.aliasPass, this.compiler].filter((child) => child?.pid !== undefined);
209
+ await Promise.all(children.map((child) => terminateProcessGroup(child.pid, 3_000)));
210
+ this.compiler = null;
211
+ this.aliasPass = null;
212
+ this.publish({ state: LocalDevCompileState.STOPPED, childPid: null });
213
+ }
214
+ publish(updates, transition = true) {
215
+ const timestamp = new Date().toISOString();
216
+ this.state = { ...this.state, ...updates, heartbeatAt: timestamp, ...(transition ? { updatedAt: timestamp } : {}) };
217
+ try {
218
+ writeRuntimeSignalRecord(this.recordPath, this.state);
219
+ }
220
+ catch (error) {
221
+ this.log(`could not publish the compile record (${error.message}); readers will treat this package as unknown`);
222
+ }
223
+ if (transition)
224
+ for (const listener of this.listeners)
225
+ listener(this.state);
226
+ }
227
+ spawnCompiler() {
228
+ if (this.stopping)
229
+ return;
230
+ const child = spawn(process.execPath, [this.typescriptCompilerPath, '--watch', '-p', this.options.project, '--preserveWatchOutput'], {
231
+ cwd: this.options.packageRoot,
232
+ detached: usesProcessGroups(),
233
+ stdio: ['ignore', 'pipe', 'pipe'],
234
+ });
235
+ this.compiler = child;
236
+ this.compilerStartedAtMs = Date.now();
237
+ this.stdoutBuffer = '';
238
+ this.publish({ childPid: child.pid ?? null, state: LocalDevCompileState.STARTING });
239
+ child.stdout?.setEncoding('utf8');
240
+ child.stdout?.on('data', (chunk) => this.handleCompilerOutput(chunk));
241
+ child.stderr?.setEncoding('utf8');
242
+ child.stderr?.on('data', (chunk) => this.output(chunk));
243
+ child.once('exit', (code, signal) => {
244
+ if (this.compiler !== child)
245
+ return;
246
+ this.compiler = null;
247
+ if (this.stopping)
248
+ return;
249
+ this.publish({ state: LocalDevCompileState.STOPPED, childPid: null });
250
+ this.log(`the compiler exited (${signal ?? `code ${code}`}); restarting it in ${Math.round(this.respawnDelayMs / 1000)}s`);
251
+ this.respawnTimer = setTimeout(() => this.spawnCompiler(), this.respawnDelayMs);
252
+ this.respawnDelayMs = Math.min(this.respawnDelayMs * 2, COMPILER_RESPAWN_MAX_DELAY_MS);
253
+ });
254
+ }
255
+ handleCompilerOutput(chunk) {
256
+ this.output(chunk);
257
+ this.stdoutBuffer += chunk;
258
+ const lines = this.stdoutBuffer.split('\n');
259
+ this.stdoutBuffer = lines.pop() ?? '';
260
+ for (const rawLine of lines) {
261
+ const line = rawLine.replace(ANSI_PATTERN, '');
262
+ if (COMPILATION_STARTED_PATTERN.test(line)) {
263
+ this.handleCompilationStarted();
264
+ continue;
265
+ }
266
+ const ended = COMPILATION_ENDED_PATTERN.exec(line);
267
+ if (ended)
268
+ this.handleCompilationEnded(Number(ended[1]));
269
+ }
270
+ }
271
+ handleCompilationStarted() {
272
+ this.generation += 1;
273
+ this.compilationStartedAtMs = Date.now();
274
+ // An alias pass of the previous compilation rewrites files this one is about to replace: stop it.
275
+ if (this.aliasPass?.pid)
276
+ void terminateProcessGroup(this.aliasPass.pid);
277
+ this.aliasPass = null;
278
+ this.publish({ state: LocalDevCompileState.COMPILING, lastCompilationStartedAt: new Date(this.compilationStartedAtMs).toISOString() });
279
+ }
280
+ handleCompilationEnded(errorCount) {
281
+ // The compiler is answering, so a later exit is a new failure, not the same one: reset its backoff.
282
+ this.respawnDelayMs = COMPILER_RESPAWN_BASE_DELAY_MS;
283
+ if (errorCount > 0) {
284
+ this.publish({
285
+ state: LocalDevCompileState.FAILED,
286
+ lastFailureAt: new Date().toISOString(),
287
+ lastErrorCount: errorCount,
288
+ failureSummary: `tsc reported ${errorCount} error(s); dist is not published.`,
289
+ });
290
+ return;
291
+ }
292
+ this.publish({ state: LocalDevCompileState.FINALIZING });
293
+ const generation = this.generation;
294
+ const startedAtMs = this.compilationStartedAtMs;
295
+ const pass = spawn(process.execPath, [this.aliasCompilerPath, '-p', this.options.project, '--resolve-full-paths', '--resolve-full-extension', '.js'], {
296
+ cwd: this.options.packageRoot,
297
+ detached: usesProcessGroups(),
298
+ stdio: ['ignore', 'pipe', 'pipe'],
299
+ });
300
+ this.aliasPass = pass;
301
+ let passOutput = '';
302
+ pass.stdout?.setEncoding('utf8');
303
+ pass.stderr?.setEncoding('utf8');
304
+ pass.stdout?.on('data', (text) => { passOutput += text; });
305
+ pass.stderr?.on('data', (text) => { passOutput += text; });
306
+ void childExited(pass).then(() => {
307
+ if (generation !== this.generation || this.stopping)
308
+ return;
309
+ this.aliasPass = null;
310
+ if (pass.exitCode !== 0) {
311
+ this.output(passOutput);
312
+ this.publish({
313
+ state: LocalDevCompileState.FAILED,
314
+ lastFailureAt: new Date().toISOString(),
315
+ lastErrorCount: 0,
316
+ failureSummary: `the import-specifier rewrite (tsc-alias) failed with exit ${pass.exitCode ?? pass.signalCode}; dist is not published.`,
317
+ });
318
+ return;
319
+ }
320
+ // One second of slack: file-system mtimes are coarser than the clock that stamped the start.
321
+ const unresolvable = scanEmittedTreeForUnresolvableSpecifiers(this.distRoot, startedAtMs - 1000);
322
+ if (unresolvable.length > 0) {
323
+ const named = unresolvable.slice(0, 3).map((finding) => `${finding.file} imports '${finding.specifier}'`).join('; ');
324
+ this.log(`the emitted tree still holds imports Node cannot resolve (${named}); dist is not published`);
325
+ this.publish({
326
+ state: LocalDevCompileState.FAILED,
327
+ lastFailureAt: new Date().toISOString(),
328
+ lastErrorCount: 0,
329
+ failureSummary: `the emitted tree still holds extensionless relative imports after the rewrite: ${named}.`,
330
+ });
331
+ return;
332
+ }
333
+ this.publish({ state: LocalDevCompileState.READY, lastSuccessfulCompileAt: new Date().toISOString(), lastErrorCount: 0, failureSummary: null });
334
+ });
335
+ }
336
+ /**
337
+ * Restart a compiler that did not answer a source change (see the class comment), or that last read the tree before a
338
+ * dependency install ended (#3552).
339
+ *
340
+ * The second rule: an install re-creates `node_modules`, and a compiler that compiled while it ran read a half-installed
341
+ * tree (`TS2318 Cannot find global type 'Array'` once `typescript/lib` was gone) and records nothing that changes after
342
+ * the install. Measured on reference run 42666728304: three packages stayed FAILED on that error, so the backend was
343
+ * never allowed to start again. A watcher that compiled before the install also resolved modules the install moved.
344
+ * Self-limiting: the restarted compiler starts after the install ended.
345
+ */
346
+ async checkForDeafCompiler() {
347
+ if (this.stopping || this.compiler === null)
348
+ return;
349
+ const install = classifyDependencyInstall(readDependencyInstallRecord(this.options.appRoot), Date.now());
350
+ const nodeModulesInstalledAtMs = readNodeModulesInstalledAtMs(this.options.appRoot);
351
+ if (compilerReadTreeBeforeDependencyInstallEnded({
352
+ install,
353
+ nodeModulesInstalledAtMs,
354
+ lastCompilationStartedAtMs: this.state.lastCompilationStartedAt ? Date.parse(this.state.lastCompilationStartedAt) : null,
355
+ watcherStartedAtMs: this.compilerStartedAtMs,
356
+ compilerFailed: this.state.state === LocalDevCompileState.FAILED,
357
+ })) {
358
+ const endedAtMs = Math.max(install.endedAtMs ?? 0, nodeModulesInstalledAtMs ?? 0);
359
+ this.log(`a dependency install ended (${new Date(endedAtMs).toISOString()}) after the compiler last read the tree; restarting it so it compiles against the installed tree`);
360
+ await this.restartCompiler();
361
+ return;
362
+ }
363
+ if (this.state.state !== LocalDevCompileState.READY && this.state.state !== LocalDevCompileState.FAILED)
364
+ return;
365
+ const newest = findNewestProgramSource(this.sourceRoots);
366
+ const lastStartedAtMs = this.state.lastCompilationStartedAt ? Date.parse(this.state.lastCompilationStartedAt) : undefined;
367
+ if (!compilerMissedSourceChange({
368
+ newestSourceMtimeMs: newest?.mtimeMs,
369
+ lastCompilationStartedAtMs: lastStartedAtMs,
370
+ nowMs: Date.now(),
371
+ graceMs: this.options.blindWatcherGraceMs ?? DEFAULT_BLIND_WATCHER_GRACE_MS,
372
+ }))
373
+ return;
374
+ this.log(`the compiler did not answer a change to ${newest.path} (changed ${new Date(newest.mtimeMs).toISOString()}); its file watch is deaf, restarting it`);
375
+ await this.restartCompiler();
376
+ }
377
+ async restartCompiler() {
378
+ const previous = this.compiler;
379
+ this.compiler = null;
380
+ this.publish({ state: LocalDevCompileState.STARTING, childPid: null });
381
+ if (previous?.pid)
382
+ await terminateProcessGroup(previous.pid);
383
+ this.spawnCompiler();
384
+ }
385
+ }
386
+ //# sourceMappingURL=package-compile-loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-compile-loop.js","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0BAA0B,EAAE,eAAe;YAC3C,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,IAAI,8BAA8B;SAC5E,CAAC;YAAE,OAAO;QACX,IAAI,CAAC,GAAG,CAAC,2CAA2C,MAAO,CAAC,IAAI,aAAa,IAAI,IAAI,CAAC,MAAO,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;QAChK,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,IAAI,QAAQ,EAAE,GAAG;YAAE,MAAM,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC7D,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF","sourcesContent":["import { spawn, type ChildProcess } from 'node:child_process';\nimport { randomUUID } from 'node:crypto';\nimport { readdirSync, statSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { join, resolve } from 'node:path';\n\nimport {\n LOCAL_DEV_COMPILE_OBSERVATION_KIND,\n LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION,\n LocalDevCompileState,\n type LocalDevCompileObservation,\n} from '../runtime/local-dev-runtime-signals.contracts';\nimport { compileObservationPath, isLiveCompileObservation, readCompileObservation, writeRuntimeSignalRecord } from './dev-runtime-signals';\nimport { childExited, isProcessAlive, killProcessGroupNow, readProcessIdentity, terminateProcessGroup, usesProcessGroups } from './dev-runtime-processes';\nimport { scanEmittedTreeForUnresolvableSpecifiers } from './emitted-relative-specifiers';\nimport { classifyDependencyInstall, compilerReadTreeBeforeDependencyInstallEnded, readDependencyInstallRecord, readNodeModulesInstalledAtMs } from './dependency-install-record';\n\n/**\n * One application package's compiler, run so that its `dist` is never READ half-published (#3216) and never silently\n * stops being kept current (#3214).\n *\n * ## What it replaces, and why the replacement owns `tsc` directly\n *\n * An app-creator package compiled with `tsc-watch -p … --onSuccess \"tsc-alias …\"`: `tsc` writes extensionless relative\n * imports, the alias pass rewrites them a moment later, and NOTHING said which of the two states `dist` was in. A backend\n * starting in between read `./x` and died with `ERR_MODULE_NOT_FOUND` (#3216). And when the watcher went deaf after a\n * laptop sleep (a file-watch subscription that outlived the daemon behind it — see\n * `.claude/rules/staleness-presents-as-a-logic-defect.md`), nothing noticed: `touch backend-api/src/index.ts` changed\n * nothing for an hour (#3214).\n *\n * So this loop runs `tsc --watch` itself, reads the compiler's own start/end lines, runs the alias pass, VERIFIES the\n * emitted tree, and publishes one compile observation — the same record, at the same path, that a framework developer's\n * observer publishes — whose `READY` means \"emitted, rewritten and verified\". A reader (the backend supervisor, the dev\n * companion) reads `dist` only on `READY`.\n *\n * ## Rejected: an atomic staging swap of the whole tree\n *\n * Emitting into a staging directory and renaming it over `dist` would make publication atomic for a reader that never\n * consults the record. It was rejected for two measured costs: `tsc --watch` keeps its incremental state against ONE\n * output directory, so every cycle would copy the whole tree (thousands of files in a grown application); and a rename\n * replaces the directory inode that the companion's module-generation reader and Vite's dependency watcher are bound to.\n * The record is the publication instead, and every reader in the dev loop consults it.\n *\n * ## A deaf watcher is restarted on evidence\n *\n * While idle, the loop compares the newest source mtime with the last compilation start. A source changed more than\n * {@link DEFAULT_BLIND_WATCHER_GRACE_MS} ago that started no compilation is a watcher that did not see it, and the\n * compiler is restarted. `tsc`'s own debounce is 250 ms, so the grace is generous by two orders of magnitude.\n */\n\n/** How long a source change may go unanswered before the compiler is judged deaf and restarted. */\nexport const DEFAULT_BLIND_WATCHER_GRACE_MS = 30_000;\n/** How often an idle compiler is checked for deafness. */\nexport const DEFAULT_BLIND_WATCHER_CHECK_INTERVAL_MS = 15_000;\n/** How often the record's `heartbeatAt` is refreshed, so a reader can tell a live record from a stopped one. */\nconst HEARTBEAT_INTERVAL_MS = 5_000;\nconst COMPILER_RESPAWN_BASE_DELAY_MS = 2_000;\nconst COMPILER_RESPAWN_MAX_DELAY_MS = 30_000;\n\n/** `tsc --watch` start lines (TS6031 / TS6032), as printed with `--preserveWatchOutput`. */\nconst COMPILATION_STARTED_PATTERN = /Starting compilation in watch mode|File change detected\\. Starting incremental compilation/u;\n/** `tsc --watch` end line (TS6193 / TS6194). */\nconst COMPILATION_ENDED_PATTERN = /Found (\\d+) errors?\\. Watching for file changes/u;\n/** ANSI colour codes, which `tsc` writes when it believes it has a terminal. */\nconst ANSI_PATTERN = /\\u001b\\[[0-9;]*m/gu;\n\n/** Source files that are not part of the package's compiled program and must not count as an unanswered change. */\nconst NON_PROGRAM_SOURCE_PATTERN = /(?:^|\\/)(?:__tests__|__mocks__)(?:\\/|$)|\\.(?:test|spec)\\.[cm]?tsx?$/u;\nconst PROGRAM_SOURCE_PATTERN = /\\.(?:[cm]?tsx?|json)$/u;\n\nexport interface PackageCompileLoopOptions {\n readonly appRoot: string;\n readonly packageRoot: string;\n readonly packageName: string;\n /** The tsconfig the package builds with, relative to the package root (`tsconfig.build.json`). */\n readonly project: string;\n /** The emitted tree, absolute or relative to the package root (`dist/esm`). */\n readonly dist: string;\n /** Source roots whose changes the compiler must answer; defaults to `<package>/src`. */\n readonly sourceRoots?: readonly string[];\n /** Resolved from the package by default; injectable for tests that compile a package with no `node_modules`. */\n readonly typescriptCompilerPath?: string;\n readonly aliasCompilerPath?: string;\n readonly blindWatcherGraceMs?: number;\n readonly blindWatcherCheckIntervalMs?: number;\n /** Where the compiler's own output goes; standard output by default. */\n readonly output?: (text: string) => void;\n readonly log?: (line: string) => void;\n}\n\n/** Resolve a dependency's file from the package that declares it, the way `pnpm exec` would find its binary. */\nfunction resolveFromPackage(packageRoot: string, specifier: string): string {\n return createRequire(join(packageRoot, 'package.json')).resolve(specifier);\n}\n\n/** The newest program source under `roots`, with its mtime; `undefined` when there is none. */\nexport function findNewestProgramSource(roots: readonly string[]): { readonly path: string; readonly mtimeMs: number } | undefined {\n let newest: { path: string; mtimeMs: number } | undefined;\n const walk = (directory: string): void => {\n let entries;\n try {\n entries = readdirSync(directory, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n const path = join(directory, entry.name);\n if (entry.isDirectory()) {\n if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name.startsWith('.')) continue;\n if (NON_PROGRAM_SOURCE_PATTERN.test(`${entry.name}/`)) continue;\n walk(path);\n continue;\n }\n if (!entry.isFile() || !PROGRAM_SOURCE_PATTERN.test(entry.name) || NON_PROGRAM_SOURCE_PATTERN.test(entry.name)) continue;\n try {\n const { mtimeMs } = statSync(path);\n if (newest === undefined || mtimeMs > newest.mtimeMs) newest = { path, mtimeMs };\n } catch {\n // Removed mid-walk.\n }\n }\n };\n for (const root of roots) walk(root);\n return newest;\n}\n\n/**\n * Is the compiler deaf? True when the newest program source changed after the last compilation START, and longer ago\n * than the grace: the compiler had every chance to see it and did not. Pure, so the rule is pinned without a clock.\n */\nexport function compilerMissedSourceChange(input: {\n readonly newestSourceMtimeMs: number | undefined;\n readonly lastCompilationStartedAtMs: number | undefined;\n readonly nowMs: number;\n readonly graceMs: number;\n}): boolean {\n if (input.newestSourceMtimeMs === undefined || input.lastCompilationStartedAtMs === undefined) return false;\n if (input.newestSourceMtimeMs <= input.lastCompilationStartedAtMs) return false;\n return input.nowMs - input.newestSourceMtimeMs > input.graceMs;\n}\n\nexport class PackageCompileLoop {\n private readonly recordPath: string;\n private readonly distRoot: string;\n private readonly sourceRoots: readonly string[];\n private readonly typescriptCompilerPath: string;\n private readonly aliasCompilerPath: string;\n private readonly output: (text: string) => void;\n private readonly log: (line: string) => void;\n private readonly listeners = new Set<(observation: LocalDevCompileObservation) => void>();\n private state: LocalDevCompileObservation;\n private compiler: ChildProcess | null = null;\n private aliasPass: ChildProcess | null = null;\n /** Bumped at every compilation start, so an alias pass that finishes after a newer start publishes nothing. */\n private generation = 0;\n private compilationStartedAtMs = 0;\n private stdoutBuffer = '';\n private stopping = false;\n private respawnDelayMs = COMPILER_RESPAWN_BASE_DELAY_MS;\n private respawnTimer: NodeJS.Timeout | null = null;\n private heartbeatTimer: NodeJS.Timeout | null = null;\n private blindWatcherTimer: NodeJS.Timeout | null = null;\n /** When the current compiler process was spawned: what an ended dependency install is compared against (#3552). */\n private compilerStartedAtMs = Number.NaN;\n\n public constructor(private readonly options: PackageCompileLoopOptions) {\n this.recordPath = compileObservationPath(options.appRoot, options.packageName);\n this.distRoot = resolve(options.packageRoot, options.dist);\n this.sourceRoots = options.sourceRoots ?? [join(options.packageRoot, 'src')];\n this.typescriptCompilerPath = options.typescriptCompilerPath ?? resolveFromPackage(options.packageRoot, 'typescript/bin/tsc');\n this.aliasCompilerPath = options.aliasCompilerPath ?? resolveFromPackage(options.packageRoot, 'tsc-alias/dist/bin/index.js');\n this.output = options.output ?? ((text) => process.stdout.write(text));\n this.log = options.log ?? ((line) => process.stdout.write(`[wildo-dev-runtime] ${options.packageName}: ${line}\\n`));\n const now = new Date().toISOString();\n this.state = {\n kind: LOCAL_DEV_COMPILE_OBSERVATION_KIND,\n schemaVersion: LOCAL_DEV_RUNTIME_SIGNALS_PROTOCOL_VERSION,\n producerKind: 'wildo-dev-runtime',\n producerInstanceId: randomUUID(),\n producerPid: process.pid,\n childPid: null,\n appRoot: options.appRoot,\n packageRoot: options.packageRoot,\n packageName: options.packageName,\n state: LocalDevCompileState.STARTING,\n heartbeatAt: now,\n updatedAt: now,\n lastCompilationStartedAt: null,\n lastSuccessfulCompileAt: null,\n lastFailureAt: null,\n lastErrorCount: null,\n failureSummary: null,\n diagnostic: null,\n };\n }\n\n public get observation(): LocalDevCompileObservation {\n return this.state;\n }\n\n public onChange(listener: (observation: LocalDevCompileObservation) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n /**\n * Start compiling. REFUSES when another live process already compiles this package (two writers of one `dist` is the\n * defect, not a configuration), and stops the compiler an earlier generation left behind when its owner died.\n */\n public async start(): Promise<void> {\n const previous = readCompileObservation(this.recordPath);\n // A pid alone is not a live producer (pids are reused); a fresh heartbeat on a record that has not STOPPED is.\n if (previous && previous.producerPid !== process.pid && isLiveCompileObservation(previous)) {\n throw new Error(`${this.options.packageName} is already compiled by process ${previous.producerPid} (${this.recordPath}). Stop that dev process first: two compilers writing one dist is what this refuses.`);\n }\n if (previous?.childPid && isProcessAlive(previous.childPid)) {\n const identity = readProcessIdentity(previous.childPid);\n if (identity?.cwd === this.options.packageRoot && /--watch/u.test(identity.command ?? '')) {\n this.log(`stopping the compiler an earlier dev run left behind (pid ${previous.childPid}, parent ${identity.ppid ?? 'unknown'})`);\n await terminateProcessGroup(previous.childPid);\n }\n }\n this.publish({});\n this.heartbeatTimer = setInterval(() => this.publish({}, false), HEARTBEAT_INTERVAL_MS);\n this.heartbeatTimer.unref();\n this.blindWatcherTimer = setInterval(() => void this.checkForDeafCompiler(), this.options.blindWatcherCheckIntervalMs ?? DEFAULT_BLIND_WATCHER_CHECK_INTERVAL_MS);\n this.blindWatcherTimer.unref();\n this.spawnCompiler();\n }\n\n /** Kill the compiler and an alias pass synchronously: for a process that is exiting and cannot await {@link stop}. */\n public killChildrenNow(): void {\n killProcessGroupNow(this.aliasPass?.pid);\n killProcessGroupNow(this.compiler?.pid);\n }\n\n public async stop(): Promise<void> {\n this.stopping = true;\n for (const timer of [this.respawnTimer, this.heartbeatTimer, this.blindWatcherTimer]) if (timer) clearTimeout(timer);\n const children = [this.aliasPass, this.compiler].filter((child): child is ChildProcess => child?.pid !== undefined);\n await Promise.all(children.map((child) => terminateProcessGroup(child.pid!, 3_000)));\n this.compiler = null;\n this.aliasPass = null;\n this.publish({ state: LocalDevCompileState.STOPPED, childPid: null });\n }\n\n private publish(updates: Partial<LocalDevCompileObservation>, transition = true): void {\n const timestamp = new Date().toISOString();\n this.state = { ...this.state, ...updates, heartbeatAt: timestamp, ...(transition ? { updatedAt: timestamp } : {}) };\n try {\n writeRuntimeSignalRecord(this.recordPath, this.state);\n } catch (error) {\n this.log(`could not publish the compile record (${(error as Error).message}); readers will treat this package as unknown`);\n }\n if (transition) for (const listener of this.listeners) listener(this.state);\n }\n\n private spawnCompiler(): void {\n if (this.stopping) return;\n const child = spawn(process.execPath, [this.typescriptCompilerPath, '--watch', '-p', this.options.project, '--preserveWatchOutput'], {\n cwd: this.options.packageRoot,\n detached: usesProcessGroups(),\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n this.compiler = child;\n this.compilerStartedAtMs = Date.now();\n this.stdoutBuffer = '';\n this.publish({ childPid: child.pid ?? null, state: LocalDevCompileState.STARTING });\n child.stdout?.setEncoding('utf8');\n child.stdout?.on('data', (chunk: string) => this.handleCompilerOutput(chunk));\n child.stderr?.setEncoding('utf8');\n child.stderr?.on('data', (chunk: string) => this.output(chunk));\n child.once('exit', (code, signal) => {\n if (this.compiler !== child) return;\n this.compiler = null;\n if (this.stopping) return;\n this.publish({ state: LocalDevCompileState.STOPPED, childPid: null });\n this.log(`the compiler exited (${signal ?? `code ${code}`}); restarting it in ${Math.round(this.respawnDelayMs / 1000)}s`);\n this.respawnTimer = setTimeout(() => this.spawnCompiler(), this.respawnDelayMs);\n this.respawnDelayMs = Math.min(this.respawnDelayMs * 2, COMPILER_RESPAWN_MAX_DELAY_MS);\n });\n }\n\n private handleCompilerOutput(chunk: string): void {\n this.output(chunk);\n this.stdoutBuffer += chunk;\n const lines = this.stdoutBuffer.split('\\n');\n this.stdoutBuffer = lines.pop() ?? '';\n for (const rawLine of lines) {\n const line = rawLine.replace(ANSI_PATTERN, '');\n if (COMPILATION_STARTED_PATTERN.test(line)) {\n this.handleCompilationStarted();\n continue;\n }\n const ended = COMPILATION_ENDED_PATTERN.exec(line);\n if (ended) this.handleCompilationEnded(Number(ended[1]));\n }\n }\n\n private handleCompilationStarted(): void {\n this.generation += 1;\n this.compilationStartedAtMs = Date.now();\n // An alias pass of the previous compilation rewrites files this one is about to replace: stop it.\n if (this.aliasPass?.pid) void terminateProcessGroup(this.aliasPass.pid);\n this.aliasPass = null;\n this.publish({ state: LocalDevCompileState.COMPILING, lastCompilationStartedAt: new Date(this.compilationStartedAtMs).toISOString() });\n }\n\n private handleCompilationEnded(errorCount: number): void {\n // The compiler is answering, so a later exit is a new failure, not the same one: reset its backoff.\n this.respawnDelayMs = COMPILER_RESPAWN_BASE_DELAY_MS;\n if (errorCount > 0) {\n this.publish({\n state: LocalDevCompileState.FAILED,\n lastFailureAt: new Date().toISOString(),\n lastErrorCount: errorCount,\n failureSummary: `tsc reported ${errorCount} error(s); dist is not published.`,\n });\n return;\n }\n this.publish({ state: LocalDevCompileState.FINALIZING });\n const generation = this.generation;\n const startedAtMs = this.compilationStartedAtMs;\n const pass = spawn(process.execPath, [this.aliasCompilerPath, '-p', this.options.project, '--resolve-full-paths', '--resolve-full-extension', '.js'], {\n cwd: this.options.packageRoot,\n detached: usesProcessGroups(),\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n this.aliasPass = pass;\n let passOutput = '';\n pass.stdout?.setEncoding('utf8');\n pass.stderr?.setEncoding('utf8');\n pass.stdout?.on('data', (text: string) => { passOutput += text; });\n pass.stderr?.on('data', (text: string) => { passOutput += text; });\n void childExited(pass).then(() => {\n if (generation !== this.generation || this.stopping) return;\n this.aliasPass = null;\n if (pass.exitCode !== 0) {\n this.output(passOutput);\n this.publish({\n state: LocalDevCompileState.FAILED,\n lastFailureAt: new Date().toISOString(),\n lastErrorCount: 0,\n failureSummary: `the import-specifier rewrite (tsc-alias) failed with exit ${pass.exitCode ?? pass.signalCode}; dist is not published.`,\n });\n return;\n }\n // One second of slack: file-system mtimes are coarser than the clock that stamped the start.\n const unresolvable = scanEmittedTreeForUnresolvableSpecifiers(this.distRoot, startedAtMs - 1000);\n if (unresolvable.length > 0) {\n const named = unresolvable.slice(0, 3).map((finding) => `${finding.file} imports '${finding.specifier}'`).join('; ');\n this.log(`the emitted tree still holds imports Node cannot resolve (${named}); dist is not published`);\n this.publish({\n state: LocalDevCompileState.FAILED,\n lastFailureAt: new Date().toISOString(),\n lastErrorCount: 0,\n failureSummary: `the emitted tree still holds extensionless relative imports after the rewrite: ${named}.`,\n });\n return;\n }\n this.publish({ state: LocalDevCompileState.READY, lastSuccessfulCompileAt: new Date().toISOString(), lastErrorCount: 0, failureSummary: null });\n });\n }\n\n /**\n * Restart a compiler that did not answer a source change (see the class comment), or that last read the tree before a\n * dependency install ended (#3552).\n *\n * The second rule: an install re-creates `node_modules`, and a compiler that compiled while it ran read a half-installed\n * tree (`TS2318 Cannot find global type 'Array'` once `typescript/lib` was gone) and records nothing that changes after\n * the install. Measured on reference run 42666728304: three packages stayed FAILED on that error, so the backend was\n * never allowed to start again. A watcher that compiled before the install also resolved modules the install moved.\n * Self-limiting: the restarted compiler starts after the install ended.\n */\n private async checkForDeafCompiler(): Promise<void> {\n if (this.stopping || this.compiler === null) return;\n const install = classifyDependencyInstall(readDependencyInstallRecord(this.options.appRoot), Date.now());\n const nodeModulesInstalledAtMs = readNodeModulesInstalledAtMs(this.options.appRoot);\n if (compilerReadTreeBeforeDependencyInstallEnded({\n install,\n nodeModulesInstalledAtMs,\n lastCompilationStartedAtMs: this.state.lastCompilationStartedAt ? Date.parse(this.state.lastCompilationStartedAt) : null,\n watcherStartedAtMs: this.compilerStartedAtMs,\n compilerFailed: this.state.state === LocalDevCompileState.FAILED,\n })) {\n const endedAtMs = Math.max(install.endedAtMs ?? 0, nodeModulesInstalledAtMs ?? 0);\n this.log(`a dependency install ended (${new Date(endedAtMs).toISOString()}) after the compiler last read the tree; restarting it so it compiles against the installed tree`);\n await this.restartCompiler();\n return;\n }\n if (this.state.state !== LocalDevCompileState.READY && this.state.state !== LocalDevCompileState.FAILED) return;\n const newest = findNewestProgramSource(this.sourceRoots);\n const lastStartedAtMs = this.state.lastCompilationStartedAt ? Date.parse(this.state.lastCompilationStartedAt) : undefined;\n if (!compilerMissedSourceChange({\n newestSourceMtimeMs: newest?.mtimeMs,\n lastCompilationStartedAtMs: lastStartedAtMs,\n nowMs: Date.now(),\n graceMs: this.options.blindWatcherGraceMs ?? DEFAULT_BLIND_WATCHER_GRACE_MS,\n })) return;\n this.log(`the compiler did not answer a change to ${newest!.path} (changed ${new Date(newest!.mtimeMs).toISOString()}); its file watch is deaf, restarting it`);\n await this.restartCompiler();\n }\n\n private async restartCompiler(): Promise<void> {\n const previous = this.compiler;\n this.compiler = null;\n this.publish({ state: LocalDevCompileState.STARTING, childPid: null });\n if (previous?.pid) await terminateProcessGroup(previous.pid);\n this.spawnCompiler();\n }\n}\n"]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@wildo-ai/platform-core-shared/dev-runtime` — the NODE-ONLY half of the local dev runtime-signal protocol (#3212,
3
+ * #3214, #3215, #3216): where the compile and supervisor records live and how they are read and written, who holds a
4
+ * port, the compile loop and node-runtime supervisor, and `runDevRuntimeCommand`, which the `wildo-dev-runtime` program
5
+ * (`@wildo-ai/wildo-dev-runtime`, #3263) runs. The program lives in its own package because a `bin` package may keep no
6
+ * peers, while this library keeps `zod` a shared-instance peer.
7
+ *
8
+ * A subpath rather than the root because the root barrel is imported by browser bundles (the workbench), and every
9
+ * module here reaches `node:fs` or `node:child_process`. The contracts these modules read and write stay at the root
10
+ * (`runtime/local-dev-runtime-signals.contracts.ts`), where both audiences can name them.
11
+ */
12
+ export * from './dev-runtime/dev-runtime-signals';
13
+ export * from './dev-runtime/dev-runtime-processes';
14
+ export * from './dev-runtime/emitted-relative-specifiers';
15
+ export * from './dev-runtime/package-compile-loop';
16
+ export * from './dev-runtime/node-runtime-dev-supervisor';
17
+ export * from './dev-runtime/dev-runtime-command';
18
+ export * from './dev-runtime/dependency-install-record';
19
+ //# sourceMappingURL=dev-runtime.exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-runtime.exports.d.ts","sourceRoot":"","sources":["../../src/dev-runtime.exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@wildo-ai/platform-core-shared/dev-runtime` — the NODE-ONLY half of the local dev runtime-signal protocol (#3212,
3
+ * #3214, #3215, #3216): where the compile and supervisor records live and how they are read and written, who holds a
4
+ * port, the compile loop and node-runtime supervisor, and `runDevRuntimeCommand`, which the `wildo-dev-runtime` program
5
+ * (`@wildo-ai/wildo-dev-runtime`, #3263) runs. The program lives in its own package because a `bin` package may keep no
6
+ * peers, while this library keeps `zod` a shared-instance peer.
7
+ *
8
+ * A subpath rather than the root because the root barrel is imported by browser bundles (the workbench), and every
9
+ * module here reaches `node:fs` or `node:child_process`. The contracts these modules read and write stay at the root
10
+ * (`runtime/local-dev-runtime-signals.contracts.ts`), where both audiences can name them.
11
+ */
12
+ export * from './dev-runtime/dev-runtime-signals.js';
13
+ export * from './dev-runtime/dev-runtime-processes.js';
14
+ export * from './dev-runtime/emitted-relative-specifiers.js';
15
+ export * from './dev-runtime/package-compile-loop.js';
16
+ export * from './dev-runtime/node-runtime-dev-supervisor.js';
17
+ export * from './dev-runtime/dev-runtime-command.js';
18
+ export * from './dev-runtime/dependency-install-record.js';
19
+ //# sourceMappingURL=dev-runtime.exports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-runtime.exports.js","sourceRoot":"","sources":["../../src/dev-runtime.exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC","sourcesContent":["/**\n * `@wildo-ai/platform-core-shared/dev-runtime` — the NODE-ONLY half of the local dev runtime-signal protocol (#3212,\n * #3214, #3215, #3216): where the compile and supervisor records live and how they are read and written, who holds a\n * port, the compile loop and node-runtime supervisor, and `runDevRuntimeCommand`, which the `wildo-dev-runtime` program\n * (`@wildo-ai/wildo-dev-runtime`, #3263) runs. The program lives in its own package because a `bin` package may keep no\n * peers, while this library keeps `zod` a shared-instance peer.\n *\n * A subpath rather than the root because the root barrel is imported by browser bundles (the workbench), and every\n * module here reaches `node:fs` or `node:child_process`. The contracts these modules read and write stay at the root\n * (`runtime/local-dev-runtime-signals.contracts.ts`), where both audiences can name them.\n */\nexport * from './dev-runtime/dev-runtime-signals';\nexport * from './dev-runtime/dev-runtime-processes';\nexport * from './dev-runtime/emitted-relative-specifiers';\nexport * from './dev-runtime/package-compile-loop';\nexport * from './dev-runtime/node-runtime-dev-supervisor';\nexport * from './dev-runtime/dev-runtime-command';\nexport * from './dev-runtime/dependency-install-record';\n"]}
@@ -7,6 +7,8 @@ export * from './workbench/workbench-creation-plane.custom.shared.resources-conf
7
7
  export * from './workbench/workbench-aspect-resources.custom.shared.schemas';
8
8
  export * from './workbench/workbench-creation-conversation.custom.shared.schemas';
9
9
  export * from './workbench/workbench-creation-console.custom.shared.schemas';
10
+ export * from './workbench/creation-drive.custom.shared.schemas';
11
+ export * from './workbench/creation-journey-timeline.custom.shared.schemas';
10
12
  export * from './workbench/workbench-creation-dossier.custom.shared.schemas';
11
13
  export * from './workbench/workbench-domain-model.custom.shared.schemas';
12
14
  export * from './core/resources/resources-relationships.custom.shared.definitions';
@@ -14,9 +16,11 @@ export * from './core/resources/resources-operations.custom.shared.definitions';
14
16
  export * from './security/authorizations/roles.custom.shared.definitions';
15
17
  export * from './runtime/application-backend-env.contracts';
16
18
  export * from './runtime/backend-start-outcome.contracts';
19
+ export * from './runtime/local-dev-runtime-signals.contracts';
17
20
  export * from './runtime/application-worker-env.contracts';
18
21
  export * from './runtime/http-server-env.contracts';
19
22
  export * from './runtime/runtime-topology.contracts';
23
+ export * from './runtime/frontend-settings-hub-wiring.contracts';
20
24
  import type { ProductDefinition } from '@wildo-ai/saas-models';
21
25
  export declare const CUSTOM_PRODUCT_CATALOG: ProductDefinition[];
22
26
  export * from './wildo-applications/wildo-applications.custom.shared.schemas';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,wDAAwD,CAAC;AAWvE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,wEAAwE,CAAC;AACvF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6EAA6E,CAAC;AAC5F,cAAc,8DAA8D,CAAC;AAC7E,cAAc,mEAAmE,CAAC;AAClF,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,0DAA0D,CAAC;AACzE,cAAc,oEAAoE,CAAC;AACnF,cAAc,iEAAiE,CAAC;AAGhF,cAAc,2DAA2D,CAAC;AAC1E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,EAAO,CAAC;AAK9D,cAAc,+DAA+D,CAAC;AAC9E,cAAc,iFAAiF,CAAC;AAIhG,cAAc,mFAAmF,CAAC;AAClG,cAAc,yEAAyE,CAAC;AACxF,cAAc,oGAAoG,CAAC;AACnH,cAAc,0FAA0F,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,wDAAwD,CAAC;AAWvE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,wEAAwE,CAAC;AACvF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6EAA6E,CAAC;AAC5F,cAAc,8DAA8D,CAAC;AAC7E,cAAc,mEAAmE,CAAC;AAClF,cAAc,8DAA8D,CAAC;AAC7E,cAAc,kDAAkD,CAAC;AACjE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,0DAA0D,CAAC;AACzE,cAAc,oEAAoE,CAAC;AACnF,cAAc,iEAAiE,CAAC;AAGhF,cAAc,2DAA2D,CAAC;AAC1E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AAGjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,EAAO,CAAC;AAK9D,cAAc,+DAA+D,CAAC;AAC9E,cAAc,iFAAiF,CAAC;AAIhG,cAAc,mFAAmF,CAAC;AAClG,cAAc,yEAAyE,CAAC;AACxF,cAAc,oGAAoG,CAAC;AACnH,cAAc,0FAA0F,CAAC"}
package/dist/esm/index.js CHANGED
@@ -20,6 +20,8 @@ export * from './workbench/workbench-creation-plane.custom.shared.resources-conf
20
20
  export * from './workbench/workbench-aspect-resources.custom.shared.schemas.js';
21
21
  export * from './workbench/workbench-creation-conversation.custom.shared.schemas.js';
22
22
  export * from './workbench/workbench-creation-console.custom.shared.schemas.js';
23
+ export * from './workbench/creation-drive.custom.shared.schemas.js';
24
+ export * from './workbench/creation-journey-timeline.custom.shared.schemas.js';
23
25
  export * from './workbench/workbench-creation-dossier.custom.shared.schemas.js';
24
26
  export * from './workbench/workbench-domain-model.custom.shared.schemas.js';
25
27
  export * from './core/resources/resources-relationships.custom.shared.definitions.js';
@@ -28,9 +30,11 @@ export * from './core/resources/resources-operations.custom.shared.definitions.j
28
30
  export * from './security/authorizations/roles.custom.shared.definitions.js';
29
31
  export * from './runtime/application-backend-env.contracts.js';
30
32
  export * from './runtime/backend-start-outcome.contracts.js';
33
+ export * from './runtime/local-dev-runtime-signals.contracts.js';
31
34
  export * from './runtime/application-worker-env.contracts.js';
32
35
  export * from './runtime/http-server-env.contracts.js';
33
36
  export * from './runtime/runtime-topology.contracts.js';
37
+ export * from './runtime/frontend-settings-hub-wiring.contracts.js';
34
38
  export const CUSTOM_PRODUCT_CATALOG = [];
35
39
  // ### [ WILDO_AI CODE PLACEHOLDER ] [ platform_internal_code_begin ] [ BEGIN ] - Do not edit this code block. It is used by the platform to manage the code - ##########################################################
36
40
  export * from './wildo-applications/wildo-applications.custom.shared.schemas.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,iBAAiB,EAAE,CAAC;AAEpB,mBAAmB;AACnB,cAAc,wDAAwD,CAAC;AAEvE;;;;;;;;GAQG;AACH,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,wEAAwE,CAAC;AACvF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6EAA6E,CAAC;AAC5F,cAAc,8DAA8D,CAAC;AAC7E,cAAc,mEAAmE,CAAC;AAClF,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,0DAA0D,CAAC;AACzE,cAAc,oEAAoE,CAAC;AACnF,cAAc,iEAAiE,CAAC;AAEhF,kBAAkB;AAClB,cAAc,2DAA2D,CAAC;AAC1E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AAIrD,MAAM,CAAC,MAAM,sBAAsB,GAAwB,EAAE,CAAC;AAG9D,0NAA0N;AAE1N,cAAc,+DAA+D,CAAC;AAC9E,cAAc,iFAAiF,CAAC;AAEhG,uIAAuI;AAEvI,cAAc,mFAAmF,CAAC;AAClG,cAAc,yEAAyE,CAAC;AACxF,cAAc,oGAAoG,CAAC;AACnH,cAAc,0FAA0F,CAAC","sourcesContent":["// Initialize Zod decorators early (lazy init will also happen on first use)\nimport { initZodDecorators } from '@wildo-ai/zod-decorators';\ninitZodDecorators();\n\n// Custom resources\nexport * from './core/resources/resources-types.custom.shared.schemas';\n\n/*\n * The workbench's own vocabulary, kept SEPARATE from `customShared_*` on purpose.\n *\n * These resources are INTROSPECTION-backed — derived per read by the dev companion, never stored.\n * Adding them to `customShared_ResourcesConfigurationsFactoryMap` would hand them to that map's six\n * consumers, two of which must not have them: `platform-apps-manager` (whose INIT lifecycle applies\n * migrations, and there is nothing here to migrate) and the companion's i18n labelling planner,\n * which enumerates that map's keys and would generate labels for them.\n */\nexport * from './workbench/workbench-resources-types.custom.shared.schemas';\nexport * from './workbench/workbench-resources.custom.shared.schemas';\nexport * from './workbench/workbench-resources.custom.shared.resources-config.schemas';\nexport * from './workbench/workbench-creation-plane.custom.shared.schemas';\nexport * from './workbench/workbench-creation-plane.custom.shared.resources-config.schemas';\nexport * from './workbench/workbench-aspect-resources.custom.shared.schemas';\nexport * from './workbench/workbench-creation-conversation.custom.shared.schemas';\nexport * from './workbench/workbench-creation-console.custom.shared.schemas';\nexport * from './workbench/workbench-creation-dossier.custom.shared.schemas';\nexport * from './workbench/workbench-domain-model.custom.shared.schemas';\nexport * from './core/resources/resources-relationships.custom.shared.definitions';\nexport * from './core/resources/resources-operations.custom.shared.definitions';\n\n// Custom security\nexport * from './security/authorizations/roles.custom.shared.definitions';\nexport * from './runtime/application-backend-env.contracts';\nexport * from './runtime/backend-start-outcome.contracts';\nexport * from './runtime/application-worker-env.contracts';\nexport * from './runtime/http-server-env.contracts';\nexport * from './runtime/runtime-topology.contracts';\n\n// Custom billing — product catalog (placeholder until product definitions are configured)\nimport type { ProductDefinition } from '@wildo-ai/saas-models';\nexport const CUSTOM_PRODUCT_CATALOG: ProductDefinition[] = [];\n\n\n// ### [ WILDO_AI CODE PLACEHOLDER ] [ platform_internal_code_begin ] [ BEGIN ] - Do not edit this code block. It is used by the platform to manage the code - ##########################################################\n\nexport * from './wildo-applications/wildo-applications.custom.shared.schemas';\nexport * from './wildo-applications-versions/wildo-applications-versions.custom.shared.schemas';\n\n// ### [ WILDO_AI CODE PLACEHOLDER ] [ platform_internal_code_end ] [ END ] ##########################################################\n\nexport * from './wildo-application-executions/wildo-application-executions.custom.shared.schemas';\nexport * from './wildo-application-tasks/wildo-application-tasks.custom.shared.schemas';\nexport * from './wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas';\nexport * from './wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas';\n\n\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,iBAAiB,EAAE,CAAC;AAEpB,mBAAmB;AACnB,cAAc,wDAAwD,CAAC;AAEvE;;;;;;;;GAQG;AACH,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,wEAAwE,CAAC;AACvF,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6EAA6E,CAAC;AAC5F,cAAc,8DAA8D,CAAC;AAC7E,cAAc,mEAAmE,CAAC;AAClF,cAAc,8DAA8D,CAAC;AAC7E,cAAc,kDAAkD,CAAC;AACjE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,0DAA0D,CAAC;AACzE,cAAc,oEAAoE,CAAC;AACnF,cAAc,iEAAiE,CAAC;AAEhF,kBAAkB;AAClB,cAAc,2DAA2D,CAAC;AAC1E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AAIjE,MAAM,CAAC,MAAM,sBAAsB,GAAwB,EAAE,CAAC;AAG9D,0NAA0N;AAE1N,cAAc,+DAA+D,CAAC;AAC9E,cAAc,iFAAiF,CAAC;AAEhG,uIAAuI;AAEvI,cAAc,mFAAmF,CAAC;AAClG,cAAc,yEAAyE,CAAC;AACxF,cAAc,oGAAoG,CAAC;AACnH,cAAc,0FAA0F,CAAC","sourcesContent":["// Initialize Zod decorators early (lazy init will also happen on first use)\nimport { initZodDecorators } from '@wildo-ai/zod-decorators';\ninitZodDecorators();\n\n// Custom resources\nexport * from './core/resources/resources-types.custom.shared.schemas';\n\n/*\n * The workbench's own vocabulary, kept SEPARATE from `customShared_*` on purpose.\n *\n * These resources are INTROSPECTION-backed — derived per read by the dev companion, never stored.\n * Adding them to `customShared_ResourcesConfigurationsFactoryMap` would hand them to that map's six\n * consumers, two of which must not have them: `platform-apps-manager` (whose INIT lifecycle applies\n * migrations, and there is nothing here to migrate) and the companion's i18n labelling planner,\n * which enumerates that map's keys and would generate labels for them.\n */\nexport * from './workbench/workbench-resources-types.custom.shared.schemas';\nexport * from './workbench/workbench-resources.custom.shared.schemas';\nexport * from './workbench/workbench-resources.custom.shared.resources-config.schemas';\nexport * from './workbench/workbench-creation-plane.custom.shared.schemas';\nexport * from './workbench/workbench-creation-plane.custom.shared.resources-config.schemas';\nexport * from './workbench/workbench-aspect-resources.custom.shared.schemas';\nexport * from './workbench/workbench-creation-conversation.custom.shared.schemas';\nexport * from './workbench/workbench-creation-console.custom.shared.schemas';\nexport * from './workbench/creation-drive.custom.shared.schemas';\nexport * from './workbench/creation-journey-timeline.custom.shared.schemas';\nexport * from './workbench/workbench-creation-dossier.custom.shared.schemas';\nexport * from './workbench/workbench-domain-model.custom.shared.schemas';\nexport * from './core/resources/resources-relationships.custom.shared.definitions';\nexport * from './core/resources/resources-operations.custom.shared.definitions';\n\n// Custom security\nexport * from './security/authorizations/roles.custom.shared.definitions';\nexport * from './runtime/application-backend-env.contracts';\nexport * from './runtime/backend-start-outcome.contracts';\nexport * from './runtime/local-dev-runtime-signals.contracts';\nexport * from './runtime/application-worker-env.contracts';\nexport * from './runtime/http-server-env.contracts';\nexport * from './runtime/runtime-topology.contracts';\nexport * from './runtime/frontend-settings-hub-wiring.contracts';\n\n// Custom billing — product catalog (placeholder until product definitions are configured)\nimport type { ProductDefinition } from '@wildo-ai/saas-models';\nexport const CUSTOM_PRODUCT_CATALOG: ProductDefinition[] = [];\n\n\n// ### [ WILDO_AI CODE PLACEHOLDER ] [ platform_internal_code_begin ] [ BEGIN ] - Do not edit this code block. It is used by the platform to manage the code - ##########################################################\n\nexport * from './wildo-applications/wildo-applications.custom.shared.schemas';\nexport * from './wildo-applications-versions/wildo-applications-versions.custom.shared.schemas';\n\n// ### [ WILDO_AI CODE PLACEHOLDER ] [ platform_internal_code_end ] [ END ] ##########################################################\n\nexport * from './wildo-application-executions/wildo-application-executions.custom.shared.schemas';\nexport * from './wildo-application-tasks/wildo-application-tasks.custom.shared.schemas';\nexport * from './wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas';\nexport * from './wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas';\n\n\n"]}