@leitwerk-dev/test-support 0.1.9 → 0.2.1

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 (143) hide show
  1. package/dist/{chunk-KIDBCGNW.js → chunk-2PCDTYVH.js} +26 -26
  2. package/dist/chunk-2PCDTYVH.js.map +1 -0
  3. package/dist/chunk-5BZSJ4OO.js +192 -0
  4. package/dist/chunk-5BZSJ4OO.js.map +1 -0
  5. package/dist/{chunk-QFCJV2VA.js → chunk-ECAWLVYB.js} +224 -17
  6. package/dist/chunk-ECAWLVYB.js.map +1 -0
  7. package/dist/{chunk-JUH3LUYK.js → chunk-EXHTWQAE.js} +5 -1
  8. package/dist/chunk-EXHTWQAE.js.map +1 -0
  9. package/dist/compact-process-detail-fixture.d.ts +3 -0
  10. package/dist/compact-process-detail-fixture.d.ts.map +1 -1
  11. package/dist/fakes/fake-git-ops.d.ts +12 -0
  12. package/dist/fakes/fake-git-ops.d.ts.map +1 -1
  13. package/dist/fakes/fake-llm.d.ts +11 -0
  14. package/dist/fakes/fake-llm.d.ts.map +1 -1
  15. package/dist/fakes/index.d.ts +1 -1
  16. package/dist/fakes/index.d.ts.map +1 -1
  17. package/dist/fakes/index.js +111 -2
  18. package/dist/fakes/index.js.map +1 -1
  19. package/dist/fixtures.js +137 -2
  20. package/dist/fixtures.js.map +1 -1
  21. package/dist/http-launch.d.ts +9 -0
  22. package/dist/http-launch.d.ts.map +1 -0
  23. package/dist/index.d.ts +24 -12
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +113 -12
  26. package/dist/index.js.map +1 -1
  27. package/dist/integration-harness.d.ts +36 -1
  28. package/dist/integration-harness.d.ts.map +1 -1
  29. package/dist/integration.d.ts +3 -3
  30. package/dist/integration.d.ts.map +1 -1
  31. package/dist/integration.js +184 -4
  32. package/dist/integration.js.map +1 -1
  33. package/dist/local-git.d.ts +231 -0
  34. package/dist/local-git.d.ts.map +1 -0
  35. package/dist/local-git.js +428 -0
  36. package/dist/local-git.js.map +1 -0
  37. package/dist/model-provider-fixtures.d.ts +15 -0
  38. package/dist/model-provider-fixtures.d.ts.map +1 -0
  39. package/dist/polling.d.ts +2 -1
  40. package/dist/polling.d.ts.map +1 -1
  41. package/dist/process-driver.d.ts +14 -0
  42. package/dist/process-driver.d.ts.map +1 -0
  43. package/dist/question-fixtures.d.ts +2 -0
  44. package/dist/question-fixtures.d.ts.map +1 -1
  45. package/dist/server-extension-test-harness.d.ts +57 -2
  46. package/dist/server-extension-test-harness.d.ts.map +1 -1
  47. package/dist/stub-worker-entry.js +9 -5
  48. package/dist/stub-worker-entry.js.map +1 -1
  49. package/dist/test-diagnostics.d.ts +14 -0
  50. package/dist/test-diagnostics.d.ts.map +1 -0
  51. package/dist/worker-testing/in-process-worker-spawn.d.ts +21 -0
  52. package/dist/worker-testing/in-process-worker-spawn.d.ts.map +1 -1
  53. package/dist/worker-testing/index.d.ts +6 -7
  54. package/dist/worker-testing/index.d.ts.map +1 -1
  55. package/dist/worker-testing/index.js +381 -7
  56. package/dist/worker-testing/index.js.map +1 -1
  57. package/dist/worker-testing/schema-driven-stub-pi.d.ts +5 -0
  58. package/dist/worker-testing/schema-driven-stub-pi.d.ts.map +1 -1
  59. package/dist/worker-testing/stub-pi-controls.d.ts +4 -0
  60. package/dist/worker-testing/stub-pi-controls.d.ts.map +1 -1
  61. package/dist/worker-testing/stub-pi-tree-handle.d.ts +93 -1
  62. package/dist/worker-testing/stub-pi-tree-handle.d.ts.map +1 -1
  63. package/dist/worker-testing/worker-runtime-harness.d.ts +37 -2
  64. package/dist/worker-testing/worker-runtime-harness.d.ts.map +1 -1
  65. package/dist/worker-testing/worker-start-payload.d.ts +17 -1
  66. package/dist/worker-testing/worker-start-payload.d.ts.map +1 -1
  67. package/package.json +15 -9
  68. package/src/compact-process-detail-fixture.ts +37 -3
  69. package/src/fakes/fake-git-ops.ts +12 -0
  70. package/src/fakes/fake-llm.ts +11 -0
  71. package/src/fakes/index.ts +1 -1
  72. package/src/http-launch.ts +88 -0
  73. package/src/index.ts +31 -41
  74. package/src/integration-harness.ts +100 -9
  75. package/src/integration.ts +3 -9
  76. package/src/local-git.ts +499 -0
  77. package/src/model-provider-fixtures.ts +36 -0
  78. package/src/polling.ts +3 -2
  79. package/src/process-driver.ts +63 -0
  80. package/src/question-fixtures.ts +2 -0
  81. package/src/server-extension-test-harness.ts +100 -6
  82. package/src/test-diagnostics.ts +69 -0
  83. package/src/worker-testing/in-process-worker-spawn.ts +49 -2
  84. package/src/worker-testing/index.ts +4 -26
  85. package/src/worker-testing/schema-driven-stub-pi.ts +8 -1
  86. package/src/worker-testing/stub-pi-controls.ts +4 -0
  87. package/src/worker-testing/stub-pi-tree-handle.ts +301 -21
  88. package/src/worker-testing/worker-runtime-harness.ts +57 -6
  89. package/src/worker-testing/worker-start-payload.ts +18 -1
  90. package/dist/chunk-3MQO3NCX.js +0 -15
  91. package/dist/chunk-3MQO3NCX.js.map +0 -1
  92. package/dist/chunk-7ZK5QRGP.js +0 -98
  93. package/dist/chunk-7ZK5QRGP.js.map +0 -1
  94. package/dist/chunk-JUH3LUYK.js.map +0 -1
  95. package/dist/chunk-KIDBCGNW.js.map +0 -1
  96. package/dist/chunk-QFCJV2VA.js.map +0 -1
  97. package/dist/chunk-R4KVUGWR.js +0 -83
  98. package/dist/chunk-R4KVUGWR.js.map +0 -1
  99. package/dist/chunk-ST2C4VKX.js +0 -297
  100. package/dist/chunk-ST2C4VKX.js.map +0 -1
  101. package/dist/compact-process-detail-fixture.js +0 -73
  102. package/dist/compact-process-detail-fixture.js.map +0 -1
  103. package/dist/fakes/fake-git-ops.js +0 -101
  104. package/dist/fakes/fake-git-ops.js.map +0 -1
  105. package/dist/fakes/fake-llm.js +0 -27
  106. package/dist/fakes/fake-llm.js.map +0 -1
  107. package/dist/in-process-worker.js +0 -2
  108. package/dist/in-process-worker.js.map +0 -1
  109. package/dist/integration-harness.js +0 -38
  110. package/dist/integration-harness.js.map +0 -1
  111. package/dist/polling.js +0 -14
  112. package/dist/polling.js.map +0 -1
  113. package/dist/question-fixtures.js +0 -26
  114. package/dist/question-fixtures.js.map +0 -1
  115. package/dist/server-extension-test-harness.js +0 -169
  116. package/dist/server-extension-test-harness.js.map +0 -1
  117. package/dist/test-app.d.ts +0 -23
  118. package/dist/test-app.d.ts.map +0 -1
  119. package/dist/test-app.js +0 -47
  120. package/dist/test-app.js.map +0 -1
  121. package/dist/worker-testing/in-process-worker-spawn.js +0 -61
  122. package/dist/worker-testing/in-process-worker-spawn.js.map +0 -1
  123. package/dist/worker-testing/ipc-harness.d.ts +0 -11
  124. package/dist/worker-testing/ipc-harness.d.ts.map +0 -1
  125. package/dist/worker-testing/ipc-harness.js +0 -17
  126. package/dist/worker-testing/ipc-harness.js.map +0 -1
  127. package/dist/worker-testing/schema-driven-stub-pi.js +0 -65
  128. package/dist/worker-testing/schema-driven-stub-pi.js.map +0 -1
  129. package/dist/worker-testing/stub-pi-controls.js +0 -10
  130. package/dist/worker-testing/stub-pi-controls.js.map +0 -1
  131. package/dist/worker-testing/stub-pi-tree-handle.js +0 -515
  132. package/dist/worker-testing/stub-pi-tree-handle.js.map +0 -1
  133. package/dist/worker-testing/worker-runtime-harness.js +0 -231
  134. package/dist/worker-testing/worker-runtime-harness.js.map +0 -1
  135. package/dist/worker-testing/worker-start-payload.js +0 -101
  136. package/dist/worker-testing/worker-start-payload.js.map +0 -1
  137. package/dist/workspace-source-aliases.d.ts +0 -6
  138. package/dist/workspace-source-aliases.d.ts.map +0 -1
  139. package/dist/workspace-source-aliases.js +0 -126
  140. package/dist/workspace-source-aliases.js.map +0 -1
  141. package/src/test-app.ts +0 -82
  142. package/src/worker-testing/ipc-harness.ts +0 -19
  143. package/src/workspace-source-aliases.ts +0 -171
