@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 +6 -0
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -576,6 +576,29 @@ interface CreateReadFileToolOptions {
|
|
|
576
576
|
}
|
|
577
577
|
declare function createReadFileTool(opts: CreateReadFileToolOptions): CustomTool;
|
|
578
578
|
|
|
579
|
+
/**
|
|
580
|
+
* SE37 — the public reasoning toolkit: `ReasoningTools.create()` returns a
|
|
581
|
+
* `think` + `analyze` scratchpad (no-side-effect tools that echo the model's
|
|
582
|
+
* structured reasoning back as an observation, so the ReAct loop feeds it
|
|
583
|
+
* forward). Mirrors Anthropic's "think" tool + Agno's `ReasoningTools`.
|
|
584
|
+
*
|
|
585
|
+
* Lives in `@theokit/sdk-tools` (not core) so the full toolkit stays out of the
|
|
586
|
+
* core bundle. The `reasoning: true` agent flag auto-attaches an equivalent
|
|
587
|
+
* lean `think` from core; add these explicitly (`tools: [...ReasoningTools.create()]`)
|
|
588
|
+
* when you want the model to reason with a scratchpad on any model.
|
|
589
|
+
*
|
|
590
|
+
* @public
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
/** Reasoning scratchpad tools. `ReasoningTools.create()` → `[think, analyze]`. */
|
|
594
|
+
declare class ReasoningTools {
|
|
595
|
+
private constructor();
|
|
596
|
+
/** Build the tools. Pass `{ analyze: false }` for `think` only. */
|
|
597
|
+
static create(opts?: {
|
|
598
|
+
analyze?: boolean;
|
|
599
|
+
}): CustomTool[];
|
|
600
|
+
}
|
|
601
|
+
|
|
579
602
|
/**
|
|
580
603
|
* `run_vitest` — built-in tool for coding agents.
|
|
581
604
|
*
|
|
@@ -930,4 +953,4 @@ interface CreateWriteFileToolOptions {
|
|
|
930
953
|
}
|
|
931
954
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
932
955
|
|
|
933
|
-
export { CatastrophicCommandError, type CommandPolicy, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withShellExitGuidance, withToolResultGuidance };
|
|
956
|
+
export { CatastrophicCommandError, type CommandPolicy, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withShellExitGuidance, withToolResultGuidance };
|
package/dist/index.d.ts
CHANGED
|
@@ -576,6 +576,29 @@ interface CreateReadFileToolOptions {
|
|
|
576
576
|
}
|
|
577
577
|
declare function createReadFileTool(opts: CreateReadFileToolOptions): CustomTool;
|
|
578
578
|
|
|
579
|
+
/**
|
|
580
|
+
* SE37 — the public reasoning toolkit: `ReasoningTools.create()` returns a
|
|
581
|
+
* `think` + `analyze` scratchpad (no-side-effect tools that echo the model's
|
|
582
|
+
* structured reasoning back as an observation, so the ReAct loop feeds it
|
|
583
|
+
* forward). Mirrors Anthropic's "think" tool + Agno's `ReasoningTools`.
|
|
584
|
+
*
|
|
585
|
+
* Lives in `@theokit/sdk-tools` (not core) so the full toolkit stays out of the
|
|
586
|
+
* core bundle. The `reasoning: true` agent flag auto-attaches an equivalent
|
|
587
|
+
* lean `think` from core; add these explicitly (`tools: [...ReasoningTools.create()]`)
|
|
588
|
+
* when you want the model to reason with a scratchpad on any model.
|
|
589
|
+
*
|
|
590
|
+
* @public
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
/** Reasoning scratchpad tools. `ReasoningTools.create()` → `[think, analyze]`. */
|
|
594
|
+
declare class ReasoningTools {
|
|
595
|
+
private constructor();
|
|
596
|
+
/** Build the tools. Pass `{ analyze: false }` for `think` only. */
|
|
597
|
+
static create(opts?: {
|
|
598
|
+
analyze?: boolean;
|
|
599
|
+
}): CustomTool[];
|
|
600
|
+
}
|
|
601
|
+
|
|
579
602
|
/**
|
|
580
603
|
* `run_vitest` — built-in tool for coding agents.
|
|
581
604
|
*
|
|
@@ -930,4 +953,4 @@ interface CreateWriteFileToolOptions {
|
|
|
930
953
|
}
|
|
931
954
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
932
955
|
|
|
933
|
-
export { CatastrophicCommandError, type CommandPolicy, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withShellExitGuidance, withToolResultGuidance };
|
|
956
|
+
export { CatastrophicCommandError, type CommandPolicy, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withShellExitGuidance, withToolResultGuidance };
|
package/dist/index.js
CHANGED
|
@@ -1433,6 +1433,37 @@ function evaluateReadBeforeWrite(tracker, path, currentMtimeMs) {
|
|
|
1433
1433
|
if (recorded !== currentMtimeMs) return "stale";
|
|
1434
1434
|
return "ok";
|
|
1435
1435
|
}
|
|
1436
|
+
var ReasoningTools = class {
|
|
1437
|
+
constructor() {
|
|
1438
|
+
}
|
|
1439
|
+
/** Build the tools. Pass `{ analyze: false }` for `think` only. */
|
|
1440
|
+
static create(opts) {
|
|
1441
|
+
const think = Tool.create({
|
|
1442
|
+
name: "think",
|
|
1443
|
+
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.",
|
|
1444
|
+
inputSchema: z.object({
|
|
1445
|
+
thought: z.string().min(1, "think: `thought` must be a non-empty string.")
|
|
1446
|
+
}),
|
|
1447
|
+
handler: ({ thought }) => thought
|
|
1448
|
+
});
|
|
1449
|
+
if (opts?.analyze === false) return [think];
|
|
1450
|
+
const analyze = Tool.create({
|
|
1451
|
+
name: "analyze",
|
|
1452
|
+
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.",
|
|
1453
|
+
inputSchema: z.object({
|
|
1454
|
+
title: z.string().optional(),
|
|
1455
|
+
result: z.string().min(1, "analyze: `result` must describe what you are analyzing."),
|
|
1456
|
+
analysis: z.string().min(1, "analyze: `analysis` must contain your reasoning."),
|
|
1457
|
+
next_action: z.enum(["continue", "validate", "final_answer"])
|
|
1458
|
+
}),
|
|
1459
|
+
handler: ({ title, result, analysis, next_action }) => `${title ? `# ${title}
|
|
1460
|
+
` : ""}Result: ${result}
|
|
1461
|
+
Analysis: ${analysis}
|
|
1462
|
+
Next: ${next_action}`
|
|
1463
|
+
});
|
|
1464
|
+
return [think, analyze];
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1436
1467
|
var DEFAULT_TIMEOUT_MS2 = 12e4;
|
|
1437
1468
|
var DEFAULT_MAX_STDOUT_BYTES2 = 10 * 1024 * 1024;
|
|
1438
1469
|
function createRunVitestTool(opts) {
|
|
@@ -2192,6 +2223,6 @@ async function isBinaryFile(absolutePath) {
|
|
|
2192
2223
|
}
|
|
2193
2224
|
}
|
|
2194
2225
|
|
|
2195
|
-
export { CatastrophicCommandError, DEFAULT_TOOL_GUIDANCE, ReadTracker, RedirectBlockedError, SsrfBlockedError, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withShellExitGuidance, withToolResultGuidance };
|
|
2226
|
+
export { CatastrophicCommandError, DEFAULT_TOOL_GUIDANCE, ReadTracker, ReasoningTools, RedirectBlockedError, SsrfBlockedError, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withShellExitGuidance, withToolResultGuidance };
|
|
2196
2227
|
//# sourceMappingURL=index.js.map
|
|
2197
2228
|
//# sourceMappingURL=index.js.map
|