@zhijiewang/openharness 2.1.0 → 2.3.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 (233) hide show
  1. package/README.md +4 -4
  2. package/dist/DeferredTool.js +3 -1
  3. package/dist/Tool.d.ts +1 -1
  4. package/dist/agents/roles.js +58 -62
  5. package/dist/commands/cybergotchi.d.ts +1 -1
  6. package/dist/commands/cybergotchi.js +30 -30
  7. package/dist/commands/index.js +288 -132
  8. package/dist/components/App.d.ts +1 -1
  9. package/dist/components/App.js +6 -6
  10. package/dist/components/CompanionFooter.d.ts +1 -1
  11. package/dist/components/CompanionFooter.js +6 -8
  12. package/dist/components/CybergotchiBubble.js +5 -5
  13. package/dist/components/CybergotchiPanel.d.ts +1 -1
  14. package/dist/components/CybergotchiPanel.js +7 -7
  15. package/dist/components/CybergotchiPanelConnected.js +2 -2
  16. package/dist/components/CybergotchiSetup.js +26 -24
  17. package/dist/components/CybergotchiSprite.d.ts +1 -1
  18. package/dist/components/CybergotchiSprite.js +8 -12
  19. package/dist/components/DiffView.d.ts +1 -1
  20. package/dist/components/DiffView.js +10 -10
  21. package/dist/components/ErrorBoundary.d.ts +1 -1
  22. package/dist/components/ErrorBoundary.js +1 -1
  23. package/dist/components/InitWizard.js +65 -33
  24. package/dist/components/Markdown.js +2 -4
  25. package/dist/components/Messages.js +4 -4
  26. package/dist/components/PermissionPrompt.d.ts +1 -1
  27. package/dist/components/PermissionPrompt.js +15 -17
  28. package/dist/components/REPL.d.ts +1 -1
  29. package/dist/components/REPL.js +74 -49
  30. package/dist/components/Spinner.js +2 -2
  31. package/dist/components/TextInput.js +35 -29
  32. package/dist/components/ToolCallDisplay.js +3 -5
  33. package/dist/cybergotchi/bones.d.ts +1 -1
  34. package/dist/cybergotchi/bones.js +8 -8
  35. package/dist/cybergotchi/config.d.ts +2 -2
  36. package/dist/cybergotchi/config.js +13 -13
  37. package/dist/cybergotchi/events.d.ts +5 -5
  38. package/dist/cybergotchi/events.js +7 -7
  39. package/dist/cybergotchi/needs.d.ts +2 -2
  40. package/dist/cybergotchi/needs.js +7 -9
  41. package/dist/cybergotchi/personality.d.ts +2 -2
  42. package/dist/cybergotchi/personality.js +2 -2
  43. package/dist/cybergotchi/species.d.ts +1 -1
  44. package/dist/cybergotchi/species.js +145 -217
  45. package/dist/cybergotchi/speech.d.ts +2 -2
  46. package/dist/cybergotchi/speech.js +43 -43
  47. package/dist/cybergotchi/types.d.ts +4 -4
  48. package/dist/cybergotchi/types.js +26 -26
  49. package/dist/cybergotchi/useCybergotchi.d.ts +1 -1
  50. package/dist/cybergotchi/useCybergotchi.js +29 -25
  51. package/dist/git/index.js +11 -9
  52. package/dist/harness/checkpoints.js +29 -21
  53. package/dist/harness/config.d.ts +3 -3
  54. package/dist/harness/config.js +15 -9
  55. package/dist/harness/context-warning.d.ts +1 -1
  56. package/dist/harness/context-warning.js +1 -1
  57. package/dist/harness/cost.js +1 -1
  58. package/dist/harness/credentials.js +13 -13
  59. package/dist/harness/hooks.js +7 -5
  60. package/dist/harness/keybindings.js +20 -18
  61. package/dist/harness/marketplace.d.ts +3 -3
  62. package/dist/harness/marketplace.js +55 -42
  63. package/dist/harness/memory.d.ts +23 -5
  64. package/dist/harness/memory.js +142 -41
  65. package/dist/harness/onboarding.js +30 -10
  66. package/dist/harness/plugins.d.ts +9 -1
  67. package/dist/harness/plugins.js +54 -30
  68. package/dist/harness/rules.js +12 -7
  69. package/dist/harness/sandbox.js +15 -15
  70. package/dist/harness/session-db.d.ts +55 -0
  71. package/dist/harness/session-db.js +165 -0
  72. package/dist/harness/session.d.ts +1 -1
  73. package/dist/harness/session.js +34 -15
  74. package/dist/harness/store.d.ts +3 -3
  75. package/dist/harness/store.js +6 -4
  76. package/dist/harness/submit-handler.d.ts +4 -4
  77. package/dist/harness/submit-handler.js +25 -23
  78. package/dist/harness/telemetry.d.ts +1 -1
  79. package/dist/harness/telemetry.js +23 -19
  80. package/dist/harness/traces.d.ts +2 -2
  81. package/dist/harness/traces.js +39 -33
  82. package/dist/harness/verification.d.ts +1 -1
  83. package/dist/harness/verification.js +50 -44
  84. package/dist/lsp/client.js +44 -40
  85. package/dist/main.js +98 -59
  86. package/dist/mcp/DeferredMcpTool.d.ts +4 -4
  87. package/dist/mcp/DeferredMcpTool.js +9 -5
  88. package/dist/mcp/McpTool.d.ts +4 -4
  89. package/dist/mcp/McpTool.js +8 -4
  90. package/dist/mcp/client.d.ts +2 -2
  91. package/dist/mcp/client.js +21 -21
  92. package/dist/mcp/loader.d.ts +1 -1
  93. package/dist/mcp/loader.js +17 -12
  94. package/dist/mcp/registry.d.ts +3 -3
  95. package/dist/mcp/registry.js +97 -97
  96. package/dist/mcp/schema.d.ts +1 -1
  97. package/dist/mcp/schema.js +16 -16
  98. package/dist/mcp/server.d.ts +1 -1
  99. package/dist/mcp/server.js +21 -21
  100. package/dist/mcp/types.d.ts +3 -3
  101. package/dist/providers/anthropic.d.ts +2 -2
  102. package/dist/providers/anthropic.js +10 -9
  103. package/dist/providers/base.d.ts +1 -1
  104. package/dist/providers/index.js +10 -3
  105. package/dist/providers/llamacpp.d.ts +2 -2
  106. package/dist/providers/llamacpp.js +1 -3
  107. package/dist/providers/ollama.d.ts +2 -2
  108. package/dist/providers/ollama.js +3 -4
  109. package/dist/providers/openai.d.ts +2 -2
  110. package/dist/providers/openai.js +3 -5
  111. package/dist/providers/openrouter.d.ts +2 -2
  112. package/dist/providers/router.d.ts +1 -1
  113. package/dist/providers/router.js +7 -7
  114. package/dist/query/compress.d.ts +2 -2
  115. package/dist/query/compress.js +22 -21
  116. package/dist/query/context-manager.d.ts +1 -1
  117. package/dist/query/context-manager.js +5 -5
  118. package/dist/query/errors.js +1 -1
  119. package/dist/query/index.d.ts +1 -1
  120. package/dist/query/index.js +30 -22
  121. package/dist/query/tools.js +15 -12
  122. package/dist/query/types.d.ts +1 -1
  123. package/dist/query.d.ts +1 -1
  124. package/dist/query.js +1 -1
  125. package/dist/remote/auth.d.ts +2 -2
  126. package/dist/remote/auth.js +8 -8
  127. package/dist/remote/server.d.ts +3 -3
  128. package/dist/remote/server.js +60 -60
  129. package/dist/renderer/cells.js +9 -9
  130. package/dist/renderer/colors.js +24 -6
  131. package/dist/renderer/diff.d.ts +2 -2
  132. package/dist/renderer/diff.js +27 -19
  133. package/dist/renderer/differ.d.ts +1 -1
  134. package/dist/renderer/differ.js +9 -9
  135. package/dist/renderer/image.js +19 -19
  136. package/dist/renderer/index.d.ts +6 -6
  137. package/dist/renderer/index.js +163 -93
  138. package/dist/renderer/input.js +66 -48
  139. package/dist/renderer/layout.d.ts +6 -6
  140. package/dist/renderer/layout.js +163 -124
  141. package/dist/renderer/markdown.d.ts +2 -2
  142. package/dist/renderer/markdown.js +173 -54
  143. package/dist/renderer/session-browser.d.ts +2 -2
  144. package/dist/renderer/session-browser.js +19 -21
  145. package/dist/repl.d.ts +5 -5
  146. package/dist/repl.js +300 -198
  147. package/dist/sdk/index.d.ts +5 -5
  148. package/dist/sdk/index.js +32 -26
  149. package/dist/services/AgentDispatcher.d.ts +3 -3
  150. package/dist/services/AgentDispatcher.js +33 -29
  151. package/dist/services/CronExecutor.d.ts +4 -4
  152. package/dist/services/CronExecutor.js +12 -8
  153. package/dist/services/EvaluatorLoop.d.ts +3 -3
  154. package/dist/services/EvaluatorLoop.js +29 -21
  155. package/dist/services/MetaHarness.d.ts +1 -1
  156. package/dist/services/MetaHarness.js +34 -32
  157. package/dist/services/PipelineExecutor.d.ts +1 -1
  158. package/dist/services/PipelineExecutor.js +23 -25
  159. package/dist/services/SkillExtractor.d.ts +43 -0
  160. package/dist/services/SkillExtractor.js +143 -0
  161. package/dist/services/StreamingToolExecutor.d.ts +2 -2
  162. package/dist/services/StreamingToolExecutor.js +11 -7
  163. package/dist/services/a2a.d.ts +8 -8
  164. package/dist/services/a2a.js +44 -34
  165. package/dist/services/agent-messaging.d.ts +33 -15
  166. package/dist/services/agent-messaging.js +65 -13
  167. package/dist/services/cron.js +16 -16
  168. package/dist/tools/AgentTool/index.d.ts +5 -2
  169. package/dist/tools/AgentTool/index.js +35 -15
  170. package/dist/tools/AskUserTool/index.js +1 -1
  171. package/dist/tools/BashTool/index.d.ts +2 -2
  172. package/dist/tools/BashTool/index.js +18 -10
  173. package/dist/tools/CronTool/index.d.ts +2 -2
  174. package/dist/tools/CronTool/index.js +30 -12
  175. package/dist/tools/DiagnosticsTool/index.js +28 -22
  176. package/dist/tools/EnterPlanModeTool/index.js +93 -14
  177. package/dist/tools/EnterWorktreeTool/index.js +7 -3
  178. package/dist/tools/ExitPlanModeTool/index.d.ts +22 -1
  179. package/dist/tools/ExitPlanModeTool/index.js +20 -5
  180. package/dist/tools/ExitWorktreeTool/index.js +11 -4
  181. package/dist/tools/FileEditTool/index.js +3 -5
  182. package/dist/tools/FileReadTool/index.js +16 -10
  183. package/dist/tools/FileWriteTool/index.js +2 -2
  184. package/dist/tools/GlobTool/index.js +5 -9
  185. package/dist/tools/GrepTool/index.d.ts +2 -2
  186. package/dist/tools/GrepTool/index.js +14 -9
  187. package/dist/tools/ImageReadTool/index.js +2 -2
  188. package/dist/tools/KillProcessTool/index.js +11 -7
  189. package/dist/tools/LSTool/index.js +3 -3
  190. package/dist/tools/MemoryTool/index.d.ts +11 -11
  191. package/dist/tools/MemoryTool/index.js +28 -14
  192. package/dist/tools/MonitorTool/index.js +24 -19
  193. package/dist/tools/MultiEditTool/index.js +9 -5
  194. package/dist/tools/NotebookEditTool/index.js +3 -3
  195. package/dist/tools/ParallelAgentTool/index.d.ts +4 -4
  196. package/dist/tools/ParallelAgentTool/index.js +12 -6
  197. package/dist/tools/PipelineTool/index.d.ts +4 -4
  198. package/dist/tools/PipelineTool/index.js +3 -3
  199. package/dist/tools/PowerShellTool/index.js +10 -6
  200. package/dist/tools/RemoteTriggerTool/index.js +8 -4
  201. package/dist/tools/ScheduleWakeupTool/index.d.ts +42 -0
  202. package/dist/tools/ScheduleWakeupTool/index.js +115 -0
  203. package/dist/tools/SendMessageTool/index.js +25 -7
  204. package/dist/tools/SessionSearchTool/index.d.ts +15 -0
  205. package/dist/tools/SessionSearchTool/index.js +36 -0
  206. package/dist/tools/SkillTool/index.d.ts +3 -0
  207. package/dist/tools/SkillTool/index.js +39 -9
  208. package/dist/tools/TaskCreateTool/index.d.ts +2 -2
  209. package/dist/tools/TaskCreateTool/index.js +2 -2
  210. package/dist/tools/TaskGetTool/index.js +2 -2
  211. package/dist/tools/TaskListTool/index.js +3 -5
  212. package/dist/tools/TaskOutputTool/index.js +2 -2
  213. package/dist/tools/TaskStopTool/index.js +3 -3
  214. package/dist/tools/TaskUpdateTool/index.d.ts +4 -4
  215. package/dist/tools/TaskUpdateTool/index.js +2 -2
  216. package/dist/tools/ToolSearchTool/index.js +9 -6
  217. package/dist/tools/WebFetchTool/index.js +1 -1
  218. package/dist/tools/WebSearchTool/index.js +2 -6
  219. package/dist/tools.js +31 -30
  220. package/dist/types/permissions.js +15 -9
  221. package/dist/utils/bash-safety.d.ts +1 -1
  222. package/dist/utils/bash-safety.js +64 -54
  223. package/dist/utils/diff-algorithm.d.ts +3 -3
  224. package/dist/utils/diff-algorithm.js +7 -7
  225. package/dist/utils/fs.js +3 -3
  226. package/dist/utils/safe-env.js +1 -1
  227. package/dist/utils/theme-data.d.ts +1 -1
  228. package/dist/utils/theme-data.js +1 -1
  229. package/dist/utils/theme.d.ts +1 -1
  230. package/dist/utils/theme.js +1 -1
  231. package/dist/utils/tool-summary.d.ts +1 -1
  232. package/dist/utils/tool-summary.js +27 -9
  233. package/package.json +10 -3