@@ -0,0 +1,428 @@
1
+ // src/local-git.ts
2
+ import { execFileSync } from "child_process";
3
+ import {
4
+ existsSync,
5
+ lstatSync,
6
+ mkdirSync,
7
+ readFileSync,
8
+ realpathSync,
9
+ renameSync,
10
+ writeFileSync
11
+ } from "fs";
12
+ import path from "path";
13
+
14
+ // src/test-diagnostics.ts
15
+ import { AsyncLocalStorage } from "async_hooks";
16
+ import { threadId } from "worker_threads";
17
+ var active = new AsyncLocalStorage();
18
+ function createTestDiagnostics(label) {
19
+ const started = performance.now();
20
+ const events = [];
21
+ let dropped = 0;
22
+ const mark = (stage, details = {}) => {
23
+ if (events.length === 512) {
24
+ events.shift();
25
+ dropped++;
26
+ }
27
+ events.push({
28
+ ...details,
29
+ stage,
30
+ at: (/* @__PURE__ */ new Date()).toISOString(),
31
+ elapsedMs: Math.round(performance.now() - started)
32
+ });
33
+ };
34
+ const diagnostics = {
35
+ /** @internal */
36
+ mark,
37
+ /** @internal */
38
+ run(fn) {
39
+ return active.run(diagnostics, fn);
40
+ },
41
+ /** @internal */
42
+ format() {
43
+ return JSON.stringify({ label, pid: process.pid, threadId, dropped, events }, null, 2);
44
+ },
45
+ /** @internal */
46
+ report() {
47
+ mark("diagnostics.report");
48
+ console.error(diagnostics.format());
49
+ }
50
+ };
51
+ mark("test.start");
52
+ return diagnostics;
53
+ }
54
+ function traceTestSubprocess(operation, run) {
55
+ const trace = active.getStore();
56
+ if (!trace) return run();
57
+ const started = performance.now();
58
+ trace.mark("subprocess.start", { operation });
59
+ try {
60
+ const result = run();
61
+ trace.mark("subprocess.exit", {
62
+ operation,
63
+ status: 0,
64
+ durationMs: Math.round(performance.now() - started)
65
+ });
66
+ return result;
67
+ } catch (error) {
68
+ const details = error;
69
+ trace.mark("subprocess.exit", {
70
+ operation,
71
+ durationMs: Math.round(performance.now() - started),
72
+ status: typeof details?.status === "number" ? details.status : null,
73
+ signal: typeof details?.signal === "string" ? details.signal : null,
74
+ code: typeof details?.code === "string" ? details.code : null
75
+ });
76
+ throw error;
77
+ }
78
+ }
79
+
80
+ // src/local-git.ts
81
+ function localPath(root, relative) {
82
+ if (lstatSync(root, { throwIfNoEntry: false })?.isSymbolicLink())
83
+ throw new Error("Local provider storage must not contain symlinks");
84
+ const base = realpathSync(root);
85
+ const target = path.resolve(base, relative);
86
+ if (!target.startsWith(`${base}${path.sep}`))
87
+ throw new Error("Path escapes local provider storage");
88
+ let current = base;
89
+ for (const part of path.relative(base, target).split(path.sep)) {
90
+ current = path.join(current, part);
91
+ if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink())
92
+ throw new Error("Local provider storage must not contain symlinks");
93
+ }
94
+ return target;
95
+ }
96
+ function readLocalJson(root, file, initial) {
97
+ const target = localPath(root, file);
98
+ if (!existsSync(target)) return structuredClone(initial);
99
+ const value = JSON.parse(readFileSync(target, "utf8"));
100
+ if (!value || value.version !== initial.version)
101
+ throw new Error(`Unsupported local state version in ${file}`);
102
+ return value;
103
+ }
104
+ function writeLocalJson(root, file, value) {
105
+ const target = localPath(root, file);
106
+ const temporary = localPath(root, `${file}.tmp`);
107
+ writeFileSync(temporary, `${JSON.stringify(value, null, 2)}
108
+ `, { mode: 384 });
109
+ renameSync(temporary, target);
110
+ }
111
+ var LocalProviderStore = class {
112
+ /** @public */
113
+ constructor(options, file, initial) {
114
+ this.options = options;
115
+ this.file = file;
116
+ this.git = new LocalGit(options.root);
117
+ this.state = readLocalJson(options.root, file, initial);
118
+ }
119
+ options;
120
+ file;
121
+ /** @public */
122
+ git;
123
+ /** @public */
124
+ state;
125
+ /** @public */
126
+ save() {
127
+ writeLocalJson(this.options.root, this.file, this.state);
128
+ }
129
+ /** @internal */
130
+ id() {
131
+ this.state.sequence = Math.max(this.state.sequence + 1, this.options.nextId?.() ?? 0);
132
+ return this.state.sequence;
133
+ }
134
+ /** @internal */
135
+ timestamp() {
136
+ return new Date(this.options.now?.() ?? Date.now()).toISOString();
137
+ }
138
+ };
139
+ var LocalForgeStore = class extends LocalProviderStore {
140
+ /** @public */
141
+ newRepository(seed) {
142
+ const { bare, branch } = this.git.seed(seed);
143
+ return {
144
+ /** @public */
145
+ id: this.id(),
146
+ /** @public */
147
+ owner: {
148
+ /** @internal */
149
+ login: seed.owner
150
+ },
151
+ /** @public */
152
+ name: seed.name,
153
+ /** @public */
154
+ full_name: `${seed.owner}/${seed.name}`,
155
+ /** @public */
156
+ ssh_url: bare,
157
+ /** @public */
158
+ html_url: `${this.options.baseUrl}/__local`,
159
+ /** @public */
160
+ default_branch: branch
161
+ };
162
+ }
163
+ /** @internal */
164
+ pullRequestClient(repo, missing = "Unknown local pull request") {
165
+ const pull = (owner, name, number) => {
166
+ const pr = repo(owner, name).pulls.find((p) => p.number === number);
167
+ if (!pr) throw new Error(missing);
168
+ return pr;
169
+ };
170
+ return {
171
+ /** @internal */
172
+ getPullRequest: async (owner, name, number) => this.refresh(repo(owner, name), pull(owner, name, number)),
173
+ /** @internal */
174
+ listPullRequests: async (owner, name, state = "open") => {
175
+ const r = repo(owner, name);
176
+ return r.pulls.filter((p) => state === "all" || p.state === state).map((p) => this.refresh(r, p));
177
+ },
178
+ /** @internal */
179
+ updatePullRequest: async (owner, name, number, patch) => {
180
+ const pr = pull(owner, name, number);
181
+ for (const key of ["title", "body", "state"])
182
+ if (typeof patch[key] === "string") pr[key] = patch[key];
183
+ this.save();
184
+ return this.refresh(repo(owner, name), pr);
185
+ }
186
+ };
187
+ }
188
+ /** @public */
189
+ refresh(repo, pr) {
190
+ if (pr.state === "open") {
191
+ const { headSha, baseSha, ...mergeability } = this.git.mergeability(
192
+ repo.repository.ssh_url,
193
+ pr.head.ref,
194
+ pr.base.ref
195
+ );
196
+ pr.head.sha = headSha;
197
+ pr.base.sha = baseSha;
198
+ Object.assign(pr, mergeability);
199
+ }
200
+ return structuredClone(pr);
201
+ }
202
+ /** @public */
203
+ merge(repo, number) {
204
+ const pr = repo.pulls.find((p) => p.number === number);
205
+ if (!pr || pr.state !== "open") throw new Error("Pull request is not open");
206
+ this.refresh(repo, pr);
207
+ pr.merge_commit_sha = this.git.merge(repo.repository.ssh_url, pr.head.ref, pr.base.ref);
208
+ pr.merged = true;
209
+ pr.state = "closed";
210
+ this.save();
211
+ return structuredClone(pr);
212
+ }
213
+ /** @public */
214
+ addFeedback(repo, number, input) {
215
+ if (!repo.pulls.some((p) => p.number === number)) throw new Error("Unknown PR");
216
+ const value = { ...input, id: this.id(), createdAt: this.timestamp() };
217
+ repo.feedback[number] ??= [];
218
+ repo.feedback[number].push(value);
219
+ this.save();
220
+ return value;
221
+ }
222
+ /** @public */
223
+ newComment(body) {
224
+ return {
225
+ /** @internal */
226
+ id: this.id(),
227
+ /** @internal */
228
+ body,
229
+ /** @public */
230
+ user: {
231
+ /** @public */
232
+ login: "leitwerk-bot"
233
+ },
234
+ /** @internal */
235
+ created_at: this.timestamp()
236
+ };
237
+ }
238
+ /** @internal */
239
+ newPullRequest(repo, input) {
240
+ const number = this.id();
241
+ return {
242
+ /** @internal */
243
+ number,
244
+ /** @internal */
245
+ title: input.title,
246
+ /** @internal */
247
+ body: input.body,
248
+ /** @internal */
249
+ state: "open",
250
+ /** @internal */
251
+ merged: false,
252
+ /** @internal */
253
+ merge_commit_sha: null,
254
+ /** @internal */
255
+ html_url: `${this.options.baseUrl}/__local#pr-${number}`,
256
+ /** @internal */
257
+ head: {
258
+ /** @internal */
259
+ ref: input.head,
260
+ /** @internal */
261
+ sha: this.git.head(repo.repository.ssh_url, input.head)
262
+ },
263
+ /** @internal */
264
+ base: {
265
+ /** @internal */
266
+ ref: input.base,
267
+ /** @internal */
268
+ sha: this.git.head(repo.repository.ssh_url, input.base)
269
+ }
270
+ };
271
+ }
272
+ };
273
+ var LocalGit = class {
274
+ /** @public */
275
+ constructor(root) {
276
+ this.root = root;
277
+ if (lstatSync(root, { throwIfNoEntry: false })?.isSymbolicLink())
278
+ throw new Error("Local Git root must not be a symlink");
279
+ mkdirSync(root, { recursive: true, mode: 448 });
280
+ }
281
+ root;
282
+ /** @public */
283
+ run(directory, args) {
284
+ const base = realpathSync(this.root);
285
+ const directoryPath = path.resolve(directory);
286
+ const relative = path.relative(
287
+ directoryPath.startsWith(`${base}${path.sep}`) ? base : path.resolve(this.root),
288
+ directoryPath
289
+ );
290
+ const cwd = localPath(this.root, relative);
291
+ return traceTestSubprocess(
292
+ `git ${args[0] ?? ""}`,
293
+ () => execFileSync(
294
+ "git",
295
+ ["-c", "protocol.file.allow=always", "-c", "core.hooksPath=/dev/null", ...args],
296
+ {
297
+ cwd,
298
+ encoding: "utf8",
299
+ stdio: ["ignore", "pipe", "pipe"],
300
+ env: {
301
+ PATH: process.env.PATH,
302
+ HOME: this.root,
303
+ GIT_CONFIG_NOSYSTEM: "1",
304
+ GIT_CONFIG_GLOBAL: "/dev/null",
305
+ GIT_TERMINAL_PROMPT: "0",
306
+ GIT_ALLOW_PROTOCOL: "file",
307
+ GIT_AUTHOR_NAME: "Sandbox Developer",
308
+ GIT_AUTHOR_EMAIL: "developer@sandbox.invalid",
309
+ GIT_COMMITTER_NAME: "Sandbox Developer",
310
+ GIT_COMMITTER_EMAIL: "developer@sandbox.invalid"
311
+ }
312
+ }
313
+ ).trim()
314
+ );
315
+ }
316
+ /** @public */
317
+ head(directory, ref) {
318
+ if (!/^[a-zA-Z0-9_./-]+$/.test(ref) || ref.startsWith("-")) throw new Error("Invalid Git ref");
319
+ return this.run(directory, ["rev-parse", "--verify", `${ref}^{commit}`]);
320
+ }
321
+ /** @internal */
322
+ isAncestor(directory, ancestor, descendant) {
323
+ return this.isAncestorCommit(
324
+ directory,
325
+ this.head(directory, ancestor),
326
+ this.head(directory, descendant)
327
+ );
328
+ }
329
+ isAncestorCommit(directory, ancestor, descendant) {
330
+ if (ancestor === descendant) return true;
331
+ try {
332
+ this.run(directory, ["merge-base", "--is-ancestor", ancestor, descendant]);
333
+ return true;
334
+ } catch (error) {
335
+ if (error.status === 1) return false;
336
+ throw error;
337
+ }
338
+ }
339
+ /** @internal */
340
+ mergeability(directory, head, base) {
341
+ const headSha = this.head(directory, head), baseSha = this.head(directory, base);
342
+ const revisions = { headSha, baseSha };
343
+ if (this.isAncestorCommit(directory, baseSha, headSha))
344
+ return { ...revisions, mergeable: true, mergeable_state: "clean" };
345
+ try {
346
+ this.run(directory, ["merge-tree", "--write-tree", baseSha, headSha]);
347
+ } catch (error) {
348
+ if (error.status === 1)
349
+ return { ...revisions, mergeable: false, mergeable_state: "dirty" };
350
+ throw error;
351
+ }
352
+ return { ...revisions, mergeable: true, mergeable_state: "behind" };
353
+ }
354
+ /** @internal */
355
+ merge(directory, head, base) {
356
+ const h = this.head(directory, head), b = this.head(directory, base);
357
+ let commit = h;
358
+ if (!this.isAncestorCommit(directory, b, h)) {
359
+ const tree = this.run(directory, ["merge-tree", "--write-tree", b, h]).split("\n")[0];
360
+ commit = this.run(directory, [
361
+ "commit-tree",
362
+ tree,
363
+ "-p",
364
+ b,
365
+ "-p",
366
+ h,
367
+ "-m",
368
+ "Merge local pull request"
369
+ ]);
370
+ }
371
+ this.run(directory, ["update-ref", `refs/heads/${base}`, commit, b]);
372
+ return commit;
373
+ }
374
+ /** @internal */
375
+ seed(seed) {
376
+ for (const value of [seed.owner, seed.name, seed.directoryName ?? seed.name])
377
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(value))
378
+ throw new Error("Invalid local repository name");
379
+ const name = seed.directoryName ?? `${seed.owner}--${seed.name}`;
380
+ const bare = localPath(this.root, `repositories/${name}.git`);
381
+ const worktree = localPath(this.root, `seeds/${name}`);
382
+ const branch = seed.defaultBranch ?? "main";
383
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_./-]*$/.test(branch)) throw new Error("Invalid default branch");
384
+ mkdirSync(bare, { recursive: true });
385
+ mkdirSync(worktree, { recursive: true });
386
+ if (!existsSync(path.join(bare, "HEAD")))
387
+ this.run(bare, ["init", "--bare", `--initial-branch=${branch}`]);
388
+ try {
389
+ this.head(bare, branch);
390
+ return { bare, worktree, branch };
391
+ } catch {
392
+ }
393
+ if (!existsSync(path.join(worktree, ".git")))
394
+ this.run(worktree, ["init", `--initial-branch=${branch}`]);
395
+ for (const [name2, contents] of Object.entries(
396
+ seed.files ?? { "README.md": `# ${seed.name}
397
+ ` }
398
+ )) {
399
+ if (name2.split(/[\\/]/).includes(".git"))
400
+ throw new Error("Seed must not write Git configuration");
401
+ const target = localPath(worktree, name2);
402
+ mkdirSync(path.dirname(target), { recursive: true });
403
+ writeFileSync(target, contents);
404
+ }
405
+ this.run(worktree, ["add", "."]);
406
+ this.run(worktree, [
407
+ "commit",
408
+ "--allow-empty",
409
+ ...seed.signoff ? ["--signoff"] : [],
410
+ "-m",
411
+ seed.commitMessage ?? "chore: seed local repository"
412
+ ]);
413
+ if (!this.run(worktree, ["remote"]).split("\n").includes("origin"))
414
+ this.run(worktree, ["remote", "add", "origin", bare]);
415
+ this.run(worktree, ["push", bare, `HEAD:refs/heads/${branch}`]);
416
+ return { bare, worktree, branch };
417
+ }
418
+ };
419
+ export {
420
+ LocalForgeStore,
421
+ LocalGit,
422
+ LocalProviderStore,
423
+ createTestDiagnostics,
424
+ localPath,
425
+ readLocalJson,
426
+ writeLocalJson
427
+ };
428
+ //# sourceMappingURL=local-git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/local-git.ts","../src/test-diagnostics.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport {\n\texistsSync,\n\tlstatSync,\n\tmkdirSync,\n\treadFileSync,\n\trealpathSync,\n\trenameSync,\n\twriteFileSync,\n} from \"node:fs\";\nimport path from \"node:path\";\nimport type { RepositoryFeedbackItem, RepositoryPullRequest } from \"@leitwerk-dev/process-sdk\";\nimport { traceTestSubprocess } from \"./test-diagnostics.js\";\n\nexport { createTestDiagnostics } from \"./test-diagnostics.js\";\n\n/** @public */\nexport interface LocalRepositorySeed {\n\t/** @public */\n\towner: string;\n\t/** @public */\n\tname: string;\n\t/** @internal */\n\tdefaultBranch?: string;\n\t/** @public */\n\tfiles?: Record<string, string>;\n\t/** Retain a pre-existing sandbox checkout layout. @internal */\n\tdirectoryName?: string;\n\t/** @internal */\n\tcommitMessage?: string;\n\t/** @internal */\n\tsignoff?: boolean;\n}\n\n/** Reject escaping paths and symlinks, including a not-yet-created file's parents. @public */\nexport function localPath(root: string, relative: string): string {\n\tif (lstatSync(root, { throwIfNoEntry: false })?.isSymbolicLink())\n\t\tthrow new Error(\"Local provider storage must not contain symlinks\");\n\tconst base = realpathSync(root);\n\tconst target = path.resolve(base, relative);\n\tif (!target.startsWith(`${base}${path.sep}`))\n\t\tthrow new Error(\"Path escapes local provider storage\");\n\tlet current = base;\n\tfor (const part of path.relative(base, target).split(path.sep)) {\n\t\tcurrent = path.join(current, part);\n\t\tif (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink())\n\t\t\tthrow new Error(\"Local provider storage must not contain symlinks\");\n\t}\n\treturn target;\n}\n\n/** @public */\nexport function readLocalJson<\n\tT extends {\n\t\t/** @internal */\n\t\tversion: number;\n\t},\n>(root: string, file: string, initial: T): T {\n\tconst target = localPath(root, file);\n\tif (!existsSync(target)) return structuredClone(initial);\n\tconst value = JSON.parse(readFileSync(target, \"utf8\")) as T;\n\tif (!value || value.version !== initial.version)\n\t\tthrow new Error(`Unsupported local state version in ${file}`);\n\treturn value;\n}\n\n/** @public */\nexport function writeLocalJson(root: string, file: string, value: unknown): void {\n\tconst target = localPath(root, file);\n\tconst temporary = localPath(root, `${file}.tmp`);\n\twriteFileSync(temporary, `${JSON.stringify(value, null, 2)}\\n`, { mode: 0o600 });\n\trenameSync(temporary, target);\n}\n\n/** Persist local adapter state with a shared clock and monotonically increasing ids. @public */\nexport class LocalProviderStore<\n\tS extends {\n\t\t/** @internal */\n\t\tversion: number;\n\t\t/** @internal */\n\t\tsequence: number;\n\t},\n\tO extends {\n\t\t/** @internal */\n\t\troot: string;\n\t\t/** @internal */\n\t\tnow?: () => number;\n\t\t/** @internal */\n\t\tnextId?: () => number;\n\t},\n> {\n\t/** @public */\n\treadonly git: LocalGit;\n\t/** @public */\n\tstate: S;\n\t/** @public */\n\tconstructor(\n\t\t/** @public */\n\t\treadonly options: O,\n\t\tprivate readonly file: string,\n\t\tinitial: S,\n\t) {\n\t\tthis.git = new LocalGit(options.root);\n\t\tthis.state = readLocalJson(options.root, file, initial);\n\t}\n\t/** @public */\n\tsave() {\n\t\twriteLocalJson(this.options.root, this.file, this.state);\n\t}\n\t/** @internal */\n\tid() {\n\t\tthis.state.sequence = Math.max(this.state.sequence + 1, this.options.nextId?.() ?? 0);\n\t\treturn this.state.sequence;\n\t}\n\t/** @internal */\n\ttimestamp() {\n\t\treturn new Date(this.options.now?.() ?? Date.now()).toISOString();\n\t}\n}\n\n/** @public */\ntype LocalPullRequest = Pick<\n\tRepositoryPullRequest,\n\t\"number\" | \"title\" | \"body\" | \"state\" | \"merged\" | \"merge_commit_sha\" | \"head\" | \"base\"\n>;\n/** @public */\ninterface LocalPullRequestRepository<P extends LocalPullRequest> {\n\t/** @public */\n\trepository: {\n\t\t/** @internal */\n\t\tssh_url: string;\n\t};\n\t/** @public */\n\tpulls: P[];\n}\n\n/** Common PR operations; adapters retain their provider-specific state and clients. @public */\nexport class LocalForgeStore<\n\tS extends {\n\t\t/** @internal */\n\t\tversion: number;\n\t\t/** @internal */\n\t\tsequence: number;\n\t},\n\tO extends {\n\t\t/** @internal */\n\t\troot: string;\n\t\t/** @internal */\n\t\tbaseUrl: string;\n\t\t/** @internal */\n\t\tnow?: () => number;\n\t\t/** @internal */\n\t\tnextId?: () => number;\n\t},\n> extends LocalProviderStore<S, O> {\n\t/** @public */\n\tnewRepository(seed: LocalRepositorySeed) {\n\t\tconst { bare, branch } = this.git.seed(seed);\n\t\treturn {\n\t\t\t/** @public */\n\t\t\tid: this.id(),\n\t\t\t/** @public */\n\t\t\towner: {\n\t\t\t\t/** @internal */\n\t\t\t\tlogin: seed.owner,\n\t\t\t},\n\t\t\t/** @public */\n\t\t\tname: seed.name,\n\t\t\t/** @public */\n\t\t\tfull_name: `${seed.owner}/${seed.name}`,\n\t\t\t/** @public */\n\t\t\tssh_url: bare,\n\t\t\t/** @public */\n\t\t\thtml_url: `${this.options.baseUrl}/__local`,\n\t\t\t/** @public */\n\t\t\tdefault_branch: branch,\n\t\t};\n\t}\n\t/** @internal */\n\tpullRequestClient<P extends LocalPullRequest>(\n\t\trepo: (owner: string, name: string) => LocalPullRequestRepository<P>,\n\t\tmissing = \"Unknown local pull request\",\n\t) {\n\t\tconst pull = (owner: string, name: string, number: number) => {\n\t\t\tconst pr = repo(owner, name).pulls.find((p) => p.number === number);\n\t\t\tif (!pr) throw new Error(missing);\n\t\t\treturn pr;\n\t\t};\n\t\treturn {\n\t\t\t/** @internal */\n\t\t\tgetPullRequest: async (owner: string, name: string, number: number) =>\n\t\t\t\tthis.refresh(repo(owner, name), pull(owner, name, number)),\n\t\t\t/** @internal */\n\t\t\tlistPullRequests: async (owner: string, name: string, state = \"open\") => {\n\t\t\t\tconst r = repo(owner, name);\n\t\t\t\treturn r.pulls\n\t\t\t\t\t.filter((p) => state === \"all\" || p.state === state)\n\t\t\t\t\t.map((p) => this.refresh(r, p));\n\t\t\t},\n\t\t\t/** @internal */\n\t\t\tupdatePullRequest: async (\n\t\t\t\towner: string,\n\t\t\t\tname: string,\n\t\t\t\tnumber: number,\n\t\t\t\tpatch: Record<string, unknown>,\n\t\t\t) => {\n\t\t\t\tconst pr = pull(owner, name, number);\n\t\t\t\tfor (const key of [\"title\", \"body\", \"state\"] as const)\n\t\t\t\t\tif (typeof patch[key] === \"string\") pr[key] = patch[key];\n\t\t\t\tthis.save();\n\t\t\t\treturn this.refresh(repo(owner, name), pr);\n\t\t\t},\n\t\t};\n\t}\n\t/** @public */\n\trefresh<P extends LocalPullRequest>(repo: LocalPullRequestRepository<P>, pr: P): P {\n\t\tif (pr.state === \"open\") {\n\t\t\tconst { headSha, baseSha, ...mergeability } = this.git.mergeability(\n\t\t\t\trepo.repository.ssh_url,\n\t\t\t\tpr.head.ref,\n\t\t\t\tpr.base.ref,\n\t\t\t);\n\t\t\tpr.head.sha = headSha;\n\t\t\tpr.base.sha = baseSha;\n\t\t\tObject.assign(pr, mergeability);\n\t\t}\n\t\treturn structuredClone(pr);\n\t}\n\t/** @public */\n\tmerge<P extends LocalPullRequest>(repo: LocalPullRequestRepository<P>, number: number): P {\n\t\tconst pr = repo.pulls.find((p) => p.number === number);\n\t\tif (!pr || pr.state !== \"open\") throw new Error(\"Pull request is not open\");\n\t\tthis.refresh(repo, pr);\n\t\tpr.merge_commit_sha = this.git.merge(repo.repository.ssh_url, pr.head.ref, pr.base.ref);\n\t\tpr.merged = true;\n\t\tpr.state = \"closed\";\n\t\tthis.save();\n\t\treturn structuredClone(pr);\n\t}\n\t/** @public */\n\taddFeedback<F extends RepositoryFeedbackItem>(\n\t\trepo: {\n\t\t\t/** @public */\n\t\t\tpulls: Array<{\n\t\t\t\t/** @internal */\n\t\t\t\tnumber: number;\n\t\t\t}>;\n\t\t\t/** @public */\n\t\t\tfeedback: Record<string, F[]>;\n\t\t},\n\t\tnumber: number,\n\t\tinput: Omit<F, \"id\" | \"createdAt\">,\n\t): F {\n\t\tif (!repo.pulls.some((p) => p.number === number)) throw new Error(\"Unknown PR\");\n\t\tconst value = { ...input, id: this.id(), createdAt: this.timestamp() } as F;\n\t\trepo.feedback[number] ??= [];\n\t\trepo.feedback[number].push(value);\n\t\tthis.save();\n\t\treturn value;\n\t}\n\t/** @public */\n\tnewComment(body: string) {\n\t\treturn {\n\t\t\t/** @internal */\n\t\t\tid: this.id(),\n\t\t\t/** @internal */\n\t\t\tbody,\n\t\t\t/** @public */\n\t\t\tuser: {\n\t\t\t\t/** @public */\n\t\t\t\tlogin: \"leitwerk-bot\",\n\t\t\t},\n\t\t\t/** @internal */\n\t\t\tcreated_at: this.timestamp(),\n\t\t};\n\t}\n\t/** @internal */\n\tnewPullRequest(\n\t\trepo: {\n\t\t\t/** @internal */\n\t\t\trepository: {\n\t\t\t\t/** @internal */\n\t\t\t\tssh_url: string;\n\t\t\t};\n\t\t},\n\t\tinput: {\n\t\t\t/** @internal */\n\t\t\ttitle: string;\n\t\t\t/** @internal */\n\t\t\tbody: string;\n\t\t\t/** @internal */\n\t\t\thead: string;\n\t\t\t/** @internal */\n\t\t\tbase: string;\n\t\t},\n\t) {\n\t\tconst number = this.id();\n\t\treturn {\n\t\t\t/** @internal */\n\t\t\tnumber,\n\t\t\t/** @internal */\n\t\t\ttitle: input.title,\n\t\t\t/** @internal */\n\t\t\tbody: input.body,\n\t\t\t/** @internal */\n\t\t\tstate: \"open\",\n\t\t\t/** @internal */\n\t\t\tmerged: false,\n\t\t\t/** @internal */\n\t\t\tmerge_commit_sha: null,\n\t\t\t/** @internal */\n\t\t\thtml_url: `${this.options.baseUrl}/__local#pr-${number}`,\n\t\t\t/** @internal */\n\t\t\thead: {\n\t\t\t\t/** @internal */\n\t\t\t\tref: input.head,\n\t\t\t\t/** @internal */\n\t\t\t\tsha: this.git.head(repo.repository.ssh_url, input.head),\n\t\t\t},\n\t\t\t/** @internal */\n\t\t\tbase: {\n\t\t\t\t/** @internal */\n\t\t\t\tref: input.base,\n\t\t\t\t/** @internal */\n\t\t\t\tsha: this.git.head(repo.repository.ssh_url, input.base),\n\t\t\t},\n\t\t};\n\t}\n}\n\n/** Real Git with file-only transport and no ambient credentials or hooks. @public */\nexport class LocalGit {\n\t/** @public */\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly root: string,\n\t) {\n\t\tif (lstatSync(root, { throwIfNoEntry: false })?.isSymbolicLink())\n\t\t\tthrow new Error(\"Local Git root must not be a symlink\");\n\t\tmkdirSync(root, { recursive: true, mode: 0o700 });\n\t}\n\t/** @public */\n\trun(directory: string, args: string[]): string {\n\t\tconst base = realpathSync(this.root);\n\t\tconst directoryPath = path.resolve(directory);\n\t\tconst relative = path.relative(\n\t\t\tdirectoryPath.startsWith(`${base}${path.sep}`) ? base : path.resolve(this.root),\n\t\t\tdirectoryPath,\n\t\t);\n\t\tconst cwd = localPath(this.root, relative);\n\t\treturn traceTestSubprocess(`git ${args[0] ?? \"\"}`, () =>\n\t\t\texecFileSync(\n\t\t\t\t\"git\",\n\t\t\t\t[\"-c\", \"protocol.file.allow=always\", \"-c\", \"core.hooksPath=/dev/null\", ...args],\n\t\t\t\t{\n\t\t\t\t\tcwd,\n\t\t\t\t\tencoding: \"utf8\",\n\t\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\t\tenv: {\n\t\t\t\t\t\tPATH: process.env.PATH,\n\t\t\t\t\t\tHOME: this.root,\n\t\t\t\t\t\tGIT_CONFIG_NOSYSTEM: \"1\",\n\t\t\t\t\t\tGIT_CONFIG_GLOBAL: \"/dev/null\",\n\t\t\t\t\t\tGIT_TERMINAL_PROMPT: \"0\",\n\t\t\t\t\t\tGIT_ALLOW_PROTOCOL: \"file\",\n\t\t\t\t\t\tGIT_AUTHOR_NAME: \"Sandbox Developer\",\n\t\t\t\t\t\tGIT_AUTHOR_EMAIL: \"developer@sandbox.invalid\",\n\t\t\t\t\t\tGIT_COMMITTER_NAME: \"Sandbox Developer\",\n\t\t\t\t\t\tGIT_COMMITTER_EMAIL: \"developer@sandbox.invalid\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t).trim(),\n\t\t);\n\t}\n\t/** @public */\n\thead(directory: string, ref: string): string {\n\t\tif (!/^[a-zA-Z0-9_./-]+$/.test(ref) || ref.startsWith(\"-\")) throw new Error(\"Invalid Git ref\");\n\t\treturn this.run(directory, [\"rev-parse\", \"--verify\", `${ref}^{commit}`]);\n\t}\n\t/** @internal */\n\tisAncestor(directory: string, ancestor: string, descendant: string): boolean {\n\t\treturn this.isAncestorCommit(\n\t\t\tdirectory,\n\t\t\tthis.head(directory, ancestor),\n\t\t\tthis.head(directory, descendant),\n\t\t);\n\t}\n\tprivate isAncestorCommit(directory: string, ancestor: string, descendant: string): boolean {\n\t\tif (ancestor === descendant) return true;\n\t\ttry {\n\t\t\tthis.run(directory, [\"merge-base\", \"--is-ancestor\", ancestor, descendant]);\n\t\t\treturn true;\n\t\t} catch (error) {\n\t\t\tif ((error as { status?: number }).status === 1) return false;\n\t\t\tthrow error;\n\t\t}\n\t}\n\t/** @internal */\n\tmergeability(\n\t\tdirectory: string,\n\t\thead: string,\n\t\tbase: string,\n\t): {\n\t\t/** @internal */\n\t\theadSha: string;\n\t\t/** @internal */\n\t\tbaseSha: string;\n\t\t/** @internal */\n\t\tmergeable: boolean;\n\t\t/** @internal */\n\t\tmergeable_state: string;\n\t} {\n\t\tconst headSha = this.head(directory, head),\n\t\t\tbaseSha = this.head(directory, base);\n\t\tconst revisions = { headSha, baseSha };\n\t\tif (this.isAncestorCommit(directory, baseSha, headSha))\n\t\t\treturn { ...revisions, mergeable: true, mergeable_state: \"clean\" };\n\t\ttry {\n\t\t\tthis.run(directory, [\"merge-tree\", \"--write-tree\", baseSha, headSha]);\n\t\t} catch (error) {\n\t\t\tif ((error as { status?: number }).status === 1)\n\t\t\t\treturn { ...revisions, mergeable: false, mergeable_state: \"dirty\" };\n\t\t\tthrow error;\n\t\t}\n\t\treturn { ...revisions, mergeable: true, mergeable_state: \"behind\" };\n\t}\n\t/** @internal */\n\tmerge(directory: string, head: string, base: string): string {\n\t\tconst h = this.head(directory, head),\n\t\t\tb = this.head(directory, base);\n\t\tlet commit = h;\n\t\tif (!this.isAncestorCommit(directory, b, h)) {\n\t\t\tconst tree = this.run(directory, [\"merge-tree\", \"--write-tree\", b, h]).split(\"\\n\")[0];\n\t\t\tcommit = this.run(directory, [\n\t\t\t\t\"commit-tree\",\n\t\t\t\ttree,\n\t\t\t\t\"-p\",\n\t\t\t\tb,\n\t\t\t\t\"-p\",\n\t\t\t\th,\n\t\t\t\t\"-m\",\n\t\t\t\t\"Merge local pull request\",\n\t\t\t]);\n\t\t}\n\t\tthis.run(directory, [\"update-ref\", `refs/heads/${base}`, commit, b]);\n\t\treturn commit;\n\t}\n\t/** @internal */\n\tseed(seed: LocalRepositorySeed): {\n\t\t/** @internal */\n\t\tbare: string;\n\t\t/** @internal */\n\t\tworktree: string;\n\t\t/** @internal */\n\t\tbranch: string;\n\t} {\n\t\tfor (const value of [seed.owner, seed.name, seed.directoryName ?? seed.name])\n\t\t\tif (!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(value))\n\t\t\t\tthrow new Error(\"Invalid local repository name\");\n\t\tconst name = seed.directoryName ?? `${seed.owner}--${seed.name}`;\n\t\tconst bare = localPath(this.root, `repositories/${name}.git`);\n\t\tconst worktree = localPath(this.root, `seeds/${name}`);\n\t\tconst branch = seed.defaultBranch ?? \"main\";\n\t\tif (!/^[a-zA-Z0-9][a-zA-Z0-9_./-]*$/.test(branch)) throw new Error(\"Invalid default branch\");\n\t\tmkdirSync(bare, { recursive: true });\n\t\tmkdirSync(worktree, { recursive: true });\n\t\tif (!existsSync(path.join(bare, \"HEAD\")))\n\t\t\tthis.run(bare, [\"init\", \"--bare\", `--initial-branch=${branch}`]);\n\t\ttry {\n\t\t\tthis.head(bare, branch);\n\t\t\treturn { bare, worktree, branch };\n\t\t} catch {\n\t\t\t/* Resume an interrupted seed. */\n\t\t}\n\t\tif (!existsSync(path.join(worktree, \".git\")))\n\t\t\tthis.run(worktree, [\"init\", `--initial-branch=${branch}`]);\n\t\tfor (const [name, contents] of Object.entries(\n\t\t\tseed.files ?? { \"README.md\": `# ${seed.name}\\n` },\n\t\t)) {\n\t\t\tif (name.split(/[\\\\/]/).includes(\".git\"))\n\t\t\t\tthrow new Error(\"Seed must not write Git configuration\");\n\t\t\tconst target = localPath(worktree, name);\n\t\t\tmkdirSync(path.dirname(target), { recursive: true });\n\t\t\twriteFileSync(target, contents);\n\t\t}\n\t\tthis.run(worktree, [\"add\", \".\"]);\n\t\tthis.run(worktree, [\n\t\t\t\"commit\",\n\t\t\t\"--allow-empty\",\n\t\t\t...(seed.signoff ? [\"--signoff\"] : []),\n\t\t\t\"-m\",\n\t\t\tseed.commitMessage ?? \"chore: seed local repository\",\n\t\t]);\n\t\tif (!this.run(worktree, [\"remote\"]).split(\"\\n\").includes(\"origin\"))\n\t\t\tthis.run(worktree, [\"remote\", \"add\", \"origin\", bare]);\n\t\tthis.run(worktree, [\"push\", bare, `HEAD:refs/heads/${branch}`]);\n\t\treturn { bare, worktree, branch };\n\t}\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { threadId } from \"node:worker_threads\";\n\nconst active = new AsyncLocalStorage<ReturnType<typeof createTestDiagnostics>>();\n\n/** @internal Bounded, in-memory trace. Call report from onTestFailed; successful tests stay quiet. */\nexport function createTestDiagnostics(label: string) {\n\tconst started = performance.now();\n\tconst events: Record<string, unknown>[] = [];\n\tlet dropped = 0;\n\tconst mark = (stage: string, details: Record<string, unknown> = {}) => {\n\t\tif (events.length === 512) {\n\t\t\tevents.shift();\n\t\t\tdropped++;\n\t\t}\n\t\tevents.push({\n\t\t\t...details,\n\t\t\tstage,\n\t\t\tat: new Date().toISOString(),\n\t\t\telapsedMs: Math.round(performance.now() - started),\n\t\t});\n\t};\n\tconst diagnostics = {\n\t\t/** @internal */\n\t\tmark,\n\t\t/** @internal */\n\t\trun<T>(fn: () => T): T {\n\t\t\treturn active.run(diagnostics, fn);\n\t\t},\n\t\t/** @internal */\n\t\tformat() {\n\t\t\treturn JSON.stringify({ label, pid: process.pid, threadId, dropped, events }, null, 2);\n\t\t},\n\t\t/** @internal */\n\t\treport() {\n\t\t\tmark(\"diagnostics.report\");\n\t\t\tconsole.error(diagnostics.format());\n\t\t},\n\t};\n\tmark(\"test.start\");\n\treturn diagnostics;\n}\n\n/** @internal Logs only the operation name and exit metadata, never arguments, output or environment. */\nexport function traceTestSubprocess<T>(operation: string, run: () => T): T {\n\tconst trace = active.getStore();\n\tif (!trace) return run();\n\tconst started = performance.now();\n\ttrace.mark(\"subprocess.start\", { operation });\n\ttry {\n\t\tconst result = run();\n\t\ttrace.mark(\"subprocess.exit\", {\n\t\t\toperation,\n\t\t\tstatus: 0,\n\t\t\tdurationMs: Math.round(performance.now() - started),\n\t\t});\n\t\treturn result;\n\t} catch (error) {\n\t\tconst details = error as { status?: unknown; signal?: unknown; code?: unknown } | null;\n\t\ttrace.mark(\"subprocess.exit\", {\n\t\t\toperation,\n\t\t\tdurationMs: Math.round(performance.now() - started),\n\t\t\tstatus: typeof details?.status === \"number\" ? details.status : null,\n\t\t\tsignal: typeof details?.signal === \"string\" ? details.signal : null,\n\t\t\tcode: typeof details?.code === \"string\" ? details.code : null,\n\t\t});\n\t\tthrow error;\n\t}\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,UAAU;;;ACVjB,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AAEzB,IAAM,SAAS,IAAI,kBAA4D;AAGxE,SAAS,sBAAsB,OAAe;AACpD,QAAM,UAAU,YAAY,IAAI;AAChC,QAAM,SAAoC,CAAC;AAC3C,MAAI,UAAU;AACd,QAAM,OAAO,CAAC,OAAe,UAAmC,CAAC,MAAM;AACtE,QAAI,OAAO,WAAW,KAAK;AAC1B,aAAO,MAAM;AACb;AAAA,IACD;AACA,WAAO,KAAK;AAAA,MACX,GAAG;AAAA,MACH;AAAA,MACA,KAAI,oBAAI,KAAK,GAAE,YAAY;AAAA,MAC3B,WAAW,KAAK,MAAM,YAAY,IAAI,IAAI,OAAO;AAAA,IAClD,CAAC;AAAA,EACF;AACA,QAAM,cAAc;AAAA;AAAA,IAEnB;AAAA;AAAA,IAEA,IAAO,IAAgB;AACtB,aAAO,OAAO,IAAI,aAAa,EAAE;AAAA,IAClC;AAAA;AAAA,IAEA,SAAS;AACR,aAAO,KAAK,UAAU,EAAE,OAAO,KAAK,QAAQ,KAAK,UAAU,SAAS,OAAO,GAAG,MAAM,CAAC;AAAA,IACtF;AAAA;AAAA,IAEA,SAAS;AACR,WAAK,oBAAoB;AACzB,cAAQ,MAAM,YAAY,OAAO,CAAC;AAAA,IACnC;AAAA,EACD;AACA,OAAK,YAAY;AACjB,SAAO;AACR;AAGO,SAAS,oBAAuB,WAAmB,KAAiB;AAC1E,QAAM,QA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,QAAI,CAAC,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,EAAE,SAAS,QAAQ;AAChE,WAAK,IAAI,UAAU,CAAC,UAAU,OAAO,UAAU,IAAI,CAAC;AACrD,SAAK,IAAI,UAAU,CAAC,QAAQ,MAAM,mBAAmB,MAAM,EAAE,CAAC;AAC9D,WAAO,EAAE,MAAM,UAAU,OAAO;AAAA,EACjC;AACD;","names":["name"]}
@@ -0,0 +1,15 @@
1
+ import { defineModelProviders } from "@leitwerk-dev/process-sdk";
2
+ /** @public */
3
+ export type FixtureModelProviderSet = ReturnType<typeof defineModelProviders>;
4
+ /** @public */
5
+ export declare function fixtureModelProviders(...models: {
6
+ /** @public */
7
+ id: string;
8
+ /** @public */
9
+ modelId: string;
10
+ /** @internal */
11
+ piProvider?: string;
12
+ /** @public */
13
+ server?: boolean;
14
+ }[]): FixtureModelProviderSet;
15
+ //# sourceMappingURL=model-provider-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-provider-fixtures.d.ts","sourceRoot":"","sources":["../src/model-provider-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,oBAAoB,EACpB,MAAM,2BAA2B,CAAC;AAEnC,cAAc;AACd,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE9E,cAAc;AACd,wBAAgB,qBAAqB,CACpC,GAAG,MAAM,EAAE;IACV,cAAc;IACd,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EAAE,GACD,uBAAuB,CAczB"}
package/dist/polling.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export declare function waitForValue<T>(read: () => T, predicate: (value: T) => boolean, timeoutMs?: number): Promise<T>;
1
+ /** @public */
2
+ export declare function waitForValue<T>(read: () => T | Promise<T>, predicate: (value: T) => boolean, timeoutMs?: number): Promise<T>;
2
3
  //# sourceMappingURL=polling.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"polling.d.ts","sourceRoot":"","sources":["../src/polling.ts"],"names":[],"mappings":"AAAA,wBAAsB,YAAY,CAAC,CAAC,EACnC,IAAI,EAAE,MAAM,CAAC,EACb,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,EAChC,SAAS,SAAQ,GACf,OAAO,CAAC,CAAC,CAAC,CAYZ"}
