@scalequality/cli 0.4.37 → 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": "6bb1c8406fc40dc891af4c44be6e0d70aecd82ba4315f4287aecb4ad4cfbe177",
4
- "sourceCommit": "25187cf2fb824a3ba0b4e0dc3a4124af74eea77d"
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);
@@ -15492,6 +15497,11 @@ var WARM_IDLE_MS = 15 * 6e4;
15492
15497
  var TERMINAL_PULSE_MS = 4 * 6e4;
15493
15498
  var TERMINAL_IDLE_MS = 20 * 6e4;
15494
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.`;
15495
15505
  var TERMINAL_LOCAL_ENV = ["SSH_AUTH_SOCK", "EDITOR", "VISUAL", "PAGER", "LC_CTYPE"];
15496
15506
  function localLoginShell() {
15497
15507
  if (process.platform === "win32") return process.env.COMSPEC || "powershell.exe";
@@ -15721,6 +15731,8 @@ var WorkspaceEngine = class {
15721
15731
  orgPlugins = { entries: [], dirs: [] };
15722
15732
  /** The conversation's name was asked for (once, on its first turn). */
15723
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();
15724
15736
  /** The first message, named once the model has started answering it (two calls at once slowed the first answer). */
15725
15737
  titleWaiting = null;
15726
15738
  /** The project environment's setup, once per open repository (cloud only), and why the last one failed. */
@@ -16652,6 +16664,29 @@ ${String(item.content)}` : String(item.content);
16652
16664
  * A short name for a new conversation, from its first message: one small request to the session's fast model on
16653
16665
  * the gateway (measured like every other). Anything that fails leaves the conversation as it was.
16654
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
+ }
16655
16690
  /** Names the conversation from its first message now (the model answered it, or the turn ended without an answer). */
16656
16691
  nameNow() {
16657
16692
  const content = this.titleWaiting;
@@ -17321,6 +17356,9 @@ ${text3}`;
17321
17356
  headResult: null,
17322
17357
  turnEnded: false,
17323
17358
  lifecycle: false,
17359
+ spokeAt: null,
17360
+ openingAsked: false,
17361
+ silenceNudges: 0,
17324
17362
  chosen: boot.model && !boot.model.startsWith("sq-auto") ? boot.model : null,
17325
17363
  fellBack: false,
17326
17364
  timing: new TurnTiming({ sessionId: this.deps.sessionId ?? null, turnId, model, reasoning: this.reasoningLevel }, typeof payload.receivedAt === "number" ? payload.receivedAt : null, turnStart)
@@ -17334,6 +17372,7 @@ ${text3}`;
17334
17372
  let conversation = resume;
17335
17373
  const newMapper = (forTurn, baseline) => new SdkEventMapper(this.deps.root, {
17336
17374
  emit: (e) => this.emitTurnEvent(live, e),
17375
+ withdrawn: (id) => this.withdrawn.delete(id),
17337
17376
  filesMaybeChanged: () => this.scheduleDiff(),
17338
17377
  sessionId: (id) => {
17339
17378
  sawInit = true;
@@ -17460,6 +17499,7 @@ ${text3}`;
17460
17499
  emitTurnEvent(live, e) {
17461
17500
  if (live.interrupted && e.type === "error" && /^(TURN_|MODEL_)/.test(e.data.code)) return;
17462
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();
17463
17503
  this.emit(e);
17464
17504
  }
17465
17505
  /** What a frame of the main conversation says about the turn: its model calls, foreground work, and the messages it read. */
@@ -17550,6 +17590,9 @@ ${text3}`;
17550
17590
  live.refused = false;
17551
17591
  live.turnId = turnId;
17552
17592
  live.fellBack = false;
17593
+ live.spokeAt = null;
17594
+ live.openingAsked = false;
17595
+ live.silenceNudges = 0;
17553
17596
  live.headUuid = members[0];
17554
17597
  live.headResult = null;
17555
17598
  live.turnEnded = false;
@@ -17686,6 +17729,7 @@ ${text3}`;
17686
17729
  secretFiles: i.secretFiles,
17687
17730
  protections: () => this.protections(),
17688
17731
  protection: { deps: this.protectionDeps(), approver: this.protectionApprover() },
17732
+ ...this.deps.talkFirst ? { talkFirst: (name, toolUseId) => this.talkFirst(name, toolUseId) } : {},
17689
17733
  beforeTool: async () => {
17690
17734
  const t0 = Date.now();
17691
17735
  await this.toolGate;
@@ -18607,6 +18651,8 @@ function buildQueryOptions(o) {
18607
18651
  if (input.hook_event_name !== "PreToolUse") return {};
18608
18652
  if (o.beforeTool) await o.beforeTool();
18609
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 } };
18610
18656
  if (name === "ExitPlanMode") return o.plan ? {} : { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: "Not in plan mode." } };
18611
18657
  if (name === QUESTION_TOOL) return o.askQuestion ? {} : { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: "Ask in your reply instead." } };
18612
18658
  const provenance = input.mcp_server;
@@ -19084,7 +19130,8 @@ function createLocalEngine(o) {
19084
19130
  exit: (code, reason) => o.exit(code, reason, startError),
19085
19131
  pathToClaudeCodeExecutable: process.env.CLAUDE_CODE_EXECUTABLE || void 0,
19086
19132
  // The next message's engine process is started while the person reads, like Claude Code's process between messages.
19087
- warmStart: true
19133
+ warmStart: true,
19134
+ talkFirst: true
19088
19135
  });
19089
19136
  }
19090
19137
  async function connectMain(argv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalequality/cli",
3
- "version": "0.4.37",
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": {