@moxt-ai/mobius 0.0.191 → 0.0.192

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.
Files changed (44) hide show
  1. package/dist/acp/agent-session.d.ts.map +1 -1
  2. package/dist/acp/agent-session.js +43 -15
  3. package/dist/acp/agent-session.js.map +1 -1
  4. package/dist/acp/codex/app-server-protocol.d.ts +12 -0
  5. package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
  6. package/dist/acp/codex/app-server-protocol.js +5 -5
  7. package/dist/acp/codex/app-server-protocol.js.map +1 -1
  8. package/dist/acp/codex/settings.d.ts +3 -0
  9. package/dist/acp/codex/settings.d.ts.map +1 -1
  10. package/dist/acp/codex/settings.js +5 -15
  11. package/dist/acp/codex/settings.js.map +1 -1
  12. package/dist/acp/session-configuration.d.ts +20 -0
  13. package/dist/acp/session-configuration.d.ts.map +1 -0
  14. package/dist/acp/session-configuration.js +49 -0
  15. package/dist/acp/session-configuration.js.map +1 -0
  16. package/dist/acp/session-store.d.ts +3 -1
  17. package/dist/acp/session-store.d.ts.map +1 -1
  18. package/dist/acp/session-store.js +9 -2
  19. package/dist/acp/session-store.js.map +1 -1
  20. package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
  21. package/dist/artifacts/local-file-streamer.js +4 -2
  22. package/dist/artifacts/local-file-streamer.js.map +1 -1
  23. package/dist/cli.js +173 -95
  24. package/dist/cli.js.map +4 -4
  25. package/dist/daemon-command-handler.d.ts.map +1 -1
  26. package/dist/daemon-command-handler.js +1 -1
  27. package/dist/daemon-command-handler.js.map +1 -1
  28. package/dist/daemon-history-commands.d.ts +3 -2
  29. package/dist/daemon-history-commands.d.ts.map +1 -1
  30. package/dist/daemon-history-commands.js +12 -5
  31. package/dist/daemon-history-commands.js.map +1 -1
  32. package/dist/generated/acp-session-store-migrations.d.ts +3 -0
  33. package/dist/generated/acp-session-store-migrations.d.ts.map +1 -1
  34. package/dist/generated/acp-session-store-migrations.js +5 -1
  35. package/dist/generated/acp-session-store-migrations.js.map +1 -1
  36. package/dist/index.js +173 -95
  37. package/dist/index.js.map +4 -4
  38. package/dist/runtime.js +173 -95
  39. package/dist/runtime.js.map +4 -4
  40. package/dist/schema/acp-session-store/acp-session.d.ts +16 -0
  41. package/dist/schema/acp-session-store/acp-session.d.ts.map +1 -1
  42. package/dist/schema/acp-session-store/acp-session.js +1 -0
  43. package/dist/schema/acp-session-store/acp-session.js.map +1 -1
  44. package/package.json +1 -1
package/dist/runtime.js CHANGED
@@ -21433,18 +21433,21 @@ var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loa
21433
21433
  var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
21434
21434
  var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
21435
21435
  var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
