@agentdocumentformat/cli 0.7.4 → 0.7.6
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/dist/adf.mjs +3 -3
- package/dist/chunks/{App-QMFRLBPQ.mjs → App-U2XSNHUV.mjs} +126 -16
- package/dist/chunks/{chatgpt-subscription-BQGWYZXE.mjs → chatgpt-subscription-E4MXTIAT.mjs} +1 -1
- package/dist/chunks/{chunk-LAZIXV2F.mjs → chunk-BNXUAOO4.mjs} +2 -1
- package/dist/chunks/chunk-KXEF4F4E.mjs +113 -0
- package/dist/chunks/{chunk-EYX2YLJW.mjs → chunk-PRMGZZM5.mjs} +40 -20
- package/dist/chunks/{chunk-GEKSJHIV.mjs → chunk-QPLEAE6V.mjs} +1 -1
- package/dist/chunks/{cli-ZGVQRVSQ.mjs → cli-XORTCRZW.mjs} +1 -1
- package/dist/chunks/{daemon-YMIWVG5G.mjs → daemon-ZT5J445W.mjs} +37 -29
- package/dist/chunks/{open-OTQDGDH5.mjs → open-VAU7PXT6.mjs} +2 -2
- package/dist/chunks/{theme-NORU4J74.mjs → theme-SFE3JMA2.mjs} +1 -1
- package/dist/chunks/{themes-F2FKU7CP.mjs → themes-YLXLOIJF.mjs} +2 -2
- package/dist/chunks/{tui-LWLJUXZ3.mjs → tui-RVRDCIP4.mjs} +5 -5
- package/package.json +1 -1
- package/dist/chunks/chunk-SLUKGXKH.mjs +0 -68
package/dist/adf.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import "./chunks/chunk-M2RX3S2T.mjs";
|
|
|
9
9
|
|
|
10
10
|
// src/main/cli/bin.ts
|
|
11
11
|
function version() {
|
|
12
|
-
return "0.7.
|
|
12
|
+
return "0.7.6";
|
|
13
13
|
}
|
|
14
14
|
var DAEMON_HELP = `Usage: adf daemon [--port <n>] [--host <h>] [--settings <file>]
|
|
15
15
|
adf daemon start [--port <n>] [--force]
|
|
@@ -140,9 +140,9 @@ async function main(argv) {
|
|
|
140
140
|
let { daemonPaths } = await import("./chunks/daemon-control-HKFVSQTQ.mjs");
|
|
141
141
|
process.env.ADF_DAEMON_PIDFILE = daemonPaths(Number(process.env.ADF_DAEMON_PORT ?? 7385)).pidFile;
|
|
142
142
|
}
|
|
143
|
-
return await import("./chunks/daemon-
|
|
143
|
+
return await import("./chunks/daemon-ZT5J445W.mjs"), -1;
|
|
144
144
|
}
|
|
145
|
-
let [{ runCli, tuiInvocation }, control] = await Promise.all([import("./chunks/cli-
|
|
145
|
+
let [{ runCli, tuiInvocation }, control] = await Promise.all([import("./chunks/cli-XORTCRZW.mjs"), import("./chunks/daemon-control-HKFVSQTQ.mjs")]);
|
|
146
146
|
return tuiInvocation(argv) && process.env.NODE_ENV === void 0 && (process.env.NODE_ENV = "production", process.env.ADF_NODE_ENV_DEFAULTED = "1"), await runCli(argv, {
|
|
147
147
|
fetch: globalThis.fetch.bind(globalThis),
|
|
148
148
|
stdout: (text) => process.stdout.write(text),
|
|
@@ -5,7 +5,8 @@ const require = __adfCreateRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
7
|
import {
|
|
8
|
-
auth_flow_exports
|
|
8
|
+
auth_flow_exports,
|
|
9
|
+
openBrowser
|
|
9
10
|
} from "./chunk-6VQEXLE2.mjs";
|
|
10
11
|
import {
|
|
11
12
|
createMouseController,
|
|
@@ -116,7 +117,7 @@ import {
|
|
|
116
117
|
validateCredentials,
|
|
117
118
|
validateMcpForm,
|
|
118
119
|
validateProvider
|
|
119
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-QPLEAE6V.mjs";
|
|
120
121
|
import {
|
|
121
122
|
require_jsx_runtime
|
|
122
123
|
} from "./chunk-7CV2SA3H.mjs";
|
|
@@ -136,7 +137,7 @@ import {
|
|
|
136
137
|
findTheme,
|
|
137
138
|
nextThemeName,
|
|
138
139
|
themeNames
|
|
139
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-KXEF4F4E.mjs";
|
|
140
141
|
import {
|
|
141
142
|
DaemonClient
|
|
142
143
|
} from "./chunk-3UCKYP7P.mjs";
|
|
@@ -176,7 +177,7 @@ import {
|
|
|
176
177
|
ThemeContext,
|
|
177
178
|
stateColor,
|
|
178
179
|
useTheme
|
|
179
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-PRMGZZM5.mjs";
|
|
180
181
|
import {
|
|
181
182
|
isMouseGarbage,
|
|
182
183
|
lastRawInput,
|
|
@@ -1260,8 +1261,8 @@ Accept the review and load it?`,
|
|
|
1260
1261
|
return failure(store, null, "Accept review", err), !1;
|
|
1261
1262
|
}
|
|
1262
1263
|
}
|
|
1263
|
-
async function runAutostart(store,
|
|
1264
|
-
let trackedDirs =
|
|
1264
|
+
async function runAutostart(store, dirs2) {
|
|
1265
|
+
let trackedDirs = dirs2;
|
|
1265
1266
|
if (!trackedDirs || trackedDirs.length === 0)
|
|
1266
1267
|
try {
|
|
1267
1268
|
trackedDirs = (await store.client.runtimeSettings()).trackedDirectories;
|
|
@@ -3829,7 +3830,7 @@ function wakesText(timers, now = Date.now(), sep4 = "\xB7") {
|
|
|
3829
3830
|
}
|
|
3830
3831
|
|
|
3831
3832
|
// src/main/tui/auth/flow.ts
|
|
3832
|
-
var { loginChatGpt, loginGrok, openBrowser } = cjs(auth_flow_exports), seams = { openBrowser };
|
|
3833
|
+
var { loginChatGpt, loginGrok, openBrowser: openBrowser2 } = cjs(auth_flow_exports), seams = { openBrowser: openBrowser2 };
|
|
3833
3834
|
function openUrl(url2) {
|
|
3834
3835
|
seams.openBrowser(url2);
|
|
3835
3836
|
}
|
|
@@ -8638,7 +8639,7 @@ var help = {
|
|
|
8638
8639
|
}
|
|
8639
8640
|
}, theme = {
|
|
8640
8641
|
name: "theme",
|
|
8641
|
-
args: "[adf|adf-light|adf-contrast|adf-mono|next]",
|
|
8642
|
+
args: "[adf|adf-light|adf-contrast|parchment|adf-mono|next]",
|
|
8642
8643
|
description: "Pick a color theme (no argument opens the picker)",
|
|
8643
8644
|
complete: (partial) => [...themeNames(), "next", "light", "dark", "mono"].filter((n) => n.startsWith(partial.trim())),
|
|
8644
8645
|
run: (ctx) => {
|
|
@@ -11349,7 +11350,7 @@ function toneColor3(theme2, tone) {
|
|
|
11349
11350
|
}
|
|
11350
11351
|
}
|
|
11351
11352
|
function Viewer(props) {
|
|
11352
|
-
let { width, height, active, title, meta = [], notice, name, text, bytes, mime, loading, error, plain: plain2 = !1, resetKey, onBack, onEdit, emptyText } = props, theme2 = useTheme(), [top, setTop] = (0, import_react36.useState)(0), [query, setQuery] = (0, import_react36.useState)(""), [typing, setTyping] = (0, import_react36.useState)(!1), [current, setCurrent] = (0, import_react36.useState)(0);
|
|
11353
|
+
let { width, height, active, title, meta = [], notice, name, text, bytes, mime, loading, error, plain: plain2 = !1, resetKey, onBack, onEdit, onOpenExternal, onSaveBack, emptyText } = props, theme2 = useTheme(), [top, setTop] = (0, import_react36.useState)(0), [query, setQuery] = (0, import_react36.useState)(""), [typing, setTyping] = (0, import_react36.useState)(!1), [current, setCurrent] = (0, import_react36.useState)(0);
|
|
11353
11354
|
(0, import_react36.useEffect)(() => {
|
|
11354
11355
|
setTop(0), setQuery(""), setTyping(!1), setCurrent(0);
|
|
11355
11356
|
}, [resetKey]);
|
|
@@ -11380,7 +11381,7 @@ function Viewer(props) {
|
|
|
11380
11381
|
let firstVisible = matches.findIndex((m) => (lineStart2[m.line] ?? 0) >= clampedTop), index = firstVisible >= 0 ? firstVisible : 0;
|
|
11381
11382
|
setCurrent(index), reveal(index);
|
|
11382
11383
|
}
|
|
11383
|
-
}, [query]), useKeys((input, key) => typing ? key.escape ? (setTyping(!1), setQuery(""), !0) : key.return ? (setTyping(!1), !0) : key.backspace || key.delete ? (setQuery((q) => q.slice(0, -1)), !0) : (key.leftArrow || key.rightArrow) && !key.ctrl && !key.shift ? !0 : input && !key.ctrl && !key.meta && !/[\r\n\t]/.test(input) ? (setQuery((q) => q + input), !0) : !1 : (key.ctrl || key.shift) && (key.leftArrow || key.rightArrow) ? !1 : key.upArrow || input === "k" && !key.ctrl ? (scrollTo(clampedTop - 1), !0) : key.downArrow || input === "j" && !key.ctrl ? (scrollTo(clampedTop + 1), !0) : key.pageUp || key.ctrl && input === "u" ? (scrollTo(clampedTop - Math.max(1, bodyRows - 1)), !0) : key.pageDown || input === " " || key.ctrl && input === "d" ? (scrollTo(clampedTop + Math.max(1, bodyRows - 1)), !0) : key.home || input === "g" ? (scrollTo(0), !0) : key.end || input === "G" ? (scrollTo(maxTop), !0) : input === "/" ? (setTyping(!0), setQuery(""), !0) : input === "n" && query ? (jump(1), !0) : input === "N" && query ? (jump(-1), !0) : input === "e" && onEdit ? (onEdit(), !0) : key.escape && query ? (setQuery(""), !0) : (key.escape || key.backspace && !key.ctrl && !key.meta) && onBack ? (onBack(), !0) : !1, { layer: "main", active });
|
|
11384
|
+
}, [query]), useKeys((input, key) => typing ? key.escape ? (setTyping(!1), setQuery(""), !0) : key.return ? (setTyping(!1), !0) : key.backspace || key.delete ? (setQuery((q) => q.slice(0, -1)), !0) : (key.leftArrow || key.rightArrow) && !key.ctrl && !key.shift ? !0 : input && !key.ctrl && !key.meta && !/[\r\n\t]/.test(input) ? (setQuery((q) => q + input), !0) : !1 : (key.ctrl || key.shift) && (key.leftArrow || key.rightArrow) ? !1 : key.upArrow || input === "k" && !key.ctrl ? (scrollTo(clampedTop - 1), !0) : key.downArrow || input === "j" && !key.ctrl ? (scrollTo(clampedTop + 1), !0) : key.pageUp || key.ctrl && input === "u" ? (scrollTo(clampedTop - Math.max(1, bodyRows - 1)), !0) : key.pageDown || input === " " || key.ctrl && input === "d" ? (scrollTo(clampedTop + Math.max(1, bodyRows - 1)), !0) : key.home || input === "g" ? (scrollTo(0), !0) : key.end || input === "G" ? (scrollTo(maxTop), !0) : input === "/" ? (setTyping(!0), setQuery(""), !0) : input === "n" && query ? (jump(1), !0) : input === "N" && query ? (jump(-1), !0) : input === "e" && onEdit ? (onEdit(), !0) : input === "o" && onOpenExternal ? (onOpenExternal(), !0) : input === "s" && onSaveBack ? (onSaveBack(), !0) : key.escape && query ? (setQuery(""), !0) : (key.escape || key.backspace && !key.ctrl && !key.meta) && onBack ? (onBack(), !0) : !1, { layer: "main", active });
|
|
11384
11385
|
let boxRef = (0, import_react36.useRef)(null);
|
|
11385
11386
|
useWheel(boxRef, (delta) => scrollTo(clampedTop + delta * WHEEL_STEP));
|
|
11386
11387
|
let visible = rows.slice(clampedTop, clampedTop + bodyRows), lastLine = visible.length ? visible[visible.length - 1].line + 1 : 0, firstLine2 = visible.length ? visible[0].line + 1 : 0, position = rows.length === 0 ? "" : `L${firstLine2}-${lastLine}/${prepared.lines.length}${maxTop > 0 ? ` ${Math.round(clampedTop / maxTop * 100)}%` : ""}`, search = typing ? `/${query}` : query ? `/${query} ${matches.length ? `${currentIndex + 1}/${matches.length}` : "no match"} n/N` : "", header2 = /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
@@ -11423,11 +11424,12 @@ function Viewer(props) {
|
|
|
11423
11424
|
theme2.glyph.sep,
|
|
11424
11425
|
" hex dump of the first ",
|
|
11425
11426
|
Math.min(256, bytes.length),
|
|
11426
|
-
" bytes"
|
|
11427
|
+
" bytes",
|
|
11428
|
+
onOpenExternal ? ` ${theme2.glyph.sep} o opens it in the default app` : ""
|
|
11427
11429
|
] }) : null,
|
|
11428
11430
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Box_default, { flexDirection: "column", height: bodyRows, overflow: "hidden", children: body }),
|
|
11429
11431
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Box_default, { justifyContent: "space-between", width, children: [
|
|
11430
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { color: typing ? theme2.color.accent : theme2.color.muted, wrap: "truncate-end", children: search || (active ? `/ search${onEdit ? " \xB7 e edit" : ""}${onBack ? " \xB7 Backspace back" : ""}` : "") }),
|
|
11432
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { color: typing ? theme2.color.accent : theme2.color.muted, wrap: "truncate-end", children: search || (active ? `/ search${onEdit ? " \xB7 e edit" : ""}${onOpenExternal ? " \xB7 o open in app" : ""}${onBack ? " \xB7 Backspace back" : ""}` : "") }),
|
|
11431
11433
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { color: theme2.color.dim, children: position })
|
|
11432
11434
|
] })
|
|
11433
11435
|
] });
|
|
@@ -11656,6 +11658,77 @@ function DataTab({ kind, width, height, focused, agentId, agentLabel: agentLabel
|
|
|
11656
11658
|
|
|
11657
11659
|
// src/main/tui/views/files/FilesTab.tsx
|
|
11658
11660
|
var import_react38 = __toESM(require_react(), 1);
|
|
11661
|
+
|
|
11662
|
+
// src/main/tui/views/files/external.ts
|
|
11663
|
+
import { promises as fs4, rmSync, statSync as statSync3 } from "node:fs";
|
|
11664
|
+
import { tmpdir as tmpdir3 } from "node:os";
|
|
11665
|
+
import { join as join4 } from "node:path";
|
|
11666
|
+
var copies = /* @__PURE__ */ new Map(), dirs = /* @__PURE__ */ new Set(), exitHook = !1, copyKey = (agentId, target2) => `${agentId}\0${targetKey(target2)}`, errorText5 = (err) => err instanceof Error ? err.message : String(err), bytesOf = (loaded) => loaded.binary ? Buffer.from(loaded.bytes ?? new Uint8Array()) : Buffer.from(loaded.text ?? "", "utf-8");
|
|
11667
|
+
function externalCopy(agentId, target2) {
|
|
11668
|
+
return copies.get(copyKey(agentId, target2));
|
|
11669
|
+
}
|
|
11670
|
+
function externalChanged(copy) {
|
|
11671
|
+
try {
|
|
11672
|
+
return statSync3(copy.file).mtimeMs !== copy.mtimeMs;
|
|
11673
|
+
} catch {
|
|
11674
|
+
return !1;
|
|
11675
|
+
}
|
|
11676
|
+
}
|
|
11677
|
+
function cleanupExternalCopies() {
|
|
11678
|
+
for (let dir of dirs) rmSync(dir, { recursive: !0, force: !0 });
|
|
11679
|
+
dirs.clear(), copies.clear();
|
|
11680
|
+
}
|
|
11681
|
+
async function openExternal(deps, target2) {
|
|
11682
|
+
let { actions: actions4, agentId } = deps, label2 = targetLabel(target2), loaded = await actions4.run(`Open ${label2}`, (c) => loadTarget(c, agentId, target2));
|
|
11683
|
+
if (!loaded) return !1;
|
|
11684
|
+
let bytes = bytesOf(loaded), existing = externalCopy(agentId, target2), file = existing?.file;
|
|
11685
|
+
if (!existing || !externalChanged(existing)) {
|
|
11686
|
+
try {
|
|
11687
|
+
if (!file) {
|
|
11688
|
+
let dir = await fs4.mkdtemp(join4(tmpdir3(), "adf-tui-open-"));
|
|
11689
|
+
dirs.add(dir), exitHook || (exitHook = !0, process.once("exit", cleanupExternalCopies)), file = join4(dir, targetFileName(target2));
|
|
11690
|
+
}
|
|
11691
|
+
await fs4.writeFile(file, bytes);
|
|
11692
|
+
} catch (err) {
|
|
11693
|
+
return actions4.toast(`Cannot write a temp copy of ${label2} in ${tmpdir3()}: ${errorText5(err)}`, "error", 12e3), !1;
|
|
11694
|
+
}
|
|
11695
|
+
copies.set(copyKey(agentId, target2), { agentId, target: target2, file, original: bytes, binary: loaded.binary, mime: loaded.mime, mtimeMs: (await fs4.stat(file)).mtimeMs });
|
|
11696
|
+
}
|
|
11697
|
+
return (deps.open ?? openBrowser)(file), actions4.toast(`Opened ${label2} in the default app \u2014 after saving there, press s to save it back (${file})`, "info", 8e3), !0;
|
|
11698
|
+
}
|
|
11699
|
+
async function saveBackExternal(deps, target2) {
|
|
11700
|
+
let { client, actions: actions4, agentId, agentLabel: agentLabel5 } = deps, label2 = targetLabel(target2), copy = externalCopy(agentId, target2);
|
|
11701
|
+
if (!copy)
|
|
11702
|
+
return actions4.toast(`${label2} is not open in an app \u2014 press o to open it`, "warn"), "failed";
|
|
11703
|
+
let edited;
|
|
11704
|
+
try {
|
|
11705
|
+
edited = await fs4.readFile(copy.file);
|
|
11706
|
+
} catch (err) {
|
|
11707
|
+
return actions4.toast(`Cannot read ${copy.file}: ${errorText5(err)} \u2014 nothing written`, "error", 12e3), "failed";
|
|
11708
|
+
}
|
|
11709
|
+
if (edited.equals(copy.original))
|
|
11710
|
+
return copy.mtimeMs = (await fs4.stat(copy.file)).mtimeMs, actions4.toast(`No changes to ${label2}`, "info"), "unchanged";
|
|
11711
|
+
let concurrent = null;
|
|
11712
|
+
try {
|
|
11713
|
+
let current = await loadTarget(client, agentId, target2);
|
|
11714
|
+
bytesOf(current).equals(copy.original) || (concurrent = "changed in the agent since you opened it");
|
|
11715
|
+
} catch (err) {
|
|
11716
|
+
concurrent = err.status === 404 ? "was deleted since you opened it" : `could not be re-checked (${errorText5(err)})`;
|
|
11717
|
+
}
|
|
11718
|
+
return await actions4.confirm({
|
|
11719
|
+
title: concurrent ? `Concurrent change: ${label2}` : `Save ${label2}`,
|
|
11720
|
+
message: [
|
|
11721
|
+
concurrent ? `WARNING: ${label2} ${concurrent}. Writing replaces that version.` : null,
|
|
11722
|
+
`Write ${label2} in ${agentLabel5}: ${formatBytes(copy.original.length)} -> ${formatBytes(edited.length)}`
|
|
11723
|
+
].filter(Boolean).join(`
|
|
11724
|
+
`),
|
|
11725
|
+
confirmLabel: concurrent ? "Overwrite" : "Write",
|
|
11726
|
+
cancelLabel: "Cancel",
|
|
11727
|
+
danger: !!concurrent
|
|
11728
|
+
}) ? await actions4.run(`Write ${label2}`, (c) => (copy.binary && target2.kind === "file" ? c.writeFile(agentId, target2.path, { contentBase64: edited.toString("base64"), ...copy.mime ? { mimeType: copy.mime } : {} }) : writeTarget(c, agentId, target2, edited.toString("utf-8"))).then(() => !0)) ? (copy.original = edited, copy.mtimeMs = (await fs4.stat(copy.file)).mtimeMs, actions4.toast(`Saved ${label2} from the app`, "success"), "written") : (actions4.toast(`Write failed. Your copy is still at ${copy.file}`, "error", 12e3), "failed") : "discarded";
|
|
11729
|
+
}
|
|
11730
|
+
|
|
11731
|
+
// src/main/tui/views/files/FilesTab.tsx
|
|
11659
11732
|
var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1), recentWrites = /* @__PURE__ */ new Map(), RECENT_MS = 10 * 6e4;
|
|
11660
11733
|
function pinnedKeyForPath(path) {
|
|
11661
11734
|
return path === "mind.md" ? MIND_KEY : path === "README.md" || path === "document.md" ? DOCUMENT_KEY : null;
|
|
@@ -11763,7 +11836,30 @@ function FilesTab(props) {
|
|
|
11763
11836
|
} finally {
|
|
11764
11837
|
busy.current = !1;
|
|
11765
11838
|
}
|
|
11766
|
-
},
|
|
11839
|
+
}, externalDeps = () => ({ client, actions: actions4, agentId, agentLabel: agentLabel5 }), runOpenExternal = async (target2) => {
|
|
11840
|
+
await openExternal(externalDeps(), target2), setTick((t) => t + 1);
|
|
11841
|
+
}, runSaveBack = async (target2) => {
|
|
11842
|
+
if (busy.current) {
|
|
11843
|
+
actions4.toast("An edit is already in progress", "warn");
|
|
11844
|
+
return;
|
|
11845
|
+
}
|
|
11846
|
+
busy.current = !0;
|
|
11847
|
+
try {
|
|
11848
|
+
await saveBackExternal(externalDeps(), target2) === "written" && (invalidate(targetKey(target2)), await reloadList());
|
|
11849
|
+
} catch (err) {
|
|
11850
|
+
actions4.toast(`Save failed: ${err instanceof Error ? err.message : String(err)}`, "error", 12e3);
|
|
11851
|
+
} finally {
|
|
11852
|
+
busy.current = !1, setTick((t) => t + 1);
|
|
11853
|
+
}
|
|
11854
|
+
}, viewedCopy = viewerTarget ? externalCopy(agentId, viewerTarget) : void 0, copyChanged = viewedCopy ? externalChanged(viewedCopy) : !1;
|
|
11855
|
+
(0, import_react38.useEffect)(() => {
|
|
11856
|
+
if (!viewedCopy || copyChanged) return;
|
|
11857
|
+
let timer = setInterval(() => {
|
|
11858
|
+
externalChanged(viewedCopy) && setTick((t) => t + 1);
|
|
11859
|
+
}, 1500);
|
|
11860
|
+
return () => clearInterval(timer);
|
|
11861
|
+
}, [viewedCopy, copyChanged]);
|
|
11862
|
+
let createFile = async (initialPath) => {
|
|
11767
11863
|
let path = initialPath?.trim();
|
|
11768
11864
|
if (!path) {
|
|
11769
11865
|
let base2 = cursorRow?.kind === "dir" ? `${cursorRow.path}/` : cursorRow?.kind === "file" && parentDir(cursorRow.path) ? `${parentDir(cursorRow.path)}/` : "";
|
|
@@ -11862,6 +11958,10 @@ function FilesTab(props) {
|
|
|
11862
11958
|
let target2 = rowTarget(row4);
|
|
11863
11959
|
return target2 ? runEdit(target2) : actions4.toast("Pick a file to edit", "warn"), !0;
|
|
11864
11960
|
}
|
|
11961
|
+
if ((input === "o" || input === "s") && !key.ctrl) {
|
|
11962
|
+
let target2 = rowTarget(row4);
|
|
11963
|
+
return target2 ? input === "o" ? runOpenExternal(target2) : runSaveBack(target2) : actions4.toast("Pick a file", "warn"), !0;
|
|
11964
|
+
}
|
|
11865
11965
|
return input === "m" && !key.ctrl ? (rename(row4), !0) : input === "d" && !key.ctrl || key.delete && !key.backspace ? (remove2(row4), !0) : input === "p" && !key.ctrl ? (cycleProtection(row4), !0) : input === "a" && !key.ctrl ? (toggleAuthorized(row4), !0) : !1;
|
|
11866
11966
|
}, split = width >= 70, listWidth = split ? Math.max(24, Math.min(48, Math.floor(width * 0.38))) : width, viewerWidth = split ? width - listWidth - 2 : width, showList = split || pane === "list", showViewer = split || pane === "viewer", perAgent = recentWrites.get(agentId), renderRow = (row4, selected, w) => {
|
|
11867
11967
|
let indent3 = " ".repeat(row4.depth), glyph, color, right = "", suffix = "";
|
|
@@ -11964,7 +12064,7 @@ function FilesTab(props) {
|
|
|
11964
12064
|
active: focused && pane === "viewer",
|
|
11965
12065
|
title: viewerTitle,
|
|
11966
12066
|
meta: viewerMeta,
|
|
11967
|
-
notice: notice?.key === viewerKey ? notice.text : void 0,
|
|
12067
|
+
notice: copyChanged ? "Changed in the default app \u2014 s saves it back" : notice?.key === viewerKey ? notice.text : viewedCopy ? "Open in the default app (o reopens, s saves it back)" : void 0,
|
|
11968
12068
|
name: viewerTarget.kind === "file" ? viewerTarget.path : targetLabel(viewerTarget),
|
|
11969
12069
|
text: loadedOk?.text,
|
|
11970
12070
|
bytes: loadedOk?.binary ? loadedOk.bytes : void 0,
|
|
@@ -11975,6 +12075,12 @@ function FilesTab(props) {
|
|
|
11975
12075
|
onBack: () => setPane("list"),
|
|
11976
12076
|
onEdit: loadedOk?.binary ? void 0 : () => {
|
|
11977
12077
|
runEdit(viewerTarget);
|
|
12078
|
+
},
|
|
12079
|
+
onOpenExternal: () => {
|
|
12080
|
+
runOpenExternal(viewerTarget);
|
|
12081
|
+
},
|
|
12082
|
+
onSaveBack: () => {
|
|
12083
|
+
runSaveBack(viewerTarget);
|
|
11978
12084
|
}
|
|
11979
12085
|
}
|
|
11980
12086
|
) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { color: theme2.color.muted, children: "Pick a file." })
|
|
@@ -12107,7 +12213,7 @@ function keyHints(scope) {
|
|
|
12107
12213
|
{ keys: "backspace", label: "back" },
|
|
12108
12214
|
{ keys: "up down", label: "scroll" },
|
|
12109
12215
|
{ keys: "/", label: "search" },
|
|
12110
|
-
...state.tab === "files" ? [{ keys: "e", label: "edit" }] : [],
|
|
12216
|
+
...state.tab === "files" ? [{ keys: "e", label: "edit" }, { keys: "o", label: "open in app" }] : [],
|
|
12111
12217
|
{ keys: "left right", label: "tabs" }
|
|
12112
12218
|
] : state.tab !== "files" ? [
|
|
12113
12219
|
{ keys: "enter", label: "read" },
|
|
@@ -12121,6 +12227,7 @@ function keyHints(scope) {
|
|
|
12121
12227
|
{ keys: "backspace", label: "up" },
|
|
12122
12228
|
{ keys: "left right", label: "tabs" },
|
|
12123
12229
|
{ keys: "e", label: "edit" },
|
|
12230
|
+
{ keys: "o", label: "open in app" },
|
|
12124
12231
|
{ keys: "n", label: "new" },
|
|
12125
12232
|
{ keys: "/", label: "filter" },
|
|
12126
12233
|
{ keys: "d", label: "delete" }
|
|
@@ -12144,6 +12251,8 @@ var files = {
|
|
|
12144
12251
|
{ keys: "space", label: "Toggle a folder" },
|
|
12145
12252
|
{ keys: "/", label: "Filter by path (fuzzy)" },
|
|
12146
12253
|
{ keys: "e", label: "Edit in $EDITOR, then confirm the write (diff shown)" },
|
|
12254
|
+
{ keys: "o", label: "Open in the default app (xlsx, images, pdf, \u2026)" },
|
|
12255
|
+
{ keys: "s", label: "Save the default-app copy back (asks)" },
|
|
12147
12256
|
{ keys: "n", label: "New file" },
|
|
12148
12257
|
{ keys: "m", label: "Rename / move (a folder moves with its files)" },
|
|
12149
12258
|
{ keys: "d delete", label: "Delete (asks)" },
|
|
@@ -12158,7 +12267,8 @@ var files = {
|
|
|
12158
12267
|
{ keys: "backspace esc", label: "Back to the list (the entry stays selected)" },
|
|
12159
12268
|
{ keys: "up down", label: "Scroll (j k; PgUp PgDn Space page; g G top/bottom)" },
|
|
12160
12269
|
{ keys: "/", label: "Search, then n N next / previous hit" },
|
|
12161
|
-
{ keys: "e", label: "Edit this file" }
|
|
12270
|
+
{ keys: "e", label: "Edit this file" },
|
|
12271
|
+
{ keys: "o s", label: "Open in the default app \xB7 save that copy back" }
|
|
12162
12272
|
]
|
|
12163
12273
|
},
|
|
12164
12274
|
{
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
createChatGPTSubscriptionProvider,
|
|
11
11
|
describeCodexRequest,
|
|
12
12
|
patchCodexRequestBody
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BNXUAOO4.mjs";
|
|
14
14
|
import "./chunk-LFMB4PAA.mjs";
|
|
15
15
|
import "./chunk-RIX34QHC.mjs";
|
|
16
16
|
import "./chunk-M2RX3S2T.mjs";
|
|
@@ -5177,7 +5177,7 @@ function createChatGPTSubscriptionProvider(authManager, extraParams) {
|
|
|
5177
5177
|
let pendingInstructions = requestId !== null ? requestsById.get(requestId)?.instructions : legacyInstructions;
|
|
5178
5178
|
headers.set("Authorization", `Bearer ${token}`);
|
|
5179
5179
|
let accountId = authManager.getAccountId();
|
|
5180
|
-
accountId && headers.set("ChatGPT-Account-ID", accountId), headers.set("originator", "codex_cli_rs"), headers.set("version", "0.
|
|
5180
|
+
accountId && headers.set("ChatGPT-Account-ID", accountId), headers.set("originator", "codex_cli_rs"), headers.set("version", "0.159.1");
|
|
5181
5181
|
let patchedInit = init, requestSummary;
|
|
5182
5182
|
if (init?.body && typeof init.body == "string")
|
|
5183
5183
|
try {
|
|
@@ -5269,6 +5269,7 @@ function createChatGPTSubscriptionProvider(authManager, extraParams) {
|
|
|
5269
5269
|
};
|
|
5270
5270
|
}
|
|
5271
5271
|
var CHATGPT_SUBSCRIPTION_MODELS = [
|
|
5272
|
+
"gpt-6.1-sol",
|
|
5272
5273
|
"gpt-6-astra",
|
|
5273
5274
|
"gpt-6-sol",
|
|
5274
5275
|
"gpt-6-luna",
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
+
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
createTheme
|
|
9
|
+
} from "./chunk-PRMGZZM5.mjs";
|
|
10
|
+
|
|
11
|
+
// src/main/tui/commands/builtin/themes.ts
|
|
12
|
+
var ADF_DARK = { ...createTheme({ mono: !1, env: {} }).color }, ADF_LIGHT = {
|
|
13
|
+
text: "#111111",
|
|
14
|
+
// ink
|
|
15
|
+
muted: "#474B54",
|
|
16
|
+
// ink-muted
|
|
17
|
+
dim: "#6B707C",
|
|
18
|
+
// ink-faint
|
|
19
|
+
accent: "#2F5BEA",
|
|
20
|
+
// blue
|
|
21
|
+
live: "#1F44BF",
|
|
22
|
+
// blue-strong
|
|
23
|
+
loop: "#6A4A8C",
|
|
24
|
+
// status: experimental
|
|
25
|
+
user: "#2F5BEA",
|
|
26
|
+
// blue
|
|
27
|
+
assistant: "#111111",
|
|
28
|
+
// ink
|
|
29
|
+
thinking: "#6B707C",
|
|
30
|
+
// ink-faint
|
|
31
|
+
tool: "#474B54",
|
|
32
|
+
// ink-muted
|
|
33
|
+
success: "#1F6A52",
|
|
34
|
+
// status: stable
|
|
35
|
+
warn: "#8A5A0B",
|
|
36
|
+
// status: draft
|
|
37
|
+
error: "#A12F29",
|
|
38
|
+
// status: deprecated
|
|
39
|
+
info: "#474B54",
|
|
40
|
+
// ink-muted
|
|
41
|
+
border: "#C9CED8",
|
|
42
|
+
// rule-strong
|
|
43
|
+
borderFocus: "#2F5BEA",
|
|
44
|
+
// blue
|
|
45
|
+
selectionFg: "#FFFFFF",
|
|
46
|
+
// paper (on a blue fill)
|
|
47
|
+
selectionBg: "#2F5BEA",
|
|
48
|
+
// blue
|
|
49
|
+
surface: "#F6F7FA",
|
|
50
|
+
// paper-sunken
|
|
51
|
+
overlay: "#F6F7FA"
|
|
52
|
+
// paper-sunken
|
|
53
|
+
}, ADF_CONTRAST = {
|
|
54
|
+
...ADF_DARK,
|
|
55
|
+
text: "#FFFFFF",
|
|
56
|
+
assistant: "#FFFFFF",
|
|
57
|
+
muted: "#D4D8E1",
|
|
58
|
+
dim: "#B0B5C2",
|
|
59
|
+
thinking: "#B0B5C2",
|
|
60
|
+
tool: "#D4D8E1",
|
|
61
|
+
info: "#D4D8E1",
|
|
62
|
+
border: "#858B99"
|
|
63
|
+
}, PARCHMENT = {
|
|
64
|
+
text: "#D9D4C7",
|
|
65
|
+
muted: "#9A9384",
|
|
66
|
+
dim: "#5F5A50",
|
|
67
|
+
accent: "#E3A857",
|
|
68
|
+
live: "#4DB6AC",
|
|
69
|
+
loop: "#A98BE3",
|
|
70
|
+
user: "#E3A857",
|
|
71
|
+
assistant: "#D9D4C7",
|
|
72
|
+
thinking: "#7F7A6E",
|
|
73
|
+
tool: "#6FA8DC",
|
|
74
|
+
success: "#8CC084",
|
|
75
|
+
warn: "#E0B050",
|
|
76
|
+
error: "#E06C6C",
|
|
77
|
+
info: "#6FA8DC",
|
|
78
|
+
border: "#4A463E",
|
|
79
|
+
borderFocus: "#E3A857",
|
|
80
|
+
selectionFg: "#1B1A17",
|
|
81
|
+
selectionBg: "#E3A857",
|
|
82
|
+
surface: "#23211D",
|
|
83
|
+
overlay: "#2B2823"
|
|
84
|
+
}, THEMES = [
|
|
85
|
+
{ name: "adf", label: "ADF dark", description: "ADF brand colors on a dark terminal (default)", colors: ADF_DARK },
|
|
86
|
+
{ name: "adf-light", label: "ADF light", description: "ADF brand colors on a light terminal", colors: ADF_LIGHT },
|
|
87
|
+
{ name: "adf-contrast", label: "ADF high contrast", description: "Brighter text and borders on dark backgrounds", colors: ADF_CONTRAST },
|
|
88
|
+
{ name: "parchment", label: "Parchment", description: "The earlier warm palette: amber accent on a dark terminal", colors: PARCHMENT },
|
|
89
|
+
{ name: "adf-mono", label: "Mono", description: "No color (like NO_COLOR): bold and inverse carry emphasis", colors: void 0 }
|
|
90
|
+
], ALIASES = { dark: "adf", default: "adf", light: "adf-light", contrast: "adf-contrast", mono: "adf-mono", "no-color": "adf-mono" };
|
|
91
|
+
function findTheme(name) {
|
|
92
|
+
let wanted = name.trim().toLowerCase();
|
|
93
|
+
return THEMES.find((t) => t.name === (ALIASES[wanted] ?? wanted));
|
|
94
|
+
}
|
|
95
|
+
function nextThemeName(current) {
|
|
96
|
+
let at = THEMES.findIndex((t) => t.name === current);
|
|
97
|
+
return THEMES[(at + 1) % THEMES.length].name;
|
|
98
|
+
}
|
|
99
|
+
var MONO_COLORS = Object.fromEntries(Object.keys(ADF_DARK).map((k) => [k, void 0]));
|
|
100
|
+
function applyTheme(theme, choice) {
|
|
101
|
+
theme.name = choice.name, theme.mono = choice.colors === void 0, theme.color = { ...choice.colors ?? MONO_COLORS };
|
|
102
|
+
}
|
|
103
|
+
function themeNames() {
|
|
104
|
+
return THEMES.map((t) => t.name);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
THEMES,
|
|
109
|
+
findTheme,
|
|
110
|
+
nextThemeName,
|
|
111
|
+
applyTheme,
|
|
112
|
+
themeNames
|
|
113
|
+
};
|
|
@@ -13,26 +13,46 @@ import {
|
|
|
13
13
|
|
|
14
14
|
// src/main/tui/app/theme.ts
|
|
15
15
|
var import_react = __toESM(require_react(), 1), ADF_COLORS = {
|
|
16
|
-
text: "#
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
text: "#ECEEF3",
|
|
17
|
+
// ink
|
|
18
|
+
muted: "#B0B5C2",
|
|
19
|
+
// ink-muted
|
|
20
|
+
dim: "#858B99",
|
|
21
|
+
// ink-faint
|
|
22
|
+
accent: "#7F9DFF",
|
|
23
|
+
// blue
|
|
24
|
+
live: "#A9BDFF",
|
|
25
|
+
// blue-strong
|
|
26
|
+
loop: "#C6A8E6",
|
|
27
|
+
// status: experimental
|
|
28
|
+
user: "#7F9DFF",
|
|
29
|
+
// blue
|
|
30
|
+
assistant: "#ECEEF3",
|
|
31
|
+
// ink
|
|
32
|
+
thinking: "#858B99",
|
|
33
|
+
// ink-faint
|
|
34
|
+
tool: "#B0B5C2",
|
|
35
|
+
// ink-muted
|
|
36
|
+
success: "#86CFAE",
|
|
37
|
+
// status: stable
|
|
38
|
+
warn: "#E7BF73",
|
|
39
|
+
// status: draft
|
|
40
|
+
error: "#EE9B92",
|
|
41
|
+
// status: deprecated
|
|
42
|
+
info: "#B0B5C2",
|
|
43
|
+
// ink-muted
|
|
44
|
+
border: "#333A49",
|
|
45
|
+
// rule-strong
|
|
46
|
+
borderFocus: "#7F9DFF",
|
|
47
|
+
// blue
|
|
48
|
+
selectionFg: "#0C0E13",
|
|
49
|
+
// paper (on a blue fill)
|
|
50
|
+
selectionBg: "#7F9DFF",
|
|
51
|
+
// blue
|
|
52
|
+
surface: "#151922",
|
|
53
|
+
// paper-sunken
|
|
54
|
+
overlay: "#151922"
|
|
55
|
+
// paper-sunken
|
|
36
56
|
}, MONO_COLORS = Object.fromEntries(
|
|
37
57
|
Object.keys(ADF_COLORS).map((key) => [key, void 0])
|
|
38
58
|
), UNICODE_GLYPHS = {
|
|
@@ -44,7 +44,7 @@ function tuiInvocation(argv) {
|
|
|
44
44
|
return argv.filter((a) => a !== "--json");
|
|
45
45
|
}
|
|
46
46
|
async function defaultLaunchTui(argv) {
|
|
47
|
-
let { runTui } = await import("./tui-
|
|
47
|
+
let { runTui } = await import("./tui-RVRDCIP4.mjs");
|
|
48
48
|
return await runTui(argv);
|
|
49
49
|
}
|
|
50
50
|
function urlFromArgv(argv) {
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
createOpenAI,
|
|
52
52
|
sliceWellFormed,
|
|
53
53
|
toWellFormed
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-BNXUAOO4.mjs";
|
|
55
55
|
import {
|
|
56
56
|
AISDKError,
|
|
57
57
|
APICallError,
|
|
@@ -97913,6 +97913,11 @@ function decodeJwtPayload(token) {
|
|
|
97913
97913
|
return {};
|
|
97914
97914
|
}
|
|
97915
97915
|
}
|
|
97916
|
+
function chatgptAccountIdFromJwt(token) {
|
|
97917
|
+
if (!token) return "";
|
|
97918
|
+
let claims = decodeJwtPayload(token), auth2 = claims["https://api.openai.com/auth"], id = (auth2 && typeof auth2 == "object" ? auth2.chatgpt_account_id : void 0) ?? claims.chatgpt_account_id;
|
|
97919
|
+
return typeof id == "string" ? id : "";
|
|
97920
|
+
}
|
|
97916
97921
|
async function openExternal(url) {
|
|
97917
97922
|
try {
|
|
97918
97923
|
let electron = __require("electron");
|
|
@@ -97946,11 +97951,12 @@ var ChatGptAuthManager = class {
|
|
|
97946
97951
|
this.syncFromDisk();
|
|
97947
97952
|
}
|
|
97948
97953
|
/**
|
|
97949
|
-
* Re-read the token file, picking up writes from
|
|
97954
|
+
* Re-read the token file, picking up writes from other processes.
|
|
97950
97955
|
*
|
|
97951
|
-
*
|
|
97952
|
-
*
|
|
97953
|
-
*
|
|
97956
|
+
* Each surface has its own file (see subscription-token-store), but several
|
|
97957
|
+
* processes can share one — e.g. an installed and a dev Studio, or a CLI
|
|
97958
|
+
* next to its daemon — and OpenAI rotates the refresh token on every
|
|
97959
|
+
* refresh, so acting on a cached copy can invalidate a sibling's session. Always reading is what prevents that; the file is
|
|
97954
97960
|
* well under a kilobyte and this runs once per LLM request.
|
|
97955
97961
|
*/
|
|
97956
97962
|
syncFromDisk() {
|
|
@@ -98048,16 +98054,10 @@ var ChatGptAuthManager = class {
|
|
|
98048
98054
|
let body = await tokenResponse.text();
|
|
98049
98055
|
throw new Error(`Token exchange failed (${tokenResponse.status}): ${body}`);
|
|
98050
98056
|
}
|
|
98051
|
-
let tokenData = await tokenResponse.json()
|
|
98052
|
-
|
|
98053
|
-
|
|
98054
|
-
|
|
98055
|
-
}
|
|
98056
|
-
if (!accountId) {
|
|
98057
|
-
let accessClaims = decodeJwtPayload(tokenData.access_token);
|
|
98058
|
-
accountId = accessClaims.chatgpt_account_id ?? accessClaims.sub ?? "", console.log(`[ChatGPT Auth] access_token fallback: chatgpt_account_id=${accountId}`);
|
|
98059
|
-
}
|
|
98060
|
-
this.persist({
|
|
98057
|
+
let tokenData = await tokenResponse.json();
|
|
98058
|
+
tokenData.id_token && (this.email = decodeJwtPayload(tokenData.id_token).email);
|
|
98059
|
+
let accountId = chatgptAccountIdFromJwt(tokenData.access_token) || chatgptAccountIdFromJwt(tokenData.id_token);
|
|
98060
|
+
console.log(`[ChatGPT Auth] signed in: email=${this.email}, chatgpt_account_id=${accountId || "(missing)"}`), this.persist({
|
|
98061
98061
|
access_token: tokenData.access_token,
|
|
98062
98062
|
refresh_token: tokenData.refresh_token,
|
|
98063
98063
|
expires_at: Date.now() + tokenData.expires_in * 1e3,
|
|
@@ -98073,7 +98073,8 @@ var ChatGptAuthManager = class {
|
|
|
98073
98073
|
}), this.refreshPromise);
|
|
98074
98074
|
}
|
|
98075
98075
|
getAccountId() {
|
|
98076
|
-
|
|
98076
|
+
let tokens = this.syncFromDisk();
|
|
98077
|
+
return chatgptAccountIdFromJwt(tokens?.access_token) || tokens?.account_id || void 0;
|
|
98077
98078
|
}
|
|
98078
98079
|
/**
|
|
98079
98080
|
* Re-check the file after winning the in-process refresh lock.
|
|
@@ -98087,7 +98088,7 @@ var ChatGptAuthManager = class {
|
|
|
98087
98088
|
return fresh && Date.now() + REFRESH_BUFFER_MS < fresh.expires_at ? fresh.access_token : this.refreshTokens(fresh ?? tokens);
|
|
98088
98089
|
}
|
|
98089
98090
|
async refreshTokens(tokens) {
|
|
98090
|
-
let data;
|
|
98091
|
+
let data, rejected = !1;
|
|
98091
98092
|
try {
|
|
98092
98093
|
let response = await fetch(TOKEN_URL, {
|
|
98093
98094
|
method: "POST",
|
|
@@ -98099,13 +98100,13 @@ var ChatGptAuthManager = class {
|
|
|
98099
98100
|
})
|
|
98100
98101
|
});
|
|
98101
98102
|
if (!response.ok)
|
|
98102
|
-
throw new Error(`Token refresh failed (${response.status})`);
|
|
98103
|
+
throw rejected = response.status === 400 || response.status === 401, new Error(`Token refresh failed (${response.status})`);
|
|
98103
98104
|
data = await response.json();
|
|
98104
|
-
} catch {
|
|
98105
|
+
} catch (err) {
|
|
98105
98106
|
let fresh = this.syncFromDisk();
|
|
98106
98107
|
if (fresh && fresh.refresh_token !== tokens.refresh_token && Date.now() + REFRESH_BUFFER_MS < fresh.expires_at)
|
|
98107
98108
|
return fresh.access_token;
|
|
98108
|
-
throw clearTokens(), this.cachedTokens = null, this.email = void 0, new Error("Session expired \u2014 please sign in again");
|
|
98109
|
+
throw rejected ? (clearTokens(), this.cachedTokens = null, this.email = void 0, new Error("Session expired \u2014 please sign in again")) : new Error(`Could not refresh the session (${err instanceof Error ? err.message : String(err)}) \u2014 still signed in, try again`);
|
|
98109
98110
|
}
|
|
98110
98111
|
if (data.id_token) {
|
|
98111
98112
|
let claims = decodeJwtPayload(data.id_token);
|
|
@@ -98115,7 +98116,7 @@ var ChatGptAuthManager = class {
|
|
|
98115
98116
|
access_token: data.access_token,
|
|
98116
98117
|
refresh_token: data.refresh_token,
|
|
98117
98118
|
expires_at: Date.now() + data.expires_in * 1e3,
|
|
98118
|
-
account_id: tokens.account_id
|
|
98119
|
+
account_id: chatgptAccountIdFromJwt(data.access_token) || chatgptAccountIdFromJwt(data.id_token) || tokens.account_id
|
|
98119
98120
|
}), data.access_token;
|
|
98120
98121
|
}
|
|
98121
98122
|
getAuthStatus() {
|
|
@@ -98306,7 +98307,7 @@ var GrokAuthManager = class {
|
|
|
98306
98307
|
return fresh && Date.now() + REFRESH_BUFFER_MS2 < fresh.expires_at ? fresh.access_token : this.refreshTokens(fresh ?? tokens);
|
|
98307
98308
|
}
|
|
98308
98309
|
async refreshTokens(tokens) {
|
|
98309
|
-
let data;
|
|
98310
|
+
let data, rejected = !1;
|
|
98310
98311
|
try {
|
|
98311
98312
|
let response = await fetch(TOKEN_URL2, {
|
|
98312
98313
|
method: "POST",
|
|
@@ -98318,13 +98319,13 @@ var GrokAuthManager = class {
|
|
|
98318
98319
|
}).toString()
|
|
98319
98320
|
});
|
|
98320
98321
|
if (!response.ok)
|
|
98321
|
-
throw new Error(`Token refresh failed (${response.status})`);
|
|
98322
|
+
throw rejected = response.status === 400 || response.status === 401, new Error(`Token refresh failed (${response.status})`);
|
|
98322
98323
|
data = await response.json();
|
|
98323
|
-
} catch {
|
|
98324
|
+
} catch (err) {
|
|
98324
98325
|
let fresh = this.syncFromDisk();
|
|
98325
98326
|
if (fresh && fresh.refresh_token !== tokens.refresh_token && Date.now() + REFRESH_BUFFER_MS2 < fresh.expires_at)
|
|
98326
98327
|
return fresh.access_token;
|
|
98327
|
-
throw clearTokens2(), this.cachedTokens = null, this.email = void 0, new Error("Session expired \u2014 please sign in again");
|
|
98328
|
+
throw rejected ? (clearTokens2(), this.cachedTokens = null, this.email = void 0, new Error("Session expired \u2014 please sign in again")) : new Error(`Could not refresh the session (${err instanceof Error ? err.message : String(err)}) \u2014 still signed in, try again`);
|
|
98328
98329
|
}
|
|
98329
98330
|
if (data.id_token) {
|
|
98330
98331
|
let claims = decodeJwtPayload2(data.id_token);
|
|
@@ -123660,7 +123661,7 @@ async function listProviderModels(runtime2, settingsStore, providerId, agentId)
|
|
|
123660
123661
|
let cfg = resolveModelListProviderConfig(runtime2, settingsStore, providerId, agentId);
|
|
123661
123662
|
if (!cfg) return { provider: providerId, models: [], error: `Provider "${providerId}" not found.` };
|
|
123662
123663
|
if (cfg.type === "chatgpt-subscription") {
|
|
123663
|
-
let { CHATGPT_SUBSCRIPTION_MODELS } = await import("./chatgpt-subscription-
|
|
123664
|
+
let { CHATGPT_SUBSCRIPTION_MODELS } = await import("./chatgpt-subscription-E4MXTIAT.mjs");
|
|
123664
123665
|
return { provider: providerId, models: [...CHATGPT_SUBSCRIPTION_MODELS] };
|
|
123665
123666
|
}
|
|
123666
123667
|
if (cfg.type === "grok-subscription") {
|
|
@@ -124317,8 +124318,9 @@ function createSettingsDefaults() {
|
|
|
124317
124318
|
// the one-time `agentTemplateForChildren` migration has already run.
|
|
124318
124319
|
theme: "light",
|
|
124319
124320
|
// Interface typeface preset + free-text family for 'custom'; see
|
|
124320
|
-
// UI_FONT_STACKS in the renderer's app.store.
|
|
124321
|
-
|
|
124321
|
+
// UI_FONT_STACKS in the renderer's app.store. 'inter-tight' is bundled;
|
|
124322
|
+
// older stores on 'system' move to it once (settings-migrations).
|
|
124323
|
+
uiFont: "inter-tight",
|
|
124322
124324
|
uiFontCustom: "",
|
|
124323
124325
|
// Electron zoom factor for the whole window (1 = 100%).
|
|
124324
124326
|
uiScale: 1,
|
|
@@ -124371,7 +124373,13 @@ Your private working memory (\`mind.md\`), snapshotted at the start of each sess
|
|
|
124371
124373
|
{{mind.md}}`;
|
|
124372
124374
|
function applySettingsMigrations(data) {
|
|
124373
124375
|
let changedKeys = /* @__PURE__ */ new Set();
|
|
124374
|
-
|
|
124376
|
+
migrateBuiltInAdapters(data) && changedKeys.add("adapters"), migrateComputeDefaults(data) && changedKeys.add("compute"), migrateToolPrompts(data) && changedKeys.add("toolPrompts"), migrateSkillsPromptPlaceholder(data) && changedKeys.add("toolPrompts"), migrateGlobalSystemPromptSoul(data) && changedKeys.add("globalSystemPrompt"), migrateGlobalSystemPromptMind(data) && changedKeys.add("globalSystemPrompt");
|
|
124377
|
+
for (let key of migrateUiFontBrandDefault(data)) changedKeys.add(key);
|
|
124378
|
+
return { changed: changedKeys.size > 0, changedKeys: [...changedKeys] };
|
|
124379
|
+
}
|
|
124380
|
+
var UI_FONT_BRAND_MIGRATION_KEY = "uiFontBrandDefaultApplied";
|
|
124381
|
+
function migrateUiFontBrandDefault(data) {
|
|
124382
|
+
return data[UI_FONT_BRAND_MIGRATION_KEY] === !0 ? [] : (data[UI_FONT_BRAND_MIGRATION_KEY] = !0, data.uiFont === void 0 || data.uiFont === "system" ? (data.uiFont = "inter-tight", [UI_FONT_BRAND_MIGRATION_KEY, "uiFont"]) : [UI_FONT_BRAND_MIGRATION_KEY]);
|
|
124375
124383
|
}
|
|
124376
124384
|
function mergeSettingsValue(current, key, value) {
|
|
124377
124385
|
return key === "compute" && value && typeof value == "object" && !Array.isArray(value) ? {
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
openProviderAdd,
|
|
13
13
|
openWelcome,
|
|
14
14
|
secretStoreReady
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QPLEAE6V.mjs";
|
|
16
16
|
import "./chunk-7CV2SA3H.mjs";
|
|
17
17
|
import "./chunk-I3UYSITV.mjs";
|
|
18
18
|
import "./chunk-SGUTYISF.mjs";
|
|
19
19
|
import "./chunk-5QU5VY7N.mjs";
|
|
20
20
|
import "./chunk-VMHTYDH4.mjs";
|
|
21
21
|
import "./chunk-3AT7IIP7.mjs";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-PRMGZZM5.mjs";
|
|
23
23
|
import "./chunk-6GJ4QHRI.mjs";
|
|
24
24
|
import "./chunk-UYY5M2PB.mjs";
|
|
25
25
|
import "./chunk-ZJKXHM4Q.mjs";
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
findTheme,
|
|
11
11
|
nextThemeName,
|
|
12
12
|
themeNames
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-KXEF4F4E.mjs";
|
|
14
|
+
import "./chunk-PRMGZZM5.mjs";
|
|
15
15
|
import "./chunk-6GJ4QHRI.mjs";
|
|
16
16
|
import "./chunk-M2RX3S2T.mjs";
|
|
17
17
|
export {
|
|
@@ -43,7 +43,7 @@ Options:
|
|
|
43
43
|
--view <id> Start view: chat | files | loops | inspect | fleet | runtime
|
|
44
44
|
--agent <id|handle> Preselect an agent
|
|
45
45
|
--loop <name> Preselect one of its loops (default main)
|
|
46
|
-
--theme <name> adf (dark) | adf-light | adf-contrast | adf-mono (also ADF_TUI_THEME)
|
|
46
|
+
--theme <name> adf (dark) | adf-light | adf-contrast | parchment | adf-mono (also ADF_TUI_THEME)
|
|
47
47
|
--mono No color (also NO_COLOR=1)
|
|
48
48
|
--ascii ASCII glyphs (also ADF_TUI_ASCII=1)
|
|
49
49
|
--no-alt-screen Render in the main screen buffer (also turns mouse mode off)
|
|
@@ -119,10 +119,10 @@ ${tuiUsage()}
|
|
|
119
119
|
] = await Promise.all([
|
|
120
120
|
import("./react-IUIDQ5LX.mjs"),
|
|
121
121
|
import("./build-QF5W473T.mjs"),
|
|
122
|
-
import("./App-
|
|
123
|
-
import("./themes-
|
|
122
|
+
import("./App-U2XSNHUV.mjs"),
|
|
123
|
+
import("./themes-YLXLOIJF.mjs"),
|
|
124
124
|
import("./store-HUVDJPYN.mjs"),
|
|
125
|
-
import("./theme-
|
|
125
|
+
import("./theme-SFE3JMA2.mjs"),
|
|
126
126
|
import("./terminal-O5WO7C5U.mjs"),
|
|
127
127
|
import("./layout-EPJQNFAI.mjs")
|
|
128
128
|
]), { installScreenMirror } = await import("./screen-54BUTYCW.mjs"), uninstallMirror = options.altScreen ? await installScreenMirror(io.stdout).catch(() => () => {
|
|
@@ -161,7 +161,7 @@ ${tuiUsage()}
|
|
|
161
161
|
store.start().then(async () => {
|
|
162
162
|
let { recordWelcomeLaunch } = await import("./welcome-XHXFV7SH.mjs");
|
|
163
163
|
if (recordWelcomeLaunch()) {
|
|
164
|
-
let { openWelcome } = await import("./open-
|
|
164
|
+
let { openWelcome } = await import("./open-VAU7PXT6.mjs");
|
|
165
165
|
openWelcome(store);
|
|
166
166
|
}
|
|
167
167
|
if (!options.agent) return;
|
package/package.json
CHANGED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
-
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __adfDirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
createTheme
|
|
9
|
-
} from "./chunk-EYX2YLJW.mjs";
|
|
10
|
-
|
|
11
|
-
// src/main/tui/commands/builtin/themes.ts
|
|
12
|
-
var ADF_DARK = { ...createTheme({ mono: !1, env: {} }).color }, ADF_LIGHT = {
|
|
13
|
-
text: "#2B2925",
|
|
14
|
-
muted: "#6B6456",
|
|
15
|
-
dim: "#A39C8E",
|
|
16
|
-
accent: "#A8641A",
|
|
17
|
-
live: "#1F7A70",
|
|
18
|
-
loop: "#6A4BB0",
|
|
19
|
-
user: "#A8641A",
|
|
20
|
-
assistant: "#2B2925",
|
|
21
|
-
thinking: "#8A8476",
|
|
22
|
-
tool: "#2F6DA8",
|
|
23
|
-
success: "#3F7F3A",
|
|
24
|
-
warn: "#9A6A00",
|
|
25
|
-
error: "#B83232",
|
|
26
|
-
info: "#2F6DA8",
|
|
27
|
-
border: "#C9C2B2",
|
|
28
|
-
borderFocus: "#A8641A",
|
|
29
|
-
selectionFg: "#FFFDF7",
|
|
30
|
-
selectionBg: "#A8641A",
|
|
31
|
-
surface: "#EFEADF",
|
|
32
|
-
overlay: "#F7F3EA"
|
|
33
|
-
}, ADF_CONTRAST = {
|
|
34
|
-
...ADF_DARK,
|
|
35
|
-
text: "#F2EEE4",
|
|
36
|
-
muted: "#C4BDAE",
|
|
37
|
-
dim: "#8C8577",
|
|
38
|
-
border: "#7A7466",
|
|
39
|
-
thinking: "#A8A294"
|
|
40
|
-
}, THEMES = [
|
|
41
|
-
{ name: "adf", label: "ADF dark", description: "Ink & parchment on a dark terminal (default)", colors: ADF_DARK },
|
|
42
|
-
{ name: "adf-light", label: "ADF light", description: "Ink on paper, for light terminal backgrounds", colors: ADF_LIGHT },
|
|
43
|
-
{ name: "adf-contrast", label: "ADF high contrast", description: "Brighter text and borders on dark backgrounds", colors: ADF_CONTRAST },
|
|
44
|
-
{ name: "adf-mono", label: "Mono", description: "No color (like NO_COLOR): bold and inverse carry emphasis", colors: void 0 }
|
|
45
|
-
], ALIASES = { dark: "adf", default: "adf", light: "adf-light", contrast: "adf-contrast", mono: "adf-mono", "no-color": "adf-mono" };
|
|
46
|
-
function findTheme(name) {
|
|
47
|
-
let wanted = name.trim().toLowerCase();
|
|
48
|
-
return THEMES.find((t) => t.name === (ALIASES[wanted] ?? wanted));
|
|
49
|
-
}
|
|
50
|
-
function nextThemeName(current) {
|
|
51
|
-
let at = THEMES.findIndex((t) => t.name === current);
|
|
52
|
-
return THEMES[(at + 1) % THEMES.length].name;
|
|
53
|
-
}
|
|
54
|
-
var MONO_COLORS = Object.fromEntries(Object.keys(ADF_DARK).map((k) => [k, void 0]));
|
|
55
|
-
function applyTheme(theme, choice) {
|
|
56
|
-
theme.name = choice.name, theme.mono = choice.colors === void 0, theme.color = { ...choice.colors ?? MONO_COLORS };
|
|
57
|
-
}
|
|
58
|
-
function themeNames() {
|
|
59
|
-
return THEMES.map((t) => t.name);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export {
|
|
63
|
-
THEMES,
|
|
64
|
-
findTheme,
|
|
65
|
-
nextThemeName,
|
|
66
|
-
applyTheme,
|
|
67
|
-
themeNames
|
|
68
|
-
};
|