Skip to content

Commit d79ddab

Browse files
committed
fix(api): include systemBlocks on exported AgentOptions interface
1 parent d8b052f commit d79ddab

91 files changed

Lines changed: 1565 additions & 389 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

db_data/app.sqlite3

0 Bytes
Binary file not shown.

dist/api/agent.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ export interface AgentOptions extends BaseAgentConfig {
7474
* Skill content is appended to the system prompt as markdown sections.
7575
*/
7676
skills?: SkillEntry[];
77+
/**
78+
* Structured system prompt blocks with cache breakpoints.
79+
* When provided, takes precedence over the assembled string from
80+
* `instructions`, `name`, `personality`, and `skills`.
81+
* Use this for prompt caching support with Anthropic.
82+
*/
83+
systemBlocks?: import('./generateText.js').SystemContentBlock[];
7784
}
7885
/**
7986
* A named conversation session returned by `Agent.session()`.

dist/api/agent.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/api/agent.js

Lines changed: 54 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/api/agent.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/api/generateText.d.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ export interface FallbackProviderEntry {
100100
/** Model identifier override. When omitted, the provider's default text model is used. */
101101
model?: string;
102102
}
103+
/**
104+
* A structured block of system prompt content with optional cache breakpoint.
105+
* When `cacheBreakpoint` is true, providers that support prompt caching
106+
* (e.g., Anthropic) will mark this block's boundary for caching.
107+
*/
108+
export interface SystemContentBlock {
109+
/** The text content of this block. */
110+
text: string;
111+
/** When true, marks the end of this block as a cache boundary. */
112+
cacheBreakpoint?: boolean;
113+
}
103114
export interface GenerateTextOptions {
104115
/**
105116
* Provider name. When supplied without `model`, the default text model for
@@ -118,8 +129,8 @@ export interface GenerateTextOptions {
118129
model?: string;
119130
/** Single user turn to append after any `messages`. Convenience alternative to building a `messages` array. */
120131
prompt?: string;
121-
/** System prompt injected as the first message. */
122-
system?: string;
132+
/** System prompt injected as the first message. Accepts a plain string or structured blocks with cache breakpoints. */
133+
system?: string | SystemContentBlock[];
123134
/** Full conversation history. Appended before `prompt` when both are supplied. */
124135
messages?: Message[];
125136
/**
@@ -280,8 +291,8 @@ export interface GenerateTextResult {
280291
export interface GenerationHookContext {
281292
/** Current messages array (system + conversation + user). */
282293
messages: Message[];
283-
/** System prompt text. */
284-
system: string | undefined;
294+
/** System prompt — plain string or structured blocks with cache breakpoints. */
295+
system: string | SystemContentBlock[] | undefined;
285296
/** Tool definitions available for this step. */
286297
tools: ITool[];
287298
/** Resolved model ID. */
@@ -326,7 +337,7 @@ export interface ToolCallHookInfo {
326337
* tools are available and `chainOfThought` is enabled. Encourages the model
327338
* to reason explicitly before selecting a tool or crafting a response.
328339
*/
329-
export declare const DEFAULT_COT_INSTRUCTION = "Before choosing an action, briefly reason about what you need to do and why. Consider:\n1. What information do you already have?\n2. What information do you need?\n3. Which tool is most appropriate and why?\nThen proceed with your tool call or response.";
340+
export declare const DEFAULT_COT_INSTRUCTION = "Before choosing an action, briefly reason about what you need to do and why. Consider:\n1. What information do you already have?\n2. What information do you need?\n3. Which tool is most appropriate and why?\n4. How does your communication style (from the Personality section, if present) influence how you should frame your response?\nThen proceed with your tool call or response.";
330341
/**
331342
* Resolves the chain-of-thought instruction from the `chainOfThought` option.
332343
*

0 commit comments

Comments
 (0)