@scalequality/cli 0.4.34 → 0.4.36

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "sdkVersion": "0.3.281",
3
- "sha256": "b2ccc4428dd29a54024fb75482ee6279b1a58a6b4d94508501ea7a72e900ac95",
4
- "sourceCommit": "9a236ac040cb6760f2bdd944a18f6f133383aaf8"
3
+ "sha256": "dfc00b0929c473fb02db7628e801bb66c6093a69462bbdb39d9e108ee96710e5",
4
+ "sourceCommit": "a14e97fc6d163215fbedeb465ff6a229f7491e19"
5
5
  }
package/dist/connect.cjs CHANGED
@@ -13943,6 +13943,12 @@ var SdkEventMapper = class {
13943
13943
  textByMessage = /* @__PURE__ */ new Map();
13944
13944
  streamMessageId = null;
13945
13945
  thinking = /* @__PURE__ */ new Map();
13946
+ /**
13947
+ * A file tool whose input is still streaming (Erik, 24/10/2026: 40 s of "Editando arquivos" while one file was written):
13948
+ * its path is said as soon as it is complete in the stream, not when the whole file has arrived. Only the start of the
13949
+ * input is kept; the path comes first.
13950
+ */
13951
+ writing = /* @__PURE__ */ new Map();
13946
13952
  model;
13947
13953
  /** Gateway refusals already reported in this turn (the SDK can repeat one in the result). */
13948
13954
  reported = /* @__PURE__ */ new Set();
@@ -13989,6 +13995,7 @@ var SdkEventMapper = class {
13989
13995
  const message = ev.message;
13990
13996
  this.streamMessageId = typeof message?.id === "string" ? message.id : null;
13991
13997
  this.thinking.clear();
13998
+ this.writing.clear();
13992
13999
  this.streamUsage = null;
13993
14000
  this.takeStreamUsage(message?.usage);
13994
14001
  return;
@@ -14000,7 +14007,10 @@ var SdkEventMapper = class {
14000
14007
  case "content_block_start": {
14001
14008
  const block = ev.content_block;
14002
14009
  const index = Number(ev.index);
14003
- if (block?.type === "tool_use" && typeof block.name === "string" && block.name) this.cb.emit({ type: "activity", data: { tool: block.name } });
14010
+ if (block?.type === "tool_use" && typeof block.name === "string" && block.name) {
14011
+ this.cb.emit({ type: "activity", data: { tool: block.name } });
14012
+ if (FILE_TOOLS.has(block.name)) this.writing.set(index, { name: block.name, json: "" });
14013
+ }
14004
14014
  if (block?.type === "thinking" && this.streamMessageId) {
14005
14015
  const id = `think-${this.streamMessageId}-${index}`;
14006
14016
  const startedAt = this.now();
@@ -14014,10 +14024,12 @@ var SdkEventMapper = class {
14014
14024
  if (delta?.type === "text_delta" && typeof delta.text === "string" && delta.text && this.streamMessageId) {
14015
14025
  this.cb.emit({ type: "text", data: { messageId: this.streamMessageId, delta: delta.text } });
14016
14026
  }
14027
+ if (delta?.type === "input_json_delta" && typeof delta.partial_json === "string") this.onToolInput(Number(ev.index), delta.partial_json);
14017
14028
  return;
14018
14029
  }
14019
14030
  case "content_block_stop": {
14020
14031
  const index = Number(ev.index);
14032
+ this.writing.delete(index);
14021
14033
  const t = this.thinking.get(index);
14022
14034
  if (t) {
14023
14035
  this.thinking.delete(index);
@@ -14029,6 +14041,24 @@ var SdkEventMapper = class {
14029
14041
  return;
14030
14042
  }
14031
14043
  }
14044
+ /** The streamed input of a file tool: once its path is complete, the live line names the file (once per call). */
14045
+ onToolInput(index, chunk) {
14046
+ const w = this.writing.get(index);
14047
+ if (!w) return;
14048
+ w.json += chunk;
14049
+ const found = /"(file_path|notebook_path)"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(w.json);
14050
+ if (!found && w.json.length < 4096) return;
14051
+ this.writing.delete(index);
14052
+ if (!found) return;
14053
+ let path;
14054
+ try {
14055
+ path = JSON.parse(`"${found[2]}"`);
14056
+ } catch {
14057
+ return;
14058
+ }
14059
+ const target = typeof path === "string" ? activityTarget(w.name, { [found[1]]: path }) : void 0;
14060
+ if (target) this.cb.emit({ type: "activity", data: { tool: w.name, target } });
14061
+ }
14032
14062
  /** A subagent's frame: its tool calls update the card of the Agent call that runs it. */
14033
14063
  onSubagent(parentId, m) {
14034
14064
  const t = this.open.get(parentId);
@@ -14354,6 +14384,7 @@ function taskItems(todos) {
14354
14384
  }
14355
14385
  return items;
14356
14386
  }
14387
+ var FILE_TOOLS = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit", "NotebookEdit"]);
14357
14388
  function activityTarget(name, input) {
14358
14389
  const s = (k) => typeof input[k] === "string" ? input[k] : "";
14359
14390
  if (name === "Edit" || name === "MultiEdit" || name === "Write" || name === "Read") {
@@ -14663,7 +14694,8 @@ function designLines(c) {
14663
14694
  "When the user asks for a prototype, a screen, a mockup, a flow, a landing page or any interface to look at before it is built, make a design: the user opens it in the Design canvas beside this conversation, every screen side by side, and clicks through it.",
14664
14695
  "- Ask first only when the request leaves open a decision that changes the whole design (who uses the screen first, which job comes first, which direction): one short question with two or three concrete options" + (c.askQuestions ? ", asked with AskUserQuestion after one sentence saying why you ask; the user picks on a card and you go on in the same turn." : ".") + " Otherwise decide, and say your assumption in one line.",
14665
14696
  "- Start from the project, not from nothing: read the repository's styles, theme or tokens, components and copy before designing, and use its fonts, colours, spacing, radii and words. Without a look of its own, commit to a small system (one or two typefaces, a neutral ground, at most two accents) and name it in one line. Never cream or beige grounds unless the brand has them, no gradient washes, no emoji, no cards with a coloured left border.",
14666
- `- Write it in the repository it belongs to, under design/<short-name>/: one self-contained .html file per screen (its CSS and JS inside it; pictures as files in that folder), and design/<short-name>/design.json listing the screens: {"title": "Stock control", "boards": [{"file": "desktop-light.html", "title": "Desktop \xB7 light", "device": "desktop", "width": 1280, "height": 820}, {"file": "phone-light.html", "title": "Phone \xB7 light", "device": "phone", "width": 390, "height": 844}]}. Titles in the user's language. Make the light and the dark theme, and the phone screens when the interface is used on a phone. Slides, a presentation or a deck are a design too: each slide a board with "device": "slide", 1920\xD71080, in order; one idea per slide, few words set large.`,
14697
+ `- Write it in the repository it belongs to, under design/<short-name>/: one self-contained .html file per screen (its CSS and JS inside it; pictures as files in that folder), and design/<short-name>/design.json listing the screens: {"title": "Stock control", "boards": [{"file": "desktop-light.html", "title": "Desktop \xB7 light", "device": "desktop", "width": 1280, "height": 820}, {"file": "phone-light.html", "title": "Phone \xB7 light", "device": "phone", "width": 390, "height": 844}]}. Titles in the user's language. Make the light and the dark theme, and the phone screens when the interface is used on a phone. Slides, a presentation or a deck are a design too: each slide a board with "device": "slide", 1920\xD71080, in order; one idea per slide, few words set large. At most 12 boards in one design: a longer deck is two designs.`,
14698
+ "- The canvas shows a screen isolated from the internet: a picture goes in an <img> (or <picture><source>) with a path relative to the screen, never in a CSS url() or from an https address, and fonts are the system's or inlined, or the canvas shows the screen without them.",
14667
14699
  "- Make it work: real buttons, inputs, menus and states the user can click through, with plausible content in the user's language that fits the subject (never lorem ipsum, never invented claims about a real company). Accessible as drawn: button, a and input with its label, text contrast at least 4.5:1, touch targets at least 44 px on a phone. A phone screen never scrolls sideways.",
14668
14700
  "- Never start a dev server or install packages for a design. Fonts and libraries load only from cdn.jsdelivr.net, cdnjs.cloudflare.com or unpkg.com (fonts through @fontsource on jsDelivr; Google Fonts do not load here); anything else stays inside the file.",
14669
14701
  "- Then call check_design with the design.json path: it opens every screen in a browser and shows them to you. Fix what it reports and what you see wrong, and call it again until it is clean.",
@@ -14719,6 +14751,17 @@ function buildSystemAppend(c) {
14719
14751
  "- Answer in the language the user writes in.",
14720
14752
  "- Refer to the scope, teams, business areas, projects and repositories by their names, as the user sees them in ScaleQuality. Never show internal identifiers (ids, UUIDs) or internal kind names such as TEAM, PROJECTS or BUSINESS_AREA; tool results carry them for you, not for the user.",
14721
14753
  "",
14754
+ "## While you work",
14755
+ // Erik, 24/10/2026: a prototype took 79 s with 40 s of them writing one file and not a word on screen; "conversa mais
14756
+ // comigo ... pra ele não sentir a demora". Silence reads as slow, whatever the model.
14757
+ "- The user is watching while you work, and silence feels slow even when the work is fast. Talk to them as you go, like a colleague pairing in a chat: before a step that takes a while, one short sentence in the user's language saying what you are doing now; when something you found changes the plan, one sentence saying so.",
14758
+ '- Before writing a long file (a screen, a prototype, a large module), say in one sentence what goes in it, for example "Agora a tela principal: o resumo do estoque, a busca e a tabela de produtos".',
14759
+ // Measured that day: three single writes of 80, 39 and 73 s made most of a 4 min 23 s prototype, with the first token
14760
+ // of every call in about 2 s. The time was the size of one write, so the work grows in steps the user can watch.
14761
+ "- Build in small steps the user can watch: a screen, a page or a module starts as a short version that already works (show it at once when it can be shown), then grows one part at a time, each part its own edit with its sentence. Never write more than about 150 lines in one call; a longer file is written first in that size and completed with edits.",
14762
+ "- Each of these sentences goes in the same message as the tool call that starts the step, never in a turn of its own. One line each, no lists; never narrate a quick read or repeat what the screen already shows.",
14763
+ "- They do not replace the final answer: when the work is done, answer as How to answer says.",
14764
+ "",
14722
14765
  "## How to answer",
14723
14766
  "- Lead with the outcome in one or two sentences: what changed, what was found, or what you need from the user.",
14724
14767
  "- The screen already shows every command you ran and every file you edited, with their output and diff. Do not list them again, and do not restate test counts or tool results the user can open; mention one only when it matters for what comes next (a test that still fails, a risk that remains).",
@@ -16083,6 +16126,14 @@ var WorkspaceEngine = class {
16083
16126
  case "discard_hunk":
16084
16127
  await this.discardHunkCommand(str("path") ?? "", str("hunkHash") ?? "", str("repoFullName"));
16085
16128
  return;
16129
+ case "model": {
16130
+ const model = str("model");
16131
+ if (model) {
16132
+ this.queue.push({ action: "model", model });
16133
+ this.kickTurns();
16134
+ }
16135
+ return;
16136
+ }
16086
16137
  case "rewind":
16087
16138
  this.dropQueue();
16088
16139
  this.turnAbort?.abort();
@@ -16358,6 +16409,7 @@ var WorkspaceEngine = class {
16358
16409
  else if (item.action === "run_tests") await this.runTests(typeof item.repoFullName === "string" ? item.repoFullName : void 0);
16359
16410
  else if (item.action === "measure") await this.measureAction(typeof item.repoFullName === "string" ? item.repoFullName : void 0);
16360
16411
  else if (item.action === "compact") await this.compactConversation(String(item.turnId ?? ""));
16412
+ else if (item.action === "model") await this.switchModel(String(item.model ?? ""), { quiet: true });
16361
16413
  else await this.runTurn(item);
16362
16414
  }
16363
16415
  } finally {
@@ -16618,10 +16670,11 @@ ${String(item.content)}` : String(item.content);
16618
16670
  * for it; the engine takes it from the next request on. A failure keeps the
16619
16671
  * current one (and says so).
16620
16672
  */
16621
- async switchModel(model) {
16673
+ /** `quiet`: picked before the message (no step in the conversation; a refusal still says so, and the picker goes back). */
16674
+ async switchModel(model, opts = {}) {
16622
16675
  const boot = this.boot;
16623
16676
  if (!model || model === boot.model || !this.deps.transport.refreshRuntime) return;
16624
- const step = this.ownStep("model", "tool", `Switching to ${model}`, "STEP_MODEL_SWITCH", { model });
16677
+ const step = opts.quiet ? { end: (_s) => void 0 } : this.ownStep("model", "tool", `Switching to ${model}`, "STEP_MODEL_SWITCH", { model });
16625
16678
  try {
16626
16679
  const fresh = await this.deps.transport.refreshRuntime({ model: boot.model });
16627
16680
  if (!fresh.runtime.token || !fresh.runtime.baseUrl) throw new Error("RUNTIME_INCOMPLETE");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalequality/cli",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "description": "ScaleQuality CLI. Connect your computer to the ScaleQuality AI Workspace (`scalequality login`), run its coding engine in any folder of your computer, and import your Claude Code and Codex conversations.",
5
5
  "type": "module",
6
6
  "bin": {