@poncho-ai/sdk 1.15.1 → 1.16.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.15.1 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
2
+ > @poncho-ai/sdk@1.16.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 18ms
11
+ ESM ⚡️ Build success in 24ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1324ms
14
- DTS dist/index.d.ts 31.79 KB
13
+ DTS ⚡️ Build success in 1382ms
14
+ DTS dist/index.d.ts 33.61 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @poncho-ai/sdk
2
2
 
3
+ ## 1.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`8a5a367`](https://github.com/cesr/poncho-ai/commit/8a5a367dd4b2ea477b3e0146a7253cedcdc34a1c) Thanks [@cesr](https://github.com/cesr)! - Prompt-cache efficiency: tail breakpoint pin + volatile context slot + span attribution.
8
+ - **Second message-history cache breakpoint.** When prior-run tool results
9
+ are still untruncated, the history breakpoint used to sit only at the
10
+ last _stable_ index (before those results) — so a tool-heavy turn
11
+ re-sent everything after it raw on every step. Now a second breakpoint
12
+ is pinned at the true tail, so the current run reads its own growing
13
+ history at 0.1× while the stable entry keeps serving across runs.
14
+ `addPromptCacheBreakpoints` accepts `number | number[]` (out-of-range
15
+ indices dropped, duplicates collapsed). The Anthropic breakpoint budget
16
+ of 4 is now fully spent: static (1h), memory (1h), stable-history, tail.
17
+ - **`RunInput.volatileContext`** — per-run context rendered into the
18
+ _uncached_ dynamic tail of the system prompt. Embedders that previously
19
+ appended volatile blocks (live VFS tree, connected integrations) to the
20
+ agent body — busting the 1h static cache block on every change — can
21
+ pass them here instead, keeping the static block byte-stable (and
22
+ shareable across users when the agent definition is identical). The
23
+ value is captured per conversation so orchestrator-initiated turns
24
+ (continuations, subagent-callback resumes) reuse it. Forwarded through
25
+ `runConversationTurn` opts.
26
+ - **`RunInput.telemetryAttributes`** — extra attributes stamped on the
27
+ `invoke_agent` root span (e.g. `{"poncho.run.kind": "job"}`), letting
28
+ observability backends segment traffic classes without timing
29
+ forensics. Forwarded through `runConversationTurn` opts.
30
+
31
+ ## 1.15.2
32
+
33
+ ### Patch Changes
34
+
35
+ - [`3a25676`](https://github.com/cesr/poncho-ai/commit/3a2567666e1bc8d6650818db76d07765c0250264) Thanks [@cesr](https://github.com/cesr)! - Add a per-run `model` override to `RunInput` (and forward it from `runConversationTurn`'s opts). The override is captured once at run start and wins over the agent definition's `model.name` for every step of the run.
36
+
37
+ Previously the only way to vary the model per run kind on a shared harness was mutating `parsedAgent.frontmatter.model.name` before each run — but the harness re-reads that field at the start of every step, so a concurrent run's mutation flipped an in-flight run's model mid-turn. Besides being the wrong model, the switch invalidated the run's entire Anthropic prompt cache (caches are per-model), observed in production as the same ~104k-token prefix being cache-written twice back-to-back, once per model. Callers should pass `model` in the run input instead of mutating frontmatter.
38
+
3
39
  ## 1.15.1
4
40
 
5
41
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -765,12 +765,37 @@ interface RunInput {
765
765
  /** When true, ignores PONCHO_MAX_DURATION soft deadline (used for background subagent runs). */
766
766
  disableSoftDeadline?: boolean;
767
767
  /**
768
- * When true, skip the Anthropic prompt-cache breakpoint for this run.
769
- * Use for one-shot runs with no follow-up turn coming (e.g. cron-fired
770
- * jobs) the 1.25× write surcharge is pure waste when no later read
771
- * will hit the cache before the 5-min TTL expires.
768
+ * When true, skip the Anthropic message-history prompt-cache breakpoints
769
+ * for this run (the 1h static/memory system breakpoints stay on).
770
+ * Only worth it for runs that are BOTH single-step AND one-shot: the
771
+ * breakpoint is recomputed every step, so any multi-step run reads its
772
+ * own growing history through it at 0.1× — disabling that costs far
773
+ * more than the one wasted 1.25× tail write it saves. (Cron-fired jobs
774
+ * used to set this; they stopped once job runs grew to dozens of steps.)
772
775
  */
773
776
  disablePromptCache?: boolean;
777
+ /**
778
+ * Volatile per-run context appended to the UNCACHED dynamic tail of the
779
+ * system prompt (after the agent body / skills / memory blocks, which
780
+ * carry 1h cache breakpoints). Put content here that changes often and
781
+ * would otherwise bust the big static cache block if embedded in the
782
+ * agent definition — e.g. a live file-tree listing or connected-
783
+ * integrations summary. Re-sent raw on every step, so keep it small.
784
+ * Orchestrator-initiated turns on the same conversation (subagent
785
+ * callback resumes) reuse the value captured at parent-turn start.
786
+ */
787
+ volatileContext?: string;
788
+ /**
789
+ * Model name override for this run, captured once at run start. Takes
790
+ * precedence over the agent definition's `model.name` for every step of
791
+ * the run. Use this instead of mutating the parsed agent's frontmatter
792
+ * when one harness instance serves runs that need different models
793
+ * (e.g. user turns vs cron jobs) — a frontmatter mutation made while
794
+ * another run is in flight changes that run's model mid-turn, and the
795
+ * model switch invalidates its entire Anthropic prompt cache (caches
796
+ * are per-model).
797
+ */
798
+ model?: string;
774
799
  /** Scope this run to a specific tenant. */
775
800
  tenantId?: string;
776
801
  /**
@@ -781,6 +806,14 @@ interface RunInput {
781
806
  * exporter-less harness instance per mode.
782
807
  */
783
808
  suppressTelemetry?: boolean;
809
+ /**
810
+ * Extra attributes stamped on the `invoke_agent` root telemetry span,
811
+ * e.g. `{ "poncho.run.kind": "job", "poncho.job.name": "heartbeat" }`.
812
+ * Lets observability backends segment traffic classes (jobs vs chat)
813
+ * without timing forensics. String values only; ignored when telemetry
814
+ * is off or suppressed.
815
+ */
816
+ telemetryAttributes?: Record<string, string>;
784
817
  }
785
818
  interface TokenUsage {
786
819
  input: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/sdk",
3
- "version": "1.15.1",
3
+ "version": "1.16.0",
4
4
  "description": "Core types and utilities for building Poncho skills",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -146,12 +146,37 @@ export interface RunInput {
146
146
  /** When true, ignores PONCHO_MAX_DURATION soft deadline (used for background subagent runs). */
147
147
  disableSoftDeadline?: boolean;
148
148
  /**
149
- * When true, skip the Anthropic prompt-cache breakpoint for this run.
150
- * Use for one-shot runs with no follow-up turn coming (e.g. cron-fired
151
- * jobs) the 1.25× write surcharge is pure waste when no later read
152
- * will hit the cache before the 5-min TTL expires.
149
+ * When true, skip the Anthropic message-history prompt-cache breakpoints
150
+ * for this run (the 1h static/memory system breakpoints stay on).
151
+ * Only worth it for runs that are BOTH single-step AND one-shot: the
152
+ * breakpoint is recomputed every step, so any multi-step run reads its
153
+ * own growing history through it at 0.1× — disabling that costs far
154
+ * more than the one wasted 1.25× tail write it saves. (Cron-fired jobs
155
+ * used to set this; they stopped once job runs grew to dozens of steps.)
153
156
  */
154
157
  disablePromptCache?: boolean;
158
+ /**
159
+ * Volatile per-run context appended to the UNCACHED dynamic tail of the
160
+ * system prompt (after the agent body / skills / memory blocks, which
161
+ * carry 1h cache breakpoints). Put content here that changes often and
162
+ * would otherwise bust the big static cache block if embedded in the
163
+ * agent definition — e.g. a live file-tree listing or connected-
164
+ * integrations summary. Re-sent raw on every step, so keep it small.
165
+ * Orchestrator-initiated turns on the same conversation (subagent
166
+ * callback resumes) reuse the value captured at parent-turn start.
167
+ */
168
+ volatileContext?: string;
169
+ /**
170
+ * Model name override for this run, captured once at run start. Takes
171
+ * precedence over the agent definition's `model.name` for every step of
172
+ * the run. Use this instead of mutating the parsed agent's frontmatter
173
+ * when one harness instance serves runs that need different models
174
+ * (e.g. user turns vs cron jobs) — a frontmatter mutation made while
175
+ * another run is in flight changes that run's model mid-turn, and the
176
+ * model switch invalidates its entire Anthropic prompt cache (caches
177
+ * are per-model).
178
+ */
179
+ model?: string;
155
180
  /** Scope this run to a specific tenant. */
156
181
  tenantId?: string;
157
182
  /**
@@ -162,6 +187,14 @@ export interface RunInput {
162
187
  * exporter-less harness instance per mode.
163
188
  */
164
189
  suppressTelemetry?: boolean;
190
+ /**
191
+ * Extra attributes stamped on the `invoke_agent` root telemetry span,
192
+ * e.g. `{ "poncho.run.kind": "job", "poncho.job.name": "heartbeat" }`.
193
+ * Lets observability backends segment traffic classes (jobs vs chat)
194
+ * without timing forensics. String values only; ignored when telemetry
195
+ * is off or suppressed.
196
+ */
197
+ telemetryAttributes?: Record<string, string>;
165
198
  }
166
199
 
167
200
  export interface TokenUsage {