@theokit/sdk 2.1.0 → 2.2.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.
@@ -26,4 +26,10 @@ export interface AgentLoopOutput {
26
26
  * message (the previous bug — sdk-error-packaging-fix-plan).
27
27
  */
28
28
  error?: AgentLoopErrorDetail;
29
+ /**
30
+ * M1-2 (T2.2): true when the loop stopped at its iteration ceiling with the
31
+ * model still wanting to call tools (silent truncation). Copied verbatim onto
32
+ * `RunResult.stoppedAtIterationLimit`.
33
+ */
34
+ stoppedAtIterationLimit?: boolean;
29
35
  }
@@ -70,4 +70,12 @@ export interface BudgetTracker {
70
70
  check(): BudgetCheck;
71
71
  /** Snapshot of accumulated totals (for telemetry / final reporting). */
72
72
  getTotal(): BudgetTotal;
73
+ /**
74
+ * Advance the iteration counter by one. Called by the agent loop ONCE per
75
+ * completed turn (M1-1) so that trackers which gate on `maxIterations`
76
+ * (e.g. `createCounterBudgetTracker`) actually halt. OPTIONAL: trackers that
77
+ * only gate on tokens/USD omit it and the loop no-ops via optional chaining.
78
+ * MUST be synchronous and non-throwing.
79
+ */
80
+ nextIteration?(): void;
73
81
  }
@@ -677,6 +677,16 @@ interface RunResult {
677
677
  * @public
678
678
  */
679
679
  cost?: CostBreakdown;
680
+ /**
681
+ * M1-2: `true` when the run stopped because the agent loop hit its iteration
682
+ * ceiling (`SendOptions.maxIterations` or the default of 8) while the model
683
+ * still wanted to call tools — i.e. the work was silently truncated rather
684
+ * than finished. `undefined`/absent on a clean finish. A continuation driver
685
+ * (or a careful caller) inspects this to decide whether to send again.
686
+ *
687
+ * @public
688
+ */
689
+ stoppedAtIterationLimit?: boolean;
680
690
  }
681
691
  /**
682
692
  * Structured error attached to a {@link RunResult} when the underlying run
@@ -789,6 +799,16 @@ interface SendOptions {
789
799
  id?: string;
790
800
  meta?: Record<string, unknown>;
791
801
  };
802
+ /**
803
+ * Per-send ceiling on the agent loop's tool-calling turns (M1-2). Raises (or
804
+ * lowers) the default cap of 8 for this single send — useful when one heavy
805
+ * task needs more rounds than the agent's default. Must be a positive
806
+ * integer; invalid values throw `ConfigurationError` at the boundary. When
807
+ * unset, the loop uses the default of 8.
808
+ *
809
+ * @public
810
+ */
811
+ maxIterations?: number;
792
812
  }
793
813
  /**
794
814
  * Handle to a single prompt submission.
@@ -677,6 +677,16 @@ interface RunResult {
677
677
  * @public
678
678
  */
679
679
  cost?: CostBreakdown;
680
+ /**
681
+ * M1-2: `true` when the run stopped because the agent loop hit its iteration
682
+ * ceiling (`SendOptions.maxIterations` or the default of 8) while the model
683
+ * still wanted to call tools — i.e. the work was silently truncated rather
684
+ * than finished. `undefined`/absent on a clean finish. A continuation driver
685
+ * (or a careful caller) inspects this to decide whether to send again.
686
+ *
687
+ * @public
688
+ */
689
+ stoppedAtIterationLimit?: boolean;
680
690
  }
681
691
  /**
682
692
  * Structured error attached to a {@link RunResult} when the underlying run
@@ -789,6 +799,16 @@ interface SendOptions {
789
799
  id?: string;
790
800
  meta?: Record<string, unknown>;
791
801
  };
802
+ /**
803
+ * Per-send ceiling on the agent loop's tool-calling turns (M1-2). Raises (or
804
+ * lowers) the default cap of 8 for this single send — useful when one heavy
805
+ * task needs more rounds than the agent's default. Must be a positive
806
+ * integer; invalid values throw `ConfigurationError` at the boundary. When
807
+ * unset, the loop uses the default of 8.
808
+ *
809
+ * @public
810
+ */
811
+ maxIterations?: number;
792
812
  }
793
813
  /**
794
814
  * Handle to a single prompt submission.
@@ -71,6 +71,16 @@ export interface RunResult {
71
71
  * @public
72
72
  */
73
73
  cost?: CostBreakdown;
74
+ /**
75
+ * M1-2: `true` when the run stopped because the agent loop hit its iteration
76
+ * ceiling (`SendOptions.maxIterations` or the default of 8) while the model
77
+ * still wanted to call tools — i.e. the work was silently truncated rather
78
+ * than finished. `undefined`/absent on a clean finish. A continuation driver
79
+ * (or a careful caller) inspects this to decide whether to send again.
80
+ *
81
+ * @public
82
+ */
83
+ stoppedAtIterationLimit?: boolean;
74
84
  }
75
85
  /**
76
86
  * Structured error attached to a {@link RunResult} when the underlying run
@@ -183,6 +193,16 @@ export interface SendOptions {
183
193
  id?: string;
184
194
  meta?: Record<string, unknown>;
185
195
  };
196
+ /**
197
+ * Per-send ceiling on the agent loop's tool-calling turns (M1-2). Raises (or
198
+ * lowers) the default cap of 8 for this single send — useful when one heavy
199
+ * task needs more rounds than the agent's default. Must be a positive
200
+ * integer; invalid values throw `ConfigurationError` at the boundary. When
201
+ * unset, the loop uses the default of 8.
202
+ *
203
+ * @public
204
+ */
205
+ maxIterations?: number;
186
206
  }
187
207
  /**
188
208
  * Handle to a single prompt submission.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheo/theokit-sdk#readme",