tensor-cli 0.1.7-beta-lite → 0.1.8-beta-lite

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 (3) hide show
  1. package/dist/cli.js +359000 -0
  2. package/dist/index.js +271 -228
  3. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -330665,7 +330665,13 @@ var VALID_TOOLS = new Set([
330665
330665
  "write",
330666
330666
  "edit",
330667
330667
  "append",
330668
- "shell"
330668
+ "shell",
330669
+ "web_search",
330670
+ "bg_start",
330671
+ "bg_list",
330672
+ "bg_logs",
330673
+ "bg_kill",
330674
+ "ask_user_question"
330669
330675
  ]);
330670
330676
  function errorMessage(e2) {
330671
330677
  if (e2 instanceof Error)
@@ -341372,6 +341378,10 @@ class HarnessOrchestrator {
341372
341378
  activeInterrupted;
341373
341379
  isCancelled = () => this.activeInterrupted?.current === true;
341374
341380
  toolDiffs = new Map;
341381
+ headless = false;
341382
+ autoApprove = false;
341383
+ lastAnswer = "";
341384
+ lastProviderError = null;
341375
341385
  getToolDiff(id) {
341376
341386
  return this.toolDiffs.get(id);
341377
341387
  }
@@ -341516,8 +341526,6 @@ ${draft}
341516
341526
  ` + `Return the corrected ${a2.tool === "append" ? "text to append" : "complete file"}. ` + `Fix only the listed problems and keep everything else unchanged.`
341517
341527
  }
341518
341528
  ], 0.2, CONTENT_MAX_TOKENS);
341519
- if (res.content.startsWith("AGENT LOOP FAILED"))
341520
- return "";
341521
341529
  let text = res.content.replace(/^```[a-z]*\n?|\n?```$/g, "").trim();
341522
341530
  const { unwrapped, wasWrapper } = tryUnwrapDecisionJson(text);
341523
341531
  if (wasWrapper)
@@ -342162,25 +342170,6 @@ If this satisfies the task, return {"tool": null}.`
342162
342170
  static SEMANTIC_TOP_K = 5;
342163
342171
  static SEMANTIC_MIN_SCORE = 0.25;
342164
342172
  static SEMANTIC_SNIPPET_CHARS = 600;
342165
- async buildSemanticContext(query) {
342166
- if (!isSemanticEngineReady())
342167
- return "";
342168
- if (query.trim().split(/\s+/).length < 3)
342169
- return "";
342170
- try {
342171
- const hits = (await searchCodebase(query.slice(0, 1000), HarnessOrchestrator.SEMANTIC_TOP_K)).filter((h) => h.score >= HarnessOrchestrator.SEMANTIC_MIN_SCORE);
342172
- if (hits.length === 0)
342173
- return "";
342174
- const body = hits.map((h) => `--- ${h.file}:${h.startLine}-${h.endLine} (score ${h.score.toFixed(2)}) ---
342175
- ` + h.text.slice(0, HarnessOrchestrator.SEMANTIC_SNIPPET_CHARS)).join(`
342176
- `);
342177
- return `===== RELEVANT CODE (semantic search; excerpts may be partial or stale, read the file before editing) =====
342178
- ${body}
342179
- `;
342180
- } catch {
342181
- return "";
342182
- }
342183
- }
342184
342173
  recordToolCall(step, d2) {
342185
342174
  const rec = {
342186
342175
  id: ++this.toolCallSeq,
@@ -342573,6 +342562,7 @@ Reply directly to the user. Never describe or classify their message (e.g. "this
342573
342562
  this.appendResult(ctx2, chunk.delta);
342574
342563
  yield { delta: chunk.delta };
342575
342564
  }
342565
+ this.lastAnswer = (ctx2.lastSynthesis || ctx2.result).trim();
342576
342566
  } catch {}
342577
342567
  if (streamed) {
342578
342568
  ctx2.escalate = true;
@@ -342656,6 +342646,14 @@ ${this.formatReminder()}` };
342656
342646
  async* runAskTool(ctx, step, ask) {
342657
342647
  const label = ask.ignore ? "ignore" : ask.questions.map((q) => q.question).join(" | ");
342658
342648
  const call = this.recordToolCall(step, { tool: "ask_user_question", cmd: label });
342649
+ if (this.headless) {
342650
+ this.settleToolCall(call, "refused", "no user available (headless run)");
342651
+ ctx.contextMessages.push({
342652
+ role: "user",
342653
+ content: `[System] QUESTIONS: this is a non-interactive run and nobody can answer. Proceed with the safest reasonable interpretation, state the assumption in your final answer, and do not ask again.`
342654
+ });
342655
+ return { stop: false };
342656
+ }
342659
342657
  if (ask.ignore) {
342660
342658
  const had = this.resetQuestions(ctx.contextMessages);
342661
342659
  this.settleToolCall(call, "ok", had ? "pending questions dropped" : "nothing to drop");
@@ -342969,7 +342967,8 @@ Do not include prose before or after the JSON. Output ONLY the JSON object.`;
342969
342967
  `
342970
342968
  };
342971
342969
  }
342972
- const jsonText = extractFirstJsonObject(res.content);
342970
+ const unfenced = res.content.replace(/^\s*```(?:json)?\s*/i, "").replace(/```\s*$/, "");
342971
+ const jsonText = extractFirstJsonObject(unfenced);
342973
342972
  let parsed = null;
342974
342973
  if (jsonText) {
342975
342974
  try {
@@ -343277,6 +343276,17 @@ I didn't quite get that am having this issue:${issueSummary},please retry in 30
343277
343276
  if (shellRisk.tier === "confirm" && !decision.requires_confirmation) {
343278
343277
  decision = { ...decision, requires_confirmation: true };
343279
343278
  }
343279
+ if (shellRisk.tier === "confirm" && this.headless && !this.autoApprove) {
343280
+ this.settleToolCall(call, "refused", "needs approval (headless, no --yes)");
343281
+ yield { delta: `- Not run (needs approval, pass --yes to allow): ${decision.cmd}
343282
+
343283
+ ` };
343284
+ ctx.contextMessages.push({
343285
+ role: "user",
343286
+ content: `[System] "${decision.cmd}" needs user approval and this is a non-interactive run, so it did NOT run. Use a safer alternative or return {"tool": null}.`
343287
+ });
343288
+ continue;
343289
+ }
343280
343290
  }
343281
343291
  if ((decision.tool === "write" || decision.tool === "append") && (!decision.content || decision.content.trim() === "")) {
343282
343292
  let priorFileSnapshot = "";
@@ -343439,7 +343449,13 @@ ${indent}`);
343439
343449
  const lead = (decision.tool === "shell" || decision.tool === "web_search") && decision.reasoning ? `${decision.reasoning}
343440
343450
 
343441
343451
  ` : "";
343442
- yield { delta: `${lead}${call ? this.emitTool(call, arg) : ""}` };
343452
+ let runningMarker = "";
343453
+ if (call) {
343454
+ try {
343455
+ runningMarker = this.emitTool(call, arg);
343456
+ } catch {}
343457
+ }
343458
+ yield { delta: `${lead}${runningMarker}` };
343443
343459
  if (decision.tool === "write" || decision.tool === "append") {
343444
343460
  const dir = dirname3(filePath);
343445
343461
  if (!knownDirs.has(dir)) {
@@ -343564,23 +343580,41 @@ ${truncateForContext(combined)}`;
343564
343580
  case "web_search": {
343565
343581
  const query = (decision.content ?? "").trim();
343566
343582
  toolOutput = await webSearch(query, searchBudget);
343567
- if (!WEB_SEARCH_FAILED_RE.test(toolOutput)) {
343583
+ if (WEB_SEARCH_FAILED_RE.test(toolOutput)) {
343584
+ yield {
343585
+ delta: `- Web search is experiencing high demand right now \u2014 please retry in about 3 minutes.
343586
+
343587
+ `
343588
+ };
343589
+ } else {
343568
343590
  ctx.completedActions.push(`Searched the web: ${query.slice(0, 120)}`);
343569
343591
  }
343570
343592
  break;
343571
343593
  }
343572
343594
  default: {
343573
- toolOutput = `Unknown tool: ${String(decision.tool)}`;
343595
+ toolOutput = "Unknown tool requested. I didn't quite get that \u2014 can you restate exactly what you meant? " + `Valid tools: ${[...VALID_TOOLS].join(", ")}.`;
343596
+ yield {
343597
+ delta: `- I didn't quite get that \u2014 can you restate exactly what you meant?
343598
+
343599
+ `
343600
+ };
343574
343601
  break;
343575
343602
  }
343576
343603
  }
343577
343604
  const failed = /^(Failed|Edit failed|Unknown tool|Write skipped|Append skipped)/.test(toolOutput) || WEB_SEARCH_FAILED_RE.test(toolOutput) || decision.tool === "shell" && /^Exit code (?!0\b)/.test(toolOutput);
343578
- if (snap && mutationSucceeded && call)
343579
- this.recordToolDiff(call.id, getDiffSince(snap));
343605
+ if (snap && mutationSucceeded && call) {
343606
+ try {
343607
+ this.recordToolDiff(call.id, getDiffSince(snap));
343608
+ } catch {}
343609
+ }
343580
343610
  this.settleToolCall(call, failed ? "failed" : "ok", toolOutput.slice(0, 200));
343581
343611
  if (call) {
343582
- const summary = summarizeTool(decision.tool, toolOutput, failed, readRaw === null ? 0 : countLines(readRaw));
343583
- yield { delta: this.emitTool(call, arg, summary) };
343612
+ let marker = null;
343613
+ try {
343614
+ marker = this.emitTool(call, arg, summarizeTool(decision.tool, toolOutput, failed, readRaw === null ? countLines(toolOutput) : countLines(readRaw)));
343615
+ } catch {}
343616
+ if (marker)
343617
+ yield { delta: marker };
343584
343618
  }
343585
343619
  const outputLabel = decision.tool === "shell" ? `shell: ${decision.cmd}` : decision.tool === "web_search" ? `web_search: ${decision.content}` : `${decision.tool} on ${displayPath}`;
343586
343620
  const outMsg = {
@@ -343827,6 +343861,10 @@ Do not include JSON, schema, or XML tool-call syntax in this response.`
343827
343861
  }
343828
343862
  }
343829
343863
  }
343864
+ providerFor = async (modelId) => {
343865
+ const { providerName, apiKey: apiKey2 } = await this.resolveActiveProvider(modelId);
343866
+ return { providerName, hasKey: apiKey2 !== "" };
343867
+ };
343830
343868
  async resolveActiveProvider(modelId, providerOverride) {
343831
343869
  if (providerOverride) {
343832
343870
  const store2 = readProviderStore();
@@ -343903,10 +343941,17 @@ Do not include JSON, schema, or XML tool-call syntax in this response.`
343903
343941
  const out = await this.connection.run(() => this.dispatchDirectCall(provider, modelId, apiKey2, messages, temperature, maxTokens), { isCancelled: this.isCancelled });
343904
343942
  this.recordOutput(out.length);
343905
343943
  return out;
343906
- } catch {
343907
- return "AGENT LOOP FAILED : Please connect to the internet(if connected retry again in 30sec) or Check your provider credits";
343944
+ } catch (err) {
343945
+ return this.describeProviderFailure(err);
343908
343946
  }
343909
343947
  }
343948
+ describeProviderFailure(err) {
343949
+ const raw = errorMessage(err).replace(/\s+/g, " ").trim();
343950
+ const detail = raw.slice(0, 200);
343951
+ const code = detail.match(/\b(400|401|403|404|429)\b/)?.[1] ?? "";
343952
+ const hint = code === "401" || /unauthor|invalid.{0,10}key|api[\s_-]?key/i.test(detail) ? "your API key was rejected (401) \u2014 re-link it with /provider" : code === "403" || /forbidden|permission|not allowed/i.test(detail) ? "access denied (403) \u2014 this key has no access to that model" : code === "404" || /not found|does not exist/i.test(detail) ? "model or endpoint not found (404) \u2014 pick another model with /model" : code === "429" || /rate.?limit|quota|insufficient|credit|balance|payment/i.test(detail) ? "low credits or rate limited (429) \u2014 top up or retry later" : "couldn't reach the provider \u2014 check your API key, credits, or connection";
343953
+ return `${hint}${detail ? ` (${detail})` : ""}`;
343954
+ }
343910
343955
  async* executeStreamCall(provider, modelId, apiKey2, rawMessages, temperature, maxTokens = 5700, stopSequences) {
343911
343956
  this.recordRequest(rawMessages);
343912
343957
  let outChars = 0;
@@ -344808,7 +344853,7 @@ var ModelProvider = ({ children }) => {
344808
344853
  ...m,
344809
344854
  type: "error",
344810
344855
  retryable: true,
344811
- msg: `${modelLabel} returned an empty response.`
344856
+ msg: `${modelLabel} sent back nothing. That usually means the provider rejected the request \u2014 ` + "check your API key (401/403), the model name (404), or your account credits (402), then retry."
344812
344857
  } : m));
344813
344858
  toast?.show(`${modelLabel} returned nothing \u2014 try another model with /model`, "error");
344814
344859
  }
@@ -345172,7 +345217,7 @@ var index2 = () => {
345172
345217
  var RootLayout_default = index2;
345173
345218
 
345174
345219
  // src/layouts/screens/Home.tsx
345175
- var import_react44 = __toESM(require_react(), 1);
345220
+ var import_react45 = __toESM(require_react(), 1);
345176
345221
 
345177
345222
  // src/components/Header.tsx
345178
345223
  var import_react31 = __toESM(require_react(), 1);
@@ -345220,7 +345265,7 @@ var Header = () => {
345220
345265
  }, undefined, false, undefined, this),
345221
345266
  /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
345222
345267
  fg: t2.inkFaint,
345223
- children: "v0.1.7@beta-lite"
345268
+ children: "v0.1.8@beta-lite"
345224
345269
  }, undefined, false, undefined, this)
345225
345270
  ]
345226
345271
  }, undefined, true, undefined, this),
@@ -345267,7 +345312,7 @@ var Header_default = Header;
345267
345312
  import { existsSync as existsSync2 } from "fs";
345268
345313
  import path18, { resolve } from "path";
345269
345314
  import { decodePasteBytes } from "@opentui/core";
345270
- var import_react43 = __toESM(require_react(), 1);
345315
+ var import_react44 = __toESM(require_react(), 1);
345271
345316
 
345272
345317
  // src/hooks/useThemeMode.ts
345273
345318
  var import_react33 = __toESM(require_react(), 1);
@@ -353523,7 +353568,7 @@ var Menu = ({
353523
353568
  var Menu_default = Menu;
353524
353569
 
353525
353570
  // src/components/StatusBar/index.tsx
353526
- var import_react38 = __toESM(require_react(), 1);
353571
+ var import_react39 = __toESM(require_react(), 1);
353527
353572
  import { TextAttributes as TextAttributes3 } from "@opentui/core";
353528
353573
 
353529
353574
  // src/constants/anthropic-models-contex-window.ts
@@ -355548,12 +355593,83 @@ function formatNumber(num) {
355548
355593
  return num.toString();
355549
355594
  }
355550
355595
 
355596
+ // src/components/Computing/index.tsx
355597
+ var import_react38 = __toESM(require_react(), 1);
355598
+ var lerp = (a3, b, t2) => Math.round(a3 + (b - a3) * t2);
355599
+ var toHex = (r, g2, b) => `#${[r, g2, b].map((v) => v.toString(16).padStart(2, "0")).join("")}`;
355600
+ var hexToRgb = (hex3) => {
355601
+ const h2 = hex3.replace("#", "");
355602
+ return [parseInt(h2.slice(0, 2), 16), parseInt(h2.slice(2, 4), 16), parseInt(h2.slice(4, 6), 16)];
355603
+ };
355604
+ var SWEEP_WIDTH = 3;
355605
+ var SWEEP_TICK_MS = 30;
355606
+ var WORD_ADVANCE_MS = 2200;
355607
+ var Computing = ({ phase = "thinking" }) => {
355608
+ const t2 = useTheme();
355609
+ const DIM = hexToRgb(t2.shimmerBase);
355610
+ const BRIGHT = hexToRgb(t2.shimmerSweep);
355611
+ const [word, advance, switchPhase, currentPhase] = useThinkingWord(phase);
355612
+ const [sweepPhase, setSweepPhase] = import_react38.useState(0);
355613
+ import_react38.useEffect(() => {
355614
+ if (phase !== currentPhase)
355615
+ switchPhase(phase);
355616
+ }, [phase, currentPhase, switchPhase]);
355617
+ import_react38.useEffect(() => {
355618
+ const id = setInterval(advance, WORD_ADVANCE_MS);
355619
+ return () => clearInterval(id);
355620
+ }, [advance]);
355621
+ import_react38.useEffect(() => {
355622
+ const id = setInterval(() => {
355623
+ setSweepPhase((p) => (p + 0.02) % 1);
355624
+ }, SWEEP_TICK_MS);
355625
+ return () => clearInterval(id);
355626
+ }, []);
355627
+ const center = sweepPhase * (word.length + SWEEP_WIDTH) - SWEEP_WIDTH / 2;
355628
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355629
+ flexDirection: "row",
355630
+ alignItems: "center",
355631
+ paddingX: 1,
355632
+ paddingY: 1,
355633
+ children: [
355634
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("spinner", {
355635
+ name: "dots",
355636
+ color: t2.dotNeutral
355637
+ }, undefined, false, undefined, this),
355638
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355639
+ width: 1
355640
+ }, undefined, false, undefined, this),
355641
+ word.split("").map((ch, i3) => {
355642
+ const dist = Math.abs(i3 - center);
355643
+ const tVal = Math.max(0, 1 - dist / SWEEP_WIDTH);
355644
+ const color = toHex(lerp(DIM[0], BRIGHT[0], tVal), lerp(DIM[1], BRIGHT[1], tVal), lerp(DIM[2], BRIGHT[2], tVal));
355645
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355646
+ fg: color,
355647
+ children: ch
355648
+ }, `${i3}-${ch}`, false, undefined, this);
355649
+ })
355650
+ ]
355651
+ }, undefined, true, undefined, this);
355652
+ };
355653
+ var Computing_default = Computing;
355654
+
355551
355655
  // src/components/StatusBar/index.tsx
