@theokit/sdk-tools 0.13.0 → 0.15.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/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { CustomTool, ConfigurationError } from '@theokit/sdk';
2
2
  import { FilesystemProvider } from '@theokit/sdk/filesystem';
3
+ import { SandboxProvider } from '@theokit/sdk/sandbox';
4
+ import { InteractiveProvider } from '@theokit/sdk/interactive';
3
5
 
4
6
  /**
5
7
  * `apply_patch` — built-in tool for coding agents.
@@ -88,6 +90,9 @@ declare function createSessionArtifactStore(options: SessionArtifactStoreOptions
88
90
  interface CreateEditFileToolOptions {
89
91
  /** Absolute path to the project root. Every edit is gated against this boundary. */
90
92
  projectRoot: string;
93
+ /** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the read + `.bak` backup +
94
+ * write go through the backend (surface-agnostic); omitted ⇒ the local `fs` path (byte-identical). */
95
+ filesystem?: FilesystemProvider;
91
96
  }
92
97
  declare function createEditFileTool(opts: CreateEditFileToolOptions): CustomTool;
93
98
 
@@ -133,6 +138,9 @@ interface CreateGitDiffToolOptions {
133
138
  projectRoot: string;
134
139
  timeoutMs?: number;
135
140
  maxStdoutBytes?: number;
141
+ /** Optional injected execution backend (`@theokit/sdk/sandbox`) — when provided, `git diff` runs via
142
+ * `SandboxBackend.execute` (surface-agnostic); omitted ⇒ the local `git` child process (unchanged). */
143
+ sandbox?: SandboxProvider;
136
144
  }
137
145
  declare function createGitDiffTool(opts: CreateGitDiffToolOptions): CustomTool;
138
146
 
@@ -150,9 +158,39 @@ declare function createGitDiffTool(opts: CreateGitDiffToolOptions): CustomTool;
150
158
  interface CreateGlobToolOptions {
151
159
  /** Absolute path to the project root. */
152
160
  projectRoot: string;
161
+ /** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the walk reads through the
162
+ * backend (Local/remote), so the tool is surface-agnostic; omitted ⇒ the local `readdir` (unchanged). */
163
+ filesystem?: FilesystemProvider;
153
164
  }
154
165
  declare function createGlobTool(opts: CreateGlobToolOptions): CustomTool;
155
166
 
167
+ /**
168
+ * `interactive_shell` + `write_stdin` — built-in tools for driving an interactive
169
+ * session (a REPL, `git rebase -i`, any command that PROMPTS for stdin).
170
+ *
171
+ * Surface-agnostic by construction: both tools depend on an INJECTED
172
+ * `InteractiveProvider` (`@theokit/sdk/interactive`) exactly as `read_file`
173
+ * depends on `FilesystemProvider`. The HOST supplies the backend — a local
174
+ * `@theokit/sdk-pty` (terminal), a container/E2B backend (cluster/web), or a
175
+ * Tauri backend (desktop) — so the SAME tool runs on every theokit surface with
176
+ * NO native dependency here. When no backend is injected (or it cannot allocate
177
+ * a session) the tool returns `{ ok: false, error: 'interactive_unavailable' }`
178
+ * and the agent falls back to non-interactive exec.
179
+ *
180
+ * Return shapes (always a JSON string):
181
+ * interactive_shell → `{ ok: true, session_id, output }` | `{ ok: false, error }`
182
+ * write_stdin → `{ ok: true, output, alive }` | `{ ok: false, error }`
183
+ */
184
+
185
+ interface CreateInteractiveShellToolOptions {
186
+ /** The interactive backend, or a per-request resolver of one (injected — never a direct native dep). */
187
+ interactive: InteractiveProvider<unknown>;
188
+ }
189
+ /** Start an interactive session; returns a `session_id` to drive with `write_stdin`. */
190
+ declare function createInteractiveShellTool(opts: CreateInteractiveShellToolOptions): CustomTool;
191
+ /** Write to a live interactive session's stdin and read the output it produces. */
192
+ declare function createWriteStdinTool(opts: CreateInteractiveShellToolOptions): CustomTool;
193
+
156
194
  /**
157
195
  * Composable command-permission policy layer (M3-6).
158
196
  *
@@ -706,6 +744,9 @@ interface CreateSearchTextToolOptions {
706
744
  maxMatches?: number;
707
745
  /** Skip files larger than this (bytes). Default 1 MB. */
