@hmbown/kytchen-reasoning 0.1.0

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 (45) hide show
  1. package/dist/autocode.d.ts +89 -0
  2. package/dist/autocode.d.ts.map +1 -0
  3. package/dist/autocode.js +282 -0
  4. package/dist/autocode.js.map +1 -0
  5. package/dist/autocode.test.d.ts +2 -0
  6. package/dist/autocode.test.d.ts.map +1 -0
  7. package/dist/autocode.test.js +149 -0
  8. package/dist/autocode.test.js.map +1 -0
  9. package/dist/coherence.d.ts +123 -0
  10. package/dist/coherence.d.ts.map +1 -0
  11. package/dist/coherence.js +289 -0
  12. package/dist/coherence.js.map +1 -0
  13. package/dist/coherence.test.d.ts +2 -0
  14. package/dist/coherence.test.d.ts.map +1 -0
  15. package/dist/coherence.test.js +14 -0
  16. package/dist/coherence.test.js.map +1 -0
  17. package/dist/dialectic.d.ts +126 -0
  18. package/dist/dialectic.d.ts.map +1 -0
  19. package/dist/dialectic.js +317 -0
  20. package/dist/dialectic.js.map +1 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +6 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/recursive.d.ts +214 -0
  26. package/dist/recursive.d.ts.map +1 -0
  27. package/dist/recursive.js +570 -0
  28. package/dist/recursive.js.map +1 -0
  29. package/dist/recursive.test.d.ts +2 -0
  30. package/dist/recursive.test.d.ts.map +1 -0
  31. package/dist/recursive.test.js +94 -0
  32. package/dist/recursive.test.js.map +1 -0
  33. package/dist/router.d.ts +28 -0
  34. package/dist/router.d.ts.map +1 -0
  35. package/dist/router.golden.test.d.ts +2 -0
  36. package/dist/router.golden.test.d.ts.map +1 -0
  37. package/dist/router.golden.test.js +84 -0
  38. package/dist/router.golden.test.js.map +1 -0
  39. package/dist/router.js +272 -0
  40. package/dist/router.js.map +1 -0
  41. package/dist/router.test.d.ts +2 -0
  42. package/dist/router.test.d.ts.map +1 -0
  43. package/dist/router.test.js +86 -0
  44. package/dist/router.test.js.map +1 -0
  45. package/package.json +40 -0