355656
+ var formatElapsed = (ms) => {
355657
+ if (ms < 1000) {
355658
+ const seconds2 = ms / 1000;
355659
+ return `${seconds2.toFixed(1)}s`;
355660
+ }
355661
+ const totalSeconds = Math.floor(ms / 1000);
355662
+ const minutes = Math.floor(totalSeconds / 60);
355663
+ const seconds = totalSeconds % 60;
355664
+ const minStr = minutes > 0 ? `${minutes} minute${minutes > 1 ? "s" : ""}` : "";
355665
+ const secStr = seconds > 0 ? `${seconds} second${seconds > 1 ? "s" : ""}` : "";
355666
+ return [minStr, secStr].filter(Boolean).join(" ");
355667
+ };
355552
355668
  var index3 = () => {
355553
- const { activeModel, isPlanMode, sessionCharCount } = useModels();
355669
+ const { activeModel, isPlanMode, sessionCharCount, respLoading, sessionMessages, workTime } = useModels();
355554
355670
  const { currentTheme: t2 } = useThemePicker();
355555
- const [{ additions, deletions, files }, setDiffStats] = import_react38.useState(() => getDiffStats());
355556
- import_react38.useEffect(() => {
355671
+ const [{ additions, deletions, files }, setDiffStats] = import_react39.useState(() => getDiffStats());
355672
+ import_react39.useEffect(() => {
355557
355673
  const interval = setInterval(() => {
355558
355674
  setDiffStats(getDiffStats());
355559
355675
  }, 5000);
@@ -355562,94 +355678,108 @@ var index3 = () => {
355562
355678
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355563
355679
  width: "100%",
355564
355680
  paddingX: 2,
355565
- children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355566
- flexDirection: "row",
355567
- justifyContent: "space-between",
355568
- alignItems: "center",
355569
- width: "100%",
355570
- children: [
355571
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355572
- flexDirection: "row",
355573
- children: [
355574
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355575
- fg: !isPlanMode ? t2.inkFaint : t2.dotNeutral,
355576
- attributes: isPlanMode ? TextAttributes3.DIM : TextAttributes3.BOLD,
355577
- children: activeModel ? isPlanMode ? "PLAN MODE" : "BUILD MODE" : "Waiting"
355578
- }, undefined, false, undefined, this),
355579
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355580
- marginX: 1,
355581
- children: "\uF418"
355582
- }, undefined, false, undefined, this),
355583
- activeModel ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355584
- flexDirection: "row",
355585
- children: [
355586
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355587
- children: getCurrentGitBranch()
355588
- }, undefined, false, undefined, this),
355589
- sessionCharCount > 2000 && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355590
- fg: t2.inkFaint,
355591
- children: " \xB7 "
355592
- }, undefined, false, undefined, this),
355593
- sessionCharCount > 2000 && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355594
- fg: t2.inkMuted,
355595
- children: `${activeModel?.name}`
355596
- }, undefined, false, undefined, this)
355597
- ]
355598
- }, undefined, true, undefined, this) : /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355599
- flexDirection: "row",
355600
- gap: 1,
355601
- children: [
355602
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("spinner", {
355603
- name: "dots",
355604
- color: t2.dotNeutral
355605
- }, undefined, false, undefined, this),
355606
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355607
- children: "Please select a model"
355608
- }, undefined, false, undefined, this)
355609
- ]
355610
- }, undefined, true, undefined, this)
355611
- ]
355612
- }, undefined, true, undefined, this),
355613
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355614
- flexDirection: "row",
355681
+ children: [
355682
+ respLoading ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Computing_default, {}, undefined, false, undefined, this) : !respLoading && sessionMessages.length > 1 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355683
+ flexDirection: "row",
355684
+ alignItems: "center",
355685
+ paddingY: 1,
355686
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355687
+ fg: t2.inkMuted,
355615
355688
  children: [
355616
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355617
- flexDirection: "row",
355618
- children: [
355619
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355620
- fg: t2.accentRed,
355621
- children: `${deletions}-- `
355622
- }, undefined, false, undefined, this),
355623
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355624
- fg: t2.accentGreen,
355625
- children: `${additions}++ `
355626
- }, undefined, false, undefined, this),
355627
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355628
- fg: t2.codeInk,
355629
- marginRight: 2,
355630
- children: `File Changes: ${files}`
355631
- }, undefined, false, undefined, this)
355632
- ]
355633
- }, undefined, true, undefined, this),
355634
- activeModel && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355635
- children: [
355636
- "Context Window: ",
355637
- formatNumber(getModelContextWindow(activeModel))
355638
- ]
355639
- }, undefined, true, undefined, this)
355689
+ "Thought for ",
355690
+ formatElapsed(workTime)
355640
355691
  ]
