@agent-relay/wrapper 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 (115) hide show
  1. package/dist/__fixtures__/claude-outputs.d.ts +49 -0
  2. package/dist/__fixtures__/claude-outputs.d.ts.map +1 -0
  3. package/dist/__fixtures__/claude-outputs.js +443 -0
  4. package/dist/__fixtures__/claude-outputs.js.map +1 -0
  5. package/dist/__fixtures__/codex-outputs.d.ts +9 -0
  6. package/dist/__fixtures__/codex-outputs.d.ts.map +1 -0
  7. package/dist/__fixtures__/codex-outputs.js +94 -0
  8. package/dist/__fixtures__/codex-outputs.js.map +1 -0
  9. package/dist/__fixtures__/gemini-outputs.d.ts +19 -0
  10. package/dist/__fixtures__/gemini-outputs.d.ts.map +1 -0
  11. package/dist/__fixtures__/gemini-outputs.js +144 -0
  12. package/dist/__fixtures__/gemini-outputs.js.map +1 -0
  13. package/dist/__fixtures__/index.d.ts +68 -0
  14. package/dist/__fixtures__/index.d.ts.map +1 -0
  15. package/dist/__fixtures__/index.js +44 -0
  16. package/dist/__fixtures__/index.js.map +1 -0
  17. package/dist/auth-detection.d.ts +49 -0
  18. package/dist/auth-detection.d.ts.map +1 -0
  19. package/dist/auth-detection.js +199 -0
  20. package/dist/auth-detection.js.map +1 -0
  21. package/dist/base-wrapper.d.ts +225 -0
  22. package/dist/base-wrapper.d.ts.map +1 -0
  23. package/dist/base-wrapper.js +572 -0
  24. package/dist/base-wrapper.js.map +1 -0
  25. package/dist/client.d.ts +254 -0
  26. package/dist/client.d.ts.map +1 -0
  27. package/dist/client.js +801 -0
  28. package/dist/client.js.map +1 -0
  29. package/dist/id-generator.d.ts +35 -0
  30. package/dist/id-generator.d.ts.map +1 -0
  31. package/dist/id-generator.js +60 -0
  32. package/dist/id-generator.js.map +1 -0
  33. package/dist/idle-detector.d.ts +110 -0
  34. package/dist/idle-detector.d.ts.map +1 -0
  35. package/dist/idle-detector.js +304 -0
  36. package/dist/idle-detector.js.map +1 -0
  37. package/dist/inbox.d.ts +37 -0
  38. package/dist/inbox.d.ts.map +1 -0
  39. package/dist/inbox.js +73 -0
  40. package/dist/inbox.js.map +1 -0
  41. package/dist/index.d.ts +37 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +47 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/parser.d.ts +236 -0
  46. package/dist/parser.d.ts.map +1 -0
  47. package/dist/parser.js +1238 -0
  48. package/dist/parser.js.map +1 -0
  49. package/dist/prompt-composer.d.ts +67 -0
  50. package/dist/prompt-composer.d.ts.map +1 -0
  51. package/dist/prompt-composer.js +168 -0
  52. package/dist/prompt-composer.js.map +1 -0
  53. package/dist/relay-pty-orchestrator.d.ts +407 -0
  54. package/dist/relay-pty-orchestrator.d.ts.map +1 -0
  55. package/dist/relay-pty-orchestrator.js +1885 -0
  56. package/dist/relay-pty-orchestrator.js.map +1 -0
  57. package/dist/shared.d.ts +201 -0
  58. package/dist/shared.d.ts.map +1 -0
  59. package/dist/shared.js +341 -0
  60. package/dist/shared.js.map +1 -0
  61. package/dist/stuck-detector.d.ts +161 -0
  62. package/dist/stuck-detector.d.ts.map +1 -0
  63. package/dist/stuck-detector.js +402 -0
  64. package/dist/stuck-detector.js.map +1 -0
  65. package/dist/tmux-resolver.d.ts +55 -0
  66. package/dist/tmux-resolver.d.ts.map +1 -0
  67. package/dist/tmux-resolver.js +175 -0
  68. package/dist/tmux-resolver.js.map +1 -0
  69. package/dist/tmux-wrapper.d.ts +345 -0
  70. package/dist/tmux-wrapper.d.ts.map +1 -0
  71. package/dist/tmux-wrapper.js +1747 -0
  72. package/dist/tmux-wrapper.js.map +1 -0
  73. package/dist/trajectory-integration.d.ts +292 -0
  74. package/dist/trajectory-integration.d.ts.map +1 -0
  75. package/dist/trajectory-integration.js +979 -0
  76. package/dist/trajectory-integration.js.map +1 -0
  77. package/dist/wrapper-types.d.ts +41 -0
  78. package/dist/wrapper-types.d.ts.map +1 -0
  79. package/dist/wrapper-types.js +7 -0
  80. package/dist/wrapper-types.js.map +1 -0
  81. package/package.json +63 -0
  82. package/src/__fixtures__/claude-outputs.ts +471 -0
  83. package/src/__fixtures__/codex-outputs.ts +99 -0
  84. package/src/__fixtures__/gemini-outputs.ts +151 -0
  85. package/src/__fixtures__/index.ts +47 -0
  86. package/src/auth-detection.ts +244 -0
  87. package/src/base-wrapper.test.ts +540 -0
  88. package/src/base-wrapper.ts +741 -0
  89. package/src/client.test.ts +262 -0
  90. package/src/client.ts +984 -0
  91. package/src/id-generator.test.ts +71 -0
  92. package/src/id-generator.ts +69 -0
  93. package/src/idle-detector.test.ts +390 -0
  94. package/src/idle-detector.ts +370 -0
  95. package/src/inbox.test.ts +233 -0
  96. package/src/inbox.ts +89 -0
  97. package/src/index.ts +170 -0
  98. package/src/parser.regression.test.ts +251 -0
  99. package/src/parser.test.ts +1359 -0
  100. package/src/parser.ts +1477 -0
  101. package/src/prompt-composer.test.ts +219 -0
  102. package/src/prompt-composer.ts +231 -0
  103. package/src/relay-pty-orchestrator.test.ts +1027 -0
  104. package/src/relay-pty-orchestrator.ts +2270 -0
  105. package/src/shared.test.ts +221 -0
  106. package/src/shared.ts +454 -0
  107. package/src/stuck-detector.test.ts +303 -0
  108. package/src/stuck-detector.ts +511 -0
  109. package/src/tmux-resolver.test.ts +104 -0
  110. package/src/tmux-resolver.ts +207 -0
  111. package/src/tmux-wrapper.test.ts +316 -0
  112. package/src/tmux-wrapper.ts +2010 -0
  113. package/src/trajectory-detection.test.ts +151 -0
  114. package/src/trajectory-integration.ts +1261 -0
  115. package/src/wrapper-types.ts +45 -0
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Claude CLI output fixtures for parser regression testing.
3
+ *
4
+ * These fixtures capture real-world patterns from Claude CLI sessions,
5
+ * including ANSI escape codes, thinking blocks, and various edge cases.
6
+ *
7
+ * When Claude changes its output format, add new fixtures here and
8
+ * ensure the parser still handles them correctly.
9
+ */
10
+ export interface OutputFixture {
11
+ name: string;
12
+ description: string;
13
+ input: string;
14
+ expectedCommands: Array<{
15
+ to: string;
16
+ body: string;
17
+ kind?: string;
18
+ thread?: string;
19
+ project?: string;
20
+ }>;
21
+ expectedOutputContains?: string[];
22
+ expectedOutputNotContains?: string[];
23
+ }
24
+ /**
25
+ * ANSI escape codes commonly seen in Claude output
26
+ */
27
+ export declare const ANSI: {
28
+ RESET: string;
29
+ BOLD: string;
30
+ DIM: string;
31
+ BLUE: string;
32
+ GREEN: string;
33
+ YELLOW: string;
34
+ CYAN: string;
35
+ CURSOR_UP: string;
36
+ CURSOR_DOWN: string;
37
+ CURSOR_RIGHT: string;
38
+ CURSOR_LEFT: string;
39
+ CLEAR_LINE: string;
40
+ BOX_VERTICAL: string;
41
+ BOX_HORIZONTAL: string;
42
+ BOX_CORNER_TL: string;
43
+ BOX_CORNER_TR: string;
44
+ BOX_CORNER_BL: string;
45
+ BOX_CORNER_BR: string;
46
+ };
47
+ export declare const claudeOutputFixtures: OutputFixture[];
48
+ export default claudeOutputFixtures;
49
+ //# sourceMappingURL=claude-outputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-outputs.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/claude-outputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,KAAK,CAAC;QACtB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;CACtC;AAED;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;CAqBhB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAAa,EAia/C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,443 @@
1
+ /**
2
+ * Claude CLI output fixtures for parser regression testing.
3
+ *
4
+ * These fixtures capture real-world patterns from Claude CLI sessions,
5
+ * including ANSI escape codes, thinking blocks, and various edge cases.
6
+ *
7
+ * When Claude changes its output format, add new fixtures here and
8
+ * ensure the parser still handles them correctly.
9
+ */
10
+ /**
11
+ * ANSI escape codes commonly seen in Claude output
12
+ */
13
+ export const ANSI = {
14
+ RESET: '\x1b[0m',
15
+ BOLD: '\x1b[1m',
16
+ DIM: '\x1b[2m',
17
+ BLUE: '\x1b[34m',
18
+ GREEN: '\x1b[32m',
19
+ YELLOW: '\x1b[33m',
20
+ CYAN: '\x1b[36m',
21
+ // Cursor movements
22
+ CURSOR_UP: '\x1b[1A',
23
+ CURSOR_DOWN: '\x1b[1B',
24
+ CURSOR_RIGHT: '\x1b[1C',
25
+ CURSOR_LEFT: '\x1b[1D',
26
+ CLEAR_LINE: '\x1b[2K',
27
+ // Box drawing used by Claude TUI
28
+ BOX_VERTICAL: '│',
29
+ BOX_HORIZONTAL: '─',
30
+ BOX_CORNER_TL: '┌',
31
+ BOX_CORNER_TR: '┐',
32
+ BOX_CORNER_BL: '└',
33
+ BOX_CORNER_BR: '┘',
34
+ };
35
+ export const claudeOutputFixtures = [
36
+ // =====================================================================
37
+ // Basic relay commands with ANSI codes
38
+ // =====================================================================
39
+ {
40
+ name: 'basic-relay-with-ansi',
41
+ description: 'Simple relay command wrapped in ANSI color codes',
42
+ input: `${ANSI.CYAN}->relay:Lead${ANSI.RESET} Task completed successfully\n`,
43
+ expectedCommands: [
44
+ { to: 'Lead', body: 'Task completed successfully' },
45
+ ],
46
+ },
47
+ {
48
+ name: 'relay-in-bold-output',
49
+ description: 'Relay command in bold text block',
50
+ input: `${ANSI.BOLD}Processing request...${ANSI.RESET}
51
+ ${ANSI.BOLD}->relay:DataAnalyzer${ANSI.RESET} Please analyze the data
52
+ ${ANSI.DIM}Done.${ANSI.RESET}
53
+ `,
54
+ expectedCommands: [
55
+ { to: 'DataAnalyzer', body: 'Please analyze the data' },
56
+ ],
57
+ },
58
+ // =====================================================================
59
+ // Claude extended thinking blocks
60
+ // =====================================================================
61
+ {
62
+ name: 'thinking-block-with-relay',
63
+ description: 'Relay command inside thinking block should be ignored',
64
+ input: `<thinking>
65
+ Let me think about this...
66
+ ->relay:Agent This should NOT be parsed
67
+ </thinking>
68
+
69
+ ->relay:Lead This SHOULD be parsed
70
+ `,
71
+ expectedCommands: [
72
+ { to: 'Lead', body: 'This SHOULD be parsed' },
73
+ ],
74
+ // Thinking block content is intentionally stripped from output by the parser
75
+ expectedOutputNotContains: ['->relay:Agent This should NOT be parsed'],
76
+ },
77
+ {
78
+ name: 'nested-thinking-context',
79
+ description: 'Complex thinking block with code examples',
80
+ input: `<thinking>
81
+ I need to send a message to the lead agent.
82
+ The format is: ->relay:Target message
83
+ Let me compose the message...
84
+ </thinking>
85
+
86
+ ->relay:Lead I've analyzed the codebase and found the issue.
87
+ `,
88
+ expectedCommands: [
89
+ { to: 'Lead', body: "I've analyzed the codebase and found the issue." },
90
+ ],
91
+ },
92
+ // =====================================================================
93
+ // Code fences
94
+ // =====================================================================
95
+ {
96
+ name: 'relay-inside-code-fence',
97
+ description: 'Relay command inside code fence should be ignored',
98
+ input: `Here's an example:
99
+
100
+ \`\`\`typescript
101
+ // Send a message to another agent
102
+ ->relay:Agent Hello there
103
+ \`\`\`
104
+
105
+ ->relay:Lead The example above shows the syntax
106
+ `,
107
+ expectedCommands: [
108
+ { to: 'Lead', body: 'The example above shows the syntax' },
109
+ ],
110
+ expectedOutputContains: ['->relay:Agent Hello there'],
111
+ },
112
+ {
113
+ name: 'multiple-code-fences',
114
+ description: 'Multiple code fences with relay commands between',
115
+ input: `\`\`\`
116
+ First fence
117
+ ->relay:Ignored1 Should not parse
118
+ \`\`\`
119
+
120
+ ->relay:Valid1 This should parse
121
+
122
+ \`\`\`python
123
+ ->relay:Ignored2 Also should not parse
124
+ \`\`\`
125
+
126
+ ->relay:Valid2 This should also parse
127
+ `,
128
+ expectedCommands: [
129
+ { to: 'Valid1', body: 'This should parse' },
130
+ { to: 'Valid2', body: 'This should also parse' },
131
+ ],
132
+ },
133
+ // =====================================================================
134
+ // Multi-line and continuation
135
+ // =====================================================================
136
+ {
137
+ name: 'multiline-fenced-message',
138
+ description: 'Multi-line message using <<< >>> fence',
139
+ input: `->relay:Lead <<<
140
+ Here's my analysis:
141
+
142
+ 1. The authentication module needs refactoring
143
+ 2. The database queries are inefficient
144
+ 3. Consider adding caching
145
+
146
+ Let me know your thoughts.
147
+ >>>
148
+ `,
149
+ expectedCommands: [
150
+ {
151
+ to: 'Lead',
152
+ body: `Here's my analysis:
153
+
154
+ 1. The authentication module needs refactoring
155
+ 2. The database queries are inefficient
156
+ 3. Consider adding caching
157
+
158
+ Let me know your thoughts.`,
159
+ },
160
+ ],
161
+ },
162
+ {
163
+ name: 'bullet-list-continuation',
164
+ description: 'Relay command followed by bullet list',
165
+ input: `->relay:Lead Status update:
166
+ - Completed task A
167
+ - Working on task B
168
+ - Blocked on task C
169
+
170
+ Other output here
171
+ `,
172
+ expectedCommands: [
173
+ {
174
+ to: 'Lead',
175
+ body: `Status update:
176
+ - Completed task A
177
+ - Working on task B
178
+ - Blocked on task C`,
179
+ },
180
+ ],
181
+ expectedOutputContains: ['Other output here'],
182
+ },
183
+ // =====================================================================
184
+ // Box drawing and TUI elements
185
+ // =====================================================================
186
+ {
187
+ name: 'relay-with-box-drawing',
188
+ description: 'Relay command near box drawing characters',
189
+ input: `${ANSI.BOX_CORNER_TL}${ANSI.BOX_HORIZONTAL.repeat(20)}${ANSI.BOX_CORNER_TR}
190
+ ${ANSI.BOX_VERTICAL} Processing... ${ANSI.BOX_VERTICAL}
191
+ ${ANSI.BOX_CORNER_BL}${ANSI.BOX_HORIZONTAL.repeat(20)}${ANSI.BOX_CORNER_BR}
192
+
193
+ ->relay:Lead Task complete
194
+ `,
195
+ expectedCommands: [
196
+ { to: 'Lead', body: 'Task complete' },
197
+ ],
198
+ },
199
+ // =====================================================================
200
+ // Escape sequences
201
+ // =====================================================================
202
+ {
203
+ name: 'escaped-relay-prefix',
204
+ description: 'Escaped relay prefix should not trigger command',
205
+ input: `To send a message, use: \\->relay:Target message
206
+
207
+ ->relay:Lead This is the actual message
208
+ `,
209
+ expectedCommands: [
210
+ { to: 'Lead', body: 'This is the actual message' },
211
+ ],
212
+ expectedOutputContains: ['->relay:Target message'],
213
+ },
214
+ // =====================================================================
215
+ // Thread and sync syntax
216
+ // =====================================================================
217
+ {
218
+ name: 'thread-syntax',
219
+ description: 'Relay command with thread identifier',
220
+ input: `->relay:Lead [thread:auth-review] Please review the auth changes
221
+ `,
222
+ expectedCommands: [
223
+ { to: 'Lead', body: 'Please review the auth changes', thread: 'auth-review' },
224
+ ],
225
+ },
226
+ {
227
+ name: 'await-syntax',
228
+ description: 'Relay command with await/sync',
229
+ input: `->relay:Lead [await:30s] Please confirm the deployment
230
+ `,
231
+ expectedCommands: [
232
+ { to: 'Lead', body: 'Please confirm the deployment' },
233
+ ],
234
+ },
235
+ {
236
+ name: 'cross-project-syntax',
237
+ description: 'Cross-project relay command',
238
+ input: `->relay:backend-api:AuthService Please verify the token
239
+ `,
240
+ expectedCommands: [
241
+ { to: 'AuthService', body: 'Please verify the token', project: 'backend-api' },
242
+ ],
243
+ },
244
+ // =====================================================================
245
+ // Instructional text filtering
246
+ // =====================================================================
247
+ {
248
+ name: 'filter-protocol-instruction',
249
+ description: 'Should filter out protocol instruction text',
250
+ input: `->relay:AgentName message. PROTOCOL: (1) Wait for task via relay...
251
+
252
+ ->relay:Lead Actual message here
253
+ `,
254
+ expectedCommands: [
255
+ { to: 'Lead', body: 'Actual message here' },
256
+ ],
257
+ expectedOutputContains: ['->relay:AgentName'],
258
+ },
259
+ {
260
+ name: 'filter-placeholder-target',
261
+ description: 'Should filter out messages to placeholder targets',
262
+ input: `->relay:Target This is an example
263
+ ->relay:AgentName Another example
264
+ ->relay:Lead Real message
265
+ `,
266
+ expectedCommands: [
267
+ { to: 'Lead', body: 'Real message' },
268
+ ],
269
+ },
270
+ // =====================================================================
271
+ // Spawn/release commands (should pass through, not parse)
272
+ // =====================================================================
273
+ {
274
+ name: 'spawn-command-passthrough',
275
+ description: 'Spawn command should pass through, not parse as message',
276
+ input: `->relay:spawn Worker claude "Task description"
277
+ ->relay:Lead Spawn initiated
278
+ `,
279
+ expectedCommands: [
280
+ { to: 'Lead', body: 'Spawn initiated' },
281
+ ],
282
+ expectedOutputContains: ['->relay:spawn Worker'],
283
+ },
284
+ {
285
+ name: 'release-command-passthrough',
286
+ description: 'Release command should pass through, not parse as message',
287
+ input: `->relay:release Worker
288
+ ->relay:Lead Worker released
289
+ `,
290
+ expectedCommands: [
291
+ { to: 'Lead', body: 'Worker released' },
292
+ ],
293
+ expectedOutputContains: ['->relay:release Worker'],
294
+ },
295
+ // =====================================================================
296
+ // Edge cases that have caused bugs
297
+ // =====================================================================
298
+ {
299
+ name: 'cursor-movement-before-relay',
300
+ description: 'Cursor movement codes before relay command',
301
+ input: `${ANSI.CURSOR_UP}${ANSI.CLEAR_LINE}->relay:Lead Status update
302
+ `,
303
+ expectedCommands: [
304
+ { to: 'Lead', body: 'Status update' },
305
+ ],
306
+ },
307
+ {
308
+ name: 'orphaned-csi-sequence',
309
+ description: 'Orphaned CSI sequence that lost escape byte',
310
+ input: `[?25l[2K->relay:Lead Message after CSI
311
+ `,
312
+ expectedCommands: [
313
+ { to: 'Lead', body: 'Message after CSI' },
314
+ ],
315
+ },
316
+ {
317
+ name: 'relay-injection-echo',
318
+ description: 'Should not re-parse injected relay messages',
319
+ input: `Relay message from Alice [abc12345]: Hello there
320
+
321
+ ->relay:Lead Responding to Alice
322
+ `,
323
+ expectedCommands: [
324
+ { to: 'Lead', body: 'Responding to Alice' },
325
+ ],
326
+ expectedOutputContains: ['Relay message from Alice'],
327
+ },
328
+ {
329
+ name: 'incomplete-fenced-then-new-relay',
330
+ description: 'Auto-close incomplete fenced block when new relay starts',
331
+ input: `->relay:Alice <<<
332
+ Important content that forgot closing fence
333
+ ->relay:Bob Hello Bob
334
+ `,
335
+ expectedCommands: [
336
+ { to: 'Alice', body: 'Important content that forgot closing fence' },
337
+ { to: 'Bob', body: 'Hello Bob' },
338
+ ],
339
+ },
340
+ {
341
+ name: 'fence-end-on-same-line',
342
+ description: 'Fence end >>> at end of content line',
343
+ input: `->relay:Lead <<<
344
+ Quick message>>>
345
+ `,
346
+ expectedCommands: [
347
+ { to: 'Lead', body: 'Quick message' },
348
+ ],
349
+ },
350
+ {
351
+ name: 'preserve-agent-relay-text',
352
+ description: 'Should preserve [Agent Relay] text, not strip it as CSI',
353
+ input: `[Agent Relay] It's been 15 minutes. Please output a [[SUMMARY]] block
354
+ ->relay:Lead Acknowledged
355
+ `,
356
+ expectedCommands: [
357
+ { to: 'Lead', body: 'Acknowledged' },
358
+ ],
359
+ expectedOutputContains: ['[Agent Relay]'],
360
+ },
361
+ // =====================================================================
362
+ // Block format [[RELAY]]
363
+ // =====================================================================
364
+ {
365
+ name: 'json-block-format',
366
+ description: 'JSON block format message',
367
+ input: `[[RELAY]]{"to":"Lead","type":"message","body":"Structured message"}[[/RELAY]]
368
+ `,
369
+ expectedCommands: [
370
+ { to: 'Lead', body: 'Structured message', kind: 'message' },
371
+ ],
372
+ },
373
+ {
374
+ name: 'json-block-with-data',
375
+ description: 'JSON block with additional data field',
376
+ input: `[[RELAY]]
377
+ {
378
+ "to": "Lead",
379
+ "type": "action",
380
+ "body": "Execute task",
381
+ "data": {"taskId": "123", "priority": "high"}
382
+ }
383
+ [[/RELAY]]
384
+ `,
385
+ expectedCommands: [
386
+ { to: 'Lead', body: 'Execute task', kind: 'action' },
387
+ ],
388
+ },
389
+ // =====================================================================
390
+ // Real-world complex scenarios
391
+ // =====================================================================
392
+ {
393
+ name: 'complex-session-output',
394
+ description: 'Realistic complex session with mixed content',
395
+ input: `${ANSI.BOLD}Claude${ANSI.RESET} ${ANSI.DIM}(thinking...)${ANSI.RESET}
396
+
397
+ <thinking>
398
+ Let me analyze the request and formulate a response.
399
+ I should send an update to the lead agent.
400
+ </thinking>
401
+
402
+ I've completed the analysis of the authentication module. Here are my findings:
403
+
404
+ \`\`\`typescript
405
+ // Example fix for the auth issue
406
+ function validateToken(token: string): boolean {
407
+ // ->relay:Agent This is in a code block, should be ignored
408
+ return jwt.verify(token, SECRET);
409
+ }
410
+ \`\`\`
411
+
412
+ ->relay:Lead <<<
413
+ Analysis complete. Key findings:
414
+
415
+ 1. Token validation has a timing vulnerability
416
+ 2. Session handling needs improvement
417
+ 3. Consider adding rate limiting
418
+
419
+ Recommended priority: HIGH
420
+ >>>
421
+
422
+ ${ANSI.GREEN}Done.${ANSI.RESET}
423
+ `,
424
+ expectedCommands: [
425
+ {
426
+ to: 'Lead',
427
+ body: `Analysis complete. Key findings:
428
+
429
+ 1. Token validation has a timing vulnerability
430
+ 2. Session handling needs improvement
431
+ 3. Consider adding rate limiting
432
+
433
+ Recommended priority: HIGH`,
434
+ },
435
+ ],
436
+ expectedOutputContains: [
437
+ '->relay:Agent This is in a code block',
438
+ 'validateToken',
439
+ ],
440
+ },
441
+ ];
442
+ export default claudeOutputFixtures;
443
+ //# sourceMappingURL=claude-outputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-outputs.js","sourceRoot":"","sources":["../../src/__fixtures__/claude-outputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,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SAC5D;KACF;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,uCAAuC;QACpD,KAAK,EAAE;;;;;;;;CAQV;QACG,gBAAgB,EAAE;YAChB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;SACrD;KACF;IAED,wEAAwE;IACxE,+BAA+B;IAC/B,wEAAwE;IACxE;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,8CAA8C;QAC3D,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,gBAAgB,IAAI,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B9E,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK;CAC7B;QACG,gBAAgB,EAAE;YAChB;gBACE,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE;;;;;;2BAMa;aACpB;SACF;QACD,sBAAsB,EAAE;YACtB,uCAAuC;YACvC,eAAe;SAChB;KACF;CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Codex CLI output fixtures for parser regression testing.
3
+ *
4
+ * Codex (OpenAI) has its own output formatting patterns.
5
+ */
6
+ import type { OutputFixture } from './claude-outputs.js';
7
+ export declare const codexOutputFixtures: OutputFixture[];
8
+ export default codexOutputFixtures;
9
+ //# sourceMappingURL=codex-outputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-outputs.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/codex-outputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAO,MAAM,mBAAmB,EAAE,aAAa,EAwF9C,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Codex CLI output fixtures for parser regression testing.
3
+ *
4
+ * Codex (OpenAI) has its own output formatting patterns.
5
+ */
6
+ export const codexOutputFixtures = [
7
+ // =====================================================================
8
+ // Basic Codex output
9
+ // =====================================================================
10
+ {
11
+ name: 'codex-basic-relay',
12
+ description: 'Basic relay command from Codex',
13
+ input: `I'll help you with that task.
14
+
15
+ ->relay:Lead Task analysis complete. Ready for review.
16
+
17
+ Let me know if you need anything else.
18
+ `,
19
+ expectedCommands: [
20
+ { to: 'Lead', body: 'Task analysis complete. Ready for review.' },
21
+ ],
22
+ expectedOutputContains: ['help you with that task', 'Let me know'],
23
+ },
24
+ {
25
+ name: 'codex-with-code-output',
26
+ description: 'Codex output with code blocks',
27
+ input: `Here's the fix:
28
+
29
+ \`\`\`python
30
+ def authenticate(user, password):
31
+ # ->relay:Agent This is in code, ignore
32
+ return check_credentials(user, password)
33
+ \`\`\`
34
+
35
+ ->relay:Lead Code fix implemented. Please review.
36
+ `,
37
+ expectedCommands: [
38
+ { to: 'Lead', body: 'Code fix implemented. Please review.' },
39
+ ],
40
+ expectedOutputContains: ['->relay:Agent This is in code'],
41
+ },
42
+ // =====================================================================
43
+ // Codex multi-line messages
44
+ // =====================================================================
45
+ {
46
+ name: 'codex-fenced-message',
47
+ description: 'Codex sending fenced multi-line message',
48
+ input: `->relay:Lead <<<
49
+ Code review complete. Issues found:
50
+
51
+ 1. Missing error handling in auth.py:45
52
+ 2. SQL injection risk in query.py:120
53
+ 3. Unused import in utils.py:3
54
+
55
+ Priority: Fix items 1 and 2 immediately.
56
+ >>>
57
+
58
+ I've documented all issues above.
59
+ `,
60
+ expectedCommands: [
61
+ {
62
+ to: 'Lead',
63
+ body: `Code review complete. Issues found:
64
+
65
+ 1. Missing error handling in auth.py:45
66
+ 2. SQL injection risk in query.py:120
67
+ 3. Unused import in utils.py:3
68
+
69
+ Priority: Fix items 1 and 2 immediately.`,
70
+ },
71
+ ],
72
+ },
73
+ // =====================================================================
74
+ // Codex with tool use
75
+ // =====================================================================
76
+ {
77
+ name: 'codex-after-tool-use',
78
+ description: 'Relay command after Codex tool execution',
79
+ input: `Running: git status
80
+
81
+ On branch main
82
+ Changes not staged for commit:
83
+ modified: src/auth.ts
84
+
85
+ ->relay:Lead Git status shows 1 modified file: src/auth.ts
86
+ `,
87
+ expectedCommands: [
88
+ { to: 'Lead', body: 'Git status shows 1 modified file: src/auth.ts' },
89
+ ],
90
+ expectedOutputContains: ['Running: git status', 'On branch main'],
91
+ },
92
+ ];
93
+ export default codexOutputFixtures;
94
+ //# sourceMappingURL=codex-outputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-outputs.js","sourceRoot":"","sources":["../../src/__fixtures__/codex-outputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAoB;IAClD,wEAAwE;IACxE,qBAAqB;IACrB,wEAAwE;IACxE;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,gCAAgC;QAC7C,KAAK,EAAE;;;;;CAKV;QACG,gBAAgB,EAAE;YAChB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,2CAA2C,EAAE;SAClE;QACD,sBAAsB,EAAE,CAAC,yBAAyB,EAAE,aAAa,CAAC;KACnE;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,+BAA+B;QAC5C,KAAK,EAAE;;;;;;;;;CASV;QACG,gBAAgB,EAAE;YAChB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,sCAAsC,EAAE;SAC7D;QACD,sBAAsB,EAAE,CAAC,+BAA+B,CAAC;KAC1D;IAED,wEAAwE;IACxE,4BAA4B;IAC5B,wEAAwE;IACxE;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,yCAAyC;QACtD,KAAK,EAAE;;;;;;;;;;;CAWV;QACG,gBAAgB,EAAE;YAChB;gBACE,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE;;;;;;yCAM2B;aAClC;SACF;KACF;IAED,wEAAwE;IACxE,sBAAsB;IACtB,wEAAwE;IACxE;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,0CAA0C;QACvD,KAAK,EAAE;;;;;;;CAOV;QACG,gBAAgB,EAAE;YAChB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,+CAA+C,EAAE;SACtE;QACD,sBAAsB,EAAE,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;KAClE;CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Gemini CLI output fixtures for parser regression testing.
3
+ *
4
+ * Gemini has unique characteristics:
5
+ * - Uses sparkle character (✦) as output prefix
6
+ * - Can drop into shell mode ($ prompt)
7
+ * - Has specific keyword interpretation issues
8
+ */
9
+ import type { OutputFixture } from './claude-outputs.js';
10
+ /**
11
+ * Gemini-specific characters and patterns
12
+ */
13
+ export declare const GEMINI: {
14
+ SPARKLE: string;
15
+ SHELL_PROMPT: string;
16
+ };
17
+ export declare const geminiOutputFixtures: OutputFixture[];
18
+ export default geminiOutputFixtures;
19
+ //# sourceMappingURL=gemini-outputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-outputs.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/gemini-outputs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAAa,EAiI/C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}