@moxt-ai/mobius 0.0.50 → 0.0.51

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
@@ -31579,6 +31579,7 @@ var AcpProcessSession = class _AcpProcessSession {
31579
31579
  belongsTo = (agentId, cwd, additionalDirectories) => this.#agentId === agentId && this.#cwd === cwd && arraysEqual(this.#additionalDirectories, additionalDirectories);
31580
31580
  usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
31581
31581
  canRebind = () => !this.#prompted && !this.#turn.running;
31582
+ hasRunningTurn = () => this.#turn.running;
31582
31583
  prepared = () => new AcpPreparedSession(
31583
31584
  this.#agentName,
31584
31585
  this.#agentVersion,
@@ -33062,7 +33063,6 @@ var AcpSessionManager = class {
33062
33063
  const operation = (async () => {
33063
33064
  try {
33064
33065
  await this.#retireSessionProcess(options.sessionId, existing, async () => await existing.close());
33065
- this.#store.remove(options.sessionId);
33066
33066
  const runtime = await this.#startRetainedSessionProcess(
33067
33067
  options,
33068
33068
  async () => await AcpProcessSession.start(options, () => this.#observer, this.#store)
@@ -33102,7 +33102,6 @@ var AcpSessionManager = class {
33102
33102
  }
33103
33103
  } catch (error62) {
33104
33104
  await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.close());
33105
- this.#store.remove(options.sessionId);
33106
33105
  throw error62;
33107
33106
  }
33108
33107
  return runtime;
@@ -33222,11 +33221,11 @@ var AcpSessionManager = class {
33222
33221
  this.#touchExpectedSession(options.sessionId, existing);
33223
33222
  return existing.prepared();
33224
33223
  }
33225
- if (!existing.canRebind()) {
33224
+ if (existing.hasRunningTurn()) {
33226
33225
  throw new AcpExecutionError(
33227
- "The execution environment cannot change after a conversation has started",
33226
+ "The execution environment cannot change while a conversation turn is running",
33228
33227
  {},
33229
- "session_identity_mismatch"
33228
+ "session_busy"
33230
33229
  );
33231
33230
  }
33232
33231
  return (await this.#replaceExecutionPreparation(existing, options)).prepared();
@@ -40441,10 +40440,11 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
40441
40440
  "prompt_queue_target_unavailable"
40442
40441
  );
40443
40442
  }
40443
+ const executionAgent = command.sessionConfigurations === void 0 ? agent : agentForSessionConfiguration(agent, command.sessionConfigurations);
40444
40444
  if (command.sessionConfigurations !== void 0) {
40445
40445
  const prepared = await sessions.prepareExecutionSession({
40446
40446
  additionalDirectories: resolved.additionalDirectories,
40447
- agent,
40447
+ agent: executionAgent,
40448
40448
  cwd: resolved.cwd,
40449
40449
  sessionId: command.sessionId,
40450
40450
  signal
@@ -40457,7 +40457,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
40457
40457
  audit,
40458
40458
  prepared.configOptions,
40459
40459
  command.sessionConfigurations,
40460
- agent,
40460
+ executionAgent,
40461
40461
  resolved.cwd,
40462
40462
  resolved.additionalDirectories,
40463
40463
  command.commandId,
@@ -40488,7 +40488,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
40488
40488
  if (command.disposition === SessionPromptDisposition.Steer) {
40489
40489
  await sessions.steerPrompt({
40490
40490
  additionalDirectories: resolved.additionalDirectories,
40491
- agent,
40491
+ agent: executionAgent,
40492
40492
  commandId: command.commandId,
40493
40493
  cwd: resolved.cwd,
40494
40494
  images: attachments.images,
@@ -40502,7 +40502,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
40502
40502
  } else {
40503
40503
  const result = await sessions.runPrompt({
40504
40504
  additionalDirectories: resolved.additionalDirectories,
40505
- agent,
40505
+ agent: executionAgent,
40506
40506
  commandId: command.commandId,
40507
40507
  cwd: resolved.cwd,
40508
40508
  disposition: command.disposition,
@@ -40569,6 +40569,16 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
40569
40569
  function invalidSessionConfiguration(message) {
40570
40570
  return new AcpExecutionError(message, {}, "invalid_session_configuration");
40571
40571
  }
40572
+ function agentForSessionConfiguration(agent, selections) {
40573
+ const permission = selections.find((selection) => selection.configId === AGENT_PERMISSION_MODE_CONFIG_ID);
40574
+ if (permission === void 0) {
40575
+ throw invalidSessionConfiguration(
40576
+ `The Turn configuration does not match Agent setting ${AGENT_PERMISSION_MODE_CONFIG_ID}`
40577
+ );
40578
+ }
40579
+ validateSessionConfigurationSelection(agent.permissionProfile.option(agent.environment), permission);
40580
+ return agent.withPermissionMode(permission.value);
40581
+ }
40572
40582
  function validateSessionConfigurationSelection(option, selection) {
40573
40583
  if (option.type !== selection.valueType) {
40574
40584
  throw invalidSessionConfiguration(`The Agent setting ${selection.configId} changed type`);