@theokit/sdk-tools 0.11.0 → 0.12.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 +11 -2
- package/README.md +1 -1
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
package/dist/index.d.cts
CHANGED
|
@@ -339,6 +339,17 @@ declare function catastrophicShellReason(command: string): string | null;
|
|
|
339
339
|
* name/inputSchema/handler; does NOT mutate the original tool.
|
|
340
340
|
*/
|
|
341
341
|
declare function withDescription(tool: CustomTool, description: string): CustomTool;
|
|
342
|
+
/**
|
|
343
|
+
* Return a new `CustomTool` exposed under a different `name`, sharing the SAME
|
|
344
|
+
* `inputSchema` + `handler` (alias parity). Preserves description; does NOT mutate
|
|
345
|
+
* the original. This is how an agent exposes a built-in under its preferred name —
|
|
346
|
+
* e.g. a Codex-style agent aliases `search_text` → `grep`, `shell_exec` → `run_shell`
|
|
347
|
+
* — without re-implementing the tool. Pure, never throws: the final `name` is
|
|
348
|
+
* validated by the SDK at tool-registration time (the single authority for the
|
|
349
|
+
* `^[a-zA-Z][a-zA-Z0-9_-]{0,63}$` + reserved-name rules), so this helper does not
|
|
350
|
+
* re-validate (no duplicated contract).
|
|
351
|
+
*/
|
|
352
|
+
declare function withName(tool: CustomTool, name: string): CustomTool;
|
|
342
353
|
/** Render mode for {@link renderToolList}. Local — the published `renderToolList`
|
|
343
354
|
* signature inlines this union into its `.d.ts`, so consumers pass the literal
|
|
344
355
|
* ("summary" | "names" | "full") without needing the named type exported. */
|
|
@@ -580,7 +591,7 @@ declare function createReadFileTool(opts: CreateReadFileToolOptions): CustomTool
|
|
|
580
591
|
* SE37 — the public reasoning toolkit: `ReasoningTools.create()` returns a
|
|
581
592
|
* `think` + `analyze` scratchpad (no-side-effect tools that echo the model's
|
|
582
593
|
* structured reasoning back as an observation, so the ReAct loop feeds it
|
|
583
|
-
* forward). Mirrors Anthropic's "think" tool +
|
|
594
|
+
* forward). Mirrors Anthropic's "think" tool + a peer's `ReasoningTools`.
|
|
584
595
|
*
|
|
585
596
|
* Lives in `@theokit/sdk-tools` (not core) so the full toolkit stays out of the
|
|
586
597
|
* core bundle. The `reasoning: true` agent flag auto-attaches an equivalent
|
|
@@ -700,7 +711,7 @@ declare function createShellTool(opts: CreateShellToolOptions): CustomTool;
|
|
|
700
711
|
* `todolist` — in-session task tracking for multi-step work.
|
|
701
712
|
*
|
|
702
713
|
* The agent uses this to plan complex tasks and track progress.
|
|
703
|
-
* Inspired by
|
|
714
|
+
* Inspired by a peer project's todo.ts and Claude Code's TodoWrite.
|
|
704
715
|
*
|
|
705
716
|
* Actions:
|
|
706
717
|
* - add(title) → add a new todo item
|
|
@@ -964,4 +975,4 @@ interface CreateWriteFileToolOptions {
|
|
|
964
975
|
}
|
|
965
976
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
966
977
|
|
|
967
|
-
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 };
|
|
978
|
+
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, withName, withShellExitGuidance, withToolResultGuidance };
|
package/dist/index.d.ts
CHANGED
|
@@ -339,6 +339,17 @@ declare function catastrophicShellReason(command: string): string | null;
|
|
|
339
339
|
* name/inputSchema/handler; does NOT mutate the original tool.
|
|
340
340
|
*/
|
|
341
341
|
declare function withDescription(tool: CustomTool, description: string): CustomTool;
|
|
342
|
+
/**
|
|
343
|
+
* Return a new `CustomTool` exposed under a different `name`, sharing the SAME
|
|
344
|
+
* `inputSchema` + `handler` (alias parity). Preserves description; does NOT mutate
|
|
345
|
+
* the original. This is how an agent exposes a built-in under its preferred name —
|
|
346
|
+
* e.g. a Codex-style agent aliases `search_text` → `grep`, `shell_exec` → `run_shell`
|
|
347
|
+
* — without re-implementing the tool. Pure, never throws: the final `name` is
|
|
348
|
+
* validated by the SDK at tool-registration time (the single authority for the
|
|
349
|
+
* `^[a-zA-Z][a-zA-Z0-9_-]{0,63}$` + reserved-name rules), so this helper does not
|
|
350
|
+
* re-validate (no duplicated contract).
|
|
351
|
+
*/
|
|
352
|
+
declare function withName(tool: CustomTool, name: string): CustomTool;
|
|
342
353
|
/** Render mode for {@link renderToolList}. Local — the published `renderToolList`
|
|
343
354
|
* signature inlines this union into its `.d.ts`, so consumers pass the literal
|
|
344
355
|
* ("summary" | "names" | "full") without needing the named type exported. */
|
|
@@ -580,7 +591,7 @@ declare function createReadFileTool(opts: CreateReadFileToolOptions): CustomTool
|
|
|
580
591
|
* SE37 — the public reasoning toolkit: `ReasoningTools.create()` returns a
|
|
581
592
|
* `think` + `analyze` scratchpad (no-side-effect tools that echo the model's
|
|
582
593
|
* structured reasoning back as an observation, so the ReAct loop feeds it
|
|
583
|
-
* forward). Mirrors Anthropic's "think" tool +
|
|
594
|
+
* forward). Mirrors Anthropic's "think" tool + a peer's `ReasoningTools`.
|
|
584
595
|
*
|
|
585
596
|
* Lives in `@theokit/sdk-tools` (not core) so the full toolkit stays out of the
|
|
586
597
|
* core bundle. The `reasoning: true` agent flag auto-attaches an equivalent
|
|
@@ -700,7 +711,7 @@ declare function createShellTool(opts: CreateShellToolOptions): CustomTool;
|
|
|
700
711
|
* `todolist` — in-session task tracking for multi-step work.
|
|
701
712
|
*
|
|
702
713
|
* The agent uses this to plan complex tasks and track progress.
|
|
703
|
-
* Inspired by
|
|
714
|
+
* Inspired by a peer project's todo.ts and Claude Code's TodoWrite.
|
|
704
715
|
*
|
|
705
716
|
* Actions:
|
|
706
717
|
* - add(title) → add a new todo item
|
|
@@ -964,4 +975,4 @@ interface CreateWriteFileToolOptions {
|
|
|
964
975
|
}
|
|
965
976
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
966
977
|
|
|
967
|
-
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 };
|
|
978
|
+
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, withName, withShellExitGuidance, withToolResultGuidance };
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { dirname, join, relative, resolve, sep } from 'path';
|
|
|
3
3
|
import { Tool, ConfigurationError } from '@theokit/sdk';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { existsSync, statSync, mkdirSync, writeFileSync, realpathSync, readFileSync, lstatSync, readlinkSync, readdirSync } from 'fs';
|
|
6
|
-
import { replaceFileAtomic } from '@theokit/sdk/internal/persistence';
|
|
7
6
|
import { safeFilenameForId, safePathJoin as safePathJoin$1 } from '@theokit/sdk/path-safety';
|
|
7
|
+
import { replaceFileAtomic } from '@theokit/sdk/persistence';
|
|
8
8
|
import { spawn } from 'child_process';
|
|
9
9
|
import { lookup } from 'dns/promises';
|
|
10
10
|
import { isIP } from 'net';
|
|
@@ -988,6 +988,14 @@ function withDescription(tool, description) {
|
|
|
988
988
|
handler: tool.handler
|
|
989
989
|
};
|
|
990
990
|
}
|
|
991
|
+
function withName(tool, name) {
|
|
992
|
+
return {
|
|
993
|
+
name,
|
|
994
|
+
description: tool.description,
|
|
995
|
+
inputSchema: tool.inputSchema,
|
|
996
|
+
handler: tool.handler
|
|
997
|
+
};
|
|
998
|
+
}
|
|
991
999
|
function esc(s) {
|
|
992
1000
|
return String(s).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
993
1001
|
}
|
|
@@ -2239,6 +2247,6 @@ async function isBinaryFile(absolutePath) {
|
|
|
2239
2247
|
}
|
|
2240
2248
|
}
|
|
2241
2249
|
|
|
2242
|
-
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 };
|
|
2250
|
+
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, withName, withShellExitGuidance, withToolResultGuidance };
|
|
2243
2251
|
//# sourceMappingURL=index.js.map
|
|
2244
2252
|
//# sourceMappingURL=index.js.map
|