@theokit/sdk 2.23.0 → 2.24.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 +28 -0
- package/dist/a2a/index.cjs +3 -1
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +3 -1
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-Bpt_1khA.d.cts → cron-Bd2oRD7A.d.cts} +1 -1
- package/dist/{cron-7CruUd_0.d.ts → cron-vjod0qVQ.d.ts} +1 -1
- package/dist/cron.cjs +3 -1
- 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 +3 -1
- package/dist/cron.js.map +1 -1
- package/dist/define-tool.d.ts +33 -20
- package/dist/{errors-CkCaIqVP.d.cts → errors-DIKBXffg.d.cts} +1 -1
- package/dist/{errors-BuwwkrAk.d.ts → errors-DRS-kqOK.d.ts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +3 -1
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +3 -1
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -26
- package/dist/index.d.ts +37 -26
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/{run-CrIulPF7.d.cts → run-Cr0C6cOM.d.cts} +17 -0
- package/dist/{run-CrIulPF7.d.ts → run-Cr0C6cOM.d.ts} +17 -0
- package/dist/types/run.d.ts +17 -0
- package/dist/workflow.cjs +37 -0
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +47 -1
- package/dist/workflow.d.ts +47 -1
- package/dist/workflow.js +37 -2
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7be1f18: **SE16 — `outputSchema` on `defineTool` (validate + infer the tool's return).**
|
|
8
|
+
|
|
9
|
+
`defineTool` (from `@theokit/sdk`) gains an optional `outputSchema` (a Zod schema). When set, the handler returns the STRUCTURED output inferred from it (`z.infer<outputSchema>`), the value is validated against the schema, and the tool result becomes its serialization — a string stays as-is, an object is JSON-stringified. A validation failure raises `ZodError` (converted to a `tool_result(isError)`), so a malformed tool output fails loudly instead of silently reaching the model.
|
|
10
|
+
|
|
11
|
+
Additive + fully backward-compatible: with no `outputSchema` the handler returns a plain `string` exactly as before (the handler return type is `string` when `outputSchema` is absent, `z.infer<outputSchema>` when present, via a conditional type). Mirrors Mastra `createTool`'s `outputSchema`. Pairs with SE17 (`toModelOutput`). From the Mastra Tools comparison (SDK Evolution roadmap SE16).
|
|
12
|
+
|
|
13
|
+
- f621734: **SE17 — `toModelOutput` on `defineTool` (model-facing vs app-facing output split).**
|
|
14
|
+
|
|
15
|
+
`defineTool` (from `@theokit/sdk`) gains an optional `toModelOutput`. The handler returns the FULL result (validated by SE16's `outputSchema`); `toModelOutput(output)` maps it to the compact / multimodal representation the MODEL sees in the `tool_result` — so rich app-facing detail is not forced into model context. It returns a `string` OR SE7 `ToolResultContentBlock[]` (text + image). Absent ⇒ the tool result is the serialized handler output (SE16 / pre-SE17 behavior, unchanged).
|
|
16
|
+
|
|
17
|
+
Mirrors Mastra's `toModelOutput` and the Vercel AI SDK. Additive + backward-compatible. From the Mastra Tools comparison (SDK Evolution roadmap SE17).
|
|
18
|
+
|
|
19
|
+
- 72435db: **SE18 — `SendOptions.activeTools` (per-send runtime tool subset).**
|
|
20
|
+
|
|
21
|
+
`agent.send(input, { activeTools })` restricts, per send, which of the agent's registered tools the model may actually call. A tool whose canonical name is not in the list is vetoed at dispatch (its handler never runs) — reusing the existing `withToolWhitelist` path that `Agent.fork`'s `allowedTools` uses, NOT `PermissionEngine`. Composes with `toolChoice`: `activeTools` narrows the set, `toolChoice` gates calling within it. Absent ⇒ the full toolset is available (unchanged).
|
|
22
|
+
|
|
23
|
+
The loop runs inside a `withToolWhitelist(new Set(activeTools))` scope when set. Additive + backward-compatible. Mirrors Mastra `activeTools` + the Vercel AI SDK. From the Mastra Tools comparison (SDK Evolution roadmap SE18).
|
|
24
|
+
|
|
25
|
+
- f92f720: **SE19 — `workflowAsTool` (expose a Workflow as an agent tool).**
|
|
26
|
+
|
|
27
|
+
`workflowAsTool(workflow, { name, description, inputSchema })` (from `@theokit/sdk/workflow`) turns a `Workflow` into an agent `CustomTool`, completing the Mastra "X as tools" trio (tools; agents-as-tools via `defineSubAgent`; workflows-as-tools). The handler validates the model's args against `spec.inputSchema`, runs the workflow, and returns its output (a string as-is, else JSON). A run that does not reach `status: "completed"` raises a typed `WorkflowToolError` (workflow step errors do NOT throw — they surface via `run.status === "failed"`).
|
|
28
|
+
|
|
29
|
+
Because a `Workflow` carries no top-level schema (`WorkflowOptions` is `name`/`persistence`/`workflowId`; schemas are per-step), the caller supplies the tool `inputSchema` in the spec (like `defineTool`). Accepts any `{ run }`-shaped workflow (structural), so it never imports the `Workflow` class. New exports: `workflowAsTool`, `WorkflowToolError`, `WorkflowAsToolSpec`. Additive. From the Mastra Tools comparison (SDK Evolution roadmap SE19).
|
|
30
|
+
|
|
3
31
|
## 2.23.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/dist/a2a/index.cjs
CHANGED
|
@@ -12922,6 +12922,7 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
12922
12922
|
...options.onStep !== void 0 ? { onStep: options.onStep } : {},
|
|
12923
12923
|
...options.onDelta !== void 0 ? { onDelta: options.onDelta } : {},
|
|
12924
12924
|
...options.sendOptions.toolChoice !== void 0 ? { toolChoice: options.sendOptions.toolChoice } : {},
|
|
12925
|
+
...options.sendOptions.activeTools !== void 0 ? { activeTools: options.sendOptions.activeTools } : {},
|
|
12925
12926
|
...options.priorMessages !== void 0 ? { priorMessages: options.priorMessages } : {},
|
|
12926
12927
|
...options.memoryTools !== void 0 && options.memoryTools.length > 0 ? { memoryTools: options.memoryTools } : {},
|
|
12927
12928
|
...buildCustomToolsInput(
|
|
@@ -13021,6 +13022,7 @@ var init_real_local_run = __esm({
|
|
|
13021
13022
|
init_register_plugin_providers();
|
|
13022
13023
|
init_tracer();
|
|
13023
13024
|
init_personality_filter();
|
|
13025
|
+
init_async_local_storage();
|
|
13024
13026
|
init_fixture_run_base();
|
|
13025
13027
|
init_run_registry();
|
|
13026
13028
|
pluginProvidersAnnounced = false;
|
|
@@ -13070,7 +13072,7 @@ var init_real_local_run = __esm({
|
|
|
13070
13072
|
}
|
|
13071
13073
|
async executeAgentLoop(inputs) {
|
|
13072
13074
|
try {
|
|
13073
|
-
const output = await runAgentLoop(inputs);
|
|
13075
|
+
const output = inputs.activeTools !== void 0 ? await withToolWhitelist(new Set(inputs.activeTools), () => runAgentLoop(inputs)) : await runAgentLoop(inputs);
|
|
13074
13076
|
this.applyAgentLoopOutput(output);
|
|
13075
13077
|
this.transitionTo(output.finalStatus);
|
|
13076
13078
|
} catch (cause) {
|