background-agents 0.1.1 → 0.1.2

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 (210) hide show
  1. package/README.md +173 -241
  2. package/dist/agents/claude/index.d.ts +11 -0
  3. package/dist/agents/claude/index.d.ts.map +1 -0
  4. package/dist/agents/claude/index.js +78 -0
  5. package/dist/agents/claude/index.js.map +1 -0
  6. package/dist/agents/claude/parser.d.ts +16 -0
  7. package/dist/agents/claude/parser.d.ts.map +1 -0
  8. package/dist/agents/claude/parser.js +87 -0
  9. package/dist/agents/claude/parser.js.map +1 -0
  10. package/dist/agents/claude/tools.d.ts +7 -0
  11. package/dist/agents/claude/tools.d.ts.map +1 -0
  12. package/dist/agents/claude/tools.js +15 -0
  13. package/dist/agents/claude/tools.js.map +1 -0
  14. package/dist/agents/codex/index.d.ts +11 -0
  15. package/dist/agents/codex/index.d.ts.map +1 -0
  16. package/dist/agents/codex/index.js +60 -0
  17. package/dist/agents/codex/index.js.map +1 -0
  18. package/dist/agents/codex/parser.d.ts +12 -0
  19. package/dist/agents/codex/parser.d.ts.map +1 -0
  20. package/dist/agents/codex/parser.js +108 -0
  21. package/dist/agents/codex/parser.js.map +1 -0
  22. package/dist/agents/codex/tools.d.ts +11 -0
  23. package/dist/agents/codex/tools.d.ts.map +1 -0
  24. package/dist/agents/codex/tools.js +40 -0
  25. package/dist/agents/codex/tools.js.map +1 -0
  26. package/dist/agents/eliza/bundle-content.d.ts +6 -0
  27. package/dist/agents/eliza/bundle-content.d.ts.map +1 -0
  28. package/dist/agents/eliza/bundle-content.js +7 -0
  29. package/dist/agents/eliza/bundle-content.js.map +1 -0
  30. package/dist/agents/eliza/cli.bundle.js +579 -0
  31. package/dist/agents/eliza/cli.d.ts +10 -0
  32. package/dist/agents/eliza/cli.d.ts.map +1 -0
  33. package/dist/agents/eliza/cli.js +342 -0
  34. package/dist/agents/eliza/cli.js.map +1 -0
  35. package/dist/agents/eliza/index.d.ts +22 -0
  36. package/dist/agents/eliza/index.d.ts.map +1 -0
  37. package/dist/agents/eliza/index.js +54 -0
  38. package/dist/agents/eliza/index.js.map +1 -0
  39. package/dist/agents/eliza/parser.d.ts +16 -0
  40. package/dist/agents/eliza/parser.d.ts.map +1 -0
  41. package/dist/agents/eliza/parser.js +67 -0
  42. package/dist/agents/eliza/parser.js.map +1 -0
  43. package/dist/agents/eliza/patterns.d.ts +41 -0
  44. package/dist/agents/eliza/patterns.d.ts.map +1 -0
  45. package/dist/agents/eliza/patterns.js +259 -0
  46. package/dist/agents/eliza/patterns.js.map +1 -0
  47. package/dist/agents/eliza/tools.d.ts +7 -0
  48. package/dist/agents/eliza/tools.d.ts.map +1 -0
  49. package/dist/agents/eliza/tools.js +14 -0
  50. package/dist/agents/eliza/tools.js.map +1 -0
  51. package/dist/agents/gemini/index.d.ts +11 -0
  52. package/dist/agents/gemini/index.d.ts.map +1 -0
  53. package/dist/agents/gemini/index.js +46 -0
  54. package/dist/agents/gemini/index.js.map +1 -0
  55. package/dist/agents/gemini/parser.d.ts +31 -0
  56. package/dist/agents/gemini/parser.d.ts.map +1 -0
  57. package/dist/agents/gemini/parser.js +106 -0
  58. package/dist/agents/gemini/parser.js.map +1 -0
  59. package/dist/agents/gemini/tools.d.ts +7 -0
  60. package/dist/agents/gemini/tools.d.ts.map +1 -0
  61. package/dist/agents/gemini/tools.js +23 -0
  62. package/dist/agents/gemini/tools.js.map +1 -0
  63. package/dist/agents/goose/index.d.ts +11 -0
  64. package/dist/agents/goose/index.d.ts.map +1 -0
  65. package/dist/agents/goose/index.js +73 -0
  66. package/dist/agents/goose/index.js.map +1 -0
  67. package/dist/agents/goose/parser.d.ts +24 -0
  68. package/dist/agents/goose/parser.d.ts.map +1 -0
  69. package/dist/agents/goose/parser.js +86 -0
  70. package/dist/agents/goose/parser.js.map +1 -0
  71. package/dist/agents/goose/tools.d.ts +10 -0
  72. package/dist/agents/goose/tools.d.ts.map +1 -0
  73. package/dist/agents/goose/tools.js +30 -0
  74. package/dist/agents/goose/tools.js.map +1 -0
  75. package/dist/agents/index.d.ts +27 -0
  76. package/dist/agents/index.d.ts.map +1 -0
  77. package/dist/agents/index.js +46 -0
  78. package/dist/agents/index.js.map +1 -0
  79. package/dist/agents/opencode/index.d.ts +12 -0
  80. package/dist/agents/opencode/index.d.ts.map +1 -0
  81. package/dist/agents/opencode/index.js +53 -0
  82. package/dist/agents/opencode/index.js.map +1 -0
  83. package/dist/agents/opencode/parser.d.ts +15 -0
  84. package/dist/agents/opencode/parser.d.ts.map +1 -0
  85. package/dist/agents/opencode/parser.js +71 -0
  86. package/dist/agents/opencode/parser.js.map +1 -0
  87. package/dist/agents/opencode/tools.d.ts +7 -0
  88. package/dist/agents/opencode/tools.d.ts.map +1 -0
  89. package/dist/agents/opencode/tools.js +10 -0
  90. package/dist/agents/opencode/tools.js.map +1 -0
  91. package/dist/agents/openhands/index.d.ts +17 -0
  92. package/dist/agents/openhands/index.d.ts.map +1 -0
  93. package/dist/agents/openhands/index.js +67 -0
  94. package/dist/agents/openhands/index.js.map +1 -0
  95. package/dist/agents/openhands/parser.d.ts +16 -0
  96. package/dist/agents/openhands/parser.d.ts.map +1 -0
  97. package/dist/agents/openhands/parser.js +93 -0
  98. package/dist/agents/openhands/parser.js.map +1 -0
  99. package/dist/agents/openhands/tools.d.ts +7 -0
  100. package/dist/agents/openhands/tools.d.ts.map +1 -0
  101. package/dist/agents/openhands/tools.js +24 -0
  102. package/dist/agents/openhands/tools.js.map +1 -0
  103. package/dist/agents/pi/index.d.ts +14 -0
  104. package/dist/agents/pi/index.d.ts.map +1 -0
  105. package/dist/agents/pi/index.js +54 -0
  106. package/dist/agents/pi/index.js.map +1 -0
  107. package/dist/agents/pi/parser.d.ts +21 -0
  108. package/dist/agents/pi/parser.d.ts.map +1 -0
  109. package/dist/agents/pi/parser.js +91 -0
  110. package/dist/agents/pi/parser.js.map +1 -0
  111. package/dist/agents/pi/tools.d.ts +8 -0
  112. package/dist/agents/pi/tools.d.ts.map +1 -0
  113. package/dist/agents/pi/tools.js +16 -0
  114. package/dist/agents/pi/tools.js.map +1 -0
  115. package/dist/agents/picocode/index.d.ts +18 -0
  116. package/dist/agents/picocode/index.d.ts.map +1 -0
  117. package/dist/agents/picocode/index.js +68 -0
  118. package/dist/agents/picocode/index.js.map +1 -0
  119. package/dist/agents/picocode/parser.d.ts +19 -0
  120. package/dist/agents/picocode/parser.d.ts.map +1 -0
  121. package/dist/agents/picocode/parser.js +104 -0
  122. package/dist/agents/picocode/parser.js.map +1 -0
  123. package/dist/agents/picocode/tools.d.ts +9 -0
  124. package/dist/agents/picocode/tools.d.ts.map +1 -0
  125. package/dist/agents/picocode/tools.js +27 -0
  126. package/dist/agents/picocode/tools.js.map +1 -0
  127. package/dist/background/index.d.ts +6 -0
  128. package/dist/background/index.d.ts.map +1 -0
  129. package/dist/background/index.js +5 -0
  130. package/dist/background/index.js.map +1 -0
  131. package/dist/background/session.d.ts +47 -0
  132. package/dist/background/session.d.ts.map +1 -0
  133. package/dist/background/session.js +481 -0
  134. package/dist/background/session.js.map +1 -0
  135. package/dist/background/types.d.ts +55 -0
  136. package/dist/background/types.d.ts.map +1 -0
  137. package/dist/background/types.js +5 -0
  138. package/dist/background/types.js.map +1 -0
  139. package/dist/core/agent.d.ts +95 -0
  140. package/dist/core/agent.d.ts.map +1 -0
  141. package/dist/core/agent.js +8 -0
  142. package/dist/core/agent.js.map +1 -0
  143. package/dist/core/index.d.ts +7 -0
  144. package/dist/core/index.d.ts.map +1 -0
  145. package/dist/core/index.js +6 -0
  146. package/dist/core/index.js.map +1 -0
  147. package/dist/core/registry.d.ts +48 -0
  148. package/dist/core/registry.d.ts.map +1 -0
  149. package/dist/core/registry.js +68 -0
  150. package/dist/core/registry.js.map +1 -0
  151. package/dist/core/tools.d.ts +31 -0
  152. package/dist/core/tools.d.ts.map +1 -0
  153. package/dist/core/tools.js +82 -0
  154. package/dist/core/tools.js.map +1 -0
  155. package/dist/debug.js +1 -1
  156. package/dist/debug.js.map +1 -1
  157. package/dist/factory.d.ts +1 -4
  158. package/dist/factory.d.ts.map +1 -1
  159. package/dist/factory.js +1 -4
  160. package/dist/factory.js.map +1 -1
  161. package/dist/index.d.ts +29 -11
  162. package/dist/index.d.ts.map +1 -1
  163. package/dist/index.js +41 -14
  164. package/dist/index.js.map +1 -1
  165. package/dist/providers/base.d.ts +45 -18
  166. package/dist/providers/base.d.ts.map +1 -1
  167. package/dist/providers/base.js +228 -265
  168. package/dist/providers/base.js.map +1 -1
  169. package/dist/providers/gemini.d.ts.map +1 -1
  170. package/dist/providers/gemini.js +18 -8
  171. package/dist/providers/gemini.js.map +1 -1
  172. package/dist/sandbox/daytona.d.ts +5 -1
  173. package/dist/sandbox/daytona.d.ts.map +1 -1
  174. package/dist/sandbox/daytona.js +157 -214
  175. package/dist/sandbox/daytona.js.map +1 -1
  176. package/dist/sandbox/index.d.ts +3 -3
  177. package/dist/sandbox/index.d.ts.map +1 -1
  178. package/dist/sandbox/index.js +2 -2
  179. package/dist/sandbox/index.js.map +1 -1
  180. package/dist/session.d.ts +62 -51
  181. package/dist/session.d.ts.map +1 -1
  182. package/dist/session.js +94 -90
  183. package/dist/session.js.map +1 -1
  184. package/dist/types/index.d.ts +2 -2
  185. package/dist/types/index.d.ts.map +1 -1
  186. package/dist/types/index.js +2 -2
  187. package/dist/types/index.js.map +1 -1
  188. package/dist/types/provider.d.ts +37 -94
  189. package/dist/types/provider.d.ts.map +1 -1
  190. package/dist/types/provider.js +3 -0
  191. package/dist/types/provider.js.map +1 -1
  192. package/dist/utils/index.d.ts +2 -3
  193. package/dist/utils/index.d.ts.map +1 -1
  194. package/dist/utils/index.js +2 -3
  195. package/dist/utils/index.js.map +1 -1
  196. package/dist/utils/install.d.ts +12 -2
  197. package/dist/utils/install.d.ts.map +1 -1
  198. package/dist/utils/install.js +40 -4
  199. package/dist/utils/install.js.map +1 -1
  200. package/package.json +24 -13
  201. package/src/index.ts +156 -0
  202. package/dist/sandbox/daytona-ssh.d.ts +0 -9
  203. package/dist/sandbox/daytona-ssh.d.ts.map +0 -1
  204. package/dist/sandbox/daytona-ssh.js +0 -113
  205. package/dist/sandbox/daytona-ssh.js.map +0 -1
  206. package/dist/utils/session.d.ts +0 -17
  207. package/dist/utils/session.d.ts.map +0 -1
  208. package/dist/utils/session.js +0 -59
  209. package/dist/utils/session.js.map +0 -1
  210. package/next.config.codeagentsdk.cjs +0 -22
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Goose CLI output parser
3
+ *
4
+ * Pure function for parsing Goose CLI stream-json output.
5
+ * Goose outputs newline-delimited JSON events.
6
+ *
7
+ * Actual format discovered from running goose:
8
+ * - {"type":"message","message":{...}} for messages
9
+ * - {"type":"complete","total_tokens":...} for completion
10
+ * - Content blocks use {"type":"text","text":"..."} format
11
+ * - Tool calls use {"type":"tool_use",...} and {"type":"tool_result",...}
12
+ */
13
+ import type { Event } from "../../types/events";
14
+ import type { ParseContext } from "../../core/agent";
15
+ /**
16
+ * Parse a line of Goose CLI output into event(s).
17
+ *
18
+ * @param line - Raw line from CLI output
19
+ * @param toolMappings - Tool name mappings for this agent
20
+ * @param context - Parse context for session tracking
21
+ * @returns Event, array of events, or null if line should be ignored
22
+ */
23
+ export declare function parseGooseLine(line: string, toolMappings: Record<string, string>, context?: ParseContext): Event | Event[] | null;
24
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/agents/goose/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AA+DpD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,OAAO,CAAC,EAAE,YAAY,GACrB,KAAK,GAAG,KAAK,EAAE,GAAG,IAAI,CA+ExB"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Goose CLI output parser
3
+ *
4
+ * Pure function for parsing Goose CLI stream-json output.
5
+ * Goose outputs newline-delimited JSON events.
6
+ *
7
+ * Actual format discovered from running goose:
8
+ * - {"type":"message","message":{...}} for messages
9
+ * - {"type":"complete","total_tokens":...} for completion
10
+ * - Content blocks use {"type":"text","text":"..."} format
11
+ * - Tool calls use {"type":"tool_use",...} and {"type":"tool_result",...}
12
+ */
13
+ import { createToolStartEvent } from "../../core/tools";
14
+ import { safeJsonParse } from "../../utils/json";
15
+ /**
16
+ * Parse a line of Goose CLI output into event(s).
17
+ *
18
+ * @param line - Raw line from CLI output
19
+ * @param toolMappings - Tool name mappings for this agent
20
+ * @param context - Parse context for session tracking
21
+ * @returns Event, array of events, or null if line should be ignored
22
+ */
23
+ export function parseGooseLine(line, toolMappings, context) {
24
+ // Goose outputs plain JSON, but handle SSE "data: " prefix if present
25
+ const trimmedLine = line.startsWith("data: ") ? line.slice(6) : line;
26
+ const json = safeJsonParse(trimmedLine);
27
+ if (!json) {
28
+ return null;
29
+ }
30
+ // Message event containing role and content blocks
31
+ if (json.type === "message" && json.message) {
32
+ const msg = json.message;
33
+ const events = [];
34
+ // Emit session event on first assistant message with an ID
35
+ // Goose doesn't have a dedicated session init event, so we use the message ID
36
+ if (context &&
37
+ msg.role === "assistant" &&
38
+ msg.id &&
39
+ !context.state.sessionEmitted) {
40
+ context.state.sessionEmitted = true;
41
+ // Use the message ID as the session ID (or generate one from timestamp)
42
+ const sessionId = msg.id || `goose-${msg.created}`;
43
+ context.sessionId = sessionId;
44
+ events.push({ type: "session", id: sessionId });
45
+ }
46
+ for (const block of msg.content) {
47
+ // Text content from assistant
48
+ if (block.type === "text" && msg.role === "assistant") {
49
+ events.push({ type: "token", text: block.text });
50
+ }
51
+ // Tool use (tool call starting)
52
+ if (block.type === "tool_use") {
53
+ events.push(createToolStartEvent(block.name, block.input, toolMappings));
54
+ }
55
+ // Tool result (tool call completed)
56
+ if (block.type === "tool_result") {
57
+ let output;
58
+ if (typeof block.content === "string") {
59
+ output = block.content;
60
+ }
61
+ else if (Array.isArray(block.content)) {
62
+ const textParts = block.content
63
+ .filter((part) => part.type === "text" && part.text)
64
+ .map((part) => part.text);
65
+ output = textParts.join("\n") || undefined;
66
+ }
67
+ if (block.is_error && output) {
68
+ output = `Error: ${output}`;
69
+ }
70
+ events.push({ type: "tool_end", output });
71
+ }
72
+ }
73
+ return events.length > 0 ? (events.length === 1 ? events[0] : events) : null;
74
+ }
75
+ // Complete event marks successful completion
76
+ if (json.type === "complete") {
77
+ return { type: "end" };
78
+ }
79
+ // Error event
80
+ if (json.type === "error") {
81
+ const errorMsg = typeof json.error === "string" ? json.error : json.error?.message;
82
+ return { type: "end", error: errorMsg };
83
+ }
84
+ return null;
85
+ }
86
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/agents/goose/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AA6DhD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,YAAoC,EACpC,OAAsB;IAEtB,sEAAsE;IACtE,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAEpE,MAAM,IAAI,GAAG,aAAa,CAAa,WAAW,CAAC,CAAA;IACnD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAA;IACb,CAAC;IAED,mDAAmD;IACnD,IAAI,IAAI,CAAC,IAAI,KAAK,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AA;QACnE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;IACzC,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Goose tool name mappings
3
+ *
4
+ * Maps Goose CLI tool names to canonical tool names.
5
+ *
6
+ * Goose uses namespaced tool names in the format "extension__tool",
7
+ * e.g., "developer__shell", "developer__text_editor".
8
+ */
9
+ export declare const GOOSE_TOOL_MAPPINGS: Record<string, string>;
10
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/agents/goose/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsBtD,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Goose tool name mappings
3
+ *
4
+ * Maps Goose CLI tool names to canonical tool names.
5
+ *
6
+ * Goose uses namespaced tool names in the format "extension__tool",
7
+ * e.g., "developer__shell", "developer__text_editor".
8
+ */
9
+ export const GOOSE_TOOL_MAPPINGS = {
10
+ // Developer extension tools
11
+ developer__shell: "shell",
12
+ developer__text_editor: "edit",
13
+ developer__read_file: "read",
14
+ developer__write_file: "write",
15
+ developer__list_directory: "glob",
16
+ // Common MCP tool names that may appear
17
+ shell: "shell",
18
+ bash: "shell",
19
+ text_editor: "edit",
20
+ read_file: "read",
21
+ write_file: "write",
22
+ list_directory: "glob",
23
+ search: "grep",
24
+ grep: "grep",
25
+ // Computer controller extension
26
+ computercontroller__shell: "shell",
27
+ computercontroller__read_file: "read",
28
+ computercontroller__write_file: "write",
29
+ };
30
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/agents/goose/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,4BAA4B;IAC5B,gBAAgB,EAAE,OAAO;IACzB,sBAAsB,EAAE,MAAM;IAC9B,oBAAoB,EAAE,MAAM;IAC5B,qBAAqB,EAAE,OAAO;IAC9B,yBAAyB,EAAE,MAAM;IAEjC,wCAAwC;IACxC,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,OAAO;IACnB,cAAc,EAAE,MAAM;IACtB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IAEZ,gCAAgC;IAChC,yBAAyB,EAAE,OAAO;IAClC,6BAA6B,EAAE,MAAM;IACrC,8BAA8B,EAAE,OAAO;CACxC,CAAA"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Agents module - registers all built-in agents
3
+ *
4
+ * Import this module to register all agents with the registry.
5
+ */
6
+ export { claudeAgent } from "./claude/index";
7
+ export { codexAgent } from "./codex/index";
8
+ export { elizaAgent } from "./eliza/index";
9
+ export { geminiAgent } from "./gemini/index";
10
+ export { gooseAgent } from "./goose/index";
11
+ export { opencodeAgent } from "./opencode/index";
12
+ export { piAgent } from "./pi/index";
13
+ export { CLAUDE_TOOL_MAPPINGS } from "./claude/tools";
14
+ export { CODEX_TOOL_MAPPINGS } from "./codex/tools";
15
+ export { ELIZA_TOOL_MAPPINGS } from "./eliza/tools";
16
+ export { GEMINI_TOOL_MAPPINGS } from "./gemini/tools";
17
+ export { GOOSE_TOOL_MAPPINGS } from "./goose/tools";
18
+ export { OPENCODE_TOOL_MAPPINGS } from "./opencode/tools";
19
+ export { PI_TOOL_MAPPINGS } from "./pi/tools";
20
+ export { parseClaudeLine } from "./claude/parser";
21
+ export { parseCodexLine } from "./codex/parser";
22
+ export { parseElizaLine } from "./eliza/parser";
23
+ export { parseGeminiLine } from "./gemini/parser";
24
+ export { parseGooseLine } from "./goose/parser";
25
+ export { parseOpencodeLine } from "./opencode/parser";
26
+ export { parsePiLine } from "./pi/parser";
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAG7C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Agents module - registers all built-in agents
3
+ *
4
+ * Import this module to register all agents with the registry.
5
+ */
6
+ import { registry } from "../core/registry";
7
+ import { claudeAgent } from "./claude/index";
8
+ import { codexAgent } from "./codex/index";
9
+ import { elizaAgent } from "./eliza/index";
10
+ import { geminiAgent } from "./gemini/index";
11
+ import { gooseAgent } from "./goose/index";
12
+ import { opencodeAgent } from "./opencode/index";
13
+ import { piAgent } from "./pi/index";
14
+ // Register all built-in agents
15
+ registry.register(claudeAgent);
16
+ registry.register(codexAgent);
17
+ registry.register(elizaAgent);
18
+ registry.register(geminiAgent);
19
+ registry.register(gooseAgent);
20
+ registry.register(opencodeAgent);
21
+ registry.register(piAgent);
22
+ // Export agent definitions for direct import if needed
23
+ export { claudeAgent } from "./claude/index";
24
+ export { codexAgent } from "./codex/index";
25
+ export { elizaAgent } from "./eliza/index";
26
+ export { geminiAgent } from "./gemini/index";
27
+ export { gooseAgent } from "./goose/index";
28
+ export { opencodeAgent } from "./opencode/index";
29
+ export { piAgent } from "./pi/index";
30
+ // Re-export tool mappings for testing
31
+ export { CLAUDE_TOOL_MAPPINGS } from "./claude/tools";
32
+ export { CODEX_TOOL_MAPPINGS } from "./codex/tools";
33
+ export { ELIZA_TOOL_MAPPINGS } from "./eliza/tools";
34
+ export { GEMINI_TOOL_MAPPINGS } from "./gemini/tools";
35
+ export { GOOSE_TOOL_MAPPINGS } from "./goose/tools";
36
+ export { OPENCODE_TOOL_MAPPINGS } from "./opencode/tools";
37
+ export { PI_TOOL_MAPPINGS } from "./pi/tools";
38
+ // Re-export parsers for testing
39
+ export { parseClaudeLine } from "./claude/parser";
40
+ export { parseCodexLine } from "./codex/parser";
41
+ export { parseElizaLine } from "./eliza/parser";
42
+ export { parseGeminiLine } from "./gemini/parser";
43
+ export { parseGooseLine } from "./goose/parser";
44
+ export { parseOpencodeLine } from "./opencode/parser";
45
+ export { parsePiLine } from "./pi/parser";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O,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,sCAAsC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,gCAAgC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * OpenCode CLI Agent Definition
3
+ */
4
+ import type { AgentDefinition } from "../../core/agent";
5
+ /**
6
+ * OpenCode CLI agent definition.
7
+ *
8
+ * Interacts with the OpenCode CLI tool which outputs JSON lines.
9
+ * Wraps command in bash to capture stderr.
10
+ */
11
+ export declare const opencodeAgent: AgentDefinition;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/opencode/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,kBAAkB,CAAA;AAYzB;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,eA2C3B,CAAA"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * OpenCode CLI Agent Definition
3
+ */
4
+ import { parseOpencodeLine } from "./parser";
5
+ import { OPENCODE_TOOL_MAPPINGS } from "./tools";
6
+ /**
7
+ * Quote a string for bash
8
+ */
9
+ function quote(s) {
10
+ return `'${s.replace(/'/g, "'\\''")}'`;
11
+ }
12
+ /**
13
+ * OpenCode CLI agent definition.
14
+ *
15
+ * Interacts with the OpenCode CLI tool which outputs JSON lines.
16
+ * Wraps command in bash to capture stderr.
17
+ */
18
+ export const opencodeAgent = {
19
+ name: "opencode",
20
+ toolMappings: OPENCODE_TOOL_MAPPINGS,
21
+ capabilities: {
22
+ supportsSystemPrompt: false,
23
+ supportsResume: true,
24
+ },
25
+ buildCommand(options) {
26
+ // OpenCode sometimes writes JSON events to stderr; run under bash and redirect 2>&1
27
+ const parts = ["opencode", "run", "--format", "json", "--variant", "medium"];
28
+ if (options.model) {
29
+ parts.push("-m", quote(options.model));
30
+ }
31
+ if (options.sessionId) {
32
+ parts.push("-s", quote(options.sessionId));
33
+ }
34
+ if (options.prompt) {
35
+ parts.push(quote(options.prompt));
36
+ }
37
+ const command = `${parts.join(" ")} 2>&1`;
38
+ return {
39
+ cmd: "bash",
40
+ args: ["-lc", command],
41
+ env: {
42
+ // Allow all tool actions without interactive approval in headless runs
43
+ OPENCODE_PERMISSION: '{"*":"allow"}',
44
+ ...options.env,
45
+ },
46
+ wrapInBash: false, // Already wrapped
47
+ };
48
+ },
49
+ parse(line, context) {
50
+ return parseOpencodeLine(line, this.toolMappings, context);
51
+ },
52
+ };
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/opencode/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,sBAAsB,EAAE,M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AC,IAAY,EAAE,OAAqB;QACvC,OAAO,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IAC5D,CAAC;CACF,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * OpenCode CLI output parser
3
+ *
4
+ * Pure function for parsing OpenCode CLI JSON output.
5
+ * Note: OpenCode requires stateful parsing to track session ID.
6
+ */
7
+ import type { Event } from "../../types/events";
8
+ import type { ParseContext } from "../../core/agent";
9
+ /**
10
+ * Parse a line of OpenCode CLI output into event(s).
11
+ *
12
+ * Uses context.state.seenSessionId to track if session event was already emitted.
13
+ */
14
+ export declare function parseOpencodeLine(line: string, toolMappings: Record<string, string>, context: ParseContext): Event | Event[] | null;
15
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/agents/opencode/parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AA0FpD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,OAAO,EAAE,YAAY,GACpB,KAAK,GAAG,KAAK,EAAE,GAAG,IAAI,CAgExB"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * OpenCode CLI output parser
3
+ *
4
+ * Pure function for parsing OpenCode CLI JSON output.
5
+ * Note: OpenCode requires stateful parsing to track session ID.
6
+ */
7
+ import { createToolStartEvent, normalizeToolName } from "../../core/tools";
8
+ import { safeJsonParse } from "../../utils/json";
9
+ /**
10
+ * Parse a line of OpenCode CLI output into event(s).
11
+ *
12
+ * Uses context.state.seenSessionId to track if session event was already emitted.
13
+ */
14
+ export function parseOpencodeLine(line, toolMappings, context) {
15
+ const json = safeJsonParse(line);
16
+ if (!json) {
17
+ return null;
18
+ }
19
+ // Step start - session initialization
20
+ if (json.type === "step_start") {
21
+ // OpenCode can emit multiple step_start lines for the same session; only emit once
22
+ if (context.sessionId === json.sessionID)
23
+ return null;
24
+ context.sessionId = json.sessionID;
25
+ return { type: "session", id: json.sessionID };
26
+ }
27
+ // Text content - the actual response
28
+ if (json.type === "text") {
29
+ if (json.part?.type === "text" && json.part.text) {
30
+ return { type: "token", text: json.part.text };
31
+ }
32
+ return null;
33
+ }
34
+ // Tool call start
35
+ if (json.type === "tool_call") {
36
+ const toolName = (json.part?.tool || "unknown").toLowerCase();
37
+ const normalized = normalizeToolName(toolName, toolMappings);
38
+ return createToolStartEvent(normalized, json.part?.args, toolMappings);
39
+ }
40
+ // Tool use (stream-json: emitted when tool completes with full state)
41
+ if (json.type === "tool_use") {
42
+ const toolName = (json.part?.tool || "unknown").toLowerCase();
43
+ const normalized = normalizeToolName(toolName, toolMappings);
44
+ const raw = json.part;
45
+ const startEvent = createToolStartEvent(normalized, raw?.state?.input, toolMappings);
46
+ // If the tool already completed (state.output is present), emit tool_end inline.
47
+ // This is the common case for OpenCode: tool_use carries the full result.
48
+ const rawOutput = raw?.state?.output;
49
+ if (typeof rawOutput === "string" && rawOutput.trim()) {
50
+ return [startEvent, { type: "tool_end", output: rawOutput.trim() }];
51
+ }
52
+ return startEvent;
53
+ }
54
+ // Tool result - tool completed (streaming / in-progress path, no output here)
55
+ if (json.type === "tool_result") {
56
+ return { type: "tool_end" };
57
+ }
58
+ // Step finish - emit end only when run actually stops
59
+ if (json.type === "step_finish") {
60
+ if (json.part?.reason === "stop")
61
+ return { type: "end" };
62
+ return null;
63
+ }
64
+ // Error event - emit as end with error
65
+ if (json.type === "error") {
66
+ const errorMsg = json.error?.data?.message || json.error?.name || "Unknown error";
67
+ return { type: "end", error: errorMsg };
68
+ }
69
+ return null;
70
+ }
71
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @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uCAAuC;IACvC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC1B,MAAM,QAAQ,GACZ,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,IAAI,eAAe,CAAA;QAClE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;IACzC,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * OpenCode tool name mappings
3
+ *
4
+ * Maps OpenCode tool names to canonical tool names.
5
+ */
6
+ export declare const OPENCODE_TOOL_MAPPINGS: Record<string, string>;
7
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/agents/opencode/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGzD,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * OpenCode tool name mappings
3
+ *
4
+ * Maps OpenCode tool names to canonical tool names.
5
+ */
6
+ export const OPENCODE_TOOL_MAPPINGS = {
7
+ bash: "shell",
8
+ // Most OpenCode tools use canonical names already
9
+ };
10
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/agents/opencode/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAA2B;IAC5D,IAAI,EAAE,OAAO;IACb,kDAAkD;CACnD,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * OpenHands CLI Agent Definition
3
+ *
4
+ * OpenHands is an AI-powered coding agent that can edit files, run commands,
5
+ * and browse the web. This integration uses the headless CLI mode with JSON output.
6
+ *
7
+ * @see https://docs.openhands.dev/openhands/usage/cli/headless
8
+ */
9
+ import type { AgentDefinition } from "../../core/agent.js";
10
+ /**
11
+ * OpenHands CLI agent definition.
12
+ *
13
+ * Interacts with the OpenHands CLI tool in headless mode with JSON output.
14
+ * Wraps command in bash to capture stderr and handle environment properly.
15
+ */
16
+ export declare const openhandsAgent: AgentDefinition;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/openhands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,qBAAqB,CAAA;AAY5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,eAsD5B,CAAA"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * OpenHands CLI Agent Definition
3
+ *
4
+ * OpenHands is an AI-powered coding agent that can edit files, run commands,
5
+ * and browse the web. This integration uses the headless CLI mode with JSON output.
6
+ *
7
+ * @see https://docs.openhands.dev/openhands/usage/cli/headless
8
+ */
9
+ import { parseOpenhandsLine } from "./parser.js";
10
+ import { OPENHANDS_TOOL_MAPPINGS } from "./tools.js";
11
+ /**
12
+ * Quote a string for bash
13
+ */
14
+ function quote(s) {
15
+ return `'${s.replace(/'/g, "'\\''")}'`;
16
+ }
17
+ /**
18
+ * OpenHands CLI agent definition.
19
+ *
20
+ * Interacts with the OpenHands CLI tool in headless mode with JSON output.
21
+ * Wraps command in bash to capture stderr and handle environment properly.
22
+ */
23
+ export const openhandsAgent = {
24
+ name: "openhands",
25
+ toolMappings: OPENHANDS_TOOL_MAPPINGS,
26
+ capabilities: {
27
+ supportsSystemPrompt: false,
28
+ supportsResume: true,
29
+ },
30
+ buildCommand(options) {
31
+ // Build the openhands command
32
+ const parts = ["openhands", "--headless", "--json"];
33
+ // Add model if specified
34
+ // OpenHands uses LLM_MODEL env var, but we can use --override-with-envs flag
35
+ // along with environment variables for model selection
36
+ // Resume session if provided
37
+ if (options.sessionId) {
38
+ parts.push("--resume", quote(options.sessionId));
39
+ }
40
+ // Add the prompt via -t flag
41
+ if (options.prompt) {
42
+ parts.push("-t", quote(options.prompt));
43
+ }
44
+ // Redirect stderr to stdout for unified output capture
45
+ const command = `${parts.join(" ")} 2>&1`;
46
+ // Build environment variables
47
+ const env = {
48
+ // Suppress the banner for cleaner JSON output
49
+ OPENHANDS_SUPPRESS_BANNER: "1",
50
+ ...options.env,
51
+ };
52
+ // If model is specified, set the LLM_MODEL env var
53
+ if (options.model) {
54
+ env.LLM_MODEL = options.model;
55
+ }
56
+ return {
57
+ cmd: "bash",
58
+ args: ["-lc", command],
59
+ env,
60
+ wrapInBash: false, // Already wrapped
61
+ };
62
+ },
63
+ parse(line, context) {
64
+ return parseOpenhandsLine(line, this.toolMappings, context);
65
+ },
66
+ };
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/openhands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAEpD;;GAEG;AACH,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAA;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,IAAI,EAAE,WAAW;IAEjB,YAAY,EAAE,uBAAuB;IAErC,YAAY,EAAE;QACZ,oBAAoB,EAAE,KAAK;QAC3B,cAAc,EAAE,IAAI;KACrB;IAED,YAAY,CAAC,OAAmB;QAC9B,8BAA8B;QAC9B,MAAM,KAAK,GAAa,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;QAE7D,yBAAyB;QACzB,6EAA6E;QAC7E,uDAAuD;QAEvD,6BAA6B;QAC7B,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAA;QAClD,CAAC;QAED,6BAA6B;QAC7B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;QACzC,CAAC;QAED,uDAAuD;QACvD,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAA;QAEzC,8BAA8B;QAC9B,MAAM,GAAG,GAA2B;YAClC,8CAA8C;YAC9C,yBAAyB,EAAE,GAAG;YAC9B,GAAG,OAAO,CAAC,GAAG;SACf,CAAA;QAED,mDAAmD;QACnD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAA;QAC/B,CAAC;QAED,OAAO;YACL,GAAG,EAAE,MAAM;YACX,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;YACtB,GAAG;YACH,UAAU,EAAE,KAAK,EAAE,kBAAkB;SACtC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,OAAqB;QACvC,OAAO,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IAC7D,CAAC;CACF,CAAA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * OpenHands CLI output parser
3
+ *
4
+ * Pure function for parsing OpenHands CLI JSON output.
5
+ * The OpenHands CLI with --json flag outputs JSONL events with
6
+ * "type": "action" or "type": "observation" fields.
7
+ */
8
+ import type { Event } from "../../types/events.js";
9
+ import type { ParseContext } from "../../core/agent.js";
10
+ /**
11
+ * Parse a line of OpenHands CLI output into event(s).
12
+ *
13
+ * Uses context.sessionId to track if session event was already emitted.
14
+ */
15
+ export declare function parseOpenhandsLine(line: string, toolMappings: Record<string, string>, context: ParseContext): Event | null;
16
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/agents/openhands/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAuEvD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,OAAO,EAAE,YAAY,GACpB,KAAK,GAAG,IAAI,CAyFd"}