squadrant 0.12.0 → 0.12.1

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.
package/dist/index.js CHANGED
@@ -34,14 +34,14 @@ function getDefaultConfig() {
34
34
  models: {
35
35
  command: "opus",
36
36
  captain: "opus",
37
- crew: "opus",
37
+ crew: "sonnet",
38
38
  exploration: "haiku",
39
39
  review: "opus"
40
40
  },
41
41
  roles: {
42
42
  command: { agent: "claude", model: "opus" },
43
43
  captain: { agent: "claude", model: "opus" },
44
- crew: { agent: "claude", model: "opus" },
44
+ crew: { agent: "claude", model: "sonnet" },
45
45
  exploration: { agent: "claude", model: "haiku" },
46
46
  side: { agent: "claude", model: "opus" }
47
47
  },
@@ -579,7 +579,7 @@ var init_config_drift = __esm({
579
579
  }
580
580
  ];
581
581
  KNOWN_DEFAULT_HISTORY = [
582
- { path: "defaults.roles.crew.model", oldDefaults: ["sonnet"] },
582
+ { path: "defaults.roles.crew.model", oldDefaults: ["opus"] },
583
583
  { path: "defaults.roles.captain.model", oldDefaults: ["sonnet"] }
584
584
  ];
585
585
  KNOWN_DRIVERS = /* @__PURE__ */ new Set(["claude", "codex", "gemini", "opencode"]);
@@ -2632,7 +2632,8 @@ async function runCrewSend(project, name, message, runtime, workspaceId, deps) {
2632
2632
  }
2633
2633
  } catch {
2634
2634
  }
2635
- await runtime.sendToPane(crew, message);
2635
+ const deliver = deps.sendToPane ?? ((pane, msg) => runtime.sendToPane(pane, msg));
2636
+ await deliver(crew, message);
2636
2637
  }
2637
2638
  async function runCrewRead(project, name, runtime, workspaceId) {
2638
2639
  const crew = await findCrewPane(runtime, workspaceId, project, name);
@@ -2999,8 +3000,14 @@ function createCmuxDriver() {
2999
3000
  }
3000
3001
  },
3001
3002
  async sendToPane(pane, message) {
3002
- await cmux(["send", "--workspace", pane.workspaceId, "--surface", pane.surfaceId, sanitizeForCmuxSend(message)]);
3003
- await cmux(["send-key", "--workspace", pane.workspaceId, "--surface", pane.surfaceId, "Enter"]);
3003
+ await this.pasteToPane(pane, message);
3004
+ await this.sendKeyToPane(pane, "Enter");
3005
+ },
3006
+ async pasteToPane(pane, text) {
3007
+ await cmux(["send", "--workspace", pane.workspaceId, "--surface", pane.surfaceId, sanitizeForCmuxSend(text)]);
3008
+ },
3009
+ async sendKeyToPane(pane, key) {
3010
+ await cmux(["send-key", "--workspace", pane.workspaceId, "--surface", pane.surfaceId, key]);
3004
3011
  },