708
746
  maxFileSize?: number;
747
+ /** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the recursive walk reads
748
+ * through the backend (surface-agnostic); omitted ⇒ the local `readdir`/`readFile` walk (unchanged). */
749
+ filesystem?: FilesystemProvider;
709
750
  }
710
751
  declare function createSearchTextTool(opts: CreateSearchTextToolOptions): CustomTool;
711
752
 
@@ -732,6 +773,14 @@ interface CreateShellToolOptions {
732
773
  * guardrail, not a sandbox.
733
774
  */
734
775
  allowCatastrophic?: boolean;
776
+ /**
777
+ * Optional injected execution backend (`@theokit/sdk/sandbox`) — a backend or a per-request resolver.
778
+ * When provided, the command runs via `SandboxBackend.execute` (Local/Docker/E2B) so the tool is
779
+ * surface-agnostic (a cluster/desktop host runs it in the sandbox, not the local host); omitted ⇒ the
780
+ * local `/bin/sh -c` child process (byte-identical to before). The catastrophic-command guard runs
781
+ * before either path.
782
+ */
783
+ sandbox?: SandboxProvider;
735
784
  }
736
785
  declare function createShellTool(opts: CreateShellToolOptions): CustomTool;
737
786
 
@@ -1003,4 +1052,4 @@ interface CreateWriteFileToolOptions {
1003
1052
  }
1004
1053
  declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
1005
1054
 
1006
- export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, 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, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
1055
+ export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateInteractiveShellToolOptions, 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, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { CustomTool, ConfigurationError } from '@theokit/sdk';
2
2
  import { FilesystemProvider } from '@theokit/sdk/filesystem';
3
+ import { SandboxProvider } from '@theokit/sdk/sandbox';
4
+ import { InteractiveProvider } from '@theokit/sdk/interactive';
3
5
 
4
6
  /**
5
7
  * `apply_patch` — built-in tool for coding agents.
@@ -88,6 +90,9 @@ declare function createSessionArtifactStore(options: SessionArtifactStoreOptions
88
90
  interface CreateEditFileToolOptions {
89
91
  /** Absolute path to the project root. Every edit is gated against this boundary. */
90
92
  projectRoot: string;
93
+ /** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the read + `.bak` backup +
94
+ * write go through the backend (surface-agnostic); omitted ⇒ the local `fs` path (byte-identical). */
95
+ filesystem?: FilesystemProvider;
91
96
  }
92
97
  declare function createEditFileTool(opts: CreateEditFileToolOptions): CustomTool;
93
98
 
@@ -133,6 +138,9 @@ interface CreateGitDiffToolOptions {
133
138
  projectRoot: string;
134
139
  timeoutMs?: number;
135
140
  maxStdoutBytes?: number;
141
+ /** Optional injected execution backend (`@theokit/sdk/sandbox`) — when provided, `git diff` runs via
142
+ * `SandboxBackend.execute` (surface-agnostic); omitted ⇒ the local `git` child process (unchanged). */
143
+ sandbox?: SandboxProvider;
136
144
  }
137
145
  declare function createGitDiffTool(opts: CreateGitDiffToolOptions): CustomTool;
138
146
 
@@ -150,9 +158,39 @@ declare function createGitDiffTool(opts: CreateGitDiffToolOptions): CustomTool;
150
158
  interface CreateGlobToolOptions {
151
159
  /** Absolute path to the project root. */
152
160
  projectRoot: string;
161
+ /** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the walk reads through the
162
+ * backend (Local/remote), so the tool is surface-agnostic; omitted ⇒ the local `readdir` (unchanged). */
163
+ filesystem?: FilesystemProvider;
153
164
  }
