@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/index.js
CHANGED
|
@@ -7264,16 +7264,21 @@ var GraphAgentExecutor = class {
|
|
|
7264
7264
|
};
|
|
7265
7265
|
|
|
7266
7266
|
// src/runtime-kernel/graph-engine/nodes/llmNode.state.ts
|
|
7267
|
+
function assertLlmNodeStreamChunkSequence(state, answerId, seq) {
|
|
7268
|
+
const answerChanged = state.answerId !== answerId;
|
|
7269
|
+
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
7270
|
+
if (seq !== expectedSeq) {
|
|
7271
|
+
throw new Error(
|
|
7272
|
+
`final_answer_chunk sequence mismatch: answer=${answerId}, expected=${expectedSeq}, actual=${seq}`
|
|
7273
|
+
);
|
|
7274
|
+
}
|
|
7275
|
+
}
|
|
7267
7276
|
function llmNodeReducer(state, action) {
|
|
7268
7277
|
switch (action.type) {
|
|
7269
7278
|
case "STREAM_CHUNK_RECEIVED": {
|
|
7279
|
+
assertLlmNodeStreamChunkSequence(state, action.answerId, action.seq);
|
|
7270
7280
|
const answerChanged = state.answerId !== action.answerId;
|
|
7271
7281
|
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
7272
|
-
if (action.seq !== expectedSeq) {
|
|
7273
|
-
throw new Error(
|
|
7274
|
-
`final_answer_chunk sequence mismatch: answer=${action.answerId}, expected=${expectedSeq}, actual=${action.seq}`
|
|
7275
|
-
);
|
|
7276
|
-
}
|
|
7277
7282
|
return {
|
|
7278
7283
|
...state,
|
|
7279
7284
|
answerId: action.answerId,
|
|
@@ -7964,12 +7969,21 @@ var LlmNodeEventBridge = class {
|
|
|
7964
7969
|
throw new Error("final_answer did not map to a final_answer RuntimeEvent.");
|
|
7965
7970
|
}
|
|
7966
7971
|
const liveChunk = createStandaloneFinalAnswerChunk(finalAnswer);
|
|
7972
|
+
assertLlmNodeStreamChunkSequence(
|
|
7973
|
+
this.deps.getState(),
|
|
7974
|
+
liveChunk.answer_id,
|
|
7975
|
+
liveChunk.seq
|
|
7976
|
+
);
|
|
7977
|
+
const publishedChunk = this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone");
|
|
7978
|
+
if (publishedChunk.type !== "final_answer_chunk") {
|
|
7979
|
+
throw new Error("RuntimeEvent sink changed standalone final_answer_chunk type.");
|
|
7980
|
+
}
|
|
7967
7981
|
this.deps.dispatch({
|
|
7968
7982
|
type: "STREAM_CHUNK_RECEIVED",
|
|
7969
|
-
answerId:
|
|
7970
|
-
seq:
|
|
7983
|
+
answerId: publishedChunk.answer_id,
|
|
7984
|
+
seq: publishedChunk.seq
|
|
7971
7985
|
});
|
|
7972
|
-
this.buffer(
|
|
7986
|
+
this.buffer(publishedChunk);
|
|
7973
7987
|
this.buffer(this.publish(finalAnswer, "LlmNode.final_answer"));
|
|
7974
7988
|
}
|
|
7975
7989
|
this.deps.dispatch({ type: "FINAL_ANSWER_RECEIVED" });
|
|
@@ -7993,15 +8007,20 @@ var LlmNodeEventBridge = class {
|
|
|
7993
8007
|
if (!runtimeEvent || runtimeEvent.type !== "final_answer_chunk") {
|
|
7994
8008
|
throw new Error("stream_chunk did not map to final_answer_chunk.");
|
|
7995
8009
|
}
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8010
|
+
assertLlmNodeStreamChunkSequence(
|
|
8011
|
+
this.deps.getState(),
|
|
8012
|
+
runtimeEvent.answer_id,
|
|
8013
|
+
runtimeEvent.seq
|
|
8014
|
+
);
|
|
8001
8015
|
const published = this.publish(runtimeEvent, "LlmNode.final_answer_chunk");
|
|
8002
8016
|
if (published.type !== "final_answer_chunk") {
|
|
8003
8017
|
throw new Error("RuntimeEvent sink changed final_answer_chunk type.");
|
|
8004
8018
|
}
|
|
8019
|
+
this.deps.dispatch({
|
|
8020
|
+
type: "STREAM_CHUNK_RECEIVED",
|
|
8021
|
+
answerId: published.answer_id,
|
|
8022
|
+
seq: published.seq
|
|
8023
|
+
});
|
|
8005
8024
|
this.assembler.push(published);
|
|
8006
8025
|
this.buffer(published);
|
|
8007
8026
|
}
|
|
@@ -11843,14 +11862,16 @@ async function callLlmStream(params) {
|
|
|
11843
11862
|
case "answer_delta":
|
|
11844
11863
|
emitThoughtComplete(thoughtSegmenter.onBoundary());
|
|
11845
11864
|
fullResponse += event.text;
|
|
11865
|
+
const seq = streamChunkSeq;
|
|
11846
11866
|
emit({
|
|
11847
11867
|
type: "stream_chunk",
|
|
11848
11868
|
timestamp: Date.now(),
|
|
11849
11869
|
content: event.text,
|
|
11850
11870
|
id: generateRuntimeEventId(),
|
|
11851
11871
|
answer_id: streamAnswerId,
|
|
11852
|
-
seq
|
|
11872
|
+
seq
|
|
11853
11873
|
});
|
|
11874
|
+
streamChunkSeq += 1;
|
|
11854
11875
|
return;
|
|
11855
11876
|
case "thought_delta": {
|
|
11856
11877
|
const delta = thoughtSegmenter.onThoughtDelta(event.text);
|