@theokit/sdk 2.21.0 → 2.23.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.
- package/CHANGELOG.md +57 -0
- package/dist/a2a/index.cjs +99 -19
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +2 -1
- package/dist/a2a/index.d.ts +2 -1
- package/dist/a2a/index.js +99 -19
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/subagent.d.cts +95 -1
- package/dist/a2a/subagent.d.ts +95 -1
- package/dist/{cron-dpvtRoro.d.ts → cron-7CruUd_0.d.ts} +1 -1
- package/dist/{cron-YrmsszEN.d.cts → cron-Bpt_1khA.d.cts} +1 -1
- package/dist/cron.cjs +16 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +16 -6
- package/dist/cron.js.map +1 -1
- package/dist/{errors-C4vZPqXf.d.ts → errors-BuwwkrAk.d.ts} +1 -1
- package/dist/{errors-DrcpYVfZ.d.cts → errors-CkCaIqVP.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +16 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +16 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +16 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/{run-BMo8yRwK.d.cts → run-CrIulPF7.d.cts} +22 -2
- package/dist/{run-BMo8yRwK.d.ts → run-CrIulPF7.d.ts} +22 -2
- package/dist/types/agent-prims.d.ts +21 -1
- package/dist/types/agent.d.ts +1 -1
- package/package.json +1 -1
|
@@ -186,6 +186,23 @@ interface ModelSelection {
|
|
|
186
186
|
id: string;
|
|
187
187
|
params?: ModelParameterValue[];
|
|
188
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* SE12 — a read-only, text-only projection of one turn of the run's conversation,
|
|
191
|
+
* exposed to a tool handler via `ctx.messages`. Content is flattened to text; tool
|
|
192
|
+
* calls / results and non-text parts are dropped, and turns that project to empty
|
|
193
|
+
* text are omitted. Consumed by `defineSubAgent`'s `messageFilter` to forward
|
|
194
|
+
* (a subset of) the supervisor transcript to a subagent.
|
|
195
|
+
*
|
|
196
|
+
* `role` includes `"system"` for type-completeness with the wire message shape,
|
|
197
|
+
* but the system prompt travels on a separate request field — a `"system"` entry
|
|
198
|
+
* does NOT appear in the current projection.
|
|
199
|
+
*
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
interface ToolContextMessage {
|
|
203
|
+
role: "system" | "user" | "assistant";
|
|
204
|
+
content: string;
|
|
205
|
+
}
|
|
189
206
|
/**
|
|
190
207
|
* Local function tool declared per-agent via {@link AgentOptions.tools}. The
|
|
191
208
|
* handler runs in-process; no MCP server is involved. The SDK serializes
|
|
@@ -217,11 +234,14 @@ interface CustomTool {
|
|
|
217
234
|
* carries the run's `AbortSignal`; single-argument handlers are unaffected. M7
|
|
218
235
|
* — the same `ctx` also carries an optional user `context` (provided once via
|
|
219
236
|
* `SendOptions.context`), so shared config like a `projectRoot` is read by
|
|
220
|
-
* every tool instead of baked into each factory.
|
|
237
|
+
* every tool instead of baked into each factory. SE12 — `ctx.messages` is a
|
|
238
|
+
* read-only, text-only projection of the current turn's transcript (see
|
|
239
|
+
* {@link ToolContextMessage}); `defineSubAgent`'s `messageFilter` consumes it.
|
|
221
240
|
*/
|
|
222
241
|
handler: (input: Record<string, unknown>, ctx?: {
|
|
223
242
|
signal?: AbortSignal;
|
|
224
243
|
context?: unknown;
|
|
244
|
+
messages?: readonly ToolContextMessage[];
|
|
225
245
|
}) => string | ToolResultContentBlock[] | Promise<string | ToolResultContentBlock[]>;
|
|
226
246
|
}
|
|
227
247
|
|
|
@@ -1253,4 +1273,4 @@ interface GenerateRunResult<O> {
|
|
|
1253
1273
|
};
|
|
1254
1274
|
}
|
|
1255
1275
|
|
|
1256
|
-
export { type SendOptions as $, type AgentConversationTurn as A, type RunTaskStartedEvent as B, type CustomTool as C, type DoomLoopThresholds as D, type RunTaskUpdatedEvent as E, type RunToCompletionOptions as F, type GenerateOptions as G, type RunToCompletionResult as H, type ImageBlock as I, type RunToolProgressEvent as J, type SDKAssistantMessage as K, type SDKImage as L, type ModelSelection as M, type SDKImageDimension as N, type SDKObjectDelta as O, type PartialToolCallUpdate as P, type SDKRequestMessage as Q, type RunResult as R, type SDKMessage as S, type ToolResultContentBlock as T, type SDKStatusMessage as U, type SDKSystemMessage as V, type SDKTaskMessage as W, type SDKThinkingMessage as X, type SDKToolUseMessage as Y, type SDKUserMessage as Z, type SDKUserMessageEvent as _, type McpServerConfig as a, type ShellCommand as a0, type ShellConversationTurn as a1, type ShellOutput as a2, type ShellOutputDeltaUpdate as a3, type StepCompletedUpdate as a4, type StepStartedUpdate as a5, type StreamToCompletionResult as a6, type SummaryCompletedUpdate as a7, type SummaryStartedUpdate as a8, type SummaryUpdate as a9, type TextBlock as aa, type TextDeltaUpdate as ab, type ThinkingCompletedUpdate as ac, type ThinkingDeltaUpdate as ad, type ThinkingMessage as ae, type TokenDeltaUpdate as af, type TokenUsage as ag, type ToolCall as ah, type ToolCallCompletedUpdate as ai, type ToolCallStartedUpdate as aj, type
|
|
1276
|
+
export { type SendOptions as $, type AgentConversationTurn as A, type RunTaskStartedEvent as B, type CustomTool as C, type DoomLoopThresholds as D, type RunTaskUpdatedEvent as E, type RunToCompletionOptions as F, type GenerateOptions as G, type RunToCompletionResult as H, type ImageBlock as I, type RunToolProgressEvent as J, type SDKAssistantMessage as K, type SDKImage as L, type ModelSelection as M, type SDKImageDimension as N, type SDKObjectDelta as O, type PartialToolCallUpdate as P, type SDKRequestMessage as Q, type RunResult as R, type SDKMessage as S, type ToolResultContentBlock as T, type SDKStatusMessage as U, type SDKSystemMessage as V, type SDKTaskMessage as W, type SDKThinkingMessage as X, type SDKToolUseMessage as Y, type SDKUserMessage as Z, type SDKUserMessageEvent as _, type McpServerConfig as a, type ShellCommand as a0, type ShellConversationTurn as a1, type ShellOutput as a2, type ShellOutputDeltaUpdate as a3, type StepCompletedUpdate as a4, type StepStartedUpdate as a5, type StreamToCompletionResult as a6, type SummaryCompletedUpdate as a7, type SummaryStartedUpdate as a8, type SummaryUpdate as a9, type TextBlock as aa, type TextDeltaUpdate as ab, type ThinkingCompletedUpdate as ac, type ThinkingDeltaUpdate as ad, type ThinkingMessage as ae, type TokenDeltaUpdate as af, type TokenUsage as ag, type ToolCall as ah, type ToolCallCompletedUpdate as ai, type ToolCallStartedUpdate as aj, type ToolContextMessage as ak, type ToolResult as al, type ToolResultGuardOptions as am, type ToolUseBlock as an, type TurnEndedUpdate as ao, type UserMessage as ap, type UserMessageAppendedUpdate as aq, emitRunEvent as ar, type Run as b, type MessageOrigin as c, type AssistantMessage as d, type ConversationStep as e, type ConversationTurn as f, type CostBreakdown as g, type CostSource as h, type CostStatus as i, type GenerateRunResult as j, type InteractionUpdate as k, type McpAuthConfig as l, type McpHttpServerConfig as m, type McpOAuthConfig as n, type McpStdioServerConfig as o, type ModelParameterValue as p, type RunCompactBoundaryEvent as q, type RunErrorDetail as r, type RunEvent as s, type RunEventSink as t, type RunGitInfo as u, type RunOperation as v, type RunPermissionDeniedEvent as w, type RunRateLimitEvent as x, type RunStatus as y, type RunTaskCompletedEvent as z };
|
|
@@ -186,6 +186,23 @@ interface ModelSelection {
|
|
|
186
186
|
id: string;
|
|
187
187
|
params?: ModelParameterValue[];
|
|
188
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* SE12 — a read-only, text-only projection of one turn of the run's conversation,
|
|
191
|
+
* exposed to a tool handler via `ctx.messages`. Content is flattened to text; tool
|
|
192
|
+
* calls / results and non-text parts are dropped, and turns that project to empty
|
|
193
|
+
* text are omitted. Consumed by `defineSubAgent`'s `messageFilter` to forward
|
|
194
|
+
* (a subset of) the supervisor transcript to a subagent.
|
|
195
|
+
*
|
|
196
|
+
* `role` includes `"system"` for type-completeness with the wire message shape,
|
|
197
|
+
* but the system prompt travels on a separate request field — a `"system"` entry
|
|
198
|
+
* does NOT appear in the current projection.
|
|
199
|
+
*
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
interface ToolContextMessage {
|
|
203
|
+
role: "system" | "user" | "assistant";
|
|
204
|
+
content: string;
|
|
205
|
+
}
|
|
189
206
|
/**
|
|
190
207
|
* Local function tool declared per-agent via {@link AgentOptions.tools}. The
|
|
191
208
|
* handler runs in-process; no MCP server is involved. The SDK serializes
|
|
@@ -217,11 +234,14 @@ interface CustomTool {
|
|
|
217
234
|
* carries the run's `AbortSignal`; single-argument handlers are unaffected. M7
|
|
218
235
|
* — the same `ctx` also carries an optional user `context` (provided once via
|
|
219
236
|
* `SendOptions.context`), so shared config like a `projectRoot` is read by
|
|
220
|
-
* every tool instead of baked into each factory.
|
|
237
|
+
* every tool instead of baked into each factory. SE12 — `ctx.messages` is a
|
|
238
|
+
* read-only, text-only projection of the current turn's transcript (see
|
|
239
|
+
* {@link ToolContextMessage}); `defineSubAgent`'s `messageFilter` consumes it.
|
|
221
240
|
*/
|
|
222
241
|
handler: (input: Record<string, unknown>, ctx?: {
|
|
223
242
|
signal?: AbortSignal;
|
|
224
243
|
context?: unknown;
|
|
244
|
+
messages?: readonly ToolContextMessage[];
|
|
225
245
|
}) => string | ToolResultContentBlock[] | Promise<string | ToolResultContentBlock[]>;
|
|
226
246
|
}
|
|
227
247
|
|
|
@@ -1253,4 +1273,4 @@ interface GenerateRunResult<O> {
|
|
|
1253
1273
|
};
|
|
1254
1274
|
}
|
|
1255
1275
|
|
|
1256
|
-
export { type SendOptions as $, type AgentConversationTurn as A, type RunTaskStartedEvent as B, type CustomTool as C, type DoomLoopThresholds as D, type RunTaskUpdatedEvent as E, type RunToCompletionOptions as F, type GenerateOptions as G, type RunToCompletionResult as H, type ImageBlock as I, type RunToolProgressEvent as J, type SDKAssistantMessage as K, type SDKImage as L, type ModelSelection as M, type SDKImageDimension as N, type SDKObjectDelta as O, type PartialToolCallUpdate as P, type SDKRequestMessage as Q, type RunResult as R, type SDKMessage as S, type ToolResultContentBlock as T, type SDKStatusMessage as U, type SDKSystemMessage as V, type SDKTaskMessage as W, type SDKThinkingMessage as X, type SDKToolUseMessage as Y, type SDKUserMessage as Z, type SDKUserMessageEvent as _, type McpServerConfig as a, type ShellCommand as a0, type ShellConversationTurn as a1, type ShellOutput as a2, type ShellOutputDeltaUpdate as a3, type StepCompletedUpdate as a4, type StepStartedUpdate as a5, type StreamToCompletionResult as a6, type SummaryCompletedUpdate as a7, type SummaryStartedUpdate as a8, type SummaryUpdate as a9, type TextBlock as aa, type TextDeltaUpdate as ab, type ThinkingCompletedUpdate as ac, type ThinkingDeltaUpdate as ad, type ThinkingMessage as ae, type TokenDeltaUpdate as af, type TokenUsage as ag, type ToolCall as ah, type ToolCallCompletedUpdate as ai, type ToolCallStartedUpdate as aj, type
|
|
1276
|
+
export { type SendOptions as $, type AgentConversationTurn as A, type RunTaskStartedEvent as B, type CustomTool as C, type DoomLoopThresholds as D, type RunTaskUpdatedEvent as E, type RunToCompletionOptions as F, type GenerateOptions as G, type RunToCompletionResult as H, type ImageBlock as I, type RunToolProgressEvent as J, type SDKAssistantMessage as K, type SDKImage as L, type ModelSelection as M, type SDKImageDimension as N, type SDKObjectDelta as O, type PartialToolCallUpdate as P, type SDKRequestMessage as Q, type RunResult as R, type SDKMessage as S, type ToolResultContentBlock as T, type SDKStatusMessage as U, type SDKSystemMessage as V, type SDKTaskMessage as W, type SDKThinkingMessage as X, type SDKToolUseMessage as Y, type SDKUserMessage as Z, type SDKUserMessageEvent as _, type McpServerConfig as a, type ShellCommand as a0, type ShellConversationTurn as a1, type ShellOutput as a2, type ShellOutputDeltaUpdate as a3, type StepCompletedUpdate as a4, type StepStartedUpdate as a5, type StreamToCompletionResult as a6, type SummaryCompletedUpdate as a7, type SummaryStartedUpdate as a8, type SummaryUpdate as a9, type TextBlock as aa, type TextDeltaUpdate as ab, type ThinkingCompletedUpdate as ac, type ThinkingDeltaUpdate as ad, type ThinkingMessage as ae, type TokenDeltaUpdate as af, type TokenUsage as ag, type ToolCall as ah, type ToolCallCompletedUpdate as ai, type ToolCallStartedUpdate as aj, type ToolContextMessage as ak, type ToolResult as al, type ToolResultGuardOptions as am, type ToolUseBlock as an, type TurnEndedUpdate as ao, type UserMessage as ap, type UserMessageAppendedUpdate as aq, emitRunEvent as ar, type Run as b, type MessageOrigin as c, type AssistantMessage as d, type ConversationStep as e, type ConversationTurn as f, type CostBreakdown as g, type CostSource as h, type CostStatus as i, type GenerateRunResult as j, type InteractionUpdate as k, type McpAuthConfig as l, type McpHttpServerConfig as m, type McpOAuthConfig as n, type McpStdioServerConfig as o, type ModelParameterValue as p, type RunCompactBoundaryEvent as q, type RunErrorDetail as r, type RunEvent as s, type RunEventSink as t, type RunGitInfo as u, type RunOperation as v, type RunPermissionDeniedEvent as w, type RunRateLimitEvent as x, type RunStatus as y, type RunTaskCompletedEvent as z };
|
|
@@ -30,6 +30,23 @@ export interface ModelSelection {
|
|
|
30
30
|
id: string;
|
|
31
31
|
params?: ModelParameterValue[];
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* SE12 — a read-only, text-only projection of one turn of the run's conversation,
|
|
35
|
+
* exposed to a tool handler via `ctx.messages`. Content is flattened to text; tool
|
|
36
|
+
* calls / results and non-text parts are dropped, and turns that project to empty
|
|
37
|
+
* text are omitted. Consumed by `defineSubAgent`'s `messageFilter` to forward
|
|
38
|
+
* (a subset of) the supervisor transcript to a subagent.
|
|
39
|
+
*
|
|
40
|
+
* `role` includes `"system"` for type-completeness with the wire message shape,
|
|
41
|
+
* but the system prompt travels on a separate request field — a `"system"` entry
|
|
42
|
+
* does NOT appear in the current projection.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export interface ToolContextMessage {
|
|
47
|
+
role: "system" | "user" | "assistant";
|
|
48
|
+
content: string;
|
|
49
|
+
}
|
|
33
50
|
/**
|
|
34
51
|
* Local function tool declared per-agent via {@link AgentOptions.tools}. The
|
|
35
52
|
* handler runs in-process; no MCP server is involved. The SDK serializes
|
|
@@ -61,10 +78,13 @@ export interface CustomTool {
|
|
|
61
78
|
* carries the run's `AbortSignal`; single-argument handlers are unaffected. M7
|
|
62
79
|
* — the same `ctx` also carries an optional user `context` (provided once via
|
|
63
80
|
* `SendOptions.context`), so shared config like a `projectRoot` is read by
|
|
64
|
-
* every tool instead of baked into each factory.
|
|
81
|
+
* every tool instead of baked into each factory. SE12 — `ctx.messages` is a
|
|
82
|
+
* read-only, text-only projection of the current turn's transcript (see
|
|
83
|
+
* {@link ToolContextMessage}); `defineSubAgent`'s `messageFilter` consumes it.
|
|
65
84
|
*/
|
|
66
85
|
handler: (input: Record<string, unknown>, ctx?: {
|
|
67
86
|
signal?: AbortSignal;
|
|
68
87
|
context?: unknown;
|
|
88
|
+
messages?: readonly ToolContextMessage[];
|
|
69
89
|
}) => string | import("./content-blocks.js").ToolResultContentBlock[] | Promise<string | import("./content-blocks.js").ToolResultContentBlock[]>;
|
|
70
90
|
}
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ContextSettings, SDKContextManager } from "./context.js";
|
|
|
2
2
|
import type { McpServerConfig } from "./mcp.js";
|
|
3
3
|
import type { PluginsSettings, ProviderRoutingSettings, SDKProvidersManager } from "./providers.js";
|
|
4
4
|
import type { Run, SDKUserMessage, SendOptions } from "./run.js";
|
|
5
|
-
export type { CustomTool, ModelParameterValue, ModelSelection } from "./agent-prims.js";
|
|
5
|
+
export type { CustomTool, ModelParameterValue, ModelSelection, ToolContextMessage, } from "./agent-prims.js";
|
|
6
6
|
import type { Plugin } from "../internal/plugins/types.js";
|
|
7
7
|
import type { CustomTool, ModelSelection } from "./agent-prims.js";
|
|
8
8
|
/**
|
package/package.json
CHANGED