1
+ {"version":3,"file":"polling.d.ts","sourceRoot":"","sources":["../src/polling.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,wBAAsB,YAAY,CAAC,CAAC,EACnC,IAAI,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC1B,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,EAChC,SAAS,SAAQ,GACf,OAAO,CAAC,CAAC,CAAC,CAYZ"}
@@ -0,0 +1,14 @@
1
+ import type { ProcessInstance } from "@leitwerk-dev/domain";
2
+ import type { AppContext } from "@leitwerk-dev/server";
3
+ /** Drive a running or restarted app without bypassing process HTTP actions. @public */
4
+ export declare function createProcessDriver(context: () => AppContext): {
5
+ /** @public */
6
+ post: (url: string, payload?: Record<string, unknown>) => Promise<import("light-my-request").Response>;
7
+ /** @public */
8
+ waitForProcess: (id: string, predicate: (process: ProcessInstance) => boolean, description: string, timeout?: number, allowError?: boolean) => Promise<ProcessInstance>;
9
+ /** @public */
10
+ wait: (id: string, turn: string | null, lifecycle?: string, timeout?: number) => Promise<ProcessInstance>;
11
+ /** @public */
12
+ action: (id: string, action: string, input?: Record<string, unknown>) => Promise<import("light-my-request").Response>;
13
+ };
14
+ //# sourceMappingURL=process-driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-driver.d.ts","sourceRoot":"","sources":["../src/process-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,UAAU;IAsC3D,cAAc;gBApCU,MAAM,YAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAsChE,cAAc;yBA9BV,MAAM,aACC,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,eACnC,MAAM,6CAGjB,OAAO,CAAC,eAAe,CAAC;IA2B1B,cAAc;eACH,MAAM,QAAQ,MAAM,GAAG,IAAI;IAQtC,cAAc;iBACD,MAAM,UAAU,MAAM,UAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAKpE"}
@@ -1,4 +1,6 @@
1
1
  import type { NormalizedQuestion, ProcessQuestionRequest } from "@leitwerk-dev/domain";
2
+ /** @internal */
2
3
  export declare function createTestQuestion(overrides?: Partial<NormalizedQuestion>): NormalizedQuestion;
4
+ /** @internal */
3
5
  export declare function createTestQuestionRequest(overrides?: Partial<ProcessQuestionRequest>): ProcessQuestionRequest;
4
6
  //# sourceMappingURL=question-fixtures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"question-fixtures.d.ts","sourceRoot":"","sources":["../src/question-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEvF,wBAAgB,kBAAkB,CACjC,SAAS,GAAE,OAAO,CAAC,kBAAkB,CAAM,GACzC,kBAAkB,CAQpB;AAED,wBAAgB,yBAAyB,CACxC,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC7C,sBAAsB,CAexB"}
1
+ {"version":3,"file":"question-fixtures.d.ts","sourceRoot":"","sources":["../src/question-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEvF,gBAAgB;AAChB,wBAAgB,kBAAkB,CACjC,SAAS,GAAE,OAAO,CAAC,kBAAkB,CAAM,GACzC,kBAAkB,CAQpB;AAED,gBAAgB;AAChB,wBAAgB,yBAAyB,CACxC,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC7C,sBAAsB,CAexB"}
@@ -1,31 +1,86 @@
1
1
  import { type ExtensionCatalog } from "@leitwerk-dev/extension-runtime";
2
- import { type CoreServerSetupDeps, createEventBus, type LeitwerkExtensionModule, type ProvidedCapability } from "@leitwerk-dev/process-sdk";
3
- import { flushAsyncWork } from "./worker-testing/ipc-harness.js";
2
+ import { type ExternalWriteLogRepoLike } from "@leitwerk-dev/external-writes/internal";
3
+ import { type CoreServerSetupDeps, createEventBus, type IntegrationToolDefinition, type LeitwerkExtensionModule, type ProvidedCapability, type ServerExtensionAPI } from "@leitwerk-dev/process-sdk";
4
+ import { flushAsyncWork } from "@leitwerk-dev/worker-protocol";
4
5
  export { flushAsyncWork };
6
+ /** Register a test provider and expose its poll result without erasing its type. @public */
7
+ export declare function createPollingTestExtension<T>(manifest: LeitwerkExtensionModule["manifest"], setup: (api: ServerExtensionAPI) => {
8
+ /** @internal */
9
+ poll(): Promise<T>;
10
+ } | undefined): {
11
+ /** @internal */
12
+ manifest: {
13
+ /** @public */
14
+ id: string;
15
+ /** @public */
16
+ version: string;
17
+ /** @public */
18
+ requires?: readonly string[];
19
+ /** @internal */
20
+ optional?: readonly string[];
21
+ };
22
+ /** @internal */
23
+ setupServer(api: ServerExtensionAPI): void;
24
+ /** @public */
25
+ poll(): Promise<T>;
26
+ };
27
+ /** @internal */
28
+ export declare function createToolCollector(writes?: ExternalWriteLogRepoLike): {
29
+ /** @internal */
30
+ api: ServerExtensionAPI;
31
+ /** @internal */
32
+ tools: Map<string, IntegrationToolDefinition<Record<string, unknown>>>;
33
+ };
34
+ /** @internal */
5
35
  export interface InMemoryExternalWriteLog {
36
+ /** @internal */
37
+ records: {
38
+ /** @internal */
39
+ dedupKey: string;
40
+ }[];
41
+ /** @internal */
6
42
  hasDedupKey(key: string): boolean;
43
+ /** @internal */
7
44
  record(input: {
45
+ /** @internal */
8
46
  dedupKey: string;
9
47
  }): {
48
+ /** @internal */
10
49
  dedupKey: string;
11
50
  };
51
+ /** @internal */
12
52
  getDedupKeys(): ReadonlySet<string>;
13
53
  }
54
+ /** @internal */
14
55
  export declare function createInMemoryExternalWriteLog(): InMemoryExternalWriteLog;
56
+ /** @public */
15
57
  export declare function createTestServerSetupCapability(overrides?: Partial<CoreServerSetupDeps>): CoreServerSetupDeps;
58
+ /** @internal */
16
59
  export interface ServerExtensionTestHarness {
60
+ /** @internal */
17
61
  catalog: ExtensionCatalog;
62
+ /** @internal */
18
63
  events: ReturnType<typeof createEventBus>;
64
+ /** @internal */
19
65
  serverSetup: CoreServerSetupDeps;
66
+ /** @internal */
20
67
  startHooks: Array<() => void | Promise<void>>;
68
+ /** @internal */
21
69
  stopHooks: Array<() => void | Promise<void>>;
70
+ /** @internal */
22
71
  flushAsyncWork: typeof flushAsyncWork;
23
72
  }
73
+ /** @internal */
24
74
  export declare function setupServerExtensionTest(input: {
75
+ /** @internal */
25
76
  modules: readonly LeitwerkExtensionModule[];
77
+ /** @internal */
26
78
  providedCapabilities?: readonly ProvidedCapability[];
79
+ /** @internal */
27
80
  serverSetup?: Partial<CoreServerSetupDeps>;
81
+ /** @internal */
28
82
  onStart?: (handler: () => void | Promise<void>) => void;
83
+ /** @internal */
29
84
  onStop?: (handler: () => void | Promise<void>) => void;
30
85
  }): Promise<ServerExtensionTestHarness>;
31
86
  //# sourceMappingURL=server-extension-test-harness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-extension-test-harness.d.ts","sourceRoot":"","sources":["../src/server-extension-test-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAyB,MAAM,iCAAiC,CAAC;AAE/F,OAAO,EACN,KAAK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D,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CACvD,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAsCtC"}
1
+ {"version":3,"file":"server-extension-test-harness.d.ts","sourceRoot":"","sources":["../src/server-extension-test-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAyB,MAAM,iCAAiC,CAAC;AAE/F,OAAO,EAEN,KAAK,wBAAwB,EAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,KAAK,mBAAmB,EAGxB,cAAc,EACd,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAEvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,4FAA4F;AAC5F,wBAAgB,0BAA0B,CAAC,CAAC,EAC3C,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,EAC7C,KAAK,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAC5B;IACA,gBAAgB;IAChB,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;CAClB,GACD,SAAS;IAIX,gBAAgB;;;;;;;;;;;IAEhB,gBAAgB;qBACC,kBAAkB;IAGnC,cAAc;;EAMf;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,CAClC,MAAM,GAAE,wBAA2D;IAelE,gBAAgB;;IAEhB,gBAAgB;;EAGjB;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAwB;IACxC,gBAAgB;IAChB,OAAO,EAAE;QACR,gBAAgB;QAChB,QAAQ,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,gBAAgB;IAChB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,gBAAgB;IAChB,MA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