@theokit/sdk-tools 0.6.0 → 0.8.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
@@ -272,8 +272,14 @@ interface RepoMapOptions {
272
272
  /** Max directory depth to descend. Default 4. */
273
273
  maxDepth?: number;
274
274
  }
275
+ interface EnvContextOptions {
276
+ /** Injectable clock for the date line (deterministic tests). Default `new Date()`. */
277
+ now?: Date;
278
+ /** Path to the git `HEAD` file. Default `<cwd>/.git/HEAD`. */
279
+ gitHeadPath?: string;
280
+ }
275
281
  /** Render a portable `<env>` orientation block. Never throws. */
276
- declare function buildEnvContext(cwd: string): string;
282
+ declare function buildEnvContext(cwd: string, opts?: EnvContextOptions): string;
277
283
  /** Render a char-bounded, depth-limited directory tree. Never throws. */
278
284
  declare function buildRepoMap(cwd: string, opts?: RepoMapOptions): string;
279
285
 
@@ -332,12 +338,26 @@ declare function catastrophicShellReason(command: string): string | null;
332
338
  * name/inputSchema/handler; does NOT mutate the original tool.
333
339
  */
334
340
  declare function withDescription(tool: CustomTool, description: string): CustomTool;
341
+ /** Render mode for {@link renderToolList}. Local — the published `renderToolList`
342
+ * signature inlines this union into its `.d.ts`, so consumers pass the literal
343
+ * ("summary" | "names" | "full") without needing the named type exported. */
344
+ type ToolListMode = "full" | "summary" | "names";
335
345
  /**
336
- * Render a `<tools>` block (name + description per tool) from the agent's actual
337
- * `CustomTool[]` — single source of truth, so an overridden/added/removed tool
338
- * is reflected automatically. An empty array yields `<tools></tools>`. Never throws.
346
+ * Render the agent's actual `CustomTool[]` single source of truth, so an
347
+ * overridden/added/removed tool is reflected automatically. Never throws.
348
+ *
349
+ * Modes (`options.mode`, default `"full"`):
350
+ * - `"full"`: a `<tools>` XML block (name + description per tool, XML-escaped).
351
+ * An empty array yields `<tools></tools>`.
352
+ * - `"summary"`: markdown `- name: <first sentence>` per tool (NOT XML-escaped).
353
+ * - `"names"`: markdown `- name` per tool (NOT XML-escaped).
354
+ *
355
+ * Markdown modes on an empty array yield `""`. A non-object `options` arg (e.g. a
356
+ * map index from `tools.map(renderToolList)`) has no `.mode` → falls back to `"full"`.
339
357
  */
340
- declare function renderToolList(tools: CustomTool[]): string;
358
+ declare function renderToolList(tools: CustomTool[], options?: {
359
+ mode?: ToolListMode;
360
+ }): string;
341
361
 
342
362
  /**
343
363
  * Rich-error guidance for tool failures (M3-4).
@@ -778,12 +798,12 @@ declare function createWebSearchTool(opts: CreateWebSearchToolOptions): CustomTo
778
798
  * the required auth header. Zero new dependencies. Design: blueprint m3-websearch-adapter.
779
799
  */
780
800
 
781
- type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
801
+ type FetchLike$1 = (url: string, init?: RequestInit) => Promise<Response>;
782
802
  interface CreateBraveWebSearchAdapterOptions {
783
803
  /** Brave API key. Defaults to `process.env.BRAVE_API_KEY`. */
784
804
  apiKey?: string;
785
805
  /** Injectable fetch (default `globalThis.fetch`) — set in tests for offline runs. */
786
- fetchImpl?: FetchLike;
806
+ fetchImpl?: FetchLike$1;
787
807
  /** Override the Brave endpoint (self-host / test). */
788
808
  endpoint?: string;
789
809
  }
