@moxt-ai/mobius 0.0.191 → 0.0.193

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 (70) hide show
  1. package/dist/acp/agent-runtime-manager.d.ts +1 -1
  2. package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
  3. package/dist/acp/agent-runtime-manager.js +4 -1
  4. package/dist/acp/agent-runtime-manager.js.map +1 -1
  5. package/dist/acp/agent-session.d.ts +13 -0
  6. package/dist/acp/agent-session.d.ts.map +1 -1
  7. package/dist/acp/agent-session.js +52 -15
  8. package/dist/acp/agent-session.js.map +1 -1
  9. package/dist/acp/codex/agent.d.ts +13 -0
  10. package/dist/acp/codex/agent.d.ts.map +1 -1
  11. package/dist/acp/codex/agent.js +1 -0
  12. package/dist/acp/codex/agent.js.map +1 -1
  13. package/dist/acp/codex/app-server-protocol.d.ts +12 -0
  14. package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
  15. package/dist/acp/codex/app-server-protocol.js +5 -5
  16. package/dist/acp/codex/app-server-protocol.js.map +1 -1
  17. package/dist/acp/codex/settings.d.ts +5 -0
  18. package/dist/acp/codex/settings.d.ts.map +1 -1
  19. package/dist/acp/codex/settings.js +28 -24
  20. package/dist/acp/codex/settings.js.map +1 -1
  21. package/dist/acp/in-process/acp-endpoint.d.ts +3 -0
  22. package/dist/acp/in-process/acp-endpoint.d.ts.map +1 -1
  23. package/dist/acp/in-process/acp-endpoint.js.map +1 -1
  24. package/dist/acp/session-configuration.d.ts +20 -0
  25. package/dist/acp/session-configuration.d.ts.map +1 -0
  26. package/dist/acp/session-configuration.js +49 -0
  27. package/dist/acp/session-configuration.js.map +1 -0
  28. package/dist/acp/session-contracts.d.ts +11 -2
  29. package/dist/acp/session-contracts.d.ts.map +1 -1
  30. package/dist/acp/session-contracts.js +3 -1
  31. package/dist/acp/session-contracts.js.map +1 -1
  32. package/dist/acp/session-store.d.ts +3 -1
  33. package/dist/acp/session-store.d.ts.map +1 -1
  34. package/dist/acp/session-store.js +9 -2
  35. package/dist/acp/session-store.js.map +1 -1
  36. package/dist/agent-catalog/discover-agent-settings.d.ts.map +1 -1
  37. package/dist/agent-catalog/discover-agent-settings.js +8 -2
  38. package/dist/agent-catalog/discover-agent-settings.js.map +1 -1
  39. package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
  40. package/dist/artifacts/local-file-streamer.js +4 -2
  41. package/dist/artifacts/local-file-streamer.js.map +1 -1
  42. package/dist/cli.js +5099 -4963
  43. package/dist/cli.js.map +4 -4
  44. package/dist/daemon-command-handler.d.ts.map +1 -1
  45. package/dist/daemon-command-handler.js +1 -1
  46. package/dist/daemon-command-handler.js.map +1 -1
  47. package/dist/daemon-history-commands.d.ts +3 -2
  48. package/dist/daemon-history-commands.d.ts.map +1 -1
  49. package/dist/daemon-history-commands.js +12 -5
  50. package/dist/daemon-history-commands.js.map +1 -1
  51. package/dist/daemon-prompt-executor.d.ts.map +1 -1
  52. package/dist/daemon-prompt-executor.js +1 -1
  53. package/dist/daemon-prompt-executor.js.map +1 -1
  54. package/dist/generated/acp-session-store-migrations.d.ts +3 -0
  55. package/dist/generated/acp-session-store-migrations.d.ts.map +1 -1
  56. package/dist/generated/acp-session-store-migrations.js +5 -1
  57. package/dist/generated/acp-session-store-migrations.js.map +1 -1
  58. package/dist/index.js +251 -113
  59. package/dist/index.js.map +4 -4
  60. package/dist/runtime.js +251 -113
  61. package/dist/runtime.js.map +4 -4
  62. package/dist/schema/acp-session-store/acp-session.d.ts +16 -0
  63. package/dist/schema/acp-session-store/acp-session.d.ts.map +1 -1
  64. package/dist/schema/acp-session-store/acp-session.js +1 -0
  65. package/dist/schema/acp-session-store/acp-session.js.map +1 -1
  66. package/dist/session-event-log-v2.d.ts +3 -1
  67. package/dist/session-event-log-v2.d.ts.map +1 -1
  68. package/dist/session-event-log-v2.js +17 -3
  69. package/dist/session-event-log-v2.js.map +1 -1
  70. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21310,8 +21310,10 @@ var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
21310
21310
  external_exports.object({
21311
21311
  ...lifecycleBase,
21312
21312
  content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
21313
+ disposition: shortString.optional(),
21313
21314
  kind: external_exports.literal("prompt.requested"),
21314
- context: promptExecutionContextV2Schema.optional()
21315
+ context: promptExecutionContextV2Schema.optional(),
21316
+ targetCommandId: identifierStringSchema.optional()
21315
21317
  }).readonly(),
21316
21318
  external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
21317
21319
  external_exports.object({ ...lifecycleBase, kind: external_exports.literal("prompt.completed"), stopReason: shortString }).readonly(),
