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