@poncho-ai/sdk 1.15.2 → 1.17.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.2 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
2
+ > @poncho-ai/sdk@1.17.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 22ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1365ms
14
- DTS dist/index.d.ts 32.36 KB
13
+ DTS ⚡️ Build success in 1468ms
14
+ DTS dist/index.d.ts 33.95 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # @poncho-ai/sdk
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#192](https://github.com/cesr/poncho-ai/pull/192) [`bfd8012`](https://github.com/cesr/poncho-ai/commit/bfd80125ad71cd4401221c598faebf71afda2078) Thanks [@cesr](https://github.com/cesr)! - Fix context-compaction correctness so the agent stops losing context and
8
+ mislabeling failed work after a compaction:
9
+ - **Turn-based retention.** Compaction now preserves the last N whole _turns_
10
+ verbatim (new `compaction.keepRecentTurns`, default 4) instead of N messages,
11
+ which in tool-heavy turns collapsed to just the summary. The preserved side is
12
+ bounded by a token budget (≤ 50% of the context window) so keeping recent turns
13
+ can't leave the post-compaction context above the trigger (re-compaction
14
+ thrash / overflow). Adds exported `findSafeSplitPointByTurns`.
15
+ - **Faithful summaries.** The summarization output cap is raised 768 → 8192
16
+ tokens (768 physically truncated summaries mid-content); per-message truncation
17
+ 1200 → 4000 chars, with a total summarizer-input budget that drops the oldest
18
+ non-error messages first. The prompt now requires a non-omittable "Unresolved
19
+ errors & failures" section, a "Pending promises" section, forbids claiming
20
+ unconfirmed completion, and preserves identifiers verbatim.
21
+ - **Structured subagent task outcome.** New `PendingSubagentResult.taskOutcome`
22
+ (`succeeded | failed | partial | unknown`) distinct from run status: a subagent
23
+ that ran but failed its task is no longer recorded as "completed". Subagents
24
+ self-report a machine-readable verdict; it is parsed deterministically
25
+ (defaulting to "unknown", never success) and rendered in the callback header
26
+ and compaction ledger. The subagent digest is enlarged (2000 chars, ungated on
27
+ status) so the failure reason survives compaction.
28
+ - **Per-run `maxSteps` override.** New `RunInput.maxSteps` lets a caller raise the
29
+ step ceiling for foreground turns without raising it for background/job turns
30
+ that share the same agent definition.
31
+
32
+ ## 1.16.0
33
+
34
+ ### Minor Changes
35
+
36
+ - [`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.
37
+ - **Second message-history cache breakpoint.** When prior-run tool results
38
+ are still untruncated, the history breakpoint used to sit only at the
39
+ last _stable_ index (before those results) — so a tool-heavy turn
40
+ re-sent everything after it raw on every step. Now a second breakpoint
41
+ is pinned at the true tail, so the current run reads its own growing
42
+ history at 0.1× while the stable entry keeps serving across runs.
43
+ `addPromptCacheBreakpoints` accepts `number | number[]` (out-of-range
44
+ indices dropped, duplicates collapsed). The Anthropic breakpoint budget
45
+ of 4 is now fully spent: static (1h), memory (1h), stable-history, tail.
46
+ - **`RunInput.volatileContext`** — per-run context rendered into the
47
+ _uncached_ dynamic tail of the system prompt. Embedders that previously
48
+ appended volatile blocks (live VFS tree, connected integrations) to the
49
+ agent body — busting the 1h static cache block on every change — can
50
+ pass them here instead, keeping the static block byte-stable (and
51
+ shareable across users when the agent definition is identical). The
52
+ value is captured per conversation so orchestrator-initiated turns
53
+ (continuations, subagent-callback resumes) reuse it. Forwarded through
54
+ `runConversationTurn` opts.
55
+ - **`RunInput.telemetryAttributes`** — extra attributes stamped on the
56
+ `invoke_agent` root span (e.g. `{"poncho.run.kind": "job"}`), letting
57
+ observability backends segment traffic classes without timing
58
+ forensics. Forwarded through `runConversationTurn` opts.
59
+
3
60
  ## 1.15.2
4
61
 
5
62
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -765,12 +765,33 @@ 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
+ * Per-run override for the step ceiling. Takes precedence over the agent
769
+ * definition's `limits.maxSteps` (default 20). Lets one harness instance run
770
+ * foreground turns with a higher ceiling than background/job turns without a
771
+ * frontmatter mutation that would affect concurrent runs.
772
+ */
773
+ maxSteps?: number;
774
+ /**
775
+ * When true, skip the Anthropic message-history prompt-cache breakpoints
776
+ * for this run (the 1h static/memory system breakpoints stay on).
777
+ * Only worth it for runs that are BOTH single-step AND one-shot: the
778
+ * breakpoint is recomputed every step, so any multi-step run reads its
779
+ * own growing history through it at 0.1× — disabling that costs far
780
+ * more than the one wasted 1.25× tail write it saves. (Cron-fired jobs
781
+ * used to set this; they stopped once job runs grew to dozens of steps.)
772
782
  */
773
783
  disablePromptCache?: boolean;
784
+ /**
785
+ * Volatile per-run context appended to the UNCACHED dynamic tail of the
786
+ * system prompt (after the agent body / skills / memory blocks, which
787
+ * carry 1h cache breakpoints). Put content here that changes often and
788
+ * would otherwise bust the big static cache block if embedded in the
789
+ * agent definition — e.g. a live file-tree listing or connected-
790
+ * integrations summary. Re-sent raw on every step, so keep it small.
791
+ * Orchestrator-initiated turns on the same conversation (subagent
792
+ * callback resumes) reuse the value captured at parent-turn start.
793
+ */
794
+ volatileContext?: string;
774
795
  /**
775
796
  * Model name override for this run, captured once at run start. Takes
776
797
  * precedence over the agent definition's `model.name` for every step of
@@ -792,6 +813,14 @@ interface RunInput {
792
813
  * exporter-less harness instance per mode.
793
814
  */
794
815
  suppressTelemetry?: boolean;
816
+ /**
817
+ * Extra attributes stamped on the `invoke_agent` root telemetry span,
818
+ * e.g. `{ "poncho.run.kind": "job", "poncho.job.name": "heartbeat" }`.
819
+ * Lets observability backends segment traffic classes (jobs vs chat)
820
+ * without timing forensics. String values only; ignored when telemetry
821
+ * is off or suppressed.
822
+ */
823
+ telemetryAttributes?: Record<string, string>;
795
824
  }
796
825
  interface TokenUsage {
797
826
  input: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/sdk",
3
- "version": "1.15.2",
3
+ "version": "1.17.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,33 @@ 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
+ * Per-run override for the step ceiling. Takes precedence over the agent
150
+ * definition's `limits.maxSteps` (default 20). Lets one harness instance run
151
+ * foreground turns with a higher ceiling than background/job turns without a
152
+ * frontmatter mutation that would affect concurrent runs.
153
+ */
154
+ maxSteps?: number;
155
+ /**
156
+ * When true, skip the Anthropic message-history prompt-cache breakpoints
157
+ * for this run (the 1h static/memory system breakpoints stay on).
158
+ * Only worth it for runs that are BOTH single-step AND one-shot: the
159
+ * breakpoint is recomputed every step, so any multi-step run reads its
160
+ * own growing history through it at 0.1× — disabling that costs far
161
+ * more than the one wasted 1.25× tail write it saves. (Cron-fired jobs
162
+ * used to set this; they stopped once job runs grew to dozens of steps.)
153
163
  */
154
164
  disablePromptCache?: boolean;
165
+ /**
166
+ * Volatile per-run context appended to the UNCACHED dynamic tail of the
167
+ * system prompt (after the agent body / skills / memory blocks, which
168
+ * carry 1h cache breakpoints). Put content here that changes often and
169
+ * would otherwise bust the big static cache block if embedded in the
170
+ * agent definition — e.g. a live file-tree listing or connected-
171
+ * integrations summary. Re-sent raw on every step, so keep it small.
172
+ * Orchestrator-initiated turns on the same conversation (subagent
173
+ * callback resumes) reuse the value captured at parent-turn start.
174
+ */
175
+ volatileContext?: string;
155
176
  /**
156
177
  * Model name override for this run, captured once at run start. Takes
157
178
  * precedence over the agent definition's `model.name` for every step of
@@ -173,6 +194,14 @@ export interface RunInput {
173
194
  * exporter-less harness instance per mode.
174
195
  */
175
196
  suppressTelemetry?: boolean;
197
+ /**
198
+ * Extra attributes stamped on the `invoke_agent` root telemetry span,
199
+ * e.g. `{ "poncho.run.kind": "job", "poncho.job.name": "heartbeat" }`.
200
+ * Lets observability backends segment traffic classes (jobs vs chat)
201
+ * without timing forensics. String values only; ignored when telemetry
202
+ * is off or suppressed.
203
+ */
204
+ telemetryAttributes?: Record<string, string>;
176
205
  }
177
206
 
178
207
  export interface TokenUsage {