355641
355692
  }, undefined, true, undefined, this)
355642
- ]
355643
- }, undefined, true, undefined, this)
355644
- }, undefined, false, undefined, this);
355693
+ }, undefined, false, undefined, this) : null,
355694
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355695
+ flexDirection: "row",
355696
+ justifyContent: "space-between",
355697
+ alignItems: "center",
355698
+ width: "100%",
355699
+ children: [
355700
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355701
+ flexDirection: "row",
355702
+ children: [
355703
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355704
+ fg: !isPlanMode ? t2.inkFaint : t2.dotNeutral,
355705
+ attributes: isPlanMode ? TextAttributes3.DIM : TextAttributes3.BOLD,
355706
+ children: activeModel ? isPlanMode ? "PLAN MODE" : "BUILD MODE" : "Waiting"
355707
+ }, undefined, false, undefined, this),
355708
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355709
+ marginX: 1,
355710
+ children: "\uF418"
355711
+ }, undefined, false, undefined, this),
355712
+ activeModel ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355713
+ flexDirection: "row",
355714
+ children: [
355715
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355716
+ children: getCurrentGitBranch()
355717
+ }, undefined, false, undefined, this),
355718
+ sessionCharCount > 2000 && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355719
+ fg: t2.inkFaint,
355720
+ children: " \xB7 "
355721
+ }, undefined, false, undefined, this),
355722
+ sessionCharCount > 2000 && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355723
+ fg: t2.inkMuted,
355724
+ children: `${activeModel?.name}`
355725
+ }, undefined, false, undefined, this)
355726
+ ]
355727
+ }, undefined, true, undefined, this) : /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355728
+ flexDirection: "row",
355729
+ gap: 1,
355730
+ children: [
355731
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("spinner", {
355732
+ name: "dots",
355733
+ color: t2.dotNeutral
355734
+ }, undefined, false, undefined, this),
355735
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355736
+ children: "Please select a model"
355737
+ }, undefined, false, undefined, this)
355738
+ ]
355739
+ }, undefined, true, undefined, this)
355740
+ ]
355741
+ }, undefined, true, undefined, this),
355742
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355743
+ flexDirection: "row",
355744
+ children: [
355745
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355746
+ flexDirection: "row",
355747
+ children: [
355748
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355749
+ fg: t2.accentRed,
355750
+ children: `${deletions}-- `
355751
+ }, undefined, false, undefined, this),
355752
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355753
+ fg: t2.accentGreen,
355754
+ children: `${additions}++ `
355755
+ }, undefined, false, undefined, this),
355756
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355757
+ fg: t2.codeInk,
355758
+ marginRight: 2,
355759
+ children: `File Changes: ${files}`
355760
+ }, undefined, false, undefined, this)
355761
+ ]
355762
+ }, undefined, true, undefined, this),
355763
+ activeModel && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
355764
+ children: [
355765
+ "Context Window: ",
355766
+ formatNumber(getModelContextWindow(activeModel))
355767
+ ]
355768
+ }, undefined, true, undefined, this)
355769
+ ]
355770
+ }, undefined, true, undefined, this)
355771
+ ]
355772
+ }, undefined, true, undefined, this)
355773
+ ]
355774
+ }, undefined, true, undefined, this);
355645
355775
  };