@@ -793,6 +813,42 @@ interface CreateBraveWebSearchAdapterOptions {
793
813
  */
794
814
  declare function createBraveWebSearchAdapter(opts?: CreateBraveWebSearchAdapterOptions): WebSearchCallback;
795
815
 
816
+ /**
817
+ * Generic HTTP web-search adapter for `createWebSearchTool` (RADAR #92.d).
818
+ *
819
+ * `createGenericHttpSearchAdapter()` returns a `WebSearchCallback` that queries
820
+ * an arbitrary HTTP search endpoint keyed by env vars:
821
+ * - `THEOKIT_SEARCH_API_URL` — endpoint returning `{ results: [{title,url,snippet}] }`
822
+ * - `THEOKIT_SEARCH_API_KEY` — bearer token
823
+ *
824
+ * Request shape: `GET {endpoint}?q={query}&n={maxResults}` with
825
+ * `Authorization: Bearer {apiKey}`. Both values may be passed explicitly (params
826
+ * win over env). Unlike the Brave adapter (which fails early — fixed host, fixed
827
+ * auth), this one is provider-agnostic and **degrades gracefully**: when
828
+ * unconfigured OR on any network/parse failure it returns `[]` and never throws
829
+ * into the agent turn. A recurring empty result is a provider-config issue, not
830
+ * an agent bug. `fetchImpl` is injectable (default `globalThis.fetch`) for
831
+ * offline tests. Zero new dependencies.
832
+ *
833
+ * Promoted from theocode's `server/lib/web-search.ts` (`createSearchProvider`),
834
+ * re-keyed to neutral `THEOKIT_*` env vars.
835
+ */
836
+
837
+ type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
838
+ interface CreateGenericHttpSearchAdapterOptions {
839
+ /** Bearer token. Defaults to `process.env.THEOKIT_SEARCH_API_KEY`. */
840
+ apiKey?: string;
841
+ /** Search endpoint URL. Defaults to `process.env.THEOKIT_SEARCH_API_URL`. */
842
+ endpoint?: string;
843
+ /** Injectable fetch (default `globalThis.fetch`) — set in tests for offline runs. */
844
+ fetchImpl?: FetchLike;
845
+ }
846
+ /**
847
+ * Build a `WebSearchCallback` backed by a generic HTTP search endpoint. Returns
848
+ * `[]` (graceful no-op) when unconfigured or on any failure — never throws.
849
+ */
850
+ declare function createGenericHttpSearchAdapter(opts?: CreateGenericHttpSearchAdapterOptions): WebSearchCallback;
851
+
796
852
  /**
797
853
  * `write_file` — built-in tool for coding agents.
798
854
  *
@@ -812,4 +868,4 @@ interface CreateWriteFileToolOptions {
812
868
  }
813
869
  declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
814
870
 
815
- export { CatastrophicCommandError, type CommandPolicy, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, 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, 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 };
871
+ 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, 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
@@ -272,8 +272,14 @@ interface RepoMapOptions {
272
272
  /** Max directory depth to descend. Default 4. */
273
273
  maxDepth?: number;
274
274
  }
275
+ interface EnvContextOptions {
276
+ /** Injectable clock for the date line (deterministic tests). Default `new Date()`. */
277
+ now?: Date;
278
+ /** Path to the git `HEAD` file. Default `<cwd>/.git/HEAD`. */
279
+ gitHeadPath?: string;
280
+ }
275
281
  /** Render a portable `<env>` orientation block. Never throws. */
276
- declare function buildEnvContext(cwd: string): string;
282
+ declare function buildEnvContext(cwd: string, opts?: EnvContextOptions): string;
277
283
  /** Render a char-bounded, depth-limited directory tree. Never throws. */
278
284
  declare function buildRepoMap(cwd: string, opts?: RepoMapOptions): string;
279
285
 
@@ -332,12 +338,26 @@ declare function catastrophicShellReason(command: string): string | null;
332
338
  * name/inputSchema/handler; does NOT mutate the original tool.
333
339
  */
334
340
  declare function withDescription(tool: CustomTool, description: string): CustomTool;
341
+ /** Render mode for {@link renderToolList}. Local — the published `renderToolList`
342
+ * signature inlines this union into its `.d.ts`, so consumers pass the literal
343
+ * ("summary" | "names" | "full") without needing the named type exported. */
344
+ type ToolListMode = "full" | "summary" | "names";
335
345
  /**
336
- * Render a `<tools>` block (name + description per tool) from the agent's actual
337
- * `CustomTool[]` — single source of truth, so an overridden/added/removed tool
338
- * is reflected automatically. An empty array yields `<tools></tools>`. Never throws.
346
+ * Render the agent's actual `CustomTool[]` single source of truth, so an
347
+ * overridden/added/removed tool is reflected automatically. Never throws.
348
+ *
349
+ * Modes (`options.mode`, default `"full"`):
350
+ * - `"full"`: a `<tools>` XML block (name + description per tool, XML-escaped).
351
+ * An empty array yields `<tools></tools>`.
352
+ * - `"summary"`: markdown `- name: <first sentence>` per tool (NOT XML-escaped).
353
+ * - `"names"`: markdown `- name` per tool (NOT XML-escaped).
354
+ *
355
+ * Markdown modes on an empty array yield `""`. A non-object `options` arg (e.g. a
356
+ * map index from `tools.map(renderToolList)`) has no `.mode` → falls back to `"full"`.
339
357
  */
