@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/runtime-kernel.js
CHANGED
|
@@ -6268,16 +6268,21 @@ var GraphAgentExecutor = class {
|
|
|
6268
6268
|
};
|
|
6269
6269
|
|
|
6270
6270
|
// src/runtime-kernel/graph-engine/nodes/llmNode.state.ts
|
|
6271
|
+
function assertLlmNodeStreamChunkSequence(state, answerId, seq) {
|
|
6272
|
+
const answerChanged = state.answerId !== answerId;
|
|
6273
|
+
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6274
|
+
if (seq !== expectedSeq) {
|
|
6275
|
+
throw new Error(
|
|
6276
|
+
`final_answer_chunk sequence mismatch: answer=${answerId}, expected=${expectedSeq}, actual=${seq}`
|
|
6277
|
+
);
|
|
6278
|
+
}
|
|
6279
|
+
}
|
|
6271
6280
|
function llmNodeReducer(state, action) {
|
|
6272
6281
|
switch (action.type) {
|
|
6273
6282
|
case "STREAM_CHUNK_RECEIVED": {
|
|
6283
|
+
assertLlmNodeStreamChunkSequence(state, action.answerId, action.seq);
|
|
6274
6284
|
const answerChanged = state.answerId !== action.answerId;
|
|
6275
6285
|
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6276
|
-
if (action.seq !== expectedSeq) {
|
|
6277
|
-
throw new Error(
|
|
6278
|
-
`final_answer_chunk sequence mismatch: answer=${action.answerId}, expected=${expectedSeq}, actual=${action.seq}`
|
|
6279
|
-
);
|
|
6280
|
-
}
|
|
6281
6286
|
return {
|
|
6282
6287
|
...state,
|
|
6283
6288
|
answerId: action.answerId,
|
|
@@ -6968,12 +6973,21 @@ var LlmNodeEventBridge = class {
|
|
|
6968
6973
|
throw new Error("final_answer did not map to a final_answer RuntimeEvent.");
|
|
6969
6974
|
}
|
|
6970
6975
|
const liveChunk = createStandaloneFinalAnswerChunk(finalAnswer);
|
|
6976
|
+
assertLlmNodeStreamChunkSequence(
|
|
6977
|
+
this.deps.getState(),
|
|
6978
|
+
liveChunk.answer_id,
|
|
6979
|
+
liveChunk.seq
|
|
6980
|
+
);
|
|
6981
|
+
const publishedChunk = this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone");
|
|
6982
|
+
if (publishedChunk.type !== "final_answer_chunk") {
|
|
6983
|
+
throw new Error("RuntimeEvent sink changed standalone final_answer_chunk type.");
|
|
6984
|
+
}
|
|
6971
6985
|
this.deps.dispatch({
|
|
6972
6986
|
type: "STREAM_CHUNK_RECEIVED",
|
|
6973
|
-
answerId:
|
|
6974
|
-
seq:
|
|
6987
|
+
answerId: publishedChunk.answer_id,
|
|
6988
|
+
seq: publishedChunk.seq
|
|
6975
6989
|
});
|
|
6976
|
-
this.buffer(
|
|
6990
|
+
this.buffer(publishedChunk);
|
|
6977
6991
|
this.buffer(this.publish(finalAnswer, "LlmNode.final_answer"));
|
|
6978
6992
|
}
|
|
6979
6993
|
this.deps.dispatch({ type: "FINAL_ANSWER_RECEIVED" });
|
|
@@ -6997,15 +7011,20 @@ var LlmNodeEventBridge = class {
|
|
|
6997
7011
|
if (!runtimeEvent || runtimeEvent.type !== "final_answer_chunk") {
|
|
6998
7012
|
throw new Error("stream_chunk did not map to final_answer_chunk.");
|
|
6999
7013
|
}
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7014
|
+
assertLlmNodeStreamChunkSequence(
|
|
7015
|
+
this.deps.getState(),
|
|
7016
|
+
runtimeEvent.answer_id,
|
|
7017
|
+
runtimeEvent.seq
|
|
7018
|
+
);
|
|
7005
7019
|
const published = this.publish(runtimeEvent, "LlmNode.final_answer_chunk");
|
|
7006
7020
|
if (published.type !== "final_answer_chunk") {
|
|
7007
7021
|
throw new Error("RuntimeEvent sink changed final_answer_chunk type.");
|
|
7008
7022
|
}
|
|
7023
|
+
this.deps.dispatch({
|
|
7024
|
+
type: "STREAM_CHUNK_RECEIVED",
|
|
7025
|
+
answerId: published.answer_id,
|
|
7026
|
+
seq: published.seq
|
|
7027
|
+
});
|
|
7009
7028
|
this.assembler.push(published);
|
|
7010
7029
|
this.buffer(published);
|
|
7011
7030
|
}
|
|
@@ -10840,14 +10859,16 @@ async function callLlmStream(params) {
|
|
|
10840
10859
|
case "answer_delta":
|
|
10841
10860
|
emitThoughtComplete(thoughtSegmenter.onBoundary());
|
|
10842
10861
|
fullResponse += event.text;
|
|
10862
|
+
const seq = streamChunkSeq;
|
|
10843
10863
|
emit({
|
|
10844
10864
|
type: "stream_chunk",
|
|
10845
10865
|
timestamp: Date.now(),
|
|
10846
10866
|
content: event.text,
|
|
10847
10867
|
id: generateRuntimeEventId(),
|
|
10848
10868
|
answer_id: streamAnswerId,
|
|
10849
|
-
seq
|
|
10869
|
+
seq
|
|
10850
10870
|
});
|
|
10871
|
+
streamChunkSeq += 1;
|
|
10851
10872
|
return;
|
|
10852
10873
|
case "thought_delta": {
|
|
10853
10874
|
const delta = thoughtSegmenter.onThoughtDelta(event.text);
|