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