@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/cli.js CHANGED
@@ -3381,7 +3381,7 @@ var program = new Command();
3381
3381
  // package.json
3382
3382
  var package_default = {
3383
3383
  name: "@moxt-ai/mobius",
3384
- version: "0.0.191",
3384
+ version: "0.0.192",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -24848,7 +24848,11 @@ var threadTurnSchema = external_exports.object({
24848
24848
  items: external_exports.array(external_exports.unknown()).max(1e5)
24849
24849
  });
24850
24850
  var threadTurnsSchema = external_exports.array(threadTurnSchema).max(1e5);
24851
+ var collaborationModeSchema = external_exports.object({
24852
+ mode: external_exports.enum(["default", "plan"])
24853
+ });
24851
24854
  var threadLifecycleResponseSchema = external_exports.object({
24855
+ collaborationMode: collaborationModeSchema.nullish(),
24852
24856
  model: boundedText(256).nullish(),
24853
24857
  reasoningEffort: boundedText(256).nullish(),
24854
24858
  serviceTier: boundedText(256).nullish(),
@@ -24893,9 +24897,7 @@ var modelListResponseSchema = external_exports.object({
24893
24897
  var threadSettingsUpdatedSchema = external_exports.object({
24894
24898
  threadId: boundedText(256),
24895
24899
  threadSettings: external_exports.object({
24896
- collaborationMode: external_exports.object({
24897
- mode: external_exports.enum(["default", "plan"])
24898
- }).nullish()
24900
+ collaborationMode: collaborationModeSchema.nullish()
24899
24901
  })
24900
24902
  });
24901
24903
 
@@ -25372,7 +25374,7 @@ var FULL_ACCESS_MODE = Object.freeze({
25372
25374
  sandboxPolicy: { type: "dangerFullAccess" }
25373
25375
  });
25374
25376
  var AGENT_MODES = Object.freeze([READ_ONLY_MODE, AGENT_MODE, FULL_ACCESS_MODE]);
25375
- var DEFAULT_MODE = AGENT_MODE;
25377
+ var DEFAULT_MODE = FULL_ACCESS_MODE;
25376
25378
  function initialMode(environment) {
25377
25379
  const requested = environment["INITIAL_AGENT_MODE"];
25378
25380
  if (requested === void 0) {
@@ -25490,9 +25492,6 @@ function effortSetting(model, currentValue) {
25490
25492
  var CodexSettings = class {
25491
25493
  #appServer;
25492
25494
  #models = [];
25493
- // Whether the current turn must carry a policy at all. Until the user picks a mode, Codex's own
25494
- // configuration decides, so `turn/start` omits the fields and inherits what the host set up.
25495
- #policySelected = false;
25496
25495
  // Whether a collaboration mode choice has been made in this session. A restored thread keeps
25497
25496
  // the mode Codex already persisted, so the first turn does not reset it to Build.
25498
25497
  #collaborationModeSelected = false;
@@ -25532,14 +25531,9 @@ var CodexSettings = class {
25532
25531
  const mode = AGENT_MODES.find((candidate) => candidate.id === selection.mode) ?? DEFAULT_MODE;
25533
25532
  const supportsFast = this.#model(selection.model)?.additionalSpeedTiers?.includes(FAST_TIER) === true;
25534
25533
  return {
25535
- // Until a mode is chosen, `config.toml` decides the sandbox and approval
25536
- // policy, and those fields stay off the turn so the host's own setup is
25537
- // inherited rather than overridden.
25538
- ...this.#policySelected ? {
25539
- approvalPolicy: mode.approvalPolicy,
25540
- approvalsReviewer: mode.approvalsReviewer,
25541
- sandboxPolicy: mode.sandboxPolicy
25542
- } : {},
25534
+ approvalPolicy: mode.approvalPolicy,
25535
+ approvalsReviewer: mode.approvalsReviewer,
25536
+ sandboxPolicy: mode.sandboxPolicy,
25543
25537
  // The collaboration mode rides on the turn: Codex applies it to the
25544
25538
  // thread, where it persists until changed. "Build" is Codex's `default`
25545
25539
  // mode, so it is only sent once a choice exists to apply.
@@ -25632,6 +25626,7 @@ var CodexSettings = class {
25632
25626
  this.#selection = {
25633
25627
  ...this.#selection,
25634
25628
  ...supported,
25629
+ collaborationMode: thread.collaborationMode?.mode ?? this.#selection.collaborationMode,
25635
25630
  fastMode: thread.serviceTier === SERVICE_TIER_FAST
25636
25631
  };
25637
25632
  };
@@ -25671,7 +25666,6 @@ var CodexSettings = class {
25671
25666
  );
25672
25667
  }
25673
25668
  this.#selection = { ...this.#selection, mode: value };
25674
- this.#policySelected = true;
25675
25669
  return;
25676
25670
  }
25677
25671
  if (configId === COLLABORATION_MODE_SETTING_ID) {
@@ -30147,18 +30141,21 @@ var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loa
30147
30141
  var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
30148
30142
  var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
30149
30143
  var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
30150
- var pageLoadFields = {
30151
- additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
30152
- agentId: identifierStringSchema,
30153
- bindingId: identifierStringSchema,
30144
+ var pageRequestFields = {
30154
30145
  cursor: external_exports.string().min(1).max(512).nullable(),
30155
- directoryId: directoryIdentifier,
30156
30146
  eventLimit: external_exports.number().int().min(1).max(1e4),
30157
30147
  requestId: identifierStringSchema,
30158
30148
  sessionId: identifierStringSchema
30159
30149
  };
30160
- var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
30161
- var sessionPreviewHistoryPageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND) }).readonly();
30150
+ var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageRequestFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
30151
+ var sessionPreviewHistoryPageLoadSchema = external_exports.object({
30152
+ ...pageRequestFields,
30153
+ additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
30154
+ agentId: identifierStringSchema,
30155
+ bindingId: identifierStringSchema,
30156
+ directoryId: directoryIdentifier,
30157
+ kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND)
30158
+ }).readonly();
30162
30159
  var pageLoadedFields = {
30163
30160
  events: nativeSessionEventsV2Schema,
30164
30161
  requestId: identifierStringSchema,
@@ -32897,6 +32894,54 @@ function sessionConfigProtocolForAgent(_agentId) {
32897
32894
  return standardSessionConfigProtocol;
32898
32895
  }
32899
32896
 
32897
+ // src/acp/session-configuration.ts
32898
+ var storedSessionConfigurationsSchema = external_exports.array(
32899
+ external_exports.discriminatedUnion("type", [
32900
+ external_exports.object({ booleanValue: external_exports.boolean(), configId: external_exports.string().max(128), type: external_exports.literal("boolean") }),
32901
+ external_exports.object({ configId: external_exports.string().max(128), type: external_exports.literal("select"), value: external_exports.string().max(500) })
32902
+ ])
32903
+ ).max(100);
32904
+ var decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(value);
32905
+ var AcpSessionConfigurations = class {
32906
+ #selected = [];
32907
+ stored = () => this.#selected;
32908
+ capture = (options) => {
32909
+ this.#selected = this.#selected.map((selection) => {
32910
+ const current = options.find(
32911
+ (option) => option.id === selection.configId && option.type === selection.type
32912
+ );
32913
+ if (current === void 0) {
32914
+ return selection;
32915
+ }
32916
+ return current.type === "boolean" ? { booleanValue: current.booleanValue, configId: current.id, type: "boolean" } : { configId: current.id, type: "select", value: current.currentValue };
32917
+ });
32918
+ };
32919
+ select = (option) => {
32920
+ const selected = option.type === "boolean" ? { booleanValue: option.booleanValue, configId: option.id, type: "boolean" } : { configId: option.id, type: "select", value: option.currentValue };
32921
+ this.#selected = [...this.#selected.filter((selection) => selection.configId !== selected.configId), selected];
32922
+ };
32923
+ restore = async (stored, options, apply, signal) => {
32924
+ this.#selected = stored;
32925
+ for (const selection of this.#selected) {
32926
+ const current = options.find(
32927
+ (option) => option.id === selection.configId && option.type === selection.type
32928
+ );
32929
+ if (current === void 0) {
32930
+ continue;
32931
+ }
32932
+ if (selection.type === "boolean") {
32933
+ if (current.booleanValue !== selection.booleanValue) {
32934
+ await apply(selection, signal);
32935
+ }
32936
+ continue;
32937
+ }
32938
+ if (current.currentValue !== selection.value && current.values.some((value) => value.value === selection.value)) {
32939
+ await apply(selection, signal);
32940
+ }
32941
+ }
32942
+ };
32943
+ };
32944
+
32900
32945
  // src/acp/session-contracts.ts
32901
32946
  var acpNativeHistoryReader = {
32902
32947
  access: () => ({ kind: "acp" })
@@ -38506,6 +38551,7 @@ var acpSession = sqliteTable("acp_session", {
38506
38551
  nativeSessionId: text("native_session_id").notNull(),
38507
38552
  cwd: text("cwd").notNull(),
38508
38553
  additionalDirectories: text("additional_directories").notNull(),
38554
+ configurations: text("configurations").notNull().default("[]"),
38509
38555
  prompted: integer2("prompted", { mode: "boolean" }).notNull(),
38510
38556
  title: text("title").notNull(),
38511
38557
  updatedAt: text("updated_at").notNull()
@@ -38773,15 +38819,17 @@ var AcpStoredSession = class {
38773
38819
  additionalDirectories;
38774
38820
  agentId;
38775
38821
  cwd;
38822
+ configurations;
38776
38823
  nativeSessionId;
38777
38824
  prompted;
38778
38825
  sessionId;
38779
38826
  title;
38780
38827
  updatedAt;
38781
- constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
38828
+ constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString(), configurations = []) {
38782
38829
  this.additionalDirectories = [...additionalDirectories];
38783
38830
  this.agentId = agentId;
38784
38831
  this.cwd = cwd;
38832
+ this.configurations = configurations.map((configuration) => ({ ...configuration }));
38785
38833
  this.nativeSessionId = nativeSessionId;
38786
38834
  this.prompted = prompted;
38787
38835
  this.sessionId = sessionId;
@@ -38831,6 +38879,7 @@ var MemoryAcpSessionStore = class {
38831
38879
  var storedSessionRowSchema = external_exports.object({
38832
38880
  additionalDirectories: external_exports.string(),
38833
38881
  agentId: external_exports.string(),
38882
+ configurations: external_exports.string(),
38834
38883
  cwd: external_exports.string(),
38835
38884
  nativeSessionId: external_exports.string(),
38836
38885
  prompted: external_exports.boolean(),
@@ -38842,6 +38891,8 @@ function decodeStoredSession(value) {
38842
38891
  const row = storedSessionRowSchema.parse(value);
38843
38892
  const decodedAdditionalDirectories = JSON.parse(row.additionalDirectories);
38844
38893
  const additionalDirectories = external_exports.array(external_exports.string()).parse(decodedAdditionalDirectories);
38894
+ const decodedConfigurations = JSON.parse(row.configurations);
38895
+ const configurations = decodeStoredSessionConfigurations(decodedConfigurations);
38845
38896
  return new AcpStoredSession(
38846
38897
  row.sessionId,
38847
38898
  row.agentId,
@@ -38850,7 +38901,8 @@ function decodeStoredSession(value) {
38850
38901
  additionalDirectories,
38851
38902
  row.prompted,
38852
38903
  row.title,
38853
- row.updatedAt
38904
+ row.updatedAt,
38905
+ configurations
38854
38906
  );
38855
38907
  }
38856
38908
  var SqliteAcpSessionStore = class {
@@ -38883,6 +38935,7 @@ var SqliteAcpSessionStore = class {
38883
38935
  const value = {
38884
38936
  additionalDirectories: JSON.stringify(session.additionalDirectories),
38885
38937
  agentId: session.agentId,
38938
+ configurations: JSON.stringify(session.configurations),
38886
38939
  cwd: session.cwd,
38887
38940
  nativeSessionId: session.nativeSessionId,
38888
38941
  prompted: session.prompted,
@@ -38931,6 +38984,7 @@ var AgentSession = class _AgentSession {
38931
38984
  #commands = [];
38932
38985
  #configRevision = 0;
38933
38986
  #configOptions = [];
38987
+ #sessionConfigurations = new AcpSessionConfigurations();
38934
38988
  #nativeHistoryOwnership = { kind: "unbound" };
38935
38989
  #prompted = false;
38936
38990
  #nativePrompt = null;
@@ -39035,6 +39089,41 @@ var AgentSession = class _AgentSession {
39035
39089
  usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
39036
39090
  canRebind = () => !this.#prompted && !this.#turn.running;
39037
39091
  hasRunningTurn = () => this.#turn.running;
39092
+ #writeStoredSession = () => {
39093
+ this.#store.write(
39094
+ new AcpStoredSession(
39095
+ this.#mobiusSessionId,
39096
+ this.#agentId,
39097
+ this.#updates.sessionId(),
39098
+ this.#cwd,
39099
+ this.#additionalDirectories,
39100
+ this.#prompted,
39101
+ this.#sessionTitle ?? "",
39102
+ (/* @__PURE__ */ new Date()).toISOString(),
39103
+ this.#sessionConfigurations.stored()
39104
+ )
39105
+ );
39106
+ };
39107
+ #captureSelectedConfigurationValues = () => {
39108
+ this.#sessionConfigurations.capture(this.#configOptions);
39109
+ if (this.#updates.sessionId().length > 0) {
39110
+ this.#writeStoredSession();
39111
+ }
39112
+ };
39113
+ #restoreStoredConfigurations = async (session, signal) => {
39114
+ await this.#sessionConfigurations.restore(
39115
+ session.configurations,
39116
+ this.#configOptions,
39117
+ async (selection, signal2) => await this.#applyConfiguration(
39118
+ selection.configId,
39119
+ selection.type === "select" ? selection.value : "",
39120
+ selection.type === "boolean" ? selection.booleanValue : false,
39121
+ selection.type,
39122
+ signal2
39123
+ ),
39124
+ signal
39125
+ );
39126
+ };
39038
39127
  prepared = () => new AcpPreparedSession(
39039
39128
  this.#agentName,
39040
39129
  this.#agentVersion,
@@ -39385,20 +39474,12 @@ var AgentSession = class _AgentSession {
39385
39474
  lifecycleResponse = created;
39386
39475
  }
39387
39476
  this.#configOptions = this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
39477
+ if (stored instanceof FoundAcpStoredSession && this.#restored) {
39478
+ await this.#restoreStoredConfigurations(stored.session, signal);
39479
+ }
39388
39480
  await this.#updates.drained();
39389
39481
  signal.throwIfAborted();
39390
- this.#store.write(
39391
- new AcpStoredSession(
39392
- this.#mobiusSessionId,
39393
- this.#agentId,
39394
- this.#updates.sessionId(),
39395
- this.#cwd,
39396
- this.#additionalDirectories,
39397
- this.#prompted,
39398
- this.#sessionTitle ?? "",
39399
- (/* @__PURE__ */ new Date()).toISOString()
39400
- )
39401
- );
39482
+ this.#writeStoredSession();
39402
39483
  };
39403
39484
  listNativeSessions = async (cursor, signal) => {
39404
39485
  if (!this.#capabilities.listSessions) {
@@ -39439,15 +39520,17 @@ var AgentSession = class _AgentSession {
39439
39520
  this.#cwd,
39440
39521
  this.#additionalDirectories,
39441
39522
  false,
39442
- ""
39523
+ "",
39524
+ (/* @__PURE__ */ new Date()).toISOString(),
39525
+ this.#sessionConfigurations.stored()
39443
39526
  )
39444
39527
  );
39445
39528
  this.#store.remove(previousSessionId);
39446
39529
  this.#mobiusSessionId = sessionId;
39447
39530
  };
39448
- configure = async (options) => {
39449
- const existing = this.#configOptions.find((option) => option.id === options.configId);
39450
- if (existing === void 0 || existing.type !== options.valueType) {
39531
+ #applyConfiguration = async (configId, value, booleanValue, valueType, signal) => {
39532
+ const existing = this.#configOptions.find((option) => option.id === configId);
39533
+ if (existing === void 0 || existing.type !== valueType) {
39451
39534
  throw new AcpExecutionError(
39452
39535
  "The requested ACP configuration option is unavailable",
39453
39536
  {},
@@ -39462,10 +39545,10 @@ var AgentSession = class _AgentSession {
39462
39545
  "invalid_session_configuration"
39463
39546
  );
39464
39547
  }
39465
- if (!existing.values.some((entry) => entry.value === options.value)) {
39548
+ if (!existing.values.some((entry) => entry.value === value)) {
39466
39549
  throw new AcpConfigurationValueUnavailableError(
39467
- options.configId,
39468
- options.value,
39550
+ configId,
39551
+ value,
39469
39552
  existing.values.map((entry) => entry.value)
39470
39553
  );
39471
39554
  }
@@ -39474,20 +39557,20 @@ var AgentSession = class _AgentSession {
39474
39557
  try {
39475
39558
  const configured = await this.#sessionConfigProtocol.configure(
39476
39559
  this.#configOptions,
39477
- options,
39560
+ { booleanValue, configId, signal, value },
39478
39561
  this.#updates.sessionId(),
39479
39562
  {
39480
- request: async (method, params, failureMessage, signal) => await this.race(
39563
+ request: async (method, params, failureMessage, signal2) => await this.race(
39481
39564
  this.#connection.connection.agent.request(method, params, {
39482
- cancellationSignal: signal
39565
+ cancellationSignal: signal2
39483
39566
  }),
39484
39567
  failureMessage,
39485
- signal
39568
+ signal2
39486
39569
  )
39487
39570
  }
39488
39571
  );
39489
- const applied = configured.find((option) => option.id === options.configId);
39490
- if (applied === void 0 || applied.type !== options.valueType || applied.type === "boolean" && applied.booleanValue !== options.booleanValue || applied.type === "select" && applied.currentValue !== options.value) {
39572
+ const applied = configured.find((option) => option.id === configId);
39573
+ if (applied === void 0 || applied.type !== valueType || applied.type === "boolean" && applied.booleanValue !== booleanValue || applied.type === "select" && applied.currentValue !== value) {
39491
39574
  throw new AcpExecutionError(
39492
39575
  "The Agent did not apply the requested session configuration",
39493
39576
  {},
@@ -39504,6 +39587,21 @@ var AgentSession = class _AgentSession {
39504
39587
  }
39505
39588
  throw error62;
39506
39589
  }
39590
+ };
39591
+ configure = async (options) => {
39592
+ await this.#applyConfiguration(
39593
+ options.configId,
39594
+ options.value,
39595
+ options.booleanValue,
39596
+ options.valueType,
39597
+ options.signal
39598
+ );
39599
+ const applied = this.#configOptions.find((option) => option.id === options.configId);
39600
+ if (applied === void 0) {
39601
+ throw new AcpExecutionError("The requested ACP configuration option is unavailable");
39602
+ }
39603
+ this.#sessionConfigurations.select(applied);
39604
+ this.#writeStoredSession();
39507
39605
  return this.#configOptions;
39508
39606
  };
39509
39607
  buildPrompt = (options) => {
@@ -39578,19 +39676,8 @@ var AgentSession = class _AgentSession {
39578
39676
  if (this.#sessionTitle === null || this.#sessionTitle.length === 0) {
39579
39677
  this.#sessionTitle = truncate(options.prompt, 500);
39580
39678
  }
39581
- this.#store.write(
39582
- new AcpStoredSession(
39583
- this.#mobiusSessionId,
39584
- this.#agentId,
39585
- this.#updates.sessionId(),
39586
- this.#cwd,
39587
- this.#additionalDirectories,
39588
- true,
39589
- this.#sessionTitle,
39590
- (/* @__PURE__ */ new Date()).toISOString()
39591
- )
39592
- );
39593
39679
  this.#prompted = true;
39680
+ this.#writeStoredSession();
39594
39681
  const running = new RunningAcpTurn(
39595
39682
  options.commandId,
39596
39683
  options.onActivity,
@@ -39661,18 +39748,7 @@ var AgentSession = class _AgentSession {
39661
39748
  usage: result.usage ?? null
39662
39749
  });
39663
39750
  }
39664
- this.#store.write(
39665
- new AcpStoredSession(
39666
- this.#mobiusSessionId,
39667
- this.#agentId,
39668
- this.#updates.sessionId(),
39669
- this.#cwd,
39670
- this.#additionalDirectories,
39671
- true,
39672
- this.#sessionTitle ?? "",
39673
- (/* @__PURE__ */ new Date()).toISOString()
39674
- )
39675
- );
39751
+ this.#writeStoredSession();
39676
39752
  if (lifecycleV2 !== void 0) {
39677
39753
  await this.recordLifecycleEventV2({
39678
39754
  payload: { commandId: options.commandId, kind: "prompt.completed", stopReason: result.stopReason },
@@ -39928,6 +40004,7 @@ var AgentSession = class _AgentSession {
39928
40004
  update.configOptions
39929
40005
  );
39930
40006
  this.#configRevision += 1;
40007
+ this.#captureSelectedConfigurationValues();
39931
40008
  await this.emitConfigUpdate();
39932
40009
  return;
39933
40010
  }
@@ -39936,6 +40013,7 @@ var AgentSession = class _AgentSession {
39936
40013
  (option) => option.category === "mode" ? { ...option, currentValue: update.currentModeId } : option
39937
40014
  );
39938
40015
  this.#configRevision += 1;
40016
+ this.#captureSelectedConfigurationValues();
39939
40017
  await this.emitConfigUpdate();
39940
40018
  return;
39941
40019
  }
@@ -39951,18 +40029,7 @@ var AgentSession = class _AgentSession {
39951
40029
  this.#sessionUpdatedAt = truncate(update.updatedAt ?? "", 128);
39952
40030
  }
39953
40031
  if (this.#updates.sessionId().length > 0) {
39954
- this.#store.write(
39955
- new AcpStoredSession(
39956
- this.#mobiusSessionId,
39957
- this.#agentId,
39958
- this.#updates.sessionId(),
39959
- this.#cwd,
39960
- this.#additionalDirectories,
39961
- this.#prompted,
39962
- this.#sessionTitle ?? "",
39963
- (/* @__PURE__ */ new Date()).toISOString()
39964
- )
39965
- );
40032
+ this.#writeStoredSession();
39966
40033
  }
39967
40034
  await this.#getObserver().onInfo({
39968
40035
  kind: SESSION_INFO_UPDATED_KIND,
@@ -43438,6 +43505,10 @@ var acpSessionStoreMigrations = [
43438
43505
  {
43439
43506
  "name": "0004_special_mathemanic.sql",
43440
43507
  "sql": "DROP TABLE `deleted_acp_session`;--> statement-breakpoint\nALTER TABLE `acp_session` DROP COLUMN `last_terminal_command_id`;"
43508
+ },
43509
+ {
43510
+ "name": "0005_orange_amphibian.sql",
43511
+ "sql": "ALTER TABLE `acp_session` ADD `configurations` text DEFAULT '[]' NOT NULL;"
43441
43512
  }
43442
43513
  ];
43443
43514
 
@@ -45544,7 +45615,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
45544
45615
  // src/artifacts/local-file-streamer.ts
45545
45616
  import { createReadStream as createReadStream2 } from "node:fs";
45546
45617
  import { realpath as realpath10, stat as stat9 } from "node:fs/promises";
45547
- import { basename as basename5, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve7 } from "node:path";
45618
+ import { basename as basename5, extname, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve7 } from "node:path";
45548
45619
  import { fileURLToPath as fileURLToPath2 } from "node:url";
45549
45620
  var CHUNK_BYTES = 192 * 1024;
45550
45621
  function requestedPath(value) {
@@ -45594,7 +45665,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory, externa
45594
45665
  send2({
45595
45666
  byteLength: before.size,
45596
45667
  kind: FILE_BEGIN_KIND,
45597
- mediaType: external?.mediaType ?? raster?.mimeType ?? "application/octet-stream",
45668
+ mediaType: external?.mediaType ?? raster?.mimeType ?? (extname(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
45598
45669
  modifiedAt: before.mtime.toISOString(),
45599
45670
  name: external?.name ?? (basename5(target) || "file"),
45600
45671
  requestId: command.requestId,
@@ -45658,18 +45729,24 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
45658
45729
  }
45659
45730
 
45660
45731
  // src/daemon-history-commands.ts
45661
- async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventLogV2, signal) {
45732
+ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventLogV2, signal) {
45733
+ let agentId;
45662
45734
  try {
45735
+ const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
45736
+ if (entry === void 0) {
45737
+ throw new AcpExecutionError("The Session was not found", {}, "session_not_found");
45738
+ }
45739
+ agentId = entry.agentId;
45663
45740
  const resolved = await resolveSessionDirectories(
45664
45741
  directories,
45665
45742
  config2.bindingId,
45666
- command.directoryId,
45667
- command.additionalDirectoryIds,
45743
+ entry.directoryId,
45744
+ entry.additionalDirectories.map((directory) => directory.directoryId),
45668
45745
  signal
45669
45746
  );
45670
45747
  const loadOptions = {
45671
45748
  additionalDirectories: resolved.additionalDirectories,
45672
- agent: config2.catalog.find(command.agentId),
45749
+ agent: config2.catalog.find(entry.agentId),
45673
45750
  cwd: resolved.cwd,
45674
45751
  sessionId: command.sessionId,
45675
45752
  signal
@@ -45714,7 +45791,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
45714
45791
  "session_history_v2_load_failed",
45715
45792
  command.requestId,
45716
45793
  {
45717
- agentId: command.agentId,
45794
+ ...agentId === void 0 ? {} : { agentId },
45718
45795
  code: operationErrorCode(error62),
45719
45796
  sessionId: command.sessionId
45720
45797
  },
@@ -45723,7 +45800,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
45723
45800
  audit.record({
45724
45801
  commandId: command.requestId,
45725
45802
  details: {
45726
- agentId: command.agentId,
45803
+ ...agentId === void 0 ? {} : { agentId },
45727
45804
  code: operationErrorCode(error62)
45728
45805
  },
45729
45806
  event: "session_history_v2_load_failed",
@@ -46583,6 +46660,7 @@ function createDaemonCommandHandler({
46583
46660
  audit,
46584
46661
  diagnostics,
46585
46662
  sessions,
46663
+ nativeSessions,
46586
46664
  eventLogV2,
46587
46665
  signal
46588
46666
  );