@scalequality/cli 0.4.36 → 0.4.38

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": "dfc00b0929c473fb02db7628e801bb66c6093a69462bbdb39d9e108ee96710e5",
4
- "sourceCommit": "a14e97fc6d163215fbedeb465ff6a229f7491e19"
3
+ "sha256": "25cae8837c48bbfd702551d44a1c4e65885f846853e60554d5840e6c1cd153d4",
4
+ "sourceCommit": "3db91eef5ca985d2318938623a2b6010a0860339"
5
5
  }
package/dist/connect.cjs CHANGED
@@ -13925,6 +13925,7 @@ var SQ_TOOL_LABELS = {
13925
13925
  check_design: { kind: "tool", label: "Checking the design in a browser" },
13926
13926
  open_pull_request: { kind: "tool", label: "Opening the pull request" }
13927
13927
  };
13928
+ var STEP_WITHDRAWN = "STEP_WITHDRAWN";
13928
13929
  function clip(s, n) {
13929
13930
  const one = s.replace(/\s+/g, " ").trim();
13930
13931
  return one.length > n ? `${one.slice(0, n - 1)}\u2026` : one;
@@ -14194,6 +14195,10 @@ var SdkEventMapper = class {
14194
14195
  if (!t) continue;
14195
14196
  this.open.delete(b.tool_use_id);
14196
14197
  closed = true;
14198
+ if (this.cb.withdrawn?.(b.tool_use_id)) {
14199
+ this.cb.emit({ type: "step", data: { id: b.tool_use_id, kind: t.kind, label: t.label, status: "done", code: STEP_WITHDRAWN, startedAt: iso(t.startedAt), endedAt: iso(this.now()) } });
14200
+ continue;
14201
+ }
14197
14202
  const failed2 = b.is_error === true && t.name !== "ExitPlanMode" && t.name !== "AskUserQuestion";
14198
14203
  const endedAt = this.now();
14199
14204
  this.stepDone(b.tool_use_id, t, failed2 ? "failed" : "done", endedAt);
@@ -14752,6 +14757,10 @@ function buildSystemAppend(c) {
14752
14757
  "- 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.",
14753
14758
  "",
14754
14759
  "## While you work",
14760
+ // Erik, 25/10/2026, a prototype asked in staging: 1 min 45 s of commands and edits before the first word, then "Agora
14761
+ // vou corrigir..." with no hello. "fala alguma coisa ... tipo ok vou fazer pra vc ... tem que ter a conversa com o user
14762
+ // ... acatou a ordem direto de forma fria", as Claude Code and Cursor do.
14763
+ '- Answer first, then work: a turn that asks for work starts with one or two sentences to the user, in their language, before any tool call: take the request as a colleague would in a chat and say how you will go about it, for example "Bora! Vou montar a home do app de bebidas: ofertas no topo, as categorias e os mais vendidos, primeiro no celular." When the request leaves the direction open, that message also says the choices you are taking (who it is for, the style, what comes first) so the user can redirect you, or you ask first as Designs and prototypes says. Never open a turn with a tool call and no word to the user.',
14755
14764
  // 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
14765
  // comigo ... pra ele não sentir a demora". Silence reads as slow, whatever the model.
14757
14766
  "- 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.",
@@ -15488,6 +15497,11 @@ var WARM_IDLE_MS = 15 * 6e4;
15488
15497
  var TERMINAL_PULSE_MS = 4 * 6e4;
15489
15498
  var TERMINAL_IDLE_MS = 20 * 6e4;
15490
15499
  var TERMINAL_SHARE_WAIT_MS = 3e3;
15500
+ var TALK_EXEMPT = /* @__PURE__ */ new Set(["AskUserQuestion", "ExitPlanMode", "TodoWrite"]);
15501
+ var TALK_SILENCE_MS = 75e3;
15502
+ var TALK_SILENCE_NUDGES = 2;
15503
+ var TALK_FIRST_OPENING = "Not run yet: you have not said anything to the user in this turn. First write one or two sentences to them, in their language: take the request and say how you will go about it (and the choices you are taking when the direction is open). Then call this tool again, unchanged.";
15504
+ var TALK_FIRST_SILENCE = (seconds) => `Not run yet: the user has seen no word from you for ${seconds} seconds. Say in one sentence what you are doing now, then call this tool again, unchanged.`;
15491
15505
  var TERMINAL_LOCAL_ENV = ["SSH_AUTH_SOCK", "EDITOR", "VISUAL", "PAGER", "LC_CTYPE"];
15492
15506
  function localLoginShell() {
15493
15507
  if (process.platform === "win32") return process.env.COMSPEC || "powershell.exe";
@@ -15717,6 +15731,8 @@ var WorkspaceEngine = class {
15717
15731
  orgPlugins = { entries: [], dirs: [] };
15718
15732
  /** The conversation's name was asked for (once, on its first turn). */
15719
15733
  titled = false;
15734
+ /** Tool calls sent back by talkFirst: their steps leave the screen when their refusal comes back. */
15735
+ withdrawn = /* @__PURE__ */ new Set();
15720
15736
  /** The first message, named once the model has started answering it (two calls at once slowed the first answer). */
15721
15737
  titleWaiting = null;
15722
15738
  /** The project environment's setup, once per open repository (cloud only), and why the last one failed. */
@@ -16648,6 +16664,29 @@ ${String(item.content)}` : String(item.content);
16648
16664
  * A short name for a new conversation, from its first message: one small request to the session's fast model on
16649
16665
  * the gateway (measured like every other). Anything that fails leaves the conversation as it was.
16650
16666
  */
16667
+ /**
16668
+ * Talking before working, whatever the model (Erik, 25/10/2026: "temos que ter regra que funciona para todos os
16669
+ * modelos"; the prompt alone left 1 min 45 s of tools before the first word). The turn's first tool call made before
16670
+ * any word to the person goes back once, asking for that word; after a long silence, one sentence again (twice a turn
16671
+ * at most). The call never ran: its step leaves the screen (STEP_WITHDRAWN) and the model calls it again.
16672
+ */
16673
+ talkFirst(name, toolUseId) {
16674
+ const live = this.live;
16675
+ if (!live || TALK_EXEMPT.has(name)) return null;
16676
+ const now = Date.now();
16677
+ let reason = null;
16678
+ if (live.spokeAt === null) {
16679
+ if (live.openingAsked) return null;
16680
+ live.openingAsked = true;
16681
+ reason = TALK_FIRST_OPENING;
16682
+ } else if (now - live.spokeAt > TALK_SILENCE_MS && live.silenceNudges < TALK_SILENCE_NUDGES) {
16683
+ live.silenceNudges++;
16684
+ reason = TALK_FIRST_SILENCE(Math.round((now - live.spokeAt) / 1e3));
16685
+ live.spokeAt = now;
16686
+ }
16687
+ if (reason && toolUseId) this.withdrawn.add(toolUseId);
16688
+ return reason;
16689
+ }
16651
16690
  /** Names the conversation from its first message now (the model answered it, or the turn ended without an answer). */
16652
16691
  nameNow() {
16653
16692
  const content = this.titleWaiting;
@@ -17317,6 +17356,9 @@ ${text3}`;
17317
17356
  headResult: null,
17318
17357
  turnEnded: false,
17319
17358
  lifecycle: false,
17359
+ spokeAt: null,
17360
+ openingAsked: false,
17361
+ silenceNudges: 0,
17320
17362
  chosen: boot.model && !boot.model.startsWith("sq-auto") ? boot.model : null,
17321
17363
  fellBack: false,
17322
17364
  timing: new TurnTiming({ sessionId: this.deps.sessionId ?? null, turnId, model, reasoning: this.reasoningLevel }, typeof payload.receivedAt === "number" ? payload.receivedAt : null, turnStart)
@@ -17330,6 +17372,7 @@ ${text3}`;
17330
17372
  let conversation = resume;
17331
17373
  const newMapper = (forTurn, baseline) => new SdkEventMapper(this.deps.root, {
17332
17374
  emit: (e) => this.emitTurnEvent(live, e),
17375
+ withdrawn: (id) => this.withdrawn.delete(id),
17333
17376
  filesMaybeChanged: () => this.scheduleDiff(),
17334
17377
  sessionId: (id) => {
17335
17378
  sawInit = true;
@@ -17456,6 +17499,7 @@ ${text3}`;
17456
17499
  emitTurnEvent(live, e) {
17457
17500
  if (live.interrupted && e.type === "error" && /^(TURN_|MODEL_)/.test(e.data.code)) return;
17458
17501
  if (e.type === "text" || e.type === "activity" || e.type === "step" && e.data.kind !== "think") live.timing.visibleEvent();
17502
+ if (e.type === "text" || e.type === "question") live.spokeAt = Date.now();
17459
17503
  this.emit(e);
17460
17504
  }
17461
17505
  /** What a frame of the main conversation says about the turn: its model calls, foreground work, and the messages it read. */
@@ -17546,6 +17590,9 @@ ${text3}`;
17546
17590
  live.refused = false;
17547
17591
  live.turnId = turnId;
17548
17592
  live.fellBack = false;
17593
+ live.spokeAt = null;
17594
+ live.openingAsked = false;
17595
+ live.silenceNudges = 0;
17549
17596
  live.headUuid = members[0];
17550
17597
  live.headResult = null;
17551
17598
  live.turnEnded = false;
@@ -17682,6 +17729,7 @@ ${text3}`;
17682
17729
  secretFiles: i.secretFiles,
17683
17730
  protections: () => this.protections(),
17684
17731
  protection: { deps: this.protectionDeps(), approver: this.protectionApprover() },
17732
+ ...this.deps.talkFirst ? { talkFirst: (name, toolUseId) => this.talkFirst(name, toolUseId) } : {},
17685
17733
  beforeTool: async () => {
17686
17734
  const t0 = Date.now();
17687
17735
  await this.toolGate;
@@ -18603,6 +18651,8 @@ function buildQueryOptions(o) {
18603
18651
  if (input.hook_event_name !== "PreToolUse") return {};
18604
18652
  if (o.beforeTool) await o.beforeTool();
18605
18653
  const name = String(input.tool_name ?? "");
18654
+ const talk = !input.agent_id && o.talkFirst ? o.talkFirst(name, String(input.tool_use_id ?? "")) : null;
18655
+ if (talk) return { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: talk } };
18606
18656
  if (name === "ExitPlanMode") return o.plan ? {} : { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: "Not in plan mode." } };
18607
18657
  if (name === QUESTION_TOOL) return o.askQuestion ? {} : { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: "Ask in your reply instead." } };
18608
18658
  const provenance = input.mcp_server;
@@ -19080,7 +19130,8 @@ function createLocalEngine(o) {
19080
19130
  exit: (code, reason) => o.exit(code, reason, startError),
19081
19131
  pathToClaudeCodeExecutable: process.env.CLAUDE_CODE_EXECUTABLE || void 0,
19082
19132
  // The next message's engine process is started while the person reads, like Claude Code's process between messages.
19083
- warmStart: true
19133
+ warmStart: true,
19134
+ talkFirst: true
19084
19135
  });
19085
19136
  }
19086
19137
  async function connectMain(argv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalequality/cli",
3
- "version": "0.4.36",
3
+ "version": "0.4.38",
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": {