stitchkit 0.83.0 → 0.83.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.
package/CHANGELOG.md CHANGED
@@ -15,6 +15,25 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.83.1] — 2026-09-07
19
+
20
+ ### Fixed
21
+
22
+ - **The drain bound could not fire when it was the only thing left to fire.**
23
+ 0.83.0 unref'd the bound's timer, which reads like hygiene — a drain bound
24
+ should not keep a process alive while it is shutting down — and silently
25
+ destroyed the feature. A pending write holds nothing, so when the stuck write
26
+ is the last work in the process, an unref'd timer lets the event loop empty
27
+ and `close({ timeoutMs })` never settles at all. That is not an edge case, it
28
+ is the case the bound exists for; under Node the process exits 13 on the
29
+ unsettled await. The timer cannot outlive the deadline the caller asked for,
30
+ so it is ref'd again.
31
+
32
+ Every in-process test passed against the broken build, because a test runner
33
+ keeps the loop alive by itself. The consumer lane now runs the real failure
34
+ from the packed tarball under each runtime (`node: drain bound`), which is the
35
+ only place it was ever visible.
36
+
18
37
  ## [0.83.0] — 2026-09-07
19
38
 
20
39
  ### ⚠️ Breaking changes
@@ -2,12 +2,12 @@ import {
2
2
  composeAgentPrompt,
3
3
  createAgentRuntime,
4
4
  createAgentRuntimeEventSink
5
- } from "./index-pq7ak4k8.js";
5
+ } from "./index-st8v8739.js";
6
6
  import {
7
7
  AgentModelDescriptorSchema
8
8
  } from "./index-tg3m2ec5.js";
9
9
  import"./index-y2s6h5bf.js";
10
- import"./index-7z1h3kbr.js";
10
+ import"./index-wnfk50r0.js";
11
11
  import {
12
12
  walkContainedFiles
13
13
  } from "./index-rqpdar1e.js";
@@ -48,7 +48,7 @@ import {
48
48
  registerDeferredToolRepair,
49
49
  repairedSearchCall,
50
50
  selectAgentHistory
51
- } from "./index-pq7ak4k8.js";
51
+ } from "./index-st8v8739.js";
52
52
  import {
53
53
  AgentModelCapabilitySchema,
54
54
  AgentModelCatalogEntrySchema,
@@ -72,7 +72,7 @@ import {
72
72
  } from "./index-y2s6h5bf.js";
73
73
  import {
74
74
  createBoundedSinkManager
75
- } from "./index-7z1h3kbr.js";
75
+ } from "./index-wnfk50r0.js";
76
76
  import {
77
77
  AgentAdmissionEventSchema,
78
78
  AgentCheckpointEventSchema,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ActivitySnapshotSchema,
3
3
  ManagedScheduleStatusSchema
4
- } from "./index-64ew0vnj.js";
4
+ } from "./index-9f8ztey6.js";
5
5
  import {
6
6
  ApplicationSnapshotSchema
7
7
  } from "./index-3gye9wzb.js";
8
- import"./index-7z1h3kbr.js";
8
+ import"./index-wnfk50r0.js";
9
9
  import"./index-7gnkny4z.js";
10
10
 
11
11
  // src/application/opentelemetry.ts
@@ -26,7 +26,7 @@ import {
26
26
  createActivityProjection,
27
27
  createApplicationSnapshotSink,
28
28
  createManagedSchedule
29
- } from "./index-64ew0vnj.js";
29
+ } from "./index-9f8ztey6.js";
30
30
  import {
31
31
  DiagnosticJournalCloseResultSchema,
32
32
  DiagnosticJournalFailurePhaseSchema,
@@ -60,7 +60,7 @@ import {
60
60
  import"./index-3z73fh2c.js";
61
61
  import {
62
62
  createBoundedSinkManager
63
- } from "./index-7z1h3kbr.js";
63
+ } from "./index-wnfk50r0.js";
64
64
  import {
65
65
  backoffDelay,
66
66
  createBackoff
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  assertDrainBound,
6
6
  withinBound
7
- } from "./index-7z1h3kbr.js";
7
+ } from "./index-wnfk50r0.js";
8
8
  import {
9
9
  createBoundedChannel
10
10
  } from "./index-7gnkny4z.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./index-y2s6h5bf.js";
