squadrant 0.13.2 → 0.13.3

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
@@ -2569,7 +2569,12 @@ async function runCrewSpawn(input, config, deps) {
2569
2569
  task: input.task,
2570
2570
  name
2571
2571
  });
2572
- deps.writeSettingsLocal(spawnCwd);
2572
+ let hooksInstalled = false;
2573
+ try {
2574
+ deps.writeSettingsLocal(spawnCwd);
2575
+ hooksInstalled = true;
2576
+ } catch {
2577
+ }
2573
2578
  const cliCommand2 = agent.buildCommand({
2574
2579
  prompt: input.task,
2575
2580
  workdir: spawnCwd,
@@ -2593,7 +2598,7 @@ ${buildCompletionProtocol(rec.id, input.project)}`, preLaunchScreen);
2593
2598
  if (!claudeResult.delivered) {
2594
2599
  process.stderr.write(`\u26A0\uFE0F First turn not delivered for crew '${name}' \u2014 use 'squadrant crew send ${input.project} ${name}' to re-send the task.
2595
2600
  `);
2596
- } else {
2601
+ } else if (!hooksInstalled) {
2597
2602
  await deps.emitEvent?.(input.project, { type: "task.first-turn.confirmed", id: rec.id });
2598
2603
  }
2599
2604
  return { ...pane2, title: title2 };
@@ -2900,6 +2905,27 @@ function parseDraftFromScreen(screen) {
2900
2905
  }
2901
2906
  return "";
2902
2907
  }
2908
+ function hasCCInputBox(screen) {
2909
+ if (!screen)
2910
+ return false;
2911
+ const lines = screen.split(/\r?\n/);
2912
+ const HR_RE = /^\s*─{10,}\s*$/;
2913
+ let bottomHR = -1;
2914
+ let topHR = -1;
2915
+ for (let i = lines.length - 1; i >= 0; i--) {
2916
+ if (HR_RE.test(lines[i])) {
2917
+ if (bottomHR === -1)
2918
+ bottomHR = i;
2919
+ else {
2920
+ topHR = i;
2921
+ break;
2922
+ }
2923
+ }
2924
+ }
2925
+ if (topHR === -1)
2926
+ return false;
2927
+ return lines.slice(topHR + 1, bottomHR).some((l) => /[>❯]/.test(l));
2928
+ }
2903
2929
  function readInputBoxRaw(screen) {
2904
2930
  if (!screen)
2905
2931
  return null;
@@ -4033,7 +4059,7 @@ async function confirmedSendToPane(runtime, pane, message) {
4033
4059
  sawDraft = true;
4034
4060
  if (draft === "" && sawDraft)
4035
4061
  return { delivered: true };
4036
- if (draft === null && afterScreen !== preSendScreen)
4062
+ if (draft === null && afterScreen !== preSendScreen && sawDraft)
4037
4063
  return { delivered: true };
4038
4064
  const settled = await settleInputBox(runtime, pane);
4039
4065
  if (settled)
@@ -4053,7 +4079,7 @@ async function sendFirstTurnWhenReady(runtime, pane, task, preLaunchScreen, acce
4053
4079
  let stable = false;
4054
4080
  for (let i = 0; i < maxPolls && !stable; i++) {
4055
4081
  const screen = await runtime.readPaneScreen(pane) ?? "";
4056
- const hasInputBox = !!acceptanceConfig?.splashMarker || parseDraftFromScreen(screen) !== null;
4082
+ const hasInputBox = !!acceptanceConfig?.splashMarker || hasCCInputBox(screen);
4057
4083
  if (screen.length > 0 && screen === previousScreen && screen !== preLaunchScreen && hasInputBox) {
4058
4084
  stable = true;
4059
4085
  } else {
@@ -4092,7 +4118,7 @@ async function sendFirstTurnWhenReady(runtime, pane, task, preLaunchScreen, acce
4092
4118
  sawDraft = true;
4093
4119
  if (draft === "" && sawDraft)
4094
4120
  return { delivered: true };
4095
- if (draft === null && afterScreen !== preSendScreen)
4121
+ if (draft === null && afterScreen !== preSendScreen && sawDraft)
4096
4122
  return { delivered: true };
4097
4123
  const settled = await settleInputBox(runtime, pane);
4098
4124
  if (settled)
@@ -5833,6 +5859,8 @@ function mapClaudeHookToEvent(event, payload, taskId) {
5833
5859
  case "SubagentStop":
5834
5860
  case "PostToolUse":
5835
5861
  return { type: "task.progress", id: taskId, note: event.toLowerCase() };
5862
+ case "UserPromptSubmit":
5863
+ return { type: "task.first-turn.confirmed", id: taskId };
5836
5864
  default:
5837
5865
  return null;
5838
5866
  }
@@ -5840,7 +5868,7 @@ function mapClaudeHookToEvent(event, payload, taskId) {
5840
5868
  var EVENTS, claudeInteractive;
5841
5869
  var init_claude2 = __esm({
5842
5870
  "packages/agents/dist/interactive/claude.js"() {
5843
- EVENTS = ["Stop", "SubagentStop", "SessionEnd", "PostToolUse", "Notification"];
5871
+ EVENTS = ["Stop", "SubagentStop", "SessionEnd", "PostToolUse", "Notification", "UserPromptSubmit"];
5844
5872
  claudeInteractive = {
5845
5873
  provider: "claude",
5846
5874
  tier: "strong",
@@ -11028,9 +11056,10 @@ async function sendToSock(req) {
11028
11056
  function mapHookSub(sub, payload, taskId) {
11029
11057
  switch (sub) {
11030
11058
  case "session-start":
11031
- case "prompt-submit":
11032
11059
  case "pre-tool-use":
11033
11060
  return { type: "task.progress", id: taskId, note: sub };
11061
+ case "prompt-submit":
11062
+ return { type: "task.first-turn.confirmed", id: taskId };
11034
11063
  case "stop":
11035
11064
  return mapClaudeHookToEvent("Stop", payload, taskId);
11036
11065
  case "notification":