@poncho-ai/sdk 1.10.0 → 1.12.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.10.0 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
2
+ > @poncho-ai/sdk@1.12.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 20ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1318ms
14
- DTS dist/index.d.ts 28.29 KB
13
+ DTS ⚡️ Build success in 1257ms
14
+ DTS dist/index.d.ts 29.41 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # @poncho-ai/sdk
2
2
 
3
+ ## 1.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#118](https://github.com/cesr/poncho-ai/pull/118) [`e8df464`](https://github.com/cesr/poncho-ai/commit/e8df4649618cba0b408a6c143f923f0dcb2046c8) Thanks [@cesr](https://github.com/cesr)! - harness: 1h static system-prompt cache breakpoint + per-run cache kill-switch
8
+
9
+ Two related changes to Anthropic prompt caching:
10
+
11
+ **1-hour static system-prompt breakpoint.** The harness now splits the
12
+ assembled system prompt into a static portion (agent body + skill
13
+ context + browser/fs/isolate context — stable across many turns and
14
+ jobs within an hour) and a dynamic tail (memory, todos, time). On
15
+ Anthropic models, these are sent as two `role: "system"` messages with
16
+ `cacheControl: { ttl: "1h" }` on the static block. The existing 5-min
17
+ tail breakpoint on the last user/assistant/tool message is retained.
18
+
19
+ This lets later turns and job runs read ~95% of the system prompt at
20
+ 0.1× (cache read) instead of paying 1× whenever the 5-min tail cache
21
+ has expired — the previous setup only cached for 5 minutes via the
22
+ tail breakpoint. Within-user cross-conversation and interactive-vs-job
23
+ all share the static cache.
24
+
25
+ **Per-run cache kill-switch.** Added `RunInput.disablePromptCache?:
26
+ boolean` (also exposed on `RunConversationTurnOpts.disablePromptCache`,
27
+ forwarded into `runInput`). When set, the harness skips the 5-min tail
28
+ breakpoint for that run. The 1-hour static breakpoint is still
29
+ applied — the run still benefits from reading the shared static cache,
30
+ just doesn't write a new tail entry that won't be read before TTL.
31
+
32
+ Intended for one-shot programmatic invocations (cron-fired jobs,
33
+ subagent dispatch) where no follow-up turn is coming within the 5-min
34
+ TTL window, so the 1.25× write surcharge would be pure waste.
35
+
36
+ Non-Anthropic providers fall through to the previous single concatenated
37
+ `system:` string with no cache control — those providers auto-cache.
38
+
39
+ Internal: `isAnthropicModel` is now exported from `prompt-cache.ts`
40
+ for reuse at the streamText site.
41
+
42
+ ## 1.11.0
43
+
44
+ ### Minor Changes
45
+
46
+ - [`1adaae2`](https://github.com/cesr/poncho-ai/commit/1adaae2d4cc55800f01d602f2a7d6ecc65031443) Thanks [@cesr](https://github.com/cesr)! - harness: device-dispatch mode for tools that execute on a connected client
47
+
48
+ Tools can now be marked `dispatch: "device"` on `loadedConfig.tools`. When
49
+ the model calls such a tool the dispatcher pauses the run, emits a new
50
+ `tool:device:required` event, and checkpoints with the new
51
+ `kind: "device"` discriminator on `pendingApprovals` — same plumbing as
52
+ the approval flow, different trigger and different resume payload.
53
+ Consumers (e.g. PonchOS for iOS device tools) drive the external
54
+ execution and feed the result back via `continueFromToolResult`.
55
+
56
+ Approval can be combined: `{access: "approval", dispatch: "device"}`
57
+ yields the approval card first, then on resume falls through to the
58
+ device-required event. The wire vocabulary for approvals
59
+ (`approvalId` etc.) is unchanged; the `pendingApprovals` column /
60
+ field name stays.
61
+
62
+ `ToolAccess` is broadened to accept both the legacy string `"approval"`
63
+ and the new `{access?, dispatch?}` object form. Existing configs keep
64
+ working unchanged.
65
+
3
66
  ## 1.10.0
4
67
 
5
68
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -747,6 +747,13 @@ interface RunInput {
747
747
  conversationId?: string;
748
748
  /** When true, ignores PONCHO_MAX_DURATION soft deadline (used for background subagent runs). */
749
749
  disableSoftDeadline?: boolean;
750
+ /**
751
+ * When true, skip the Anthropic prompt-cache breakpoint for this run.
752
+ * Use for one-shot runs with no follow-up turn coming (e.g. cron-fired
753
+ * jobs) — the 1.25× write surcharge is pure waste when no later read
754
+ * will hit the cache before the 5-min TTL expires.
755
+ */
756
+ disablePromptCache?: boolean;
750
757
  /** Scope this run to a specific tenant. */
751
758
  tenantId?: string;
752
759
  }
@@ -858,6 +865,32 @@ type AgentEvent = {
858
865
  name: string;
859
866
  input: Record<string, unknown>;
860
867
  }>;
868
+ } | {
869
+ /**
870
+ * Tool wants to execute on a connected client device (e.g. iOS).
871
+ * The consumer of the harness is responsible for routing this event
872
+ * to the appropriate WebSocket and POSTing the tool's result back via
873
+ * `resumeRunFromCheckpoint`. Carries the same envelope as the
874
+ * approval-required event; `requestId` plays the role of `approvalId`.
875
+ */
876
+ type: "tool:device:required";
877
+ tool: string;
878
+ input: unknown;
879
+ requestId: string;
880
+ } | {
881
+ type: "tool:device:checkpoint";
882
+ approvals: Array<{
883
+ approvalId: string;
884
+ tool: string;
885
+ toolCallId: string;
886
+ input: Record<string, unknown>;
887
+ }>;
888
+ checkpointMessages: Message[];
889
+ pendingToolCalls: Array<{
890
+ id: string;
891
+ name: string;
892
+ input: Record<string, unknown>;
893
+ }>;
861
894
  } | {
862
895
  type: "browser:frame";
863
896
  data: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/sdk",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Core types and utilities for building Poncho skills",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -128,6 +128,13 @@ export interface RunInput {
128
128
  conversationId?: string;
129
129
  /** When true, ignores PONCHO_MAX_DURATION soft deadline (used for background subagent runs). */
130
130
  disableSoftDeadline?: boolean;
131
+ /**
132
+ * When true, skip the Anthropic prompt-cache breakpoint for this run.
133
+ * Use for one-shot runs with no follow-up turn coming (e.g. cron-fired
134
+ * jobs) — the 1.25× write surcharge is pure waste when no later read
135
+ * will hit the cache before the 5-min TTL expires.
136
+ */
137
+ disablePromptCache?: boolean;
131
138
  /** Scope this run to a specific tenant. */
132
139
  tenantId?: string;
133
140
  }
@@ -196,6 +203,30 @@ export type AgentEvent =
196
203
  checkpointMessages: Message[];
197
204
  pendingToolCalls: Array<{ id: string; name: string; input: Record<string, unknown> }>;
198
205
  }
206
+ | {
207
+ /**
208
+ * Tool wants to execute on a connected client device (e.g. iOS).
209
+ * The consumer of the harness is responsible for routing this event
210
+ * to the appropriate WebSocket and POSTing the tool's result back via
211
+ * `resumeRunFromCheckpoint`. Carries the same envelope as the
212
+ * approval-required event; `requestId` plays the role of `approvalId`.
213
+ */
214
+ type: "tool:device:required";
215
+ tool: string;
216
+ input: unknown;
217
+ requestId: string;
218
+ }
219
+ | {
220
+ type: "tool:device:checkpoint";
221
+ approvals: Array<{
222
+ approvalId: string;
223
+ tool: string;
224
+ toolCallId: string;
225
+ input: Record<string, unknown>;
226
+ }>;
227
+ checkpointMessages: Message[];
228
+ pendingToolCalls: Array<{ id: string; name: string; input: Record<string, unknown> }>;
229
+ }
199
230
  | { type: "browser:frame"; data: string; width: number; height: number }
200
231
  | {
201
232
  type: "browser:status";