9
9
  import {
10
10
  createBoundedSinkManager
11
- } from "./index-7z1h3kbr.js";
11
+ } from "./index-wnfk50r0.js";
12
12
  import {
13
13
  AgentRuntimeEventSchema,
14
14
  agentDurableEventId
@@ -82,10 +82,8 @@ function withinBound(work, bound) {
82
82
  onAbort = give;
83
83
  signal.addEventListener("abort", onAbort, { once: true });
84
84
  }
85
- if (timeoutMs !== undefined) {
85
+ if (timeoutMs !== undefined)
86
86
  timer = setTimeout(give, timeoutMs);
87
- timer.unref?.();
88
- }
89
87
  });
90
88
  return Promise.race([work.then(() => true), reached]).finally(() => {
91
89
  if (timer !== undefined)
@@ -53,8 +53,16 @@ export declare function assertDrainBound(bound: ObservabilityDrainBound | undefi
53
53
  * `flush({ signal })` per batch is exactly the shape that accumulates them.
54
54
  * A listener and a timer, both disposed here, cost nothing and leave nothing.
55
55
  *
56
- * The timer is unref'd: a drain bound must never be the thing keeping a process
57
- * alive when the whole point is shutting down.
56
+ * The timer is REF'D, and that is the whole mechanism. Unref'ing it reads like
57
+ * good hygiene a drain bound should not keep a process alive while it is
58
+ * shutting down — and it silently destroys the feature: a pending write holds
59
+ * nothing, so when the stuck write is the last thing left, an unref'd timer
60
+ * lets the loop empty and the bound never fires at all. That is not an edge
61
+ * case, it is the case this exists for. The timer cannot outlive the deadline
62
+ * the caller itself asked for, so holding the loop for exactly that long is
63
+ * what was wanted. Found only by installing the published package and running
64
+ * it under `node`, where the process exits 13 on an unsettled top-level await;
65
+ * every in-process test passes because the runner keeps the loop alive.
58
66
  */
59
67
  export declare function withinBound(work: Promise<unknown>, bound: ObservabilityDrainBound | undefined): Promise<boolean>;
60
68
  export interface BoundedSinkManager<EVENT> {
@@ -1 +1 @@
1
- {"version":3,"file":"observability-sink.d.ts","sourceRoot":"","sources":["../../src/internal/observability-sink.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,gBAAgB,CAAC,KAAK;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,eAAe,CA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C/C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,GAAG,IAAI,CAMjF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EACtB,KAAK,EAAE,uBAAuB,GAAG,SAAS,GACzC,OAAO,CAAC,OAAO,CAAC,CA2BlB;AAED,MAAM,WAAW,kBAAkB,CAAC,KAAK;IACvC,MAAM,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACpD,iFAAiF;IACjF,KAAK,CAAC,KAAK,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,SAAS,IAAI,uBAAuB,CAAC;IACrC;;;;OAIG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC1E;AAaD,wBAAgB,wBAAwB,CAAC,KAAK,EAC5C,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAC/B,kBAAkB,CAAC,KAAK,CAAC,CAuJ3B"}
@@ -6,7 +6,7 @@ import {
6
6
  assertDrainBound,
7
7
  createBoundedSinkManager,
8
8
  withinBound
9
- } from "../index-7z1h3kbr.js";
9
+ } from "../index-wnfk50r0.js";
10
10
  import {
11
11
  measureSize,
12
12
  redact,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.83.0",
3
+ "version": "0.83.1",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",