@linghun/tools 0.1.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.
Files changed (157) hide show
  1. package/LICENSE +190 -0
  2. package/dist/chunk-2U4BZXAI.js +6 -0
  3. package/dist/chunk-3RP665TH.js +6 -0
  4. package/dist/chunk-4567YAXM.js +13 -0
  5. package/dist/chunk-4EZHIDZ6.js +13 -0
  6. package/dist/chunk-4UHQWBFA.js +167 -0
  7. package/dist/chunk-7ZOADACP.js +13 -0
  8. package/dist/chunk-AZCQL24J.js +13 -0
  9. package/dist/chunk-BRG64AEC.js +6 -0
  10. package/dist/chunk-DN3KJZRV.js +13 -0
  11. package/dist/chunk-E75PYM7V.js +6 -0
  12. package/dist/chunk-EPIB4FSE.js +151 -0
  13. package/dist/chunk-GAWMEMXB.js +6 -0
  14. package/dist/chunk-H5OOD2OS.js +6 -0
  15. package/dist/chunk-HNIVNZIS.js +6 -0
  16. package/dist/chunk-HUIZOB4A.js +6 -0
  17. package/dist/chunk-I3Z4OKMS.js +13 -0
  18. package/dist/chunk-IOC3BSPT.js +6 -0
  19. package/dist/chunk-IQP3XE32.js +6 -0
  20. package/dist/chunk-ITBZHMZQ.js +6 -0
  21. package/dist/chunk-K3YDFDLP.js +6 -0
  22. package/dist/chunk-KGDJAST5.js +52 -0
  23. package/dist/chunk-LGZOG7IQ.js +13 -0
  24. package/dist/chunk-MK3YP2VR.js +6 -0
  25. package/dist/chunk-MMJX44V6.js +29 -0
  26. package/dist/chunk-NKWRH36V.js +52 -0
  27. package/dist/chunk-NPKLGVDQ.js +6 -0
  28. package/dist/chunk-PS2ZOFZ6.js +6 -0
  29. package/dist/chunk-RBHQ5WNR.js +13 -0
  30. package/dist/chunk-SQP6SJRP.js +6 -0
  31. package/dist/chunk-SWK6XRZQ.js +6 -0
  32. package/dist/chunk-SZFZPQGL.js +6 -0
  33. package/dist/chunk-VAFW24RN.js +6 -0
  34. package/dist/chunk-VJDLOFCF.js +13 -0
  35. package/dist/chunk-VZWMPUSS.js +13 -0
  36. package/dist/chunk-WLQ7DGMG.js +13 -0
  37. package/dist/chunk-XZWSO5CM.js +6 -0
  38. package/dist/chunk-YR4HWOR2.js +6 -0
  39. package/dist/chunk-ZYAEUABC.js +6 -0
  40. package/dist/index.d.ts +147 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +1753 -0
  43. package/dist/tool-runtime.d.ts +49 -0
  44. package/dist/tool-runtime.d.ts.map +1 -0
  45. package/dist/tool-runtime.js +6 -0
  46. package/dist/tools/Bash/BashTool.d.ts +6 -0
  47. package/dist/tools/Bash/BashTool.d.ts.map +1 -0
  48. package/dist/tools/Bash/BashTool.js +8 -0
  49. package/dist/tools/Bash/UI.d.ts +2 -0
  50. package/dist/tools/Bash/UI.d.ts.map +1 -0
  51. package/dist/tools/Bash/UI.js +6 -0
  52. package/dist/tools/Bash/prompt.d.ts +2 -0
  53. package/dist/tools/Bash/prompt.d.ts.map +1 -0
  54. package/dist/tools/Bash/prompt.js +6 -0
  55. package/dist/tools/Diff/DiffTool.d.ts +6 -0
  56. package/dist/tools/Diff/DiffTool.d.ts.map +1 -0
  57. package/dist/tools/Diff/DiffTool.js +8 -0
  58. package/dist/tools/Diff/UI.d.ts +2 -0
  59. package/dist/tools/Diff/UI.d.ts.map +1 -0
  60. package/dist/tools/Diff/UI.js +6 -0
  61. package/dist/tools/Diff/prompt.d.ts +2 -0
  62. package/dist/tools/Diff/prompt.d.ts.map +1 -0
  63. package/dist/tools/Diff/prompt.js +6 -0
  64. package/dist/tools/Edit/EditTool.d.ts +6 -0
  65. package/dist/tools/Edit/EditTool.d.ts.map +1 -0
  66. package/dist/tools/Edit/EditTool.js +8 -0
  67. package/dist/tools/Edit/UI.d.ts +2 -0
  68. package/dist/tools/Edit/UI.d.ts.map +1 -0
  69. package/dist/tools/Edit/UI.js +6 -0
  70. package/dist/tools/Edit/prompt.d.ts +2 -0
  71. package/dist/tools/Edit/prompt.d.ts.map +1 -0
  72. package/dist/tools/Edit/prompt.js +6 -0
  73. package/dist/tools/Glob/GlobTool.d.ts +6 -0
  74. package/dist/tools/Glob/GlobTool.d.ts.map +1 -0
  75. package/dist/tools/Glob/GlobTool.js +8 -0
  76. package/dist/tools/Glob/UI.d.ts +2 -0
  77. package/dist/tools/Glob/UI.d.ts.map +1 -0
  78. package/dist/tools/Glob/UI.js +6 -0
  79. package/dist/tools/Glob/prompt.d.ts +2 -0
  80. package/dist/tools/Glob/prompt.d.ts.map +1 -0
  81. package/dist/tools/Glob/prompt.js +6 -0
  82. package/dist/tools/Grep/GrepTool.d.ts +6 -0
  83. package/dist/tools/Grep/GrepTool.d.ts.map +1 -0
  84. package/dist/tools/Grep/GrepTool.js +8 -0
  85. package/dist/tools/Grep/UI.d.ts +2 -0
  86. package/dist/tools/Grep/UI.d.ts.map +1 -0
  87. package/dist/tools/Grep/UI.js +6 -0
  88. package/dist/tools/Grep/prompt.d.ts +2 -0
  89. package/dist/tools/Grep/prompt.d.ts.map +1 -0
  90. package/dist/tools/Grep/prompt.js +6 -0
  91. package/dist/tools/MultiEdit/MultiEditTool.d.ts +6 -0
  92. package/dist/tools/MultiEdit/MultiEditTool.d.ts.map +1 -0
  93. package/dist/tools/MultiEdit/MultiEditTool.js +8 -0
  94. package/dist/tools/MultiEdit/UI.d.ts +2 -0
  95. package/dist/tools/MultiEdit/UI.d.ts.map +1 -0
  96. package/dist/tools/MultiEdit/UI.js +6 -0
  97. package/dist/tools/MultiEdit/prompt.d.ts +2 -0
  98. package/dist/tools/MultiEdit/prompt.d.ts.map +1 -0
  99. package/dist/tools/MultiEdit/prompt.js +6 -0
  100. package/dist/tools/Read/ReadTool.d.ts +6 -0
  101. package/dist/tools/Read/ReadTool.d.ts.map +1 -0
  102. package/dist/tools/Read/ReadTool.js +8 -0
  103. package/dist/tools/Read/UI.d.ts +2 -0
  104. package/dist/tools/Read/UI.d.ts.map +1 -0
  105. package/dist/tools/Read/UI.js +6 -0
  106. package/dist/tools/Read/prompt.d.ts +2 -0
  107. package/dist/tools/Read/prompt.d.ts.map +1 -0
  108. package/dist/tools/Read/prompt.js +6 -0
  109. package/dist/tools/Todo/TodoTool.d.ts +6 -0
  110. package/dist/tools/Todo/TodoTool.d.ts.map +1 -0
  111. package/dist/tools/Todo/TodoTool.js +8 -0
  112. package/dist/tools/Todo/UI.d.ts +2 -0
  113. package/dist/tools/Todo/UI.d.ts.map +1 -0
  114. package/dist/tools/Todo/UI.js +6 -0
  115. package/dist/tools/Todo/prompt.d.ts +2 -0
  116. package/dist/tools/Todo/prompt.d.ts.map +1 -0
  117. package/dist/tools/Todo/prompt.js +6 -0
  118. package/dist/tools/WebFetch/UI.d.ts +2 -0
  119. package/dist/tools/WebFetch/UI.d.ts.map +1 -0
  120. package/dist/tools/WebFetch/UI.js +6 -0
  121. package/dist/tools/WebFetch/WebFetchTool.d.ts +6 -0
  122. package/dist/tools/WebFetch/WebFetchTool.d.ts.map +1 -0
  123. package/dist/tools/WebFetch/WebFetchTool.js +8 -0
  124. package/dist/tools/WebFetch/prompt.d.ts +2 -0
  125. package/dist/tools/WebFetch/prompt.d.ts.map +1 -0
  126. package/dist/tools/WebFetch/prompt.js +6 -0
  127. package/dist/tools/WebFetch/web-fetch.d.ts +21 -0
  128. package/dist/tools/WebFetch/web-fetch.d.ts.map +1 -0
  129. package/dist/tools/WebFetch/web-fetch.js +8 -0
  130. package/dist/tools/WebSearch/UI.d.ts +2 -0
  131. package/dist/tools/WebSearch/UI.d.ts.map +1 -0
  132. package/dist/tools/WebSearch/UI.js +6 -0
  133. package/dist/tools/WebSearch/WebSearchTool.d.ts +6 -0
  134. package/dist/tools/WebSearch/WebSearchTool.d.ts.map +1 -0
  135. package/dist/tools/WebSearch/WebSearchTool.js +8 -0
  136. package/dist/tools/WebSearch/bing-scraper.d.ts +30 -0
  137. package/dist/tools/WebSearch/bing-scraper.d.ts.map +1 -0
  138. package/dist/tools/WebSearch/bing-scraper.js +10 -0
  139. package/dist/tools/WebSearch/prompt.d.ts +2 -0
  140. package/dist/tools/WebSearch/prompt.d.ts.map +1 -0
  141. package/dist/tools/WebSearch/prompt.js +6 -0
  142. package/dist/tools/Write/UI.d.ts +2 -0
  143. package/dist/tools/Write/UI.d.ts.map +1 -0
  144. package/dist/tools/Write/UI.js +6 -0
  145. package/dist/tools/Write/WriteTool.d.ts +6 -0
  146. package/dist/tools/Write/WriteTool.d.ts.map +1 -0
  147. package/dist/tools/Write/WriteTool.js +8 -0
  148. package/dist/tools/Write/prompt.d.ts +2 -0
  149. package/dist/tools/Write/prompt.d.ts.map +1 -0
  150. package/dist/tools/Write/prompt.js +6 -0
  151. package/dist/tools/prompts.d.ts +3 -0
  152. package/dist/tools/prompts.d.ts.map +1 -0
  153. package/dist/tools/prompts.js +39 -0
  154. package/dist/tools/ui.d.ts +3 -0
  155. package/dist/tools/ui.d.ts.map +1 -0
  156. package/dist/tools/ui.js +39 -0
  157. package/package.json +26 -0
