@poncho-ai/sdk 1.14.0 → 1.15.1
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 +44 -0
- package/dist/index.d.ts +38 -0
- package/package.json +1 -1
- package/src/index.ts +39 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/sdk@1.
|
|
2
|
+
> @poncho-ai/sdk@1.15.1 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 18ms
|
|
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.79 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @poncho-ai/sdk
|
|
2
2
|
|
|
3
|
+
## 1.15.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`299f574`](https://github.com/cesr/poncho-ai/commit/299f574a2f2f0d4873f42bbcffdf604e9cc4c29c) Thanks [@cesr](https://github.com/cesr)! - Mark in-flight assistant drafts with `metadata.incomplete = true`.
|
|
8
|
+
|
|
9
|
+
The orchestrator's per-step draft persist (`persistDraft`) and the
|
|
10
|
+
approval/device checkpoint and continuation writes now stamp the trailing
|
|
11
|
+
assistant message `metadata.incomplete = true`; the three terminal writes
|
|
12
|
+
(normal finalize, cancelled, errored) clear it. This lets a consumer that
|
|
13
|
+
reconciles a persisted snapshot against a live event stream (e.g. a
|
|
14
|
+
WebSocket layer) strip the in-flight draft from the authoritative snapshot
|
|
15
|
+
and rebuild that turn from the event log instead — so the snapshot and the
|
|
16
|
+
replayed events never both carry the in-flight turn, eliminating
|
|
17
|
+
reconnect-time duplication. Additive + backwards-compatible: consumers that
|
|
18
|
+
ignore the flag are unaffected.
|
|
19
|
+
|
|
20
|
+
## 1.15.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- [#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
|
|
25
|
+
|
|
26
|
+
Additive fields that let a streaming client reconstruct view-state by
|
|
27
|
+
identity rather than inferring structure from event order (the source of a
|
|
28
|
+
class of reconnect/subagent rendering bugs):
|
|
29
|
+
- `tool:started` / `tool:completed` / `tool:error` now carry `toolCallId`
|
|
30
|
+
(already in scope as `call.id` / `result.callId`). Clients match tool
|
|
31
|
+
pills by id instead of by tool name.
|
|
32
|
+
- `subagent:spawned|completed|error|stopped` now carry `parentToolCallId`
|
|
33
|
+
(the `spawn_subagent` tool call's id) and `task`; `completed`/`error`
|
|
34
|
+
also carry `resultText`. Clients attach subagent state to the spawning
|
|
35
|
+
tool's pill and render the result inline — no header-regex or
|
|
36
|
+
sequential-cursor pairing needed.
|
|
37
|
+
- `ToolContext` gains `toolCallId` so the `spawn_subagent` handler can
|
|
38
|
+
record which call produced the subagent (plumbed: tool-dispatcher →
|
|
39
|
+
spawn handler → `SubagentSpawnOptions.parentToolCallId` →
|
|
40
|
+
`subagentMeta.parentToolCallId` → the events above).
|
|
41
|
+
- `run:started` gains an optional `cause` field in the type
|
|
42
|
+
(`user|continuation|subagent_callback|approval_resume`); emission is
|
|
43
|
+
deferred to a later pass.
|
|
44
|
+
|
|
45
|
+
All fields are additive; older clients ignore them.
|
|
46
|
+
|
|
3
47
|
## 1.14.0
|
|
4
48
|
|
|
5
49
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -680,6 +680,14 @@ interface Message {
|
|
|
680
680
|
content: string | string[];
|
|
681
681
|
}>;
|
|
682
682
|
isCompactionSummary?: boolean;
|
|
683
|
+
/** True while this assistant message is an in-flight DRAFT (the turn
|
|
684
|
+
* hasn't finished). Set by the orchestrator's per-step draft persist and
|
|
685
|
+
* cleared at finalize. Consumers that reconcile a persisted snapshot with
|
|
686
|
+
* a live event stream (e.g. PonchOS's WS layer) strip `incomplete`
|
|
687
|
+
* messages from the snapshot and rebuild the in-flight turn from the
|
|
688
|
+
* event log instead — so the two never both carry it (no reconnect
|
|
689
|
+
* duplication). */
|
|
690
|
+
incomplete?: boolean;
|
|
683
691
|
};
|
|
684
692
|
}
|
|
685
693
|
/** Extract the text content from a message, regardless of content format. */
|
|
@@ -713,6 +721,11 @@ interface ToolContext {
|
|
|
713
721
|
parameters: Record<string, unknown>;
|
|
714
722
|
abortSignal?: AbortSignal;
|
|
715
723
|
conversationId?: string;
|
|
724
|
+
/** The id of the tool call currently executing. Lets a tool that spawns
|
|
725
|
+
* further work (spawn_subagent) record which call produced it, so the
|
|
726
|
+
* resulting subagent events can carry `parentToolCallId` and the client
|
|
727
|
+
* can attach subagent state to the spawning tool's pill. */
|
|
728
|
+
toolCallId?: string;
|
|
716
729
|
/** The tenant ID when running in multi-tenant mode. */
|
|
717
730
|
tenantId?: string;
|
|
718
731
|
/** Telemetry is suppressed for this run (e.g. an incognito turn). Tools
|
|
@@ -802,6 +815,19 @@ type AgentEvent = {
|
|
|
802
815
|
runId: string;
|
|
803
816
|
agentId: string;
|
|
804
817
|
contextWindow?: number;
|
|
818
|
+
/**
|
|
819
|
+
* Why this run began. Lets a streaming client render the run
|
|
820
|
+
* deterministically instead of inferring from event order:
|
|
821
|
+
* - "user": a fresh user-message turn.
|
|
822
|
+
* - "continuation": the harness continued a long turn past a
|
|
823
|
+
* checkpoint (same logical turn).
|
|
824
|
+
* - "subagent_callback": a turn injecting a finished subagent's
|
|
825
|
+
* result back into the parent.
|
|
826
|
+
* - "approval_resume": resuming after a tool-approval decision
|
|
827
|
+
* (continues the existing assistant turn).
|
|
828
|
+
* Absent on older harness versions.
|
|
829
|
+
*/
|
|
830
|
+
cause?: "user" | "continuation" | "subagent_callback" | "approval_resume";
|
|
805
831
|
} | {
|
|
806
832
|
type: "run:completed";
|
|
807
833
|
runId: string;
|
|
@@ -838,10 +864,12 @@ type AgentEvent = {
|
|
|
838
864
|
} | {
|
|
839
865
|
type: "tool:started";
|
|
840
866
|
tool: string;
|
|
867
|
+
toolCallId: string;
|
|
841
868
|
input: unknown;
|
|
842
869
|
} | {
|
|
843
870
|
type: "tool:completed";
|
|
844
871
|
tool: string;
|
|
872
|
+
toolCallId: string;
|
|
845
873
|
input?: unknown;
|
|
846
874
|
output: unknown;
|
|
847
875
|
duration: number;
|
|
@@ -849,6 +877,7 @@ type AgentEvent = {
|
|
|
849
877
|
} | {
|
|
850
878
|
type: "tool:error";
|
|
851
879
|
tool: string;
|
|
880
|
+
toolCallId: string;
|
|
852
881
|
error: string;
|
|
853
882
|
recoverable: boolean;
|
|
854
883
|
} | {
|
|
@@ -918,19 +947,28 @@ type AgentEvent = {
|
|
|
918
947
|
subagentId: string;
|
|
919
948
|
conversationId: string;
|
|
920
949
|
task: string;
|
|
950
|
+
parentToolCallId?: string;
|
|
921
951
|
} | {
|
|
922
952
|
type: "subagent:completed";
|
|
923
953
|
subagentId: string;
|
|
924
954
|
conversationId: string;
|
|
955
|
+
task?: string;
|
|
956
|
+
parentToolCallId?: string;
|
|
957
|
+
resultText?: string;
|
|
925
958
|
} | {
|
|
926
959
|
type: "subagent:error";
|
|
927
960
|
subagentId: string;
|
|
928
961
|
conversationId: string;
|
|
929
962
|
error: string;
|
|
963
|
+
task?: string;
|
|
964
|
+
parentToolCallId?: string;
|
|
965
|
+
resultText?: string;
|
|
930
966
|
} | {
|
|
931
967
|
type: "subagent:stopped";
|
|
932
968
|
subagentId: string;
|
|
933
969
|
conversationId: string;
|
|
970
|
+
task?: string;
|
|
971
|
+
parentToolCallId?: string;
|
|
934
972
|
} | {
|
|
935
973
|
type: "subagent:approval_needed";
|
|
936
974
|
subagentId: string;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -38,6 +38,14 @@ export interface Message {
|
|
|
38
38
|
toolActivity?: string[];
|
|
39
39
|
sections?: Array<{ type: "text" | "tools"; content: string | string[] }>;
|
|
40
40
|
isCompactionSummary?: boolean;
|
|
41
|
+
/** True while this assistant message is an in-flight DRAFT (the turn
|
|
42
|
+
* hasn't finished). Set by the orchestrator's per-step draft persist and
|
|
43
|
+
* cleared at finalize. Consumers that reconcile a persisted snapshot with
|
|
44
|
+
* a live event stream (e.g. PonchOS's WS layer) strip `incomplete`
|
|
45
|
+
* messages from the snapshot and rebuild the in-flight turn from the
|
|
46
|
+
* event log instead — so the two never both carry it (no reconnect
|
|
47
|
+
* duplication). */
|
|
48
|
+
incomplete?: boolean;
|
|
41
49
|
};
|
|
42
50
|
}
|
|
43
51
|
|
|
@@ -76,6 +84,11 @@ export interface ToolContext {
|
|
|
76
84
|
parameters: Record<string, unknown>;
|
|
77
85
|
abortSignal?: AbortSignal;
|
|
78
86
|
conversationId?: string;
|
|
87
|
+
/** The id of the tool call currently executing. Lets a tool that spawns
|
|
88
|
+
* further work (spawn_subagent) record which call produced it, so the
|
|
89
|
+
* resulting subagent events can carry `parentToolCallId` and the client
|
|
90
|
+
* can attach subagent state to the spawning tool's pill. */
|
|
91
|
+
toolCallId?: string;
|
|
79
92
|
/** The tenant ID when running in multi-tenant mode. */
|
|
80
93
|
tenantId?: string;
|
|
81
94
|
/** Telemetry is suppressed for this run (e.g. an incognito turn). Tools
|
|
@@ -183,7 +196,25 @@ export interface AgentFailure {
|
|
|
183
196
|
}
|
|
184
197
|
|
|
185
198
|
export type AgentEvent =
|
|
186
|
-
| {
|
|
199
|
+
| {
|
|
200
|
+
type: "run:started";
|
|
201
|
+
runId: string;
|
|
202
|
+
agentId: string;
|
|
203
|
+
contextWindow?: number;
|
|
204
|
+
/**
|
|
205
|
+
* Why this run began. Lets a streaming client render the run
|
|
206
|
+
* deterministically instead of inferring from event order:
|
|
207
|
+
* - "user": a fresh user-message turn.
|
|
208
|
+
* - "continuation": the harness continued a long turn past a
|
|
209
|
+
* checkpoint (same logical turn).
|
|
210
|
+
* - "subagent_callback": a turn injecting a finished subagent's
|
|
211
|
+
* result back into the parent.
|
|
212
|
+
* - "approval_resume": resuming after a tool-approval decision
|
|
213
|
+
* (continues the existing assistant turn).
|
|
214
|
+
* Absent on older harness versions.
|
|
215
|
+
*/
|
|
216
|
+
cause?: "user" | "continuation" | "subagent_callback" | "approval_resume";
|
|
217
|
+
}
|
|
187
218
|
| { type: "run:completed"; runId: string; result: RunResult; pendingSubagents?: boolean }
|
|
188
219
|
| { type: "run:cancelled"; runId: string; messages?: Message[] }
|
|
189
220
|
| { type: "run:error"; runId: string; error: AgentFailure }
|
|
@@ -193,9 +224,9 @@ export type AgentEvent =
|
|
|
193
224
|
| { type: "model:chunk"; content: string }
|
|
194
225
|
| { type: "model:response"; usage: TokenUsage }
|
|
195
226
|
| { 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 }
|
|
227
|
+
| { type: "tool:started"; tool: string; toolCallId: string; input: unknown }
|
|
228
|
+
| { type: "tool:completed"; tool: string; toolCallId: string; input?: unknown; output: unknown; duration: number; outputTokenEstimate?: number }
|
|
229
|
+
| { type: "tool:error"; tool: string; toolCallId: string; error: string; recoverable: boolean }
|
|
199
230
|
| {
|
|
200
231
|
type: "tool:approval:required";
|
|
201
232
|
tool: string;
|
|
@@ -246,10 +277,10 @@ export type AgentEvent =
|
|
|
246
277
|
url?: string;
|
|
247
278
|
interactionAllowed: boolean;
|
|
248
279
|
}
|
|
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 }
|
|
280
|
+
| { type: "subagent:spawned"; subagentId: string; conversationId: string; task: string; parentToolCallId?: string }
|
|
281
|
+
| { type: "subagent:completed"; subagentId: string; conversationId: string; task?: string; parentToolCallId?: string; resultText?: string }
|
|
282
|
+
| { type: "subagent:error"; subagentId: string; conversationId: string; error: string; task?: string; parentToolCallId?: string; resultText?: string }
|
|
283
|
+
| { type: "subagent:stopped"; subagentId: string; conversationId: string; task?: string; parentToolCallId?: string }
|
|
253
284
|
| {
|
|
254
285
|
type: "subagent:approval_needed";
|
|
255
286
|
subagentId: string;
|