@@ -0,0 +1,570 @@
1
+ // ---------------------------------------------------------------------------
2
+ // SHA-1758: Recursive reasoning and bounded sub-query orchestration
3
+ // ---------------------------------------------------------------------------
4
+ // ---------------------------------------------------------------------------
5
+ // ID generation
6
+ // ---------------------------------------------------------------------------
7
+ let _idCounter = 0;
8
+ /**
9
+ * Generates a stable, collision-resistant task ID.
10
+ *
11
+ * Uses a monotonic counter so recursive traces are deterministic and
12
+ * stable across replays/tests.
13
+ */
14
+ function generateTaskId() {
15
+ _idCounter += 1;
16
+ return `rq-${String(_idCounter).padStart(4, "0")}`;
17
+ }
18
+ /**
19
+ * Resets the internal ID counter. Intended for tests only.
20
+ * @internal
21
+ */
22
+ export function _resetIdCounter() {
23
+ _idCounter = 0;
24
+ }
25
+ // ---------------------------------------------------------------------------
26
+ // Merge strategy
27
+ // ---------------------------------------------------------------------------
28
+ /**
29
+ * Deterministically merges child outcomes into the parent scope.
30
+ *
31
+ * Strategy:
32
+ * 1. Child evidence items are appended to parent evidence in spawn order.
33
+ * 2. The parent summary is augmented with a structured digest of child
34
+ * summaries, preserving ordering and attribution.
35
+ * 3. Finalization status is downgraded to `"partial"` if *any* child
36
+ * did not fully complete.
37
+ */
38
+ function mergeChildOutcomes(parentSummary, parentEvidence, childOutcomes) {
39
+ const mergedEvidence = [...parentEvidence];
40
+ const childDigestParts = [];
41
+ let allChildrenFinalized = true;
42
+ for (const child of childOutcomes) {
43
+ // Collect evidence from the child (and transitively from its children).
44
+ mergedEvidence.push(...flattenEvidence(child));
45
+ const statusTag = child.finalized ? "" : ` [${child.finalizationStatus}]`;
46
+ childDigestParts.push(`- [${child.taskId}]${statusTag}: ${child.summary}`);
47
+ if (!child.finalized) {
48
+ allChildrenFinalized = false;
49
+ }
50
+ }
51
+ let mergedSummary = parentSummary;
52
+ if (childDigestParts.length > 0) {
53
+ mergedSummary += `\n\n--- Sub-query results (${childOutcomes.length}) ---\n`;
54
+ mergedSummary += childDigestParts.join("\n");
55
+ }
56
+ return { mergedSummary, mergedEvidence, allChildrenFinalized };
57
+ }
58
+ /**
59
+ * Recursively collects all evidence items from an outcome tree,
60
+ * preserving depth-first spawn order.
61
+ */
62
+ function flattenEvidence(outcome) {
63
+ const result = [...outcome.evidence];
64
+ for (const child of outcome.childOutcomes) {
65
+ result.push(...flattenEvidence(child));
66
+ }
67
+ return result;
68
+ }
69
+ // ---------------------------------------------------------------------------
70
+ // Orchestrator
71
+ // ---------------------------------------------------------------------------
72
+ /**
73
+ * Recursive reasoning orchestrator with bounded sub-query execution.
74
+ *
75
+ * The orchestrator manages a tree of sub-queries, enforcing hard limits
76
+ * on depth, breadth, and total iterations. It is provider-agnostic: the
77
+ * actual execution of each sub-query is delegated to a caller-supplied
78
+ * callback.
79
+ *
80
+ * ## Lifecycle
81
+ *
82
+ * 1. The caller invokes {@link run} with a root prompt and an execution
83
+ * callback.
84
+ * 2. The orchestrator creates a root task and executes it via the callback.
85
+ * 3. If the callback returns follow-up sub-queries, the orchestrator
86
+ * spawns child tasks (subject to limits) and recurses.
87
+ * 4. Child outcomes are merged back into the parent deterministically.
88
+ * 5. A full {@link RecursiveTrace} is returned for observability.
89
+ *
90
+ * ## Graceful degradation
91
+ *
92
+ * When any limit is reached, the orchestrator does **not** throw. Instead
93
+ * it produces a partial outcome with an appropriate
94
+ * {@link FinalizationStatus} and a fallback summary. Callers can inspect
95
+ * the trace to see which sub-queries were curtailed.
96
+ */
97
+ export class RecursiveOrchestrator {
98
+ config;
99
+ constructor(config) {
100
+ this.config = config;
101
+ }
102
+ // -----------------------------------------------------------------------
103
+ // Public API
104
+ // -----------------------------------------------------------------------
105
+ /**
106
+ * Returns `true` if a new task can be spawned given the current depth
107
+ * and cumulative iteration count.
108
+ */
109
+ canSpawn(depth, iterations) {
110
+ return depth < this.config.maxDepth && iterations < this.config.maxIterations;
111
+ }
112
+ /**
113
+ * Produces a fallback outcome when a task cannot be fully executed.
114
+ * The outcome is explicitly marked as non-finalized with the
115
+ * appropriate status.
116
+ */
117
+ summarizeFallback(task, status = "partial") {
118
+ return {
119
+ taskId: task.id,
120
+ depth: task.depth,
121
+ finalized: false,
122
+ finalizationStatus: status,
123
+ summary: buildFallbackSummary(task, status),
124
+ evidence: [],
125
+ childOutcomes: [],
126
+ };
127
+ }
128
+ /**
129
+ * Executes a recursive reasoning pass starting from the given root
130
+ * prompt.
131
+ *
132
+ * @param rootPrompt - The top-level query to reason about.
133
+ * @param execute - Provider-agnostic callback for running a single
134
+ * sub-query. The orchestrator calls this for every
135
+ * task node in the tree.
136
+ * @returns A full trace of the recursive decomposition.
137
+ */
138
+ async run(rootPrompt, execute, options = {}) {
139
+ const limits = resolveLimits(this.config, options);
140
+ const nowFn = options.now ?? Date.now;
141
+ const deadlineAtMs = typeof limits.maxWallTimeMs === "number" ? nowFn() + limits.maxWallTimeMs : undefined;
142
+ const taskMap = new Map();
143
+ const state = {
144
+ iterations: 0,
145
+ maxDepthReached: 0,
146
+ taskMap,
147
+ limits,
148
+ now: nowFn,
149
+ signal: options.signal,
150
+ deadlineAtMs,
151
+ onLifecycleEvent: options.onLifecycleEvent,
152
+ };
153
+ const rootTask = createTask(rootPrompt, 0, null, 0);
154
+ taskMap.set(rootTask.id, rootTask);
155
+ await this.emitLifecycle(state, {
156
+ type: "execution.started",
157
+ timestamp: toIso(state.now()),
158
+ maxDepth: limits.maxDepth,
159
+ maxIterations: limits.maxIterations,
160
+ maxBreadth: limits.maxBreadth,
161
+ maxWallTimeMs: limits.maxWallTimeMs,
162
+ remainingMs: this.remainingMs(state),
163
+ message: "recursive execution started",
164
+ });
165
+ const rootOutcome = await this.executeTask(rootTask, execute, state, []);
166
+ await this.emitLifecycle(state, {
167
+ type: "execution.completed",
168
+ timestamp: toIso(state.now()),
169
+ maxDepth: limits.maxDepth,
170
+ maxIterations: limits.maxIterations,
171
+ maxBreadth: limits.maxBreadth,
172
+ maxWallTimeMs: limits.maxWallTimeMs,
173
+ maxDepthReached: state.maxDepthReached,
174
+ iteration: state.iterations,
175
+ remainingMs: this.remainingMs(state),
176
+ finalizationStatus: rootOutcome.finalizationStatus,
177
+ summary: rootOutcome.summary,
178
+ evidenceCount: flattenEvidence(rootOutcome).length,
179
+ message: "recursive execution completed",
180
+ });
181
+ return {
182
+ rootOutcome,
183
+ taskMap,
184
+ totalIterations: state.iterations,
185
+ maxDepthReached: state.maxDepthReached,
186
+ };
187
+ }
188
+ // -----------------------------------------------------------------------
189
+ // Internal execution engine
190
+ // -----------------------------------------------------------------------
191
+ /**
192
+ * Recursively executes a single task and all of its spawned children.
193
+ */
194
+ async executeTask(task, execute, state, parentEvidence) {
195
+ // Track depth watermark.
196
+ if (task.depth > state.maxDepthReached) {
197
+ state.maxDepthReached = task.depth;
198
+ }
199
+ if (this.isInterrupted(state)) {
200
+ await this.emitLifecycle(state, {
201
+ type: "task.interrupted",
202
+ timestamp: toIso(state.now()),
203
+ taskId: task.id,
204
+ parentTaskId: task.parentId,
205
+ depth: task.depth,
206
+ prompt: task.prompt,
207
+ iteration: state.iterations,
208
+ maxIterations: state.limits.maxIterations,
209
+ remainingMs: this.remainingMs(state),
210
+ finalizationStatus: "interrupted",
211
+ message: "sub-agent interrupted before execution",
212
+ });
213
+ return this.summarizeFallback(task, "interrupted");
214
+ }
215
+ if (this.isTimeBudgetExceeded(state)) {
216
+ await this.emitLifecycle(state, {
217
+ type: "task.limited",
218
+ timestamp: toIso(state.now()),
219
+ taskId: task.id,
220
+ parentTaskId: task.parentId,
221
+ depth: task.depth,
222
+ prompt: task.prompt,
223
+ iteration: state.iterations,
224
+ maxIterations: state.limits.maxIterations,
225
+ remainingMs: this.remainingMs(state),
226
+ finalizationStatus: "time_budget_exceeded",
227
+ message: "sub-agent skipped because time budget is exhausted",
228
+ });
229
+ return this.summarizeFallback(task, "time_budget_exceeded");
230
+ }
231
+ // Enforce iteration limit *before* executing.
232
+ if (state.iterations >= state.limits.maxIterations) {
233
+ await this.emitLifecycle(state, {
234
+ type: "task.limited",
235
+ timestamp: toIso(state.now()),
236
+ taskId: task.id,
237
+ parentTaskId: task.parentId,
238
+ depth: task.depth,
239
+ prompt: task.prompt,
240
+ iteration: state.iterations,
241
+ maxIterations: state.limits.maxIterations,
242
+ remainingMs: this.remainingMs(state),
243
+ finalizationStatus: "iteration_limit_reached",
244
+ message: "sub-agent skipped because iteration budget is exhausted",
245
+ });
246
+ return this.summarizeFallback(task, "iteration_limit_reached");
247
+ }
248
+ // Consume one iteration.
249
+ state.iterations += 1;
250
+ await this.emitLifecycle(state, {
251
+ type: "task.started",
252
+ timestamp: toIso(state.now()),
253
+ taskId: task.id,
254
+ parentTaskId: task.parentId,
255
+ depth: task.depth,
256
+ prompt: task.prompt,
257
+ iteration: state.iterations,
258
+ maxIterations: state.limits.maxIterations,
259
+ remainingMs: this.remainingMs(state),
260
+ message: "sub-agent execution started",
261
+ });
262
+ // Execute the task via the caller-supplied callback.
263
+ let result;
264
+ try {
265
+ result = await execute(task, parentEvidence, {
266
+ iteration: state.iterations,
267
+ maxIterations: state.limits.maxIterations,
268
+ startedAt: toIso(state.now()),
269
+ remainingMs: this.remainingMs(state),
270
+ signal: state.signal,
271
+ });
272
+ }
273
+ catch (err) {
274
+ const message = err instanceof Error ? err.message : String(err);
275
+ const interrupted = this.isInterrupted(state) || /\babort(ed|ing)?\b/i.test(message);
276
+ const finalizationStatus = interrupted ? "interrupted" : "execution_error";
277
+ await this.emitLifecycle(state, {
278
+ type: interrupted ? "task.interrupted" : "task.completed",
279
+ timestamp: toIso(state.now()),
280
+ taskId: task.id,
281
+ parentTaskId: task.parentId,
282
+ depth: task.depth,
283
+ prompt: task.prompt,
284
+ iteration: state.iterations,
285
+ maxIterations: state.limits.maxIterations,
286
+ remainingMs: this.remainingMs(state),
287
+ finalizationStatus,
288
+ summary: message,
289
+ message: interrupted
290
+ ? "sub-agent interrupted during execution"
291
+ : "sub-agent execution failed",
292
+ });
293
+ return {
294
+ taskId: task.id,
295
+ depth: task.depth,
296
+ finalized: false,
297
+ finalizationStatus,
298
+ summary: interrupted ? "Execution interrupted by signal." : `Execution failed: ${message}`,
299
+ evidence: [],
300
+ childOutcomes: [],
301
+ };
302
+ }
303
+ // Accumulate evidence from this execution.
304
+ const taskEvidence = [...result.evidence];
305
+ // Determine which sub-queries to spawn.
306
+ const requestedSubQueries = result.subQueries ?? [];
307
+ const childOutcomes = [];
308
+ if (requestedSubQueries.length > 0) {
309
+ const childDepth = task.depth + 1;
310
+ // Check depth limit.
311
+ if (childDepth >= state.limits.maxDepth) {
312
+ // Cannot go deeper -- produce partial outcome noting the limit.
313
+ const depthLimitOutcome = this.buildDepthLimitNote(task, result.summary, taskEvidence, requestedSubQueries);
314
+ await this.emitLifecycle(state, {
315
+ type: "task.limited",
316
+ timestamp: toIso(state.now()),
317
+ taskId: task.id,
318
+ parentTaskId: task.parentId,
319
+ depth: task.depth,
320
+ prompt: task.prompt,
321
+ iteration: state.iterations,
322
+ maxIterations: state.limits.maxIterations,
323
+ remainingMs: this.remainingMs(state),
324
+ finalizationStatus: "depth_limit_reached",
325
+ childCount: requestedSubQueries.length,
326
+ message: "requested sub-queries dropped by depth limit",
327
+ });
328
+ return depthLimitOutcome;
329
+ }
330
+ // Determine how many children we can actually spawn.
331
+ const breadthCap = state.limits.maxBreadth;
332
+ const iterationsRemaining = state.limits.maxIterations - state.iterations;
333
+ const spawnable = Math.min(requestedSubQueries.length, breadthCap, iterationsRemaining);
334
+ const breadthLimited = spawnable < requestedSubQueries.length;
335
+ let interrupted = false;
336
+ let timeLimited = false;
337
+ let iterationLimited = false;
338
+ for (let i = 0; i < spawnable; i++) {
339
+ if (this.isInterrupted(state)) {
340
+ interrupted = true;
341
+ break;
342
+ }
343
+ if (this.isTimeBudgetExceeded(state)) {
344
+ timeLimited = true;
345
+ break;
346
+ }
347
+ // Re-check iteration budget before each child.
348
+ if (state.iterations >= state.limits.maxIterations) {
349
+ iterationLimited = true;
350
+ break;
351
+ }
352
+ const childPrompt = requestedSubQueries[i];
353
+ const childTask = createTask(childPrompt, childDepth, task.id, i);
354
+ task.childIds.push(childTask.id);
355
+ state.taskMap.set(childTask.id, childTask);
356
+ await this.emitLifecycle(state, {
357
+ type: "task.spawned",
358
+ timestamp: toIso(state.now()),
359
+ taskId: childTask.id,
360
+ parentTaskId: task.id,
361
+ depth: childTask.depth,
362
+ prompt: childTask.prompt,
363
+ iteration: state.iterations,
364
+ maxIterations: state.limits.maxIterations,
365
+ remainingMs: this.remainingMs(state),
366
+ message: `spawned from ${task.id}`,
367
+ });
368
+ // Evidence visible to the child: parent's original evidence plus
369
+ // evidence from this task's own execution.
370
+ const childParentEvidence = [...parentEvidence, ...taskEvidence];
371
+ const childOutcome = await this.executeTask(childTask, execute, state, childParentEvidence);
372
+ childOutcomes.push(childOutcome);
373
+ }
374
+ // Merge child outcomes into this task's result.
375
+ const { mergedSummary, mergedEvidence, allChildrenFinalized } = mergeChildOutcomes(result.summary, taskEvidence, childOutcomes);
376
+ let finalizationStatus;
377
+ if (interrupted) {
378
+ finalizationStatus = "interrupted";
379
+ }
380
+ else if (timeLimited) {
381
+ finalizationStatus = "time_budget_exceeded";
382
+ }
383
+ else if (breadthLimited) {
384
+ finalizationStatus = "breadth_limit_reached";
385
+ }
386
+ else if (iterationLimited) {
387
+ finalizationStatus = "iteration_limit_reached";
388
+ }
389
+ else {
390
+ finalizationStatus = allChildrenFinalized ? "completed" : "partial";
391
+ }
392
+ const finalized = finalizationStatus === "completed";
393
+ const outcome = {
394
+ taskId: task.id,
395
+ depth: task.depth,
396
+ finalized,
397
+ finalizationStatus,
398
+ summary: mergedSummary,
399
+ evidence: mergedEvidence,
400
+ childOutcomes,
401
+ };
402
+ await this.emitLifecycle(state, {
403
+ type: "task.merged",
404
+ timestamp: toIso(state.now()),
405
+ taskId: task.id,
406
+ parentTaskId: task.parentId,
407
+ depth: task.depth,
408
+ prompt: task.prompt,
409
+ iteration: state.iterations,
410
+ maxIterations: state.limits.maxIterations,
411
+ remainingMs: this.remainingMs(state),
412
+ finalizationStatus,
413
+ childCount: childOutcomes.length,
414
+ evidenceCount: mergedEvidence.length,
415
+ summary: mergedSummary,
416
+ message: "child outcomes merged into parent",
417
+ });
418
+ await this.emitLifecycle(state, {
419
+ type: finalizationStatus === "interrupted" ? "task.interrupted" : "task.completed",
420
+ timestamp: toIso(state.now()),
421
+ taskId: task.id,
422
+ parentTaskId: task.parentId,
423
+ depth: task.depth,
424
+ prompt: task.prompt,
425
+ iteration: state.iterations,
426
+ maxIterations: state.limits.maxIterations,
427
+ remainingMs: this.remainingMs(state),
428
+ finalizationStatus,
429
+ childCount: childOutcomes.length,
430
+ evidenceCount: mergedEvidence.length,
431
+ summary: mergedSummary,
432
+ message: "sub-agent task finished",
433
+ });
434
+ return outcome;
435
+ }
436
+ // Leaf task -- no sub-queries requested.
437
+ const leafOutcome = {
438
+ taskId: task.id,
439
+ depth: task.depth,
440
+ finalized: true,
441
+ finalizationStatus: "completed",
442
+ summary: result.summary,
443
+ evidence: taskEvidence,
444
+ childOutcomes: [],
445
+ };
446
+ await this.emitLifecycle(state, {
447
+ type: "task.completed",
448
+ timestamp: toIso(state.now()),
449
+ taskId: task.id,
450
+ parentTaskId: task.parentId,
451
+ depth: task.depth,
452
+ prompt: task.prompt,
453
+ iteration: state.iterations,
454
+ maxIterations: state.limits.maxIterations,
455
+ remainingMs: this.remainingMs(state),
456
+ finalizationStatus: "completed",
457
+ evidenceCount: taskEvidence.length,
458
+ summary: result.summary,
459
+ message: "sub-agent leaf task finished",
460
+ });
461
+ return leafOutcome;
462
+ }
463
+ /**
464
+ * Builds a partial outcome when a task wants to spawn children but the
465
+ * depth limit has been reached.
466
+ */
467
+ buildDepthLimitNote(task, summary, evidence, droppedQueries) {
468
+ const truncatedList = droppedQueries
469
+ .slice(0, 5)
470
+ .map((q) => ` - ${q.slice(0, 120)}`)
471
+ .join("\n");
472
+ const moreNote = droppedQueries.length > 5
473
+ ? `\n ... and ${droppedQueries.length - 5} more`
474
+ : "";
475
+ return {
476
+ taskId: task.id,
477
+ depth: task.depth,
478
+ finalized: false,
479
+ finalizationStatus: "depth_limit_reached",
480
+ summary: `${summary}\n\n[Depth limit reached — ${droppedQueries.length} sub-query(ies) not spawned]\n${truncatedList}${moreNote}`,
481
+ evidence,
482
+ childOutcomes: [],
483
+ };
484
+ }
485
+ isInterrupted(state) {
486
+ return state.signal?.aborted === true;
487
+ }
488
+ remainingMs(state) {
489
+ if (state.deadlineAtMs === undefined)
490
+ return undefined;
491
+ return Math.max(0, state.deadlineAtMs - state.now());
492
+ }
493
+ isTimeBudgetExceeded(state) {
494
+ const remaining = this.remainingMs(state);
495
+ return typeof remaining === "number" ? remaining <= 0 : false;
496
+ }
497
+ async emitLifecycle(state, event) {
498
+ await state.onLifecycleEvent?.(event);
499
+ }
500
+ }
501
+ /** Creates a new task node. */
502
+ function createTask(prompt, depth, parentId, siblingIndex) {
503
+ return {
504
+ id: generateTaskId(),
505
+ prompt,
506
+ depth,
507
+ parentId,
508
+ childIds: [],
509
+ siblingIndex,
510
+ };
511
+ }
512
+ /** Builds a human-readable fallback summary for a curtailed task. */
513
+ function buildFallbackSummary(task, status) {
514
+ const reason = FALLBACK_REASON_LABELS[status] ?? "unknown limit";
515
+ return (`Partial summary for task ${task.id} at depth ${task.depth}: ` +
516
+ `execution was curtailed (${reason}). ` +
517
+ `Original prompt: "${task.prompt.slice(0, 200)}${task.prompt.length > 200 ? "..." : ""}"`);
518
+ }
519
+ const FALLBACK_REASON_LABELS = {
520
+ completed: "completed",
521
+ depth_limit_reached: "maximum recursion depth reached",
522
+ breadth_limit_reached: "maximum breadth per task reached",
523
+ iteration_limit_reached: "total iteration budget exhausted",
524
+ time_budget_exceeded: "wall-clock time budget exhausted",
525
+ interrupted: "execution interrupted by operator signal",
526
+ execution_error: "execution callback threw an error",
527
+ partial: "partial completion",
528
+ };
529
+ function resolveLimits(base, overrides) {
530
+ const maxDepth = sanitizeInteger(overrides.maxDepth ?? base.maxDepth, 1, 64, base.maxDepth);
531
+ const maxIterations = sanitizeInteger(overrides.maxIterations ?? base.maxIterations, 1, 1024, base.maxIterations);
532
+ const requestedBreadth = overrides.maxBreadth ?? base.maxBreadth ?? maxIterations;
533
+ const breadthFallback = Number.isFinite(requestedBreadth) && requestedBreadth > 0
534
+ ? Math.min(maxIterations, Math.floor(requestedBreadth))
535
+ : Math.min(maxIterations, 1);
536
+ const maxBreadth = sanitizeInteger(requestedBreadth, 1, maxIterations, breadthFallback);
537
+ const maxWallTimeMs = sanitizeOptionalInteger(overrides.maxWallTimeMs ?? base.maxWallTimeMs, 100, 3_600_000);
538
+ return {
539
+ maxDepth,
540
+ maxIterations,
541
+ maxBreadth,
542
+ ...(maxWallTimeMs !== undefined ? { maxWallTimeMs } : {}),
543
+ };
544
+ }
545
+ function sanitizeInteger(value, min, max, fallback) {
546
+ if (!Number.isFinite(value))
547
+ return fallback;
548
+ const rounded = Math.floor(value);
549
+ if (rounded < min)
550
+ return min;
551
+ if (rounded > max)
552
+ return max;
553
+ return rounded;
554
+ }
555
+ function sanitizeOptionalInteger(value, min, max) {
556
+ if (value === undefined)
557
+ return undefined;
558
+ if (!Number.isFinite(value))
559
+ return undefined;
560
+ const rounded = Math.floor(value);
561
+ if (rounded < min)
562
+ return min;
563
+ if (rounded > max)
564
+ return max;
565
+ return rounded;
566
+ }
567
+ function toIso(epochMs) {
568
+ return new Date(epochMs).toISOString();
569
+ }
570
+ //# sourceMappingURL=recursive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recursive.js","sourceRoot":"","sources":["../src/recursive.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oEAAoE;AACpE,8EAA8E;AA6M9E,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB;;;;;GAKG;AACH,SAAS,cAAc;IACrB,UAAU,IAAI,CAAC,CAAC;IAChB,OAAO,MAAM,MAA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AAG,GAAG;QAAE,OAAO,GAAG,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAyB,EACzB,GAAW,EACX,GAAW;IAEX,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,OAAO,GAAG,GAAG;QAAE,OAAO,GAAG,CAAC;IAC9B,IAAI,OAAO,GAAG,GAAG;QAAE,OAAO,GAAG,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,KAAK,CAAC,OAAe;IAC5B,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=recursive.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recursive.test.d.ts","sourceRoot":"","sources":["../src/recursive.test.ts"],"names":[],"mappings":""}