@axhub/genie 0.2.8 → 0.2.9

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 (83) hide show
  1. package/LICENSE +21 -675
  2. package/dist/api-docs.html +2 -2
  3. package/dist/assets/App-GBcTeeUS.js +460 -0
  4. package/dist/assets/ReviewApp-C9K--AQE.js +1 -0
  5. package/dist/assets/{_basePickBy-CqJbRZ9y.js → _basePickBy-DR_8uFCo.js} +1 -1
  6. package/dist/assets/{_baseUniq-BS8YH8jO.js → _baseUniq-D0njlQ_7.js} +1 -1
  7. package/dist/assets/{arc-BBmKEN-S.js → arc-CKlr_Rec.js} +1 -1
  8. package/dist/assets/{architectureDiagram-2XIMDMQ5-N5lcb82R.js → architectureDiagram-2XIMDMQ5-BmO_uLUH.js} +1 -1
  9. package/dist/assets/{blockDiagram-WCTKOSBZ-DTMwHuLn.js → blockDiagram-WCTKOSBZ-DhAeO-56.js} +1 -1
  10. package/dist/assets/{c4Diagram-IC4MRINW-BTKlkXI9.js → c4Diagram-IC4MRINW-C67kFoXx.js} +1 -1
  11. package/dist/assets/channel-V3MBjKys.js +1 -0
  12. package/dist/assets/{chunk-4BX2VUAB-DUdoTxAc.js → chunk-4BX2VUAB-mLLagvJi.js} +1 -1
  13. package/dist/assets/{chunk-55IACEB6-Bm_92xe4.js → chunk-55IACEB6-Lx-hOjlM.js} +1 -1
  14. package/dist/assets/{chunk-FMBD7UC4-CGW0g62g.js → chunk-FMBD7UC4-Bt-XmVUV.js} +1 -1
  15. package/dist/assets/{chunk-JSJVCQXG-DYkTH3w1.js → chunk-JSJVCQXG-Cya6gaDV.js} +1 -1
  16. package/dist/assets/{chunk-KX2RTZJC-C9oTlISU.js → chunk-KX2RTZJC-Bd7Ig6tF.js} +1 -1
  17. package/dist/assets/{chunk-NQ4KR5QH-CM50ygWP.js → chunk-NQ4KR5QH-5UAE0Vg-.js} +1 -1
  18. package/dist/assets/{chunk-QZHKN3VN-7dzpYeNJ.js → chunk-QZHKN3VN-BAxZ8m7w.js} +1 -1
  19. package/dist/assets/{chunk-WL4C6EOR-Cm9nQrsr.js → chunk-WL4C6EOR-DjDPvUUP.js} +1 -1
  20. package/dist/assets/classDiagram-VBA2DB6C-C790yYiY.js +1 -0
  21. package/dist/assets/classDiagram-v2-RAHNMMFH-C790yYiY.js +1 -0
  22. package/dist/assets/clone-BbMGfZwt.js +1 -0
  23. package/dist/assets/{cose-bilkent-S5V4N54A-Ccp_p0JZ.js → cose-bilkent-S5V4N54A-D-60XrkJ.js} +1 -1
  24. package/dist/assets/{dagre-KLK3FWXG-fBwTLUp9.js → dagre-KLK3FWXG-bqu3ZS4K.js} +1 -1
  25. package/dist/assets/{diagram-E7M64L7V-CeNVmFUp.js → diagram-E7M64L7V-BueeqoYm.js} +1 -1
  26. package/dist/assets/{diagram-IFDJBPK2-CtavyLGa.js → diagram-IFDJBPK2-D4fDv2E7.js} +1 -1
  27. package/dist/assets/{diagram-P4PSJMXO-CpQTjQwc.js → diagram-P4PSJMXO-WqipY3fN.js} +1 -1
  28. package/dist/assets/{erDiagram-INFDFZHY-B8R5vwhd.js → erDiagram-INFDFZHY-D0oVnO-x.js} +1 -1
  29. package/dist/assets/{flowDiagram-PKNHOUZH-BvkVVwIQ.js → flowDiagram-PKNHOUZH-DzbGyxrr.js} +1 -1
  30. package/dist/assets/{ganttDiagram-A5KZAMGK-DOu3hSNa.js → ganttDiagram-A5KZAMGK-BwhbbgCP.js} +1 -1
  31. package/dist/assets/{gitGraphDiagram-K3NZZRJ6-C7zT67YE.js → gitGraphDiagram-K3NZZRJ6-DZgAh_KM.js} +1 -1
  32. package/dist/assets/{graph-D11wiwHo.js → graph-DzKos-N0.js} +1 -1
  33. package/dist/assets/{highlighted-body-TPN3WLV5-Babpthg-.js → highlighted-body-TPN3WLV5-CKDMgz3X.js} +1 -1
  34. package/dist/assets/{index-DFxzgWoO.js → index-DiQlHzGj.js} +2 -2
  35. package/dist/assets/index-Drat2nB9.css +1 -0
  36. package/dist/assets/{infoDiagram-LFFYTUFH-BmA7IpQG.js → infoDiagram-LFFYTUFH-BFicZbTf.js} +1 -1
  37. package/dist/assets/{ishikawaDiagram-PHBUUO56-BEquZd3E.js → ishikawaDiagram-PHBUUO56-CtihxDxl.js} +1 -1
  38. package/dist/assets/{journeyDiagram-4ABVD52K-BfemGz7f.js → journeyDiagram-4ABVD52K-Du00J8_d.js} +1 -1
  39. package/dist/assets/{kanban-definition-K7BYSVSG-CWja3mln.js → kanban-definition-K7BYSVSG-BJi9S0iQ.js} +1 -1
  40. package/dist/assets/{layout-BLUNf-PJ.js → layout-B80Sityu.js} +1 -1
  41. package/dist/assets/{linear-DukIV_Xv.js → linear-sRQLOf5H.js} +1 -1
  42. package/dist/assets/{mermaid-O7DHMXV3-SgtM28qI.js → mermaid-O7DHMXV3-CBuVs4eJ.js} +6 -6
  43. package/dist/assets/{mindmap-definition-YRQLILUH-4UjqXITU.js → mindmap-definition-YRQLILUH-C5IL_xi-.js} +1 -1
  44. package/dist/assets/{pieDiagram-SKSYHLDU-8AxqJd0M.js → pieDiagram-SKSYHLDU-CeTwlJ8z.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-337W2JSQ-D60m8V8r.js → quadrantDiagram-337W2JSQ-COfUcLWt.js} +1 -1
  46. package/dist/assets/{requirementDiagram-Z7DCOOCP-zqh9jBVf.js → requirementDiagram-Z7DCOOCP-DSb-CJ5B.js} +1 -1
  47. package/dist/assets/{sankeyDiagram-WA2Y5GQK-CDZILTLI.js → sankeyDiagram-WA2Y5GQK-8jtuVb45.js} +1 -1
  48. package/dist/assets/{sequenceDiagram-2WXFIKYE-7BReFd0L.js → sequenceDiagram-2WXFIKYE-C2VpkMwA.js} +1 -1
  49. package/dist/assets/{stateDiagram-RAJIS63D-HPTVdIG4.js → stateDiagram-RAJIS63D-fmwMqxxc.js} +1 -1
  50. package/dist/assets/stateDiagram-v2-FVOUBMTO-9GGXVWrR.js +1 -0
  51. package/dist/assets/{timeline-definition-YZTLITO2-CTVllFgr.js → timeline-definition-YZTLITO2-Dx1hP5lg.js} +1 -1
  52. package/dist/assets/{treemap-KZPCXAKY-BtyxboJZ.js → treemap-KZPCXAKY-CkLOdYCZ.js} +1 -1
  53. package/dist/assets/{vendor-codemirror-Dz7_EqNA.js → vendor-codemirror-BxPY6emf.js} +1 -1
  54. package/dist/assets/{vendor-react-Cpt6D04s.js → vendor-react-xmA_f8ig.js} +1 -1
  55. package/dist/assets/{vennDiagram-LZ73GAT5-D96ZI6Mg.js → vennDiagram-LZ73GAT5-D6KWcnln.js} +1 -1
  56. package/dist/assets/{xychartDiagram-JWTSCODW-eRk-39YO.js → xychartDiagram-JWTSCODW-6fh6qmzN.js} +1 -1
  57. package/dist/index.html +5 -5
  58. package/package.json +3 -3
  59. package/server/acp-runtime/client.js +9 -2
  60. package/server/acp-runtime/session-store.js +4 -4
  61. package/server/cli.js +23 -2
  62. package/server/external-agent/service.js +24 -6
  63. package/server/external-agent/ws.js +63 -3
  64. package/server/index.js +34 -5
  65. package/server/projects.js +536 -161
  66. package/server/routes/session-core.js +149 -86
  67. package/server/session-core/eventStore.js +45 -18
  68. package/server/session-core/providerAdapters.js +50 -13
  69. package/server/session-core/runtimeState.js +8 -0
  70. package/shared/conversationEvents.js +78 -14
  71. package/dist/assets/App-CTKZtqB1.js +0 -460
  72. package/dist/assets/ReviewApp-DM6BNAzR.js +0 -1
  73. package/dist/assets/channel-1oJBvF-0.js +0 -1
  74. package/dist/assets/classDiagram-VBA2DB6C-d5TeKFM4.js +0 -1
  75. package/dist/assets/classDiagram-v2-RAHNMMFH-d5TeKFM4.js +0 -1
  76. package/dist/assets/clone-CinxIlEu.js +0 -1
  77. package/dist/assets/index-YCFGDVKw.css +0 -1
  78. package/dist/assets/stateDiagram-v2-FVOUBMTO-DTUf5_gC.js +0 -1
  79. package/server/_legacy-providers/README.md +0 -30
  80. package/server/_legacy-providers/claude-sdk.js +0 -956
  81. package/server/_legacy-providers/gemini-cli.js +0 -368
  82. package/server/_legacy-providers/openai-codex.js +0 -705
  83. package/server/_legacy-providers/opencode-cli.js +0 -674
