squadrant 0.20.1 → 0.20.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.
@@ -124,6 +124,10 @@ function getDefaultConfig() {
124
124
  // Audit C2: OFF by design — cmux hibernation is global-only and would
125
125
  // hibernate the captain. See the field doc above.
126
126
  cmuxAgentHibernation: false,
127
+ // #667: fresh installs ship native delivery for both proven agents.
128
+ // Existing configs without the block still resolve to "off" (the
129
+ // resolver fallback is the safety net).
130
+ controlChannel: { claude: "on", opencode: "on" },
127
131
  crewRouting: {
128
132
  rules: [
129
133
  { tier: "extreme", match: "redesign|architect|rewrite|from scratch|deep reasoning", agent: "claude", model: "opus" },
@@ -9628,6 +9632,7 @@ import os12 from "os";
9628
9632
  import path20 from "path";
9629
9633
 
9630
9634
  // packages/agents/dist/opencode/http-channel.js
9635
+ init_dist2();
9631
9636
  var OpencodeHttpChannel = class {
9632
9637
  name = "opencode-http";
9633
9638
  agent = "opencode";
@@ -9636,12 +9641,16 @@ var OpencodeHttpChannel = class {
9636
9641
  fetchImpl;
9637
9642
  portFor;
9638
9643
  sessionFor;
9644
+ directoryFor;
9645
+ createdAfterFor;
9639
9646
  timeoutMs;
9640
9647
  log;
9641
9648
  constructor(deps) {
9642
9649
  this.fetchImpl = deps.fetchImpl ?? fetch;
9643
9650
  this.portFor = deps.portFor;
9644
9651
  this.sessionFor = deps.sessionFor;
9652
+ this.directoryFor = deps.directoryFor;
9653
+ this.createdAfterFor = deps.createdAfterFor;
9645
9654
  this.timeoutMs = deps.timeoutMs ?? 5e3;
9646
9655
  this.log = deps.log;
9647
9656
  }
@@ -9694,11 +9703,24 @@ var OpencodeHttpChannel = class {
9694
9703
  * are tried. This is a capability probe, NOT a version comparison — the honest
9695
9704
  * check is "does this route answer", and neither path is a promised-stable
9696
9705
  * contract. Re-run the smoke suite when opencode is upgraded.
9706
+ *
9707
+ * #787: when the crew's directory is known, resolve by EXACT directory
9708
+ * (realpath-normalized) and never fall back to the project-wide newest.
9709
+ * GET /session is project-scoped (shared by every worktree of the repo), so
9710
+ * "newest" can be a sibling crew's — prompt_async at that id would run the
9711
+ * message in the wrong session.
9712
+ *
9713
+ * #789: opencode creates a session lazily (nothing exists until the first turn),
9714
+ * so a reused worktree dir can hold a prior crew's session. When the crew's
9715
+ * createdAt is known, also require the candidate to have been created at/after
9716
+ * it — otherwise a send resolves a stale session the live TUI is not showing.
9697
9717
  */
9698
9718
  async resolveSession(taskId, port) {
9699
9719
  const cached = this.sessionByTask.get(taskId);
9700
9720
  if (cached)
9701
9721
  return cached;
9722
+ const directory = this.directoryFor?.(taskId);
9723
+ const createdAfterMs = this.createdAfterFor?.(taskId);
9702
9724
  for (const path23 of ["/session?", "/api/session?"]) {
9703
9725
  let res;
9704
9726
  try {
@@ -9716,11 +9738,11 @@ var OpencodeHttpChannel = class {
9716
9738
  }
9717
9739
  if (!Array.isArray(sessions) || sessions.length === 0)
9718
9740
  continue;
9719
- const newest = sessions.reduce((a, b) => (b.time?.updated ?? 0) > (a.time?.updated ?? 0) ? b : a);
9720
- if (!newest?.id)
9741
+ const resolved = directory ? newestSessionInDirectory(sessions, directory, createdAfterMs) : sessions.reduce((a, b) => (b.time?.updated ?? 0) > (a.time?.updated ?? 0) ? b : a).id;
9742
+ if (!resolved)
9721
9743
  continue;
9722
- this.sessionByTask.set(taskId, newest.id);
9723
- return newest.id;
9744
+ this.sessionByTask.set(taskId, resolved);
9745
+ return resolved;
9724
9746
  }
9725
9747
  return void 0;
9726
9748
  }