3005
3012
  async readPaneScreen(pane) {
3006
3013
  try {
@@ -3556,6 +3563,16 @@ var init_daemon_cmux = __esm({
3556
3563
 
3557
3564
  // packages/workspaces/dist/crew-pane.js
3558
3565
  import net from "net";
3566
+ async function settleInputBox(runtime, pane) {
3567
+ let prev = await runtime.readPaneScreen(pane) ?? "";
3568
+ for (let i = 0; i < SETTLE_MAX_POLLS; i++) {
3569
+ await new Promise((r) => setTimeout(r, SETTLE_POLL_MS));
3570
+ const cur = await runtime.readPaneScreen(pane) ?? "";
3571
+ if (cur === prev)
3572
+ return;
3573
+ prev = cur;
3574
+ }
3575
+ }
3559
3576
  function getFreePort() {
3560
3577
  return new Promise((resolve3, reject) => {
3561
3578
  const srv = net.createServer();
@@ -3589,6 +3606,23 @@ async function resolveCaptainWorkspace(project) {
3589
3606
  }
3590
3607
  return { runtime, workspaceId: captain.id };
3591
3608
  }
3609
+ async function confirmedSendToPane(runtime, pane, message) {
3610
+ const preSendScreen = await runtime.readPaneScreen(pane) ?? "";
3611
+ await runtime.pasteToPane(pane, message);
3612
+ await settleInputBox(runtime, pane);
3613
+ await runtime.sendKeyToPane(pane, "Enter");
3614
+ for (let attempt = 0; attempt < SUBMIT_RETRY_LIMIT; attempt++) {
3615
+ await new Promise((r) => setTimeout(r, POST_SEND_CHECK_MS));
3616
+ const afterScreen = await runtime.readPaneScreen(pane) ?? "";
3617
+ const draft = parseDraftFromScreen(afterScreen);
3618
+ if (draft === "")
3619
+ return;
3620
+ if (draft === null && afterScreen !== preSendScreen)
3621
+ return;
3622
+ await settleInputBox(runtime, pane);
3623
+ await runtime.sendKeyToPane(pane, "Enter");
3624
+ }
3625
+ }
3592
3626
  async function sendFirstTurnWhenReady(runtime, pane, task, preLaunchScreen, acceptanceConfig) {
3593
3627
  await new Promise((r) => setTimeout(r, SEND_FIRST_TURN_FLOOR_MS));
3594
3628
  const maxPolls = Math.floor((SEND_FIRST_TURN_TIMEOUT_MS - SEND_FIRST_TURN_FLOOR_MS) / POLL_INTERVAL_MS);
@@ -3604,8 +3638,8 @@ async function sendFirstTurnWhenReady(runtime, pane, task, preLaunchScreen, acce
3604
3638
  }
3605
3639
  }
3606
3640
  const preSendScreen = await runtime.readPaneScreen(pane) ?? "";
3607
- await runtime.sendToPane(pane, task);
3608
3641
  if (acceptanceConfig?.splashMarker) {
3642
+ await runtime.sendToPane(pane, task);
3609
3643
  for (let check2 = 0; check2 < SPLASH_MAX_CHECKS; check2++) {
3610
3644
  await new Promise((r) => setTimeout(r, POST_SEND_CHECK_MS));
3611
3645
  const afterScreen = await runtime.readPaneScreen(pane) ?? "";
@@ -3616,21 +3650,25 @@ async function sendFirstTurnWhenReady(runtime, pane, task, preLaunchScreen, acce
3616
3650
  await runtime.sendToPane(pane, task);
3617
3651
  }
3618
3652
  }
3619
- } else {
3620
- const retryLimit = acceptanceConfig?.retryLimit ?? 2;
3621
- for (let attempt = 0; attempt < retryLimit; attempt++) {
3622
- await new Promise((r) => setTimeout(r, POST_SEND_CHECK_MS));
3623
- const afterScreen = await runtime.readPaneScreen(pane) ?? "";
3624
- if (isTurnAccepted(preSendScreen, afterScreen, acceptanceConfig)) {
3625
- return;
3626
- }
3627
- if (attempt < retryLimit - 1) {
3628
- await runtime.sendToPane(pane, task);
3629
- }
3630
- }
3653
+ return;
3654
+ }
3655
+ await runtime.pasteToPane(pane, task);
3656
+ await settleInputBox(runtime, pane);
3657
+ await runtime.sendKeyToPane(pane, "Enter");
3658
+ const retryLimit = acceptanceConfig?.retryLimit ?? SUBMIT_RETRY_LIMIT;
3659
+ for (let attempt = 0; attempt < retryLimit; attempt++) {
3660
+ await new Promise((r) => setTimeout(r, POST_SEND_CHECK_MS));
3661
+ const afterScreen = await runtime.readPaneScreen(pane) ?? "";
3662
+ const draft = parseDraftFromScreen(afterScreen);
3663
+ if (draft === "")
3664
+ return;
3665
+ if (draft === null && afterScreen !== preSendScreen)
3666
+ return;
3667
+ await settleInputBox(runtime, pane);
3668
+ await runtime.sendKeyToPane(pane, "Enter");
3631
3669
  }
3632
3670
  }
3633
- var SEND_FIRST_TURN_FLOOR_MS, POLL_INTERVAL_MS, SEND_FIRST_TURN_TIMEOUT_MS, POST_SEND_CHECK_MS, SPLASH_MAX_CHECKS, SPLASH_RESEND_EVERY_N;
3671
+ var SEND_FIRST_TURN_FLOOR_MS, POLL_INTERVAL_MS, SEND_FIRST_TURN_TIMEOUT_MS, POST_SEND_CHECK_MS, SPLASH_MAX_CHECKS, SPLASH_RESEND_EVERY_N, SETTLE_POLL_MS, SETTLE_MAX_POLLS, SUBMIT_RETRY_LIMIT;
3634
3672
  var init_crew_pane = __esm({
3635
3673
  "packages/workspaces/dist/crew-pane.js"() {
3636
3674
  init_dist();
@@ -3643,6 +3681,9 @@ var init_crew_pane = __esm({
3643
3681
  POST_SEND_CHECK_MS = 750;
3644
3682
  SPLASH_MAX_CHECKS = 20;
3645
3683
  SPLASH_RESEND_EVERY_N = 4;
3684
+ SETTLE_POLL_MS = 400;
3685
+ SETTLE_MAX_POLLS = 8;
3686
+ SUBMIT_RETRY_LIMIT = 4;
3646
3687
  }
3647
3688
  });
3648
3689
 
@@ -3657,6 +3698,7 @@ __export(dist_exports, {
3657
3698
  WorkspaceRegistry: () => WorkspaceRegistry,
3658
3699
  classifyStartupSurface: () => classifyStartupSurface,
3659
3700
  cmuxLocal: () => cmuxLocal,
3701
+ confirmedSendToPane: () => confirmedSendToPane,
3660
3702
  createCmuxDriver: () => createCmuxDriver,
3661
3703
  createCmuxNotifier: () => createCmuxNotifier,
3662
3704
  createObsidianDriver: () => createObsidianDriver,
@@ -7160,7 +7202,10 @@ async function runCrewSend2(project, name, message) {
7160
7202
  listTasks: async (p) => await squadrantdCall({ kind: "list", project: p }),
7161
7203
  emitEvent: async (p, event) => {
7162
7204
  await squadrantdCall({ kind: "event", project: p, event });
7163
- }
7205
+ },
7206
+ // #448: use paste-settle-Enter confirmation for follow-up sends (same guard
7207
+ // as first-turn #447) so large messages don't strand in paste mode.
7208
+ sendToPane: (pane, msg) => confirmedSendToPane(runtime, pane, msg)
7164
7209
  });
7165
7210
  }
7166
7211
  async function runCrewRead2(project, name) {