@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/quickstart.js
CHANGED
|
@@ -6259,16 +6259,21 @@ var GraphAgentExecutor = class {
|
|
|
6259
6259
|
};
|
|
6260
6260
|
|
|
6261
6261
|
// src/runtime-kernel/graph-engine/nodes/llmNode.state.ts
|
|
6262
|
+
function assertLlmNodeStreamChunkSequence(state, answerId, seq) {
|
|
6263
|
+
const answerChanged = state.answerId !== answerId;
|
|
6264
|
+
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6265
|
+
if (seq !== expectedSeq) {
|
|
6266
|
+
throw new Error(
|
|
6267
|
+
`final_answer_chunk sequence mismatch: answer=${answerId}, expected=${expectedSeq}, actual=${seq}`
|
|
6268
|
+
);
|
|
6269
|
+
}
|
|
6270
|
+
}
|
|
6262
6271
|
function llmNodeReducer(state, action) {
|
|
6263
6272
|
switch (action.type) {
|
|
6264
6273
|
case "STREAM_CHUNK_RECEIVED": {
|
|
6274
|
+
assertLlmNodeStreamChunkSequence(state, action.answerId, action.seq);
|
|
6265
6275
|
const answerChanged = state.answerId !== action.answerId;
|
|
6266
6276
|
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6267
|
-
if (action.seq !== expectedSeq) {
|
|
6268
|
-
throw new Error(
|
|
6269
|
-
`final_answer_chunk sequence mismatch: answer=${action.answerId}, expected=${expectedSeq}, actual=${action.seq}`
|
|
6270
|
-
);
|
|
6271
|
-
}
|
|
6272
6277
|
return {
|
|
6273
6278
|
...state,
|
|
6274
6279
|
answerId: action.answerId,
|
|
@@ -6959,12 +6964,21 @@ var LlmNodeEventBridge = class {
|
|
|
6959
6964
|
throw new Error("final_answer did not map to a final_answer RuntimeEvent.");
|
|
6960
6965
|
}
|
|
6961
6966
|
const liveChunk = createStandaloneFinalAnswerChunk(finalAnswer);
|
|
6967
|
+
assertLlmNodeStreamChunkSequence(
|
|
6968
|
+
this.deps.getState(),
|
|
6969
|
+
liveChunk.answer_id,
|
|
6970
|
+
liveChunk.seq
|
|
6971
|
+
);
|
|
6972
|
+
const publishedChunk = this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone");
|
|
6973
|
+
if (publishedChunk.type !== "final_answer_chunk") {
|
|
6974
|
+
throw new Error("RuntimeEvent sink changed standalone final_answer_chunk type.");
|
|
6975
|
+
}
|
|
6962
6976
|
this.deps.dispatch({
|
|
6963
6977
|
type: "STREAM_CHUNK_RECEIVED",
|
|
6964
|
-
answerId:
|
|
6965
|
-
seq:
|
|
6978
|
+
answerId: publishedChunk.answer_id,
|
|
6979
|
+
seq: publishedChunk.seq
|
|
6966
6980
|
});
|
|
6967
|
-
this.buffer(
|
|
6981
|
+
this.buffer(publishedChunk);
|
|
6968
6982
|
this.buffer(this.publish(finalAnswer, "LlmNode.final_answer"));
|
|
6969
6983
|
}
|
|
6970
6984
|
this.deps.dispatch({ type: "FINAL_ANSWER_RECEIVED" });
|
|
@@ -6988,15 +7002,20 @@ var LlmNodeEventBridge = class {
|
|
|
6988
7002
|
if (!runtimeEvent || runtimeEvent.type !== "final_answer_chunk") {
|
|
6989
7003
|
throw new Error("stream_chunk did not map to final_answer_chunk.");
|
|
6990
7004
|
}
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
7005
|
+
assertLlmNodeStreamChunkSequence(
|
|
7006
|
+
this.deps.getState(),
|
|
7007
|
+
runtimeEvent.answer_id,
|
|
7008
|
+
runtimeEvent.seq
|
|
7009
|
+
);
|
|
6996
7010
|
const published = this.publish(runtimeEvent, "LlmNode.final_answer_chunk");
|
|
6997
7011
|
if (published.type !== "final_answer_chunk") {
|
|
6998
7012
|
throw new Error("RuntimeEvent sink changed final_answer_chunk type.");
|
|
6999
7013
|
}
|
|
7014
|
+
this.deps.dispatch({
|
|
7015
|
+
type: "STREAM_CHUNK_RECEIVED",
|
|
7016
|
+
answerId: published.answer_id,
|
|
7017
|
+
seq: published.seq
|
|
7018
|
+
});
|
|
7000
7019
|
this.assembler.push(published);
|
|
7001
7020
|
this.buffer(published);
|
|
7002
7021
|
}
|
|
@@ -10514,14 +10533,16 @@ async function callLlmStream(params) {
|
|
|
10514
10533
|
case "answer_delta":
|
|
10515
10534
|
emitThoughtComplete(thoughtSegmenter.onBoundary());
|
|
10516
10535
|
fullResponse += event.text;
|
|
10536
|
+
const seq = streamChunkSeq;
|
|
10517
10537
|
emit({
|
|
10518
10538
|
type: "stream_chunk",
|
|
10519
10539
|
timestamp: Date.now(),
|
|
10520
10540
|
content: event.text,
|
|
10521
10541
|
id: generateRuntimeEventId(),
|
|
10522
10542
|
answer_id: streamAnswerId,
|
|
10523
|
-
seq
|
|
10543
|
+
seq
|
|
10524
10544
|
});
|
|
10545
|
+
streamChunkSeq += 1;
|
|
10525
10546
|
return;
|
|
10526
10547
|
case "thought_delta": {
|
|
10527
10548
|
const delta = thoughtSegmenter.onThoughtDelta(event.text);
|