gearbox-code 0.2.1 → 0.2.3
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/cli.mjs +63 -27
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -135826,7 +135826,7 @@ var color = {
|
|
|
135826
135826
|
path: "#7DD3FC",
|
|
135827
135827
|
codeKeyword: "#7DD3FC",
|
|
135828
135828
|
codeString: "#A7F3D0",
|
|
135829
|
-
codeNumber: "#
|
|
135829
|
+
codeNumber: "#A5B4FC",
|
|
135830
135830
|
codeComment: "#4B5563",
|
|
135831
135831
|
codePunct: "#6B7280",
|
|
135832
135832
|
codeFunction: "#93C5FD",
|
|
@@ -135853,7 +135853,7 @@ var glyph = {
|
|
|
135853
135853
|
|
|
135854
135854
|
// src/ui/components/Banner.tsx
|
|
135855
135855
|
var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
135856
|
-
function Banner({
|
|
135856
|
+
function Banner({ cwd: cwd2, width }) {
|
|
135857
135857
|
const { stdout } = use_stdout_default();
|
|
135858
135858
|
const w = width ?? Math.min(stdout?.columns ?? 80, 100);
|
|
135859
135859
|
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
@@ -135870,13 +135870,10 @@ function Banner({ model, cwd: cwd2, width }) {
|
|
|
135870
135870
|
bold: true,
|
|
135871
135871
|
children: "gearbox"
|
|
135872
135872
|
}, undefined, false, undefined, this),
|
|
135873
|
-
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
135874
|
-
color: color.
|
|
135875
|
-
children:
|
|
135876
|
-
|
|
135877
|
-
cwd2 ? ` ${glyph.bullet} ${cwd2}` : ""
|
|
135878
|
-
]
|
|
135879
|
-
}, undefined, true, undefined, this)
|
|
135873
|
+
cwd2 ? /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
135874
|
+
color: color.faint,
|
|
135875
|
+
children: cwd2
|
|
135876
|
+
}, undefined, false, undefined, this) : null
|
|
135880
135877
|
]
|
|
135881
135878
|
}, undefined, true, undefined, this),
|
|
135882
135879
|
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
@@ -141960,7 +141957,6 @@ function Working({
|
|
|
141960
141957
|
const spinner = linger ? "●" : spinFrame(state);
|
|
141961
141958
|
const f3 = Math.floor(Date.now() / 360);
|
|
141962
141959
|
const dots = ["", ".", "..", "..."][f3 % 4];
|
|
141963
|
-
const phase = state === "tool" ? "using tools" : state === "streaming" ? "writing" : "thinking";
|
|
141964
141960
|
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
141965
141961
|
width,
|
|
141966
141962
|
paddingX: 1,
|
|
@@ -141980,12 +141976,8 @@ function Working({
|
|
|
141980
141976
|
label,
|
|
141981
141977
|
!linger ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
141982
141978
|
color: color.accentDim,
|
|
141983
|
-
children:
|
|
141984
|
-
|
|
141985
|
-
phase,
|
|
141986
|
-
dots
|
|
141987
|
-
]
|
|
141988
|
-
}, undefined, true, undefined, this) : null
|
|
141979
|
+
children: dots
|
|
141980
|
+
}, undefined, false, undefined, this) : null
|
|
141989
141981
|
]
|
|
141990
141982
|
}, undefined, true, undefined, this),
|
|
141991
141983
|
!linger ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
@@ -142000,7 +141992,7 @@ function Working({
|
|
|
142000
141992
|
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
142001
141993
|
color: color.faint,
|
|
142002
141994
|
children: [
|
|
142003
|
-
tps
|
|
141995
|
+
tps >= 5 ? ` · ~${tps} tok/s` : "",
|
|
142004
141996
|
" · esc to interrupt"
|
|
142005
141997
|
]
|
|
142006
141998
|
}, undefined, true, undefined, this)
|
|
@@ -146975,6 +146967,7 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
|
|
|
146975
146967
|
const notifyRef = import_react26.useRef(loadPrefs().notify !== false);
|
|
146976
146968
|
const firstRunRef = import_react26.useRef(!loadPrefs().onboarded);
|
|
146977
146969
|
const pasteStoreRef = import_react26.useRef(new Map);
|
|
146970
|
+
const pasteBufRef = import_react26.useRef(null);
|
|
146978
146971
|
const pasteIdRef = import_react26.useRef(0);
|
|
146979
146972
|
const copiedSelectionRef = import_react26.useRef("");
|
|
146980
146973
|
const mouseAnchorRef = import_react26.useRef(null);
|
|
@@ -146990,6 +146983,7 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
|
|
|
146990
146983
|
const [copiedNotice, setCopiedNotice] = import_react26.useState(null);
|
|
146991
146984
|
const copiedTimerRef = import_react26.useRef(null);
|
|
146992
146985
|
const outCharsRef = import_react26.useRef(0);
|
|
146986
|
+
const firstOutputAtRef = import_react26.useRef(0);
|
|
146993
146987
|
const [, bumpMotion] = import_react26.useReducer((x2) => x2 + 1, 0);
|
|
146994
146988
|
const [yolo2, setYoloState] = import_react26.useState(isYolo());
|
|
146995
146989
|
const [perm, setPermState] = import_react26.useState(null);
|
|
@@ -147813,11 +147807,19 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
|
|
|
147813
147807
|
accountStatusCacheRef.current = statuses;
|
|
147814
147808
|
}, []);
|
|
147815
147809
|
const askModeRef = import_react26.useRef(false);
|
|
147810
|
+
const lastRouteRef = import_react26.useRef("");
|
|
147811
|
+
const routeChanged = (key) => {
|
|
147812
|
+
const changed = key !== lastRouteRef.current;
|
|
147813
|
+
lastRouteRef.current = key;
|
|
147814
|
+
return changed;
|
|
147815
|
+
};
|
|
147816
147816
|
const runCliBackend = import_react26.useCallback(async (args) => {
|
|
147817
147817
|
const { binary, profile, modelId, accountId, efforts, label, pinned, prompt, messages, onEvent, signal } = args;
|
|
147818
147818
|
usedAccountRef.current = accountId;
|
|
147819
|
-
|
|
147820
|
-
|
|
147819
|
+
if (args.showProvenance !== false) {
|
|
147820
|
+
const detail = pinned ? `${binary}${label ? ` · ${label}` : ""} owns tools and permissions` : `${binary}${label ? ` · ${label}` : ""} subscription seat · own tools/permissions`;
|
|
147821
|
+
onEvent({ type: "phase", label: "using subscription", detail, state: "running" });
|
|
147822
|
+
}
|
|
147821
147823
|
const _cliEffortRaw = normalizeEffort(effortRef.current, efforts);
|
|
147822
147824
|
if (_cliEffortRaw === null && effortRef.current !== "medium") {
|
|
147823
147825
|
const { level: nearest } = clampEffort(effortRef.current, efforts);
|
|
@@ -147916,6 +147918,7 @@ ${map4}
|
|
|
147916
147918
|
efforts: cliChoice?.efforts ?? [],
|
|
147917
147919
|
label: cliModelLabel(activeCliModelRef.current) || undefined,
|
|
147918
147920
|
pinned: true,
|
|
147921
|
+
showProvenance: routeChanged(`pin:${pin.id}:${activeCliModelRef.current ?? pin.binary}`),
|
|
147919
147922
|
prompt,
|
|
147920
147923
|
messages,
|
|
147921
147924
|
onEvent,
|
|
@@ -147937,7 +147940,9 @@ ${map4}
|
|
|
147937
147940
|
return { ...cliImageGuard(), failure: { message: "image attachments need an API-backed model" }, cooldownKey: acct.id };
|
|
147938
147941
|
routedRef.current = { model: choice3.model, reason: choice3.reason };
|
|
147939
147942
|
setLastPick({ model: choice3.model, reason: choice3.reason });
|
|
147940
|
-
|
|
147943
|
+
const showCli = routeChanged(`cli:${acct.id}:${choice3.model.id}`);
|
|
147944
|
+
if (showCli)
|
|
147945
|
+
onEvent({ type: "model-pick", model: choice3.model.label, provider: choice3.model.provider, reason: choice3.reason });
|
|
147941
147946
|
const out = await runCliBackend({
|
|
147942
147947
|
binary: choice3.backend.binary,
|
|
147943
147948
|
profile: choice3.backend.profile,
|
|
@@ -147947,6 +147952,7 @@ ${map4}
|
|
|
147947
147952
|
label: choice3.model.label,
|
|
147948
147953
|
pinned: false,
|
|
147949
147954
|
deferTerminal: true,
|
|
147955
|
+
showProvenance: showCli,
|
|
147950
147956
|
prompt,
|
|
147951
147957
|
messages,
|
|
147952
147958
|
onEvent,
|
|
@@ -147959,7 +147965,9 @@ ${map4}
|
|
|
147959
147965
|
throw new Error(`${choice3.model.label} cannot run this turn (${missing.join(", ")} unsupported). Use /model auto or pick a compatible model.`);
|
|
147960
147966
|
routedRef.current = { model: choice3.model, reason: choice3.reason };
|
|
147961
147967
|
setLastPick({ model: choice3.model, reason: choice3.reason });
|
|
147962
|
-
|
|
147968
|
+
if (routeChanged(`api:${choice3.model.provider}:${choice3.model.id}`)) {
|
|
147969
|
+
onEvent({ type: "model-pick", model: choice3.model.label, provider: choice3.model.provider, reason: choice3.reason });
|
|
147970
|
+
}
|
|
147963
147971
|
onEvent({ type: "phase", label: "building context", detail: choice3.model.label, state: "running" });
|
|
147964
147972
|
const userContent = imageContent(prompt, activeImagesRef.current);
|
|
147965
147973
|
const { system, messages: ctx } = buildContext({ history: messages, userText: prompt, userContent, model: choice3.model, plan });
|
|
@@ -148107,7 +148115,7 @@ ${map4}
|
|
|
148107
148115
|
process.stdout.write("\x1B[?1049h\x1B[2J\x1B[H");
|
|
148108
148116
|
if (process.env.GEARBOX_MOUSE !== "0")
|
|
148109
148117
|
process.stdout.write("\x1B[?1000h\x1B[?1002h\x1B[?1006h");
|
|
148110
|
-
process.stdout.write("\x1B[?
|
|
148118
|
+
process.stdout.write("\x1B[?2004h\x1B[?25l");
|
|
148111
148119
|
setRawMode?.(true);
|
|
148112
148120
|
}
|
|
148113
148121
|
};
|
|
@@ -148167,6 +148175,7 @@ ${fetched.join(`
|
|
|
148167
148175
|
setSuggestion(null);
|
|
148168
148176
|
const turnStart = Date.now();
|
|
148169
148177
|
outCharsRef.current = 0;
|
|
148178
|
+
firstOutputAtRef.current = 0;
|
|
148170
148179
|
if (lingerRef.current)
|
|
148171
148180
|
clearTimeout(lingerRef.current);
|
|
148172
148181
|
setLinger(false);
|
|
@@ -148271,6 +148280,8 @@ ${fetched.join(`
|
|
|
148271
148280
|
push({ kind: "phase", id: idRef.current++, label: e2.label, detail: e2.detail, state: e2.state ?? "running" });
|
|
148272
148281
|
} else if (e2.type === "text") {
|
|
148273
148282
|
setMascotState("streaming");
|
|
148283
|
+
if (firstOutputAtRef.current === 0)
|
|
148284
|
+
firstOutputAtRef.current = Date.now();
|
|
148274
148285
|
outCharsRef.current += e2.text.length;
|
|
148275
148286
|
pendingText += e2.text;
|
|
148276
148287
|
if (!textFlushTimer)
|
|
@@ -149414,6 +149425,25 @@ Example: /mcp add github npx -y @modelcontextprotocol/server-github`);
|
|
|
149414
149425
|
use_input_default((input, key) => {
|
|
149415
149426
|
if (/\[<\d+;\d+;\d+[Mm]/.test(input))
|
|
149416
149427
|
return;
|
|
149428
|
+
if (pasteBufRef.current !== null || input.includes("\x1B[200~")) {
|
|
149429
|
+
pasteBufRef.current = (pasteBufRef.current ?? "") + input;
|
|
149430
|
+
if (!pasteBufRef.current.includes("\x1B[201~"))
|
|
149431
|
+
return;
|
|
149432
|
+
const clean = sanitizeInputText(pasteBufRef.current.replace(/\x1b\[20[01]~/g, ""));
|
|
149433
|
+
pasteBufRef.current = null;
|
|
149434
|
+
const e2 = editRef.current;
|
|
149435
|
+
const lines2 = clean.split(`
|
|
149436
|
+
`).length;
|
|
149437
|
+
if (clean.length > 400 || lines2 > 4) {
|
|
149438
|
+
const id = ++pasteIdRef.current;
|
|
149439
|
+
const ph = `[Pasted #${id}: ${lines2} line${lines2 === 1 ? "" : "s"} · ${clean.length.toLocaleString()} chars]`;
|
|
149440
|
+
pasteStoreRef.current.set(ph, clean);
|
|
149441
|
+
setEdit({ value: e2.value.slice(0, e2.cursor) + ph + e2.value.slice(e2.cursor), cursor: e2.cursor + ph.length });
|
|
149442
|
+
} else {
|
|
149443
|
+
setEdit({ value: e2.value.slice(0, e2.cursor) + clean + e2.value.slice(e2.cursor), cursor: e2.cursor + clean.length });
|
|
149444
|
+
}
|
|
149445
|
+
return;
|
|
149446
|
+
}
|
|
149417
149447
|
if (permRef.current) {
|
|
149418
149448
|
if (input === "1")
|
|
149419
149449
|
resolvePerm("once");
|
|
@@ -149659,14 +149689,14 @@ Example: /mcp add github npx -y @modelcontextprotocol/server-github`);
|
|
|
149659
149689
|
return;
|
|
149660
149690
|
}
|
|
149661
149691
|
}
|
|
149662
|
-
if (!busyRef.current &&
|
|
149663
|
-
`))
|
|
149692
|
+
if (!busyRef.current && input.length > 240 && input.includes(`
|
|
149693
|
+
`)) {
|
|
149664
149694
|
const clean = sanitizeInputText(input);
|
|
149665
149695
|
const lines2 = clean.split(`
|
|
149666
149696
|
`).length;
|
|
149667
149697
|
if (lines2 > 4 || clean.length > 400) {
|
|
149668
149698
|
const id = ++pasteIdRef.current;
|
|
149669
|
-
const ph = `[Pasted #${id}: ${lines2} line${lines2
|
|
149699
|
+
const ph = `[Pasted #${id}: ${lines2} line${lines2 === 1 ? "" : "s"} · ${clean.length.toLocaleString()} chars]`;
|
|
149670
149700
|
pasteStoreRef.current.set(ph, clean);
|
|
149671
149701
|
const e2 = editRef.current;
|
|
149672
149702
|
setEdit({ value: e2.value.slice(0, e2.cursor) + ph + e2.value.slice(e2.cursor), cursor: e2.cursor + ph.length });
|
|
@@ -149944,7 +149974,13 @@ Example: /mcp add github npx -y @modelcontextprotocol/server-github`);
|
|
|
149944
149974
|
skin: ghostSkin,
|
|
149945
149975
|
verb,
|
|
149946
149976
|
elapsed,
|
|
149947
|
-
tps:
|
|
149977
|
+
tps: (() => {
|
|
149978
|
+
const t0 = firstOutputAtRef.current;
|
|
149979
|
+
if (!t0)
|
|
149980
|
+
return 0;
|
|
149981
|
+
const secs = (Date.now() - t0) / 1000;
|
|
149982
|
+
return secs > 0.7 ? Math.round(outCharsRef.current / 4 / secs) : 0;
|
|
149983
|
+
})(),
|
|
149948
149984
|
linger: linger && !busy,
|
|
149949
149985
|
width
|
|
149950
149986
|
}, undefined, false, undefined, this) : null,
|
|
@@ -150612,7 +150648,7 @@ process.once("SIGTERM", () => {
|
|
|
150612
150648
|
process.exit(0);
|
|
150613
150649
|
});
|
|
150614
150650
|
if (process.stdout.isTTY)
|
|
150615
|
-
process.stdout.write("\x1B[?
|
|
150651
|
+
process.stdout.write("\x1B[?2004h\x1B[?25l");
|
|
150616
150652
|
if (fullscreen)
|
|
150617
150653
|
process.stdout.write("\x1B[?1049h\x1B[2J\x1B[H");
|
|
150618
150654
|
if (mouse)
|
package/package.json
CHANGED