@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/cli.js
CHANGED
|
@@ -6145,16 +6145,21 @@ var GraphAgentExecutor = class {
|
|
|
6145
6145
|
};
|
|
6146
6146
|
|
|
6147
6147
|
// src/runtime-kernel/graph-engine/nodes/llmNode.state.ts
|
|
6148
|
+
function assertLlmNodeStreamChunkSequence(state, answerId, seq) {
|
|
6149
|
+
const answerChanged = state.answerId !== answerId;
|
|
6150
|
+
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6151
|
+
if (seq !== expectedSeq) {
|
|
6152
|
+
throw new Error(
|
|
6153
|
+
`final_answer_chunk sequence mismatch: answer=${answerId}, expected=${expectedSeq}, actual=${seq}`
|
|
6154
|
+
);
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6148
6157
|
function llmNodeReducer(state, action) {
|
|
6149
6158
|
switch (action.type) {
|
|
6150
6159
|
case "STREAM_CHUNK_RECEIVED": {
|
|
6160
|
+
assertLlmNodeStreamChunkSequence(state, action.answerId, action.seq);
|
|
6151
6161
|
const answerChanged = state.answerId !== action.answerId;
|
|
6152
6162
|
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6153
|
-
if (action.seq !== expectedSeq) {
|
|
6154
|
-
throw new Error(
|
|
6155
|
-
`final_answer_chunk sequence mismatch: answer=${action.answerId}, expected=${expectedSeq}, actual=${action.seq}`
|
|
6156
|
-
);
|
|
6157
|
-
}
|
|
6158
6163
|
return {
|
|
6159
6164
|
...state,
|
|
6160
6165
|
answerId: action.answerId,
|
|
@@ -6845,12 +6850,21 @@ var LlmNodeEventBridge = class {
|
|
|
6845
6850
|
throw new Error("final_answer did not map to a final_answer RuntimeEvent.");
|
|
6846
6851
|
}
|
|
6847
6852
|
const liveChunk = createStandaloneFinalAnswerChunk(finalAnswer);
|
|
6853
|
+
assertLlmNodeStreamChunkSequence(
|
|
6854
|
+
this.deps.getState(),
|
|
6855
|
+
liveChunk.answer_id,
|
|
6856
|
+
liveChunk.seq
|
|
6857
|
+
);
|
|
6858
|
+
const publishedChunk = this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone");
|
|
6859
|
+
if (publishedChunk.type !== "final_answer_chunk") {
|
|
6860
|
+
throw new Error("RuntimeEvent sink changed standalone final_answer_chunk type.");
|
|
6861
|
+
}
|
|
6848
6862
|
this.deps.dispatch({
|
|
6849
6863
|
type: "STREAM_CHUNK_RECEIVED",
|
|
6850
|
-
answerId:
|
|
6851
|
-
seq:
|
|
6864
|
+
answerId: publishedChunk.answer_id,
|
|
6865
|
+
seq: publishedChunk.seq
|
|
6852
6866
|
});
|
|
6853
|
-
this.buffer(
|
|
6867
|
+
this.buffer(publishedChunk);
|
|
6854
6868
|
this.buffer(this.publish(finalAnswer, "LlmNode.final_answer"));
|
|
6855
6869
|
}
|
|
6856
6870
|
this.deps.dispatch({ type: "FINAL_ANSWER_RECEIVED" });
|
|
@@ -6874,15 +6888,20 @@ var LlmNodeEventBridge = class {
|
|
|
6874
6888
|
if (!runtimeEvent || runtimeEvent.type !== "final_answer_chunk") {
|
|
6875
6889
|
throw new Error("stream_chunk did not map to final_answer_chunk.");
|
|
6876
6890
|
}
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6891
|
+
assertLlmNodeStreamChunkSequence(
|
|
6892
|
+
this.deps.getState(),
|
|
6893
|
+
runtimeEvent.answer_id,
|
|
6894
|
+
runtimeEvent.seq
|
|
6895
|
+
);
|
|
6882
6896
|
const published = this.publish(runtimeEvent, "LlmNode.final_answer_chunk");
|
|
6883
6897
|
if (published.type !== "final_answer_chunk") {
|
|
6884
6898
|
throw new Error("RuntimeEvent sink changed final_answer_chunk type.");
|
|
6885
6899
|
}
|
|
6900
|
+
this.deps.dispatch({
|
|
6901
|
+
type: "STREAM_CHUNK_RECEIVED",
|
|
6902
|
+
answerId: published.answer_id,
|
|
6903
|
+
seq: published.seq
|
|
6904
|
+
});
|
|
6886
6905
|
this.assembler.push(published);
|
|
6887
6906
|
this.buffer(published);
|
|
6888
6907
|
}
|
|
@@ -10400,14 +10419,16 @@ async function callLlmStream(params) {
|
|
|
10400
10419
|
case "answer_delta":
|
|
10401
10420
|
emitThoughtComplete(thoughtSegmenter.onBoundary());
|
|
10402
10421
|
fullResponse += event.text;
|
|
10422
|
+
const seq = streamChunkSeq;
|
|
10403
10423
|
emit({
|
|
10404
10424
|
type: "stream_chunk",
|
|
10405
10425
|
timestamp: Date.now(),
|
|
10406
10426
|
content: event.text,
|
|
10407
10427
|
id: generateRuntimeEventId(),
|
|
10408
10428
|
answer_id: streamAnswerId,
|
|
10409
|
-
seq
|
|
10429
|
+
seq
|
|
10410
10430
|
});
|
|
10431
|
+
streamChunkSeq += 1;
|
|
10411
10432
|
return;
|
|
10412
10433
|
case "thought_delta": {
|
|
10413
10434
|
const delta = thoughtSegmenter.onThoughtDelta(event.text);
|