@moxt-ai/mobius 0.0.315 → 0.0.316

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
@@ -2086,7 +2086,7 @@ var init_package = __esm({
2086
2086
  "package.json"() {
2087
2087
  package_default = {
2088
2088
  name: "@moxt-ai/mobius",
2089
- version: "0.0.315",
2089
+ version: "0.0.316",
2090
2090
  description: "Mobius CLI for pairing and running local AI agent services.",
2091
2091
  type: "module",
2092
2092
  bin: {
@@ -96208,7 +96208,12 @@ var init_session_manager = __esm({
96208
96208
  return await runtime.loadHistoryEvents(eventLimit, cursor, options2.signal);
96209
96209
  });
96210
96210
  });
96211
- openNativeSession = async (options, origin) => this.#operations.run(options, async (options2) => {
96211
+ async #nativeTargetOptions(options, sessionId, resolveAgent) {
96212
+ const resolved = await resolveAgent(options.agent.id, options.signal, sessionId);
96213
+ options.signal.throwIfAborted();
96214
+ return { ...options, ...resolved, sessionId };
96215
+ }
96216
+ openNativeSession = async (options, origin, resolveAgent) => this.#operations.run(options, async (options2) => {
96212
96217
  const key = `${options2.agent.id}:${origin.nativeSessionId}`;
96213
96218
  if (this.#nativeOperations.has(key)) {
96214
96219
  throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
@@ -96227,10 +96232,8 @@ var init_session_manager = __esm({
96227
96232
  if (origin.kind === "import" && existing !== void 0) {
96228
96233
  return await this.#executionProcesses.use(existing.sessionId, async () => {
96229
96234
  this.#closedSessions.delete(existing.sessionId);
96230
- const runtime = await this.ensureSession({
96231
- ...options2,
96232
- sessionId: existing.sessionId
96233
- });
96235
+ const target2 = await this.#nativeTargetOptions(options2, existing.sessionId, resolveAgent);
96236
+ const runtime = await this.ensureSession(target2);
96234
96237
  if (this.#executions.command(existing.sessionId) !== void 0 || this.#nativeOperations.has(key)) {
96235
96238
  throw new AcpExecutionError(
96236
96239
  "Wait for the native session's running operation to finish",
@@ -96250,6 +96253,7 @@ var init_session_manager = __esm({
96250
96253
  }
96251
96254
  });
96252
96255
  }
96256
+ const target = await this.#nativeTargetOptions(options2, options2.sessionId, resolveAgent);
96253
96257
  if (this.#executionProcesses.get(options2.sessionId) !== void 0 || this.#executionProcesses.pending(options2.sessionId) !== void 0 || this.#store.read(options2.sessionId) instanceof FoundStoredSession) {
96254
96258
  throw new AcpExecutionError(
96255
96259
  "The destination conversation already exists",
@@ -96260,7 +96264,7 @@ var init_session_manager = __esm({
96260
96264
  return await this.#executionProcesses.use(options2.sessionId, async () => {
96261
96265
  this.#nativeOperations.add(key);
96262
96266
  try {
96263
- const runtime = await this.#startPreparation({ ...options2, origin }, { kind: "interactive-only" });
96267
+ const runtime = await this.#startPreparation({ ...target, origin }, { kind: "interactive-only" });
96264
96268
  const openedKey = `${options2.agent.id}:${runtime.nativeSessionId()}`;
96265
96269
  this.#nativeOperations.add(openedKey);
96266
96270
  try {
@@ -96544,7 +96548,8 @@ var init_native_session_browser = __esm({
96544
96548
  sessionId: command.targetSessionId,
96545
96549
  additionalDirectories: target.additionalDirectories
96546
96550
  },
96547
- action === "fork" ? { kind: "fork", nativeSessionId: target.info.sessionId, title: title2 } : { kind: "import", nativeSessionId: target.info.sessionId, title: title2 }
96551
+ action === "fork" ? { kind: "fork", nativeSessionId: target.info.sessionId, title: title2 } : { kind: "import", nativeSessionId: target.info.sessionId, title: title2 },
96552
+ this.#resolveAgent
96548
96553
  );
96549
96554
  signal.throwIfAborted();
96550
96555
  const ready = {
@@ -99443,7 +99448,7 @@ async function executeSessionHistoryPageLoad(socket, command, config2, resolveAg
99443
99448
  );
99444
99449
  const loadOptions = {
99445
99450
  additionalDirectories: resolved.additionalDirectories,
99446
- ...await resolveAgent(entry.agentId, signal),
99451
+ ...await resolveAgent(entry.agentId, signal, command.sessionId),
99447
99452
  cwd: resolved.cwd,
99448
99453
  sessionId: command.sessionId,
99449
99454
  signal
@@ -99490,7 +99495,7 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, re
99490
99495
  );
99491
99496
  const loadOptions = {
99492
99497
  additionalDirectories: resolved.additionalDirectories,
99493
- ...await resolveAgent(command.agentId, signal),
99498
+ ...await resolveAgent(command.agentId, signal, command.sessionId),
99494
99499
  cwd: resolved.cwd,
99495
99500
  sessionId: command.sessionId,
99496
99501
  signal
@@ -100158,7 +100163,7 @@ async function executePrompt({
100158
100163
  command.additionalDirectoryIds,
100159
100164
  signal
100160
100165
  );
100161
- const { agent, adapter } = await resolveAgent(command.agentId, signal);
100166
+ const { agent, adapter } = await resolveAgent(command.agentId, signal, command.sessionId);
100162
100167
  const availability = await waitForSessionAvailability(signal);
100163
100168
  if (availability.kind === "busy") {
100164
100169
  throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
@@ -100554,7 +100559,7 @@ async function prepareSession(command, recovery, closed, config2, resolveAgent,
100554
100559
  signal
100555
100560
  )
100556
100561
  );
100557
- const resolvedAgent = await resolveAgent(command.agentId, signal);
100562
+ const resolvedAgent = await resolveAgent(command.agentId, signal, command.sessionId);
100558
100563
  const preparation = {
100559
100564
  additionalDirectories: resolved.additionalDirectories,
100560
100565
  ...resolvedAgent,
@@ -100717,7 +100722,7 @@ async function executeSessionConfigure(socket, command, config2, resolveAgent, d
100717
100722
  );
100718
100723
  const configOptions = await sessions.configureSession({
100719
100724
  additionalDirectories: resolved.additionalDirectories,
100720
- ...await resolveAgent(command.agentId, signal),
100725
+ ...await resolveAgent(command.agentId, signal, command.sessionId),
100721
100726
  booleanValue: command.booleanValue,
100722
100727
  configId: command.configId,
100723
100728
  cwd: resolved.cwd,
@@ -101712,8 +101717,10 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
101712
101717
  processes,
101713
101718
  (sessionId, content, contentSignal) => externalContent.put({ ...content, sessionId, signal: contentSignal })
101714
101719
  );
101715
- const resolveAgent = async (agentId, resolveSignal) => {
101716
- const agent = await resolveCatalogAgent(config2, agentId, resolveSignal);
101720
+ const resolveAgent = async (agentId, resolveSignal, sessionId) => {
101721
+ const catalogAgent = await resolveCatalogAgent(config2, agentId, resolveSignal);
101722
+ const environment = sessionId === void 0 ? void 0 : config2.sessionEnvironment?.({ sessionId, agentId });
101723
+ const agent = environment === void 0 ? catalogAgent : catalogAgent.withEnvironment({ ...catalogAgent.environment, ...environment });
101717
101724
  return { agent, adapter: adapters.resolve(agent) };
101718
101725
  };
101719
101726
  const layer = buildSessionLayer({