gearbox-code 0.2.1 → 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.
Files changed (2) hide show
  1. package/dist/cli.mjs +38 -22
  2. 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: "#FDA4AF",
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({ model, cwd: cwd2, width }) {
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.dim,
135875
- children: [
135876
- model,
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 > 0 ? ` · ~${tps} tok/s` : "",
141995
+ tps >= 5 ? ` · ~${tps} tok/s` : "",
142004
141996
  " · esc to interrupt"
142005
141997
  ]
142006
141998
  }, undefined, true, undefined, this)
@@ -146990,6 +146982,7 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
146990
146982
  const [copiedNotice, setCopiedNotice] = import_react26.useState(null);
146991
146983
  const copiedTimerRef = import_react26.useRef(null);
146992
146984
  const outCharsRef = import_react26.useRef(0);
146985
+ const firstOutputAtRef = import_react26.useRef(0);
146993
146986
  const [, bumpMotion] = import_react26.useReducer((x2) => x2 + 1, 0);
146994
146987
  const [yolo2, setYoloState] = import_react26.useState(isYolo());
146995
146988
  const [perm, setPermState] = import_react26.useState(null);
@@ -147813,11 +147806,19 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
147813
147806
  accountStatusCacheRef.current = statuses;
147814
147807
  }, []);
147815
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
+ };
147816
147815
  const runCliBackend = import_react26.useCallback(async (args) => {
147817
147816
  const { binary, profile, modelId, accountId, efforts, label, pinned, prompt, messages, onEvent, signal } = args;
147818
147817
  usedAccountRef.current = accountId;
147819
- const detail = pinned ? `${binary}${label ? ` · ${label}` : ""} owns tools and permissions` : `${binary}${label ? ` · ${label}` : ""} subscription · seat (~free) owns tools and permissions`;
147820
- onEvent({ type: "phase", label: "using subscription", detail, state: "running" });
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
+ }
147821
147822
  const _cliEffortRaw = normalizeEffort(effortRef.current, efforts);
147822
147823
  if (_cliEffortRaw === null && effortRef.current !== "medium") {
147823
147824
  const { level: nearest } = clampEffort(effortRef.current, efforts);
@@ -147916,6 +147917,7 @@ ${map4}
147916
147917
  efforts: cliChoice?.efforts ?? [],
147917
147918
  label: cliModelLabel(activeCliModelRef.current) || undefined,
147918
147919
  pinned: true,
147920
+ showProvenance: routeChanged(`pin:${pin.id}:${activeCliModelRef.current ?? pin.binary}`),
147919
147921
  prompt,
147920
147922
  messages,
147921
147923
  onEvent,
@@ -147937,7 +147939,9 @@ ${map4}
147937
147939
  return { ...cliImageGuard(), failure: { message: "image attachments need an API-backed model" }, cooldownKey: acct.id };
147938
147940
  routedRef.current = { model: choice3.model, reason: choice3.reason };
147939
147941
  setLastPick({ model: choice3.model, reason: choice3.reason });
147940
- onEvent({ type: "model-pick", model: choice3.model.label, provider: choice3.model.provider, reason: choice3.reason });
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 });
147941
147945
  const out = await runCliBackend({
147942
147946
  binary: choice3.backend.binary,
147943
147947
  profile: choice3.backend.profile,
@@ -147947,6 +147951,7 @@ ${map4}
147947
147951
  label: choice3.model.label,
147948
147952
  pinned: false,
147949
147953
  deferTerminal: true,
147954
+ showProvenance: showCli,
147950
147955
  prompt,
147951
147956
  messages,
147952
147957
  onEvent,
@@ -147959,7 +147964,9 @@ ${map4}
147959
147964
  throw new Error(`${choice3.model.label} cannot run this turn (${missing.join(", ")} unsupported). Use /model auto or pick a compatible model.`);
147960
147965
  routedRef.current = { model: choice3.model, reason: choice3.reason };
147961
147966
  setLastPick({ model: choice3.model, reason: choice3.reason });
147962
- onEvent({ type: "model-pick", model: choice3.model.label, provider: choice3.model.provider, reason: choice3.reason });
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
+ }
147963
147970
  onEvent({ type: "phase", label: "building context", detail: choice3.model.label, state: "running" });
147964
147971
  const userContent = imageContent(prompt, activeImagesRef.current);
147965
147972
  const { system, messages: ctx } = buildContext({ history: messages, userText: prompt, userContent, model: choice3.model, plan });
@@ -148167,6 +148174,7 @@ ${fetched.join(`
148167
148174
  setSuggestion(null);
148168
148175
  const turnStart = Date.now();
148169
148176
  outCharsRef.current = 0;
148177
+ firstOutputAtRef.current = 0;
148170
148178
  if (lingerRef.current)
148171
148179
  clearTimeout(lingerRef.current);
148172
148180
  setLinger(false);
@@ -148271,6 +148279,8 @@ ${fetched.join(`
148271
148279
  push({ kind: "phase", id: idRef.current++, label: e2.label, detail: e2.detail, state: e2.state ?? "running" });
148272
148280
  } else if (e2.type === "text") {
148273
148281
  setMascotState("streaming");
148282
+ if (firstOutputAtRef.current === 0)
148283
+ firstOutputAtRef.current = Date.now();
148274
148284
  outCharsRef.current += e2.text.length;
148275
148285
  pendingText += e2.text;
148276
148286
  if (!textFlushTimer)
@@ -149944,7 +149954,13 @@ Example: /mcp add github npx -y @modelcontextprotocol/server-github`);
149944
149954
  skin: ghostSkin,
149945
149955
  verb,
149946
149956
  elapsed,
149947
- tps: elapsed > 0 ? Math.round(outCharsRef.current / 4 / elapsed) : 0,
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
+ })(),
149948
149964
  linger: linger && !busy,
149949
149965
  width
149950
149966
  }, undefined, false, undefined, this) : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gearbox-code",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A beautiful multi-provider coding harness for the terminal. (Intelligent model routing lands on top of this soon.)",
5
5
  "type": "module",
6
6
  "license": "MIT",