@poncho-ai/sdk 1.13.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/sdk@1.13.0 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
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
  CLI Building entry: src/index.ts
@@ -8,7 +8,7 @@
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
10
  ESM dist/index.js 17.24 KB
11
- ESM ⚡️ Build success in 21ms
11
+ ESM ⚡️ Build success in 19ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1513ms
14
- DTS dist/index.d.ts 29.81 KB
13
+ DTS ⚡️ Build success in 1324ms
14
+ DTS dist/index.d.ts 31.27 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
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
+
30
+ ## 1.14.0
31
+
32
+ ### Minor Changes
33
+
34
+ - [`d8453b4`](https://github.com/cesr/poncho-ai/commit/d8453b4f2360a1734e448960fe52f6c450cdf842) Thanks [@cesr](https://github.com/cesr)! - harness: propagate `suppressTelemetry` to subagents.
35
+
36
+ A telemetry-off run (e.g. incognito) now suppresses telemetry for the subagents it spawns too, not just the parent turn. The parent run's `suppressTelemetry` is exposed on `ToolContext`, captured by `spawn_subagent` into the new `SubagentManager.spawn({ suppressTelemetry })` option, stored on the subagent conversation's `subagentMeta`, and read back by the orchestrator's `runSubagent` / continuation so the child run (and its re-runs) emit no `invoke_agent` / `execute_tool` / AI-SDK spans.
37
+
3
38
  ## 1.13.0
4
39
 
5
40
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -713,8 +713,17 @@ 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;
723
+ /** Telemetry is suppressed for this run (e.g. an incognito turn). Tools
724
+ * that spawn further runs (subagents) propagate this so the child run
725
+ * emits no telemetry either. */
726
+ suppressTelemetry?: boolean;
718
727
  /** Virtual filesystem scoped to the current tenant. Available when VFS is enabled. */
719
728
  vfs?: VfsAccess;
720
729
  }
@@ -798,6 +807,19 @@ type AgentEvent = {
798
807
  runId: string;
799
808
  agentId: string;
800
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";
801
823
  } | {
802
824
  type: "run:completed";
803
825
  runId: string;
@@ -834,10 +856,12 @@ type AgentEvent = {
834
856
  } | {
835
857
  type: "tool:started";
836
858
  tool: string;
859
+ toolCallId: string;
837
860
  input: unknown;
838
861
  } | {
839
862
  type: "tool:completed";
840
863
  tool: string;
864
+ toolCallId: string;
841
865
  input?: unknown;
842
866
  output: unknown;
843
867
  duration: number;
@@ -845,6 +869,7 @@ type AgentEvent = {
845
869
  } | {
846
870
  type: "tool:error";
847
871
  tool: string;
872
+ toolCallId: string;
848
873
  error: string;
849
874
  recoverable: boolean;
850
875
  } | {
@@ -914,19 +939,28 @@ type AgentEvent = {
914
939
  subagentId: string;
915
940
  conversationId: string;
916
941
  task: string;
942
+ parentToolCallId?: string;
917
943
  } | {
918
944
  type: "subagent:completed";
919
945
  subagentId: string;
920
946
  conversationId: string;
947
+ task?: string;
948
+ parentToolCallId?: string;
949
+ resultText?: string;
921
950
  } | {
922
951
  type: "subagent:error";
923
952
  subagentId: string;
924
953
  conversationId: string;
925
954
  error: string;
955
+ task?: string;
956
+ parentToolCallId?: string;
957
+ resultText?: string;
926
958
  } | {
927
959
  type: "subagent:stopped";
928
960
  subagentId: string;
929
961
  conversationId: string;
962
+ task?: string;
963
+ parentToolCallId?: string;
930
964
  } | {
931
965
  type: "subagent:approval_needed";
932
966
  subagentId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/sdk",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "Core types and utilities for building Poncho skills",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -76,8 +76,17 @@ 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;
86
+ /** Telemetry is suppressed for this run (e.g. an incognito turn). Tools
87
+ * that spawn further runs (subagents) propagate this so the child run
88
+ * emits no telemetry either. */
89
+ suppressTelemetry?: boolean;
81
90
  /** Virtual filesystem scoped to the current tenant. Available when VFS is enabled. */
82
91
  vfs?: VfsAccess;
83
92
  }
@@ -179,7 +188,25 @@ export interface AgentFailure {
179
188
  }
180
189
 
181
190
  export type AgentEvent =
182
- | { type: "run:started"; runId: string; agentId: string; contextWindow?: number }
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
+ }
183
210
  | { type: "run:completed"; runId: string; result: RunResult; pendingSubagents?: boolean }
184
211
  | { type: "run:cancelled"; runId: string; messages?: Message[] }
185
212
  | { type: "run:error"; runId: string; error: AgentFailure }
@@ -189,9 +216,9 @@ export type AgentEvent =
189
216
  | { type: "model:chunk"; content: string }
190
217
  | { type: "model:response"; usage: TokenUsage }
191
218
  | { type: "tool:generating"; tool: string; toolCallId: string }
192
- | { type: "tool:started"; tool: string; input: unknown }
193
- | { type: "tool:completed"; tool: string; input?: unknown; output: unknown; duration: number; outputTokenEstimate?: number }
194
- | { 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 }
195
222
  | {
196
223
  type: "tool:approval:required";
197
224
  tool: string;
@@ -242,10 +269,10 @@ export type AgentEvent =
242
269
  url?: string;
243
270
  interactionAllowed: boolean;
244
271
  }
245
- | { type: "subagent:spawned"; subagentId: string; conversationId: string; task: string }
246
- | { type: "subagent:completed"; subagentId: string; conversationId: string }
247
- | { type: "subagent:error"; subagentId: string; conversationId: string; error: string }
248
- | { 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 }
249
276
  | {
250
277
  type: "subagent:approval_needed";
251
278
  subagentId: string;