@theokit/sdk 2.18.1 → 2.19.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.
@@ -77,10 +77,13 @@ interface CustomTool {
77
77
  * model). Throws → SDK converts to `tool_result` with `isError: true` and
78
78
  * the error `message` as content. #65 — an optional 2nd `ToolContext`
79
79
  * argument carries the run's `AbortSignal`; single-argument handlers are
80
- * unaffected.
80
+ * unaffected. M7 — the same `ctx` also carries an optional user `context`
81
+ * (provided once via `SendOptions.context`), so shared config like a
82
+ * `projectRoot` is read by every tool instead of baked into each factory.
81
83
  */
82
84
  handler: (input: Record<string, unknown>, ctx?: {
83
85
  signal?: AbortSignal;
86
+ context?: unknown;
84
87
  }) => string | Promise<string>;
85
88
  }
86
89
 
@@ -918,6 +921,15 @@ interface SendOptions {
918
921
  * @public
919
922
  */
920
923
  signal?: AbortSignal;
924
+ /**
925
+ * M7 — an opaque user `context` forwarded to every tool handler's `ctx.context`
926
+ * for this run. Set shared config (e.g. `projectRoot`) once here instead of
927
+ * baking it into each tool factory (mirrors ai-sdk `experimental_context`,
928
+ * mastra `RuntimeContext`, openai-agents-js `RunContext`).
929
+ *
930
+ * @public
931
+ */
932
+ context?: unknown;
921
933
  /**
922
934
  * #58 — per-tool execution timeout in ms. Each tool call is bounded by this
923
935
  * deadline (merged with `signal`); a hung tool yields a typed timeout result
@@ -77,10 +77,13 @@ interface CustomTool {
77
77
  * model). Throws → SDK converts to `tool_result` with `isError: true` and
78
78
  * the error `message` as content. #65 — an optional 2nd `ToolContext`
79
79
  * argument carries the run's `AbortSignal`; single-argument handlers are
80
- * unaffected.
80
+ * unaffected. M7 — the same `ctx` also carries an optional user `context`
81
+ * (provided once via `SendOptions.context`), so shared config like a
82
+ * `projectRoot` is read by every tool instead of baked into each factory.
81
83
  */
82
84
  handler: (input: Record<string, unknown>, ctx?: {
83
85
  signal?: AbortSignal;
86
+ context?: unknown;
84
87
  }) => string | Promise<string>;
85
88
  }
86
89
 
@@ -918,6 +921,15 @@ interface SendOptions {
918
921
  * @public
919
922
  */
920
923
  signal?: AbortSignal;
924
+ /**
925
+ * M7 — an opaque user `context` forwarded to every tool handler's `ctx.context`
926
+ * for this run. Set shared config (e.g. `projectRoot`) once here instead of
927
+ * baking it into each tool factory (mirrors ai-sdk `experimental_context`,
928
+ * mastra `RuntimeContext`, openai-agents-js `RunContext`).
929
+ *
930
+ * @public
931
+ */
932
+ context?: unknown;
921
933
  /**
922
934
  * #58 — per-tool execution timeout in ms. Each tool call is bounded by this
923
935
  * deadline (merged with `signal`); a hung tool yields a typed timeout result
@@ -57,9 +57,12 @@ export interface CustomTool {
57
57
  * model). Throws → SDK converts to `tool_result` with `isError: true` and
58
58
  * the error `message` as content. #65 — an optional 2nd `ToolContext`
59
59
  * argument carries the run's `AbortSignal`; single-argument handlers are
60
- * unaffected.
60
+ * unaffected. M7 — the same `ctx` also carries an optional user `context`
61
+ * (provided once via `SendOptions.context`), so shared config like a
62
+ * `projectRoot` is read by every tool instead of baked into each factory.
61
63
  */
62
64
  handler: (input: Record<string, unknown>, ctx?: {
63
65
  signal?: AbortSignal;
66
+ context?: unknown;
64
67
  }) => string | Promise<string>;
65
68
  }
@@ -268,6 +268,15 @@ export interface SendOptions {
268
268
  * @public
269
269
  */
270
270
  signal?: AbortSignal;
271
+ /**
272
+ * M7 — an opaque user `context` forwarded to every tool handler's `ctx.context`
273
+ * for this run. Set shared config (e.g. `projectRoot`) once here instead of
274
+ * baking it into each tool factory (mirrors ai-sdk `experimental_context`,
275
+ * mastra `RuntimeContext`, openai-agents-js `RunContext`).
276
+ *
277
+ * @public
278
+ */
279
+ context?: unknown;
271
280
  /**
272
281
  * #58 — per-tool execution timeout in ms. Each tool call is bounded by this
273
282
  * deadline (merged with `signal`); a hung tool yields a typed timeout result
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "2.18.1",
3
+ "version": "2.19.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",