@@ -1,368 +0,0 @@
1
- import { spawn } from 'child_process';
2
- import crossSpawn from 'cross-spawn';
3
- import { resolveWorkingDirectory } from './utils/defaultWorkingDirectory.js';
4
-
5
- const spawnFunction = process.platform === 'win32' ? crossSpawn : spawn;
6
-
7
- const activeGeminiProcesses = new Map();
8
-
9
- function collectTextChunks(payload) {
10
- if (!payload) return [];
11
- if (typeof payload === 'string') return payload.trim() ? [payload] : [];
12
-
13
- const chunks = [];
14
-
15
- if (Array.isArray(payload)) {
16
- payload.forEach(item => {
17
- chunks.push(...collectTextChunks(item));
18
- });
19
- return chunks;
20
- }
21
-
22
- if (typeof payload !== 'object') {
23
- return chunks;
24
- }
25
-
26
- const directKeys = ['text', 'response', 'content', 'message', 'delta'];
27
- for (const key of directKeys) {
28
- if (payload[key] !== undefined) {
29
- chunks.push(...collectTextChunks(payload[key]));
30
- }
31
- }
32
-
33
- if (Array.isArray(payload.parts)) {
34
- payload.parts.forEach(part => {
35
- chunks.push(...collectTextChunks(part));
36
- });
37
- }
38
-
39
- if (payload.data && typeof payload.data === 'object') {
40
- chunks.push(...collectTextChunks(payload.data));
41
- }
42
-
43
- return chunks;
44
- }
45
-
46
- function getEventRole(event) {
47
- return (
48
- event?.role ||
49
- event?.author ||
50
- event?.sender ||
51
- event?.message?.role ||
52
- event?.data?.role ||
53
- event?.content?.role ||
54
- null
55
- );
56
- }
57
-
58
- function extractAssistantTextChunks(event, command) {
59
- const role = String(getEventRole(event) || '').toLowerCase();
60
- if (role === 'user') return [];
61
-
62
- const eventType = String(event?.type || event?.event || event?.kind || '').toLowerCase();
63
- const hasAssistantPayload = !!(event?.response || event?.candidates || event?.delta || event?.text || event?.content || event?.message);
64
- if (eventType.includes('prompt') && !hasAssistantPayload) {
65
- return [];
66
- }
67
-
68
- const normalizedPrompt = String(command || '').trim();
69
- return collectTextChunks(event).filter((text) => {
70
- const trimmed = String(text || '').trim();
71
- if (!trimmed) return false;
72
- if (normalizedPrompt && trimmed === normalizedPrompt) return false;
73
- return true;
74
- });
75
- }
76
-
77
- function parseGeminiJsonLine(line) {
78
- const trimmed = line.trim();
79
- if (!trimmed) return null;
80
-
81
- const payload = trimmed.startsWith('data:') ? trimmed.slice(5).trim() : trimmed;
82
- if (!payload) return null;
83
-
84
- return JSON.parse(payload);
85
- }
86
-
87
- function emitTextChunks(ws, sessionId, chunks) {
88
- chunks.forEach((text) => {
89
- if (!text) return;
90
- ws.send({
91
- type: 'claude-response',
92
- data: {
93
- type: 'content_block_delta',
94
- delta: {
95
- type: 'text_delta',
96
- text
97
- }
98
- },
99
- provider: 'gemini',
100
- sessionId
101
- });
102
- });
103
- }
104
-
105
- function formatGeminiProcessError(code, stderrOutput) {
106
- const normalizedStderr = String(stderrOutput || '').trim();
107
- if (normalizedStderr) {
108
- const apiMessageMatch =
109
- normalizedStderr.match(/"message":"([^"]+)"/) ||
110
- normalizedStderr.match(/message:\s*"([^"]+)"/i) ||
111
- normalizedStderr.match(/ApiError:\s*\{.*?"message":"([^"]+)"/i) ||
112
- normalizedStderr.match(/Error when talking to Gemini API[\s\S]*?message":"([^"]+)"/i);
113
-
114
- if (apiMessageMatch?.[1]) {
115
- return apiMessageMatch[1];
116
- }
117
-
118
- const firstMeaningfulLine = normalizedStderr
119
- .split('\n')
120
- .map((line) => line.trim())
121
- .find((line) => line && !line.startsWith('at '));
122
-
123
- if (firstMeaningfulLine) {
124
- return firstMeaningfulLine;
125
- }
126
-
127
- return normalizedStderr;
128
- }
129
-
130
- return `Gemini CLI exited with code ${code}`;
131
- }
132
-
133
- function extractGeminiEventError(event) {
134
- if (!event || typeof event !== 'object') {
135
- return null;
136
- }
137
-
138
- const candidates = [
139
- event?.error?.message,
140
- event?.error?.details,
141
- event?.result?.error?.message,
142
- event?.result?.error,
143
- event?.data?.error?.message,
144
- event?.data?.error,
145
- event?.message
146
- ];
147
-
148
- for (const candidate of candidates) {
149
- const normalized = String(candidate || '').trim();
150
- if (normalized) {
151
- return normalized;
152
- }
153
- }
154
-
155
- return null;
156
- }
157
-
158
- async function queryGemini(command, options = {}, ws) {
159
- return new Promise((resolve, reject) => {
160
- const { sessionId, cwd, projectPath, resume, model, permissionMode } = options;
161
- let capturedSessionId = sessionId;
162
- let sentSessionCreated = false;
163
- let stderrBuffer = '';
164
- let fatalErrorSent = false;
165
- let sawSuccessfulTerminalEvent = false;
166
- let sawErroredTerminalEvent = false;
167
-
168
- const args = ['-y', '@google/gemini-cli'];
169
-
170
- if (sessionId && (resume || !command || !command.trim())) {
171
- args.push('--resume', sessionId);
172
- }
173
-
174
- if (command && command.trim()) {
175
- args.push('--prompt', command);
176
- args.push('--output-format', 'stream-json');
177
- }
178
-
179
- if (model) {
180
- args.push('--model', model);
181
- }
182
-
183
- if (permissionMode === 'bypassPermissions' || permissionMode === 'acceptEdits') {
184
- args.push('--yolo');
185
- }
186
-
187
- const workingDir = resolveWorkingDirectory({ cwd, projectPath });
188
-
189
- const geminiProcess = spawnFunction('npx', args, {
190
- cwd: workingDir,
191
- stdio: ['pipe', 'pipe', 'pipe'],
192
- env: {
193
- ...process.env,
194
- GEMINI_NONINTERACTIVE: '1'
195
- }
196
- });
197
-
198
- const processKey = capturedSessionId || Date.now().toString();
199
- let processRegistryKey = processKey;
200
- activeGeminiProcesses.set(processRegistryKey, geminiProcess);
201
-
202
- const finalizeSessionId = () => capturedSessionId || sessionId || null;
203
- const emitFatalError = (errorMessage) => {
204
- if (fatalErrorSent || !errorMessage) {
205
- return;
206
- }
207
-
208
- fatalErrorSent = true;
209
- ws.send({
210
- type: 'claude-error',
211
- error: errorMessage,
212
- provider: 'gemini',
213
- sessionId: finalizeSessionId()
214
- });
215
- };
216
-
217
- const handleJsonEvent = (event) => {
218
- const incomingSessionId = event?.session_id || event?.sessionId || event?.data?.session_id || event?.data?.sessionId;
219
- if (incomingSessionId && !capturedSessionId) {
220
- capturedSessionId = incomingSessionId;
221
- if (ws.setSessionId && typeof ws.setSessionId === 'function') {
222
- ws.setSessionId(capturedSessionId);
223
- }
224
-
225
- if (processRegistryKey !== capturedSessionId) {
226
- activeGeminiProcesses.delete(processRegistryKey);
227
- activeGeminiProcesses.set(capturedSessionId, geminiProcess);
228
- processRegistryKey = capturedSessionId;
229
- }
230
-
231
- if (!sessionId && !sentSessionCreated) {
232
- sentSessionCreated = true;
233
- ws.send({
234
- type: 'session-created',
235
- sessionId: capturedSessionId,
236
- provider: 'gemini'
237
- });
238
- }
239
- }
240
-
241
- const type = event?.type || event?.event || event?.kind;
242
- if (type === 'result' || type === 'done' || type === 'complete') {
243
- const eventStatus = String(event?.status || event?.result?.status || '').trim().toLowerCase();
244
- const eventError = extractGeminiEventError(event);
245
- if (eventStatus === 'error' || eventError) {
246
- sawErroredTerminalEvent = true;
247
- emitFatalError(eventError || 'Gemini CLI request failed');
248
- return;
249
- }
250
-
251
- sawSuccessfulTerminalEvent = true;
252
- ws.send({
253
- type: 'claude-response',
254
- data: { type: 'content_block_stop' },
255
- provider: 'gemini',
256
- sessionId: finalizeSessionId()
257
- });
258
-
259
- ws.send({
260
- type: 'gemini-result',
261
- data: event,
262
- sessionId: finalizeSessionId()
263
- });
264
- return;
265
- }
266
-
267
- const textChunks = extractAssistantTextChunks(event, command);
268
- emitTextChunks(ws, finalizeSessionId(), textChunks);
269
- };
270
-
271
- let stdoutBuffer = '';
272
- geminiProcess.stdout.on('data', (data) => {
273
- stdoutBuffer += data.toString();
274
- const lines = stdoutBuffer.split('\n');
275
- stdoutBuffer = lines.pop() || '';
276
-
277
- for (const line of lines) {
278
- try {
279
- const event = parseGeminiJsonLine(line);
280
- if (!event) continue;
281
- handleJsonEvent(event);
282
- } catch {}
283
- }
284
- });
285
-
286
- geminiProcess.stderr.on('data', (data) => {
287
- const chunk = data.toString();
288
- stderrBuffer += chunk;
289
-
290
- const normalizedChunk = chunk.trim();
291
- if (normalizedChunk) {
292
- console.warn('Gemini CLI stderr:', normalizedChunk);
293
- }
294
- });
295
-
296
- geminiProcess.on('close', (code) => {
297
- if (stdoutBuffer.trim()) {
298
- try {
299
- const finalEvent = parseGeminiJsonLine(stdoutBuffer);
300
- if (finalEvent) {
301
- handleJsonEvent(finalEvent);
302
- }
303
- } catch {}
304
- }
305
-
306
- activeGeminiProcesses.delete(processRegistryKey);
307
-
308
- if (code === 0 && !sawErroredTerminalEvent) {
309
- if (!sawSuccessfulTerminalEvent) {
310
- ws.send({
311
- type: 'claude-response',
312
- data: { type: 'content_block_stop' },
313
- provider: 'gemini',
314
- sessionId: finalizeSessionId()
315
- });
316
- }
317
-
318
- ws.send({
319
- type: 'claude-complete',
320
- sessionId: finalizeSessionId(),
321
- provider: 'gemini',
322
- exitCode: code,
323
- isNewSession: !sessionId && !!command
324
- });
325
- resolve();
326
- } else {
327
- const errorMessage = formatGeminiProcessError(code, stderrBuffer);
328
- emitFatalError(errorMessage);
329
- reject(new Error(errorMessage));
330
- }
331
- });
332
-
333
- geminiProcess.on('error', (error) => {
334
- activeGeminiProcesses.delete(processRegistryKey);
335
-
336
- emitFatalError(error.message);
337
-
338
- reject(error);
339
- });
340
-
341
- geminiProcess.stdin.end();
342
- });
343
- }
344
-
345
- function abortGeminiSession(sessionId) {
346
- const process = activeGeminiProcesses.get(sessionId);
347
- if (process) {
348
- process.kill('SIGTERM');
349
- activeGeminiProcesses.delete(sessionId);
350
- return true;
351
- }
352
- return false;
353
- }
354
-
355
- function isGeminiSessionActive(sessionId) {
356
- return activeGeminiProcesses.has(sessionId);
357
- }
358
-
359
- function getActiveGeminiSessions() {
360
- return Array.from(activeGeminiProcesses.keys());
361
- }
362
-
363
- export {
364
- queryGemini,
365
- abortGeminiSession,
366
- isGeminiSessionActive,
367
- getActiveGeminiSessions
368
- };