154
165
  declare function createGlobTool(opts: CreateGlobToolOptions): CustomTool;
155
166
 
167
+ /**
168
+ * `interactive_shell` + `write_stdin` — built-in tools for driving an interactive
169
+ * session (a REPL, `git rebase -i`, any command that PROMPTS for stdin).
170
+ *
171
+ * Surface-agnostic by construction: both tools depend on an INJECTED
172
+ * `InteractiveProvider` (`@theokit/sdk/interactive`) exactly as `read_file`
173
+ * depends on `FilesystemProvider`. The HOST supplies the backend — a local
174
+ * `@theokit/sdk-pty` (terminal), a container/E2B backend (cluster/web), or a
175
+ * Tauri backend (desktop) — so the SAME tool runs on every theokit surface with
176
+ * NO native dependency here. When no backend is injected (or it cannot allocate
177
+ * a session) the tool returns `{ ok: false, error: 'interactive_unavailable' }`
178
+ * and the agent falls back to non-interactive exec.
179
+ *
180
+ * Return shapes (always a JSON string):
181
+ * interactive_shell → `{ ok: true, session_id, output }` | `{ ok: false, error }`
182
+ * write_stdin → `{ ok: true, output, alive }` | `{ ok: false, error }`
183
+ */
184
+
185
+ interface CreateInteractiveShellToolOptions {
186
+ /** The interactive backend, or a per-request resolver of one (injected — never a direct native dep). */
187
+ interactive: InteractiveProvider<unknown>;
188
+ }
189
+ /** Start an interactive session; returns a `session_id` to drive with `write_stdin`. */
190
+ declare function createInteractiveShellTool(opts: CreateInteractiveShellToolOptions): CustomTool;
191
+ /** Write to a live interactive session's stdin and read the output it produces. */
192
+ declare function createWriteStdinTool(opts: CreateInteractiveShellToolOptions): CustomTool;
193
+
156
194
  /**
157
195
  * Composable command-permission policy layer (M3-6).
158
196
  *
@@ -706,6 +744,9 @@ interface CreateSearchTextToolOptions {
706
744
  maxMatches?: number;
707
745
  /** Skip files larger than this (bytes). Default 1 MB. */
708
746
  maxFileSize?: number;
747
+ /** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the recursive walk reads
748
+ * through the backend (surface-agnostic); omitted ⇒ the local `readdir`/`readFile` walk (unchanged). */
749
+ filesystem?: FilesystemProvider;
709
750
  }
710
751
  declare function createSearchTextTool(opts: CreateSearchTextToolOptions): CustomTool;
711
752
 
@@ -732,6 +773,14 @@ interface CreateShellToolOptions {
732
773
  * guardrail, not a sandbox.
733
774
  */
734
775
  allowCatastrophic?: boolean;
776
+ /**
777
+ * Optional injected execution backend (`@theokit/sdk/sandbox`) — a backend or a per-request resolver.
778
+ * When provided, the command runs via `SandboxBackend.execute` (Local/Docker/E2B) so the tool is
779
+ * surface-agnostic (a cluster/desktop host runs it in the sandbox, not the local host); omitted ⇒ the
780
+ * local `/bin/sh -c` child process (byte-identical to before). The catastrophic-command guard runs
781
+ * before either path.
782
+ */
783
+ sandbox?: SandboxProvider;
735
784
  }
736
785
  declare function createShellTool(opts: CreateShellToolOptions): CustomTool;
737
786
 
@@ -1003,4 +1052,4 @@ interface CreateWriteFileToolOptions {
1003
1052
  }
1004
1053
  declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
1005
1054
 
1006
- export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, 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, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
1055
+ export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateInteractiveShellToolOptions, 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, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };