@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.
- package/CHANGELOG.md +13 -0
- package/dist/cli.cjs +35 -14
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +35 -14
- package/dist/cli.js.map +1 -1
- package/dist/contracts/agentSpec.d.cts +30 -30
- package/dist/contracts/agentSpec.d.ts +30 -30
- package/dist/contracts/audit.d.cts +24 -24
- package/dist/contracts/audit.d.ts +24 -24
- package/dist/contracts/contextPolicy.d.cts +36 -36
- package/dist/contracts/contextPolicy.d.ts +36 -36
- package/dist/contracts/events.d.cts +1080 -1080
- package/dist/contracts/events.d.ts +1080 -1080
- package/dist/contracts/execution.d.cts +8 -8
- package/dist/contracts/execution.d.ts +8 -8
- package/dist/contracts/messages.d.cts +1178 -1178
- package/dist/contracts/messages.d.ts +1178 -1178
- package/dist/contracts/provider-continuation.d.cts +28 -28
- package/dist/contracts/provider-continuation.d.ts +28 -28
- package/dist/contracts/sse.d.cts +897 -897
- package/dist/contracts/sse.d.ts +897 -897
- package/dist/contracts/sub-run-trace-payload.d.cts +26 -26
- package/dist/contracts/sub-run-trace-payload.d.ts +26 -26
- package/dist/contracts/token-accounting.d.cts +30 -30
- package/dist/contracts/token-accounting.d.ts +30 -30
- package/dist/index.cjs +35 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -14
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +35 -14
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +35 -14
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/events/agentEvents.d.cts +172 -172
- package/dist/runtime-kernel/events/agentEvents.d.ts +172 -172
- package/dist/runtime-kernel.cjs +35 -14
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +35 -14
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +35 -14
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +35 -14
- package/dist/testkit.js.map +1 -1
- package/docs/integration/01-installation.md +1 -1
- package/package.json +4 -4
package/dist/testkit.cjs
CHANGED
|
@@ -6454,16 +6454,21 @@ var GraphAgentExecutor = class {
|
|
|
6454
6454
|
};
|
|
6455
6455
|
|
|
6456
6456
|
// src/runtime-kernel/graph-engine/nodes/llmNode.state.ts
|
|
6457
|
+
function assertLlmNodeStreamChunkSequence(state, answerId, seq) {
|
|
6458
|
+
const answerChanged = state.answerId !== answerId;
|
|
6459
|
+
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6460
|
+
if (seq !== expectedSeq) {
|
|
6461
|
+
throw new Error(
|
|
6462
|
+
`final_answer_chunk sequence mismatch: answer=${answerId}, expected=${expectedSeq}, actual=${seq}`
|
|
6463
|
+
);
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6457
6466
|
function llmNodeReducer(state, action) {
|
|
6458
6467
|
switch (action.type) {
|
|
6459
6468
|
case "STREAM_CHUNK_RECEIVED": {
|
|
6469
|
+
assertLlmNodeStreamChunkSequence(state, action.answerId, action.seq);
|
|
6460
6470
|
const answerChanged = state.answerId !== action.answerId;
|
|
6461
6471
|
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6462
|
-
if (action.seq !== expectedSeq) {
|
|
6463
|
-
throw new Error(
|
|
6464
|
-
`final_answer_chunk sequence mismatch: answer=${action.answerId}, expected=${expectedSeq}, actual=${action.seq}`
|
|
6465
|
-
);
|
|
6466
|
-
}
|
|
6467
6472
|
return {
|
|
6468
6473
|
...state,
|
|
6469
6474
|
answerId: action.answerId,
|
|
@@ -7154,12 +7159,21 @@ var LlmNodeEventBridge = class {
|
|
|
7154
7159
|
throw new Error("final_answer did not map to a final_answer RuntimeEvent.");
|
|
7155
7160
|
}
|
|
7156
7161
|
const liveChunk = createStandaloneFinalAnswerChunk(finalAnswer);
|
|
7162
|
+
assertLlmNodeStreamChunkSequence(
|
|
7163
|
+
this.deps.getState(),
|
|
7164
|
+
liveChunk.answer_id,
|
|
7165
|
+
liveChunk.seq
|
|
7166
|
+
);
|
|
7167
|
+
const publishedChunk = this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone");
|
|
7168
|
+
if (publishedChunk.type !== "final_answer_chunk") {
|
|
7169
|
+
throw new Error("RuntimeEvent sink changed standalone final_answer_chunk type.");
|
|
7170
|
+
}
|
|
7157
7171
|
this.deps.dispatch({
|
|
7158
7172
|
type: "STREAM_CHUNK_RECEIVED",
|
|
7159
|
-
answerId:
|
|
7160
|
-
seq:
|
|
7173
|
+
answerId: publishedChunk.answer_id,
|
|
7174
|
+
seq: publishedChunk.seq
|
|
7161
7175
|
});
|
|
7162
|
-
this.buffer(
|
|
7176
|
+
this.buffer(publishedChunk);
|
|
7163
7177
|
this.buffer(this.publish(finalAnswer, "LlmNode.final_answer"));
|
|
7164
7178
|
}
|
|
7165
7179
|
this.deps.dispatch({ type: "FINAL_ANSWER_RECEIVED" });
|
|
@@ -7183,15 +7197,20 @@ var LlmNodeEventBridge = class {
|
|
|
7183
7197
|
if (!runtimeEvent || runtimeEvent.type !== "final_answer_chunk") {
|
|
7184
7198
|
throw new Error("stream_chunk did not map to final_answer_chunk.");
|
|
7185
7199
|
}
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7200
|
+
assertLlmNodeStreamChunkSequence(
|
|
7201
|
+
this.deps.getState(),
|
|
7202
|
+
runtimeEvent.answer_id,
|
|
7203
|
+
runtimeEvent.seq
|
|
7204
|
+
);
|
|
7191
7205
|
const published = this.publish(runtimeEvent, "LlmNode.final_answer_chunk");
|
|
7192
7206
|
if (published.type !== "final_answer_chunk") {
|
|
7193
7207
|
throw new Error("RuntimeEvent sink changed final_answer_chunk type.");
|
|
7194
7208
|
}
|
|
7209
|
+
this.deps.dispatch({
|
|
7210
|
+
type: "STREAM_CHUNK_RECEIVED",
|
|
7211
|
+
answerId: published.answer_id,
|
|
7212
|
+
seq: published.seq
|
|
7213
|
+
});
|
|
7195
7214
|
this.assembler.push(published);
|
|
7196
7215
|
this.buffer(published);
|
|
7197
7216
|
}
|
|
@@ -11026,14 +11045,16 @@ async function callLlmStream(params) {
|
|
|
11026
11045
|
case "answer_delta":
|
|
11027
11046
|
emitThoughtComplete(thoughtSegmenter.onBoundary());
|
|
11028
11047
|
fullResponse += event.text;
|
|
11048
|
+
const seq = streamChunkSeq;
|
|
11029
11049
|
emit({
|
|
11030
11050
|
type: "stream_chunk",
|
|
11031
11051
|
timestamp: Date.now(),
|
|
11032
11052
|
content: event.text,
|
|
11033
11053
|
id: generateRuntimeEventId(),
|
|
11034
11054
|
answer_id: streamAnswerId,
|
|
11035
|
-
seq
|
|
11055
|
+
seq
|
|
11036
11056
|
});
|
|
11057
|
+
streamChunkSeq += 1;
|
|
11037
11058
|
return;
|
|
11038
11059
|
case "thought_delta": {
|
|
11039
11060
|
const delta = thoughtSegmenter.onThoughtDelta(event.text);
|