@@ -0,0 +1,6 @@
1
+ // src/tools/Glob/UI.ts
2
+ var userFacingName = "\u5339\u914D\u6587\u4EF6";
3
+
4
+ export {
5
+ userFacingName
6
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/Read/UI.ts
2
+ var userFacingName = "\u8BFB\u53D6\u6587\u4EF6";
3
+
4
+ export {
5
+ userFacingName
6
+ };
@@ -0,0 +1,52 @@
1
+ import {
2
+ WebSearchTool
3
+ } from "./chunk-4EZHIDZ6.js";
4
+ import {
5
+ WriteTool
6
+ } from "./chunk-I3Z4OKMS.js";
7
+ import {
8
+ MultiEditTool
9
+ } from "./chunk-VJDLOFCF.js";
10
+ import {
11
+ WebFetchTool
12
+ } from "./chunk-LGZOG7IQ.js";
13
+ import {
14
+ GrepTool
15
+ } from "./chunk-AZCQL24J.js";
16
+ import {
17
+ ReadTool
18
+ } from "./chunk-RBHQ5WNR.js";
19
+ import {
20
+ TodoTool
21
+ } from "./chunk-4567YAXM.js";
22
+ import {
23
+ GlobTool
24
+ } from "./chunk-DN3KJZRV.js";
25
+ import {
26
+ EditTool
27
+ } from "./chunk-WLQ7DGMG.js";
28
+ import {
29
+ BashTool
30
+ } from "./chunk-VZWMPUSS.js";
31
+ import {
32
+ DiffTool
33
+ } from "./chunk-7ZOADACP.js";
34
+
35
+ // src/tools/prompts.ts
36
+ var toolPrompts = {
37
+ Read: ReadTool.prompt,
38
+ Write: WriteTool.prompt,
39
+ Edit: EditTool.prompt,
40
+ MultiEdit: MultiEditTool.prompt,
41
+ Grep: GrepTool.prompt,
42
+ Glob: GlobTool.prompt,
43
+ Bash: BashTool.prompt,
44
+ Todo: TodoTool.prompt,
45
+ Diff: DiffTool.prompt,
46
+ WebSearch: WebSearchTool.prompt,
47
+ WebFetch: WebFetchTool.prompt
48
+ };
49
+
50
+ export {
51
+ toolPrompts
52
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ prompt
3
+ } from "./chunk-ZYAEUABC.js";
4
+ import {
5
+ userFacingName
6
+ } from "./chunk-SWK6XRZQ.js";
7
+
8
+ // src/tools/WebFetch/WebFetchTool.ts
9
+ var WebFetchTool = { name: "WebFetch", prompt, userFacingName };
10
+
11
+ export {
12
+ WebFetchTool
13
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/Grep/UI.ts
2
+ var userFacingName = "\u641C\u7D22\u6587\u672C";
3
+
4
+ export {
5
+ userFacingName
6
+ };
@@ -0,0 +1,29 @@
1
+ // src/tool-runtime.ts
2
+ function createTool(definition) {
3
+ const isReadOnly = definition.isReadOnly ?? false;
4
+ const isConcurrencySafe = definition.isConcurrencySafe ?? false;
5
+ const lifecycle = {
6
+ enabled: definition.lifecycle?.enabled ?? true,
7
+ destructive: definition.lifecycle?.destructive ?? false,
8
+ interruptBehavior: definition.lifecycle?.interruptBehavior ?? "not-supported",
9
+ maxResultSizeChars: definition.lifecycle?.maxResultSizeChars ?? 8e3
10
+ };
11
+ const permissionReason = definition.permission.reason;
12
+ return {
13
+ ...definition,
14
+ isReadOnly,
15
+ isConcurrencySafe,
16
+ lifecycle,
17
+ isReadOnlyTool: () => isReadOnly,
18
+ isDestructive: () => lifecycle.destructive,
19
+ checkPermissions: definition.checkPermissions ?? (() => isReadOnly ? { behavior: "allow", reason: permissionReason } : { behavior: "passthrough", reason: permissionReason }),
20
+ userFacingName: definition.userFacingName ?? (() => definition.title),
21
+ getToolUseSummary: definition.getToolUseSummary ?? (() => definition.description),
22
+ prompt: definition.prompt ?? (() => `${definition.title}: ${definition.description}`),
23
+ getActivityDescription: definition.getActivityDescription ?? (() => definition.description)
24
+ };
25
+ }
26
+
27
+ export {
28
+ createTool
29
+ };
@@ -0,0 +1,52 @@
1
+ import {
2
+ WebSearchTool
3
+ } from "./chunk-4EZHIDZ6.js";
4
+ import {
5
+ WriteTool
6
+ } from "./chunk-I3Z4OKMS.js";
7
+ import {
8
+ MultiEditTool
9
+ } from "./chunk-VJDLOFCF.js";
10
+ import {
11
+ WebFetchTool
12
+ } from "./chunk-LGZOG7IQ.js";
13
+ import {
14
+ GrepTool
15
+ } from "./chunk-AZCQL24J.js";
16
+ import {
17
+ ReadTool
18
+ } from "./chunk-RBHQ5WNR.js";
19
+ import {
20
+ TodoTool
21
+ } from "./chunk-4567YAXM.js";
22
+ import {
23
+ GlobTool
24
+ } from "./chunk-DN3KJZRV.js";
25
+ import {
26
+ EditTool
27
+ } from "./chunk-WLQ7DGMG.js";
28
+ import {
29
+ BashTool
30
+ } from "./chunk-VZWMPUSS.js";
31
+ import {
32
+ DiffTool
33
+ } from "./chunk-7ZOADACP.js";
34
+
35
+ // src/tools/ui.ts
36
+ var toolUserFacingNames = {
37
+ Read: ReadTool.userFacingName,
38
+ Write: WriteTool.userFacingName,
39
+ Edit: EditTool.userFacingName,
40
+ MultiEdit: MultiEditTool.userFacingName,
41
+ Grep: GrepTool.userFacingName,
42
+ Glob: GlobTool.userFacingName,
43
+ Bash: BashTool.userFacingName,
44
+ Todo: TodoTool.userFacingName,
45
+ Diff: DiffTool.userFacingName,
46
+ WebSearch: WebSearchTool.userFacingName,
47
+ WebFetch: WebFetchTool.userFacingName
48
+ };
49
+
50
+ export {
51
+ toolUserFacingNames
52
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/Write/UI.ts
2
+ var userFacingName = "\u5199\u5165\u6587\u4EF6";
3
+
4
+ export {
5
+ userFacingName
6
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/Write/prompt.ts
2
+ var prompt = "Use Write only when replacing or creating a whole workspace file is required. Prefer Edit/MultiEdit for small changes and include expectedHash when available.";
3
+
4
+ export {
5
+ prompt
6
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ prompt
3
+ } from "./chunk-HNIVNZIS.js";
4
+ import {
5
+ userFacingName
6
+ } from "./chunk-K3YDFDLP.js";
7
+
8
+ // src/tools/Read/ReadTool.ts
9
+ var ReadTool = { name: "Read", prompt, userFacingName };
10
+
11
+ export {
12
+ ReadTool
13
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/Edit/prompt.ts
2
+ var prompt = "Use Edit for one exact string replacement after reading the file. oldText must be unique and should include enough context to avoid accidental edits.";
3
+
4
+ export {
5
+ prompt
6
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/WebFetch/UI.ts
2
+ var userFacingName = "\u6293\u53D6\u7F51\u9875";
3
+
4
+ export {
5
+ userFacingName
6
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/Todo/prompt.ts
2
+ var prompt = "Use Todo to keep multi-step work visible. Add, start, complete, or block items as task state changes.";
3
+
4
+ export {
5
+ prompt
6
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/WebSearch/UI.ts
2
+ var userFacingName = "\u641C\u7D22\u7F51\u9875";
3
+
4
+ export {
5
+ userFacingName
6
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ prompt
3
+ } from "./chunk-3RP665TH.js";
4
+ import {
5
+ userFacingName
6
+ } from "./chunk-IOC3BSPT.js";
7
+
8
+ // src/tools/MultiEdit/MultiEditTool.ts
9
+ var MultiEditTool = { name: "MultiEdit", prompt, userFacingName };
10
+
11
+ export {
12
+ MultiEditTool
13
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ prompt
3
+ } from "./chunk-E75PYM7V.js";
4
+ import {
5
+ userFacingName
6
+ } from "./chunk-GAWMEMXB.js";
7
+
8
+ // src/tools/Bash/BashTool.ts
9
+ var BashTool = { name: "Bash", prompt, userFacingName };
10
+
11
+ export {
12
+ BashTool
13
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ prompt
3
+ } from "./chunk-SQP6SJRP.js";
4
+ import {
5
+ userFacingName
6
+ } from "./chunk-BRG64AEC.js";
7
+
8
+ // src/tools/Edit/EditTool.ts
9
+ var EditTool = { name: "Edit", prompt, userFacingName };
10
+
11
+ export {
12
+ EditTool
13
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/Todo/UI.ts
2
+ var userFacingName = "\u4EFB\u52A1\u5217\u8868";
3
+
4
+ export {
5
+ userFacingName
6
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/WebSearch/prompt.ts
2
+ var prompt = "WebSearch searches the web via Bing and returns structured results (title, URL, snippet). Use it when you need current information beyond your knowledge cutoff. Results are organic search listings \u2014 no ads, no injected content. Each result shows the page title, URL, and a content snippet. You should cite sources (with URLs) in your response when you use search results. Use allowed_domains/blocked_domains to filter results by hostname. Default returns up to 8 results.";
3
+
4
+ export {
5
+ prompt
6
+ };
@@ -0,0 +1,6 @@
1
+ // src/tools/WebFetch/prompt.ts
2
+ var prompt = "WebFetch fetches the content of a URL and returns it as text (HTML pages are converted to plain text). Use it to read documentation, articles, or any web page the user references. The tool strips scripts/styles/navigation and returns only the meaningful text content. Results are truncated at ~50K characters. If you provide a prompt, the returned content is scoped to what you asked about. The URL must be a fully-formed https? URL. Internal/private addresses (localhost, 127.0.0.1, 192.168.x, etc.) are blocked for security.";
3
+
4
+ export {
5
+ prompt
6
+ };
@@ -0,0 +1,147 @@
1
+ import { type ToolDefinition } from "./tool-runtime.js";
2
+ export type { ToolDefinition, ToolFactoryDefinition, ToolInterruptBehavior, ToolLifecycleMetadata, ToolPermissionDecision, } from "./tool-runtime.js";
3
+ export { createTool } from "./tool-runtime.js";
4
+ export type ToolRisk = "low" | "medium" | "high";
5
+ export type ToolPermissionSpec = {
6
+ risk: ToolRisk;
7
+ scope: "workspace" | "command" | "session";
8
+ reason: string;
9
+ phase06Mode: "metadata-only";
10
+ };
11
+ export type ToolOutput = {
12
+ text: string;
13
+ summary?: string;
14
+ preview?: string;
15
+ details?: string;
16
+ data?: unknown;
17
+ truncated?: boolean;
18
+ fullOutputPath?: string;
19
+ evidenceId?: string;
20
+ changedFiles?: string[];
21
+ };
22
+ export type ToolProgressEvent = {
23
+ toolName: ToolName;
24
+ stream: "stdout" | "stderr" | "system";
25
+ text: string;
26
+ };
27
+ export type ReadSnapshot = {
28
+ path: string;
29
+ hash: string;
30
+ mtimeMs: number;
31
+ size: number;
32
+ };
33
+ export type ToolContext = {
34
+ workspaceRoot: string;
35
+ logRoot?: string;
36
+ changedFiles: string[];
37
+ todos: TodoItem[];
38
+ readSnapshots?: Record<string, ReadSnapshot>;
39
+ patchSummaries?: Record<string, DiffSummary>;
40
+ abortSignal?: AbortSignal;
41
+ onProgress?: (event: ToolProgressEvent) => void | Promise<void>;
42
+ };
43
+ export type ToolName = "Read" | "Write" | "Edit" | "MultiEdit" | "Grep" | "Glob" | "Bash" | "Todo" | "Diff" | "WebSearch" | "WebFetch";
44
+ export type TodoStatus = "pending" | "in_progress" | "completed" | "blocked";
45
+ export type TodoItem = {
46
+ id: string;
47
+ content: string;
48
+ status: TodoStatus;
49
+ evidence?: string;
50
+ };
51
+ export type DiffSummary = {
52
+ changedFiles: string[];
53
+ addedLines: number;
54
+ removedLines: number;
55
+ summary: string;
56
+ riskyFiles: string[];
57
+ };
58
+ export type ReadInput = {
59
+ path: string;
60
+ offset?: number;
61
+ limit?: number;
62
+ };
63
+ export type WriteInput = {
64
+ path: string;
65
+ content: string;
66
+ expectedHash?: string;
67
+ };
68
+ export type EditInput = {
69
+ path: string;
70
+ oldText: string;
71
+ newText: string;
72
+ expectedHash?: string;
73
+ };
74
+ export type MultiEditInput = {
75
+ path: string;
76
+ edits: {
77
+ oldText: string;
78
+ newText: string;
79
+ }[];
80
+ expectedHash?: string;
81
+ };
82
+ export type GrepInput = {
83
+ pattern: string;
84
+ path?: string;
85
+ limit?: number;
86
+ };
87
+ export type GlobInput = {
88
+ pattern: string;
89
+ path?: string;
90
+ limit?: number;
91
+ };
92
+ export type BashInput = {
93
+ command: string;
94
+ timeoutMs?: number;
95
+ };
96
+ export type TodoInput = {
97
+ action: "list";
98
+ } | {
99
+ action: "add";
100
+ content: string;
101
+ id?: string;
102
+ } | {
103
+ action: "start" | "done" | "block";
104
+ id: string;
105
+ content?: string;
106
+ evidence?: string;
107
+ };
108
+ export type DiffInput = {
109
+ files?: string[];
110
+ };
111
+ export type { WebSearchInput, SearchResult } from "./tools/WebSearch/bing-scraper.js";
112
+ export type { WebFetchInput } from "./tools/WebFetch/web-fetch.js";
113
+ export type ToolRunResult = {
114
+ id: string;
115
+ name: ToolName;
116
+ input: unknown;
117
+ output: ToolOutput;
118
+ };
119
+ export declare const toolRegistryStatus: "ready";
120
+ export declare function createToolContext(workspaceRoot?: string): ToolContext;
121
+ /**
122
+ * **UNSAFE LOW-LEVEL PRIMITIVE.** Executes a built-in tool directly without
123
+ * any permission policy check.
124
+ *
125
+ * D.13N — TUI main paths (model tool dispatch, slash commands) MUST go
126
+ * through `decidePermission` (and by extension, the permission-policy-engine)
127
+ * BEFORE calling `runTool`. This entry exists only for callers that have
128
+ * already passed a policy decision (e.g. `executeApprovedModelToolUse` in
129
+ * the TUI package). New consumers should add a permission gate at the
130
+ * call site rather than bypassing here.
131
+ *
132
+ * Do NOT export this through wrapper modules without a permission check.
133
+ */
134
+ export declare function runTool(name: ToolName, input: unknown, context: ToolContext): Promise<ToolRunResult>;
135
+ export declare const builtInTools: Record<ToolName, ToolDefinition>;
136
+ type ShellCommandAdapter = {
137
+ command: string;
138
+ adapter: "native" | "powershell-adapted" | "blocked";
139
+ logCommand?: string;
140
+ };
141
+ export declare function adaptShellCommand(command: string): ShellCommandAdapter;
142
+ export declare function adaptShellCommandForPlatform(command: string, platform: NodeJS.Platform): ShellCommandAdapter;
143
+ declare function globToRegExp(pattern: string): RegExp;
144
+ declare function decodeShellChunk(chunk: Buffer): string;
145
+ export declare const __testGlobToRegExp: typeof globToRegExp;
146
+ export declare const __testDecodeShellChunk: typeof decodeShellChunk;
147
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAQ3B,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAA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