gearbox-code 0.2.0 → 0.2.2
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 +74 -23
- 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)
|
|
@@ -143489,6 +143481,21 @@ function Panel({
|
|
|
143489
143481
|
r2.status
|
|
143490
143482
|
]
|
|
143491
143483
|
}, undefined, true, undefined, this),
|
|
143484
|
+
r2.detail ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
143485
|
+
color: color.faint,
|
|
143486
|
+
children: [
|
|
143487
|
+
" · ",
|
|
143488
|
+
r2.detail
|
|
143489
|
+
]
|
|
143490
|
+
}, undefined, true, undefined, this) : null,
|
|
143491
|
+
r2.type === "subscription" && !(r2.detail && r2.detail.includes("@")) ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
143492
|
+
color: color.accentDim,
|
|
143493
|
+
children: [
|
|
143494
|
+
" · /account login ",
|
|
143495
|
+
r2.alias,
|
|
143496
|
+
" to identify"
|
|
143497
|
+
]
|
|
143498
|
+
}, undefined, true, undefined, this) : null,
|
|
143492
143499
|
r2.active ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
143493
143500
|
color: color.ok,
|
|
143494
143501
|
children: [
|
|
@@ -146975,6 +146982,7 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
|
|
|
146975
146982
|
const [copiedNotice, setCopiedNotice] = import_react26.useState(null);
|
|
146976
146983
|
const copiedTimerRef = import_react26.useRef(null);
|
|
146977
146984
|
const outCharsRef = import_react26.useRef(0);
|
|
146985
|
+
const firstOutputAtRef = import_react26.useRef(0);
|
|
146978
146986
|
const [, bumpMotion] = import_react26.useReducer((x2) => x2 + 1, 0);
|
|
146979
146987
|
const [yolo2, setYoloState] = import_react26.useState(isYolo());
|
|
146980
146988
|
const [perm, setPermState] = import_react26.useState(null);
|
|
@@ -147768,7 +147776,7 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
|
|
|
147768
147776
|
status,
|
|
147769
147777
|
active: activeRow,
|
|
147770
147778
|
alias: accountSlug(a),
|
|
147771
|
-
detail: st?.signedIn ? st.detail : undefined,
|
|
147779
|
+
detail: (st?.signedIn ? st.detail : undefined) ?? a.identity?.label,
|
|
147772
147780
|
duplicateOf: st?.duplicateOf,
|
|
147773
147781
|
health: a.health?.state
|
|
147774
147782
|
};
|
|
@@ -147781,12 +147789,36 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
|
|
|
147781
147789
|
statusPad: Math.max(6, ...rows2.map((r2) => r2.status.length))
|
|
147782
147790
|
};
|
|
147783
147791
|
};
|
|
147792
|
+
const refreshCliStatuses = import_react26.useCallback(async () => {
|
|
147793
|
+
const accounts = listAccounts().filter((a) => a.exec === "cli");
|
|
147794
|
+
const statuses = { ...accountStatusCacheRef.current };
|
|
147795
|
+
await Promise.all(accounts.map(async (a) => {
|
|
147796
|
+
const bin = a.auth.binary;
|
|
147797
|
+
const profile = a.auth.loginProfile;
|
|
147798
|
+
try {
|
|
147799
|
+
const st = await cliAuthStatus(bin, profile);
|
|
147800
|
+
statuses[a.id] = { signedIn: st.loggedIn, detail: st.detail, identity: st.identity };
|
|
147801
|
+
if (st.loggedIn && st.identityLabel) {
|
|
147802
|
+
putAccount({ ...a, identity: { key: st.identity ?? a.id, label: st.identityLabel, checkedAt: Date.now() } });
|
|
147803
|
+
}
|
|
147804
|
+
} catch {}
|
|
147805
|
+
}));
|
|
147806
|
+
accountStatusCacheRef.current = statuses;
|
|
147807
|
+
}, []);
|
|
147784
147808
|
const askModeRef = import_react26.useRef(false);
|
|
147809
|
+
const lastRouteRef = import_react26.useRef("");
|
|
147810
|
+
const routeChanged = (key) => {
|
|
147811
|
+
const changed = key !== lastRouteRef.current;
|
|
147812
|
+
lastRouteRef.current = key;
|
|
147813
|
+
return changed;
|
|
147814
|
+
};
|
|
147785
147815
|
const runCliBackend = import_react26.useCallback(async (args) => {
|
|
147786
147816
|
const { binary, profile, modelId, accountId, efforts, label, pinned, prompt, messages, onEvent, signal } = args;
|
|
147787
147817
|
usedAccountRef.current = accountId;
|
|
147788
|
-
|
|
147789
|
-
|
|
147818
|
+
if (args.showProvenance !== false) {
|
|
147819
|
+
const detail = pinned ? `${binary}${label ? ` · ${label}` : ""} owns tools and permissions` : `${binary}${label ? ` · ${label}` : ""} subscription seat · own tools/permissions`;
|
|
147820
|
+
onEvent({ type: "phase", label: "using subscription", detail, state: "running" });
|
|
147821
|
+
}
|
|
147790
147822
|
const _cliEffortRaw = normalizeEffort(effortRef.current, efforts);
|
|
147791
147823
|
if (_cliEffortRaw === null && effortRef.current !== "medium") {
|
|
147792
147824
|
const { level: nearest } = clampEffort(effortRef.current, efforts);
|
|
@@ -147885,6 +147917,7 @@ ${map4}
|
|
|
147885
147917
|
efforts: cliChoice?.efforts ?? [],
|
|
147886
147918
|
label: cliModelLabel(activeCliModelRef.current) || undefined,
|
|
147887
147919
|
pinned: true,
|
|
147920
|
+
showProvenance: routeChanged(`pin:${pin.id}:${activeCliModelRef.current ?? pin.binary}`),
|
|
147888
147921
|
prompt,
|
|
147889
147922
|
messages,
|
|
147890
147923
|
onEvent,
|
|
@@ -147906,7 +147939,9 @@ ${map4}
|
|
|
147906
147939
|
return { ...cliImageGuard(), failure: { message: "image attachments need an API-backed model" }, cooldownKey: acct.id };
|
|
147907
147940
|
routedRef.current = { model: choice3.model, reason: choice3.reason };
|
|
147908
147941
|
setLastPick({ model: choice3.model, reason: choice3.reason });
|
|
147909
|
-
|
|
147942
|
+
const showCli = routeChanged(`cli:${acct.id}:${choice3.model.id}`);
|
|
147943
|
+
if (showCli)
|
|
147944
|
+
onEvent({ type: "model-pick", model: choice3.model.label, provider: choice3.model.provider, reason: choice3.reason });
|
|
147910
147945
|
const out = await runCliBackend({
|
|
147911
147946
|
binary: choice3.backend.binary,
|
|
147912
147947
|
profile: choice3.backend.profile,
|
|
@@ -147916,6 +147951,7 @@ ${map4}
|
|
|
147916
147951
|
label: choice3.model.label,
|
|
147917
147952
|
pinned: false,
|
|
147918
147953
|
deferTerminal: true,
|
|
147954
|
+
showProvenance: showCli,
|
|
147919
147955
|
prompt,
|
|
147920
147956
|
messages,
|
|
147921
147957
|
onEvent,
|
|
@@ -147928,7 +147964,9 @@ ${map4}
|
|
|
147928
147964
|
throw new Error(`${choice3.model.label} cannot run this turn (${missing.join(", ")} unsupported). Use /model auto or pick a compatible model.`);
|
|
147929
147965
|
routedRef.current = { model: choice3.model, reason: choice3.reason };
|
|
147930
147966
|
setLastPick({ model: choice3.model, reason: choice3.reason });
|
|
147931
|
-
|
|
147967
|
+
if (routeChanged(`api:${choice3.model.provider}:${choice3.model.id}`)) {
|
|
147968
|
+
onEvent({ type: "model-pick", model: choice3.model.label, provider: choice3.model.provider, reason: choice3.reason });
|
|
147969
|
+
}
|
|
147932
147970
|
onEvent({ type: "phase", label: "building context", detail: choice3.model.label, state: "running" });
|
|
147933
147971
|
const userContent = imageContent(prompt, activeImagesRef.current);
|
|
147934
147972
|
const { system, messages: ctx } = buildContext({ history: messages, userText: prompt, userContent, model: choice3.model, plan });
|
|
@@ -148136,6 +148174,7 @@ ${fetched.join(`
|
|
|
148136
148174
|
setSuggestion(null);
|
|
148137
148175
|
const turnStart = Date.now();
|
|
148138
148176
|
outCharsRef.current = 0;
|
|
148177
|
+
firstOutputAtRef.current = 0;
|
|
148139
148178
|
if (lingerRef.current)
|
|
148140
148179
|
clearTimeout(lingerRef.current);
|
|
148141
148180
|
setLinger(false);
|
|
@@ -148240,6 +148279,8 @@ ${fetched.join(`
|
|
|
148240
148279
|
push({ kind: "phase", id: idRef.current++, label: e2.label, detail: e2.detail, state: e2.state ?? "running" });
|
|
148241
148280
|
} else if (e2.type === "text") {
|
|
148242
148281
|
setMascotState("streaming");
|
|
148282
|
+
if (firstOutputAtRef.current === 0)
|
|
148283
|
+
firstOutputAtRef.current = Date.now();
|
|
148243
148284
|
outCharsRef.current += e2.text.length;
|
|
148244
148285
|
pendingText += e2.text;
|
|
148245
148286
|
if (!textFlushTimer)
|
|
@@ -148919,6 +148960,10 @@ Example: /mcp add github npx -y @modelcontextprotocol/server-github`);
|
|
|
148919
148960
|
case "account": {
|
|
148920
148961
|
if (!arg.trim() && fullscreen) {
|
|
148921
148962
|
setPanel({ kind: "accounts", title: "accounts · ⏎ to switch", index: 0 });
|
|
148963
|
+
refreshCliStatuses().then(() => {
|
|
148964
|
+
if (panelRef.current?.kind === "accounts")
|
|
148965
|
+
setPanel({ ...panelRef.current });
|
|
148966
|
+
});
|
|
148922
148967
|
return;
|
|
148923
148968
|
}
|
|
148924
148969
|
echo(text2);
|
|
@@ -149909,7 +149954,13 @@ Example: /mcp add github npx -y @modelcontextprotocol/server-github`);
|
|
|
149909
149954
|
skin: ghostSkin,
|
|
149910
149955
|
verb,
|
|
149911
149956
|
elapsed,
|
|
149912
|
-
tps:
|
|
149957
|
+
tps: (() => {
|
|
149958
|
+
const t0 = firstOutputAtRef.current;
|
|
149959
|
+
if (!t0)
|
|
149960
|
+
return 0;
|
|
149961
|
+
const secs = (Date.now() - t0) / 1000;
|
|
149962
|
+
return secs > 0.7 ? Math.round(outCharsRef.current / 4 / secs) : 0;
|
|
149963
|
+
})(),
|
|
149913
149964
|
linger: linger && !busy,
|
|
149914
149965
|
width
|
|
149915
149966
|
}, undefined, false, undefined, this) : null,
|
package/package.json
CHANGED