@linnlabs/linnkit 0.32.1 → 0.32.3

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/CHANGELOG.md +13 -0
  2. package/dist/cli.cjs +35 -14
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +35 -14
  5. package/dist/cli.js.map +1 -1
  6. package/dist/contracts/agentSpec.d.cts +30 -30
  7. package/dist/contracts/agentSpec.d.ts +30 -30
  8. package/dist/contracts/audit.d.cts +24 -24
  9. package/dist/contracts/audit.d.ts +24 -24
  10. package/dist/contracts/contextPolicy.d.cts +36 -36
  11. package/dist/contracts/contextPolicy.d.ts +36 -36
  12. package/dist/contracts/events.d.cts +1080 -1080
  13. package/dist/contracts/events.d.ts +1080 -1080
  14. package/dist/contracts/execution.d.cts +8 -8
  15. package/dist/contracts/execution.d.ts +8 -8
  16. package/dist/contracts/messages.d.cts +1178 -1178
  17. package/dist/contracts/messages.d.ts +1178 -1178
  18. package/dist/contracts/provider-continuation.d.cts +28 -28
  19. package/dist/contracts/provider-continuation.d.ts +28 -28
  20. package/dist/contracts/sse.d.cts +897 -897
  21. package/dist/contracts/sse.d.ts +897 -897
  22. package/dist/contracts/sub-run-trace-payload.d.cts +26 -26
  23. package/dist/contracts/sub-run-trace-payload.d.ts +26 -26
  24. package/dist/contracts/token-accounting.d.cts +30 -30
  25. package/dist/contracts/token-accounting.d.ts +30 -30
  26. package/dist/index.cjs +35 -14
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.js +35 -14
  29. package/dist/index.js.map +1 -1
  30. package/dist/quickstart.cjs +35 -14
  31. package/dist/quickstart.cjs.map +1 -1
  32. package/dist/quickstart.js +35 -14
  33. package/dist/quickstart.js.map +1 -1
  34. package/dist/runtime-kernel/events/agentEvents.d.cts +172 -172
  35. package/dist/runtime-kernel/events/agentEvents.d.ts +172 -172
  36. package/dist/runtime-kernel.cjs +35 -14
  37. package/dist/runtime-kernel.cjs.map +1 -1
  38. package/dist/runtime-kernel.js +35 -14
  39. package/dist/runtime-kernel.js.map +1 -1
  40. package/dist/testkit.cjs +35 -14
  41. package/dist/testkit.cjs.map +1 -1
  42. package/dist/testkit.js +35 -14
  43. package/dist/testkit.js.map +1 -1
  44. package/docs/integration/01-installation.md +1 -1
  45. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -14,6 +14,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
14
 
15
15
  ## [Unreleased]
16
16
 
17
+ ## [0.32.3] - 2026-09-11
18
+
19
+ ### Changed
20
+
21
+ - Allow testkit consumers to use Vitest 4 while preserving compatibility with
22
+ existing Vitest 2 and 3 hosts.
23
+
24
+ ## [0.32.2] - 2026-09-07
25
+
26
+ ### Fixed
27
+
28
+ - Keep answer chunk sequence allocation transactional across the streaming adapter and Graph runtime event bridge. A failed downstream publish no longer consumes the current `final_answer_chunk.seq`, so a subsequent retry can publish the same chunk without creating a sequence gap.
29
+
17
30
  ## [0.32.1] - 2026-09-05
18
31
 
19
32
  ### Fixed
package/dist/cli.cjs CHANGED
@@ -6148,16 +6148,21 @@ var GraphAgentExecutor = class {
6148
6148
  };
6149
6149
 
6150
6150
  // src/runtime-kernel/graph-engine/nodes/llmNode.state.ts
