agendex-cli 0.7.0 → 0.8.1
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.
- package/README.md +19 -4
- package/dist/cli.js +1976 -1742
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -31,6 +31,20 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
31
31
|
return to;
|
|
32
32
|
};
|
|
33
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
38
|
+
var __export = (target, all) => {
|
|
39
|
+
for (var name in all)
|
|
40
|
+
__defProp(target, name, {
|
|
41
|
+
get: all[name],
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
34
48
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
35
49
|
|
|
36
50
|
// ../../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
@@ -161,1213 +175,619 @@ var require_src = __commonJS((exports, module) => {
|
|
|
161
175
|
module.exports = { cursor, scroll, erase, beep };
|
|
162
176
|
});
|
|
163
177
|
|
|
164
|
-
//
|
|
165
|
-
import {
|
|
166
|
-
import
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
import { join as join6 } from "node:path";
|
|
173
|
-
|
|
174
|
-
// ../shared/src/adapters/claude-code.ts
|
|
175
|
-
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
176
|
-
import { homedir } from "node:os";
|
|
177
|
-
import { basename, join, resolve, sep } from "node:path";
|
|
178
|
-
|
|
179
|
-
// ../shared/src/hash.ts
|
|
180
|
-
import { createHash } from "node:crypto";
|
|
181
|
-
function hashPath(filePath) {
|
|
182
|
-
return createHash("sha256").update(filePath).digest("hex").slice(0, 16);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// ../shared/src/adapters/claude-code.ts
|
|
186
|
-
var plansDir = join(homedir(), ".claude", "plans");
|
|
187
|
-
function extractTitle(content, filename) {
|
|
188
|
-
const match = content.match(/^#\s+(.+)/m);
|
|
189
|
-
if (match?.[1])
|
|
190
|
-
return match[1].replace(/^Plan:\s*/i, "").trim();
|
|
191
|
-
return basename(filename, ".md").split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
178
|
+
// ../../node_modules/.bun/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
|
|
179
|
+
import { stdout as R, stdin as q } from "node:process";
|
|
180
|
+
import ot from "node:readline";
|
|
181
|
+
function B(t, e, s) {
|
|
182
|
+
if (!s.some((u) => !u.disabled))
|
|
183
|
+
return t;
|
|
184
|
+
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
185
|
+
return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
|
|
192
186
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
getWatchPaths() {
|
|
200
|
-
return [plansDir];
|
|
201
|
-
},
|
|
202
|
-
matches(filePath) {
|
|
203
|
-
if (!filePath.endsWith(".md"))
|
|
204
|
-
return false;
|
|
205
|
-
const normalized = resolve(filePath);
|
|
206
|
-
const baseDir = resolve(plansDir);
|
|
207
|
-
return normalized.startsWith(baseDir + sep);
|
|
208
|
-
},
|
|
209
|
-
async parse(filePath) {
|
|
210
|
-
try {
|
|
211
|
-
const content = await readFile(filePath, "utf-8");
|
|
212
|
-
const stats = await stat(filePath);
|
|
213
|
-
return [
|
|
214
|
-
{
|
|
215
|
-
id: hashPath(filePath),
|
|
216
|
-
agent: "claude-code",
|
|
217
|
-
title: extractTitle(content, filePath),
|
|
218
|
-
content,
|
|
219
|
-
filePath,
|
|
220
|
-
format: "md",
|
|
221
|
-
createdAt: stats.birthtime,
|
|
222
|
-
updatedAt: stats.mtime,
|
|
223
|
-
metadata: {}
|
|
224
|
-
}
|
|
225
|
-
];
|
|
226
|
-
} catch {
|
|
227
|
-
return [];
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
async write(plan, newContent) {
|
|
231
|
-
try {
|
|
232
|
-
await writeFile(plan.filePath, newContent, "utf-8");
|
|
233
|
-
return true;
|
|
234
|
-
} catch {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
// ../shared/src/adapters/codex-cli.ts
|
|
241
|
-
import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
|
|
242
|
-
import { homedir as homedir2 } from "node:os";
|
|
243
|
-
import { basename as basename2, join as join2 } from "node:path";
|
|
244
|
-
var sessionsDir = join2(homedir2(), ".codex", "sessions");
|
|
245
|
-
var PROPOSED_PLAN_BLOCK_REGEX = /<proposed_plan>\s*([\s\S]*?)\s*<\/proposed_plan>/gi;
|
|
246
|
-
var PROPOSED_PLAN_TAG_REGEX = /<\s*\/?\s*proposed_plan\s*>/gi;
|
|
247
|
-
var ESCAPED_PROPOSED_PLAN_TAG_REGEX = /<\s*\/?\s*proposed_plan\s*>/gi;
|
|
248
|
-
function normalizeLineEndings(text) {
|
|
249
|
-
return text.replace(/\r\n?/g, `
|
|
187
|
+
function K(t, e, s) {
|
|
188
|
+
return String(t).normalize().replaceAll(`\r
|
|
189
|
+
`, `
|
|
190
|
+
`).split(`
|
|
191
|
+
`).map((i) => Et(i, e, s)).join(`
|
|
250
192
|
`);
|
|
251
193
|
}
|
|
252
|
-
function
|
|
253
|
-
|
|
194
|
+
function H(t, e) {
|
|
195
|
+
if (typeof t == "string")
|
|
196
|
+
return _.aliases.get(t) === e;
|
|
197
|
+
for (const s of t)
|
|
198
|
+
if (s !== undefined && H(s, e))
|
|
199
|
+
return true;
|
|
200
|
+
return false;
|
|
254
201
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
202
|
+
function _t(t, e) {
|
|
203
|
+
if (t === e)
|
|
204
|
+
return;
|
|
205
|
+
const s = t.split(`
|
|
206
|
+
`), i = e.split(`
|
|
207
|
+
`), r = Math.max(s.length, i.length), n = [];
|
|
208
|
+
for (let u = 0;u < r; u++)
|
|
209
|
+
s[u] !== i[u] && n.push(u);
|
|
210
|
+
return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
|
|
257
211
|
}
|
|
258
|
-
function
|
|
259
|
-
|
|
260
|
-
for (const line of raw.split(`
|
|
261
|
-
`)) {
|
|
262
|
-
const trimmed = line.trim();
|
|
263
|
-
if (!trimmed)
|
|
264
|
-
continue;
|
|
265
|
-
try {
|
|
266
|
-
parsed.push(JSON.parse(trimmed));
|
|
267
|
-
} catch {}
|
|
268
|
-
}
|
|
269
|
-
return parsed;
|
|
212
|
+
function Ct(t) {
|
|
213
|
+
return t === z;
|
|
270
214
|
}
|
|
271
|
-
function
|
|
272
|
-
|
|
215
|
+
function T(t, e) {
|
|
216
|
+
const s = t;
|
|
217
|
+
s.isTTY && s.setRawMode(e);
|
|
273
218
|
}
|
|
274
|
-
function
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return "";
|
|
279
|
-
const parts = [];
|
|
280
|
-
for (const chunk of content) {
|
|
281
|
-
if (!isRecord(chunk))
|
|
282
|
-
continue;
|
|
283
|
-
const type = typeof chunk.type === "string" ? chunk.type : "";
|
|
284
|
-
if (type !== "text" && type !== "input_text" && type !== "output_text")
|
|
285
|
-
continue;
|
|
286
|
-
if (typeof chunk.text === "string")
|
|
287
|
-
parts.push(chunk.text);
|
|
288
|
-
}
|
|
289
|
-
return parts.join(`
|
|
219
|
+
function xt(t, e, s, i = s) {
|
|
220
|
+
const r = rt(t ?? R);
|
|
221
|
+
return K(e, r - s.length, { hard: true, trim: false }).split(`
|
|
222
|
+
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
290
223
|
`);
|
|
291
224
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
meta.startedAt = line.payload.timestamp;
|
|
312
|
-
}
|
|
313
|
-
if (typeof line.payload.started_at === "string" && !meta.startedAt) {
|
|
314
|
-
meta.startedAt = line.payload.started_at;
|
|
315
|
-
}
|
|
316
|
-
if (typeof line.payload.cwd === "string" && !meta.cwd) {
|
|
317
|
-
meta.cwd = line.payload.cwd;
|
|
318
|
-
}
|
|
225
|
+
|
|
226
|
+
class x {
|
|
227
|
+
input;
|
|
228
|
+
output;
|
|
229
|
+
_abortSignal;
|
|
230
|
+
rl;
|
|
231
|
+
opts;
|
|
232
|
+
_render;
|
|
233
|
+
_track = false;
|
|
234
|
+
_prevFrame = "";
|
|
235
|
+
_subscribers = new Map;
|
|
236
|
+
_cursor = 0;
|
|
237
|
+
state = "initial";
|
|
238
|
+
error = "";
|
|
239
|
+
value;
|
|
240
|
+
userInput = "";
|
|
241
|
+
constructor(e, s = true) {
|
|
242
|
+
const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
|
|
243
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
|
|
319
244
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
function normalizeRole(candidate, fallback = "assistant") {
|
|
323
|
-
if (typeof candidate !== "string")
|
|
324
|
-
return fallback;
|
|
325
|
-
return candidate;
|
|
326
|
-
}
|
|
327
|
-
function extractMessages(lines) {
|
|
328
|
-
const messages = [];
|
|
329
|
-
for (const line of lines) {
|
|
330
|
-
if (!isRecord(line))
|
|
331
|
-
continue;
|
|
332
|
-
if (line.type === "response_item" && isRecord(line.payload) && line.payload.type === "message") {
|
|
333
|
-
const text2 = extractTextFromContent(line.payload.content);
|
|
334
|
-
if (!text2.trim())
|
|
335
|
-
continue;
|
|
336
|
-
messages.push({
|
|
337
|
-
role: normalizeRole(line.payload.role),
|
|
338
|
-
text: text2,
|
|
339
|
-
phase: typeof line.payload.phase === "string" ? line.payload.phase : undefined
|
|
340
|
-
});
|
|
341
|
-
continue;
|
|
342
|
-
}
|
|
343
|
-
const hasLegacyFields = line.content !== undefined || line.role !== undefined || line.session_meta !== undefined || line.type === "message";
|
|
344
|
-
if (!hasLegacyFields || line.session_meta !== undefined)
|
|
345
|
-
continue;
|
|
346
|
-
const text = extractTextFromContent(line.content);
|
|
347
|
-
if (!text.trim())
|
|
348
|
-
continue;
|
|
349
|
-
messages.push({
|
|
350
|
-
role: normalizeRole(line.role, "user"),
|
|
351
|
-
text
|
|
352
|
-
});
|
|
245
|
+
unsubscribe() {
|
|
246
|
+
this._subscribers.clear();
|
|
353
247
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const blocks = [];
|
|
358
|
-
for (const message of messages) {
|
|
359
|
-
if (message.role !== "assistant")
|
|
360
|
-
continue;
|
|
361
|
-
const matches = message.text.matchAll(PROPOSED_PLAN_BLOCK_REGEX);
|
|
362
|
-
for (const match of matches) {
|
|
363
|
-
if (!match[1])
|
|
364
|
-
continue;
|
|
365
|
-
const block = normalizeMarkdown(match[1]);
|
|
366
|
-
if (block)
|
|
367
|
-
blocks.push(block);
|
|
368
|
-
}
|
|
248
|
+
setSubscriber(e, s) {
|
|
249
|
+
const i = this._subscribers.get(e) ?? [];
|
|
250
|
+
i.push(s), this._subscribers.set(e, i);
|
|
369
251
|
}
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
function selectPlanContent(messages) {
|
|
373
|
-
const assistant = messages.filter((m) => m.role === "assistant" && m.text.trim().length > 0);
|
|
374
|
-
const planBlocks = extractProposedPlanBlocks(assistant);
|
|
375
|
-
if (planBlocks.length > 0) {
|
|
376
|
-
return {
|
|
377
|
-
content: normalizeMarkdown(planBlocks.join(`
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
`)),
|
|
382
|
-
planBlocks
|
|
383
|
-
};
|
|
252
|
+
on(e, s) {
|
|
253
|
+
this.setSubscriber(e, { cb: s });
|
|
384
254
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
255
|
+
once(e, s) {
|
|
256
|
+
this.setSubscriber(e, { cb: s, once: true });
|
|
257
|
+
}
|
|
258
|
+
emit(e, ...s) {
|
|
259
|
+
const i = this._subscribers.get(e) ?? [], r = [];
|
|
260
|
+
for (const n of i)
|
|
261
|
+
n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
|
|
262
|
+
for (const n of r)
|
|
263
|
+
n();
|
|
264
|
+
}
|
|
265
|
+
prompt() {
|
|
266
|
+
return new Promise((e) => {
|
|
267
|
+
if (this._abortSignal) {
|
|
268
|
+
if (this._abortSignal.aborted)
|
|
269
|
+
return this.state = "cancel", this.close(), e(z);
|
|
270
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
271
|
+
this.state = "cancel", this.close();
|
|
272
|
+
}, { once: true });
|
|
273
|
+
}
|
|
274
|
+
this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
275
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
|
|
276
|
+
}), this.once("cancel", () => {
|
|
277
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
_isActionKey(e, s) {
|
|
282
|
+
return e === "\t";
|
|
283
|
+
}
|
|
284
|
+
_setValue(e) {
|
|
285
|
+
this.value = e, this.emit("value", this.value);
|
|
286
|
+
}
|
|
287
|
+
_setUserInput(e, s) {
|
|
288
|
+
this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
289
|
+
}
|
|
290
|
+
_clearUserInput() {
|
|
291
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
292
|
+
}
|
|
293
|
+
onKeypress(e, s) {
|
|
294
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
|
|
295
|
+
if (this.opts.validate) {
|
|
296
|
+
const i = this.opts.validate(this.value);
|
|
297
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
298
|
+
}
|
|
299
|
+
this.state !== "error" && (this.state = "submit");
|
|
422
300
|
}
|
|
301
|
+
H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
423
302
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
continue;
|
|
428
|
-
return cleanTitle(trimmed);
|
|
303
|
+
close() {
|
|
304
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
305
|
+
`), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
429
306
|
}
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (!normalized)
|
|
435
|
-
return false;
|
|
436
|
-
const lower = normalized.toLowerCase();
|
|
437
|
-
if (lower.startsWith("# agents.md instructions"))
|
|
438
|
-
return false;
|
|
439
|
-
if (lower.startsWith("<environment_context>"))
|
|
440
|
-
return false;
|
|
441
|
-
if (lower.startsWith("<system-reminder>"))
|
|
442
|
-
return false;
|
|
443
|
-
return true;
|
|
444
|
-
}
|
|
445
|
-
function extractTitle2(messages, planBlocks, filename) {
|
|
446
|
-
if (planBlocks.length > 0 && planBlocks[0]) {
|
|
447
|
-
const planTitle = titleFromPlanBlock(planBlocks[0]);
|
|
448
|
-
if (planTitle)
|
|
449
|
-
return shorten(planTitle, 120);
|
|
307
|
+
restoreCursor() {
|
|
308
|
+
const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
309
|
+
`).length - 1;
|
|
310
|
+
this.output.write(import_sisteransi.cursor.move(-999, e * -1));
|
|
450
311
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
312
|
+
render() {
|
|
313
|
+
const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
314
|
+
if (e !== this._prevFrame) {
|
|
315
|
+
if (this.state === "initial")
|
|
316
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
317
|
+
else {
|
|
318
|
+
const s = _t(this._prevFrame, e), i = nt(this.output);
|
|
319
|
+
if (this.restoreCursor(), s) {
|
|
320
|
+
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
321
|
+
let u = s.lines.find((a) => a >= r);
|
|
322
|
+
if (u === undefined) {
|
|
323
|
+
this._prevFrame = e;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (s.lines.length === 1) {
|
|
327
|
+
this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
328
|
+
const a = e.split(`
|
|
329
|
+
`);
|
|
330
|
+
this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
|
|
331
|
+
return;
|
|
332
|
+
} else if (s.lines.length > 1) {
|
|
333
|
+
if (r < n)
|
|
334
|
+
u = r;
|
|
335
|
+
else {
|
|
336
|
+
const l = u - n;
|
|
337
|
+
l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
|
|
338
|
+
}
|
|
339
|
+
this.output.write(import_sisteransi.erase.down());
|
|
340
|
+
const a = e.split(`
|
|
341
|
+
`).slice(u);
|
|
342
|
+
this.output.write(a.join(`
|
|
343
|
+
`)), this._prevFrame = e;
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
this.output.write(import_sisteransi.erase.down());
|
|
348
|
+
}
|
|
349
|
+
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
350
|
+
}
|
|
457
351
|
}
|
|
458
|
-
return basename2(filename, ".jsonl");
|
|
459
352
|
}
|
|
460
|
-
function
|
|
461
|
-
if (
|
|
462
|
-
return;
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
return;
|
|
466
|
-
return date;
|
|
353
|
+
function wt(t, e) {
|
|
354
|
+
if (t === undefined || e.length === 0)
|
|
355
|
+
return 0;
|
|
356
|
+
const s = e.findIndex((i) => i.value === t);
|
|
357
|
+
return s !== -1 ? s : 0;
|
|
467
358
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
const createdAt = parseDate(sessionMeta.startedAt) ?? stats.birthtime;
|
|
491
|
-
const metadata = {};
|
|
492
|
-
if (sessionMeta.sessionId)
|
|
493
|
-
metadata.sessionId = sessionMeta.sessionId;
|
|
494
|
-
if (planBlocks.length > 0)
|
|
495
|
-
metadata.planBlocks = planBlocks.length;
|
|
496
|
-
return [
|
|
497
|
-
{
|
|
498
|
-
id: hashPath(filePath),
|
|
499
|
-
agent: "codex-cli",
|
|
500
|
-
title: extractTitle2(messages, planBlocks, filePath),
|
|
501
|
-
content,
|
|
502
|
-
filePath,
|
|
503
|
-
format: "jsonl",
|
|
504
|
-
createdAt,
|
|
505
|
-
updatedAt: stats.mtime,
|
|
506
|
-
workspace: sessionMeta.cwd,
|
|
507
|
-
metadata
|
|
359
|
+
function Dt(t, e) {
|
|
360
|
+
return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
|
|
361
|
+
}
|
|
362
|
+
function St(t, e) {
|
|
363
|
+
if (e)
|
|
364
|
+
return t ? e : e[0];
|
|
365
|
+
}
|
|
366
|
+
var import_picocolors, import_sisteransi, at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O, y, L, P, M, ct, ft, X = (t, e = {}, s = {}) => {
|
|
367
|
+
const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
368
|
+
let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
369
|
+
t:
|
|
370
|
+
for (;; ) {
|
|
371
|
+
if (w > C || o >= p && o > h) {
|
|
372
|
+
const ut = t.slice(C, w) || t.slice(h, o);
|
|
373
|
+
v = 0;
|
|
374
|
+
for (const Y of ut.replaceAll(ct, "")) {
|
|
375
|
+
const $ = Y.codePointAt(0) || 0;
|
|
376
|
+
if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
377
|
+
F = true;
|
|
378
|
+
break t;
|
|
379
|
+
}
|
|
380
|
+
v += Y.length, c += f;
|
|
508
381
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
// ../shared/src/adapters/continue-ide.ts
|
|
520
|
-
import { readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
521
|
-
import { homedir as homedir3 } from "node:os";
|
|
522
|
-
import { join as join3 } from "node:path";
|
|
523
|
-
var continueDir = join3(homedir3(), ".continue", "sessions");
|
|
524
|
-
var continueIdeAdapter = {
|
|
525
|
-
agent: "continue-ide",
|
|
526
|
-
writable: false,
|
|
527
|
-
getSearchPaths() {
|
|
528
|
-
return [continueDir];
|
|
529
|
-
},
|
|
530
|
-
getWatchPaths() {
|
|
531
|
-
return [continueDir];
|
|
532
|
-
},
|
|
533
|
-
matches(filePath) {
|
|
534
|
-
return filePath.endsWith(".json");
|
|
535
|
-
},
|
|
536
|
-
async parse(filePath) {
|
|
537
|
-
try {
|
|
538
|
-
const raw = await readFile3(filePath, "utf-8");
|
|
539
|
-
const session = JSON.parse(raw);
|
|
540
|
-
if (!session.history || session.history.length === 0)
|
|
541
|
-
return [];
|
|
542
|
-
const stats = await stat3(filePath);
|
|
543
|
-
let title = "Continue Session";
|
|
544
|
-
let workspace;
|
|
545
|
-
const indexPath = join3(continueDir, "sessions.json");
|
|
546
|
-
try {
|
|
547
|
-
const indexRaw = await readFile3(indexPath, "utf-8");
|
|
548
|
-
const sessions = JSON.parse(indexRaw);
|
|
549
|
-
const sessionId = filePath.split("/").pop()?.replace(".json", "");
|
|
550
|
-
const meta = sessions.find((s) => s.sessionId === sessionId);
|
|
551
|
-
if (meta) {
|
|
552
|
-
title = meta.title || title;
|
|
553
|
-
workspace = meta.workspaceDirectory;
|
|
382
|
+
C = w = 0;
|
|
383
|
+
}
|
|
384
|
+
if (o >= p)
|
|
385
|
+
break;
|
|
386
|
+
if (M.lastIndex = o, M.test(t)) {
|
|
387
|
+
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
388
|
+
F = true;
|
|
389
|
+
break;
|
|
554
390
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
{
|
|
563
|
-
id: hashPath(filePath),
|
|
564
|
-
agent: "continue-ide",
|
|
565
|
-
title,
|
|
566
|
-
content,
|
|
567
|
-
filePath,
|
|
568
|
-
format: "json",
|
|
569
|
-
createdAt: stats.birthtime,
|
|
570
|
-
updatedAt: stats.mtime,
|
|
571
|
-
workspace,
|
|
572
|
-
metadata: {}
|
|
391
|
+
c += f, C = h, w = o, o = h = M.lastIndex;
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
if (O.lastIndex = o, O.test(t)) {
|
|
395
|
+
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
396
|
+
F = true;
|
|
397
|
+
break;
|
|
573
398
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
return [];
|
|
577
|
-
}
|
|
578
|
-
},
|
|
579
|
-
async write() {
|
|
580
|
-
return false;
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
// ../shared/src/adapters/cursor.ts
|
|
585
|
-
import { existsSync } from "node:fs";
|
|
586
|
-
import { stat as stat4 } from "node:fs/promises";
|
|
587
|
-
import { homedir as homedir4 } from "node:os";
|
|
588
|
-
import { join as join4 } from "node:path";
|
|
589
|
-
function quoteIdentifier(name) {
|
|
590
|
-
return `"${name.replaceAll('"', '""')}"`;
|
|
591
|
-
}
|
|
592
|
-
var cursorAdapter = {
|
|
593
|
-
agent: "cursor",
|
|
594
|
-
writable: false,
|
|
595
|
-
getSearchPaths() {
|
|
596
|
-
return [join4(homedir4(), ".cursor", "ai-tracking")];
|
|
597
|
-
},
|
|
598
|
-
getWatchPaths() {
|
|
599
|
-
return [join4(homedir4(), ".cursor", "ai-tracking")];
|
|
600
|
-
},
|
|
601
|
-
matches(filePath) {
|
|
602
|
-
return filePath.endsWith(".db");
|
|
603
|
-
},
|
|
604
|
-
async parse(filePath) {
|
|
605
|
-
if (!existsSync(filePath))
|
|
606
|
-
return [];
|
|
607
|
-
let db = null;
|
|
608
|
-
try {
|
|
609
|
-
const { default: SqliteDatabase } = await import("better-sqlite3");
|
|
610
|
-
db = new SqliteDatabase(filePath, { fileMustExist: true, readonly: true });
|
|
611
|
-
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all();
|
|
612
|
-
const plans = [];
|
|
613
|
-
const stats = await stat4(filePath);
|
|
614
|
-
for (const table of tables) {
|
|
615
|
-
try {
|
|
616
|
-
const rows = db.prepare(`SELECT * FROM ${quoteIdentifier(table.name)} LIMIT 50`).all();
|
|
617
|
-
if (rows.length === 0)
|
|
618
|
-
continue;
|
|
619
|
-
const content = rows.map((row) => {
|
|
620
|
-
return Object.entries(row).map(([k, v]) => `**${k}**: ${String(v)}`).join(`
|
|
621
|
-
`);
|
|
622
|
-
}).join(`
|
|
623
|
-
|
|
624
|
-
---
|
|
625
|
-
|
|
626
|
-
`);
|
|
627
|
-
plans.push({
|
|
628
|
-
id: hashPath(`${filePath}:${table.name}`),
|
|
629
|
-
agent: "cursor",
|
|
630
|
-
title: `Cursor: ${table.name}`,
|
|
631
|
-
content,
|
|
632
|
-
filePath,
|
|
633
|
-
format: "sqlite",
|
|
634
|
-
createdAt: stats.birthtime,
|
|
635
|
-
updatedAt: stats.mtime,
|
|
636
|
-
metadata: { table: table.name }
|
|
637
|
-
});
|
|
638
|
-
} catch {}
|
|
399
|
+
c += u, C = h, w = o, o = h = O.lastIndex;
|
|
400
|
+
continue;
|
|
639
401
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
},
|
|
647
|
-
async write() {
|
|
648
|
-
return false;
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
// ../shared/src/adapters/oh-my-opencode.ts
|
|
653
|
-
import { existsSync as existsSync2, readdirSync, readFileSync } from "node:fs";
|
|
654
|
-
import { readdir, readFile as readFile4, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
|
|
655
|
-
import { homedir as homedir5 } from "node:os";
|
|
656
|
-
import { basename as basename3, join as join5 } from "node:path";
|
|
657
|
-
var dataHome = process.env.XDG_DATA_HOME || join5(homedir5(), ".local", "share");
|
|
658
|
-
var opencodeSessionDir = join5(dataHome, "opencode", "storage", "session");
|
|
659
|
-
var cwdPlansDir = join5(process.cwd(), ".sisyphus", "plans");
|
|
660
|
-
var PLAN_PATH_MARKER = "/.sisyphus/plans/";
|
|
661
|
-
function normalizePath(filePath) {
|
|
662
|
-
return filePath.replace(/\\/g, "/");
|
|
663
|
-
}
|
|
664
|
-
function isRecord2(value) {
|
|
665
|
-
return typeof value === "object" && value !== null;
|
|
666
|
-
}
|
|
667
|
-
function isPlanMarkdown(filePath) {
|
|
668
|
-
const normalized = normalizePath(filePath).toLowerCase();
|
|
669
|
-
return normalized.endsWith(".md") && normalized.includes(PLAN_PATH_MARKER);
|
|
670
|
-
}
|
|
671
|
-
function isSessionFile(filePath) {
|
|
672
|
-
const normalized = normalizePath(filePath);
|
|
673
|
-
const root = normalizePath(opencodeSessionDir);
|
|
674
|
-
return normalized.startsWith(`${root}/`) && normalized.endsWith(".json");
|
|
675
|
-
}
|
|
676
|
-
function extractTitle3(content, filePath) {
|
|
677
|
-
const heading = content.match(/^\s{0,3}#{1,6}\s+(.+?)\s*$/m)?.[1];
|
|
678
|
-
if (heading)
|
|
679
|
-
return heading.replace(/^Plan:\s*/i, "").trim();
|
|
680
|
-
return basename3(filePath, ".md").split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
681
|
-
}
|
|
682
|
-
function workspaceFromPlanPath(filePath) {
|
|
683
|
-
const normalized = normalizePath(filePath);
|
|
684
|
-
const lower = normalized.toLowerCase();
|
|
685
|
-
const markerIndex = lower.lastIndexOf(PLAN_PATH_MARKER);
|
|
686
|
-
if (markerIndex <= 0)
|
|
687
|
-
return;
|
|
688
|
-
return normalized.slice(0, markerIndex);
|
|
689
|
-
}
|
|
690
|
-
function parseSessionMeta(raw) {
|
|
691
|
-
try {
|
|
692
|
-
const parsed = JSON.parse(raw);
|
|
693
|
-
if (!isRecord2(parsed))
|
|
694
|
-
return;
|
|
695
|
-
return {
|
|
696
|
-
id: typeof parsed.id === "string" ? parsed.id : undefined,
|
|
697
|
-
parentID: typeof parsed.parentID === "string" ? parsed.parentID : undefined,
|
|
698
|
-
directory: typeof parsed.directory === "string" ? parsed.directory : undefined
|
|
699
|
-
};
|
|
700
|
-
} catch {
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
function discoverPlanDirectories() {
|
|
705
|
-
const dirs = new Set([cwdPlansDir]);
|
|
706
|
-
if (!existsSync2(opencodeSessionDir))
|
|
707
|
-
return Array.from(dirs);
|
|
708
|
-
try {
|
|
709
|
-
const projectDirs = readdirSync(opencodeSessionDir, { withFileTypes: true });
|
|
710
|
-
for (const projectDir of projectDirs) {
|
|
711
|
-
if (!projectDir.isDirectory())
|
|
402
|
+
if (y.lastIndex = o, y.test(t)) {
|
|
403
|
+
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
404
|
+
F = true;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
c += f, C = h, w = o, o = h = y.lastIndex;
|
|
712
408
|
continue;
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
409
|
+
}
|
|
410
|
+
if (L.lastIndex = o, L.test(t)) {
|
|
411
|
+
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
412
|
+
F = true;
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
c += f, C = h, w = o, o = h = L.lastIndex;
|
|
718
416
|
continue;
|
|
719
417
|
}
|
|
720
|
-
|
|
721
|
-
if (
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
continue;
|
|
728
|
-
if (session.parentID)
|
|
729
|
-
continue;
|
|
730
|
-
dirs.add(join5(session.directory, ".sisyphus", "plans"));
|
|
731
|
-
} catch {}
|
|
418
|
+
if (P.lastIndex = o, P.test(t)) {
|
|
419
|
+
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
420
|
+
F = true;
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
c += g, C = h, w = o, o = h = P.lastIndex;
|
|
424
|
+
continue;
|
|
732
425
|
}
|
|
426
|
+
o += 1;
|
|
733
427
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
return
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
428
|
+
return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
|
|
429
|
+
}, pt, S = (t, e = {}) => X(t, pt, e).width, W = "\x1B", Z = "", Ft = 39, j = "\x07", Q = "[", dt = "]", tt = "m", U, et, mt = (t) => {
|
|
430
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
|
|
431
|
+
return 39;
|
|
432
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
|
|
433
|
+
return 49;
|
|
434
|
+
if (t === 1 || t === 2)
|
|
435
|
+
return 22;
|
|
436
|
+
if (t === 3)
|
|
437
|
+
return 23;
|
|
438
|
+
if (t === 4)
|
|
439
|
+
return 24;
|
|
440
|
+
if (t === 7)
|
|
441
|
+
return 27;
|
|
442
|
+
if (t === 8)
|
|
443
|
+
return 28;
|
|
444
|
+
if (t === 9)
|
|
445
|
+
return 29;
|
|
446
|
+
if (t === 0)
|
|
447
|
+
return 0;
|
|
448
|
+
}, st = (t) => `${W}${Q}${t}${tt}`, it = (t) => `${W}${U}${t}${j}`, gt = (t) => t.map((e) => S(e)), G = (t, e, s) => {
|
|
449
|
+
const i = e[Symbol.iterator]();
|
|
450
|
+
let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
451
|
+
for (;!l.done; ) {
|
|
452
|
+
const m = l.value, A = S(m);
|
|
453
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
757
454
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
455
|
+
u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
456
|
+
}, vt = (t) => {
|
|
457
|
+
const e = t.split(" ");
|
|
458
|
+
let s = e.length;
|
|
459
|
+
for (;s > 0 && !(S(e[s - 1]) > 0); )
|
|
460
|
+
s--;
|
|
461
|
+
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
462
|
+
}, Et = (t, e, s = {}) => {
|
|
463
|
+
if (s.trim !== false && t.trim() === "")
|
|
464
|
+
return "";
|
|
465
|
+
let i = "", r, n;
|
|
466
|
+
const u = t.split(" "), a = gt(u);
|
|
467
|
+
let l = [""];
|
|
468
|
+
for (const [h, o] of u.entries()) {
|
|
469
|
+
s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
470
|
+
let p = S(l.at(-1) ?? "");
|
|
471
|
+
if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
472
|
+
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
473
|
+
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
477
|
+
if (s.wordWrap === false && p < e) {
|
|
478
|
+
G(l, o, e);
|
|
774
479
|
continue;
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
source: "session-index",
|
|
778
|
-
sessionId: session.id
|
|
779
|
-
});
|
|
780
|
-
plans.push(...parsed);
|
|
480
|
+
}
|
|
481
|
+
l.push("");
|
|
781
482
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
483
|
+
if (p + a[h] > e && s.wordWrap === false) {
|
|
484
|
+
G(l, o, e);
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
l[l.length - 1] += o;
|
|
785
488
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (isPlanMarkdown(filePath)) {
|
|
801
|
-
return parsePlanFile(filePath, workspaceFromPlanPath(filePath), {
|
|
802
|
-
source: "plan-file"
|
|
803
|
-
});
|
|
489
|
+
s.trim !== false && (l = l.map((h) => vt(h)));
|
|
490
|
+
const E = l.join(`
|
|
491
|
+
`), g = E[Symbol.iterator]();
|
|
492
|
+
let m = g.next(), A = g.next(), V = 0;
|
|
493
|
+
for (;!m.done; ) {
|
|
494
|
+
const h = m.value, o = A.value;
|
|
495
|
+
if (i += h, h === W || h === Z) {
|
|
496
|
+
et.lastIndex = V + 1;
|
|
497
|
+
const F = et.exec(E)?.groups;
|
|
498
|
+
if (F?.code !== undefined) {
|
|
499
|
+
const d = Number.parseFloat(F.code);
|
|
500
|
+
r = d === Ft ? undefined : d;
|
|
501
|
+
} else
|
|
502
|
+
F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
|
|
804
503
|
}
|
|
805
|
-
|
|
806
|
-
|
|
504
|
+
const p = r ? mt(r) : undefined;
|
|
505
|
+
o === `
|
|
506
|
+
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
507
|
+
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
508
|
+
}
|
|
509
|
+
return i;
|
|
510
|
+
}, At, _, bt, z, rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80, nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20, Vt, yt, Lt;
|
|
511
|
+
var init_dist = __esm(() => {
|
|
512
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
513
|
+
import_sisteransi = __toESM(require_src(), 1);
|
|
514
|
+
O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
515
|
+
y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
516
|
+
L = /\t{1,1000}/y;
|
|
517
|
+
P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
518
|
+
M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
519
|
+
ct = /\p{M}+/gu;
|
|
520
|
+
ft = { limit: 1 / 0, ellipsis: "" };
|
|
521
|
+
pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
522
|
+
U = `${dt}8;;`;
|
|
523
|
+
et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
|
|
524
|
+
At = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
525
|
+
_ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
|
|
526
|
+
bt = globalThis.process.platform.startsWith("win");
|
|
527
|
+
z = Symbol("clack:cancel");
|
|
528
|
+
Vt = class Vt extends x {
|
|
529
|
+
filteredOptions;
|
|
530
|
+
multiple;
|
|
531
|
+
isNavigating = false;
|
|
532
|
+
selectedValues = [];
|
|
533
|
+
focusedValue;
|
|
534
|
+
#t = 0;
|
|
535
|
+
#s = "";
|
|
536
|
+
#i;
|
|
537
|
+
#e;
|
|
538
|
+
get cursor() {
|
|
539
|
+
return this.#t;
|
|
540
|
+
}
|
|
541
|
+
get userInputWithCursor() {
|
|
542
|
+
if (!this.userInput)
|
|
543
|
+
return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
|
|
544
|
+
if (this._cursor >= this.userInput.length)
|
|
545
|
+
return `${this.userInput}█`;
|
|
546
|
+
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
547
|
+
return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
|
|
548
|
+
}
|
|
549
|
+
get options() {
|
|
550
|
+
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
551
|
+
}
|
|
552
|
+
constructor(e) {
|
|
553
|
+
super(e), this.#e = e.options;
|
|
554
|
+
const s = this.options;
|
|
555
|
+
this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
|
|
556
|
+
let i;
|
|
557
|
+
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
|
|
558
|
+
for (const r of i) {
|
|
559
|
+
const n = s.findIndex((u) => u.value === r);
|
|
560
|
+
n !== -1 && (this.toggleSelected(r), this.#t = n);
|
|
561
|
+
}
|
|
562
|
+
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
|
|
563
|
+
}
|
|
564
|
+
_isActionKey(e, s) {
|
|
565
|
+
return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
|
|
566
|
+
}
|
|
567
|
+
#r(e, s) {
|
|
568
|
+
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
569
|
+
i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
570
|
+
}
|
|
571
|
+
deselectAll() {
|
|
572
|
+
this.selectedValues = [];
|
|
573
|
+
}
|
|
574
|
+
toggleSelected(e) {
|
|
575
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
576
|
+
}
|
|
577
|
+
#n(e) {
|
|
578
|
+
if (e !== this.#s) {
|
|
579
|
+
this.#s = e;
|
|
580
|
+
const s = this.options;
|
|
581
|
+
e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
|
|
582
|
+
const i = wt(this.focusedValue, this.filteredOptions);
|
|
583
|
+
this.#t = B(i, 0, this.filteredOptions);
|
|
584
|
+
const r = this.filteredOptions[this.#t];
|
|
585
|
+
r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
586
|
+
}
|
|
807
587
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
588
|
+
};
|
|
589
|
+
yt = class yt extends x {
|
|
590
|
+
options;
|
|
591
|
+
cursor = 0;
|
|
592
|
+
#t;
|
|
593
|
+
getGroupItems(e) {
|
|
594
|
+
return this.options.filter((s) => s.group === e);
|
|
595
|
+
}
|
|
596
|
+
isGroupSelected(e) {
|
|
597
|
+
const s = this.getGroupItems(e), i = this.value;
|
|
598
|
+
return i === undefined ? false : s.every((r) => i.includes(r.value));
|
|
599
|
+
}
|
|
600
|
+
toggleValue() {
|
|
601
|
+
const e = this.options[this.cursor];
|
|
602
|
+
if (this.value === undefined && (this.value = []), e.group === true) {
|
|
603
|
+
const s = e.value, i = this.getGroupItems(s);
|
|
604
|
+
this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
|
|
605
|
+
} else {
|
|
606
|
+
const s = this.value.includes(e.value);
|
|
607
|
+
this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
constructor(e) {
|
|
611
|
+
super(e, false);
|
|
612
|
+
const { options: s } = e;
|
|
613
|
+
this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
|
|
614
|
+
switch (i) {
|
|
615
|
+
case "left":
|
|
616
|
+
case "up": {
|
|
617
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
618
|
+
const r = this.options[this.cursor]?.group === true;
|
|
619
|
+
!this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
case "down":
|
|
623
|
+
case "right": {
|
|
624
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
625
|
+
const r = this.options[this.cursor]?.group === true;
|
|
626
|
+
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
case "space":
|
|
630
|
+
this.toggleValue();
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
});
|
|
816
634
|
}
|
|
817
|
-
}
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
// ../shared/src/adapters/stub.ts
|
|
821
|
-
function createStubAdapter(agent, searchPaths, matchExt) {
|
|
822
|
-
return {
|
|
823
|
-
agent,
|
|
824
|
-
writable: false,
|
|
825
|
-
getSearchPaths: () => searchPaths,
|
|
826
|
-
getWatchPaths: () => searchPaths,
|
|
827
|
-
matches: (fp) => fp.endsWith(matchExt),
|
|
828
|
-
parse: async () => [],
|
|
829
|
-
write: async () => false
|
|
830
635
|
};
|
|
831
|
-
|
|
636
|
+
Lt = class Lt extends x {
|
|
637
|
+
options;
|
|
638
|
+
cursor = 0;
|
|
639
|
+
get _value() {
|
|
640
|
+
return this.options[this.cursor].value;
|
|
641
|
+
}
|
|
642
|
+
get _enabledOptions() {
|
|
643
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
644
|
+
}
|
|
645
|
+
toggleAll() {
|
|
646
|
+
const e = this._enabledOptions, s = this.value !== undefined && this.value.length === e.length;
|
|
647
|
+
this.value = s ? [] : e.map((i) => i.value);
|
|
648
|
+
}
|
|
649
|
+
toggleInvert() {
|
|
650
|
+
const e = this.value;
|
|
651
|
+
if (!e)
|
|
652
|
+
return;
|
|
653
|
+
const s = this._enabledOptions.filter((i) => !e.includes(i.value));
|
|
654
|
+
this.value = s.map((i) => i.value);
|
|
655
|
+
}
|
|
656
|
+
toggleValue() {
|
|
657
|
+
this.value === undefined && (this.value = []);
|
|
658
|
+
const e = this.value.includes(this._value);
|
|
659
|
+
this.value = e ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
660
|
+
}
|
|
661
|
+
constructor(e) {
|
|
662
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
663
|
+
const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
|
|
664
|
+
this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => {
|
|
665
|
+
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
666
|
+
}), this.on("cursor", (i) => {
|
|
667
|
+
switch (i) {
|
|
668
|
+
case "left":
|
|
669
|
+
case "up":
|
|
670
|
+
this.cursor = B(this.cursor, -1, this.options);
|
|
671
|
+
break;
|
|
672
|
+
case "down":
|
|
673
|
+
case "right":
|
|
674
|
+
this.cursor = B(this.cursor, 1, this.options);
|
|
675
|
+
break;
|
|
676
|
+
case "space":
|
|
677
|
+
this.toggleValue();
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
});
|
|
832
684
|
|
|
833
|
-
//
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
antigravity: "antigravity",
|
|
838
|
-
augment: "augment",
|
|
839
|
-
"claude-code": "claude-code",
|
|
840
|
-
openclaw: "openclaw",
|
|
841
|
-
cline: "cline",
|
|
842
|
-
codebuddy: "codebuddy",
|
|
843
|
-
codex: "codex-cli",
|
|
844
|
-
"command-code": "command-code",
|
|
845
|
-
continue: "continue-ide",
|
|
846
|
-
crush: "crush",
|
|
847
|
-
cursor: "cursor",
|
|
848
|
-
droid: "droid",
|
|
849
|
-
"gemini-cli": "gemini-cli",
|
|
850
|
-
"github-copilot": "copilot-chat",
|
|
851
|
-
goose: "goose",
|
|
852
|
-
junie: "junie",
|
|
853
|
-
"iflow-cli": "iflow-cli",
|
|
854
|
-
kilo: "kilo-cli",
|
|
855
|
-
"kimi-cli": "kimi-cli",
|
|
856
|
-
"kiro-cli": "kiro-cli",
|
|
857
|
-
kode: "kode",
|
|
858
|
-
mcpjam: "mcpjam",
|
|
859
|
-
"mistral-vibe": "mistral-vibe",
|
|
860
|
-
mux: "mux",
|
|
861
|
-
opencode: "oh-my-opencode",
|
|
862
|
-
openhands: "openhands",
|
|
863
|
-
pi: "pi",
|
|
864
|
-
qoder: "qoder",
|
|
865
|
-
"qwen-code": "qwen-code",
|
|
866
|
-
replit: "replit",
|
|
867
|
-
roo: "roo",
|
|
868
|
-
trae: "trae",
|
|
869
|
-
"trae-cn": "trae-cn",
|
|
870
|
-
windsurf: "windsurf",
|
|
871
|
-
zencoder: "zencoder",
|
|
872
|
-
neovate: "neovate",
|
|
873
|
-
pochi: "pochi",
|
|
874
|
-
adal: "adal",
|
|
875
|
-
aider: "aider"
|
|
876
|
-
};
|
|
877
|
-
var CATALOG = [
|
|
878
|
-
{
|
|
879
|
-
id: "amp",
|
|
880
|
-
displayName: "Amp",
|
|
881
|
-
group: "universal",
|
|
882
|
-
implemented: false,
|
|
883
|
-
defaultEnabled: true,
|
|
884
|
-
createAdapter: () => createStubAdapter("amp", [join6(home, ".amp")], ".json")
|
|
885
|
-
},
|
|
886
|
-
{
|
|
887
|
-
id: "antigravity",
|
|
888
|
-
displayName: "Antigravity",
|
|
889
|
-
group: "other",
|
|
890
|
-
implemented: false,
|
|
891
|
-
defaultEnabled: false,
|
|
892
|
-
createAdapter: () => createStubAdapter("antigravity", [join6(home, ".gemini", "antigravity")], ".json")
|
|
893
|
-
},
|
|
894
|
-
{
|
|
895
|
-
id: "augment",
|
|
896
|
-
displayName: "Augment",
|
|
897
|
-
group: "other",
|
|
898
|
-
implemented: false,
|
|
899
|
-
defaultEnabled: false,
|
|
900
|
-
createAdapter: () => createStubAdapter("augment", [join6(home, ".augment")], ".json")
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
id: "claude-code",
|
|
904
|
-
displayName: "Claude Code",
|
|
905
|
-
group: "other",
|
|
906
|
-
implemented: true,
|
|
907
|
-
defaultEnabled: true,
|
|
908
|
-
createAdapter: () => claudeCodeAdapter
|
|
909
|
-
},
|
|
910
|
-
{
|
|
911
|
-
id: "openclaw",
|
|
912
|
-
displayName: "OpenClaw",
|
|
913
|
-
group: "other",
|
|
914
|
-
implemented: false,
|
|
915
|
-
defaultEnabled: false,
|
|
916
|
-
createAdapter: () => createStubAdapter("openclaw", [join6(home, ".openclaw")], ".md")
|
|
917
|
-
},
|
|
918
|
-
{
|
|
919
|
-
id: "cline",
|
|
920
|
-
displayName: "Cline",
|
|
921
|
-
group: "other",
|
|
922
|
-
implemented: false,
|
|
923
|
-
defaultEnabled: true,
|
|
924
|
-
createAdapter: () => createStubAdapter("cline", [
|
|
925
|
-
join6(home, "AppData", "Roaming", "Code", "User", "globalStorage", "saoudrizwan.claude-dev"),
|
|
926
|
-
join6(home, ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev")
|
|
927
|
-
], ".json")
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
id: "codebuddy",
|
|
931
|
-
displayName: "CodeBuddy",
|
|
932
|
-
group: "other",
|
|
933
|
-
implemented: false,
|
|
934
|
-
defaultEnabled: false,
|
|
935
|
-
createAdapter: () => createStubAdapter("codebuddy", [join6(home, ".codebuddy")], ".md")
|
|
936
|
-
},
|
|
937
|
-
{
|
|
938
|
-
id: "codex",
|
|
939
|
-
displayName: "Codex",
|
|
940
|
-
group: "universal",
|
|
941
|
-
implemented: true,
|
|
942
|
-
defaultEnabled: true,
|
|
943
|
-
createAdapter: () => codexCliAdapter
|
|
944
|
-
},
|
|
945
|
-
{
|
|
946
|
-
id: "command-code",
|
|
947
|
-
displayName: "Command Code",
|
|
948
|
-
group: "other",
|
|
949
|
-
implemented: false,
|
|
950
|
-
defaultEnabled: false,
|
|
951
|
-
createAdapter: () => createStubAdapter("command-code", [join6(home, ".commandcode")], ".md")
|
|
952
|
-
},
|
|
953
|
-
{
|
|
954
|
-
id: "continue",
|
|
955
|
-
displayName: "Continue",
|
|
956
|
-
group: "other",
|
|
957
|
-
implemented: true,
|
|
958
|
-
defaultEnabled: true,
|
|
959
|
-
createAdapter: () => continueIdeAdapter
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
id: "crush",
|
|
963
|
-
displayName: "Crush",
|
|
964
|
-
group: "other",
|
|
965
|
-
implemented: false,
|
|
966
|
-
defaultEnabled: false,
|
|
967
|
-
createAdapter: () => createStubAdapter("crush", [join6(home, ".config", "crush")], ".json")
|
|
968
|
-
},
|
|
969
|
-
{
|
|
970
|
-
id: "cursor",
|
|
971
|
-
displayName: "Cursor",
|
|
972
|
-
group: "other",
|
|
973
|
-
implemented: true,
|
|
974
|
-
defaultEnabled: true,
|
|
975
|
-
createAdapter: () => cursorAdapter
|
|
976
|
-
},
|
|
977
|
-
{
|
|
978
|
-
id: "droid",
|
|
979
|
-
displayName: "Droid",
|
|
980
|
-
group: "other",
|
|
981
|
-
implemented: false,
|
|
982
|
-
defaultEnabled: true,
|
|
983
|
-
createAdapter: () => createStubAdapter("droid", [join6(home, ".factory", "droids")], ".md")
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
id: "gemini-cli",
|
|
987
|
-
displayName: "Gemini CLI",
|
|
988
|
-
group: "universal",
|
|
989
|
-
implemented: false,
|
|
990
|
-
defaultEnabled: false,
|
|
991
|
-
createAdapter: () => createStubAdapter("gemini-cli", [join6(home, ".gemini")], ".md")
|
|
992
|
-
},
|
|
993
|
-
{
|
|
994
|
-
id: "github-copilot",
|
|
995
|
-
displayName: "GitHub Copilot",
|
|
996
|
-
group: "universal",
|
|
997
|
-
implemented: false,
|
|
998
|
-
defaultEnabled: true,
|
|
999
|
-
createAdapter: () => createStubAdapter("copilot-chat", [join6(home, ".vscode", "User", "workspaceStorage")], ".json")
|
|
1000
|
-
},
|
|
1001
|
-
{
|
|
1002
|
-
id: "goose",
|
|
1003
|
-
displayName: "Goose",
|
|
1004
|
-
group: "other",
|
|
1005
|
-
implemented: false,
|
|
1006
|
-
defaultEnabled: false,
|
|
1007
|
-
createAdapter: () => createStubAdapter("goose", [join6(home, ".config", "goose")], ".json")
|
|
1008
|
-
},
|
|
1009
|
-
{
|
|
1010
|
-
id: "junie",
|
|
1011
|
-
displayName: "Junie",
|
|
1012
|
-
group: "other",
|
|
1013
|
-
implemented: false,
|
|
1014
|
-
defaultEnabled: false,
|
|
1015
|
-
createAdapter: () => createStubAdapter("junie", [join6(home, ".junie")], ".json")
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
id: "iflow-cli",
|
|
1019
|
-
displayName: "iFlow CLI",
|
|
1020
|
-
group: "other",
|
|
1021
|
-
implemented: false,
|
|
1022
|
-
defaultEnabled: false,
|
|
1023
|
-
createAdapter: () => createStubAdapter("iflow-cli", [join6(home, ".iflow")], ".json")
|
|
1024
|
-
},
|
|
1025
|
-
{
|
|
1026
|
-
id: "kilo",
|
|
1027
|
-
displayName: "Kilo Code",
|
|
1028
|
-
group: "other",
|
|
1029
|
-
implemented: false,
|
|
1030
|
-
defaultEnabled: true,
|
|
1031
|
-
createAdapter: () => createStubAdapter("kilo-cli", [join6(home, ".kilo")], ".md")
|
|
1032
|
-
},
|
|
1033
|
-
{
|
|
1034
|
-
id: "kimi-cli",
|
|
1035
|
-
displayName: "Kimi Code CLI",
|
|
1036
|
-
group: "universal",
|
|
1037
|
-
implemented: false,
|
|
1038
|
-
defaultEnabled: false,
|
|
1039
|
-
createAdapter: () => createStubAdapter("kimi-cli", [join6(home, ".kimi")], ".md")
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
id: "kiro-cli",
|
|
1043
|
-
displayName: "Kiro CLI",
|
|
1044
|
-
group: "other",
|
|
1045
|
-
implemented: false,
|
|
1046
|
-
defaultEnabled: false,
|
|
1047
|
-
createAdapter: () => createStubAdapter("kiro-cli", [join6(home, ".kiro")], ".json")
|
|
1048
|
-
},
|
|
1049
|
-
{
|
|
1050
|
-
id: "kode",
|
|
1051
|
-
displayName: "Kode",
|
|
1052
|
-
group: "other",
|
|
1053
|
-
implemented: false,
|
|
1054
|
-
defaultEnabled: false,
|
|
1055
|
-
createAdapter: () => createStubAdapter("kode", [join6(home, ".kode")], ".json")
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
id: "mcpjam",
|
|
1059
|
-
displayName: "MCPJam",
|
|
1060
|
-
group: "other",
|
|
1061
|
-
implemented: false,
|
|
1062
|
-
defaultEnabled: false,
|
|
1063
|
-
createAdapter: () => createStubAdapter("mcpjam", [join6(home, ".mcpjam")], ".json")
|
|
1064
|
-
},
|
|
1065
|
-
{
|
|
1066
|
-
id: "mistral-vibe",
|
|
1067
|
-
displayName: "Mistral Vibe",
|
|
1068
|
-
group: "other",
|
|
1069
|
-
implemented: false,
|
|
1070
|
-
defaultEnabled: false,
|
|
1071
|
-
createAdapter: () => createStubAdapter("mistral-vibe", [join6(home, ".vibe")], ".json")
|
|
1072
|
-
},
|
|
1073
|
-
{
|
|
1074
|
-
id: "mux",
|
|
1075
|
-
displayName: "Mux",
|
|
1076
|
-
group: "other",
|
|
1077
|
-
implemented: false,
|
|
1078
|
-
defaultEnabled: false,
|
|
1079
|
-
createAdapter: () => createStubAdapter("mux", [join6(home, ".mux")], ".json")
|
|
1080
|
-
},
|
|
1081
|
-
{
|
|
1082
|
-
id: "opencode",
|
|
1083
|
-
displayName: "OpenCode",
|
|
1084
|
-
group: "universal",
|
|
1085
|
-
implemented: true,
|
|
1086
|
-
defaultEnabled: true,
|
|
1087
|
-
createAdapter: () => ohMyOpencodeAdapter
|
|
1088
|
-
},
|
|
1089
|
-
{
|
|
1090
|
-
id: "openhands",
|
|
1091
|
-
displayName: "OpenHands",
|
|
1092
|
-
group: "other",
|
|
1093
|
-
implemented: false,
|
|
1094
|
-
defaultEnabled: false,
|
|
1095
|
-
createAdapter: () => createStubAdapter("openhands", [join6(home, ".openhands")], ".json")
|
|
1096
|
-
},
|
|
1097
|
-
{
|
|
1098
|
-
id: "pi",
|
|
1099
|
-
displayName: "Pi",
|
|
1100
|
-
group: "other",
|
|
1101
|
-
implemented: false,
|
|
1102
|
-
defaultEnabled: false,
|
|
1103
|
-
createAdapter: () => createStubAdapter("pi", [join6(home, ".pi", "agent")], ".md")
|
|
1104
|
-
},
|
|
1105
|
-
{
|
|
1106
|
-
id: "qoder",
|
|
1107
|
-
displayName: "Qoder",
|
|
1108
|
-
group: "other",
|
|
1109
|
-
implemented: false,
|
|
1110
|
-
defaultEnabled: false,
|
|
1111
|
-
createAdapter: () => createStubAdapter("qoder", [join6(home, ".qoder")], ".json")
|
|
1112
|
-
},
|
|
1113
|
-
{
|
|
1114
|
-
id: "qwen-code",
|
|
1115
|
-
displayName: "Qwen Code",
|
|
1116
|
-
group: "other",
|
|
1117
|
-
implemented: false,
|
|
1118
|
-
defaultEnabled: false,
|
|
1119
|
-
createAdapter: () => createStubAdapter("qwen-code", [join6(home, ".qwen")], ".json")
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
id: "replit",
|
|
1123
|
-
displayName: "Replit",
|
|
1124
|
-
group: "other",
|
|
1125
|
-
implemented: false,
|
|
1126
|
-
defaultEnabled: false,
|
|
1127
|
-
createAdapter: () => createStubAdapter("replit", [join6(home, ".replit")], ".md")
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
id: "roo",
|
|
1131
|
-
displayName: "Roo Code",
|
|
1132
|
-
group: "other",
|
|
1133
|
-
implemented: false,
|
|
1134
|
-
defaultEnabled: false,
|
|
1135
|
-
createAdapter: () => createStubAdapter("roo", [join6(home, ".roo")], ".md")
|
|
1136
|
-
},
|
|
1137
|
-
{
|
|
1138
|
-
id: "trae",
|
|
1139
|
-
displayName: "Trae",
|
|
1140
|
-
group: "other",
|
|
1141
|
-
implemented: false,
|
|
1142
|
-
defaultEnabled: false,
|
|
1143
|
-
createAdapter: () => createStubAdapter("trae", [join6(home, ".trae")], ".md")
|
|
1144
|
-
},
|
|
1145
|
-
{
|
|
1146
|
-
id: "trae-cn",
|
|
1147
|
-
displayName: "Trae CN",
|
|
1148
|
-
group: "other",
|
|
1149
|
-
implemented: false,
|
|
1150
|
-
defaultEnabled: false,
|
|
1151
|
-
createAdapter: () => createStubAdapter("trae-cn", [join6(home, ".trae-cn")], ".md")
|
|
1152
|
-
},
|
|
1153
|
-
{
|
|
1154
|
-
id: "windsurf",
|
|
1155
|
-
displayName: "Windsurf",
|
|
1156
|
-
group: "other",
|
|
1157
|
-
implemented: false,
|
|
1158
|
-
defaultEnabled: true,
|
|
1159
|
-
createAdapter: () => createStubAdapter("windsurf", [join6(home, ".cascade_backups")], ".md")
|
|
1160
|
-
},
|
|
1161
|
-
{
|
|
1162
|
-
id: "zencoder",
|
|
1163
|
-
displayName: "Zencoder",
|
|
1164
|
-
group: "other",
|
|
1165
|
-
implemented: false,
|
|
1166
|
-
defaultEnabled: false,
|
|
1167
|
-
createAdapter: () => createStubAdapter("zencoder", [join6(home, ".zencoder")], ".json")
|
|
1168
|
-
},
|
|
1169
|
-
{
|
|
1170
|
-
id: "neovate",
|
|
1171
|
-
displayName: "Neovate",
|
|
1172
|
-
group: "other",
|
|
1173
|
-
implemented: false,
|
|
1174
|
-
defaultEnabled: false,
|
|
1175
|
-
createAdapter: () => createStubAdapter("neovate", [join6(home, ".neovate")], ".json")
|
|
1176
|
-
},
|
|
1177
|
-
{
|
|
1178
|
-
id: "pochi",
|
|
1179
|
-
displayName: "Pochi",
|
|
1180
|
-
group: "other",
|
|
1181
|
-
implemented: false,
|
|
1182
|
-
defaultEnabled: false,
|
|
1183
|
-
createAdapter: () => createStubAdapter("pochi", [join6(home, ".pochi")], ".json")
|
|
1184
|
-
},
|
|
1185
|
-
{
|
|
1186
|
-
id: "adal",
|
|
1187
|
-
displayName: "AdaL",
|
|
1188
|
-
group: "other",
|
|
1189
|
-
implemented: false,
|
|
1190
|
-
defaultEnabled: false,
|
|
1191
|
-
createAdapter: () => createStubAdapter("adal", [join6(home, ".adal")], ".json")
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
id: "aider",
|
|
1195
|
-
displayName: "Aider",
|
|
1196
|
-
group: "other",
|
|
1197
|
-
implemented: false,
|
|
1198
|
-
defaultEnabled: true,
|
|
1199
|
-
createAdapter: () => createStubAdapter("aider", [join6(home, ".aider")], ".aider.chat.history.md")
|
|
1200
|
-
}
|
|
1201
|
-
];
|
|
1202
|
-
function getAdapterCatalog() {
|
|
1203
|
-
return CATALOG.map((entry) => ({ ...entry }));
|
|
1204
|
-
}
|
|
1205
|
-
function getCatalogDefaultAdapterIds() {
|
|
1206
|
-
return CATALOG.filter((entry) => entry.defaultEnabled).map((entry) => entry.id);
|
|
1207
|
-
}
|
|
1208
|
-
function isAdapterId(value) {
|
|
1209
|
-
return CATALOG.some((entry) => entry.id === value);
|
|
1210
|
-
}
|
|
1211
|
-
var LEGACY_TO_ADAPTER_ID = new Map(Object.entries(ADAPTER_AGENT_ALIASES).map(([adapterId, agent]) => [
|
|
1212
|
-
agent,
|
|
1213
|
-
adapterId
|
|
1214
|
-
]));
|
|
1215
|
-
function resolveAdapterId(value) {
|
|
1216
|
-
if (isAdapterId(value))
|
|
1217
|
-
return value;
|
|
1218
|
-
return LEGACY_TO_ADAPTER_ID.get(value);
|
|
1219
|
-
}
|
|
1220
|
-
// ../shared/src/adapters/registry.ts
|
|
1221
|
-
var catalog = getAdapterCatalog();
|
|
1222
|
-
var catalogById = new Map(catalog.map((entry) => [entry.id, entry]));
|
|
1223
|
-
function getCatalog() {
|
|
1224
|
-
return catalog.map((entry) => ({ ...entry }));
|
|
1225
|
-
}
|
|
1226
|
-
function getDefaultAdapterIds() {
|
|
1227
|
-
return getCatalogDefaultAdapterIds();
|
|
1228
|
-
}
|
|
1229
|
-
function sanitizeEnabledAdapterIds(ids) {
|
|
1230
|
-
const selected = [];
|
|
1231
|
-
const seen = new Set;
|
|
1232
|
-
for (const id of ids) {
|
|
1233
|
-
const typedId = resolveAdapterId(id);
|
|
1234
|
-
if (!typedId || !catalogById.has(typedId))
|
|
1235
|
-
continue;
|
|
1236
|
-
if (seen.has(typedId))
|
|
1237
|
-
continue;
|
|
1238
|
-
seen.add(typedId);
|
|
1239
|
-
selected.push(typedId);
|
|
1240
|
-
}
|
|
1241
|
-
return selected;
|
|
1242
|
-
}
|
|
1243
|
-
function resolveAdapters(enabledIds) {
|
|
1244
|
-
const selectedIds = sanitizeEnabledAdapterIds(enabledIds);
|
|
1245
|
-
if (selectedIds.length === 0) {
|
|
1246
|
-
const defaults = getDefaultAdapterIds();
|
|
1247
|
-
return defaults.map((id) => {
|
|
1248
|
-
const entry = catalogById.get(id);
|
|
1249
|
-
if (!entry)
|
|
1250
|
-
throw new Error(`Adapter catalog missing entry for ${id}`);
|
|
1251
|
-
return entry.createAdapter();
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
return selectedIds.map((id) => {
|
|
1255
|
-
const entry = catalogById.get(id);
|
|
1256
|
-
if (!entry)
|
|
1257
|
-
throw new Error(`Adapter catalog missing entry for ${id}`);
|
|
1258
|
-
return entry.createAdapter();
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
function setActiveAdapters(adapters) {
|
|
1262
|
-
activeAdapters = [...adapters];
|
|
685
|
+
// ../../node_modules/.bun/@clack+prompts@1.0.1/node_modules/@clack/prompts/dist/index.mjs
|
|
686
|
+
import N2 from "node:process";
|
|
687
|
+
function me() {
|
|
688
|
+
return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1263
689
|
}
|
|
1264
|
-
function
|
|
1265
|
-
return
|
|
690
|
+
function J(t, r, s) {
|
|
691
|
+
return String(t).normalize().replaceAll(`\r
|
|
692
|
+
`, `
|
|
693
|
+
`).split(`
|
|
694
|
+
`).map((i) => Ie(i, r, s)).join(`
|
|
695
|
+
`);
|
|
1266
696
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
import { join as join7 } from "node:path";
|
|
1273
|
-
|
|
1274
|
-
// ../../node_modules/.bun/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
|
|
1275
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
1276
|
-
import { stdout as R, stdin as q } from "node:process";
|
|
1277
|
-
var import_sisteransi = __toESM(require_src(), 1);
|
|
1278
|
-
import ot from "node:readline";
|
|
1279
|
-
function B(t, e, s) {
|
|
1280
|
-
if (!s.some((u) => !u.disabled))
|
|
1281
|
-
return t;
|
|
1282
|
-
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
1283
|
-
return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
|
|
697
|
+
function Jt(t, r) {
|
|
698
|
+
if (!t)
|
|
699
|
+
return true;
|
|
700
|
+
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
|
|
701
|
+
return s.includes(o) || i.includes(o) || a.includes(o);
|
|
1284
702
|
}
|
|
1285
|
-
var
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
703
|
+
var import_picocolors2, import_sisteransi2, et2, C = (t, r) => et2 ? t : r, Rt, dt2, $t2, V, ht2, d, x2, Ot, Pt, Q2, H2, st2, U2, q2, Nt, rt2, mt2, Wt2, pt2, gt2, Lt2, ft2, Ft2, yt2, Et2, W2 = (t) => {
|
|
704
|
+
switch (t) {
|
|
705
|
+
case "initial":
|
|
706
|
+
case "active":
|
|
707
|
+
return import_picocolors2.default.cyan(Rt);
|
|
708
|
+
case "cancel":
|
|
709
|
+
return import_picocolors2.default.red(dt2);
|
|
710
|
+
case "error":
|
|
711
|
+
return import_picocolors2.default.yellow($t2);
|
|
712
|
+
case "submit":
|
|
713
|
+
return import_picocolors2.default.green(V);
|
|
714
|
+
}
|
|
715
|
+
}, vt2 = (t) => {
|
|
716
|
+
switch (t) {
|
|
717
|
+
case "initial":
|
|
718
|
+
case "active":
|
|
719
|
+
return import_picocolors2.default.cyan(d);
|
|
720
|
+
case "cancel":
|
|
721
|
+
return import_picocolors2.default.red(d);
|
|
722
|
+
case "error":
|
|
723
|
+
return import_picocolors2.default.yellow(d);
|
|
724
|
+
case "submit":
|
|
725
|
+
return import_picocolors2.default.green(d);
|
|
726
|
+
}
|
|
727
|
+
}, pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, At2, it2, nt2, wt2, at2, Fe, ye, jt = (t, r = {}, s = {}) => {
|
|
728
|
+
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
729
|
+
let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0;
|
|
1298
730
|
t:
|
|
1299
731
|
for (;; ) {
|
|
1300
|
-
if (
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
for (const
|
|
1304
|
-
const
|
|
1305
|
-
if (
|
|
1306
|
-
|
|
732
|
+
if (B2 > I2 || m >= h && m > $) {
|
|
733
|
+
const _2 = t.slice(I2, B2) || t.slice($, m);
|
|
734
|
+
y2 = 0;
|
|
735
|
+
for (const D2 of _2.replaceAll(Fe, "")) {
|
|
736
|
+
const T2 = D2.codePointAt(0) || 0;
|
|
737
|
+
if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) {
|
|
738
|
+
f = true;
|
|
1307
739
|
break t;
|
|
1308
740
|
}
|
|
1309
|
-
|
|
741
|
+
y2 += D2.length, A += w;
|
|
1310
742
|
}
|
|
1311
|
-
|
|
743
|
+
I2 = B2 = 0;
|
|
1312
744
|
}
|
|
1313
|
-
if (
|
|
745
|
+
if (m >= h)
|
|
1314
746
|
break;
|
|
1315
|
-
if (
|
|
1316
|
-
if (
|
|
1317
|
-
|
|
747
|
+
if (at2.lastIndex = m, at2.test(t)) {
|
|
748
|
+
if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
|
|
749
|
+
f = true;
|
|
1318
750
|
break;
|
|
1319
751
|
}
|
|
1320
|
-
|
|
752
|
+
A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
|
|
1321
753
|
continue;
|
|
1322
754
|
}
|
|
1323
|
-
if (
|
|
1324
|
-
if (
|
|
1325
|
-
|
|
755
|
+
if (At2.lastIndex = m, At2.test(t)) {
|
|
756
|
+
if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
|
|
757
|
+
f = true;
|
|
1326
758
|
break;
|
|
1327
759
|
}
|
|
1328
|
-
|
|
760
|
+
A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
|
|
1329
761
|
continue;
|
|
1330
762
|
}
|
|
1331
|
-
if (
|
|
1332
|
-
if (
|
|
1333
|
-
|
|
763
|
+
if (it2.lastIndex = m, it2.test(t)) {
|
|
764
|
+
if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) {
|
|
765
|
+
f = true;
|
|
1334
766
|
break;
|
|
1335
767
|
}
|
|
1336
|
-
|
|
768
|
+
A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
|
|
1337
769
|
continue;
|
|
1338
770
|
}
|
|
1339
|
-
if (
|
|
1340
|
-
if (
|
|
1341
|
-
|
|
771
|
+
if (nt2.lastIndex = m, nt2.test(t)) {
|
|
772
|
+
if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) {
|
|
773
|
+
f = true;
|
|
1342
774
|
break;
|
|
1343
775
|
}
|
|
1344
|
-
|
|
776
|
+
A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex;
|
|
1345
777
|
continue;
|
|
1346
778
|
}
|
|
1347
|
-
if (
|
|
1348
|
-
if (
|
|
1349
|
-
|
|
779
|
+
if (wt2.lastIndex = m, wt2.test(t)) {
|
|
780
|
+
if (A + g > S2 && (v = Math.min(v, m)), A + g > i) {
|
|
781
|
+
f = true;
|
|
1350
782
|
break;
|
|
1351
783
|
}
|
|
1352
|
-
|
|
784
|
+
A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex;
|
|
1353
785
|
continue;
|
|
1354
786
|
}
|
|
1355
|
-
|
|
787
|
+
m += 1;
|
|
1356
788
|
}
|
|
1357
|
-
return { width:
|
|
1358
|
-
}
|
|
1359
|
-
var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
1360
|
-
var S = (t, e = {}) => X(t, pt, e).width;
|
|
1361
|
-
var W = "\x1B";
|
|
1362
|
-
var Z = "";
|
|
1363
|
-
var Ft = 39;
|
|
1364
|
-
var j = "\x07";
|
|
1365
|
-
var Q = "[";
|
|
1366
|
-
var dt = "]";
|
|
1367
|
-
var tt = "m";
|
|
1368
|
-
var U = `${dt}8;;`;
|
|
1369
|
-
var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
|
|
1370
|
-
var mt = (t) => {
|
|
789
|
+
return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o };
|
|
790
|
+
}, Ee, M2 = (t, r = {}) => jt(t, Ee, r).width, ot2 = "\x1B", Gt = "", ve = 39, Ct2 = "\x07", kt2 = "[", Ae = "]", Vt2 = "m", St2, Ht, we = (t) => {
|
|
1371
791
|
if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
|
|
1372
792
|
return 39;
|
|
1373
793
|
if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
|
|
@@ -1386,667 +806,1369 @@ var mt = (t) => {
|
|
|
1386
806
|
return 29;
|
|
1387
807
|
if (t === 0)
|
|
1388
808
|
return 0;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
1396
|
-
for (;!l.done; ) {
|
|
1397
|
-
const m = l.value, A = S(m);
|
|
1398
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
809
|
+
}, Ut = (t) => `${ot2}${kt2}${t}${Vt2}`, Kt = (t) => `${ot2}${St2}${t}${Ct2}`, Ce = (t) => t.map((r) => M2(r)), It2 = (t, r, s) => {
|
|
810
|
+
const i = r[Symbol.iterator]();
|
|
811
|
+
let a = false, o = false, u = t.at(-1), l = u === undefined ? 0 : M2(u), n = i.next(), c = i.next(), g = 0;
|
|
812
|
+
for (;!n.done; ) {
|
|
813
|
+
const F = n.value, p = M2(F);
|
|
814
|
+
l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot2 || F === Gt) && (a = true, o = r.startsWith(St2, g + 1)), a ? o ? F === Ct2 && (a = false, o = false) : F === Vt2 && (a = false) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
|
|
1399
815
|
}
|
|
1400
|
-
u = t.at(-1), !
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
for (;s > 0 && !(S(e[s - 1]) > 0); )
|
|
816
|
+
u = t.at(-1), !l && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
817
|
+
}, Se = (t) => {
|
|
818
|
+
const r = t.split(" ");
|
|
819
|
+
let s = r.length;
|
|
820
|
+
for (;s > 0 && !(M2(r[s - 1]) > 0); )
|
|
1406
821
|
s--;
|
|
1407
|
-
return s ===
|
|
1408
|
-
}
|
|
1409
|
-
var Et = (t, e, s = {}) => {
|
|
822
|
+
return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
823
|
+
}, Ie = (t, r, s = {}) => {
|
|
1410
824
|
if (s.trim !== false && t.trim() === "")
|
|
1411
825
|
return "";
|
|
1412
|
-
let i = "",
|
|
1413
|
-
const u = t.split(" "),
|
|
1414
|
-
let
|
|
1415
|
-
for (const [
|
|
1416
|
-
s.trim !== false && (
|
|
1417
|
-
let
|
|
1418
|
-
if (
|
|
1419
|
-
const
|
|
1420
|
-
Math.floor((
|
|
826
|
+
let i = "", a, o;
|
|
827
|
+
const u = t.split(" "), l = Ce(u);
|
|
828
|
+
let n = [""];
|
|
829
|
+
for (const [$, m] of u.entries()) {
|
|
830
|
+
s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
831
|
+
let h = M2(n.at(-1) ?? "");
|
|
832
|
+
if ($ !== 0 && (h >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), h = 0), (h > 0 || s.trim === false) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
|
|
833
|
+
const y2 = r - h, f = 1 + Math.floor((l[$] - y2 - 1) / r);
|
|
834
|
+
Math.floor((l[$] - 1) / r) < f && n.push(""), It2(n, m, r);
|
|
1421
835
|
continue;
|
|
1422
836
|
}
|
|
1423
|
-
if (
|
|
1424
|
-
if (s.wordWrap === false &&
|
|
1425
|
-
|
|
837
|
+
if (h + l[$] > r && h > 0 && l[$] > 0) {
|
|
838
|
+
if (s.wordWrap === false && h < r) {
|
|
839
|
+
It2(n, m, r);
|
|
1426
840
|
continue;
|
|
1427
841
|
}
|
|
1428
|
-
|
|
1429
|
-
}
|
|
1430
|
-
if (
|
|
1431
|
-
|
|
1432
|
-
continue;
|
|
842
|
+
n.push("");
|
|
843
|
+
}
|
|
844
|
+
if (h + l[$] > r && s.wordWrap === false) {
|
|
845
|
+
It2(n, m, r);
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
n[n.length - 1] += m;
|
|
849
|
+
}
|
|
850
|
+
s.trim !== false && (n = n.map(($) => Se($)));
|
|
851
|
+
const c = n.join(`
|
|
852
|
+
`), g = c[Symbol.iterator]();
|
|
853
|
+
let F = g.next(), p = g.next(), E = 0;
|
|
854
|
+
for (;!F.done; ) {
|
|
855
|
+
const $ = F.value, m = p.value;
|
|
856
|
+
if (i += $, $ === ot2 || $ === Gt) {
|
|
857
|
+
Ht.lastIndex = E + 1;
|
|
858
|
+
const f = Ht.exec(c)?.groups;
|
|
859
|
+
if (f?.code !== undefined) {
|
|
860
|
+
const v = Number.parseFloat(f.code);
|
|
861
|
+
a = v === ve ? undefined : v;
|
|
862
|
+
} else
|
|
863
|
+
f?.uri !== undefined && (o = f.uri.length === 0 ? undefined : f.uri);
|
|
864
|
+
}
|
|
865
|
+
const h = a ? we(a) : undefined;
|
|
866
|
+
m === `
|
|
867
|
+
` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
|
|
868
|
+
` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
|
|
869
|
+
}
|
|
870
|
+
return i;
|
|
871
|
+
}, be = (t, r, s, i, a) => {
|
|
872
|
+
let o = r, u = 0;
|
|
873
|
+
for (let l = s;l < i; l++) {
|
|
874
|
+
const n = t[l];
|
|
875
|
+
if (o = o - n.length, u++, o <= a)
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
return { lineCount: o, removals: u };
|
|
879
|
+
}, X2 = (t) => {
|
|
880
|
+
const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt(a), g = import_picocolors2.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
|
|
881
|
+
let $ = 0;
|
|
882
|
+
r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
|
|
883
|
+
let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
|
|
884
|
+
const y2 = Math.min($ + E, s.length), f = [];
|
|
885
|
+
let v = 0;
|
|
886
|
+
m && v++, h && v++;
|
|
887
|
+
const S2 = $ + (m ? 1 : 0), I2 = y2 - (h ? 1 : 0);
|
|
888
|
+
for (let A = S2;A < I2; A++) {
|
|
889
|
+
const w = J(i(s[A], A === r), n, { hard: true, trim: false }).split(`
|
|
890
|
+
`);
|
|
891
|
+
f.push(w), v += w.length;
|
|
892
|
+
}
|
|
893
|
+
if (v > p) {
|
|
894
|
+
let A = 0, w = 0, _2 = v;
|
|
895
|
+
const D2 = r - S2, T2 = (Y, L2) => be(f, _2, Y, L2, p);
|
|
896
|
+
m ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length))) : ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (m = true, f.splice(0, A)), w > 0 && (h = true, f.splice(f.length - w, w));
|
|
897
|
+
}
|
|
898
|
+
const B2 = [];
|
|
899
|
+
m && B2.push(g);
|
|
900
|
+
for (const A of f)
|
|
901
|
+
for (const w of A)
|
|
902
|
+
B2.push(w);
|
|
903
|
+
return h && B2.push(g), B2;
|
|
904
|
+
}, xe = (t) => {
|
|
905
|
+
const r = (i, a, o, u) => {
|
|
906
|
+
const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== undefined && i.value === u ? import_picocolors2.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors2.default.green(U2) : import_picocolors2.default.dim(q2);
|
|
907
|
+
return i.disabled ? `${import_picocolors2.default.gray(q2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors2.default.dim(n)}`;
|
|
908
|
+
}, s = new Vt({ options: t.options, multiple: true, filter: t.filter ?? ((i, a) => Jt(i, a)), validate: () => {
|
|
909
|
+
if (t.required && s.selectedValues.length === 0)
|
|
910
|
+
return "Please select at least one item";
|
|
911
|
+
}, initialValue: t.initialValues, signal: t.signal, input: t.input, output: t.output, render() {
|
|
912
|
+
const i = `${import_picocolors2.default.gray(d)}
|
|
913
|
+
${W2(this.state)} ${t.message}
|
|
914
|
+
`, a = this.userInput, o = t.placeholder, u = a === "" && o !== undefined, l = this.isNavigating || u ? import_picocolors2.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors2.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
915
|
+
switch (this.state) {
|
|
916
|
+
case "submit":
|
|
917
|
+
return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.dim(`${this.selectedValues.length} items selected`)}`;
|
|
918
|
+
case "cancel":
|
|
919
|
+
return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a))}`;
|
|
920
|
+
default: {
|
|
921
|
+
const g = this.state === "error" ? import_picocolors2.default.yellow : import_picocolors2.default.cyan, F = [`${import_picocolors2.default.dim("↑/↓")} to navigate`, `${import_picocolors2.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`, `${import_picocolors2.default.dim("Enter:")} confirm`, `${import_picocolors2.default.dim("Type:")} to search`], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors2.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors2.default.yellow(this.error)}`] : [], $ = [...`${i}${g(d)}`.split(`
|
|
922
|
+
`), `${g(d)} ${import_picocolors2.default.dim("Search:")} ${l}${c}`, ...p, ...E], m = [`${g(d)} ${F.join(" • ")}`, `${g(x2)}`], h = X2({ cursor: this.cursor, options: this.filteredOptions, style: (y2, f) => r(y2, f, this.selectedValues, this.focusedValue), maxItems: t.maxItems, output: t.output, rowPadding: $.length + m.length });
|
|
923
|
+
return [...$, ...h.map((y2) => `${g(d)} ${y2}`), ...m].join(`
|
|
924
|
+
`);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
} });
|
|
928
|
+
return s.prompt();
|
|
929
|
+
}, Ne = (t = "", r) => {
|
|
930
|
+
(r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
|
|
931
|
+
|
|
932
|
+
`);
|
|
933
|
+
}, Z2 = (t, r) => t.split(`
|
|
934
|
+
`).map((s) => r(s)).join(`
|
|
935
|
+
`), je = (t) => {
|
|
936
|
+
const r = (i, a) => {
|
|
937
|
+
const o = i.label ?? String(i.value);
|
|
938
|
+
return a === "disabled" ? `${import_picocolors2.default.gray(q2)} ${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.gray(u)))}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors2.default.cyan(st2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors2.default.green(U2)} ${Z2(o, import_picocolors2.default.dim)}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors2.default.green(U2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z2(o, import_picocolors2.default.dim)}` : `${import_picocolors2.default.dim(q2)} ${Z2(o, import_picocolors2.default.dim)}`;
|
|
939
|
+
}, s = t.required ?? true;
|
|
940
|
+
return new Lt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: s, cursorAt: t.cursorAt, validate(i) {
|
|
941
|
+
if (s && (i === undefined || i.length === 0))
|
|
942
|
+
return `Please select at least one option.
|
|
943
|
+
${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
|
|
944
|
+
}, render() {
|
|
945
|
+
const i = xt(t.output, t.message, `${vt2(this.state)} `, `${W2(this.state)} `), a = `${import_picocolors2.default.gray(d)}
|
|
946
|
+
${i}
|
|
947
|
+
`, o = this.value ?? [], u = (l, n) => {
|
|
948
|
+
if (l.disabled)
|
|
949
|
+
return r(l, "disabled");
|
|
950
|
+
const c = o.includes(l.value);
|
|
951
|
+
return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
|
|
952
|
+
};
|
|
953
|
+
switch (this.state) {
|
|
954
|
+
case "submit": {
|
|
955
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none"), n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
|
|
956
|
+
return `${a}${n}`;
|
|
957
|
+
}
|
|
958
|
+
case "cancel": {
|
|
959
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
960
|
+
if (l.trim() === "")
|
|
961
|
+
return `${a}${import_picocolors2.default.gray(d)}`;
|
|
962
|
+
const n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
|
|
963
|
+
return `${a}${n}
|
|
964
|
+
${import_picocolors2.default.gray(d)}`;
|
|
965
|
+
}
|
|
966
|
+
case "error": {
|
|
967
|
+
const l = `${import_picocolors2.default.yellow(d)} `, n = this.error.split(`
|
|
968
|
+
`).map((F, p) => p === 0 ? `${import_picocolors2.default.yellow(x2)} ${import_picocolors2.default.yellow(F)}` : ` ${F}`).join(`
|
|
969
|
+
`), c = a.split(`
|
|
970
|
+
`).length, g = n.split(`
|
|
971
|
+
`).length + 1;
|
|
972
|
+
return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: u }).join(`
|
|
973
|
+
${l}`)}
|
|
974
|
+
${n}
|
|
975
|
+
`;
|
|
976
|
+
}
|
|
977
|
+
default: {
|
|
978
|
+
const l = `${import_picocolors2.default.cyan(d)} `, n = a.split(`
|
|
979
|
+
`).length;
|
|
980
|
+
return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
|
|
981
|
+
${l}`)}
|
|
982
|
+
${import_picocolors2.default.cyan(x2)}
|
|
983
|
+
`;
|
|
984
|
+
}
|
|
1433
985
|
}
|
|
1434
|
-
|
|
986
|
+
} }).prompt();
|
|
987
|
+
}, Ke, zt, Qt;
|
|
988
|
+
var init_dist2 = __esm(() => {
|
|
989
|
+
init_dist();
|
|
990
|
+
init_dist();
|
|
991
|
+
import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
992
|
+
import_sisteransi2 = __toESM(require_src(), 1);
|
|
993
|
+
et2 = me();
|
|
994
|
+
Rt = C("◆", "*");
|
|
995
|
+
dt2 = C("■", "x");
|
|
996
|
+
$t2 = C("▲", "x");
|
|
997
|
+
V = C("◇", "o");
|
|
998
|
+
ht2 = C("┌", "T");
|
|
999
|
+
d = C("│", "|");
|
|
1000
|
+
x2 = C("└", "—");
|
|
1001
|
+
Ot = C("┐", "T");
|
|
1002
|
+
Pt = C("┘", "—");
|
|
1003
|
+
Q2 = C("●", ">");
|
|
1004
|
+
H2 = C("○", " ");
|
|
1005
|
+
st2 = C("◻", "[•]");
|
|
1006
|
+
U2 = C("◼", "[+]");
|
|
1007
|
+
q2 = C("◻", "[ ]");
|
|
1008
|
+
Nt = C("▪", "•");
|
|
1009
|
+
rt2 = C("─", "-");
|
|
1010
|
+
mt2 = C("╮", "+");
|
|
1011
|
+
Wt2 = C("├", "+");
|
|
1012
|
+
pt2 = C("╯", "+");
|
|
1013
|
+
gt2 = C("╰", "+");
|
|
1014
|
+
Lt2 = C("╭", "+");
|
|
1015
|
+
ft2 = C("●", "•");
|
|
1016
|
+
Ft2 = C("◆", "*");
|
|
1017
|
+
yt2 = C("▲", "!");
|
|
1018
|
+
Et2 = C("■", "x");
|
|
1019
|
+
At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
1020
|
+
it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
1021
|
+
nt2 = /\t{1,1000}/y;
|
|
1022
|
+
wt2 = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
1023
|
+
at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
1024
|
+
Fe = /\p{M}+/gu;
|
|
1025
|
+
ye = { limit: 1 / 0, ellipsis: "" };
|
|
1026
|
+
Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
1027
|
+
St2 = `${Ae}8;;`;
|
|
1028
|
+
Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y");
|
|
1029
|
+
Ke = import_picocolors2.default.magenta;
|
|
1030
|
+
zt = { light: C("─", "-"), heavy: C("━", "="), block: C("█", "#") };
|
|
1031
|
+
Qt = `${import_picocolors2.default.gray(d)} `;
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1034
|
+
// src/cleanup.ts
|
|
1035
|
+
var exports_cleanup = {};
|
|
1036
|
+
__export(exports_cleanup, {
|
|
1037
|
+
promptForDaemonCleanup: () => promptForDaemonCleanup
|
|
1038
|
+
});
|
|
1039
|
+
async function promptForDaemonCleanup(devices) {
|
|
1040
|
+
const options = devices.map((d2) => ({
|
|
1041
|
+
value: d2.deviceId,
|
|
1042
|
+
label: d2.hostname,
|
|
1043
|
+
hint: `pid: ${d2.pid != null ? String(d2.pid) : "~"} · ${d2.status}`
|
|
1044
|
+
}));
|
|
1045
|
+
const selected = await je({
|
|
1046
|
+
message: "Select daemons to remove",
|
|
1047
|
+
options,
|
|
1048
|
+
required: true
|
|
1049
|
+
});
|
|
1050
|
+
if (Ct(selected)) {
|
|
1051
|
+
Ne("Cleanup cancelled.");
|
|
1052
|
+
return null;
|
|
1435
1053
|
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1054
|
+
return selected;
|
|
1055
|
+
}
|
|
1056
|
+
var init_cleanup = __esm(() => {
|
|
1057
|
+
init_dist2();
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
// src/cli.ts
|
|
1061
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
1062
|
+
import { writeSync } from "node:fs";
|
|
1063
|
+
import { resolve as resolve5 } from "node:path";
|
|
1064
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1065
|
+
|
|
1066
|
+
// ../shared/src/adapters/catalog.ts
|
|
1067
|
+
import { homedir as homedir6 } from "node:os";
|
|
1068
|
+
import { join as join6 } from "node:path";
|
|
1069
|
+
|
|
1070
|
+
// ../shared/src/adapters/claude-code.ts
|
|
1071
|
+
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
1072
|
+
import { homedir } from "node:os";
|
|
1073
|
+
import { basename, join, resolve, sep } from "node:path";
|
|
1074
|
+
|
|
1075
|
+
// ../shared/src/hash.ts
|
|
1076
|
+
import { createHash } from "node:crypto";
|
|
1077
|
+
function hashPath(filePath) {
|
|
1078
|
+
return createHash("sha256").update(filePath).digest("hex").slice(0, 16);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
// ../shared/src/adapters/claude-code.ts
|
|
1082
|
+
var plansDir = join(homedir(), ".claude", "plans");
|
|
1083
|
+
function extractTitle(content, filename) {
|
|
1084
|
+
const match = content.match(/^#\s+(.+)/m);
|
|
1085
|
+
if (match?.[1])
|
|
1086
|
+
return match[1].replace(/^Plan:\s*/i, "").trim();
|
|
1087
|
+
return basename(filename, ".md").split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
1088
|
+
}
|
|
1089
|
+
var claudeCodeAdapter = {
|
|
1090
|
+
agent: "claude-code",
|
|
1091
|
+
writable: true,
|
|
1092
|
+
getSearchPaths() {
|
|
1093
|
+
return [plansDir];
|
|
1094
|
+
},
|
|
1095
|
+
getWatchPaths() {
|
|
1096
|
+
return [plansDir];
|
|
1097
|
+
},
|
|
1098
|
+
matches(filePath) {
|
|
1099
|
+
if (!filePath.endsWith(".md"))
|
|
1100
|
+
return false;
|
|
1101
|
+
const normalized = resolve(filePath);
|
|
1102
|
+
const baseDir = resolve(plansDir);
|
|
1103
|
+
return normalized.startsWith(baseDir + sep);
|
|
1104
|
+
},
|
|
1105
|
+
async parse(filePath) {
|
|
1106
|
+
try {
|
|
1107
|
+
const content = await readFile(filePath, "utf-8");
|
|
1108
|
+
const stats = await stat(filePath);
|
|
1109
|
+
return [
|
|
1110
|
+
{
|
|
1111
|
+
id: hashPath(filePath),
|
|
1112
|
+
agent: "claude-code",
|
|
1113
|
+
title: extractTitle(content, filePath),
|
|
1114
|
+
content,
|
|
1115
|
+
filePath,
|
|
1116
|
+
format: "md",
|
|
1117
|
+
createdAt: stats.birthtime,
|
|
1118
|
+
updatedAt: stats.mtime,
|
|
1119
|
+
metadata: {}
|
|
1120
|
+
}
|
|
1121
|
+
];
|
|
1122
|
+
} catch {
|
|
1123
|
+
return [];
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
async write(plan, newContent) {
|
|
1127
|
+
try {
|
|
1128
|
+
await writeFile(plan.filePath, newContent, "utf-8");
|
|
1129
|
+
return true;
|
|
1130
|
+
} catch {
|
|
1131
|
+
return false;
|
|
1450
1132
|
}
|
|
1451
|
-
const p = r ? mt(r) : undefined;
|
|
1452
|
-
o === `
|
|
1453
|
-
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
1454
|
-
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
1455
1133
|
}
|
|
1456
|
-
return i;
|
|
1457
1134
|
};
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1135
|
+
|
|
1136
|
+
// ../shared/src/adapters/codex-cli.ts
|
|
1137
|
+
import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
|
|
1138
|
+
import { homedir as homedir2 } from "node:os";
|
|
1139
|
+
import { basename as basename2, join as join2 } from "node:path";
|
|
1140
|
+
var sessionsDir = join2(homedir2(), ".codex", "sessions");
|
|
1141
|
+
var PROPOSED_PLAN_BLOCK_REGEX = /<proposed_plan>\s*([\s\S]*?)\s*<\/proposed_plan>/gi;
|
|
1142
|
+
var PROPOSED_PLAN_TAG_REGEX = /<\s*\/?\s*proposed_plan\s*>/gi;
|
|
1143
|
+
var ESCAPED_PROPOSED_PLAN_TAG_REGEX = /<\s*\/?\s*proposed_plan\s*>/gi;
|
|
1144
|
+
function normalizeLineEndings(text) {
|
|
1145
|
+
return text.replace(/\r\n?/g, `
|
|
1463
1146
|
`);
|
|
1464
1147
|
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
function H(t, e) {
|
|
1468
|
-
if (typeof t == "string")
|
|
1469
|
-
return _.aliases.get(t) === e;
|
|
1470
|
-
for (const s of t)
|
|
1471
|
-
if (s !== undefined && H(s, e))
|
|
1472
|
-
return true;
|
|
1473
|
-
return false;
|
|
1148
|
+
function stripProposedPlanTags(text) {
|
|
1149
|
+
return text.replace(ESCAPED_PROPOSED_PLAN_TAG_REGEX, "").replace(PROPOSED_PLAN_TAG_REGEX, "");
|
|
1474
1150
|
}
|
|
1475
|
-
function
|
|
1476
|
-
|
|
1477
|
-
return;
|
|
1478
|
-
const s = t.split(`
|
|
1479
|
-
`), i = e.split(`
|
|
1480
|
-
`), r = Math.max(s.length, i.length), n = [];
|
|
1481
|
-
for (let u = 0;u < r; u++)
|
|
1482
|
-
s[u] !== i[u] && n.push(u);
|
|
1483
|
-
return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
|
|
1151
|
+
function normalizeMarkdown(text) {
|
|
1152
|
+
return stripProposedPlanTags(normalizeLineEndings(text)).trim();
|
|
1484
1153
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1154
|
+
function parseJsonLines(raw) {
|
|
1155
|
+
const parsed = [];
|
|
1156
|
+
for (const line of raw.split(`
|
|
1157
|
+
`)) {
|
|
1158
|
+
const trimmed = line.trim();
|
|
1159
|
+
if (!trimmed)
|
|
1160
|
+
continue;
|
|
1161
|
+
try {
|
|
1162
|
+
parsed.push(JSON.parse(trimmed));
|
|
1163
|
+
} catch {}
|
|
1164
|
+
}
|
|
1165
|
+
return parsed;
|
|
1489
1166
|
}
|
|
1490
|
-
function
|
|
1491
|
-
|
|
1492
|
-
s.isTTY && s.setRawMode(e);
|
|
1167
|
+
function isRecord(value) {
|
|
1168
|
+
return typeof value === "object" && value !== null;
|
|
1493
1169
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
error = "";
|
|
1509
|
-
value;
|
|
1510
|
-
userInput = "";
|
|
1511
|
-
constructor(e, s = true) {
|
|
1512
|
-
const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
|
|
1513
|
-
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
|
|
1514
|
-
}
|
|
1515
|
-
unsubscribe() {
|
|
1516
|
-
this._subscribers.clear();
|
|
1170
|
+
function extractTextFromContent(content) {
|
|
1171
|
+
if (typeof content === "string")
|
|
1172
|
+
return content;
|
|
1173
|
+
if (!Array.isArray(content))
|
|
1174
|
+
return "";
|
|
1175
|
+
const parts = [];
|
|
1176
|
+
for (const chunk of content) {
|
|
1177
|
+
if (!isRecord(chunk))
|
|
1178
|
+
continue;
|
|
1179
|
+
const type = typeof chunk.type === "string" ? chunk.type : "";
|
|
1180
|
+
if (type !== "text" && type !== "input_text" && type !== "output_text")
|
|
1181
|
+
continue;
|
|
1182
|
+
if (typeof chunk.text === "string")
|
|
1183
|
+
parts.push(chunk.text);
|
|
1517
1184
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1185
|
+
return parts.join(`
|
|
1186
|
+
`);
|
|
1187
|
+
}
|
|
1188
|
+
function extractSessionMeta(lines) {
|
|
1189
|
+
const meta = {};
|
|
1190
|
+
for (const line of lines) {
|
|
1191
|
+
if (!isRecord(line))
|
|
1192
|
+
continue;
|
|
1193
|
+
const legacyMeta = isRecord(line.session_meta) ? line.session_meta : undefined;
|
|
1194
|
+
if (legacyMeta?.session_id && !meta.sessionId)
|
|
1195
|
+
meta.sessionId = legacyMeta.session_id;
|
|
1196
|
+
if (legacyMeta?.started_at && !meta.startedAt)
|
|
1197
|
+
meta.startedAt = legacyMeta.started_at;
|
|
1198
|
+
if (line.type !== "session_meta" || !isRecord(line.payload))
|
|
1199
|
+
continue;
|
|
1200
|
+
if (typeof line.payload.id === "string" && !meta.sessionId) {
|
|
1201
|
+
meta.sessionId = line.payload.id;
|
|
1202
|
+
}
|
|
1203
|
+
if (typeof line.payload.session_id === "string" && !meta.sessionId) {
|
|
1204
|
+
meta.sessionId = line.payload.session_id;
|
|
1205
|
+
}
|
|
1206
|
+
if (typeof line.payload.timestamp === "string" && !meta.startedAt) {
|
|
1207
|
+
meta.startedAt = line.payload.timestamp;
|
|
1208
|
+
}
|
|
1209
|
+
if (typeof line.payload.started_at === "string" && !meta.startedAt) {
|
|
1210
|
+
meta.startedAt = line.payload.started_at;
|
|
1211
|
+
}
|
|
1212
|
+
if (typeof line.payload.cwd === "string" && !meta.cwd) {
|
|
1213
|
+
meta.cwd = line.payload.cwd;
|
|
1214
|
+
}
|
|
1521
1215
|
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1216
|
+
return meta;
|
|
1217
|
+
}
|
|
1218
|
+
function normalizeRole(candidate, fallback = "assistant") {
|
|
1219
|
+
if (typeof candidate !== "string")
|
|
1220
|
+
return fallback;
|
|
1221
|
+
return candidate;
|
|
1222
|
+
}
|
|
1223
|
+
function extractMessages(lines) {
|
|
1224
|
+
const messages = [];
|
|
1225
|
+
for (const line of lines) {
|
|
1226
|
+
if (!isRecord(line))
|
|
1227
|
+
continue;
|
|
1228
|
+
if (line.type === "response_item" && isRecord(line.payload) && line.payload.type === "message") {
|
|
1229
|
+
const text2 = extractTextFromContent(line.payload.content);
|
|
1230
|
+
if (!text2.trim())
|
|
1231
|
+
continue;
|
|
1232
|
+
messages.push({
|
|
1233
|
+
role: normalizeRole(line.payload.role),
|
|
1234
|
+
text: text2,
|
|
1235
|
+
phase: typeof line.payload.phase === "string" ? line.payload.phase : undefined
|
|
1236
|
+
});
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
const hasLegacyFields = line.content !== undefined || line.role !== undefined || line.session_meta !== undefined || line.type === "message";
|
|
1240
|
+
if (!hasLegacyFields || line.session_meta !== undefined)
|
|
1241
|
+
continue;
|
|
1242
|
+
const text = extractTextFromContent(line.content);
|
|
1243
|
+
if (!text.trim())
|
|
1244
|
+
continue;
|
|
1245
|
+
messages.push({
|
|
1246
|
+
role: normalizeRole(line.role, "user"),
|
|
1247
|
+
text
|
|
1248
|
+
});
|
|
1524
1249
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1250
|
+
return messages;
|
|
1251
|
+
}
|
|
1252
|
+
function extractProposedPlanBlocks(messages) {
|
|
1253
|
+
const blocks = [];
|
|
1254
|
+
for (const message of messages) {
|
|
1255
|
+
if (message.role !== "assistant")
|
|
1256
|
+
continue;
|
|
1257
|
+
const matches = message.text.matchAll(PROPOSED_PLAN_BLOCK_REGEX);
|
|
1258
|
+
for (const match of matches) {
|
|
1259
|
+
if (!match[1])
|
|
1260
|
+
continue;
|
|
1261
|
+
const block = normalizeMarkdown(match[1]);
|
|
1262
|
+
if (block)
|
|
1263
|
+
blocks.push(block);
|
|
1264
|
+
}
|
|
1527
1265
|
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1266
|
+
return blocks;
|
|
1267
|
+
}
|
|
1268
|
+
function selectPlanContent(messages) {
|
|
1269
|
+
const assistant = messages.filter((m) => m.role === "assistant" && m.text.trim().length > 0);
|
|
1270
|
+
const planBlocks = extractProposedPlanBlocks(assistant);
|
|
1271
|
+
if (planBlocks.length > 0) {
|
|
1272
|
+
return {
|
|
1273
|
+
content: normalizeMarkdown(planBlocks.join(`
|
|
1274
|
+
|
|
1275
|
+
---
|
|
1276
|
+
|
|
1277
|
+
`)),
|
|
1278
|
+
planBlocks
|
|
1279
|
+
};
|
|
1534
1280
|
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1281
|
+
const finalAnswerAssistant = assistant.filter((m) => m.phase === "final_answer");
|
|
1282
|
+
const selected = finalAnswerAssistant.length > 0 ? finalAnswerAssistant : assistant;
|
|
1283
|
+
return {
|
|
1284
|
+
content: normalizeMarkdown(selected.map((m) => m.text).join(`
|
|
1285
|
+
|
|
1286
|
+
---
|
|
1287
|
+
|
|
1288
|
+
`)),
|
|
1289
|
+
planBlocks: []
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
function cleanTitle(title) {
|
|
1293
|
+
return title.trim().replace(/^Plan:\s*/i, "").replace(/^#+\s*/, "").replace(/^\*\*|\*\*$/g, "").replace(/^`|`$/g, "").replace(/^[-*+]\s+/, "").trim();
|
|
1294
|
+
}
|
|
1295
|
+
function shorten(text, maxLen) {
|
|
1296
|
+
if (text.length <= maxLen)
|
|
1297
|
+
return text;
|
|
1298
|
+
return `${text.slice(0, maxLen - 1).trimEnd()}...`;
|
|
1299
|
+
}
|
|
1300
|
+
function titleFromPlanBlock(block) {
|
|
1301
|
+
const heading = block.match(/^\s{0,3}#{1,6}\s+(.+?)\s*$/m)?.[1];
|
|
1302
|
+
if (heading)
|
|
1303
|
+
return cleanTitle(heading);
|
|
1304
|
+
const lines = block.split(`
|
|
1305
|
+
`);
|
|
1306
|
+
for (let i = 0;i < lines.length; i++) {
|
|
1307
|
+
const line = lines[i]?.trim() ?? "";
|
|
1308
|
+
const titleMatch = line.match(/^\*\*title\*\*(?::\s*(.+))?\s*$/i);
|
|
1309
|
+
if (!titleMatch)
|
|
1310
|
+
continue;
|
|
1311
|
+
if (titleMatch[1]?.trim())
|
|
1312
|
+
return cleanTitle(titleMatch[1]);
|
|
1313
|
+
for (let j = i + 1;j < lines.length; j++) {
|
|
1314
|
+
const next = lines[j]?.trim() ?? "";
|
|
1315
|
+
if (!next)
|
|
1316
|
+
continue;
|
|
1317
|
+
return cleanTitle(next);
|
|
1318
|
+
}
|
|
1550
1319
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1320
|
+
for (const line of lines) {
|
|
1321
|
+
const trimmed = line.trim();
|
|
1322
|
+
if (!trimmed || /^---+$/.test(trimmed))
|
|
1323
|
+
continue;
|
|
1324
|
+
return cleanTitle(trimmed);
|
|
1553
1325
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
function isMeaningfulUserText(text) {
|
|
1329
|
+
const normalized = normalizeLineEndings(text).trim();
|
|
1330
|
+
if (!normalized)
|
|
1331
|
+
return false;
|
|
1332
|
+
const lower = normalized.toLowerCase();
|
|
1333
|
+
if (lower.startsWith("# agents.md instructions"))
|
|
1334
|
+
return false;
|
|
1335
|
+
if (lower.startsWith("<environment_context>"))
|
|
1336
|
+
return false;
|
|
1337
|
+
if (lower.startsWith("<system-reminder>"))
|
|
1338
|
+
return false;
|
|
1339
|
+
return true;
|
|
1340
|
+
}
|
|
1341
|
+
function extractTitle2(messages, planBlocks, filename) {
|
|
1342
|
+
if (planBlocks.length > 0 && planBlocks[0]) {
|
|
1343
|
+
const planTitle = titleFromPlanBlock(planBlocks[0]);
|
|
1344
|
+
if (planTitle)
|
|
1345
|
+
return shorten(planTitle, 120);
|
|
1556
1346
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1347
|
+
const firstUser = messages.find((m) => m.role === "user" && isMeaningfulUserText(m.text));
|
|
1348
|
+
if (firstUser) {
|
|
1349
|
+
const firstLine = normalizeLineEndings(firstUser.text).split(`
|
|
1350
|
+
`).map((line) => line.trim()).find(Boolean);
|
|
1351
|
+
if (firstLine)
|
|
1352
|
+
return shorten(cleanTitle(firstLine), 80);
|
|
1559
1353
|
}
|
|
1560
|
-
|
|
1561
|
-
|
|
1354
|
+
return basename2(filename, ".jsonl");
|
|
1355
|
+
}
|
|
1356
|
+
function parseDate(value) {
|
|
1357
|
+
if (!value)
|
|
1358
|
+
return;
|
|
1359
|
+
const date = new Date(value);
|
|
1360
|
+
if (Number.isNaN(date.getTime()))
|
|
1361
|
+
return;
|
|
1362
|
+
return date;
|
|
1363
|
+
}
|
|
1364
|
+
var codexCliAdapter = {
|
|
1365
|
+
agent: "codex-cli",
|
|
1366
|
+
writable: false,
|
|
1367
|
+
getSearchPaths() {
|
|
1368
|
+
return [sessionsDir];
|
|
1369
|
+
},
|
|
1370
|
+
getWatchPaths() {
|
|
1371
|
+
return [sessionsDir];
|
|
1372
|
+
},
|
|
1373
|
+
matches(filePath) {
|
|
1374
|
+
return filePath.endsWith(".jsonl") && basename2(filePath).startsWith("rollout-");
|
|
1375
|
+
},
|
|
1376
|
+
async parse(filePath) {
|
|
1377
|
+
try {
|
|
1378
|
+
const raw = await readFile2(filePath, "utf-8");
|
|
1379
|
+
const lines = parseJsonLines(raw);
|
|
1380
|
+
if (lines.length === 0)
|
|
1381
|
+
return [];
|
|
1382
|
+
const messages = extractMessages(lines);
|
|
1383
|
+
const { content, planBlocks } = selectPlanContent(messages);
|
|
1384
|
+
const stats = await stat2(filePath);
|
|
1385
|
+
const sessionMeta = extractSessionMeta(lines);
|
|
1386
|
+
const createdAt = parseDate(sessionMeta.startedAt) ?? stats.birthtime;
|
|
1387
|
+
const metadata = {};
|
|
1388
|
+
if (sessionMeta.sessionId)
|
|
1389
|
+
metadata.sessionId = sessionMeta.sessionId;
|
|
1390
|
+
if (planBlocks.length > 0)
|
|
1391
|
+
metadata.planBlocks = planBlocks.length;
|
|
1392
|
+
return [
|
|
1393
|
+
{
|
|
1394
|
+
id: hashPath(filePath),
|
|
1395
|
+
agent: "codex-cli",
|
|
1396
|
+
title: extractTitle2(messages, planBlocks, filePath),
|
|
1397
|
+
content,
|
|
1398
|
+
filePath,
|
|
1399
|
+
format: "jsonl",
|
|
1400
|
+
createdAt,
|
|
1401
|
+
updatedAt: stats.mtime,
|
|
1402
|
+
workspace: sessionMeta.cwd,
|
|
1403
|
+
metadata
|
|
1404
|
+
}
|
|
1405
|
+
];
|
|
1406
|
+
} catch {
|
|
1407
|
+
return [];
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
async write() {
|
|
1411
|
+
return false;
|
|
1562
1412
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
// ../shared/src/adapters/continue-ide.ts
|
|
1416
|
+
import { readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
1417
|
+
import { homedir as homedir3 } from "node:os";
|
|
1418
|
+
import { join as join3 } from "node:path";
|
|
1419
|
+
var continueDir = join3(homedir3(), ".continue", "sessions");
|
|
1420
|
+
var continueIdeAdapter = {
|
|
1421
|
+
agent: "continue-ide",
|
|
1422
|
+
writable: false,
|
|
1423
|
+
getSearchPaths() {
|
|
1424
|
+
return [continueDir];
|
|
1425
|
+
},
|
|
1426
|
+
getWatchPaths() {
|
|
1427
|
+
return [continueDir];
|
|
1428
|
+
},
|
|
1429
|
+
matches(filePath) {
|
|
1430
|
+
return filePath.endsWith(".json");
|
|
1431
|
+
},
|
|
1432
|
+
async parse(filePath) {
|
|
1433
|
+
try {
|
|
1434
|
+
const raw = await readFile3(filePath, "utf-8");
|
|
1435
|
+
const session = JSON.parse(raw);
|
|
1436
|
+
if (!session.history || session.history.length === 0)
|
|
1437
|
+
return [];
|
|
1438
|
+
const stats = await stat3(filePath);
|
|
1439
|
+
let title = "Continue Session";
|
|
1440
|
+
let workspace;
|
|
1441
|
+
const indexPath = join3(continueDir, "sessions.json");
|
|
1442
|
+
try {
|
|
1443
|
+
const indexRaw = await readFile3(indexPath, "utf-8");
|
|
1444
|
+
const sessions = JSON.parse(indexRaw);
|
|
1445
|
+
const sessionId = filePath.split("/").pop()?.replace(".json", "");
|
|
1446
|
+
const meta = sessions.find((s) => s.sessionId === sessionId);
|
|
1447
|
+
if (meta) {
|
|
1448
|
+
title = meta.title || title;
|
|
1449
|
+
workspace = meta.workspaceDirectory;
|
|
1450
|
+
}
|
|
1451
|
+
} catch {}
|
|
1452
|
+
const content = (session.history ?? []).map((m) => `**${m.role}**: ${m.content}`).join(`
|
|
1453
|
+
|
|
1454
|
+
---
|
|
1455
|
+
|
|
1456
|
+
`);
|
|
1457
|
+
return [
|
|
1458
|
+
{
|
|
1459
|
+
id: hashPath(filePath),
|
|
1460
|
+
agent: "continue-ide",
|
|
1461
|
+
title,
|
|
1462
|
+
content,
|
|
1463
|
+
filePath,
|
|
1464
|
+
format: "json",
|
|
1465
|
+
createdAt: stats.birthtime,
|
|
1466
|
+
updatedAt: stats.mtime,
|
|
1467
|
+
workspace,
|
|
1468
|
+
metadata: {}
|
|
1469
|
+
}
|
|
1470
|
+
];
|
|
1471
|
+
} catch {
|
|
1472
|
+
return [];
|
|
1570
1473
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
1575
|
-
`), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
1576
|
-
}
|
|
1577
|
-
restoreCursor() {
|
|
1578
|
-
const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
1579
|
-
`).length - 1;
|
|
1580
|
-
this.output.write(import_sisteransi.cursor.move(-999, e * -1));
|
|
1474
|
+
},
|
|
1475
|
+
async write() {
|
|
1476
|
+
return false;
|
|
1581
1477
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
// ../shared/src/adapters/cursor.ts
|
|
1481
|
+
import { existsSync } from "node:fs";
|
|
1482
|
+
import { stat as stat4 } from "node:fs/promises";
|
|
1483
|
+
import { homedir as homedir4 } from "node:os";
|
|
1484
|
+
import { join as join4 } from "node:path";
|
|
1485
|
+
function quoteIdentifier(name) {
|
|
1486
|
+
return `"${name.replaceAll('"', '""')}"`;
|
|
1487
|
+
}
|
|
1488
|
+
var cursorAdapter = {
|
|
1489
|
+
agent: "cursor",
|
|
1490
|
+
writable: false,
|
|
1491
|
+
getSearchPaths() {
|
|
1492
|
+
return [join4(homedir4(), ".cursor", "ai-tracking")];
|
|
1493
|
+
},
|
|
1494
|
+
getWatchPaths() {
|
|
1495
|
+
return [join4(homedir4(), ".cursor", "ai-tracking")];
|
|
1496
|
+
},
|
|
1497
|
+
matches(filePath) {
|
|
1498
|
+
return filePath.endsWith(".db");
|
|
1499
|
+
},
|
|
1500
|
+
async parse(filePath) {
|
|
1501
|
+
if (!existsSync(filePath))
|
|
1502
|
+
return [];
|
|
1503
|
+
let db = null;
|
|
1504
|
+
try {
|
|
1505
|
+
const { default: SqliteDatabase } = await import("better-sqlite3");
|
|
1506
|
+
db = new SqliteDatabase(filePath, { fileMustExist: true, readonly: true });
|
|
1507
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all();
|
|
1508
|
+
const plans = [];
|
|
1509
|
+
const stats = await stat4(filePath);
|
|
1510
|
+
for (const table of tables) {
|
|
1511
|
+
try {
|
|
1512
|
+
const rows = db.prepare(`SELECT * FROM ${quoteIdentifier(table.name)} LIMIT 50`).all();
|
|
1513
|
+
if (rows.length === 0)
|
|
1514
|
+
continue;
|
|
1515
|
+
const content = rows.map((row) => {
|
|
1516
|
+
return Object.entries(row).map(([k, v]) => `**${k}**: ${String(v)}`).join(`
|
|
1599
1517
|
`);
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
this.output.write(import_sisteransi.erase.down());
|
|
1518
|
+
}).join(`
|
|
1519
|
+
|
|
1520
|
+
---
|
|
1521
|
+
|
|
1522
|
+
`);
|
|
1523
|
+
plans.push({
|
|
1524
|
+
id: hashPath(`${filePath}:${table.name}`),
|
|
1525
|
+
agent: "cursor",
|
|
1526
|
+
title: `Cursor: ${table.name}`,
|
|
1527
|
+
content,
|
|
1528
|
+
filePath,
|
|
1529
|
+
format: "sqlite",
|
|
1530
|
+
createdAt: stats.birthtime,
|
|
1531
|
+
updatedAt: stats.mtime,
|
|
1532
|
+
metadata: { table: table.name }
|
|
1533
|
+
});
|
|
1534
|
+
} catch {}
|
|
1618
1535
|
}
|
|
1619
|
-
|
|
1536
|
+
return plans;
|
|
1537
|
+
} catch {
|
|
1538
|
+
return [];
|
|
1539
|
+
} finally {
|
|
1540
|
+
db?.close();
|
|
1620
1541
|
}
|
|
1542
|
+
},
|
|
1543
|
+
async write() {
|
|
1544
|
+
return false;
|
|
1621
1545
|
}
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
// ../shared/src/adapters/oh-my-opencode.ts
|
|
1549
|
+
import { existsSync as existsSync2, readdirSync, readFileSync } from "node:fs";
|
|
1550
|
+
import { readdir, readFile as readFile4, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
|
|
1551
|
+
import { homedir as homedir5 } from "node:os";
|
|
1552
|
+
import { basename as basename3, join as join5 } from "node:path";
|
|
1553
|
+
var dataHome = process.env.XDG_DATA_HOME || join5(homedir5(), ".local", "share");
|
|
1554
|
+
var opencodeSessionDir = join5(dataHome, "opencode", "storage", "session");
|
|
1555
|
+
var cwdPlansDir = join5(process.cwd(), ".sisyphus", "plans");
|
|
1556
|
+
var PLAN_PATH_MARKER = "/.sisyphus/plans/";
|
|
1557
|
+
function normalizePath(filePath) {
|
|
1558
|
+
return filePath.replace(/\\/g, "/");
|
|
1622
1559
|
}
|
|
1623
|
-
function
|
|
1624
|
-
|
|
1625
|
-
return 0;
|
|
1626
|
-
const s = e.findIndex((i) => i.value === t);
|
|
1627
|
-
return s !== -1 ? s : 0;
|
|
1560
|
+
function isRecord2(value) {
|
|
1561
|
+
return typeof value === "object" && value !== null;
|
|
1628
1562
|
}
|
|
1629
|
-
function
|
|
1630
|
-
|
|
1563
|
+
function isPlanMarkdown(filePath) {
|
|
1564
|
+
const normalized = normalizePath(filePath).toLowerCase();
|
|
1565
|
+
return normalized.endsWith(".md") && normalized.includes(PLAN_PATH_MARKER);
|
|
1631
1566
|
}
|
|
1632
|
-
function
|
|
1633
|
-
|
|
1634
|
-
|
|
1567
|
+
function isSessionFile(filePath) {
|
|
1568
|
+
const normalized = normalizePath(filePath);
|
|
1569
|
+
const root = normalizePath(opencodeSessionDir);
|
|
1570
|
+
return normalized.startsWith(`${root}/`) && normalized.endsWith(".json");
|
|
1635
1571
|
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
selectedValues = [];
|
|
1642
|
-
focusedValue;
|
|
1643
|
-
#t = 0;
|
|
1644
|
-
#s = "";
|
|
1645
|
-
#i;
|
|
1646
|
-
#e;
|
|
1647
|
-
get cursor() {
|
|
1648
|
-
return this.#t;
|
|
1649
|
-
}
|
|
1650
|
-
get userInputWithCursor() {
|
|
1651
|
-
if (!this.userInput)
|
|
1652
|
-
return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
|
|
1653
|
-
if (this._cursor >= this.userInput.length)
|
|
1654
|
-
return `${this.userInput}█`;
|
|
1655
|
-
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
1656
|
-
return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
|
|
1657
|
-
}
|
|
1658
|
-
get options() {
|
|
1659
|
-
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
1660
|
-
}
|
|
1661
|
-
constructor(e) {
|
|
1662
|
-
super(e), this.#e = e.options;
|
|
1663
|
-
const s = this.options;
|
|
1664
|
-
this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
|
|
1665
|
-
let i;
|
|
1666
|
-
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
|
|
1667
|
-
for (const r of i) {
|
|
1668
|
-
const n = s.findIndex((u) => u.value === r);
|
|
1669
|
-
n !== -1 && (this.toggleSelected(r), this.#t = n);
|
|
1670
|
-
}
|
|
1671
|
-
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
|
|
1672
|
-
}
|
|
1673
|
-
_isActionKey(e, s) {
|
|
1674
|
-
return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
|
|
1675
|
-
}
|
|
1676
|
-
#r(e, s) {
|
|
1677
|
-
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
1678
|
-
i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
1679
|
-
}
|
|
1680
|
-
deselectAll() {
|
|
1681
|
-
this.selectedValues = [];
|
|
1682
|
-
}
|
|
1683
|
-
toggleSelected(e) {
|
|
1684
|
-
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
1685
|
-
}
|
|
1686
|
-
#n(e) {
|
|
1687
|
-
if (e !== this.#s) {
|
|
1688
|
-
this.#s = e;
|
|
1689
|
-
const s = this.options;
|
|
1690
|
-
e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
|
|
1691
|
-
const i = wt(this.focusedValue, this.filteredOptions);
|
|
1692
|
-
this.#t = B(i, 0, this.filteredOptions);
|
|
1693
|
-
const r = this.filteredOptions[this.#t];
|
|
1694
|
-
r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
class yt extends x {
|
|
1699
|
-
options;
|
|
1700
|
-
cursor = 0;
|
|
1701
|
-
#t;
|
|
1702
|
-
getGroupItems(e) {
|
|
1703
|
-
return this.options.filter((s) => s.group === e);
|
|
1704
|
-
}
|
|
1705
|
-
isGroupSelected(e) {
|
|
1706
|
-
const s = this.getGroupItems(e), i = this.value;
|
|
1707
|
-
return i === undefined ? false : s.every((r) => i.includes(r.value));
|
|
1708
|
-
}
|
|
1709
|
-
toggleValue() {
|
|
1710
|
-
const e = this.options[this.cursor];
|
|
1711
|
-
if (this.value === undefined && (this.value = []), e.group === true) {
|
|
1712
|
-
const s = e.value, i = this.getGroupItems(s);
|
|
1713
|
-
this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
|
|
1714
|
-
} else {
|
|
1715
|
-
const s = this.value.includes(e.value);
|
|
1716
|
-
this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
constructor(e) {
|
|
1720
|
-
super(e, false);
|
|
1721
|
-
const { options: s } = e;
|
|
1722
|
-
this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
|
|
1723
|
-
switch (i) {
|
|
1724
|
-
case "left":
|
|
1725
|
-
case "up": {
|
|
1726
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1727
|
-
const r = this.options[this.cursor]?.group === true;
|
|
1728
|
-
!this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
1729
|
-
break;
|
|
1730
|
-
}
|
|
1731
|
-
case "down":
|
|
1732
|
-
case "right": {
|
|
1733
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1734
|
-
const r = this.options[this.cursor]?.group === true;
|
|
1735
|
-
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
1736
|
-
break;
|
|
1737
|
-
}
|
|
1738
|
-
case "space":
|
|
1739
|
-
this.toggleValue();
|
|
1740
|
-
break;
|
|
1741
|
-
}
|
|
1742
|
-
});
|
|
1743
|
-
}
|
|
1572
|
+
function extractTitle3(content, filePath) {
|
|
1573
|
+
const heading = content.match(/^\s{0,3}#{1,6}\s+(.+?)\s*$/m)?.[1];
|
|
1574
|
+
if (heading)
|
|
1575
|
+
return heading.replace(/^Plan:\s*/i, "").trim();
|
|
1576
|
+
return basename3(filePath, ".md").split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1744
1577
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
return
|
|
1578
|
+
function workspaceFromPlanPath(filePath) {
|
|
1579
|
+
const normalized = normalizePath(filePath);
|
|
1580
|
+
const lower = normalized.toLowerCase();
|
|
1581
|
+
const markerIndex = lower.lastIndexOf(PLAN_PATH_MARKER);
|
|
1582
|
+
if (markerIndex <= 0)
|
|
1583
|
+
return;
|
|
1584
|
+
return normalized.slice(0, markerIndex);
|
|
1752
1585
|
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
var H2 = C("○", " ");
|
|
1766
|
-
var st2 = C("◻", "[•]");
|
|
1767
|
-
var U2 = C("◼", "[+]");
|
|
1768
|
-
var q2 = C("◻", "[ ]");
|
|
1769
|
-
var Nt = C("▪", "•");
|
|
1770
|
-
var rt2 = C("─", "-");
|
|
1771
|
-
var mt2 = C("╮", "+");
|
|
1772
|
-
var Wt2 = C("├", "+");
|
|
1773
|
-
var pt2 = C("╯", "+");
|
|
1774
|
-
var gt2 = C("╰", "+");
|
|
1775
|
-
var Lt2 = C("╭", "+");
|
|
1776
|
-
var ft2 = C("●", "•");
|
|
1777
|
-
var Ft2 = C("◆", "*");
|
|
1778
|
-
var yt2 = C("▲", "!");
|
|
1779
|
-
var Et2 = C("■", "x");
|
|
1780
|
-
var W2 = (t) => {
|
|
1781
|
-
switch (t) {
|
|
1782
|
-
case "initial":
|
|
1783
|
-
case "active":
|
|
1784
|
-
return import_picocolors2.default.cyan(Rt);
|
|
1785
|
-
case "cancel":
|
|
1786
|
-
return import_picocolors2.default.red(dt2);
|
|
1787
|
-
case "error":
|
|
1788
|
-
return import_picocolors2.default.yellow($t2);
|
|
1789
|
-
case "submit":
|
|
1790
|
-
return import_picocolors2.default.green(V);
|
|
1586
|
+
function parseSessionMeta(raw) {
|
|
1587
|
+
try {
|
|
1588
|
+
const parsed = JSON.parse(raw);
|
|
1589
|
+
if (!isRecord2(parsed))
|
|
1590
|
+
return;
|
|
1591
|
+
return {
|
|
1592
|
+
id: typeof parsed.id === "string" ? parsed.id : undefined,
|
|
1593
|
+
parentID: typeof parsed.parentID === "string" ? parsed.parentID : undefined,
|
|
1594
|
+
directory: typeof parsed.directory === "string" ? parsed.directory : undefined
|
|
1595
|
+
};
|
|
1596
|
+
} catch {
|
|
1597
|
+
return;
|
|
1791
1598
|
}
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
var Fe = /\p{M}+/gu;
|
|
1802
|
-
var ye = { limit: 1 / 0, ellipsis: "" };
|
|
1803
|
-
var jt = (t, r = {}, s = {}) => {
|
|
1804
|
-
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
1805
|
-
let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0;
|
|
1806
|
-
t:
|
|
1807
|
-
for (;; ) {
|
|
1808
|
-
if (B2 > I2 || m >= h && m > $) {
|
|
1809
|
-
const _2 = t.slice(I2, B2) || t.slice($, m);
|
|
1810
|
-
y2 = 0;
|
|
1811
|
-
for (const D2 of _2.replaceAll(Fe, "")) {
|
|
1812
|
-
const T2 = D2.codePointAt(0) || 0;
|
|
1813
|
-
if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) {
|
|
1814
|
-
f = true;
|
|
1815
|
-
break t;
|
|
1816
|
-
}
|
|
1817
|
-
y2 += D2.length, A += w;
|
|
1818
|
-
}
|
|
1819
|
-
I2 = B2 = 0;
|
|
1820
|
-
}
|
|
1821
|
-
if (m >= h)
|
|
1822
|
-
break;
|
|
1823
|
-
if (at2.lastIndex = m, at2.test(t)) {
|
|
1824
|
-
if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
|
|
1825
|
-
f = true;
|
|
1826
|
-
break;
|
|
1827
|
-
}
|
|
1828
|
-
A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
|
|
1829
|
-
continue;
|
|
1830
|
-
}
|
|
1831
|
-
if (At2.lastIndex = m, At2.test(t)) {
|
|
1832
|
-
if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
|
|
1833
|
-
f = true;
|
|
1834
|
-
break;
|
|
1835
|
-
}
|
|
1836
|
-
A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
|
|
1599
|
+
}
|
|
1600
|
+
function discoverPlanDirectories() {
|
|
1601
|
+
const dirs = new Set([cwdPlansDir]);
|
|
1602
|
+
if (!existsSync2(opencodeSessionDir))
|
|
1603
|
+
return Array.from(dirs);
|
|
1604
|
+
try {
|
|
1605
|
+
const projectDirs = readdirSync(opencodeSessionDir, { withFileTypes: true });
|
|
1606
|
+
for (const projectDir of projectDirs) {
|
|
1607
|
+
if (!projectDir.isDirectory())
|
|
1837
1608
|
continue;
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
}
|
|
1844
|
-
A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
|
|
1609
|
+
const projectPath = join5(opencodeSessionDir, projectDir.name);
|
|
1610
|
+
let sessionFiles = [];
|
|
1611
|
+
try {
|
|
1612
|
+
sessionFiles = readdirSync(projectPath);
|
|
1613
|
+
} catch {
|
|
1845
1614
|
continue;
|
|
1846
1615
|
}
|
|
1847
|
-
|
|
1848
|
-
if (
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1616
|
+
for (const file of sessionFiles) {
|
|
1617
|
+
if (!file.endsWith(".json"))
|
|
1618
|
+
continue;
|
|
1619
|
+
try {
|
|
1620
|
+
const raw = readFileSync(join5(projectPath, file), "utf-8");
|
|
1621
|
+
const session = parseSessionMeta(raw);
|
|
1622
|
+
if (!session?.directory)
|
|
1623
|
+
continue;
|
|
1624
|
+
if (session.parentID)
|
|
1625
|
+
continue;
|
|
1626
|
+
dirs.add(join5(session.directory, ".sisyphus", "plans"));
|
|
1627
|
+
} catch {}
|
|
1854
1628
|
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1629
|
+
}
|
|
1630
|
+
} catch {}
|
|
1631
|
+
return Array.from(dirs);
|
|
1632
|
+
}
|
|
1633
|
+
async function parsePlanFile(filePath, workspace, metadata = {}) {
|
|
1634
|
+
try {
|
|
1635
|
+
const content = await readFile4(filePath, "utf-8");
|
|
1636
|
+
const stats = await stat5(filePath);
|
|
1637
|
+
return [
|
|
1638
|
+
{
|
|
1639
|
+
id: hashPath(filePath),
|
|
1640
|
+
agent: "oh-my-opencode",
|
|
1641
|
+
title: extractTitle3(content, filePath),
|
|
1642
|
+
content,
|
|
1643
|
+
filePath,
|
|
1644
|
+
format: "md",
|
|
1645
|
+
createdAt: stats.birthtime,
|
|
1646
|
+
updatedAt: stats.mtime,
|
|
1647
|
+
workspace,
|
|
1648
|
+
metadata
|
|
1862
1649
|
}
|
|
1863
|
-
|
|
1650
|
+
];
|
|
1651
|
+
} catch {
|
|
1652
|
+
return [];
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
async function parseSessionFile(filePath) {
|
|
1656
|
+
try {
|
|
1657
|
+
const raw = await readFile4(filePath, "utf-8");
|
|
1658
|
+
const session = parseSessionMeta(raw);
|
|
1659
|
+
if (!session?.directory)
|
|
1660
|
+
return [];
|
|
1661
|
+
if (session.parentID)
|
|
1662
|
+
return [];
|
|
1663
|
+
const plansDir2 = join5(session.directory, ".sisyphus", "plans");
|
|
1664
|
+
if (!existsSync2(plansDir2))
|
|
1665
|
+
return [];
|
|
1666
|
+
const entries = await readdir(plansDir2, { withFileTypes: true });
|
|
1667
|
+
const plans = [];
|
|
1668
|
+
for (const entry of entries) {
|
|
1669
|
+
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
1670
|
+
continue;
|
|
1671
|
+
const planPath = join5(plansDir2, entry.name);
|
|
1672
|
+
const parsed = await parsePlanFile(planPath, session.directory, {
|
|
1673
|
+
source: "session-index",
|
|
1674
|
+
sessionId: session.id
|
|
1675
|
+
});
|
|
1676
|
+
plans.push(...parsed);
|
|
1864
1677
|
}
|
|
1865
|
-
|
|
1678
|
+
return plans;
|
|
1679
|
+
} catch {
|
|
1680
|
+
return [];
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
var ohMyOpencodeAdapter = {
|
|
1684
|
+
agent: "oh-my-opencode",
|
|
1685
|
+
writable: true,
|
|
1686
|
+
getSearchPaths() {
|
|
1687
|
+
return [opencodeSessionDir, ...discoverPlanDirectories()];
|
|
1688
|
+
},
|
|
1689
|
+
getWatchPaths() {
|
|
1690
|
+
return [opencodeSessionDir, ...discoverPlanDirectories()];
|
|
1691
|
+
},
|
|
1692
|
+
matches(filePath) {
|
|
1693
|
+
return isPlanMarkdown(filePath) || isSessionFile(filePath);
|
|
1694
|
+
},
|
|
1695
|
+
async parse(filePath) {
|
|
1696
|
+
if (isPlanMarkdown(filePath)) {
|
|
1697
|
+
return parsePlanFile(filePath, workspaceFromPlanPath(filePath), {
|
|
1698
|
+
source: "plan-file"
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
if (isSessionFile(filePath)) {
|
|
1702
|
+
return parseSessionFile(filePath);
|
|
1703
|
+
}
|
|
1704
|
+
return [];
|
|
1705
|
+
},
|
|
1706
|
+
async write(plan, newContent) {
|
|
1707
|
+
try {
|
|
1708
|
+
await writeFile2(plan.filePath, newContent, "utf-8");
|
|
1709
|
+
return true;
|
|
1710
|
+
} catch {
|
|
1711
|
+
return false;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1866
1714
|
};
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1715
|
+
|
|
1716
|
+
// ../shared/src/adapters/stub.ts
|
|
1717
|
+
function createStubAdapter(agent, searchPaths, matchExt) {
|
|
1718
|
+
return {
|
|
1719
|
+
agent,
|
|
1720
|
+
writable: false,
|
|
1721
|
+
getSearchPaths: () => searchPaths,
|
|
1722
|
+
getWatchPaths: () => searchPaths,
|
|
1723
|
+
matches: (fp) => fp.endsWith(matchExt),
|
|
1724
|
+
parse: async () => [],
|
|
1725
|
+
write: async () => false
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
// ../shared/src/adapters/catalog.ts
|
|
1730
|
+
var home = homedir6();
|
|
1731
|
+
var ADAPTER_AGENT_ALIASES = {
|
|
1732
|
+
amp: "amp",
|
|
1733
|
+
antigravity: "antigravity",
|
|
1734
|
+
augment: "augment",
|
|
1735
|
+
"claude-code": "claude-code",
|
|
1736
|
+
openclaw: "openclaw",
|
|
1737
|
+
cline: "cline",
|
|
1738
|
+
codebuddy: "codebuddy",
|
|
1739
|
+
codex: "codex-cli",
|
|
1740
|
+
"command-code": "command-code",
|
|
1741
|
+
continue: "continue-ide",
|
|
1742
|
+
crush: "crush",
|
|
1743
|
+
cursor: "cursor",
|
|
1744
|
+
droid: "droid",
|
|
1745
|
+
"gemini-cli": "gemini-cli",
|
|
1746
|
+
"github-copilot": "copilot-chat",
|
|
1747
|
+
goose: "goose",
|
|
1748
|
+
junie: "junie",
|
|
1749
|
+
"iflow-cli": "iflow-cli",
|
|
1750
|
+
kilo: "kilo-cli",
|
|
1751
|
+
"kimi-cli": "kimi-cli",
|
|
1752
|
+
"kiro-cli": "kiro-cli",
|
|
1753
|
+
kode: "kode",
|
|
1754
|
+
mcpjam: "mcpjam",
|
|
1755
|
+
"mistral-vibe": "mistral-vibe",
|
|
1756
|
+
mux: "mux",
|
|
1757
|
+
opencode: "oh-my-opencode",
|
|
1758
|
+
openhands: "openhands",
|
|
1759
|
+
pi: "pi",
|
|
1760
|
+
qoder: "qoder",
|
|
1761
|
+
"qwen-code": "qwen-code",
|
|
1762
|
+
replit: "replit",
|
|
1763
|
+
roo: "roo",
|
|
1764
|
+
trae: "trae",
|
|
1765
|
+
"trae-cn": "trae-cn",
|
|
1766
|
+
windsurf: "windsurf",
|
|
1767
|
+
zencoder: "zencoder",
|
|
1768
|
+
neovate: "neovate",
|
|
1769
|
+
pochi: "pochi",
|
|
1770
|
+
adal: "adal",
|
|
1771
|
+
aider: "aider"
|
|
1897
1772
|
};
|
|
1898
|
-
var
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1773
|
+
var CATALOG = [
|
|
1774
|
+
{
|
|
1775
|
+
id: "amp",
|
|
1776
|
+
displayName: "Amp",
|
|
1777
|
+
group: "universal",
|
|
1778
|
+
implemented: false,
|
|
1779
|
+
defaultEnabled: true,
|
|
1780
|
+
createAdapter: () => createStubAdapter("amp", [join6(home, ".amp")], ".json")
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
id: "antigravity",
|
|
1784
|
+
displayName: "Antigravity",
|
|
1785
|
+
group: "other",
|
|
1786
|
+
implemented: false,
|
|
1787
|
+
defaultEnabled: false,
|
|
1788
|
+
createAdapter: () => createStubAdapter("antigravity", [join6(home, ".gemini", "antigravity")], ".json")
|
|
1789
|
+
},
|
|
1790
|
+
{
|
|
1791
|
+
id: "augment",
|
|
1792
|
+
displayName: "Augment",
|
|
1793
|
+
group: "other",
|
|
1794
|
+
implemented: false,
|
|
1795
|
+
defaultEnabled: false,
|
|
1796
|
+
createAdapter: () => createStubAdapter("augment", [join6(home, ".augment")], ".json")
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
id: "claude-code",
|
|
1800
|
+
displayName: "Claude Code",
|
|
1801
|
+
group: "other",
|
|
1802
|
+
implemented: true,
|
|
1803
|
+
defaultEnabled: true,
|
|
1804
|
+
createAdapter: () => claudeCodeAdapter
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
id: "openclaw",
|
|
1808
|
+
displayName: "OpenClaw",
|
|
1809
|
+
group: "other",
|
|
1810
|
+
implemented: false,
|
|
1811
|
+
defaultEnabled: false,
|
|
1812
|
+
createAdapter: () => createStubAdapter("openclaw", [join6(home, ".openclaw")], ".md")
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
id: "cline",
|
|
1816
|
+
displayName: "Cline",
|
|
1817
|
+
group: "other",
|
|
1818
|
+
implemented: false,
|
|
1819
|
+
defaultEnabled: true,
|
|
1820
|
+
createAdapter: () => createStubAdapter("cline", [
|
|
1821
|
+
join6(home, "AppData", "Roaming", "Code", "User", "globalStorage", "saoudrizwan.claude-dev"),
|
|
1822
|
+
join6(home, ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev")
|
|
1823
|
+
], ".json")
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
id: "codebuddy",
|
|
1827
|
+
displayName: "CodeBuddy",
|
|
1828
|
+
group: "other",
|
|
1829
|
+
implemented: false,
|
|
1830
|
+
defaultEnabled: false,
|
|
1831
|
+
createAdapter: () => createStubAdapter("codebuddy", [join6(home, ".codebuddy")], ".md")
|
|
1832
|
+
},
|
|
1833
|
+
{
|
|
1834
|
+
id: "codex",
|
|
1835
|
+
displayName: "Codex",
|
|
1836
|
+
group: "universal",
|
|
1837
|
+
implemented: true,
|
|
1838
|
+
defaultEnabled: true,
|
|
1839
|
+
createAdapter: () => codexCliAdapter
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
id: "command-code",
|
|
1843
|
+
displayName: "Command Code",
|
|
1844
|
+
group: "other",
|
|
1845
|
+
implemented: false,
|
|
1846
|
+
defaultEnabled: false,
|
|
1847
|
+
createAdapter: () => createStubAdapter("command-code", [join6(home, ".commandcode")], ".md")
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
id: "continue",
|
|
1851
|
+
displayName: "Continue",
|
|
1852
|
+
group: "other",
|
|
1853
|
+
implemented: true,
|
|
1854
|
+
defaultEnabled: true,
|
|
1855
|
+
createAdapter: () => continueIdeAdapter
|
|
1856
|
+
},
|
|
1857
|
+
{
|
|
1858
|
+
id: "crush",
|
|
1859
|
+
displayName: "Crush",
|
|
1860
|
+
group: "other",
|
|
1861
|
+
implemented: false,
|
|
1862
|
+
defaultEnabled: false,
|
|
1863
|
+
createAdapter: () => createStubAdapter("crush", [join6(home, ".config", "crush")], ".json")
|
|
1864
|
+
},
|
|
1865
|
+
{
|
|
1866
|
+
id: "cursor",
|
|
1867
|
+
displayName: "Cursor",
|
|
1868
|
+
group: "other",
|
|
1869
|
+
implemented: true,
|
|
1870
|
+
defaultEnabled: true,
|
|
1871
|
+
createAdapter: () => cursorAdapter
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
id: "droid",
|
|
1875
|
+
displayName: "Droid",
|
|
1876
|
+
group: "other",
|
|
1877
|
+
implemented: false,
|
|
1878
|
+
defaultEnabled: true,
|
|
1879
|
+
createAdapter: () => createStubAdapter("droid", [join6(home, ".factory", "droids")], ".md")
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
id: "gemini-cli",
|
|
1883
|
+
displayName: "Gemini CLI",
|
|
1884
|
+
group: "universal",
|
|
1885
|
+
implemented: false,
|
|
1886
|
+
defaultEnabled: false,
|
|
1887
|
+
createAdapter: () => createStubAdapter("gemini-cli", [join6(home, ".gemini")], ".md")
|
|
1888
|
+
},
|
|
1889
|
+
{
|
|
1890
|
+
id: "github-copilot",
|
|
1891
|
+
displayName: "GitHub Copilot",
|
|
1892
|
+
group: "universal",
|
|
1893
|
+
implemented: false,
|
|
1894
|
+
defaultEnabled: true,
|
|
1895
|
+
createAdapter: () => createStubAdapter("copilot-chat", [join6(home, ".vscode", "User", "workspaceStorage")], ".json")
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
id: "goose",
|
|
1899
|
+
displayName: "Goose",
|
|
1900
|
+
group: "other",
|
|
1901
|
+
implemented: false,
|
|
1902
|
+
defaultEnabled: false,
|
|
1903
|
+
createAdapter: () => createStubAdapter("goose", [join6(home, ".config", "goose")], ".json")
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
id: "junie",
|
|
1907
|
+
displayName: "Junie",
|
|
1908
|
+
group: "other",
|
|
1909
|
+
implemented: false,
|
|
1910
|
+
defaultEnabled: false,
|
|
1911
|
+
createAdapter: () => createStubAdapter("junie", [join6(home, ".junie")], ".json")
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
id: "iflow-cli",
|
|
1915
|
+
displayName: "iFlow CLI",
|
|
1916
|
+
group: "other",
|
|
1917
|
+
implemented: false,
|
|
1918
|
+
defaultEnabled: false,
|
|
1919
|
+
createAdapter: () => createStubAdapter("iflow-cli", [join6(home, ".iflow")], ".json")
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
id: "kilo",
|
|
1923
|
+
displayName: "Kilo Code",
|
|
1924
|
+
group: "other",
|
|
1925
|
+
implemented: false,
|
|
1926
|
+
defaultEnabled: true,
|
|
1927
|
+
createAdapter: () => createStubAdapter("kilo-cli", [join6(home, ".kilo")], ".md")
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
id: "kimi-cli",
|
|
1931
|
+
displayName: "Kimi Code CLI",
|
|
1932
|
+
group: "universal",
|
|
1933
|
+
implemented: false,
|
|
1934
|
+
defaultEnabled: false,
|
|
1935
|
+
createAdapter: () => createStubAdapter("kimi-cli", [join6(home, ".kimi")], ".md")
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
id: "kiro-cli",
|
|
1939
|
+
displayName: "Kiro CLI",
|
|
1940
|
+
group: "other",
|
|
1941
|
+
implemented: false,
|
|
1942
|
+
defaultEnabled: false,
|
|
1943
|
+
createAdapter: () => createStubAdapter("kiro-cli", [join6(home, ".kiro")], ".json")
|
|
1944
|
+
},
|
|
1945
|
+
{
|
|
1946
|
+
id: "kode",
|
|
1947
|
+
displayName: "Kode",
|
|
1948
|
+
group: "other",
|
|
1949
|
+
implemented: false,
|
|
1950
|
+
defaultEnabled: false,
|
|
1951
|
+
createAdapter: () => createStubAdapter("kode", [join6(home, ".kode")], ".json")
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
id: "mcpjam",
|
|
1955
|
+
displayName: "MCPJam",
|
|
1956
|
+
group: "other",
|
|
1957
|
+
implemented: false,
|
|
1958
|
+
defaultEnabled: false,
|
|
1959
|
+
createAdapter: () => createStubAdapter("mcpjam", [join6(home, ".mcpjam")], ".json")
|
|
1960
|
+
},
|
|
1961
|
+
{
|
|
1962
|
+
id: "mistral-vibe",
|
|
1963
|
+
displayName: "Mistral Vibe",
|
|
1964
|
+
group: "other",
|
|
1965
|
+
implemented: false,
|
|
1966
|
+
defaultEnabled: false,
|
|
1967
|
+
createAdapter: () => createStubAdapter("mistral-vibe", [join6(home, ".vibe")], ".json")
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
id: "mux",
|
|
1971
|
+
displayName: "Mux",
|
|
1972
|
+
group: "other",
|
|
1973
|
+
implemented: false,
|
|
1974
|
+
defaultEnabled: false,
|
|
1975
|
+
createAdapter: () => createStubAdapter("mux", [join6(home, ".mux")], ".json")
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
id: "opencode",
|
|
1979
|
+
displayName: "OpenCode",
|
|
1980
|
+
group: "universal",
|
|
1981
|
+
implemented: true,
|
|
1982
|
+
defaultEnabled: true,
|
|
1983
|
+
createAdapter: () => ohMyOpencodeAdapter
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
id: "openhands",
|
|
1987
|
+
displayName: "OpenHands",
|
|
1988
|
+
group: "other",
|
|
1989
|
+
implemented: false,
|
|
1990
|
+
defaultEnabled: false,
|
|
1991
|
+
createAdapter: () => createStubAdapter("openhands", [join6(home, ".openhands")], ".json")
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
id: "pi",
|
|
1995
|
+
displayName: "Pi",
|
|
1996
|
+
group: "other",
|
|
1997
|
+
implemented: false,
|
|
1998
|
+
defaultEnabled: false,
|
|
1999
|
+
createAdapter: () => createStubAdapter("pi", [join6(home, ".pi", "agent")], ".md")
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
id: "qoder",
|
|
2003
|
+
displayName: "Qoder",
|
|
2004
|
+
group: "other",
|
|
2005
|
+
implemented: false,
|
|
2006
|
+
defaultEnabled: false,
|
|
2007
|
+
createAdapter: () => createStubAdapter("qoder", [join6(home, ".qoder")], ".json")
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
id: "qwen-code",
|
|
2011
|
+
displayName: "Qwen Code",
|
|
2012
|
+
group: "other",
|
|
2013
|
+
implemented: false,
|
|
2014
|
+
defaultEnabled: false,
|
|
2015
|
+
createAdapter: () => createStubAdapter("qwen-code", [join6(home, ".qwen")], ".json")
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
id: "replit",
|
|
2019
|
+
displayName: "Replit",
|
|
2020
|
+
group: "other",
|
|
2021
|
+
implemented: false,
|
|
2022
|
+
defaultEnabled: false,
|
|
2023
|
+
createAdapter: () => createStubAdapter("replit", [join6(home, ".replit")], ".md")
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
id: "roo",
|
|
2027
|
+
displayName: "Roo Code",
|
|
2028
|
+
group: "other",
|
|
2029
|
+
implemented: false,
|
|
2030
|
+
defaultEnabled: false,
|
|
2031
|
+
createAdapter: () => createStubAdapter("roo", [join6(home, ".roo")], ".md")
|
|
2032
|
+
},
|
|
2033
|
+
{
|
|
2034
|
+
id: "trae",
|
|
2035
|
+
displayName: "Trae",
|
|
2036
|
+
group: "other",
|
|
2037
|
+
implemented: false,
|
|
2038
|
+
defaultEnabled: false,
|
|
2039
|
+
createAdapter: () => createStubAdapter("trae", [join6(home, ".trae")], ".md")
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
id: "trae-cn",
|
|
2043
|
+
displayName: "Trae CN",
|
|
2044
|
+
group: "other",
|
|
2045
|
+
implemented: false,
|
|
2046
|
+
defaultEnabled: false,
|
|
2047
|
+
createAdapter: () => createStubAdapter("trae-cn", [join6(home, ".trae-cn")], ".md")
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
id: "windsurf",
|
|
2051
|
+
displayName: "Windsurf",
|
|
2052
|
+
group: "other",
|
|
2053
|
+
implemented: false,
|
|
2054
|
+
defaultEnabled: true,
|
|
2055
|
+
createAdapter: () => createStubAdapter("windsurf", [join6(home, ".cascade_backups")], ".md")
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
id: "zencoder",
|
|
2059
|
+
displayName: "Zencoder",
|
|
2060
|
+
group: "other",
|
|
2061
|
+
implemented: false,
|
|
2062
|
+
defaultEnabled: false,
|
|
2063
|
+
createAdapter: () => createStubAdapter("zencoder", [join6(home, ".zencoder")], ".json")
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
id: "neovate",
|
|
2067
|
+
displayName: "Neovate",
|
|
2068
|
+
group: "other",
|
|
2069
|
+
implemented: false,
|
|
2070
|
+
defaultEnabled: false,
|
|
2071
|
+
createAdapter: () => createStubAdapter("neovate", [join6(home, ".neovate")], ".json")
|
|
2072
|
+
},
|
|
2073
|
+
{
|
|
2074
|
+
id: "pochi",
|
|
2075
|
+
displayName: "Pochi",
|
|
2076
|
+
group: "other",
|
|
2077
|
+
implemented: false,
|
|
2078
|
+
defaultEnabled: false,
|
|
2079
|
+
createAdapter: () => createStubAdapter("pochi", [join6(home, ".pochi")], ".json")
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
id: "adal",
|
|
2083
|
+
displayName: "AdaL",
|
|
2084
|
+
group: "other",
|
|
2085
|
+
implemented: false,
|
|
2086
|
+
defaultEnabled: false,
|
|
2087
|
+
createAdapter: () => createStubAdapter("adal", [join6(home, ".adal")], ".json")
|
|
2088
|
+
},
|
|
2089
|
+
{
|
|
2090
|
+
id: "aider",
|
|
2091
|
+
displayName: "Aider",
|
|
2092
|
+
group: "other",
|
|
2093
|
+
implemented: false,
|
|
2094
|
+
defaultEnabled: true,
|
|
2095
|
+
createAdapter: () => createStubAdapter("aider", [join6(home, ".aider")], ".aider.chat.history.md")
|
|
1907
2096
|
}
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2097
|
+
];
|
|
2098
|
+
function getAdapterCatalog() {
|
|
2099
|
+
return CATALOG.map((entry) => ({ ...entry }));
|
|
2100
|
+
}
|
|
2101
|
+
function getCatalogDefaultAdapterIds() {
|
|
2102
|
+
return CATALOG.filter((entry) => entry.defaultEnabled).map((entry) => entry.id);
|
|
2103
|
+
}
|
|
2104
|
+
function isAdapterId(value) {
|
|
2105
|
+
return CATALOG.some((entry) => entry.id === value);
|
|
2106
|
+
}
|
|
2107
|
+
var LEGACY_TO_ADAPTER_ID = new Map(Object.entries(ADAPTER_AGENT_ALIASES).map(([adapterId, agent]) => [
|
|
2108
|
+
agent,
|
|
2109
|
+
adapterId
|
|
2110
|
+
]));
|
|
2111
|
+
function resolveAdapterId(value) {
|
|
2112
|
+
if (isAdapterId(value))
|
|
2113
|
+
return value;
|
|
2114
|
+
return LEGACY_TO_ADAPTER_ID.get(value);
|
|
2115
|
+
}
|
|
2116
|
+
// ../shared/src/adapters/registry.ts
|
|
2117
|
+
var catalog = getAdapterCatalog();
|
|
2118
|
+
var catalogById = new Map(catalog.map((entry) => [entry.id, entry]));
|
|
2119
|
+
function getCatalog() {
|
|
2120
|
+
return catalog.map((entry) => ({ ...entry }));
|
|
2121
|
+
}
|
|
2122
|
+
function getDefaultAdapterIds() {
|
|
2123
|
+
return getCatalogDefaultAdapterIds();
|
|
2124
|
+
}
|
|
2125
|
+
function sanitizeEnabledAdapterIds(ids) {
|
|
2126
|
+
const selected = [];
|
|
2127
|
+
const seen = new Set;
|
|
2128
|
+
for (const id of ids) {
|
|
2129
|
+
const typedId = resolveAdapterId(id);
|
|
2130
|
+
if (!typedId || !catalogById.has(typedId))
|
|
1929
2131
|
continue;
|
|
1930
|
-
|
|
1931
|
-
if (h + l[$] > r && h > 0 && l[$] > 0) {
|
|
1932
|
-
if (s.wordWrap === false && h < r) {
|
|
1933
|
-
It2(n, m, r);
|
|
1934
|
-
continue;
|
|
1935
|
-
}
|
|
1936
|
-
n.push("");
|
|
1937
|
-
}
|
|
1938
|
-
if (h + l[$] > r && s.wordWrap === false) {
|
|
1939
|
-
It2(n, m, r);
|
|
2132
|
+
if (seen.has(typedId))
|
|
1940
2133
|
continue;
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
}
|
|
1944
|
-
s.trim !== false && (n = n.map(($) => Se($)));
|
|
1945
|
-
const c = n.join(`
|
|
1946
|
-
`), g = c[Symbol.iterator]();
|
|
1947
|
-
let F = g.next(), p = g.next(), E = 0;
|
|
1948
|
-
for (;!F.done; ) {
|
|
1949
|
-
const $ = F.value, m = p.value;
|
|
1950
|
-
if (i += $, $ === ot2 || $ === Gt) {
|
|
1951
|
-
Ht.lastIndex = E + 1;
|
|
1952
|
-
const f = Ht.exec(c)?.groups;
|
|
1953
|
-
if (f?.code !== undefined) {
|
|
1954
|
-
const v = Number.parseFloat(f.code);
|
|
1955
|
-
a = v === ve ? undefined : v;
|
|
1956
|
-
} else
|
|
1957
|
-
f?.uri !== undefined && (o = f.uri.length === 0 ? undefined : f.uri);
|
|
1958
|
-
}
|
|
1959
|
-
const h = a ? we(a) : undefined;
|
|
1960
|
-
m === `
|
|
1961
|
-
` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
|
|
1962
|
-
` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
|
|
2134
|
+
seen.add(typedId);
|
|
2135
|
+
selected.push(typedId);
|
|
1963
2136
|
}
|
|
1964
|
-
return
|
|
1965
|
-
};
|
|
1966
|
-
function J(t, r, s) {
|
|
1967
|
-
return String(t).normalize().replaceAll(`\r
|
|
1968
|
-
`, `
|
|
1969
|
-
`).split(`
|
|
1970
|
-
`).map((i) => Ie(i, r, s)).join(`
|
|
1971
|
-
`);
|
|
2137
|
+
return selected;
|
|
1972
2138
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
const
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt(a), g = import_picocolors2.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
|
|
1984
|
-
let $ = 0;
|
|
1985
|
-
r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
|
|
1986
|
-
let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
|
|
1987
|
-
const y2 = Math.min($ + E, s.length), f = [];
|
|
1988
|
-
let v = 0;
|
|
1989
|
-
m && v++, h && v++;
|
|
1990
|
-
const S2 = $ + (m ? 1 : 0), I2 = y2 - (h ? 1 : 0);
|
|
1991
|
-
for (let A = S2;A < I2; A++) {
|
|
1992
|
-
const w = J(i(s[A], A === r), n, { hard: true, trim: false }).split(`
|
|
1993
|
-
`);
|
|
1994
|
-
f.push(w), v += w.length;
|
|
1995
|
-
}
|
|
1996
|
-
if (v > p) {
|
|
1997
|
-
let A = 0, w = 0, _2 = v;
|
|
1998
|
-
const D2 = r - S2, T2 = (Y, L2) => be(f, _2, Y, L2, p);
|
|
1999
|
-
m ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length))) : ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (m = true, f.splice(0, A)), w > 0 && (h = true, f.splice(f.length - w, w));
|
|
2139
|
+
function resolveAdapters(enabledIds) {
|
|
2140
|
+
const selectedIds = sanitizeEnabledAdapterIds(enabledIds);
|
|
2141
|
+
if (selectedIds.length === 0) {
|
|
2142
|
+
const defaults = getDefaultAdapterIds();
|
|
2143
|
+
return defaults.map((id) => {
|
|
2144
|
+
const entry = catalogById.get(id);
|
|
2145
|
+
if (!entry)
|
|
2146
|
+
throw new Error(`Adapter catalog missing entry for ${id}`);
|
|
2147
|
+
return entry.createAdapter();
|
|
2148
|
+
});
|
|
2000
2149
|
}
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
};
|
|
2008
|
-
function Jt(t, r) {
|
|
2009
|
-
if (!t)
|
|
2010
|
-
return true;
|
|
2011
|
-
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
|
|
2012
|
-
return s.includes(o) || i.includes(o) || a.includes(o);
|
|
2150
|
+
return selectedIds.map((id) => {
|
|
2151
|
+
const entry = catalogById.get(id);
|
|
2152
|
+
if (!entry)
|
|
2153
|
+
throw new Error(`Adapter catalog missing entry for ${id}`);
|
|
2154
|
+
return entry.createAdapter();
|
|
2155
|
+
});
|
|
2013
2156
|
}
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
case "submit":
|
|
2027
|
-
return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.dim(`${this.selectedValues.length} items selected`)}`;
|
|
2028
|
-
case "cancel":
|
|
2029
|
-
return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a))}`;
|
|
2030
|
-
default: {
|
|
2031
|
-
const g = this.state === "error" ? import_picocolors2.default.yellow : import_picocolors2.default.cyan, F = [`${import_picocolors2.default.dim("↑/↓")} to navigate`, `${import_picocolors2.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`, `${import_picocolors2.default.dim("Enter:")} confirm`, `${import_picocolors2.default.dim("Type:")} to search`], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors2.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors2.default.yellow(this.error)}`] : [], $ = [...`${i}${g(d)}`.split(`
|
|
2032
|
-
`), `${g(d)} ${import_picocolors2.default.dim("Search:")} ${l}${c}`, ...p, ...E], m = [`${g(d)} ${F.join(" • ")}`, `${g(x2)}`], h = X2({ cursor: this.cursor, options: this.filteredOptions, style: (y2, f) => r(y2, f, this.selectedValues, this.focusedValue), maxItems: t.maxItems, output: t.output, rowPadding: $.length + m.length });
|
|
2033
|
-
return [...$, ...h.map((y2) => `${g(d)} ${y2}`), ...m].join(`
|
|
2034
|
-
`);
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
} });
|
|
2038
|
-
return s.prompt();
|
|
2039
|
-
};
|
|
2040
|
-
var Ne = (t = "", r) => {
|
|
2041
|
-
(r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
|
|
2042
|
-
|
|
2043
|
-
`);
|
|
2044
|
-
};
|
|
2045
|
-
var Ke = import_picocolors2.default.magenta;
|
|
2046
|
-
var zt = { light: C("─", "-"), heavy: C("━", "="), block: C("█", "#") };
|
|
2047
|
-
var Qt = `${import_picocolors2.default.gray(d)} `;
|
|
2157
|
+
function setActiveAdapters(adapters) {
|
|
2158
|
+
activeAdapters = [...adapters];
|
|
2159
|
+
}
|
|
2160
|
+
function getActiveAdapters() {
|
|
2161
|
+
return [...activeAdapters];
|
|
2162
|
+
}
|
|
2163
|
+
var activeAdapters = resolveAdapters(getDefaultAdapterIds());
|
|
2164
|
+
// ../shared/src/config.ts
|
|
2165
|
+
import { randomBytes } from "node:crypto";
|
|
2166
|
+
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "node:fs";
|
|
2167
|
+
import { homedir as homedir7 } from "node:os";
|
|
2168
|
+
import { join as join7 } from "node:path";
|
|
2048
2169
|
|
|
2049
2170
|
// ../shared/src/setup/adapter-selection.ts
|
|
2171
|
+
init_dist2();
|
|
2050
2172
|
var MAX_VISIBLE_OPTIONS = 7;
|
|
2051
2173
|
function isInteractiveTTY() {
|
|
2052
2174
|
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
@@ -2712,6 +2834,40 @@ async function fetchDevices() {
|
|
|
2712
2834
|
const body = JSON.parse(res.body);
|
|
2713
2835
|
return body.devices ?? [];
|
|
2714
2836
|
}
|
|
2837
|
+
async function deleteDaemons(deviceIds) {
|
|
2838
|
+
const { token, convexUrl } = getCloudConfig();
|
|
2839
|
+
const url = `${convexUrl}/api/cli/devices`;
|
|
2840
|
+
let activeToken = token;
|
|
2841
|
+
let res = await requestText(url, {
|
|
2842
|
+
method: "DELETE",
|
|
2843
|
+
headers: {
|
|
2844
|
+
Authorization: `Bearer ${activeToken}`,
|
|
2845
|
+
Connection: "close",
|
|
2846
|
+
"Content-Type": "application/json"
|
|
2847
|
+
},
|
|
2848
|
+
body: JSON.stringify({ deviceIds })
|
|
2849
|
+
});
|
|
2850
|
+
if (res.status === 401) {
|
|
2851
|
+
const refreshed = await refreshStoredToken(activeToken, convexUrl);
|
|
2852
|
+
if (refreshed) {
|
|
2853
|
+
activeToken = refreshed;
|
|
2854
|
+
res = await requestText(url, {
|
|
2855
|
+
method: "DELETE",
|
|
2856
|
+
headers: {
|
|
2857
|
+
Authorization: `Bearer ${activeToken}`,
|
|
2858
|
+
Connection: "close",
|
|
2859
|
+
"Content-Type": "application/json"
|
|
2860
|
+
},
|
|
2861
|
+
body: JSON.stringify({ deviceIds })
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
if (res.status < 200 || res.status >= 300) {
|
|
2866
|
+
return { ok: false, deleted: 0 };
|
|
2867
|
+
}
|
|
2868
|
+
const body = JSON.parse(res.body);
|
|
2869
|
+
return { ok: body.ok ?? false, deleted: body.deleted ?? 0 };
|
|
2870
|
+
}
|
|
2715
2871
|
|
|
2716
2872
|
// src/auth.ts
|
|
2717
2873
|
import { spawn } from "node:child_process";
|
|
@@ -3095,7 +3251,7 @@ import { join as join11 } from "node:path";
|
|
|
3095
3251
|
// package.json
|
|
3096
3252
|
var package_default = {
|
|
3097
3253
|
name: "agendex-cli",
|
|
3098
|
-
version: "0.
|
|
3254
|
+
version: "0.8.1",
|
|
3099
3255
|
description: "Agendex CLI for login, sync, and daemon workflows",
|
|
3100
3256
|
homepage: "https://github.com/Tyru5/Agendex#readme",
|
|
3101
3257
|
repository: {
|
|
@@ -3128,6 +3284,7 @@ var package_default = {
|
|
|
3128
3284
|
prepack: "node ./scripts/build-release.mjs --dist-only"
|
|
3129
3285
|
},
|
|
3130
3286
|
dependencies: {
|
|
3287
|
+
"@clack/prompts": "^1.0.1",
|
|
3131
3288
|
"better-sqlite3": "^12.6.2"
|
|
3132
3289
|
},
|
|
3133
3290
|
devDependencies: {
|
|
@@ -3205,7 +3362,16 @@ async function main() {
|
|
|
3205
3362
|
writeStdout(CLI_VERSION);
|
|
3206
3363
|
return 0;
|
|
3207
3364
|
}
|
|
3208
|
-
const isPassthrough = [
|
|
3365
|
+
const isPassthrough = [
|
|
3366
|
+
"stop",
|
|
3367
|
+
"status",
|
|
3368
|
+
"login",
|
|
3369
|
+
"logout",
|
|
3370
|
+
"cleanup",
|
|
3371
|
+
"help",
|
|
3372
|
+
"--help",
|
|
3373
|
+
"-h"
|
|
3374
|
+
].includes(command);
|
|
3209
3375
|
if (!isInternal && !isPassthrough) {
|
|
3210
3376
|
const { updateAvailable, current, latest } = await checkForUpdate();
|
|
3211
3377
|
if (updateAvailable) {
|
|
@@ -3280,6 +3446,72 @@ async function main() {
|
|
|
3280
3446
|
await syncAll();
|
|
3281
3447
|
return 0;
|
|
3282
3448
|
}
|
|
3449
|
+
case "cleanup": {
|
|
3450
|
+
const config = loadConfig();
|
|
3451
|
+
if (!config?.cloudToken || !config?.convexUrl) {
|
|
3452
|
+
writeStderr("[agendex] not logged in. Run `agendex login` first.");
|
|
3453
|
+
return 1;
|
|
3454
|
+
}
|
|
3455
|
+
const allDevices = await fetchDevices();
|
|
3456
|
+
if (allDevices.length === 0) {
|
|
3457
|
+
writeStdout("[agendex] no daemons found");
|
|
3458
|
+
return 0;
|
|
3459
|
+
}
|
|
3460
|
+
const now = Date.now();
|
|
3461
|
+
const staleDevices = allDevices.filter((d2) => {
|
|
3462
|
+
const age = d2.lastSeenAt ? now - d2.lastSeenAt : Number.POSITIVE_INFINITY;
|
|
3463
|
+
return age >= CLI_DAEMON_STALE_AFTER_MS;
|
|
3464
|
+
});
|
|
3465
|
+
if (args.includes("--stale")) {
|
|
3466
|
+
if (staleDevices.length === 0) {
|
|
3467
|
+
writeStdout("[agendex] no stale daemons to remove");
|
|
3468
|
+
return 0;
|
|
3469
|
+
}
|
|
3470
|
+
const staleIds = staleDevices.map((d2) => d2.deviceId).filter((id) => id != null);
|
|
3471
|
+
if (staleIds.length === 0) {
|
|
3472
|
+
writeStdout("[agendex] stale daemons have no device IDs and cannot be removed");
|
|
3473
|
+
return 0;
|
|
3474
|
+
}
|
|
3475
|
+
const result2 = await deleteDaemons(staleIds);
|
|
3476
|
+
if (result2.ok) {
|
|
3477
|
+
writeStdout(`[agendex] removed ${result2.deleted} stale daemon(s)`);
|
|
3478
|
+
} else {
|
|
3479
|
+
writeStderr("[agendex] failed to remove stale daemons");
|
|
3480
|
+
return 1;
|
|
3481
|
+
}
|
|
3482
|
+
return 0;
|
|
3483
|
+
}
|
|
3484
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
3485
|
+
writeStderr("[agendex] interactive cleanup requires a TTY. Use --stale to auto-remove stale daemons.");
|
|
3486
|
+
return 1;
|
|
3487
|
+
}
|
|
3488
|
+
const { promptForDaemonCleanup: promptForDaemonCleanup2 } = await Promise.resolve().then(() => (init_cleanup(), exports_cleanup));
|
|
3489
|
+
const deviceIds = allDevices.filter((d2) => d2.deviceId != null).map((d2) => {
|
|
3490
|
+
const age = d2.lastSeenAt ? now - d2.lastSeenAt : Number.POSITIVE_INFINITY;
|
|
3491
|
+
const status = age < CLI_DAEMON_STALE_AFTER_MS ? "alive" : "stale";
|
|
3492
|
+
return {
|
|
3493
|
+
deviceId: d2.deviceId,
|
|
3494
|
+
hostname: d2.hostname ?? "unknown",
|
|
3495
|
+
pid: d2.pid,
|
|
3496
|
+
status
|
|
3497
|
+
};
|
|
3498
|
+
});
|
|
3499
|
+
if (deviceIds.length === 0) {
|
|
3500
|
+
writeStdout("[agendex] no daemons with device IDs to remove");
|
|
3501
|
+
return 0;
|
|
3502
|
+
}
|
|
3503
|
+
const selected = await promptForDaemonCleanup2(deviceIds);
|
|
3504
|
+
if (!selected)
|
|
3505
|
+
return 0;
|
|
3506
|
+
const result = await deleteDaemons(selected);
|
|
3507
|
+
if (result.ok) {
|
|
3508
|
+
writeStdout(`[agendex] removed ${result.deleted} daemon(s)`);
|
|
3509
|
+
} else {
|
|
3510
|
+
writeStderr("[agendex] failed to remove daemons");
|
|
3511
|
+
return 1;
|
|
3512
|
+
}
|
|
3513
|
+
return 0;
|
|
3514
|
+
}
|
|
3283
3515
|
case "status": {
|
|
3284
3516
|
const config = loadConfig();
|
|
3285
3517
|
const pidInfo = readPidInfo();
|
|
@@ -3345,6 +3577,8 @@ Usage:
|
|
|
3345
3577
|
agendex logout Clear stored cloud token
|
|
3346
3578
|
agendex configure Select which agents/adapters to index
|
|
3347
3579
|
agendex sync One-shot scan + sync to cloud
|
|
3580
|
+
agendex cleanup Interactively remove cloud daemons
|
|
3581
|
+
agendex cleanup --stale Auto-remove all stale daemons
|
|
3348
3582
|
agendex status Show current config state + daemon status
|
|
3349
3583
|
agendex help Show this help message
|
|
3350
3584
|
agendex --version Print CLI version
|