@theokit/sdk-tools 0.9.1 → 0.10.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2606c98: SE37 — Reasoning ergonomics. Ships `ReasoningTools.create()` (`think`/`analyze` scratchpad tools, from `@theokit/sdk` core, re-exported by `@theokit/sdk-tools`) and a lightweight `AgentOptions.reasoning?: boolean` flag. When `reasoning: true`, the agent gets a chain-of-thought preamble prepended to its system prompt AND the reasoning tools auto-attached, turning a non-reasoning model into a reason→act→observe loop using the SAME model (reuses the existing tool loop; no new runtime). Inert (with a one-time warn) when a native reasoning model is configured (`model.params: [{ id: "thinking" }]`) — native reasoning wins, no double-reasoning. Default off; byte-identical behaviour when unset. Validated REAL on OpenRouter: `reasoning: true` drove the `think` tool and answered the "9.11 vs 9.9" trap correctly (9.9).
8
+
3
9
  ## 0.9.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1435,6 +1435,37 @@ function evaluateReadBeforeWrite(tracker, path, currentMtimeMs) {
1435
1435
  if (recorded !== currentMtimeMs) return "stale";
1436
1436
  return "ok";
1437
1437
  }
1438
+ var ReasoningTools = class {
1439
+ constructor() {
1440
+ }
1441
+ /** Build the tools. Pass `{ analyze: false }` for `think` only. */
1442
+ static create(opts) {
1443
+ const think = sdk.Tool.create({
1444
+ name: "think",
1445
+ description: "Use this as a scratchpad to think step by step BEFORE answering or acting. Write out your reasoning for one step. Nothing else happens \u2014 it is only your private reasoning space. Call it as many times as you need before the final answer.",
1446
+ inputSchema: zod.z.object({
1447
+ thought: zod.z.string().min(1, "think: `thought` must be a non-empty string.")
1448
+ }),
1449
+ handler: ({ thought }) => thought
1450
+ });
1451
+ if (opts?.analyze === false) return [think];
1452
+ const analyze = sdk.Tool.create({
1453
+ name: "analyze",
1454
+ description: "Analyze the result of a previous step or tool call. State what you looked at, your analysis, and whether to `continue` reasoning, `validate` (double-check) your work, or give the `final_answer`. Use this to catch your own mistakes before answering.",
1455
+ inputSchema: zod.z.object({
1456
+ title: zod.z.string().optional(),
1457
+ result: zod.z.string().min(1, "analyze: `result` must describe what you are analyzing."),
1458
+ analysis: zod.z.string().min(1, "analyze: `analysis` must contain your reasoning."),
1459
+ next_action: zod.z.enum(["continue", "validate", "final_answer"])
1460
+ }),
1461
+ handler: ({ title, result, analysis, next_action }) => `${title ? `# ${title}
1462
+ ` : ""}Result: ${result}
1463
+ Analysis: ${analysis}
1464
+ Next: ${next_action}`
1465
+ });
1466
+ return [think, analyze];
1467
+ }
1468
+ };
1438
1469
  var DEFAULT_TIMEOUT_MS2 = 12e4;
1439
1470
  var DEFAULT_MAX_STDOUT_BYTES2 = 10 * 1024 * 1024;
1440
1471
  function createRunVitestTool(opts) {
@@ -2197,6 +2228,7 @@ async function isBinaryFile(absolutePath) {
2197
2228
  exports.CatastrophicCommandError = CatastrophicCommandError;
2198
2229
  exports.DEFAULT_TOOL_GUIDANCE = DEFAULT_TOOL_GUIDANCE;
2199
2230
  exports.ReadTracker = ReadTracker;
2231
+ exports.ReasoningTools = ReasoningTools;
2200
2232
  exports.RedirectBlockedError = RedirectBlockedError;
2201
2233
  exports.SsrfBlockedError = SsrfBlockedError;
2202
2234
  exports.buildEnvContext = buildEnvContext;