@cabane/companion 0.6.21 → 0.6.22

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/cli.js CHANGED
@@ -6834,10 +6834,11 @@ function describeSubAgentError(status2, body) {
6834
6834
  var Dispatcher = class {
6835
6835
  constructor(opts) {
6836
6836
  this.opts = opts;
6837
+ this.aborts = opts.aborts ?? /* @__PURE__ */ new Map();
6837
6838
  }
6838
6839
  opts;
6839
6840
  // SJ383: per-(conversation, agent) abort registry.
6840
- aborts = /* @__PURE__ */ new Map();
6841
+ aborts;
6841
6842
  notifyStart(info) {
6842
6843
  try {
6843
6844
  this.opts.observer?.onStart(info);
@@ -8587,6 +8588,7 @@ var CompanionSupervisor = class {
8587
8588
  outbox,
8588
8589
  log: this.log
8589
8590
  });
8591
+ const aborts = /* @__PURE__ */ new Map();
8590
8592
  const dispatcher = this.buildDispatcher({
8591
8593
  api,
8592
8594
  baseUrl: this.config.baseUrl,
@@ -8595,7 +8597,8 @@ var CompanionSupervisor = class {
8595
8597
  agentId: it.agentId,
8596
8598
  agentUsername: it.agentUsername,
8597
8599
  credential,
8598
- runConfig
8600
+ runConfig,
8601
+ aborts
8599
8602
  });
8600
8603
  const drain2 = this.makeDrain(api, it.agentId);
8601
8604
  wr.agents.set(it.agentId, {
@@ -8605,6 +8608,7 @@ var CompanionSupervisor = class {
8605
8608
  credential,
8606
8609
  runConfig,
8607
8610
  api,
8611
+ aborts,
8608
8612
  dispatcher,
8609
8613
  cancelDrain: drain2.cancel,
8610
8614
  kickDrain: drain2.kick
@@ -8640,7 +8644,12 @@ var CompanionSupervisor = class {
8640
8644
  return isClaudeCodeConnected(this.config) && this.claudeCodePresent();
8641
8645
  }
8642
8646
  buildDispatcher(ctx) {
8643
- if (this.dispatcherFactory) return this.dispatcherFactory(ctx);
8647
+ const local = localAgentConfig(this.config, {
8648
+ agentId: ctx.agentId,
8649
+ agentUsername: ctx.agentUsername,
8650
+ workspaceSlug: ctx.workspaceSlug
8651
+ });
8652
+ if (this.dispatcherFactory) return this.dispatcherFactory({ ...ctx, local });
8644
8653
  return new Dispatcher({
8645
8654
  api: ctx.api,
8646
8655
  baseUrl: ctx.baseUrl,
@@ -8649,11 +8658,8 @@ var CompanionSupervisor = class {
8649
8658
  agentId: ctx.agentId,
8650
8659
  agentUsername: ctx.agentUsername,
8651
8660
  credential: ctx.credential,
8652
- local: localAgentConfig(this.config, {
8653
- agentId: ctx.agentId,
8654
- agentUsername: ctx.agentUsername,
8655
- workspaceSlug: ctx.workspaceSlug
8656
- }),
8661
+ local,
8662
+ aborts: ctx.aborts,
8657
8663
  runConfig: ctx.runConfig,
8658
8664
  log: this.log,
8659
8665
  // CT833: register the claude-code adapter only when this device actually
@@ -8923,6 +8929,7 @@ var CompanionSupervisor = class {
8923
8929
  if (!next) return;
8924
8930
  this.config = next;
8925
8931
  this.log.level = next.logLevel ?? "debug";
8932
+ this.rebuildDispatchers();
8926
8933
  void this.refreshAssignments();
8927
8934
  }
8928
8935
  // The dashboard "refresh assignments" control — an immediate pull.
@@ -9020,8 +9027,8 @@ var CompanionSupervisor = class {
9020
9027
  }
9021
9028
  // Re-create every running agent's Dispatcher from the CURRENT config, keeping
9022
9029
  // the runner (its api/outbox/chains/SSE) intact. Used after a runtime-enabling
9023
- // config change so the adapter registry rebuilt per turn from the dispatcher's
9024
- // constructor optspicks up the new opencode/codex adapter.
9030
+ // config change so constructor-captured options — per-agent cwd/prepareHook and
9031
+ // the adapter registry pick up their new values without an app restart.
9025
9032
  rebuildDispatchers() {
9026
9033
  for (const wr of this.workspaces.values()) {
9027
9034
  for (const runner of wr.agents.values()) {
@@ -9033,7 +9040,8 @@ var CompanionSupervisor = class {
9033
9040
  agentId: runner.agentId,
9034
9041
  agentUsername: runner.username,
9035
9042
  credential: runner.credential,
9036
- runConfig: runner.runConfig
9043
+ runConfig: runner.runConfig,
9044
+ aborts: runner.aborts
9037
9045
  });
9038
9046
  }
9039
9047
  }
package/dist/runtime.js CHANGED
@@ -6456,10 +6456,11 @@ function describeSubAgentError(status, body) {
6456
6456
  var Dispatcher = class {
6457
6457
  constructor(opts) {
6458
6458
  this.opts = opts;
6459
+ this.aborts = opts.aborts ?? /* @__PURE__ */ new Map();
6459
6460
  }
6460
6461
  opts;
6461
6462
  // SJ383: per-(conversation, agent) abort registry.
6462
- aborts = /* @__PURE__ */ new Map();
6463
+ aborts;
6463
6464
  notifyStart(info) {
6464
6465
  try {
6465
6466
  this.opts.observer?.onStart(info);
@@ -8209,6 +8210,7 @@ var CompanionSupervisor = class {
8209
8210
  outbox,
8210
8211
  log: this.log
8211
8212
  });
8213
+ const aborts = /* @__PURE__ */ new Map();
8212
8214
  const dispatcher = this.buildDispatcher({
8213
8215
  api,
8214
8216
  baseUrl: this.config.baseUrl,
@@ -8217,7 +8219,8 @@ var CompanionSupervisor = class {
8217
8219
  agentId: it.agentId,
8218
8220
  agentUsername: it.agentUsername,
8219
8221
  credential,
8220
- runConfig
8222
+ runConfig,
8223
+ aborts
8221
8224
  });
8222
8225
  const drain2 = this.makeDrain(api, it.agentId);
8223
8226
  wr.agents.set(it.agentId, {
@@ -8227,6 +8230,7 @@ var CompanionSupervisor = class {
8227
8230
  credential,
8228
8231
  runConfig,
8229
8232
  api,
8233
+ aborts,
8230
8234
  dispatcher,
8231
8235
  cancelDrain: drain2.cancel,
8232
8236
  kickDrain: drain2.kick
@@ -8262,7 +8266,12 @@ var CompanionSupervisor = class {
8262
8266
  return isClaudeCodeConnected(this.config) && this.claudeCodePresent();
8263
8267
  }
8264
8268
  buildDispatcher(ctx) {
8265
- if (this.dispatcherFactory) return this.dispatcherFactory(ctx);
8269
+ const local = localAgentConfig(this.config, {
8270
+ agentId: ctx.agentId,
8271
+ agentUsername: ctx.agentUsername,
8272
+ workspaceSlug: ctx.workspaceSlug
8273
+ });
8274
+ if (this.dispatcherFactory) return this.dispatcherFactory({ ...ctx, local });
8266
8275
  return new Dispatcher({
8267
8276
  api: ctx.api,
8268
8277
  baseUrl: ctx.baseUrl,
@@ -8271,11 +8280,8 @@ var CompanionSupervisor = class {
8271
8280
  agentId: ctx.agentId,
8272
8281
  agentUsername: ctx.agentUsername,
8273
8282
  credential: ctx.credential,
8274
- local: localAgentConfig(this.config, {
8275
- agentId: ctx.agentId,
8276
- agentUsername: ctx.agentUsername,
8277
- workspaceSlug: ctx.workspaceSlug
8278
- }),
8283
+ local,
8284
+ aborts: ctx.aborts,
8279
8285
  runConfig: ctx.runConfig,
8280
8286
  log: this.log,
8281
8287
  // CT833: register the claude-code adapter only when this device actually
@@ -8545,6 +8551,7 @@ var CompanionSupervisor = class {
8545
8551
  if (!next) return;
8546
8552
  this.config = next;
8547
8553
  this.log.level = next.logLevel ?? "debug";
8554
+ this.rebuildDispatchers();
8548
8555
  void this.refreshAssignments();
8549
8556
  }
8550
8557
  // The dashboard "refresh assignments" control — an immediate pull.
@@ -8642,8 +8649,8 @@ var CompanionSupervisor = class {
8642
8649
  }
8643
8650
  // Re-create every running agent's Dispatcher from the CURRENT config, keeping
8644
8651
  // the runner (its api/outbox/chains/SSE) intact. Used after a runtime-enabling
8645
- // config change so the adapter registry rebuilt per turn from the dispatcher's
8646
- // constructor optspicks up the new opencode/codex adapter.
8652
+ // config change so constructor-captured options — per-agent cwd/prepareHook and
8653
+ // the adapter registry pick up their new values without an app restart.
8647
8654
  rebuildDispatchers() {
8648
8655
  for (const wr of this.workspaces.values()) {
8649
8656
  for (const runner of wr.agents.values()) {
@@ -8655,7 +8662,8 @@ var CompanionSupervisor = class {
8655
8662
  agentId: runner.agentId,
8656
8663
  agentUsername: runner.username,
8657
8664
  credential: runner.credential,
8658
- runConfig: runner.runConfig
8665
+ runConfig: runner.runConfig,
8666
+ aborts: runner.aborts
8659
8667
  });
8660
8668
  }
8661
8669
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
4
4
  "type": "module",
5
5
  "description": "The Cabane Companion (headless): connect a coding agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
6
6
  "license": "UNLICENSED",