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