340
- declare function renderToolList(tools: CustomTool[]): string;
358
+ declare function renderToolList(tools: CustomTool[], options?: {
359
+ mode?: ToolListMode;
360
+ }): string;
341
361
 
342
362
  /**
343
363
  * Rich-error guidance for tool failures (M3-4).
@@ -778,12 +798,12 @@ declare function createWebSearchTool(opts: CreateWebSearchToolOptions): CustomTo
778
798
  * the required auth header. Zero new dependencies. Design: blueprint m3-websearch-adapter.
779
799
  */
780
800
 
781
- type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
801
+ type FetchLike$1 = (url: string, init?: RequestInit) => Promise<Response>;
782
802
  interface CreateBraveWebSearchAdapterOptions {
783
803
  /** Brave API key. Defaults to `process.env.BRAVE_API_KEY`. */
784
804
  apiKey?: string;
785
805
  /** Injectable fetch (default `globalThis.fetch`) — set in tests for offline runs. */
786
- fetchImpl?: FetchLike;
806
+ fetchImpl?: FetchLike$1;
787
807
  /** Override the Brave endpoint (self-host / test). */
788
808
  endpoint?: string;
789
809
  }
@@ -793,6 +813,42 @@ interface CreateBraveWebSearchAdapterOptions {
793
813
  */
794
814
  declare function createBraveWebSearchAdapter(opts?: CreateBraveWebSearchAdapterOptions): WebSearchCallback;
795
815
 
816
+ /**
817
+ * Generic HTTP web-search adapter for `createWebSearchTool` (RADAR #92.d).
818
+ *
819
+ * `createGenericHttpSearchAdapter()` returns a `WebSearchCallback` that queries
820
+ * an arbitrary HTTP search endpoint keyed by env vars:
821
+ * - `THEOKIT_SEARCH_API_URL` — endpoint returning `{ results: [{title,url,snippet}] }`
822
+ * - `THEOKIT_SEARCH_API_KEY` — bearer token
823
+ *
824
+ * Request shape: `GET {endpoint}?q={query}&n={maxResults}` with
825
+ * `Authorization: Bearer {apiKey}`. Both values may be passed explicitly (params
826
+ * win over env). Unlike the Brave adapter (which fails early — fixed host, fixed
827
+ * auth), this one is provider-agnostic and **degrades gracefully**: when
828
+ * unconfigured OR on any network/parse failure it returns `[]` and never throws
829
+ * into the agent turn. A recurring empty result is a provider-config issue, not
830
+ * an agent bug. `fetchImpl` is injectable (default `globalThis.fetch`) for
831
+ * offline tests. Zero new dependencies.
832
+ *
833
+ * Promoted from theocode's `server/lib/web-search.ts` (`createSearchProvider`),
834
+ * re-keyed to neutral `THEOKIT_*` env vars.
835
+ */
836
+
837
+ type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
838
+ interface CreateGenericHttpSearchAdapterOptions {
839
+ /** Bearer token. Defaults to `process.env.THEOKIT_SEARCH_API_KEY`. */
840
+ apiKey?: string;
841
+ /** Search endpoint URL. Defaults to `process.env.THEOKIT_SEARCH_API_URL`. */
842
+ endpoint?: string;
843
+ /** Injectable fetch (default `globalThis.fetch`) — set in tests for offline runs. */
844
+ fetchImpl?: FetchLike;
845
+ }
846
+ /**
847
+ * Build a `WebSearchCallback` backed by a generic HTTP search endpoint. Returns
848
+ * `[]` (graceful no-op) when unconfigured or on any failure — never throws.
849
+ */
850
+ declare function createGenericHttpSearchAdapter(opts?: CreateGenericHttpSearchAdapterOptions): WebSearchCallback;
851
+
796
852
  /**
797
853
  * `write_file` — built-in tool for coding agents.
798
854
  *
@@ -812,4 +868,4 @@ interface CreateWriteFileToolOptions {
812
868
  }
813
869
  declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
814
870
 
815
- export { CatastrophicCommandError, type CommandPolicy, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateEditFileToolOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, 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, 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 };
871
+ 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, 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
@@ -885,15 +885,26 @@ function safeReadHead(p, n) {
885
885
  return "";
886
886
  }
887
887
  }
888
- function buildEnvContext(cwd) {
888
+ function gitBranch(headPath) {
889
+ try {
890
+ const head = readFileSync(headPath, "utf-8").trim();
891
+ const match = head.match(/^ref:\s*refs\/heads\/(.+)$/);
892
+ return match ? match[1] : void 0;
893
+ } catch {
894
+ return void 0;
895
+ }
896
+ }
897
+ function buildEnvContext(cwd, opts = {}) {
889
898
  const lines = [
890
899
  "<env>",
891
900
  ` Working directory: ${cwd}`,
892
901
  ` Platform: ${process.platform} (${process.arch})`,
893
902
  ` Node: ${process.version}`,
894
- ` Is git repo: ${safeExists(join(cwd, ".git")) ? "yes" : "no"}`,
895
- ` Today's date: ${(/* @__PURE__ */ new Date()).toDateString()}`
903
+ ` Is git repo: ${safeExists(join(cwd, ".git")) ? "yes" : "no"}`
896
904
  ];
905
+ const branch = gitBranch(opts.gitHeadPath ?? join(cwd, ".git", "HEAD"));
906
+ if (branch) lines.push(` Branch: ${branch}`);
907
+ lines.push(` Today's date: ${(opts.now ?? /* @__PURE__ */ new Date()).toDateString()}`);
897
908
  const docs = PROJECT_DOCS.filter((d) => safeExists(join(cwd, d)));