@@ -21420,7 +21422,9 @@ var sessionEventLogPageV2Schema = external_exports.object({
21420
21422
  var nativeEventPageRequestV2Schema = external_exports.object({ cursor: external_exports.string().min(1).max(512).nullable(), eventLimit: external_exports.number().int().min(1).max(1e4) }).readonly();
21421
21423
  var queuedPromptRequestEventLogV2Schema = external_exports.object({
21422
21424
  commandId: identifierStringSchema,
21423
- content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly()
21425
+ content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
21426
+ disposition: shortString.optional(),
21427
+ targetCommandId: identifierStringSchema.optional()
21424
21428
  }).readonly();
21425
21429
  var nativeSessionEventsV2Schema = external_exports.object({
21426
21430
  events: sessionEventLogPageV2Schema,
@@ -21459,18 +21463,21 @@ var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loa
21459
21463
  var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
21460
21464
  var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
21461
21465
  var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
21462
- var pageLoadFields = {
21463
- additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
21464
- agentId: identifierStringSchema,
21465
- bindingId: identifierStringSchema,
21466
+ var pageRequestFields = {
21466
21467
  cursor: external_exports.string().min(1).max(512).nullable(),
21467
- directoryId: directoryIdentifier,
21468
21468
  eventLimit: external_exports.number().int().min(1).max(1e4),
21469
21469
  requestId: identifierStringSchema,
21470
21470
  sessionId: identifierStringSchema
21471
21471
  };
21472
- var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
21473
- var sessionPreviewHistoryPageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND) }).readonly();
21472
+ var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageRequestFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
21473
+ var sessionPreviewHistoryPageLoadSchema = external_exports.object({
21474
+ ...pageRequestFields,
21475
+ additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
21476
+ agentId: identifierStringSchema,
21477
+ bindingId: identifierStringSchema,
21478
+ directoryId: directoryIdentifier,
21479
+ kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND)
21480
+ }).readonly();
21474
21481
  var pageLoadedFields = {
21475
21482
  events: nativeSessionEventsV2Schema,
21476
21483
  requestId: identifierStringSchema,
@@ -24184,6 +24191,54 @@ function sessionConfigProtocolForAgent(_agentId) {
24184
24191
  return standardSessionConfigProtocol;
24185
24192
  }
24186
24193
 
24194
+ // src/acp/session-configuration.ts
24195
+ var storedSessionConfigurationsSchema = external_exports.array(
24196
+ external_exports.discriminatedUnion("type", [
24197
+ external_exports.object({ booleanValue: external_exports.boolean(), configId: external_exports.string().max(128), type: external_exports.literal("boolean") }),
24198
+ external_exports.object({ configId: external_exports.string().max(128), type: external_exports.literal("select"), value: external_exports.string().max(500) })
24199
+ ])
24200
+ ).max(100);
24201
+ var decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(value);
24202
+ var AcpSessionConfigurations = class {
24203
+ #selected = [];
24204
+ stored = () => this.#selected;
24205
+ capture = (options) => {
24206
+ this.#selected = this.#selected.map((selection) => {
24207
+ const current = options.find(
24208
+ (option) => option.id === selection.configId && option.type === selection.type
24209
+ );
24210
+ if (current === void 0) {
24211
+ return selection;
24212
+ }
24213
+ return current.type === "boolean" ? { booleanValue: current.booleanValue, configId: current.id, type: "boolean" } : { configId: current.id, type: "select", value: current.currentValue };
24214
+ });
24215
+ };
24216
+ select = (option) => {
24217
+ const selected = option.type === "boolean" ? { booleanValue: option.booleanValue, configId: option.id, type: "boolean" } : { configId: option.id, type: "select", value: option.currentValue };
24218
+ this.#selected = [...this.#selected.filter((selection) => selection.configId !== selected.configId), selected];
24219
+ };
24220
+ restore = async (stored, options, apply, signal) => {
24221
+ this.#selected = stored;
24222
+ for (const selection of this.#selected) {
24223
+ const current = options.find(
24224
+ (option) => option.id === selection.configId && option.type === selection.type
24225
+ );
24226
+ if (current === void 0) {
24227
+ continue;
24228
+ }
24229
+ if (selection.type === "boolean") {
24230
+ if (current.booleanValue !== selection.booleanValue) {
24231
+ await apply(selection, signal);
24232
+ }
24233
+ continue;
24234
+ }
24235
+ if (current.currentValue !== selection.value && current.values.some((value) => value.value === selection.value)) {
24236
+ await apply(selection, signal);
24237
+ }
24238
+ }
24239
+ };
24240
+ };
24241
+
24187
24242
  // src/acp/session-contracts.ts
