@poncho-ai/sdk 1.14.0 → 1.15.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.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +27 -0
- package/dist/index.d.ts +30 -0
- package/package.json +1 -1
- package/src/index.ts +31 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/sdk@1.
|
|
2
|
+
> @poncho-ai/sdk@1.15.0 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
|
|
3
3
|
> tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[32mESM[39m [1mdist/index.js [22m[32m17.24 KB[39m
|
|
11
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 19ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
14
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1324ms
|
|
14
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m31.27 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @poncho-ai/sdk
|
|
2
2
|
|
|
3
|
+
## 1.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#145](https://github.com/cesr/poncho-ai/pull/145) [`bfa4976`](https://github.com/cesr/poncho-ai/commit/bfa4976ac8b05a300e22271e23c3bae4aadae2a8) Thanks [@cesr](https://github.com/cesr)! - events: add stable identity so streaming clients match instead of guess
|
|
8
|
+
|
|
9
|
+
Additive fields that let a streaming client reconstruct view-state by
|
|
10
|
+
identity rather than inferring structure from event order (the source of a
|
|
11
|
+
class of reconnect/subagent rendering bugs):
|
|
12
|
+
- `tool:started` / `tool:completed` / `tool:error` now carry `toolCallId`
|
|
13
|
+
(already in scope as `call.id` / `result.callId`). Clients match tool
|
|
14
|
+
pills by id instead of by tool name.
|
|
15
|
+
- `subagent:spawned|completed|error|stopped` now carry `parentToolCallId`
|
|
16
|
+
(the `spawn_subagent` tool call's id) and `task`; `completed`/`error`
|
|
17
|
+
also carry `resultText`. Clients attach subagent state to the spawning
|
|
18
|
+
tool's pill and render the result inline — no header-regex or
|
|
19
|
+
sequential-cursor pairing needed.
|
|
20
|
+
- `ToolContext` gains `toolCallId` so the `spawn_subagent` handler can
|
|
21
|
+
record which call produced the subagent (plumbed: tool-dispatcher →
|
|
22
|
+
spawn handler → `SubagentSpawnOptions.parentToolCallId` →
|
|
23
|
+
`subagentMeta.parentToolCallId` → the events above).
|
|
24
|
+
- `run:started` gains an optional `cause` field in the type
|
|
25
|
+
(`user|continuation|subagent_callback|approval_resume`); emission is
|
|
26
|
+
deferred to a later pass.
|
|
27
|
+
|
|
28
|
+
All fields are additive; older clients ignore them.
|
|
29
|
+
|
|
3
30
|
## 1.14.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -713,6 +713,11 @@ interface ToolContext {
|
|
|
713
713
|
parameters: Record<string, unknown>;
|
|
714
714
|
abortSignal?: AbortSignal;
|
|
715
715
|
conversationId?: string;
|
|
716
|
+
/** The id of the tool call currently executing. Lets a tool that spawns
|
|
717
|
+
* further work (spawn_subagent) record which call produced it, so the
|
|
718
|
+
* resulting subagent events can carry `parentToolCallId` and the client
|
|
719
|
+
* can attach subagent state to the spawning tool's pill. */
|
|
720
|
+
toolCallId?: string;
|
|
716
721
|
/** The tenant ID when running in multi-tenant mode. */
|
|
717
722
|
tenantId?: string;
|
|
718
723
|
/** Telemetry is suppressed for this run (e.g. an incognito turn). Tools
|
|
@@ -802,6 +807,19 @@ type AgentEvent = {
|
|
|
802
807
|
runId: string;
|
|
803
808
|
agentId: string;
|
|
804
809
|
contextWindow?: number;
|
|
810
|
+
/**
|
|
811
|
+
* Why this run began. Lets a streaming client render the run
|
|
812
|
+
* deterministically instead of inferring from event order:
|
|
813
|
+
* - "user": a fresh user-message turn.
|
|
814
|
+
* - "continuation": the harness continued a long turn past a
|
|
815
|
+
* checkpoint (same logical turn).
|
|
816
|
+
* - "subagent_callback": a turn injecting a finished subagent's
|
|
817
|
+
* result back into the parent.
|
|
818
|
+
* - "approval_resume": resuming after a tool-approval decision
|
|
819
|
+
* (continues the existing assistant turn).
|
|
820
|
+
* Absent on older harness versions.
|
|
821
|
+
*/
|
|
822
|
+
cause?: "user" | "continuation" | "subagent_callback" | "approval_resume";
|
|
805
823
|
} | {
|
|
806
824
|
type: "run:completed";
|
|
807
825
|
runId: string;
|
|
@@ -838,10 +856,12 @@ type AgentEvent = {
|
|
|
838
856
|
} | {
|
|
839
857
|
type: "tool:started";
|
|
840
858
|
tool: string;
|
|
859
|
+
toolCallId: string;
|
|
841
860
|
input: unknown;
|
|
842
861
|
} | {
|
|
843
862
|
type: "tool:completed";
|
|
844
863
|
tool: string;
|
|
864
|
+
toolCallId: string;
|
|
845
865
|
input?: unknown;
|
|
846
866
|
output: unknown;
|
|
847
867
|
duration: number;
|
|
@@ -849,6 +869,7 @@ type AgentEvent = {
|
|
|
849
869
|
} | {
|
|
850
870
|
type: "tool:error";
|
|
851
871
|
tool: string;
|
|
872
|
+
toolCallId: string;
|
|
852
873
|
error: string;
|
|
853
874
|
recoverable: boolean;
|
|
854
875
|
} | {
|
|
@@ -918,19 +939,28 @@ type AgentEvent = {
|
|
|
918
939
|
subagentId: string;
|
|
919
940
|
conversationId: string;
|
|
920
941
|
task: string;
|
|
942
|
+
parentToolCallId?: string;
|
|
921
943
|
} | {
|
|
922
944
|
type: "subagent:completed";
|
|
923
945
|
subagentId: string;
|
|
924
946
|
conversationId: string;
|
|
947
|
+
task?: string;
|
|
948
|
+
parentToolCallId?: string;
|
|
949
|
+
resultText?: string;
|
|
925
950
|
} | {
|
|
926
951
|
type: "subagent:error";
|
|
927
952
|
subagentId: string;
|
|
928
953
|
conversationId: string;
|
|
929
954
|
error: string;
|
|
955
|
+
task?: string;
|
|
956
|
+
parentToolCallId?: string;
|
|
957
|
+
resultText?: string;
|
|
930
958
|
} | {
|
|
931
959
|
type: "subagent:stopped";
|
|
932
960
|
subagentId: string;
|
|
933
961
|
conversationId: string;
|
|
962
|
+
task?: string;
|
|
963
|
+
parentToolCallId?: string;
|
|
934
964
|
} | {
|
|
935
965
|
type: "subagent:approval_needed";
|
|
936
966
|
subagentId: string;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -76,6 +76,11 @@ export interface ToolContext {
|
|
|
76
76
|
parameters: Record<string, unknown>;
|
|
77
77
|
abortSignal?: AbortSignal;
|
|
78
78
|
conversationId?: string;
|
|
79
|
+
/** The id of the tool call currently executing. Lets a tool that spawns
|
|
80
|
+
* further work (spawn_subagent) record which call produced it, so the
|
|
81
|
+
* resulting subagent events can carry `parentToolCallId` and the client
|
|
82
|
+
* can attach subagent state to the spawning tool's pill. */
|
|
83
|
+
toolCallId?: string;
|
|
79
84
|
/** The tenant ID when running in multi-tenant mode. */
|
|
80
85
|
tenantId?: string;
|
|
81
86
|
/** Telemetry is suppressed for this run (e.g. an incognito turn). Tools
|
|
@@ -183,7 +188,25 @@ export interface AgentFailure {
|
|
|
183
188
|
}
|
|
184
189
|
|
|
185
190
|
export type AgentEvent =
|
|
186
|
-
| {
|
|
191
|
+
| {
|
|
192
|
+
type: "run:started";
|
|
193
|
+
runId: string;
|
|
194
|
+
agentId: string;
|
|
195
|
+
contextWindow?: number;
|
|
196
|
+
/**
|
|
197
|
+
* Why this run began. Lets a streaming client render the run
|
|
198
|
+
* deterministically instead of inferring from event order:
|
|
199
|
+
* - "user": a fresh user-message turn.
|
|
200
|
+
* - "continuation": the harness continued a long turn past a
|
|
201
|
+
* checkpoint (same logical turn).
|
|
202
|
+
* - "subagent_callback": a turn injecting a finished subagent's
|
|
203
|
+
* result back into the parent.
|
|
204
|
+
* - "approval_resume": resuming after a tool-approval decision
|
|
205
|
+
* (continues the existing assistant turn).
|
|
206
|
+
* Absent on older harness versions.
|
|
207
|
+
*/
|
|
208
|
+
cause?: "user" | "continuation" | "subagent_callback" | "approval_resume";
|
|
209
|
+
}
|
|
187
210
|
| { type: "run:completed"; runId: string; result: RunResult; pendingSubagents?: boolean }
|
|
188
211
|
| { type: "run:cancelled"; runId: string; messages?: Message[] }
|
|
189
212
|
| { type: "run:error"; runId: string; error: AgentFailure }
|
|
@@ -193,9 +216,9 @@ export type AgentEvent =
|
|
|
193
216
|
| { type: "model:chunk"; content: string }
|
|
194
217
|
| { type: "model:response"; usage: TokenUsage }
|
|
195
218
|
| { type: "tool:generating"; tool: string; toolCallId: string }
|
|
196
|
-
| { type: "tool:started"; tool: string; input: unknown }
|
|
197
|
-
| { type: "tool:completed"; tool: string; input?: unknown; output: unknown; duration: number; outputTokenEstimate?: number }
|
|
198
|
-
| { type: "tool:error"; tool: string; error: string; recoverable: boolean }
|
|
219
|
+
| { type: "tool:started"; tool: string; toolCallId: string; input: unknown }
|
|
220
|
+
| { type: "tool:completed"; tool: string; toolCallId: string; input?: unknown; output: unknown; duration: number; outputTokenEstimate?: number }
|
|
221
|
+
| { type: "tool:error"; tool: string; toolCallId: string; error: string; recoverable: boolean }
|
|
199
222
|
| {
|
|
200
223
|
type: "tool:approval:required";
|
|
201
224
|
tool: string;
|
|
@@ -246,10 +269,10 @@ export type AgentEvent =
|
|
|
246
269
|
url?: string;
|
|
247
270
|
interactionAllowed: boolean;
|
|
248
271
|
}
|
|
249
|
-
| { type: "subagent:spawned"; subagentId: string; conversationId: string; task: string }
|
|
250
|
-
| { type: "subagent:completed"; subagentId: string; conversationId: string }
|
|
251
|
-
| { type: "subagent:error"; subagentId: string; conversationId: string; error: string }
|
|
252
|
-
| { type: "subagent:stopped"; subagentId: string; conversationId: string }
|
|
272
|
+
| { type: "subagent:spawned"; subagentId: string; conversationId: string; task: string; parentToolCallId?: string }
|
|
273
|
+
| { type: "subagent:completed"; subagentId: string; conversationId: string; task?: string; parentToolCallId?: string; resultText?: string }
|
|
274
|
+
| { type: "subagent:error"; subagentId: string; conversationId: string; error: string; task?: string; parentToolCallId?: string; resultText?: string }
|
|
275
|
+
| { type: "subagent:stopped"; subagentId: string; conversationId: string; task?: string; parentToolCallId?: string }
|
|
253
276
|
| {
|
|
254
277
|
type: "subagent:approval_needed";
|
|
255
278
|
subagentId: string;
|