@lotics/app-sdk 0.43.0 → 0.44.0
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.
|
@@ -31,6 +31,11 @@ export interface AgentRunStep {
|
|
|
31
31
|
output?: unknown;
|
|
32
32
|
/** The tool failure message, when `status` is `"error"`. */
|
|
33
33
|
errorText?: string;
|
|
34
|
+
/** Running count of streamed argument characters. While a tool call's arguments
|
|
35
|
+
* are still generating, the reducer writes a live size into `detail` ("18 KB")
|
|
36
|
+
* off this accumulator, so a long generation reads as progressing, not frozen;
|
|
37
|
+
* both are cleared when the call settles. */
|
|
38
|
+
streamedChars?: number;
|
|
34
39
|
}
|
|
35
40
|
/** One entry in the ordered run transcript, in the order it streamed: the agent's
|
|
36
41
|
* answer prose (`text`), its thinking (`reasoning` — shown collapsed, revealed on
|
|
@@ -68,6 +73,9 @@ export declare function initialAgentRunState(): AgentRunState;
|
|
|
68
73
|
interface Chunk {
|
|
69
74
|
type?: string;
|
|
70
75
|
delta?: string;
|
|
76
|
+
/** Partial tool-argument text, streamed while a tool call's input is generated
|
|
77
|
+
* (`tool-input-delta`) — distinct from `delta` (answer/thinking prose). */
|
|
78
|
+
inputTextDelta?: string;
|
|
71
79
|
toolName?: string;
|
|
72
80
|
toolCallId?: string;
|
|
73
81
|
input?: unknown;
|
package/dist/src/agent_stream.js
CHANGED
|
@@ -23,6 +23,10 @@ const SUBMIT_TOOL = "submit_result";
|
|
|
23
23
|
export function initialAgentRunState() {
|
|
24
24
|
return { status: "streaming", items: [] };
|
|
25
25
|
}
|
|
26
|
+
/** A live size for a step's still-streaming arguments — B under 1 KB, else KB. */
|
|
27
|
+
function formatStreamSize(chars) {
|
|
28
|
+
return chars < 1024 ? `${chars} B` : `${Math.round(chars / 1024)} KB`;
|
|
29
|
+
}
|
|
26
30
|
/** Grow the trailing prose segment of the given kind, or open a new one (after a
|
|
27
31
|
* tool ran, or when the kind flips text↔reasoning) — so the transcript interleaves
|
|
28
32
|
* answer prose, thinking, and tools in the order they streamed. */
|
|
@@ -73,8 +77,24 @@ export function reduceAgentChunk(state, chunk) {
|
|
|
73
77
|
items: [...state.items, { type: "step", id, label: name, kind: "tool", status: "running", input: chunk.input }],
|
|
74
78
|
};
|
|
75
79
|
}
|
|
80
|
+
case "tool-input-delta": {
|
|
81
|
+
// A tool's arguments streaming in — grow the step's live size so a long
|
|
82
|
+
// generation reads as progressing. `submit_result` created no step (it sets
|
|
83
|
+
// `output`), so its deltas find no matching step and this no-ops.
|
|
84
|
+
const len = (chunk.inputTextDelta ?? "").length;
|
|
85
|
+
if (!len)
|
|
86
|
+
return state;
|
|
87
|
+
return {
|
|
88
|
+
...state,
|
|
89
|
+
items: updateStep(state.items, chunk.toolCallId, (s) => {
|
|
90
|
+
const chars = (s.streamedChars ?? 0) + len;
|
|
91
|
+
return { ...s, streamedChars: chars, detail: formatStreamSize(chars) };
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
76
95
|
case "tool-output-available":
|
|
77
|
-
|
|
96
|
+
// Settled — drop the live streaming size; the row is just label + done.
|
|
97
|
+
return { ...state, items: updateStep(state.items, chunk.toolCallId, (s) => ({ ...s, status: "done", output: chunk.output, detail: undefined, streamedChars: undefined })) };
|
|
78
98
|
case "tool-output-error":
|
|
79
99
|
return { ...state, items: updateStep(state.items, chunk.toolCallId, (s) => ({ ...s, status: "error", errorText: chunk.errorText ?? "The tool failed." })) };
|
|
80
100
|
case "error":
|
package/dist/src/router.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotics/app-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "Runtime SDK for Lotics custom-code apps — typed hooks, postMessage bridge, mount entry point",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/react": "^19.
|
|
42
|
+
"@types/react": "^19.2.17",
|
|
43
43
|
"@types/react-dom": "^19.0.0",
|
|
44
44
|
"react": "^19.2.0",
|
|
45
45
|
"react-dom": "^19.2.0",
|
|
46
|
-
"react-router-dom": "^7.
|
|
46
|
+
"react-router-dom": "^7.18.1"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"lotics",
|
|
@@ -60,4 +60,4 @@
|
|
|
60
60
|
"url": "https://github.com/lotics/lotics.git",
|
|
61
61
|
"directory": "packages/app-sdk"
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|