24188
24243
  var acpNativeHistoryReader = {
24189
24244
  access: () => ({ kind: "acp" })
@@ -24222,10 +24277,12 @@ var AcpAgentSettingsSnapshot = class {
24222
24277
  agentName;
24223
24278
  agentVersion;
24224
24279
  configOptions;
24225
- constructor(agentName, agentVersion, configOptions) {
24280
+ modelEffort;
24281
+ constructor(agentName, agentVersion, configOptions, modelEffort) {
24226
24282
  this.agentName = agentName;
24227
24283
  this.agentVersion = agentVersion;
24228
24284
  this.configOptions = configOptions;
24285
+ this.modelEffort = modelEffort;
24229
24286
  }
24230
24287
  };
24231
24288
 
@@ -29850,6 +29907,7 @@ var acpSession = sqliteTable("acp_session", {
29850
29907
  nativeSessionId: text("native_session_id").notNull(),
29851
29908
  cwd: text("cwd").notNull(),
29852
29909
  additionalDirectories: text("additional_directories").notNull(),
29910
+ configurations: text("configurations").notNull().default("[]"),
29853
29911
  prompted: integer2("prompted", { mode: "boolean" }).notNull(),
29854
29912
  title: text("title").notNull(),
29855
29913
  updatedAt: text("updated_at").notNull()
@@ -30117,15 +30175,17 @@ var AcpStoredSession = class {
30117
30175
  additionalDirectories;
30118
30176
  agentId;
30119
30177
  cwd;
30178
+ configurations;
30120
30179
  nativeSessionId;
30121
30180
  prompted;
30122
30181
  sessionId;
30123
30182
  title;
30124
30183
  updatedAt;
30125
- constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
30184
+ constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString(), configurations = []) {
30126
30185
  this.additionalDirectories = [...additionalDirectories];
30127
30186
  this.agentId = agentId;
30128
30187
  this.cwd = cwd;
30188
+ this.configurations = configurations.map((configuration) => ({ ...configuration }));
30129
30189
  this.nativeSessionId = nativeSessionId;
30130
30190
  this.prompted = prompted;
30131
30191
  this.sessionId = sessionId;
@@ -30175,6 +30235,7 @@ var MemoryAcpSessionStore = class {
30175
30235
  var storedSessionRowSchema = external_exports.object({
30176
30236
  additionalDirectories: external_exports.string(),
30177
30237
  agentId: external_exports.string(),
30238
+ configurations: external_exports.string(),
30178
30239
  cwd: external_exports.string(),
30179
30240
  nativeSessionId: external_exports.string(),
30180
30241
  prompted: external_exports.boolean(),
@@ -30186,6 +30247,8 @@ function decodeStoredSession(value) {
30186
30247
  const row = storedSessionRowSchema.parse(value);
30187
30248
  const decodedAdditionalDirectories = JSON.parse(row.additionalDirectories);
30188
30249
  const additionalDirectories = external_exports.array(external_exports.string()).parse(decodedAdditionalDirectories);
30250
+ const decodedConfigurations = JSON.parse(row.configurations);
30251
+ const configurations = decodeStoredSessionConfigurations(decodedConfigurations);
30189
30252
  return new AcpStoredSession(
30190
30253
  row.sessionId,
30191
30254
  row.agentId,
@@ -30194,7 +30257,8 @@ function decodeStoredSession(value) {
30194
30257
  additionalDirectories,
30195
30258
  row.prompted,
30196
30259
  row.title,
30197
- row.updatedAt
30260
+ row.updatedAt,
30261
+ configurations
30198
30262
  );
30199
30263
  }
30200
30264
  var SqliteAcpSessionStore = class {
@@ -30227,6 +30291,7 @@ var SqliteAcpSessionStore = class {
30227
30291
  const value = {
30228
30292
  additionalDirectories: JSON.stringify(session.additionalDirectories),
30229
30293
  agentId: session.agentId,
30294
+ configurations: JSON.stringify(session.configurations),
30230
30295
  cwd: session.cwd,
30231
30296
  nativeSessionId: session.nativeSessionId,
30232
30297
  prompted: session.prompted,
@@ -30275,6 +30340,7 @@ var AgentSession = class _AgentSession {
30275
30340
  #commands = [];
30276
30341
  #configRevision = 0;
30277
30342
  #configOptions = [];
30343
+ #sessionConfigurations = new AcpSessionConfigurations();
30278
30344
  #nativeHistoryOwnership = { kind: "unbound" };
30279
30345
  #prompted = false;
30280
30346
  #nativePrompt = null;
@@ -30379,6 +30445,41 @@ var AgentSession = class _AgentSession {
30379
30445
  usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
30380
30446
  canRebind = () => !this.#prompted && !this.#turn.running;
30381
30447
  hasRunningTurn = () => this.#turn.running;
30448
+ #writeStoredSession = () => {
30449
+ this.#store.write(
30450
+ new AcpStoredSession(
30451
+ this.#mobiusSessionId,
30452
+ this.#agentId,
30453
+ this.#updates.sessionId(),
30454
+ this.#cwd,
30455
+ this.#additionalDirectories,
30456
+ this.#prompted,
30457
+ this.#sessionTitle ?? "",
30458
+ (/* @__PURE__ */ new Date()).toISOString(),
30459
+ this.#sessionConfigurations.stored()
30460
+ )
30461
+ );
30462
+ };
30463
+ #captureSelectedConfigurationValues = () => {
30464
+ this.#sessionConfigurations.capture(this.#configOptions);
30465
+ if (this.#updates.sessionId().length > 0) {
30466
+ this.#writeStoredSession();
30467
+ }
30468
+ };
30469
+ #restoreStoredConfigurations = async (session, signal) => {
30470
+ await this.#sessionConfigurations.restore(
30471
+ session.configurations,
30472
+ this.#configOptions,
30473
+ async (selection, signal2) => await this.#applyConfiguration(
30474
+ selection.configId,
30475
+ selection.type === "select" ? selection.value : "",
30476
+ selection.type === "boolean" ? selection.booleanValue : false,
30477
+ selection.type,
30478
+ signal2
30479
+ ),
30480
+ signal
30481
+ );
30482
+ };
30382
30483
  prepared = () => new AcpPreparedSession(
30383
30484
  this.#agentName,
30384
30485
  this.#agentVersion,
@@ -30729,20 +30830,12 @@ var AgentSession = class _AgentSession {
30729
30830
  lifecycleResponse = created;
30730
30831
  }
30731
30832
  this.#configOptions = this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
30833
+ if (stored instanceof FoundAcpStoredSession && this.#restored) {
30834
+ await this.#restoreStoredConfigurations(stored.session, signal);
30835
+ }
30732
30836
  await this.#updates.drained();
30733
30837
  signal.throwIfAborted();
30734
- this.#store.write(
30735
- new AcpStoredSession(
30736
- this.#mobiusSessionId,
30737
- this.#agentId,
30738
- this.#updates.sessionId(),
30739
- this.#cwd,
30740
- this.#additionalDirectories,
30741
- this.#prompted,
30742
- this.#sessionTitle ?? "",
30743
- (/* @__PURE__ */ new Date()).toISOString()
30744
- )
30745
- );
30838
+ this.#writeStoredSession();
30746
30839
  };
30747
30840
  listNativeSessions = async (cursor, signal) => {
30748
30841
  if (!this.#capabilities.listSessions) {
@@ -30783,15 +30876,17 @@ var AgentSession = class _AgentSession {
30783
30876
  this.#cwd,
30784
30877
  this.#additionalDirectories,
30785
30878
  false,
30786
- ""
30879
+ "",
30880
+ (/* @__PURE__ */ new Date()).toISOString(),
30881
+ this.#sessionConfigurations.stored()
30787
30882
  )
30788
30883
  );
30789
30884
  this.#store.remove(previousSessionId);
30790
30885
  this.#mobiusSessionId = sessionId;
30791
30886
  };
30792
- configure = async (options) => {
30793
- const existing = this.#configOptions.find((option) => option.id === options.configId);
30794
- if (existing === void 0 || existing.type !== options.valueType) {
30887
+ #applyConfiguration = async (configId, value, booleanValue, valueType, signal) => {
30888
+ const existing = this.#configOptions.find((option) => option.id === configId);
30889
+ if (existing === void 0 || existing.type !== valueType) {
30795
30890
  throw new AcpExecutionError(
30796
30891
  "The requested ACP configuration option is unavailable",
30797
30892
  {},
@@ -30806,10 +30901,10 @@ var AgentSession = class _AgentSession {
30806
30901
  "invalid_session_configuration"
30807
30902
  );
30808
30903
  }
30809
- if (!existing.values.some((entry) => entry.value === options.value)) {
30904
+ if (!existing.values.some((entry) => entry.value === value)) {
30810
30905
  throw new AcpConfigurationValueUnavailableError(
30811
- options.configId,
30812
- options.value,
30906
+ configId,
30907
+ value,
30813
30908
  existing.values.map((entry) => entry.value)
30814
30909
  );
30815
30910
  }
@@ -30818,20 +30913,20 @@ var AgentSession = class _AgentSession {
30818
30913
  try {
30819
30914
  const configured = await this.#sessionConfigProtocol.configure(
30820
30915
  this.#configOptions,
30821
- options,
30916
+ { booleanValue, configId, signal, value },
30822
30917
  this.#updates.sessionId(),
30823
30918
  {
30824
- request: async (method, params, failureMessage, signal) => await this.race(
30919
+ request: async (method, params, failureMessage, signal2) => await this.race(
30825
30920
  this.#connection.connection.agent.request(method, params, {
30826
- cancellationSignal: signal
30921
+ cancellationSignal: signal2
30827
30922
  }),
30828
30923
  failureMessage,
30829
- signal
30924
+ signal2
30830
30925
  )
30831
30926
  }
30832
30927
  );
30833
- const applied = configured.find((option) => option.id === options.configId);
30834
- if (applied === void 0 || applied.type !== options.valueType || applied.type === "boolean" && applied.booleanValue !== options.booleanValue || applied.type === "select" && applied.currentValue !== options.value) {
30928
+ const applied = configured.find((option) => option.id === configId);
30929
+ if (applied === void 0 || applied.type !== valueType || applied.type === "boolean" && applied.booleanValue !== booleanValue || applied.type === "select" && applied.currentValue !== value) {
30835
30930
  throw new AcpExecutionError(
30836
30931
  "The Agent did not apply the requested session configuration",
30837
30932
  {},
@@ -30848,6 +30943,21 @@ var AgentSession = class _AgentSession {
30848
30943
  }
30849
30944
  throw error62;
30850
30945
  }
30946
+ };
30947
+ configure = async (options) => {
30948
+ await this.#applyConfiguration(
30949
+ options.configId,
30950
+ options.value,
30951
+ options.booleanValue,
30952
+ options.valueType,
30953
+ options.signal
30954
+ );
30955
+ const applied = this.#configOptions.find((option) => option.id === options.configId);
30956
+ if (applied === void 0) {
30957
+ throw new AcpExecutionError("The requested ACP configuration option is unavailable");
30958
+ }
30959
+ this.#sessionConfigurations.select(applied);
30960
+ this.#writeStoredSession();
30851
30961
  return this.#configOptions;
30852
30962
  };
30853
30963
  buildPrompt = (options) => {
@@ -30922,19 +31032,8 @@ var AgentSession = class _AgentSession {
30922
31032
  if (this.#sessionTitle === null || this.#sessionTitle.length === 0) {
30923
31033
  this.#sessionTitle = truncate2(options.prompt, 500);
30924
31034
  }
30925
- this.#store.write(
30926
- new AcpStoredSession(
30927
- this.#mobiusSessionId,
30928
- this.#agentId,
30929
- this.#updates.sessionId(),
30930
- this.#cwd,
30931
- this.#additionalDirectories,
30932
- true,
30933
- this.#sessionTitle,
30934
- (/* @__PURE__ */ new Date()).toISOString()
30935
- )
30936
- );
30937
31035
  this.#prompted = true;
31036
+ this.#writeStoredSession();
30938
31037
  const running = new RunningAcpTurn(
30939
31038
  options.commandId,
30940
31039
  options.onActivity,
@@ -30950,8 +31049,10 @@ var AgentSession = class _AgentSession {
30950
31049
  payload: {
30951
31050
  commandId: options.commandId,
30952
31051
  content: lifecycleV2.content,
31052
+ ...lifecycleV2.disposition === void 0 ? {} : { disposition: lifecycleV2.disposition },
30953
31053
  kind: "prompt.requested",
30954
- ...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context }
31054
+ ...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context },
31055
+ ...lifecycleV2.targetCommandId === void 0 ? {} : { targetCommandId: lifecycleV2.targetCommandId }
30955
31056
  },
30956
31057
  type: "lifecycle-metadata"
30957
31058
  });
@@ -31005,18 +31106,7 @@ var AgentSession = class _AgentSession {
31005
31106
  usage: result.usage ?? null
31006
31107
  });
31007
31108
  }
31008
- this.#store.write(
31009
- new AcpStoredSession(
31010
- this.#mobiusSessionId,
31011
- this.#agentId,
31012
- this.#updates.sessionId(),
31013
- this.#cwd,
31014
- this.#additionalDirectories,
31015
- true,
31016
- this.#sessionTitle ?? "",
31017
- (/* @__PURE__ */ new Date()).toISOString()
31018
- )
31019
- );
31109
+ this.#writeStoredSession();
31020
31110
  if (lifecycleV2 !== void 0) {
31021
31111
  await this.recordLifecycleEventV2({
31022
31112
  payload: { commandId: options.commandId, kind: "prompt.completed", stopReason: result.stopReason },
@@ -31069,8 +31159,10 @@ var AgentSession = class _AgentSession {
31069
31159
  payload: {
31070
31160
  commandId: options.commandId,
31071
31161
  content: lifecycleV2.content,
31162
+ ...lifecycleV2.disposition === void 0 ? {} : { disposition: lifecycleV2.disposition },
31072
31163
  kind: "prompt.requested",
31073
- ...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context }
31164
+ ...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context },
31165
+ ...lifecycleV2.targetCommandId === void 0 ? {} : { targetCommandId: lifecycleV2.targetCommandId }
31074
31166
  },
31075
31167
  type: "lifecycle-metadata"
31076
31168
  });
@@ -31272,6 +31364,7 @@ var AgentSession = class _AgentSession {
31272
31364
  update.configOptions
31273
31365
  );
31274
31366
  this.#configRevision += 1;
31367
+ this.#captureSelectedConfigurationValues();
31275
31368
  await this.emitConfigUpdate();
31276
31369
  return;
31277
31370
  }
@@ -31280,6 +31373,7 @@ var AgentSession = class _AgentSession {
31280
31373
  (option) => option.category === "mode" ? { ...option, currentValue: update.currentModeId } : option
31281
31374
  );
31282
31375
  this.#configRevision += 1;
31376
+ this.#captureSelectedConfigurationValues();
31283
31377
  await this.emitConfigUpdate();
31284
31378
  return;
31285
31379
  }
@@ -31295,18 +31389,7 @@ var AgentSession = class _AgentSession {
31295
31389
  this.#sessionUpdatedAt = truncate2(update.updatedAt ?? "", 128);
31296
31390
  }
31297
31391
  if (this.#updates.sessionId().length > 0) {
31298
- this.#store.write(
31299
- new AcpStoredSession(
31300
- this.#mobiusSessionId,
31301
- this.#agentId,
31302
- this.#updates.sessionId(),
31303
- this.#cwd,
31304
- this.#additionalDirectories,
31305
- this.#prompted,
31306
- this.#sessionTitle ?? "",
31307
- (/* @__PURE__ */ new Date()).toISOString()
31308
- )
31309
- );
31392
+ this.#writeStoredSession();
31310
31393
  }
31311
31394
  await this.#getObserver().onInfo({
31312
31395
  kind: SESSION_INFO_UPDATED_KIND,
@@ -31349,6 +31432,7 @@ var AgentSession = class _AgentSession {
31349
31432
  }
31350
31433
  };
31351
31434
  closeProcess = () => this.#connection.closeProcess();
31435
+ agentSettingsModelEffort = () => this.#connection.inProcessAgent?.agentSettingsModelEffort?.() ?? null;
31352
31436
  race = (operation, exitMessage, signal) => this.#connection.race(operation, exitMessage, signal);
31353
31437
  assertNativeSession = (sessionId) => {
31354
31438
  if (sessionId !== this.#updates.sessionId()) {
@@ -32587,6 +32671,7 @@ var AgentRuntimeManager = class {
32587
32671
  ),
32588
32672
  async (runtime) => {
32589
32673
  const prepared = runtime.prepared();
32674
+ const discoveredModelEffort = runtime.agentSettingsModelEffort();
32590
32675
  const model = options2.model;
32591
32676
  const configOptions = model === void 0 ? prepared.configOptions : await runtime.configure({
32592
32677
  ...options2,
@@ -32599,7 +32684,12 @@ var AgentRuntimeManager = class {
32599
32684
  value: model,
32600
32685
  valueType: "select"
32601
32686
  });
32602
- return new AcpAgentSettingsSnapshot(prepared.agentName, prepared.agentVersion, configOptions);
32687
+ return new AcpAgentSettingsSnapshot(
32688
+ prepared.agentName,
32689
+ prepared.agentVersion,
32690
+ configOptions,
32691
+ discoveredModelEffort === null ? { kind: "unavailable" } : { kind: "complete", value: discoveredModelEffort }
32692
+ );
32603
32693
  },
32604
32694
  async (runtime) => await runtime.close()
32605
32695
  );
@@ -33872,7 +33962,11 @@ var threadTurnSchema = external_exports.object({
33872
33962
  items: external_exports.array(external_exports.unknown()).max(1e5)
33873
33963
  });
33874
33964
  var threadTurnsSchema = external_exports.array(threadTurnSchema).max(1e5);
33965
+ var collaborationModeSchema = external_exports.object({
33966
+ mode: external_exports.enum(["default", "plan"])
33967
+ });
33875
33968
  var threadLifecycleResponseSchema = external_exports.object({
33969
+ collaborationMode: collaborationModeSchema.nullish(),
33876
33970
  model: boundedText(256).nullish(),
33877
33971
  reasoningEffort: boundedText(256).nullish(),
33878
33972
  serviceTier: boundedText(256).nullish(),
@@ -33917,9 +34011,7 @@ var modelListResponseSchema = external_exports.object({
33917
34011
  var threadSettingsUpdatedSchema = external_exports.object({
33918
34012
  threadId: boundedText(256),
33919
34013
  threadSettings: external_exports.object({
33920
- collaborationMode: external_exports.object({
33921
- mode: external_exports.enum(["default", "plan"])
33922
- }).nullish()
34014
+ collaborationMode: collaborationModeSchema.nullish()
33923
34015
  })
33924
34016
  });
33925
34017
 
@@ -34396,7 +34488,7 @@ var FULL_ACCESS_MODE = Object.freeze({
34396
34488
  sandboxPolicy: { type: "dangerFullAccess" }
34397
34489
  });
34398
34490
  var AGENT_MODES = Object.freeze([READ_ONLY_MODE, AGENT_MODE, FULL_ACCESS_MODE]);
34399
- var DEFAULT_MODE = AGENT_MODE;
34491
+ var DEFAULT_MODE = FULL_ACCESS_MODE;
34400
34492
  function initialMode(environment) {
34401
34493
  const requested = environment["INITIAL_AGENT_MODE"];
34402
34494
  if (requested === void 0) {
@@ -34422,7 +34514,7 @@ function effortValues(model) {
34422
34514
  }));
34423
34515
  }
34424
34516
  function supportedSelection(models, reportedModel, reportedEffort) {
34425
- const model = models.find((candidate) => candidate.id === reportedModel) ?? models.find((candidate) => candidate.isDefault === true) ?? models[0];
34517
+ const model = models.find((candidate) => candidate.id === reportedModel);
34426
34518
  if (model === void 0) {
34427
34519
  return { model: reportedModel, effort: reportedEffort };
34428
34520
  }
@@ -34433,7 +34525,11 @@ function supportedSelection(models, reportedModel, reportedEffort) {
34433
34525
  };
34434
34526
  }
34435
34527
  function modelSetting(models, currentValue) {
34436
- const values = modelValues(models);
34528
+ const catalogValues = modelValues(models);
34529
+ const values = currentValue.length > 0 && !catalogValues.some((value) => value.value === currentValue) ? [
34530
+ { description: "Current model configured in Codex", name: currentValue, value: currentValue },
34531
+ ...catalogValues
34532
+ ] : catalogValues;
34437
34533
  const current = values.some((value) => value.value === currentValue) ? currentValue : models.find((model) => model.isDefault === true)?.id ?? values[0]?.value ?? "";
34438
34534
  if (current.length === 0) {
34439
34535
  return null;
@@ -34514,9 +34610,6 @@ function effortSetting(model, currentValue) {
34514
34610
  var CodexSettings = class {
34515
34611
  #appServer;
34516
34612
  #models = [];
34517
- // Whether the current turn must carry a policy at all. Until the user picks a mode, Codex's own
34518
- // configuration decides, so `turn/start` omits the fields and inherits what the host set up.
34519
- #policySelected = false;
34520
34613
  // Whether a collaboration mode choice has been made in this session. A restored thread keeps
34521
34614
  // the mode Codex already persisted, so the first turn does not reset it to Build.
34522
34615
  #collaborationModeSelected = false;
@@ -34554,16 +34647,12 @@ var CodexSettings = class {
34554
34647
  turnParameters = () => {
34555
34648
  const selection = this.#selection;
34556
34649
  const mode = AGENT_MODES.find((candidate) => candidate.id === selection.mode) ?? DEFAULT_MODE;
34557
- const supportsFast = this.#model(selection.model)?.additionalSpeedTiers?.includes(FAST_TIER) === true;
34650
+ const model = this.#model(selection.model);
34651
+ const supportsFast = model?.additionalSpeedTiers?.includes(FAST_TIER) === true;
34558
34652
  return {
34559
- // Until a mode is chosen, `config.toml` decides the sandbox and approval
34560
- // policy, and those fields stay off the turn so the host's own setup is
34561
- // inherited rather than overridden.
34562
- ...this.#policySelected ? {
34563
- approvalPolicy: mode.approvalPolicy,
34564
- approvalsReviewer: mode.approvalsReviewer,
34565
- sandboxPolicy: mode.sandboxPolicy
34566
- } : {},
34653
+ approvalPolicy: mode.approvalPolicy,
34654
+ approvalsReviewer: mode.approvalsReviewer,
34655
+ sandboxPolicy: mode.sandboxPolicy,
34567
34656
  // The collaboration mode rides on the turn: Codex applies it to the
34568
34657
  // thread, where it persists until changed. "Build" is Codex's `default`
34569
34658
  // mode, so it is only sent once a choice exists to apply.
@@ -34577,8 +34666,8 @@ var CodexSettings = class {
34577
34666
  }
34578
34667
  }
34579
34668
  } : {},
34580
- ...selection.effort.length === 0 ? {} : { effort: selection.effort },
34581
- ...selection.model.length === 0 ? {} : { model: selection.model },
34669
+ ...model === void 0 || selection.effort.length === 0 ? {} : { effort: selection.effort },
34670
+ ...model === void 0 ? {} : { model: model.id },
34582
34671
  ...selection.fastMode && supportsFast ? { serviceTier: SERVICE_TIER_FAST } : {}
34583
34672
  };
34584
34673
  };
@@ -34647,6 +34736,18 @@ var CodexSettings = class {
34647
34736
  options.push(modeSetting(this.#selection.mode));
34648
34737
  return options;
34649
34738
  };
34739
+ agentModelEffort = () => ({
34740
+ effortSettingId: REASONING_EFFORT_SETTING_ID,
34741
+ modelSettingId: MODEL_SETTING_ID,
34742
+ resolution: AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE,
34743
+ unsupportedModelIds: [],
34744
+ valuesByModel: Object.fromEntries(
34745
+ this.#models.map((model) => [
34746
+ model.id,
34747
+ effortValues(model).map((value) => ({ ...value, groupId: "", groupName: "" }))
34748
+ ])
34749
+ )
34750
+ });
34650
34751
  selectRestoredThread = (thread) => {
34651
34752
  const supported = supportedSelection(
34652
34753
  this.#models,
@@ -34656,6 +34757,7 @@ var CodexSettings = class {
34656
34757
  this.#selection = {
34657
34758
  ...this.#selection,
34658
34759
  ...supported,
34760
+ collaborationMode: thread.collaborationMode?.mode ?? this.#selection.collaborationMode,
34659
34761
  fastMode: thread.serviceTier === SERVICE_TIER_FAST
34660
34762
  };
34661
34763
  };
@@ -34695,7 +34797,6 @@ var CodexSettings = class {
34695
34797
  );
34696
34798
  }
34697
34799
  this.#selection = { ...this.#selection, mode: value };
34698
- this.#policySelected = true;
34699
34800
  return;
34700
34801
  }
34701
34802
  if (configId === COLLABORATION_MODE_SETTING_ID) {
@@ -35032,6 +35133,7 @@ var CodexAcpAgent = class {
35032
35133
  await this.#interruptTurn();
35033
35134
  });
35034
35135
  }
35136
+ agentSettingsModelEffort = () => this.#settings.agentModelEffort();
35035
35137
  /** The ACP agent app Mobius connects its own ACP client to, in-process. */
35036
35138
  app = () => this.#app;
35037
35139
  nativeTurnId = () => this.#nativeTurnId;
@@ -39954,6 +40056,10 @@ var acpSessionStoreMigrations = [
39954
40056
  {
39955
40057
  "name": "0004_special_mathemanic.sql",
39956
40058
  "sql": "DROP TABLE `deleted_acp_session`;--> statement-breakpoint\nALTER TABLE `acp_session` DROP COLUMN `last_terminal_command_id`;"
40059
+ },
40060
+ {
40061
+ "name": "0005_orange_amphibian.sql",
40062
+ "sql": "ALTER TABLE `acp_session` ADD `configurations` text DEFAULT '[]' NOT NULL;"
39957
40063
  }
39958
40064
  ];
39959
40065
 
@@ -41443,7 +41549,7 @@ import { WebSocket as WebSocket5 } from "undici";
41443
41549
  // package.json
41444
41550
  var package_default = {
41445
41551
  name: "@moxt-ai/mobius",
41446
- version: "0.0.191",
41552
+ version: "0.0.193",
41447
41553
  description: "Mobius CLI for pairing and running local AI agent services.",
41448
41554
  type: "module",
41449
41555
  bin: {
@@ -41757,7 +41863,8 @@ async function discoverAgentSettings(command, config2, directories, sessions, si
41757
41863
  const baseSnapshot = {
41758
41864
  agentName: inspectedBaseSnapshot.agentName,
41759
41865
  agentVersion: inspectedBaseSnapshot.agentVersion,
41760
- configOptions: await discoverOpenCodeModelOptions(agent, cwd, inspectedBaseSnapshot.configOptions, signal)
41866
+ configOptions: await discoverOpenCodeModelOptions(agent, cwd, inspectedBaseSnapshot.configOptions, signal),
41867
+ modelEffort: inspectedBaseSnapshot.modelEffort
41761
41868
  };
41762
41869
  const baseModel = modelOption(baseSnapshot.configOptions);
41763
41870
  const unsupportedModels = [];
@@ -41797,6 +41904,7 @@ async function discoverAgentSettings(command, config2, directories, sessions, si
41797
41904
  baseSnapshot.configOptions,
41798
41905
  selectedSnapshot.configOptions,
41799
41906
  unsupportedModels,
41907
+ baseSnapshot.modelEffort,
41800
41908
  cwd,
41801
41909
  sessions,
41802
41910
  signal
@@ -41889,7 +41997,7 @@ function unavailableModelEffort() {
41889
41997
  valuesByModel: {}
41890
41998
  };
41891
41999
  }
41892
- async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
42000
+ async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, discoveredModelEffort, cwd, sessions, signal) {
41893
42001
  const model = modelOption(initialOptions);
41894
42002
  const unsupportedModels = initiallyUnsupportedModels;
41895
42003
  if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
@@ -41898,6 +42006,9 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
41898
42006
  if (model === void 0 || model.type !== "select" || model.values.length === 0) {
41899
42007
  return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
41900
42008
  }
42009
+ if (resolution === AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && discoveredModelEffort.kind === "complete" && discoveredModelEffort.value.resolution === AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE) {
42010
+ return discoveredModelEffort.value;
42011
+ }
41901
42012
  const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
41902
42013
  additionalDirectories: [],
41903
42014
  agent,
@@ -42136,7 +42247,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
42136
42247
  // src/artifacts/local-file-streamer.ts
42137
42248
  import { createReadStream as createReadStream2 } from "node:fs";
42138
42249
  import { realpath as realpath10, stat as stat9 } from "node:fs/promises";
42139
- import { basename as basename5, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve7 } from "node:path";
42250
+ import { basename as basename5, extname, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve7 } from "node:path";
42140
42251
  import { fileURLToPath as fileURLToPath2 } from "node:url";
42141
42252
  var CHUNK_BYTES = 192 * 1024;
42142
42253
  function requestedPath(value) {
@@ -42186,7 +42297,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory, externa
42186
42297
  send2({
42187
42298
  byteLength: before.size,
42188
42299
  kind: FILE_BEGIN_KIND,
42189
- mediaType: external?.mediaType ?? raster?.mimeType ?? "application/octet-stream",
42300
+ mediaType: external?.mediaType ?? raster?.mimeType ?? (extname(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
42190
42301
  modifiedAt: before.mtime.toISOString(),
42191
42302
  name: external?.name ?? (basename5(target) || "file"),
42192
42303
  requestId: command.requestId,
@@ -42250,18 +42361,24 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
42250
42361
  }
42251
42362
 
42252
42363
  // src/daemon-history-commands.ts
42253
- async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventLogV2, signal) {
42364
+ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventLogV2, signal) {
42365
+ let agentId;
42254
42366
  try {
42367
+ const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
42368
+ if (entry === void 0) {
42369
+ throw new AcpExecutionError("The Session was not found", {}, "session_not_found");
42370
+ }
42371
+ agentId = entry.agentId;
42255
42372
  const resolved = await resolveSessionDirectories(
42256
42373
  directories,
42257
42374
  config2.bindingId,
42258
- command.directoryId,
42259
- command.additionalDirectoryIds,
42375
+ entry.directoryId,
42376
+ entry.additionalDirectories.map((directory) => directory.directoryId),
42260
42377
  signal
42261
42378
  );
42262
42379
  const loadOptions = {
42263
42380
  additionalDirectories: resolved.additionalDirectories,
42264
- agent: config2.catalog.find(command.agentId),
42381
+ agent: config2.catalog.find(entry.agentId),
42265
42382
  cwd: resolved.cwd,
42266
42383
  sessionId: command.sessionId,
42267
42384
  signal
@@ -42306,7 +42423,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
42306
42423
  "session_history_v2_load_failed",
42307
42424
  command.requestId,
42308
42425
  {
42309
- agentId: command.agentId,
42426
+ ...agentId === void 0 ? {} : { agentId },
42310
42427
  code: operationErrorCode(error62),
42311
42428
  sessionId: command.sessionId
42312
42429
  },
@@ -42315,7 +42432,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
42315
42432
  audit.record({
42316
42433
  commandId: command.requestId,
42317
42434
  details: {
42318
- agentId: command.agentId,
42435
+ ...agentId === void 0 ? {} : { agentId },
42319
42436
  code: operationErrorCode(error62)
42320
42437
  },
42321
42438
  event: "session_history_v2_load_failed",
@@ -42687,7 +42804,13 @@ async function executePrompt({
42687
42804
  }
42688
42805
  }
42689
42806
  const stream = activateAttempt();
42690
- const lifecycleV2 = eventLogV2.started(command.sessionId, command.commandId, attemptId, stream.epoch);
42807
+ const lifecycleV2 = eventLogV2.started(
42808
+ command.sessionId,
42809
+ command.commandId,
42810
+ attemptId,
42811
+ stream.epoch,
42812
+ availability.disposition
42813
+ );
42691
42814
  const attachments = await resolvePromptArtifacts(config2, command, signal);
42692
42815
  let stopReason;
42693
42816
  if (availability.disposition === SessionPromptDisposition.Steer) {
@@ -43175,6 +43298,7 @@ function createDaemonCommandHandler({
43175
43298
  audit,
43176
43299
  diagnostics,
43177
43300
  sessions,
43301
+ nativeSessions,
43178
43302
  eventLogV2,
43179
43303
  signal
43180
43304
  );
@@ -43976,20 +44100,29 @@ var DaemonSessionEventLogV2 = class {
43976
44100
  this.#queued.set(command.commandId, {
43977
44101
  commandId: command.commandId,
43978
44102
  content: promptContent(command),
44103
+ ...command.disposition === void 0 ? {} : { disposition: command.disposition },
43979
44104
  context: {
43980
44105
  agentId: command.agentId,
43981
44106
  directoryId: command.directoryId,
43982
44107
  additionalDirectoryIds: command.additionalDirectoryIds
43983
44108
  },
43984
44109
  phase: "queued",
43985
- sessionId: command.sessionId
44110
+ sessionId: command.sessionId,
44111
+ ...command.targetCommandId.length === 0 ? {} : { targetCommandId: command.targetCommandId }
43986
44112
  });
43987
44113
  };
43988
- started = (sessionId, commandId, attemptId, epoch) => {
44114
+ started = (sessionId, commandId, attemptId, epoch, disposition) => {
43989
44115
  const request = this.#queued.get(commandId);
43990
44116
  if (request?.sessionId === sessionId) {
43991
44117
  this.#queued.set(commandId, { ...request, phase: "running" });
43992
- return { attemptId, content: request.content, epoch, context: request.context };
44118
+ return {
44119
+ attemptId,
44120
+ content: request.content,
44121
+ disposition,
44122
+ epoch,
44123
+ context: request.context,
44124
+ ...request.targetCommandId === void 0 ? {} : { targetCommandId: request.targetCommandId }
44125
+ };
43993
44126
  }
43994
44127
  throw new Error("The executing prompt was not registered in the V2 queue");
43995
44128
  };
@@ -44076,7 +44209,12 @@ var DaemonSessionEventLogV2 = class {
44076
44209
  }
44077
44210
  };
44078
44211
  promptRequestRecovery = (sessionId) => ({
44079
- queuedPromptRequests: [...this.#queued.values()].filter((request) => request.sessionId === sessionId && request.phase === "queued").map(({ commandId, content }) => ({ commandId, content }))
44212
+ queuedPromptRequests: [...this.#queued.values()].filter((request) => request.sessionId === sessionId && request.phase === "queued").map(({ commandId, content, disposition, targetCommandId }) => ({
44213
+ commandId,
44214
+ content,
44215
+ ...disposition === void 0 ? {} : { disposition },
44216
+ ...targetCommandId === void 0 ? {} : { targetCommandId }
44217
+ }))
44080
44218
  });
44081
44219
  };
44082
44220