6151
+ function assertLlmNodeStreamChunkSequence(state, answerId, seq) {
6152
+ const answerChanged = state.answerId !== answerId;
6153
+ const expectedSeq = answerChanged ? 0 : state.chunkSeq;
6154
+ if (seq !== expectedSeq) {
6155
+ throw new Error(
6156
+ `final_answer_chunk sequence mismatch: answer=${answerId}, expected=${expectedSeq}, actual=${seq}`
6157
+ );
6158
+ }
6159
+ }
6151
6160
  function llmNodeReducer(state, action) {
6152
6161
  switch (action.type) {
6153
6162
  case "STREAM_CHUNK_RECEIVED": {
6163
+ assertLlmNodeStreamChunkSequence(state, action.answerId, action.seq);
6154
6164
  const answerChanged = state.answerId !== action.answerId;
6155
6165
  const expectedSeq = answerChanged ? 0 : state.chunkSeq;
6156
- if (action.seq !== expectedSeq) {
6157
- throw new Error(
6158
- `final_answer_chunk sequence mismatch: answer=${action.answerId}, expected=${expectedSeq}, actual=${action.seq}`
6159
- );
6160
- }
6161
6166
  return {
6162
6167
  ...state,
6163
6168
  answerId: action.answerId,
@@ -6848,12 +6853,21 @@ var LlmNodeEventBridge = class {
6848
6853
  throw new Error("final_answer did not map to a final_answer RuntimeEvent.");
6849
6854
  }
6850
6855
  const liveChunk = createStandaloneFinalAnswerChunk(finalAnswer);
6856
+ assertLlmNodeStreamChunkSequence(
6857
+ this.deps.getState(),
6858
+ liveChunk.answer_id,
6859
+ liveChunk.seq
6860
+ );
6861
+ const publishedChunk = this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone");
6862
+ if (publishedChunk.type !== "final_answer_chunk") {
6863
+ throw new Error("RuntimeEvent sink changed standalone final_answer_chunk type.");
6864
+ }
6851
6865
  this.deps.dispatch({
6852
6866
  type: "STREAM_CHUNK_RECEIVED",
6853
- answerId: liveChunk.answer_id,
6854
- seq: liveChunk.seq
6867
+ answerId: publishedChunk.answer_id,
6868
+ seq: publishedChunk.seq
6855
6869
  });
6856
- this.buffer(this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone"));
6870
+ this.buffer(publishedChunk);
6857
6871
  this.buffer(this.publish(finalAnswer, "LlmNode.final_answer"));
6858
6872
  }
6859
6873
  this.deps.dispatch({ type: "FINAL_ANSWER_RECEIVED" });
@@ -6877,15 +6891,20 @@ var LlmNodeEventBridge = class {
6877
6891
  if (!runtimeEvent || runtimeEvent.type !== "final_answer_chunk") {
6878
6892
  throw new Error("stream_chunk did not map to final_answer_chunk.");
6879
6893
  }
6880
- this.deps.dispatch({
6881
- type: "STREAM_CHUNK_RECEIVED",
6882
- answerId: runtimeEvent.answer_id,
6883
- seq: runtimeEvent.seq
6884
- });
6894
+ assertLlmNodeStreamChunkSequence(
6895
+ this.deps.getState(),
6896
+ runtimeEvent.answer_id,
6897
+ runtimeEvent.seq
6898
+ );
6885
6899
  const published = this.publish(runtimeEvent, "LlmNode.final_answer_chunk");
6886
6900
  if (published.type !== "final_answer_chunk") {
6887
6901
  throw new Error("RuntimeEvent sink changed final_answer_chunk type.");
6888
6902
  }
6903
+ this.deps.dispatch({
6904
+ type: "STREAM_CHUNK_RECEIVED",
6905
+ answerId: published.answer_id,
6906
+ seq: published.seq
6907
+ });
6889
6908
  this.assembler.push(published);
6890
6909
  this.buffer(published);
6891
6910
  }
@@ -10403,14 +10422,16 @@ async function callLlmStream(params) {
10403
10422
  case "answer_delta":
10404
10423
  emitThoughtComplete(thoughtSegmenter.onBoundary());
10405
10424
  fullResponse += event.text;
10425
+ const seq = streamChunkSeq;
10406
10426
  emit({
10407
10427
  type: "stream_chunk",
10408
10428
  timestamp: Date.now(),
10409
10429
  content: event.text,
10410
10430
  id: generateRuntimeEventId(),
10411
10431
  answer_id: streamAnswerId,
10412
- seq: streamChunkSeq++
10432
+ seq
10413
10433
  });
10434
+ streamChunkSeq += 1;
10414
10435
  return;
10415
10436
  case "thought_delta": {
10416
10437
  const delta = thoughtSegmenter.onThoughtDelta(event.text);