21436
- var pageLoadFields = {
21437
- additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
21438
- agentId: identifierStringSchema,
21439
- bindingId: identifierStringSchema,
21436
+ var pageRequestFields = {
21440
21437
  cursor: external_exports.string().min(1).max(512).nullable(),
21441
- directoryId: directoryIdentifier,
21442
21438
  eventLimit: external_exports.number().int().min(1).max(1e4),
21443
21439
  requestId: identifierStringSchema,
21444
21440
  sessionId: identifierStringSchema
21445
21441
  };
21446
- var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
21447
- var sessionPreviewHistoryPageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND) }).readonly();
21442
+ var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageRequestFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
21443
+ var sessionPreviewHistoryPageLoadSchema = external_exports.object({
21444
+ ...pageRequestFields,
21445
+ additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
21446
+ agentId: identifierStringSchema,
21447
+ bindingId: identifierStringSchema,
21448
+ directoryId: directoryIdentifier,
21449
+ kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND)
21450
+ }).readonly();
21448
21451
  var pageLoadedFields = {
21449
21452
  events: nativeSessionEventsV2Schema,
21450
21453
  requestId: identifierStringSchema,
@@ -23362,7 +23365,11 @@ var threadTurnSchema = external_exports.object({
23362
23365
  items: external_exports.array(external_exports.unknown()).max(1e5)
23363
23366
  });
23364
23367
  var threadTurnsSchema = external_exports.array(threadTurnSchema).max(1e5);
23368
+ var collaborationModeSchema = external_exports.object({
23369
+ mode: external_exports.enum(["default", "plan"])
23370
+ });
23365
23371
  var threadLifecycleResponseSchema = external_exports.object({
23372
+ collaborationMode: collaborationModeSchema.nullish(),
23366
23373
  model: boundedText(256).nullish(),
23367
23374
  reasoningEffort: boundedText(256).nullish(),
23368
23375
  serviceTier: boundedText(256).nullish(),
@@ -23407,9 +23414,7 @@ var modelListResponseSchema = external_exports.object({
23407
23414
  var threadSettingsUpdatedSchema = external_exports.object({
23408
23415
  threadId: boundedText(256),
23409
23416
  threadSettings: external_exports.object({
23410
- collaborationMode: external_exports.object({
23411
- mode: external_exports.enum(["default", "plan"])
23412
- }).nullish()
23417
+ collaborationMode: collaborationModeSchema.nullish()
23413
23418
  })
23414
23419
  });
23415
23420
 
@@ -23886,7 +23891,7 @@ var FULL_ACCESS_MODE = Object.freeze({
23886
23891
  sandboxPolicy: { type: "dangerFullAccess" }
23887
23892
  });
23888
23893
  var AGENT_MODES = Object.freeze([READ_ONLY_MODE, AGENT_MODE, FULL_ACCESS_MODE]);
23889
- var DEFAULT_MODE = AGENT_MODE;
23894
+ var DEFAULT_MODE = FULL_ACCESS_MODE;
23890
23895
  function initialMode(environment) {
23891
23896
  const requested = environment["INITIAL_AGENT_MODE"];
23892
23897
  if (requested === void 0) {
@@ -24004,9 +24009,6 @@ function effortSetting(model, currentValue) {
24004
24009
  var CodexSettings = class {
24005
24010
  #appServer;
24006
24011
  #models = [];
24007
- // Whether the current turn must carry a policy at all. Until the user picks a mode, Codex's own
24008
- // configuration decides, so `turn/start` omits the fields and inherits what the host set up.
24009
- #policySelected = false;
24010
24012
  // Whether a collaboration mode choice has been made in this session. A restored thread keeps
24011
24013
  // the mode Codex already persisted, so the first turn does not reset it to Build.
24012
24014
  #collaborationModeSelected = false;
@@ -24046,14 +24048,9 @@ var CodexSettings = class {
24046
24048
  const mode = AGENT_MODES.find((candidate) => candidate.id === selection.mode) ?? DEFAULT_MODE;
24047
24049
  const supportsFast = this.#model(selection.model)?.additionalSpeedTiers?.includes(FAST_TIER) === true;
24048
24050
  return {
24049
- // Until a mode is chosen, `config.toml` decides the sandbox and approval
24050
- // policy, and those fields stay off the turn so the host's own setup is
24051
- // inherited rather than overridden.
24052
- ...this.#policySelected ? {
24053
- approvalPolicy: mode.approvalPolicy,
24054
- approvalsReviewer: mode.approvalsReviewer,
24055
- sandboxPolicy: mode.sandboxPolicy
24056
- } : {},
24051
+ approvalPolicy: mode.approvalPolicy,
24052
+ approvalsReviewer: mode.approvalsReviewer,
24053
+ sandboxPolicy: mode.sandboxPolicy,
24057
24054
  // The collaboration mode rides on the turn: Codex applies it to the
24058
24055
  // thread, where it persists until changed. "Build" is Codex's `default`
24059
24056
  // mode, so it is only sent once a choice exists to apply.
@@ -24146,6 +24143,7 @@ var CodexSettings = class {
24146
24143
  this.#selection = {
24147
24144
  ...this.#selection,
24148
24145
  ...supported,
24146
+ collaborationMode: thread.collaborationMode?.mode ?? this.#selection.collaborationMode,
24149
24147
  fastMode: thread.serviceTier === SERVICE_TIER_FAST
24150
24148
  };
24151
24149
  };
@@ -24185,7 +24183,6 @@ var CodexSettings = class {
24185
24183
  );
24186
24184
  }
24187
24185
  this.#selection = { ...this.#selection, mode: value };
24188
- this.#policySelected = true;
24189
24186
  return;
24190
24187
  }
24191
24188
  if (configId === COLLABORATION_MODE_SETTING_ID) {
@@ -28529,6 +28526,54 @@ function sessionConfigProtocolForAgent(_agentId) {
28529
28526
  return standardSessionConfigProtocol;
28530
28527
  }
28531
28528
 
28529
+ // src/acp/session-configuration.ts
28530
+ var storedSessionConfigurationsSchema = external_exports.array(
28531
+ external_exports.discriminatedUnion("type", [
28532
+ external_exports.object({ booleanValue: external_exports.boolean(), configId: external_exports.string().max(128), type: external_exports.literal("boolean") }),
28533
+ external_exports.object({ configId: external_exports.string().max(128), type: external_exports.literal("select"), value: external_exports.string().max(500) })
28534
+ ])
28535
+ ).max(100);
28536
+ var decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(value);
28537
+ var AcpSessionConfigurations = class {
28538
+ #selected = [];
28539
+ stored = () => this.#selected;
28540
+ capture = (options) => {
28541
+ this.#selected = this.#selected.map((selection) => {
28542
+ const current = options.find(
28543
+ (option) => option.id === selection.configId && option.type === selection.type
28544
+ );
28545
+ if (current === void 0) {
28546
+ return selection;
28547
+ }
28548
+ return current.type === "boolean" ? { booleanValue: current.booleanValue, configId: current.id, type: "boolean" } : { configId: current.id, type: "select", value: current.currentValue };
28549
+ });
28550
+ };
28551
+ select = (option) => {
28552
+ const selected = option.type === "boolean" ? { booleanValue: option.booleanValue, configId: option.id, type: "boolean" } : { configId: option.id, type: "select", value: option.currentValue };
28553
+ this.#selected = [...this.#selected.filter((selection) => selection.configId !== selected.configId), selected];
28554
+ };
28555
+ restore = async (stored, options, apply, signal) => {
28556
+ this.#selected = stored;
28557
+ for (const selection of this.#selected) {
28558
+ const current = options.find(
28559
+ (option) => option.id === selection.configId && option.type === selection.type
28560
+ );
28561
+ if (current === void 0) {
28562
+ continue;
28563
+ }
28564
+ if (selection.type === "boolean") {
28565
+ if (current.booleanValue !== selection.booleanValue) {
28566
+ await apply(selection, signal);
28567
+ }
28568
+ continue;
28569
+ }
28570
+ if (current.currentValue !== selection.value && current.values.some((value) => value.value === selection.value)) {
28571
+ await apply(selection, signal);
28572
+ }
28573
+ }
28574
+ };
28575
+ };
28576
+
28532
28577
  // src/acp/session-contracts.ts
28533
28578
  var acpNativeHistoryReader = {
28534
28579
  access: () => ({ kind: "acp" })
@@ -34138,6 +34183,7 @@ var acpSession = sqliteTable("acp_session", {
34138
34183
  nativeSessionId: text("native_session_id").notNull(),
34139
34184
  cwd: text("cwd").notNull(),
34140
34185
  additionalDirectories: text("additional_directories").notNull(),
34186
+ configurations: text("configurations").notNull().default("[]"),
34141
34187
  prompted: integer2("prompted", { mode: "boolean" }).notNull(),
34142
34188
  title: text("title").notNull(),
34143
34189
  updatedAt: text("updated_at").notNull()
@@ -34405,15 +34451,17 @@ var AcpStoredSession = class {
34405
34451
  additionalDirectories;
34406
34452
  agentId;
34407
34453
  cwd;
34454
+ configurations;
34408
34455
  nativeSessionId;
34409
34456
  prompted;
34410
34457
  sessionId;
34411
34458
  title;
34412
34459
  updatedAt;
34413
- constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
34460
+ constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString(), configurations = []) {
34414
34461
  this.additionalDirectories = [...additionalDirectories];
34415
34462
  this.agentId = agentId;
34416
34463
  this.cwd = cwd;
34464
+ this.configurations = configurations.map((configuration) => ({ ...configuration }));
34417
34465
  this.nativeSessionId = nativeSessionId;
34418
34466
  this.prompted = prompted;
34419
34467
  this.sessionId = sessionId;
@@ -34463,6 +34511,7 @@ var MemoryAcpSessionStore = class {
34463
34511
  var storedSessionRowSchema = external_exports.object({
34464
34512
  additionalDirectories: external_exports.string(),
34465
34513
  agentId: external_exports.string(),
34514
+ configurations: external_exports.string(),
34466
34515
  cwd: external_exports.string(),
34467
34516
  nativeSessionId: external_exports.string(),
34468
34517
  prompted: external_exports.boolean(),
@@ -34474,6 +34523,8 @@ function decodeStoredSession(value) {
34474
34523
  const row = storedSessionRowSchema.parse(value);
34475
34524
  const decodedAdditionalDirectories = JSON.parse(row.additionalDirectories);
34476
34525
  const additionalDirectories = external_exports.array(external_exports.string()).parse(decodedAdditionalDirectories);
34526
+ const decodedConfigurations = JSON.parse(row.configurations);
34527
+ const configurations = decodeStoredSessionConfigurations(decodedConfigurations);
34477
34528
  return new AcpStoredSession(
34478
34529
  row.sessionId,
34479
34530
  row.agentId,
@@ -34482,7 +34533,8 @@ function decodeStoredSession(value) {
34482
34533
  additionalDirectories,
34483
34534
  row.prompted,
34484
34535
  row.title,
34485
- row.updatedAt
34536
+ row.updatedAt,
34537
+ configurations
34486
34538
  );
34487
34539
  }
34488
34540
  var SqliteAcpSessionStore = class {
@@ -34515,6 +34567,7 @@ var SqliteAcpSessionStore = class {
34515
34567
  const value = {
34516
34568
  additionalDirectories: JSON.stringify(session.additionalDirectories),
34517
34569
  agentId: session.agentId,
34570
+ configurations: JSON.stringify(session.configurations),
34518
34571
  cwd: session.cwd,
34519
34572
  nativeSessionId: session.nativeSessionId,
34520
34573
  prompted: session.prompted,
@@ -34563,6 +34616,7 @@ var AgentSession = class _AgentSession {
34563
34616
  #commands = [];
34564
34617
  #configRevision = 0;
34565
34618
  #configOptions = [];
34619
+ #sessionConfigurations = new AcpSessionConfigurations();
34566
34620
  #nativeHistoryOwnership = { kind: "unbound" };
34567
34621
  #prompted = false;
34568
34622
  #nativePrompt = null;
@@ -34667,6 +34721,41 @@ var AgentSession = class _AgentSession {
34667
34721
  usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
34668
34722
  canRebind = () => !this.#prompted && !this.#turn.running;
34669
34723
  hasRunningTurn = () => this.#turn.running;
34724
+ #writeStoredSession = () => {
34725
+ this.#store.write(
34726
+ new AcpStoredSession(
34727
+ this.#mobiusSessionId,
34728
+ this.#agentId,
34729
+ this.#updates.sessionId(),
34730
+ this.#cwd,
34731
+ this.#additionalDirectories,
34732
+ this.#prompted,
34733
+ this.#sessionTitle ?? "",
34734
+ (/* @__PURE__ */ new Date()).toISOString(),
34735
+ this.#sessionConfigurations.stored()
34736
+ )
34737
+ );
34738
+ };
34739
+ #captureSelectedConfigurationValues = () => {
34740
+ this.#sessionConfigurations.capture(this.#configOptions);
34741
+ if (this.#updates.sessionId().length > 0) {
34742
+ this.#writeStoredSession();
34743
+ }
34744
+ };
34745
+ #restoreStoredConfigurations = async (session, signal) => {
34746
+ await this.#sessionConfigurations.restore(
34747
+ session.configurations,
34748
+ this.#configOptions,
34749
+ async (selection, signal2) => await this.#applyConfiguration(
34750
+ selection.configId,
34751
+ selection.type === "select" ? selection.value : "",
34752
+ selection.type === "boolean" ? selection.booleanValue : false,
34753
+ selection.type,
34754
+ signal2
34755
+ ),
34756
+ signal
34757
+ );
34758
+ };
34670
34759
  prepared = () => new AcpPreparedSession(
34671
34760
  this.#agentName,
34672
34761
  this.#agentVersion,
@@ -35017,20 +35106,12 @@ var AgentSession = class _AgentSession {
35017
35106
  lifecycleResponse = created;
35018
35107
  }
35019
35108
  this.#configOptions = this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
35109
+ if (stored instanceof FoundAcpStoredSession && this.#restored) {
35110
+ await this.#restoreStoredConfigurations(stored.session, signal);
35111
+ }
35020
35112
  await this.#updates.drained();
35021
35113
  signal.throwIfAborted();
35022
- this.#store.write(
35023
- new AcpStoredSession(
35024
- this.#mobiusSessionId,
35025
- this.#agentId,
35026
- this.#updates.sessionId(),
35027
- this.#cwd,
35028
- this.#additionalDirectories,
35029
- this.#prompted,
35030
- this.#sessionTitle ?? "",
35031
- (/* @__PURE__ */ new Date()).toISOString()
35032
- )
35033
- );
35114
+ this.#writeStoredSession();
35034
35115
  };
35035
35116
  listNativeSessions = async (cursor, signal) => {
35036
35117
  if (!this.#capabilities.listSessions) {
@@ -35071,15 +35152,17 @@ var AgentSession = class _AgentSession {
35071
35152
  this.#cwd,
35072
35153
  this.#additionalDirectories,
35073
35154
  false,
35074
- ""
35155
+ "",
35156
+ (/* @__PURE__ */ new Date()).toISOString(),
35157
+ this.#sessionConfigurations.stored()
35075
35158
  )
35076
35159
  );
35077
35160
  this.#store.remove(previousSessionId);
35078
35161
  this.#mobiusSessionId = sessionId;
35079
35162
  };
35080
- configure = async (options) => {
35081
- const existing = this.#configOptions.find((option) => option.id === options.configId);
35082
- if (existing === void 0 || existing.type !== options.valueType) {
35163
+ #applyConfiguration = async (configId, value, booleanValue, valueType, signal) => {
35164
+ const existing = this.#configOptions.find((option) => option.id === configId);
35165
+ if (existing === void 0 || existing.type !== valueType) {
35083
35166
  throw new AcpExecutionError(
35084
35167
  "The requested ACP configuration option is unavailable",
35085
35168
  {},
@@ -35094,10 +35177,10 @@ var AgentSession = class _AgentSession {
35094
35177
  "invalid_session_configuration"
35095
35178
  );
35096
35179
  }
35097
- if (!existing.values.some((entry) => entry.value === options.value)) {
35180
+ if (!existing.values.some((entry) => entry.value === value)) {
35098
35181
  throw new AcpConfigurationValueUnavailableError(
35099
- options.configId,
35100
- options.value,
35182
+ configId,
35183
+ value,
35101
35184
  existing.values.map((entry) => entry.value)
35102
35185
  );
35103
35186
  }
@@ -35106,20 +35189,20 @@ var AgentSession = class _AgentSession {
35106
35189
  try {
35107
35190
  const configured = await this.#sessionConfigProtocol.configure(
35108
35191
  this.#configOptions,
35109
- options,
35192
+ { booleanValue, configId, signal, value },
35110
35193
  this.#updates.sessionId(),
35111
35194
  {
35112
- request: async (method, params, failureMessage, signal) => await this.race(
35195
+ request: async (method, params, failureMessage, signal2) => await this.race(
35113
35196
  this.#connection.connection.agent.request(method, params, {
35114
- cancellationSignal: signal
35197
+ cancellationSignal: signal2
35115
35198
  }),
35116
35199
  failureMessage,
35117
- signal
35200
+ signal2
35118
35201
  )
35119
35202
  }
35120
35203
  );
35121
- const applied = configured.find((option) => option.id === options.configId);
35122
- if (applied === void 0 || applied.type !== options.valueType || applied.type === "boolean" && applied.booleanValue !== options.booleanValue || applied.type === "select" && applied.currentValue !== options.value) {
35204
+ const applied = configured.find((option) => option.id === configId);
35205
+ if (applied === void 0 || applied.type !== valueType || applied.type === "boolean" && applied.booleanValue !== booleanValue || applied.type === "select" && applied.currentValue !== value) {
35123
35206
  throw new AcpExecutionError(
35124
35207
  "The Agent did not apply the requested session configuration",
35125
35208
  {},
@@ -35136,6 +35219,21 @@ var AgentSession = class _AgentSession {
35136
35219
  }
35137
35220
  throw error62;
35138
35221
  }
35222
+ };
35223
+ configure = async (options) => {
35224
+ await this.#applyConfiguration(
35225
+ options.configId,
35226
+ options.value,
35227
+ options.booleanValue,
35228
+ options.valueType,
35229
+ options.signal
35230
+ );
35231
+ const applied = this.#configOptions.find((option) => option.id === options.configId);
35232
+ if (applied === void 0) {
35233
+ throw new AcpExecutionError("The requested ACP configuration option is unavailable");
35234
+ }
35235
+ this.#sessionConfigurations.select(applied);
35236
+ this.#writeStoredSession();
35139
35237
  return this.#configOptions;
35140
35238
  };
35141
35239
  buildPrompt = (options) => {
@@ -35210,19 +35308,8 @@ var AgentSession = class _AgentSession {
35210
35308
  if (this.#sessionTitle === null || this.#sessionTitle.length === 0) {
35211
35309
  this.#sessionTitle = truncate(options.prompt, 500);
35212
35310
  }
35213
- this.#store.write(
35214
- new AcpStoredSession(
35215
- this.#mobiusSessionId,
35216
- this.#agentId,
35217
- this.#updates.sessionId(),
35218
- this.#cwd,
35219
- this.#additionalDirectories,
35220
- true,
35221
- this.#sessionTitle,
35222
- (/* @__PURE__ */ new Date()).toISOString()
35223
- )
35224
- );
35225
35311
  this.#prompted = true;
35312
+ this.#writeStoredSession();
35226
35313
  const running = new RunningAcpTurn(
35227
35314
  options.commandId,
35228
35315
  options.onActivity,
@@ -35293,18 +35380,7 @@ var AgentSession = class _AgentSession {
35293
35380
  usage: result.usage ?? null
35294
35381
  });
35295
35382
  }
35296
- this.#store.write(
35297
- new AcpStoredSession(
35298
- this.#mobiusSessionId,
35299
- this.#agentId,
35300
- this.#updates.sessionId(),
35301
- this.#cwd,
35302
- this.#additionalDirectories,
35303
- true,
35304
- this.#sessionTitle ?? "",
35305
- (/* @__PURE__ */ new Date()).toISOString()
35306
- )
35307
- );
35383
+ this.#writeStoredSession();
35308
35384
  if (lifecycleV2 !== void 0) {
35309
35385
  await this.recordLifecycleEventV2({
35310
35386
  payload: { commandId: options.commandId, kind: "prompt.completed", stopReason: result.stopReason },
@@ -35560,6 +35636,7 @@ var AgentSession = class _AgentSession {
35560
35636
  update.configOptions
35561
35637
  );
35562
35638
  this.#configRevision += 1;
35639
+ this.#captureSelectedConfigurationValues();
35563
35640
  await this.emitConfigUpdate();
35564
35641
  return;
35565
35642
  }
@@ -35568,6 +35645,7 @@ var AgentSession = class _AgentSession {
35568
35645
  (option) => option.category === "mode" ? { ...option, currentValue: update.currentModeId } : option
35569
35646
  );
35570
35647
  this.#configRevision += 1;
35648
+ this.#captureSelectedConfigurationValues();
35571
35649
  await this.emitConfigUpdate();
35572
35650
  return;
35573
35651
  }
@@ -35583,18 +35661,7 @@ var AgentSession = class _AgentSession {
35583
35661
  this.#sessionUpdatedAt = truncate(update.updatedAt ?? "", 128);
35584
35662
  }
35585
35663
  if (this.#updates.sessionId().length > 0) {
35586
- this.#store.write(
35587
- new AcpStoredSession(
35588
- this.#mobiusSessionId,
35589
- this.#agentId,
35590
- this.#updates.sessionId(),
35591
- this.#cwd,
35592
- this.#additionalDirectories,
35593
- this.#prompted,
35594
- this.#sessionTitle ?? "",
35595
- (/* @__PURE__ */ new Date()).toISOString()
35596
- )
35597
- );
35664
+ this.#writeStoredSession();
35598
35665
  }
35599
35666
  await this.#getObserver().onInfo({
35600
35667
  kind: SESSION_INFO_UPDATED_KIND,
@@ -39070,6 +39137,10 @@ var acpSessionStoreMigrations = [
39070
39137
  {
39071
39138
  "name": "0004_special_mathemanic.sql",
39072
39139
  "sql": "DROP TABLE `deleted_acp_session`;--> statement-breakpoint\nALTER TABLE `acp_session` DROP COLUMN `last_terminal_command_id`;"
39140
+ },
39141
+ {
39142
+ "name": "0005_orange_amphibian.sql",
39143
+ "sql": "ALTER TABLE `acp_session` ADD `configurations` text DEFAULT '[]' NOT NULL;"
39073
39144
  }
39074
39145
  ];
39075
39146
 
@@ -40559,7 +40630,7 @@ import { WebSocket as WebSocket5 } from "undici";
40559
40630
  // package.json
40560
40631
  var package_default = {
40561
40632
  name: "@moxt-ai/mobius",
40562
- version: "0.0.191",
40633
+ version: "0.0.192",
40563
40634
  description: "Mobius CLI for pairing and running local AI agent services.",
40564
40635
  type: "module",
40565
40636
  bin: {
@@ -41252,7 +41323,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
41252
41323
  // src/artifacts/local-file-streamer.ts
41253
41324
  import { createReadStream as createReadStream2 } from "node:fs";
41254
41325
  import { realpath as realpath9, stat as stat8 } from "node:fs/promises";
41255
- import { basename as basename4, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve5 } from "node:path";
41326
+ import { basename as basename4, extname, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve5 } from "node:path";
41256
41327
  import { fileURLToPath as fileURLToPath2 } from "node:url";
41257
41328
  var CHUNK_BYTES = 192 * 1024;
41258
41329
  function requestedPath(value) {
@@ -41302,7 +41373,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory, externa
41302
41373
  send2({
41303
41374
  byteLength: before.size,
41304
41375
  kind: FILE_BEGIN_KIND,
41305
- mediaType: external?.mediaType ?? raster?.mimeType ?? "application/octet-stream",
41376
+ mediaType: external?.mediaType ?? raster?.mimeType ?? (extname(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
41306
41377
  modifiedAt: before.mtime.toISOString(),
41307
41378
  name: external?.name ?? (basename4(target) || "file"),
41308
41379
  requestId: command.requestId,
@@ -41366,18 +41437,24 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
41366
41437
  }
41367
41438
 
41368
41439
  // src/daemon-history-commands.ts
41369
- async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventLogV2, signal) {
41440
+ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventLogV2, signal) {
41441
+ let agentId;
41370
41442
  try {
41443
+ const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
41444
+ if (entry === void 0) {
41445
+ throw new AcpExecutionError("The Session was not found", {}, "session_not_found");
41446
+ }
41447
+ agentId = entry.agentId;
41371
41448
  const resolved = await resolveSessionDirectories(
41372
41449
  directories,
41373
41450
  config2.bindingId,
41374
- command.directoryId,
41375
- command.additionalDirectoryIds,
41451
+ entry.directoryId,
41452
+ entry.additionalDirectories.map((directory) => directory.directoryId),
41376
41453
  signal
41377
41454
  );
41378
41455
  const loadOptions = {
41379
41456
  additionalDirectories: resolved.additionalDirectories,
41380
- agent: config2.catalog.find(command.agentId),
41457
+ agent: config2.catalog.find(entry.agentId),
41381
41458
  cwd: resolved.cwd,
41382
41459
  sessionId: command.sessionId,
41383
41460
  signal
@@ -41422,7 +41499,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
41422
41499
  "session_history_v2_load_failed",
41423
41500
  command.requestId,
41424
41501
  {
41425
- agentId: command.agentId,
41502
+ ...agentId === void 0 ? {} : { agentId },
41426
41503
  code: operationErrorCode(error62),
41427
41504
  sessionId: command.sessionId
41428
41505
  },
@@ -41431,7 +41508,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
41431
41508
  audit.record({
41432
41509
  commandId: command.requestId,
41433
41510
  details: {
41434
- agentId: command.agentId,
41511
+ ...agentId === void 0 ? {} : { agentId },
41435
41512
  code: operationErrorCode(error62)
41436
41513
  },
41437
41514
  event: "session_history_v2_load_failed",
@@ -42291,6 +42368,7 @@ function createDaemonCommandHandler({
42291
42368
  audit,
42292
42369
  diagnostics,
42293
42370
  sessions,
42371
+ nativeSessions,
42294
42372
  eventLogV2,
42295
42373
  signal
42296
42374
  );