@standardagents/spec 0.43.0 → 0.43.1

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.
package/dist/index.d.ts CHANGED
@@ -2562,7 +2562,11 @@ interface ExecutionState {
2562
2562
  readonly stopped: boolean;
2563
2563
  /** Which side initiated the stop (if stopped) */
2564
2564
  readonly stoppedBy?: 'a' | 'b';
2565
- /** Live chronological persisted history for the current execution */
2565
+ /**
2566
+ * Live chronological persisted history for the current execution. With
2567
+ * the active prompt's `historyLimit`, only its newest window of
2568
+ * top-level messages (see `PromptDefinition.historyLimit`).
2569
+ */
2566
2570
  readonly messageHistory: Message[];
2567
2571
  /**
2568
2572
  * Force a specific side to play the next turn.
@@ -4380,6 +4384,19 @@ interface PromptDefinition<N extends string = string, S extends ToolArgs = ToolA
4380
4384
  * @default 10
4381
4385
  */
4382
4386
  recentImageThreshold?: number;
4387
+ /**
4388
+ * Bound the stored chat history a request loads (with `includeChat`):
4389
+ * only the newest top-level messages, at least `historyLimit` and fewer
4390
+ * than twice it. The cut moves `historyLimit` messages at a time, never
4391
+ * per message, so the loaded rows stay the same between steps and a
4392
+ * provider's prompt cache stays warm; a `filter_messages` window that
4393
+ * moves in steps dividing `historyLimit` keeps the same messages it
4394
+ * would keep over the whole history. The window is the execution's
4395
+ * history itself, not only the request: `execution.messageHistory`, tools,
4396
+ * hooks and `filter_messages` all see just these rows. Stored history is
4397
+ * untouched. Unset loads the whole history.
4398
+ */
4399
+ historyLimit?: number;
4383
4400
  /**
4384
4401
  * Provider-specific options passed through to the provider.
4385
4402
  * These override model-level providerOptions for this prompt.
@@ -5863,7 +5880,8 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
5863
5880
  * Called exactly once per model-context assembly on a stable snapshot of
5864
5881
  * eligible persisted history.
5865
5882
  *
5866
- * Receives raw message rows from storage before any transformation.
5883
+ * Receives raw message rows from storage before any transformation:
5884
+ * with the prompt's `historyLimit`, only its newest window of them.
5867
5885
  * Use for filtering, sorting, or augmenting message history.
5868
5886
  * The result is the request context and does not replace
5869
5887
  * `state.execution.messageHistory`. Messages injected while this hook runs
package/dist/index.js CHANGED
@@ -216,6 +216,9 @@ function definePrompt(options) {
216
216
  if (options.recentImageThreshold !== void 0 && (options.recentImageThreshold <= 0 || !Number.isInteger(options.recentImageThreshold))) {
217
217
  throw new Error("recentImageThreshold must be a positive integer");
218
218
  }
219
+ if (options.historyLimit !== void 0 && (options.historyLimit <= 0 || !Number.isInteger(options.historyLimit))) {
220
+ throw new Error("historyLimit must be a positive integer");
221
+ }
219
222
  const normalizedVariables = Array.isArray(options.variables) ? options.variables.map((entry) => ({
220
223
  name: entry.name,
221
224
  type: entry.type === "secret" ? "secret" : "text",