355646
355776
  var StatusBar_default = index3;
355647
355777
 
355648
355778
  // src/providers/QuestionaireProvider.tsx
355649
- var import_react40 = __toESM(require_react(), 1);
355650
- var QuestionnaireContext = import_react40.createContext(null);
355779
+ var import_react41 = __toESM(require_react(), 1);
355780
+ var QuestionnaireContext = import_react41.createContext(null);
355651
355781
  var useQuestionnaire = () => {
355652
- const context = import_react40.useContext(QuestionnaireContext);
355782
+ const context = import_react41.useContext(QuestionnaireContext);
355653
355783
  if (!context) {
355654
355784
  throw new Error("useQuestionnaire must be used within a QuestionnaireProvider");
355655
355785
  }
@@ -355657,9 +355787,9 @@ var useQuestionnaire = () => {
355657
355787
  };
355658
355788
  var Questionnaire = () => {
355659
355789
  const { questions, isOpen, onComplete } = useQuestionnaire();
355660
- const [currentQIndex, setCurrentQIndex] = import_react40.useState(0);
355661
- const [selectedOptionIndex, setSelectedOptionIndex] = import_react40.useState(0);
355662
- const [answers, setAnswers] = import_react40.useState([]);
355790
+ const [currentQIndex, setCurrentQIndex] = import_react41.useState(0);
355791
+ const [selectedOptionIndex, setSelectedOptionIndex] = import_react41.useState(0);
355792
+ const [answers, setAnswers] = import_react41.useState([]);
355663
355793
  const currentQuestion = questions[currentQIndex];
355664
355794
  const options = currentQuestion?.options ?? [];
355665
355795
  useBindings(() => ({
@@ -355790,14 +355920,14 @@ var parseDroppedPath = (raw) => {
355790
355920
  var index4 = ({
355791
355921
  action
355792
355922
  }) => {
355793
- const [placeHolderText] = import_react43.useState(`Try "Analyze this codebase"`);
355794
- const [_query, setQuery] = import_react43.useState("");
355795
- const [isMenuEnable, setIsMenuEnable] = import_react43.useState(false);
355923
+ const [placeHolderText] = import_react44.useState(`Try "Analyze this codebase"`);
355924
+ const [_query, setQuery] = import_react44.useState("");
355925
+ const [isMenuEnable, setIsMenuEnable] = import_react44.useState(false);
355796
355926
  const { currentDialog } = useDialog();
355797
355927
  const renderer = useRenderer();
355798
355928
  const t2 = useTheme();
355799
355929
  const projectName = path18.basename(process.cwd());
355800
- const [scrollBoxIndex, setScrollBoxIndex] = import_react43.useState(0);
355930
+ const [scrollBoxIndex, setScrollBoxIndex] = import_react44.useState(0);
355801
355931
  const {
355802
355932
  setRespLoading,
355803
355933
  interruptedStatusRef,
@@ -355809,7 +355939,7 @@ var index4 = ({
355809
355939
  } = useModels();
355810
355940
  const { isOpen } = useThemePicker();
355811
355941
  const toast = useToast();
355812
- const [attachments, setAttachments] = import_react43.useState([]);
355942
+ const [attachments, setAttachments] = import_react44.useState([]);
355813
355943
  const usedTokens = Math.max(tokenStats.context, tokenStats.baseline);
355814
355944
  const usageLabel = contextPercent !== null ? `~${compact.format(usedTokens)} tokens \xB7 ${contextPercent.toFixed(1)}% context` : `~${compact.format(usedTokens)} tokens`;
355815
355945
  const classifyFile = (path19) => {
@@ -355907,8 +356037,8 @@ var index4 = ({
355907
356037
  setAttachments([]);
355908
356038
  }
355909
356039
  };
355910
- const [, forceRender] = import_react43.useState(0);
355911
- import_react43.useEffect(() => orchestrator.onQuestionsChange(() => forceRender((n4) => n4 + 1)), []);
356040
+ const [, forceRender] = import_react44.useState(0);
356041
+ import_react44.useEffect(() => orchestrator.onQuestionsChange(() => forceRender((n4) => n4 + 1)), []);
355912
356042
  const showQuestionnaire = orchestrator.questions.length > 0 && !orchestrator.isAnswered;
355913
356043
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
355914
356044
  width: "100%",
@@ -356045,7 +356175,7 @@ var Home = () => {
356045
356175
  }
356046
356176
  navig("/new-session", { replace: true, state: data });
356047
356177
  };
356048
- import_react44.useEffect(() => {
356178
+ import_react45.useEffect(() => {
356049
356179
  setSessionMessages([]);
356050
356180
  }, [setSessionMessages]);
356051
356181
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
@@ -356071,64 +356201,6 @@ var Home_default = Home;
356071
356201
  // src/layouts/screens/NewSession.tsx
356072
356202
  var import_react47 = __toESM(require_react(), 1);
356073
356203
 
356074
- // src/components/Computing/index.tsx
356075
- var import_react45 = __toESM(require_react(), 1);
356076
- var lerp = (a3, b, t2) => Math.round(a3 + (b - a3) * t2);
356077
- var toHex = (r, g2, b) => `#${[r, g2, b].map((v) => v.toString(16).padStart(2, "0")).join("")}`;
356078
- var hexToRgb = (hex3) => {
356079
- const h2 = hex3.replace("#", "");
356080
- return [parseInt(h2.slice(0, 2), 16), parseInt(h2.slice(2, 4), 16), parseInt(h2.slice(4, 6), 16)];
356081
- };
356082
- var SWEEP_WIDTH = 3;
356083
- var SWEEP_TICK_MS = 30;
356084
- var WORD_ADVANCE_MS = 2200;
356085
- var Computing = ({ phase = "thinking" }) => {
356086
- const t2 = useTheme();
356087
- const DIM = hexToRgb(t2.shimmerBase);
356088
- const BRIGHT = hexToRgb(t2.shimmerSweep);
356089
- const [word, advance, switchPhase, currentPhase] = useThinkingWord(phase);
356090
- const [sweepPhase, setSweepPhase] = import_react45.useState(0);
356091
- import_react45.useEffect(() => {
356092
- if (phase !== currentPhase)
356093
- switchPhase(phase);
356094
- }, [phase, currentPhase, switchPhase]);
356095
- import_react45.useEffect(() => {
356096
- const id = setInterval(advance, WORD_ADVANCE_MS);
356097
- return () => clearInterval(id);
356098
- }, [advance]);
356099
- import_react45.useEffect(() => {
356100
- const id = setInterval(() => {
356101
- setSweepPhase((p) => (p + 0.02) % 1);
356102
- }, SWEEP_TICK_MS);
356103
- return () => clearInterval(id);
356104
- }, []);
356105
- const center = sweepPhase * (word.length + SWEEP_WIDTH) - SWEEP_WIDTH / 2;
356106
- return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356107
- flexDirection: "row",
356108
- alignItems: "center",
356109
- paddingX: 2,
356110
- children: [
356111
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("spinner", {
356112
- name: "dots",
356113
- color: t2.dotNeutral
356114
- }, undefined, false, undefined, this),
356115
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356116
- width: 1
356117
- }, undefined, false, undefined, this),
356118
- word.split("").map((ch, i3) => {
356119
- const dist = Math.abs(i3 - center);
356120
- const tVal = Math.max(0, 1 - dist / SWEEP_WIDTH);
356121
- const color = toHex(lerp(DIM[0], BRIGHT[0], tVal), lerp(DIM[1], BRIGHT[1], tVal), lerp(DIM[2], BRIGHT[2], tVal));
356122
- return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
356123
- fg: color,
356124
- children: ch
356125
- }, `${i3}-${ch}`, false, undefined, this);
356126
- })
356127
- ]
356128
- }, undefined, true, undefined, this);
356129
- };
356130
- var Computing_default = Computing;
356131
-
356132
356204
  // src/components/Message/index.tsx
356133
356205
  var import_react46 = __toESM(require_react(), 1);
356134
356206
  import { RGBA as RGBA2, SyntaxStyle } from "@opentui/core";
@@ -356199,11 +356271,7 @@ var ToolCall = ({ tool }) => {
356199
356271
  }, undefined, true, undefined, this) : null,
356200
356272
  file2 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(InlineDiff, {
356201
356273
  file: file2
356202
- }, undefined, false, undefined, this) : null,
356203
- " ",
356204
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356205
- marginBottom: 1
356206
- }, undefined, false, undefined, this)
356274
+ }, undefined, false, undefined, this) : null
356207
356275
  ]