@@ -20,8 +20,8 @@ declare const inputSchema: z.ZodObject<{
20
20
  path?: string | undefined;
21
21
  type?: string | undefined;
22
22
  glob?: string | undefined;
23
- context?: number | undefined;
24
23
  offset?: number | undefined;
24
+ context?: number | undefined;
25
25
  output_mode?: "content" | "files_with_matches" | "count" | undefined;
26
26
  head_limit?: number | undefined;
27
27
  multiline?: boolean | undefined;
@@ -35,8 +35,8 @@ declare const inputSchema: z.ZodObject<{
35
35
  path?: string | undefined;
36
36
  type?: string | undefined;
37
37
  glob?: string | undefined;
38
- context?: number | undefined;
39
38
  offset?: number | undefined;
39
+ context?: number | undefined;
40
40
  output_mode?: "content" | "files_with_matches" | "count" | undefined;
41
41
  head_limit?: number | undefined;
42
42
  multiline?: boolean | undefined;
@@ -1,7 +1,7 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
1
3
  import { z } from "zod";
2
- import * as fs from "fs/promises";
3
- import * as path from "path";
4
- import { walkDir, matchGlob } from "../../utils/fs.js";
4
+ import { matchGlob, walkDir } from "../../utils/fs.js";
5
5
  const inputSchema = z.object({
6
6
  pattern: z.string(),
7
7
  path: z.string().optional(),
@@ -62,7 +62,7 @@ export const GrepTool = {
62
62
  const skipOffset = input.offset ?? 0;
63
63
  const caseInsensitive = input["-i"] ?? false;
64
64
  const showLineNumbers = input["-n"] !== false; // default true
65
- const flags = "g" + (caseInsensitive ? "i" : "") + (input.multiline ? "ms" : "");
65
+ const flags = `g${caseInsensitive ? "i" : ""}${input.multiline ? "ms" : ""}`;
66
66
  let re;
67
67
  try {
68
68
  re = new RegExp(input.pattern, flags);
@@ -76,10 +76,10 @@ export const GrepTool = {
76
76
  const allFiles = await walkDir(baseDir);
77
77
  let files = allFiles;
78
78
  if (input.glob) {
79
- files = files.filter(f => matchGlob(path.relative(baseDir, f), input.glob));
79
+ files = files.filter((f) => matchGlob(path.relative(baseDir, f), input.glob));
80
80
  }
81
81
  if (typeExts) {
82
- files = files.filter(f => typeExts.some(ext => f.endsWith(ext)));
82
+ files = files.filter((f) => typeExts.some((ext) => f.endsWith(ext)));
83
83
  }
84
84
  // Multiline matching: match against entire file content
85
85
  if (input.multiline) {
@@ -116,10 +116,15 @@ export const GrepTool = {
116
116
  }
117
117
  }
118
118
  }
119
- catch { /* skip */ }
119
+ catch {
120
+ /* skip */
121
+ }
120
122
  }
121
123
  if (outputMode === "count") {
122
- return { output: fileCounts.map(fc => `${fc.file}:${fc.count}`).join("\n") || "No matches found.", isError: false };
124
+ return {
125
+ output: fileCounts.map((fc) => `${fc.file}:${fc.count}`).join("\n") || "No matches found.",
126
+ isError: false,
127
+ };
123
128
  }
124
129
  else if (outputMode === "files_with_matches") {
125
130
  return { output: matchedFiles.join("\n") || "No matches found.", isError: false };
@@ -185,7 +190,7 @@ export const GrepTool = {
185
190
  }
186
191
  }
187
192
  if (outputMode === "count") {
188
- const output = fileCounts.map(fc => `${fc.file}:${fc.count}`).join("\n");
193
+ const output = fileCounts.map((fc) => `${fc.file}:${fc.count}`).join("\n");
189
194
  return { output: output || "No matches found.", isError: false };
190
195
  }
191
196
  if (outputMode === "files_with_matches") {
@@ -1,6 +1,6 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
1
3
  import { z } from "zod";
2
- import * as fs from "fs/promises";
3
- import * as path from "path";
4
4
  const SUPPORTED_TYPES = {
5
5
  ".png": "image/png",
6
6
  ".jpg": "image/jpeg",
@@ -9,25 +9,29 @@ export const KillProcessTool = {
9
9
  description: "Kill a running process by PID or name. Use for stopping background tasks or stuck processes.",
10
10
  inputSchema,
11
11
  riskLevel: "high",
12
- isReadOnly() { return false; },
13
- isConcurrencySafe() { return true; },
12
+ isReadOnly() {
13
+ return false;
14
+ },
15
+ isConcurrencySafe() {
16
+ return true;
17
+ },
14
18
  async call(input) {
15
19
  if (!input.pid && !input.name) {
16
20
  return { output: "Provide either pid or name.", isError: true };
17
21
  }
18
22
  try {
19
23
  if (input.pid) {
20
- const signal = input.signal ?? 'SIGTERM';
24
+ const signal = input.signal ?? "SIGTERM";
21
25
  process.kill(input.pid, signal);
22
26
  return { output: `Sent ${signal} to PID ${input.pid}`, isError: false };
23
27
  }
24
28
  if (input.name) {
25
- const { execSync } = await import('node:child_process');
26
- const isWin = process.platform === 'win32';
29
+ const { execSync } = await import("node:child_process");
30
+ const isWin = process.platform === "win32";
27
31
  const cmd = isWin
28
32
  ? `taskkill /IM "${input.name}" /F`
29
- : `pkill ${input.signal ? `-${input.signal}` : ''} "${input.name}"`;
30
- const result = execSync(cmd, { encoding: 'utf-8', timeout: 5000 });
33
+ : `pkill ${input.signal ? `-${input.signal}` : ""} "${input.name}"`;
34
+ const result = execSync(cmd, { encoding: "utf-8", timeout: 5000 });
31
35
  return { output: result || `Killed process: ${input.name}`, isError: false };
32
36
  }
33
37
  }
@@ -1,6 +1,6 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
1
3
  import { z } from "zod";
2
- import * as fs from "fs/promises";
3
- import * as path from "path";
4
4
  const inputSchema = z.object({
5
5
  path: z.string().optional(),
6
6
  depth: z.number().optional(),
@@ -22,7 +22,7 @@ async function listDir(dir, prefix, maxDepth, currentDepth) {
22
22
  if (entry.isDirectory()) {
23
23
  lines.push(`${prefix}${entry.name}/`);
24
24
  if (currentDepth + 1 < maxDepth) {
25
- const subLines = await listDir(path.join(dir, entry.name), prefix + " ", maxDepth, currentDepth + 1);
25
+ const subLines = await listDir(path.join(dir, entry.name), `${prefix} `, maxDepth, currentDepth + 1);
26
26
  lines.push(...subLines);
27
27
  }
28
28
  }
@@ -3,27 +3,27 @@ import type { Tool } from "../../Tool.js";
3
3
  declare const inputSchema: z.ZodObject<{
4
4
  action: z.ZodEnum<["save", "list", "search"]>;
5
5
  name: z.ZodOptional<z.ZodString>;
6
- type: z.ZodOptional<z.ZodEnum<["convention", "preference", "project", "debugging"]>>;
6
+ type: z.ZodOptional<z.ZodEnum<["convention", "preference", "project", "debugging", "user", "feedback", "reference"]>>;
7
7
  description: z.ZodOptional<z.ZodString>;
8
8
  content: z.ZodOptional<z.ZodString>;
9
9
  query: z.ZodOptional<z.ZodString>;
10
10
  global: z.ZodOptional<z.ZodBoolean>;
11
11
  }, "strip", z.ZodTypeAny, {
12
- action: "search" | "save" | "list";
12
+ action: "search" | "list" | "save";
13
13
  content?: string | undefined;
14
- type?: "convention" | "preference" | "project" | "debugging" | undefined;
15
- global?: boolean | undefined;
16
- name?: string | undefined;
17
- description?: string | undefined;
14
+ type?: "user" | "convention" | "preference" | "project" | "debugging" | "feedback" | "reference" | undefined;
18
15
  query?: string | undefined;
16
+ description?: string | undefined;
17
+ name?: string | undefined;
18
+ global?: boolean | undefined;
19
19
  }, {
20
- action: "search" | "save" | "list";
20
+ action: "search" | "list" | "save";
21
21
  content?: string | undefined;
22
- type?: "convention" | "preference" | "project" | "debugging" | undefined;
23
- global?: boolean | undefined;
24
- name?: string | undefined;
25
- description?: string | undefined;
22
+ type?: "user" | "convention" | "preference" | "project" | "debugging" | "feedback" | "reference" | undefined;
26
23
  query?: string | undefined;
24
+ description?: string | undefined;
25
+ name?: string | undefined;
26
+ global?: boolean | undefined;
27
27
  }>;
28
28
  export declare const MemoryTool: Tool<typeof inputSchema>;
29
29
  export {};
@@ -1,9 +1,19 @@
1
1
  import { z } from "zod";
2
- import { saveMemory, loadActiveMemories, touchMemory } from "../../harness/memory.js";
2
+ import { loadActiveMemories, saveMemory, touchMemory } from "../../harness/memory.js";
3
3
  const inputSchema = z.object({
4
4
  action: z.enum(["save", "list", "search"]),
5
5
  name: z.string().optional().describe("Memory name (for save)"),
6
- type: z.enum(["convention", "preference", "project", "debugging"]).optional(),
6
+ type: z
7
+ .enum([
8
+ "convention",
9
+ "preference",
10
+ "project",
11
+ "debugging", // legacy
12
+ "user",
13
+ "feedback",
14
+ "reference", // Claude Code compatible
15
+ ])
16
+ .optional(),
7
17
  description: z.string().optional(),
8
18
  content: z.string().optional().describe("Memory content (for save)"),
9
19
  query: z.string().optional().describe("Search query (for search)"),
@@ -14,29 +24,33 @@ export const MemoryTool = {
14
24
  description: "Save, list, or search persistent memories that survive across sessions.",
15
25
  inputSchema,
16
26
  riskLevel: "low",
17
- isReadOnly(input) { return input.action !== 'save'; },
18
- isConcurrencySafe() { return true; },
27
+ isReadOnly(input) {
28
+ return input.action !== "save";
29
+ },
30
+ isConcurrencySafe() {
31
+ return true;
32
+ },
19
33
  async call(input) {
20
- if (input.action === 'save') {
34
+ if (input.action === "save") {
21
35
  if (!input.name || !input.content) {
22
36
  return { output: "name and content required for save.", isError: true };
23
37
  }
24
- const path = saveMemory(input.name, input.type ?? 'convention', input.description ?? input.name, input.content, input.global);
38
+ const path = saveMemory(input.name, (input.type ?? "user"), input.description ?? input.name, input.content, input.global);
25
39
  return { output: `Memory saved: ${path}`, isError: false };
26
40
  }
27
- if (input.action === 'list') {
41
+ if (input.action === "list") {
28
42
  const memories = loadActiveMemories();
29
43
  if (memories.length === 0)
30
44
  return { output: "No memories saved.", isError: false };
31
- const lines = memories.map(m => `[${m.type}] ${m.name} (relevance: ${(m.relevance ?? 0.5).toFixed(1)}) — ${m.description}`);
32
- return { output: lines.join('\n'), isError: false };
45
+ const lines = memories.map((m) => `[${m.type}] ${m.name} (relevance: ${(m.relevance ?? 0.5).toFixed(1)}) — ${m.description}`);
46
+ return { output: lines.join("\n"), isError: false };
33
47
  }
34
- if (input.action === 'search') {
48
+ if (input.action === "search") {
35
49
  if (!input.query)
36
50
  return { output: "query required for search.", isError: true };
37
51
  const memories = loadActiveMemories();
38
52
  const q = input.query.toLowerCase();
39
- const matches = memories.filter(m => m.name.toLowerCase().includes(q) ||
53
+ const matches = memories.filter((m) => m.name.toLowerCase().includes(q) ||
40
54
  m.content.toLowerCase().includes(q) ||
41
55
  m.description.toLowerCase().includes(q));
42
56
  if (matches.length === 0)
@@ -44,13 +58,13 @@ export const MemoryTool = {
44
58
  // Touch accessed memories to boost relevance
45
59
  for (const m of matches)
46
60
  touchMemory(m);
47
- const lines = matches.map(m => `[${m.type}] ${m.name}: ${m.content.slice(0, 200)}`);
48
- return { output: lines.join('\n\n'), isError: false };
61
+ const lines = matches.map((m) => `[${m.type}] ${m.name}: ${m.content.slice(0, 200)}`);
62
+ return { output: lines.join("\n\n"), isError: false };
49
63
  }
50
64
  return { output: "Unknown action.", isError: true };
51
65
  },
52
66
  prompt() {
53
- return "Memory: Save/list/search persistent memories across sessions. Actions: save, list, search.";
67
+ return "Memory: Save/list/search persistent memories across sessions. Actions: save, list, search. Types: user (role/preferences), feedback (corrections/confirmations), project (goals/decisions), reference (external pointers). Legacy types also accepted: convention, preference, debugging.";
54
68
  },
55
69
  };
56
70
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import { spawn } from "node:child_process";
2
+ import { z } from "zod";
3
3
  const inputSchema = z.object({
4
4
  command: z.string().describe("Background command to watch"),
5
5
  pattern: z.string().optional().describe("Regex pattern to match output lines"),
@@ -11,8 +11,12 @@ export const MonitorTool = {
11
11
  description: "Watch a background process and collect output. Optionally filter by regex pattern.",
12
12
  inputSchema,
13
13
  riskLevel: "medium",
14
- isReadOnly() { return true; },
15
- isConcurrencySafe() { return true; },
14
+ isReadOnly() {
15
+ return true;
16
+ },
17
+ isConcurrencySafe() {
18
+ return true;
19
+ },
16
20
  async call(input, context) {
17
21
  const timeout = input.timeout ?? 60_000;
18
22
  const maxLines = input.maxLines ?? 100;
@@ -22,7 +26,7 @@ export const MonitorTool = {
22
26
  let settled = false;
23
27
  const proc = spawn(input.command, {
24
28
  shell: true,
25
- stdio: ['pipe', 'pipe', 'pipe'],
29
+ stdio: ["pipe", "pipe", "pipe"],
26
30
  windowsHide: true,
27
31
  });
28
32
  const timer = setTimeout(() => {
@@ -31,7 +35,8 @@ export const MonitorTool = {
31
35
  proc.kill();
32
36
  resolve({
33
37
  output: lines.length > 0
34
- ? lines.join('\n') + `\n\n[Monitor timed out after ${timeout / 1000}s — ${lines.length} lines collected]`
38
+ ? lines.join("\n") +
39
+ `\n\n[Monitor timed out after ${timeout / 1000}s — ${lines.length} lines collected]`
35
40
  : `[Monitor timed out after ${timeout / 1000}s — no output]`,
36
41
  isError: false,
37
42
  });
@@ -45,35 +50,35 @@ export const MonitorTool = {
45
50
  lines.push(line.trimEnd());
46
51
  // Stream output chunk if callback available
47
52
  if (context.onOutputChunk && context.callId) {
48
- context.onOutputChunk(context.callId, line + '\n');
53
+ context.onOutputChunk(context.callId, `${line}\n`);
49
54
  }
50
55
  if (lines.length >= maxLines) {
51
56
  settled = true;
52
57
  clearTimeout(timer);
53
58
  proc.kill();
54
59
  resolve({
55
- output: lines.join('\n') + `\n\n[Collected ${maxLines} lines — stopped]`,
60
+ output: `${lines.join("\n")}\n\n[Collected ${maxLines} lines — stopped]`,
56
61
  isError: false,
57
62
  });
58
63
  }
59
64
  };
60
- let stdoutBuffer = '';
61
- proc.stdout?.on('data', (chunk) => {
65
+ let stdoutBuffer = "";
66
+ proc.stdout?.on("data", (chunk) => {
62
67
  stdoutBuffer += chunk.toString();
63
- const parts = stdoutBuffer.split('\n');
64
- stdoutBuffer = parts.pop() ?? '';
68
+ const parts = stdoutBuffer.split("\n");
69
+ stdoutBuffer = parts.pop() ?? "";
65
70
  for (const line of parts)
66
71
  handleLine(line);
67
72
  });
68
- let stderrBuffer = '';
69
- proc.stderr?.on('data', (chunk) => {
73
+ let stderrBuffer = "";
74
+ proc.stderr?.on("data", (chunk) => {
70
75
  stderrBuffer += chunk.toString();
71
- const parts = stderrBuffer.split('\n');
72
- stderrBuffer = parts.pop() ?? '';
76
+ const parts = stderrBuffer.split("\n");
77
+ stderrBuffer = parts.pop() ?? "";
73
78
  for (const line of parts)
74
79
  handleLine(line);
75
80
  });
76
- proc.on('exit', (code) => {
81
+ proc.on("exit", (code) => {
77
82
  if (!settled) {
78
83
  settled = true;
79
84
  clearTimeout(timer);
@@ -84,13 +89,13 @@ export const MonitorTool = {
84
89
  handleLine(stderrBuffer);
85
90
  resolve({
86
91
  output: lines.length > 0
87
- ? lines.join('\n') + `\n\n[Process exited with code ${code ?? 'unknown'} — ${lines.length} lines]`
88
- : `[Process exited with code ${code ?? 'unknown'} — no output]`,
92
+ ? `${lines.join("\n")}\n\n[Process exited with code ${code ?? "unknown"} — ${lines.length} lines]`
93
+ : `[Process exited with code ${code ?? "unknown"} — no output]`,
89
94
  isError: (code ?? 0) !== 0,
90
95
  });
91
96
  }
92
97
  });
93
- proc.on('error', (err) => {
98
+ proc.on("error", (err) => {
94
99
  if (!settled) {
95
100
  settled = true;
96
101
  clearTimeout(timer);
@@ -1,5 +1,5 @@
1
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
1
2
  import { z } from "zod";
2
- import { readFileSync, writeFileSync, existsSync } from "node:fs";
3
3
  const editSchema = z.object({
4
4
  file_path: z.string(),
5
5
  old_string: z.string(),
@@ -13,8 +13,12 @@ export const MultiEditTool = {
13
13
  description: "Apply multiple file edits atomically. All edits succeed or none do. Useful for coordinated changes across files.",
14
14
  inputSchema,
15
15
  riskLevel: "medium",
16
- isReadOnly() { return false; },
17
- isConcurrencySafe() { return false; },
16
+ isReadOnly() {
17
+ return false;
18
+ },
19
+ isConcurrencySafe() {
20
+ return false;
21
+ },
18
22
  async call(input) {
19
23
  // Phase 1: Validate all edits can be applied
20
24
  const originals = new Map();
@@ -24,7 +28,7 @@ export const MultiEditTool = {
24
28
  return { output: `File not found: ${edit.file_path}`, isError: true };
25
29
  }
26
30
  if (!originals.has(edit.file_path)) {
27
- originals.set(edit.file_path, readFileSync(edit.file_path, 'utf-8'));
31
+ originals.set(edit.file_path, readFileSync(edit.file_path, "utf-8"));
28
32
  }
29
33
  const current = modified.get(edit.file_path) ?? originals.get(edit.file_path);
30
34
  if (!current.includes(edit.old_string)) {
@@ -42,7 +46,7 @@ export const MultiEditTool = {
42
46
  results.push(path);
43
47
  }
44
48
  return {
45
- output: `Applied ${input.edits.length} edit(s) across ${results.length} file(s): ${results.join(', ')}`,
49
+ output: `Applied ${input.edits.length} edit(s) across ${results.length} file(s): ${results.join(", ")}`,
46
50
  isError: false,
47
51
  };
48
52
  },
@@ -1,6 +1,6 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
1
3
  import { z } from "zod";
2
- import * as fs from "fs/promises";
3
- import * as path from "path";
4
4
  const inputSchema = z.object({
5
5
  notebook_path: z.string(),
6
6
  cell_index: z.number(),
@@ -36,7 +36,7 @@ export const NotebookEditTool = {
36
36
  };
37
37
  }
38
38
  // Notebook cell source is an array of lines
39
- const lines = input.new_source.split("\n").map((line, i, arr) => i < arr.length - 1 ? line + "\n" : line);
39
+ const lines = input.new_source.split("\n").map((line, i, arr) => (i < arr.length - 1 ? `${line}\n` : line));
40
40
  notebook.cells[input.cell_index].source = lines;
41
41
  await fs.writeFile(filePath, JSON.stringify(notebook, null, 1), "utf-8");
42
42
  return {
@@ -7,27 +7,27 @@ declare const inputSchema: z.ZodObject<{
7
7
  description: z.ZodOptional<z.ZodString>;
8
8
  blockedBy: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
9
9
  }, "strip", z.ZodTypeAny, {
10
- prompt: string;
11
10
  id: string;
11
+ prompt: string;
12
12
  description?: string | undefined;
13
13
  blockedBy?: string[] | undefined;
14
14
  }, {
15
- prompt: string;
16
15
  id: string;
16
+ prompt: string;
17
17
  description?: string | undefined;
18
18
  blockedBy?: string[] | undefined;
19
19
  }>, "many">;
20
20
  }, "strip", z.ZodTypeAny, {
21
21
  tasks: {
22
- prompt: string;
23
22
  id: string;
23
+ prompt: string;
24
24
  description?: string | undefined;
25
25
  blockedBy?: string[] | undefined;
26
26
  }[];
27
27
  }, {
28
28
  tasks: {
29
- prompt: string;
30
29
  id: string;
30
+ prompt: string;
31
31
  description?: string | undefined;
32
32
  blockedBy?: string[] | undefined;
33
33
  }[];
@@ -14,8 +14,12 @@ export const ParallelAgentTool = {
14
14
  description: "Dispatch multiple sub-agents in parallel with optional task dependencies.",
15
15
  inputSchema,
16
16
  riskLevel: "medium",
17
- isReadOnly() { return false; },
18
- isConcurrencySafe() { return false; },
17
+ isReadOnly() {
18
+ return false;
19
+ },
20
+ isConcurrencySafe() {
21
+ return false;
22
+ },
19
23
  async call(input, context) {
20
24
  if (!context.provider || !context.tools) {
21
25
  return { output: "Parallel agents unavailable: provider not in context.", isError: true };
@@ -24,12 +28,14 @@ export const ParallelAgentTool = {
24
28
  const dispatcher = new AgentDispatcher(context.provider, context.tools, systemPrompt, context.permissionMode ?? "trust", context.model, context.workingDir, context.abortSignal);
25
29
  dispatcher.addTasks(input.tasks);
26
30
  const results = await dispatcher.execute();
27
- const output = results.map(r => {
28
- const status = r.isError ? '✗' : '✓';
31
+ const output = results
32
+ .map((r) => {
33
+ const status = r.isError ? "✗" : "✓";
29
34
  const duration = (r.durationMs / 1000).toFixed(1);
30
35
  return `${status} [${r.id}] (${duration}s)\n${r.output}`;
31
- }).join('\n\n---\n\n');
32
- const hasErrors = results.some(r => r.isError);
36
+ })
37
+ .join("\n\n---\n\n");
38
+ const hasErrors = results.some((r) => r.isError);
33
39
  return { output, isError: hasErrors };
34
40
  },
35
41
  prompt() {
@@ -8,29 +8,29 @@ declare const inputSchema: z.ZodObject<{
8
8
  dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
9
9
  }, "strip", z.ZodTypeAny, {
10
10
  tool: string;
11
- args: Record<string, unknown>;
12
11
  id: string;
12
+ args: Record<string, unknown>;
13
13
  dependsOn?: string[] | undefined;
14
14
  }, {
15
15
  tool: string;
16
- args: Record<string, unknown>;
17
16
  id: string;
17
+ args: Record<string, unknown>;
18
18
  dependsOn?: string[] | undefined;
19
19
  }>, "many">;
20
20
  description: z.ZodOptional<z.ZodString>;
21
21
  }, "strip", z.ZodTypeAny, {
22
22
  steps: {
23
23
  tool: string;
24
- args: Record<string, unknown>;
25
24
  id: string;
25
+ args: Record<string, unknown>;
26
26
  dependsOn?: string[] | undefined;
27
27
  }[];
28
28
  description?: string | undefined;
29
29
  }, {
30
30
  steps: {
31
31
  tool: string;
32
- args: Record<string, unknown>;
33
32
  id: string;
33
+ args: Record<string, unknown>;
34
34
  dependsOn?: string[] | undefined;
35
35
  }[];
36
36
  description?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { PipelineExecutor, formatPipelineResults } from "../../services/PipelineExecutor.js";
2
+ import { formatPipelineResults, PipelineExecutor } from "../../services/PipelineExecutor.js";
3
3
  const stepSchema = z.object({
4
4
  id: z.string().describe("Unique step identifier"),
5
5
  tool: z.string().describe("Tool name to execute (Glob, Grep, Read, Bash, etc.)"),
@@ -15,7 +15,7 @@ export const PipelineTool = {
15
15
  description: "Execute a declarative multi-step tool pipeline. Steps run in dependency order with variable substitution.",
16
16
  inputSchema,
17
17
  riskLevel: "medium",
18
- isReadOnly(input) {
18
+ isReadOnly(_input) {
19
19
  // Pipeline is read-only only if ALL steps use read-only tools
20
20
  // Conservative: assume not read-only
21
21
  return false;
@@ -30,7 +30,7 @@ export const PipelineTool = {
30
30
  const executor = new PipelineExecutor(context.tools, context);
31
31
  const results = await executor.execute(input.steps);
32
32
  const summary = formatPipelineResults(results);
33
- const hasErrors = results.some(r => r.isError);
33
+ const hasErrors = results.some((r) => r.isError);
34
34
  return { output: summary, isError: hasErrors };
35
35
  },
36
36
  prompt() {
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import { execSync } from "node:child_process";
2
+ import { z } from "zod";
3
3
  const inputSchema = z.object({
4
4
  command: z.string().describe("PowerShell command to execute"),
5
5
  timeout: z.number().optional().describe("Timeout in ms (default 120000)"),
@@ -9,19 +9,23 @@ export const PowerShellTool = {
9
9
  description: "Execute PowerShell commands (Windows only). Use for Windows-specific tasks like registry access, COM objects, or .NET calls.",
10
10
  inputSchema,
11
11
  riskLevel: "high",
12
- isReadOnly() { return false; },
13
- isConcurrencySafe() { return false; },
12
+ isReadOnly() {
13
+ return false;
14
+ },
15
+ isConcurrencySafe() {
16
+ return false;
17
+ },
14
18
  async call(input) {
15
- if (process.platform !== 'win32') {
19
+ if (process.platform !== "win32") {
16
20
  return { output: "PowerShell is only available on Windows. Use Bash instead.", isError: true };
17
21
  }
18
22
  const timeout = input.timeout ?? 120_000;
19
23
  try {
20
- const output = execSync(`powershell.exe -NoProfile -NonInteractive -Command "${input.command.replace(/"/g, '\\"')}"`, { encoding: 'utf-8', timeout, maxBuffer: 10 * 1024 * 1024, windowsHide: true });
24
+ const output = execSync(`powershell.exe -NoProfile -NonInteractive -Command "${input.command.replace(/"/g, '\\"')}"`, { encoding: "utf-8", timeout, maxBuffer: 10 * 1024 * 1024, windowsHide: true });
21
25
  return { output: output.trim(), isError: false };
22
26
  }
23
27
  catch (err) {
24
- const output = String(err.stdout ?? err.stderr ?? err.message ?? 'PowerShell error');
28
+ const output = String(err.stdout ?? err.stderr ?? err.message ?? "PowerShell error");
25
29
  return { output: output.slice(0, 100_000), isError: true };
26
30
  }
27
31
  },
@@ -10,13 +10,17 @@ export const RemoteTriggerTool = {
10
10
  description: "Trigger a remote webhook or API endpoint. Useful for CI/CD, deployments, and external integrations.",
11
11
  inputSchema,
12
12
  riskLevel: "high",
13
- isReadOnly() { return false; },
14
- isConcurrencySafe() { return true; },
13
+ isReadOnly() {
14
+ return false;
15
+ },
16
+ isConcurrencySafe() {
17
+ return true;
18
+ },
15
19
  async call(input) {
16
20
  try {
17
21
  const method = input.method ?? (input.body ? "POST" : "GET");
18
22
  const headers = {
19
- 'Content-Type': 'application/json',
23
+ "Content-Type": "application/json",
20
24
  ...input.headers,
21
25
  };
22
26
  const res = await fetch(input.url, {
@@ -26,7 +30,7 @@ export const RemoteTriggerTool = {
26
30
  signal: AbortSignal.timeout(30_000),
27
31
  });
28
32
  const text = await res.text();
29
- const truncated = text.length > 5000 ? text.slice(0, 5000) + '\n[truncated]' : text;
33
+ const truncated = text.length > 5000 ? `${text.slice(0, 5000)}\n[truncated]` : text;
30
34
  return {
31
35
  output: `${res.status} ${res.statusText}\n${truncated}`,
32
36
  isError: res.status >= 400,