898
909
  if (docs.length > 0) {
899
910
  lines.push(` Project docs: ${docs.join(", ")}`);
@@ -979,7 +990,18 @@ function withDescription(tool, description) {
979
990
  function esc(s) {
980
991
  return String(s).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
981
992
  }
982
- function renderToolList(tools) {
993
+ function firstSentence(d) {
994
+ const m = d.trim().match(/\.\s+(?=[A-Z(]|$)/);
995
+ return m?.index == null ? d.trim() : d.trim().slice(0, m.index + 1);
996
+ }
997
+ function renderToolList(tools, options) {
998
+ const mode = options?.mode ?? "full";
999
+ if (mode === "summary") {
1000
+ return tools.map((t) => `- ${t.name}: ${firstSentence(t.description)}`).join("\n");
1001
+ }
1002
+ if (mode === "names") {
1003
+ return tools.map((t) => `- ${t.name}`).join("\n");
1004
+ }
983
1005
  if (tools.length === 0) return "<tools></tools>";
984
1006
  const lines = ["<tools>"];
985
1007
  for (const t of tools) {
@@ -1921,6 +1943,29 @@ function createBraveWebSearchAdapter(opts = {}) {
1921
1943
  }));
1922
1944
  };
1923
1945
  }
1946
+
1947
+ // src/web-search-http.ts
1948
+ function createGenericHttpSearchAdapter(opts = {}) {
1949
+ const apiKey = opts.apiKey ?? process.env.THEOKIT_SEARCH_API_KEY;
1950
+ const endpoint = opts.endpoint ?? process.env.THEOKIT_SEARCH_API_URL;
1951
+ const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
1952
+ return async (query, maxResults) => {
1953
+ if (!apiKey || !endpoint) return [];
1954
+ try {
1955
+ const url = `${endpoint}?q=${encodeURIComponent(query)}&n=${maxResults}`;
1956
+ const res = await fetchImpl(url, { headers: { Authorization: `Bearer ${apiKey}` } });
1957
+ if (!res.ok) return [];
1958
+ const data = await res.json();
1959
+ return (data?.results ?? []).slice(0, maxResults).map((r) => ({
1960
+ title: String(r?.title ?? ""),
1961
+ url: String(r?.url ?? ""),
1962
+ snippet: String(r?.snippet ?? "")
1963
+ }));
1964
+ } catch {
1965
+ return [];
1966
+ }
1967
+ };
1968
+ }
1924
1969
  var BINARY_PROBE_BYTES3 = 8 * 1024;
1925
1970
  function createWriteFileTool(opts) {
1926
1971
  const { projectRoot } = opts;
@@ -1977,6 +2022,6 @@ async function isBinaryFile(absolutePath) {
1977
2022
  }
1978
2023
  }
1979
2024
 
1980
- export { CatastrophicCommandError, DEFAULT_TOOL_GUIDANCE, RedirectBlockedError, SsrfBlockedError, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, 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 };
2025
+ export { CatastrophicCommandError, DEFAULT_TOOL_GUIDANCE, 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 };
1981
2026
  //# sourceMappingURL=index.js.map
1982
2027
  //# sourceMappingURL=index.js.map