356208
356276
  }, undefined, true, undefined, this);
356209
356277
  };
@@ -356267,6 +356335,7 @@ var Index = ({ msg, type, attachments }) => {
356267
356335
  gap: 2,
356268
356336
  paddingY: type === "user" || type === "error" ? 0 : 1,
356269
356337
  paddingX: 2,
356338
+ marginTop: 1,
356270
356339
  width: "100%",
356271
356340
  backgroundColor: type === "user" ? t2.surfaceRaised : type === "error" ? t2.surface : t2.canvas,
356272
356341
  children: [
@@ -356323,21 +356392,9 @@ var Index = ({ msg, type, attachments }) => {
356323
356392
  var Message_default = Index;
356324
356393
 
356325
356394
  // src/layouts/screens/NewSession.tsx
356326
- var formatElapsed = (ms) => {
356327
- if (ms < 1000) {
356328
- const seconds2 = ms / 1000;
356329
- return `${seconds2.toFixed(1)}s`;
356330
- }
356331
- const totalSeconds = Math.floor(ms / 1000);
356332
- const minutes = Math.floor(totalSeconds / 60);
356333
- const seconds = totalSeconds % 60;
356334
- const minStr = minutes > 0 ? `${minutes} minute${minutes > 1 ? "s" : ""}` : "";
356335
- const secStr = seconds > 0 ? `${seconds} second${seconds > 1 ? "s" : ""}` : "";
356336
- return [minStr, secStr].filter(Boolean).join(" ");
356337
- };
356338
356395
  var NewSession = () => {
356339
356396
  const location = useLocation();
356340
- const { setSessionMessages, sessionMessages, respLoading, workTime, isPlanMode } = useModels();
356397
+ const { setSessionMessages, sessionMessages } = useModels();
356341
356398
  const { currentTheme: t2 } = useThemePicker();
356342
356399
  import_react47.useEffect(() => {
356343
356400
  const initialData = location.state;
@@ -356376,6 +356433,7 @@ var NewSession = () => {
356376
356433
  flexGrow: 1,
356377
356434
  stickyScroll: true,
356378
356435
  width: "100%",
356436
+ height: "100%",
356379
356437
  stickyStart: "bottom",
356380
356438
  children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356381
356439
  flexDirection: "column",
@@ -356398,28 +356456,13 @@ var NewSession = () => {
356398
356456
  /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356399
356457
  flexShrink: 0,
356400
356458
  width: "100%",
356401
- children: [
356402
- respLoading ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Computing_default, {}, undefined, false, undefined, this) : !respLoading && sessionMessages.length > 1 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356403
- flexDirection: "row",
356404
- alignItems: "center",
356405
- paddingX: 2,
356406
- paddingY: 1,
356407
- children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
356408
- fg: t2.inkMuted,
356409
- children: [
356410
- "Thought for ",
356411
- formatElapsed(workTime)
356412
- ]
356413
- }, undefined, true, undefined, this)
356414
- }, undefined, false, undefined, this) : null,
356415
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356416
- paddingY: 2,
356417
- children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(InputBar_default, {
356418
- action
356419
- }, undefined, false, undefined, this)
356459
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
356460
+ paddingY: 1,
356461
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(InputBar_default, {
356462
+ action
356420
356463
  }, undefined, false, undefined, this)
356421
- ]
356422
- }, undefined, true, undefined, this)
356464
+ }, undefined, false, undefined, this)
356465
+ }, undefined, false, undefined, this)
356423
356466
  ]
356424
356467
  }, undefined, true, undefined, this);
356425
356468
  };