@moxt-ai/mobius 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import { mkdir as mkdir5 } from "node:fs/promises";
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@moxt-ai/mobius",
14
- version: "0.0.34",
14
+ version: "0.0.35",
15
15
  description: "Mobius CLI for pairing and running local AI agent services.",
16
16
  type: "module",
17
17
  bin: {
@@ -22812,7 +22812,7 @@ var configValueSchema = external_exports.strictObject({
22812
22812
  name: external_exports.string().min(1).max(255),
22813
22813
  value: external_exports.string().min(1).max(500)
22814
22814
  }).readonly();
22815
- var configOptionSchema = external_exports.strictObject({
22815
+ var sessionConfigOptionSchema = external_exports.strictObject({
22816
22816
  booleanValue: external_exports.boolean(),
22817
22817
  category: external_exports.string().max(128),
22818
22818
  currentValue: external_exports.string().max(500),
@@ -22822,6 +22822,26 @@ var configOptionSchema = external_exports.strictObject({
22822
22822
  type: external_exports.enum(["boolean", "select"]),
22823
22823
  values: external_exports.array(configValueSchema).max(500).readonly()
22824
22824
  }).readonly();
22825
+ var sessionConfigOptionsSchema = external_exports.array(sessionConfigOptionSchema).max(100).readonly();
22826
+ var sessionConfigurationSelectionSchema = external_exports.strictObject({
22827
+ booleanValue: external_exports.boolean(),
22828
+ configId: IDENTIFIER,
22829
+ value: external_exports.string().max(500),
22830
+ valueType: external_exports.enum(["boolean", "select"])
22831
+ }).readonly();
22832
+ var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigurationSelectionSchema).max(100).superRefine((selections, context) => {
22833
+ const identifiers = /* @__PURE__ */ new Set();
22834
+ for (const [index, selection] of selections.entries()) {
22835
+ if (identifiers.has(selection.configId)) {
22836
+ context.addIssue({
22837
+ code: "custom",
22838
+ message: "Session configuration identifiers must be unique",
22839
+ path: [index, "configId"]
22840
+ });
22841
+ }
22842
+ identifiers.add(selection.configId);
22843
+ }
22844
+ }).readonly();
22825
22845
  var sessionCapabilitiesSchema = external_exports.strictObject({
22826
22846
  additionalDirectories: external_exports.boolean(),
22827
22847
  audioPrompt: external_exports.boolean(),
@@ -22932,7 +22952,8 @@ var sessionIdentityFields = {
22932
22952
  var sessionPrepareCommandSchema = external_exports.strictObject({
22933
22953
  ...sessionIdentityFields,
22934
22954
  kind: external_exports.literal(SESSION_PREPARE_KIND),
22935
- requestId: IDENTIFIER
22955
+ requestId: IDENTIFIER,
22956
+ transient: external_exports.boolean().optional()
22936
22957
  }).readonly();
22937
22958
  var sessionReadyEventSchema = external_exports.strictObject({
22938
22959
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
@@ -22941,7 +22962,7 @@ var sessionReadyEventSchema = external_exports.strictObject({
22941
22962
  agentVersion: external_exports.string().max(128),
22942
22963
  capabilities: sessionCapabilitiesSchema,
22943
22964
  commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
22944
- configOptions: external_exports.array(configOptionSchema).max(100).readonly(),
22965
+ configOptions: sessionConfigOptionsSchema,
22945
22966
  directoryId: DIRECTORY_IDENTIFIER,
22946
22967
  directoryLabel: external_exports.string().min(1).max(2048),
22947
22968
  kind: external_exports.literal(SESSION_READY_KIND),
@@ -22959,7 +22980,7 @@ var sessionConfigureCommandSchema = external_exports.strictObject({
22959
22980
  valueType: external_exports.enum(["boolean", "select"])
22960
22981
  }).readonly();
22961
22982
  var sessionConfigUpdatedEventSchema = external_exports.strictObject({
22962
- configOptions: external_exports.array(configOptionSchema).max(100).readonly(),
22983
+ configOptions: sessionConfigOptionsSchema,
22963
22984
  kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
22964
22985
  requestId: IDENTIFIER,
22965
22986
  sessionId: IDENTIFIER
@@ -23135,6 +23156,7 @@ var decodeAgentDisplayContentValue = (value) => decodeValue(value, displayConten
23135
23156
  var decodeRecordedAgentContentValue = (value) => decodeValue(value, recordedDisplayContentSchema);
23136
23157
  var decodePromptImagesValue = (value) => decodeValue(value, external_exports.array(promptImageSchema).max(8).readonly());
23137
23158
  var decodePromptResourcesValue = (value) => decodeValue(value, external_exports.array(promptResourceSchema).max(16).readonly());
23159
+ var decodeSessionConfigurationSelections = (value) => decodeValue(value, sessionConfigurationSelectionsSchema);
23138
23160
  var encode3 = (message, schema) => JSON.stringify(decodeValue(message, schema));
23139
23161
  var decodeWorkspaceListCommand = (encoded) => decode3(encoded, workspaceListCommandSchema);
23140
23162
  var encodeWorkspaceEntriesEvent = (message) => encode3(message, workspaceEntriesEventSchema);
@@ -23671,8 +23693,9 @@ var BotExecutionBindingApprovalRequest = class {
23671
23693
  requestId;
23672
23694
  requiredCapabilities;
23673
23695
  runtimeId;
23696
+ sessionConfigurations;
23674
23697
  workspaceRef;
23675
- constructor(requestId, botId, behaviorRevisionId, bindingId, bindingRevision, runtimeId, agentRef, workspaceRef, agentConfigRevision, behaviorInstructions, behaviorDigest, requiredCapabilities, allowedDeliveryTargets, completionPolicy) {
23698
+ constructor(requestId, botId, behaviorRevisionId, bindingId, bindingRevision, runtimeId, agentRef, workspaceRef, agentConfigRevision, behaviorInstructions, behaviorDigest, requiredCapabilities, allowedDeliveryTargets, completionPolicy, sessionConfigurations = []) {
23676
23699
  this.requestId = requestId;
23677
23700
  this.botId = botId;
23678
23701
  this.behaviorRevisionId = behaviorRevisionId;
@@ -23685,6 +23708,7 @@ var BotExecutionBindingApprovalRequest = class {
23685
23708
  this.behaviorInstructions = behaviorInstructions;
23686
23709
  this.behaviorDigest = behaviorDigest;
23687
23710
  this.requiredCapabilities = Object.freeze([...requiredCapabilities]);
23711
+ this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
23688
23712
  this.allowedDeliveryTargets = Object.freeze(
23689
23713
  allowedDeliveryTargets.map(
23690
23714
  (target) => new BotDeliveryTargetReference(target.alias, target.deliveryTargetId)
@@ -23692,6 +23716,13 @@ var BotExecutionBindingApprovalRequest = class {
23692
23716
  );
23693
23717
  this.completionPolicy = completionPolicy;
23694
23718
  }
23719
+ toJSON() {
23720
+ const { sessionConfigurations, ...request } = this;
23721
+ return {
23722
+ ...request,
23723
+ ...sessionConfigurations.length === 0 ? {} : { sessionConfigurations }
23724
+ };
23725
+ }
23695
23726
  };
23696
23727
  var BotExecutionBindingApprovedEvent = class {
23697
23728
  agentIdentityDigest;
@@ -23756,9 +23787,10 @@ var BotSessionPromptCommand = class {
23756
23787
  prompt;
23757
23788
  replyRoute;
23758
23789
  resources;
23790
+ sessionConfigurations;
23759
23791
  sessionId;
23760
23792
  turnId;
23761
- constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute) {
23793
+ constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute, sessionConfigurations = []) {
23762
23794
  this.sessionId = sessionId;
23763
23795
  this.commandId = commandId;
23764
23796
  this.agentId = agentId;
@@ -23786,6 +23818,14 @@ var BotSessionPromptCommand = class {
23786
23818
  )
23787
23819
  );
23788
23820
  this.replyRoute = replyRoute;
23821
+ this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
23822
+ }
23823
+ toJSON() {
23824
+ const { sessionConfigurations, ...command } = this;
23825
+ return {
23826
+ ...command,
23827
+ ...sessionConfigurations.length === 0 ? {} : { sessionConfigurations }
23828
+ };
23789
23829
  }
23790
23830
  };
23791
23831
  function isRecord5(value) {
@@ -23809,6 +23849,12 @@ function assertExactKeys2(value, expected) {
23809
23849
  throw new ProtocolMessageError("Message fields do not match the Bot protocol");
23810
23850
  }
23811
23851
  }
23852
+ function assertKeysWithOptional(value, expected, optional2) {
23853
+ const keys = Object.keys(value);
23854
+ if (keys.length < expected.length || keys.length > expected.length + optional2.length || expected.some((key) => !Object.hasOwn(value, key)) || keys.some((key) => !expected.includes(key) && !optional2.includes(key))) {
23855
+ throw new ProtocolMessageError("Message fields do not match the Bot protocol");
23856
+ }
23857
+ }
23812
23858
  function readText2(value, key, maximumLength, allowEmpty) {
23813
23859
  const field = value[key];
23814
23860
  if (typeof field !== "string" || field.length > maximumLength || !allowEmpty && field.length === 0) {
@@ -23898,6 +23944,12 @@ function readTargets(value, key) {
23898
23944
  }
23899
23945
  return Object.freeze(targets);
23900
23946
  }
23947
+ function readSessionConfigurations(value) {
23948
+ if (!Object.hasOwn(value, "sessionConfigurations")) {
23949
+ return [];
23950
+ }
23951
+ return decodeSessionConfigurationSelections(value["sessionConfigurations"]);
23952
+ }
23901
23953
  function readCompletionPolicy(value) {
23902
23954
  if (!isRecord5(value)) {
23903
23955
  throw new ProtocolMessageError("Invalid Bot completion policy");
@@ -23936,23 +23988,27 @@ function readReplyRoute(value) {
23936
23988
  }
23937
23989
  function decodeBotExecutionBindingApprovalRequest(encoded) {
23938
23990
  const value = parseJson3(encoded);
23939
- assertExactKeys2(value, [
23940
- "agentConfigRevision",
23941
- "agentRef",
23942
- "allowedDeliveryTargets",
23943
- "behaviorDigest",
23944
- "behaviorInstructions",
23945
- "behaviorRevisionId",
23946
- "bindingId",
23947
- "bindingRevision",
23948
- "botId",
23949
- "completionPolicy",
23950
- "kind",
23951
- "requestId",
23952
- "requiredCapabilities",
23953
- "runtimeId",
23954
- "workspaceRef"
23955
- ]);
23991
+ assertKeysWithOptional(
23992
+ value,
23993
+ [
23994
+ "agentConfigRevision",
23995
+ "agentRef",
23996
+ "allowedDeliveryTargets",
23997
+ "behaviorDigest",
23998
+ "behaviorInstructions",
23999
+ "behaviorRevisionId",
24000
+ "bindingId",
24001
+ "bindingRevision",
24002
+ "botId",
24003
+ "completionPolicy",
24004
+ "kind",
24005
+ "requestId",
24006
+ "requiredCapabilities",
24007
+ "runtimeId",
24008
+ "workspaceRef"
24009
+ ],
24010
+ ["sessionConfigurations"]
24011
+ );
23956
24012
  if (value["kind"] !== BOT_BINDING_APPROVAL_REQUEST_KIND) {
23957
24013
  throw new ProtocolMessageError("Invalid Bot binding approval request kind");
23958
24014
  }
@@ -23970,7 +24026,8 @@ function decodeBotExecutionBindingApprovalRequest(encoded) {
23970
24026
  readDigest(value, "behaviorDigest"),
23971
24027
  readIdentifiers(value, "requiredCapabilities", 32),
23972
24028
  readTargets(value, "allowedDeliveryTargets"),
23973
- readCompletionPolicy(value["completionPolicy"])
24029
+ readCompletionPolicy(value["completionPolicy"]),
24030
+ readSessionConfigurations(value)
23974
24031
  );
23975
24032
  }
23976
24033
  function decodeBotExecutionBindingApprovedEvent(encoded) {
@@ -24033,32 +24090,36 @@ function encodeBotExecutionBindingUnavailableEvent(event) {
24033
24090
  }
24034
24091
  function decodeBotSessionPromptCommand(encoded) {
24035
24092
  const value = parseJson3(encoded);
24036
- assertExactKeys2(value, [
24037
- "additionalDirectoryIds",
24038
- "agentId",
24039
- "allowedDeliveryTargets",
24040
- "behaviorDigest",
24041
- "behaviorInstructions",
24042
- "behaviorRevisionId",
24043
- "bindingId",
24044
- "bindingRevision",
24045
- "botId",
24046
- "commandId",
24047
- "conversationId",
24048
- "directoryId",
24049
- "executionCapabilityId",
24050
- "executionCapabilitySecret",
24051
- "executionDeadlineAt",
24052
- "executionId",
24053
- "images",
24054
- "kind",
24055
- "localGrantId",
24056
- "prompt",
24057
- "replyRoute",
24058
- "resources",
24059
- "sessionId",
24060
- "turnId"
24061
- ]);
24093
+ assertKeysWithOptional(
24094
+ value,
24095
+ [
24096
+ "additionalDirectoryIds",
24097
+ "agentId",
24098
+ "allowedDeliveryTargets",
24099
+ "behaviorDigest",
24100
+ "behaviorInstructions",
24101
+ "behaviorRevisionId",
24102
+ "bindingId",
24103
+ "bindingRevision",
24104
+ "botId",
24105
+ "commandId",
24106
+ "conversationId",
24107
+ "directoryId",
24108
+ "executionCapabilityId",
24109
+ "executionCapabilitySecret",
24110
+ "executionDeadlineAt",
24111
+ "executionId",
24112
+ "images",
24113
+ "kind",
24114
+ "localGrantId",
24115
+ "prompt",
24116
+ "replyRoute",
24117
+ "resources",
24118
+ "sessionId",
24119
+ "turnId"
24120
+ ],
24121
+ ["sessionConfigurations"]
24122
+ );
24062
24123
  if (value["kind"] !== BOT_SESSION_PROMPT_KIND) {
24063
24124
  throw new ProtocolMessageError("Invalid Bot Session prompt kind");
24064
24125
  }
@@ -24085,7 +24146,8 @@ function decodeBotSessionPromptCommand(encoded) {
24085
24146
  readText2(value, "behaviorInstructions", MAX_INSTRUCTIONS_LENGTH, true),
24086
24147
  readDigest(value, "behaviorDigest"),
24087
24148
  readTargets(value, "allowedDeliveryTargets"),
24088
- readReplyRoute(value["replyRoute"])
24149
+ readReplyRoute(value["replyRoute"]),
24150
+ readSessionConfigurations(value)
24089
24151
  );
24090
24152
  }
24091
24153
 
@@ -24208,6 +24270,7 @@ var nativeSessionTurnForkCommandSchema = external_exports.strictObject({
24208
24270
  title: external_exports.string().max(500)
24209
24271
  }).readonly();
24210
24272
  var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
24273
+ external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
24211
24274
  external_exports.strictObject({
24212
24275
  ...identity,
24213
24276
  action: external_exports.literal("list"),
@@ -24258,7 +24321,7 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
24258
24321
  action: external_exports.literal("preview"),
24259
24322
  entryId: identifier,
24260
24323
  targetSessionId: identifier,
24261
- reason: external_exports.literal("continuation_unavailable"),
24324
+ reason: external_exports.enum(["continuation_unavailable", "requested"]),
24262
24325
  history: sessionHistorySchema,
24263
24326
  title: external_exports.string().max(500)
24264
24327
  }).readonly(),
@@ -24567,6 +24630,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
24567
24630
  const agents = localAgents.map((agent) => ({
24568
24631
  agentPath: agent.agentIdentity.requestedPath,
24569
24632
  agentVersion: agent.agentVersion,
24633
+ botSessionConfiguration: true,
24570
24634
  capabilities: agent.capabilities,
24571
24635
  id: agent.id,
24572
24636
  label: agent.label
@@ -24830,6 +24894,16 @@ function exactTargets(left, right) {
24830
24894
  const actual = [...right].sort();
24831
24895
  return expected.every((target, index) => target === actual[index]);
24832
24896
  }
24897
+ function exactSessionConfigurations(left, right) {
24898
+ if (left.length !== right.length) {
24899
+ return false;
24900
+ }
24901
+ const expected = new Map(left.map((selection) => [selection.configId, selection]));
24902
+ return right.every((selection) => {
24903
+ const approved = expected.get(selection.configId);
24904
+ return approved !== void 0 && approved.booleanValue === selection.booleanValue && approved.value === selection.value && approved.valueType === selection.valueType;
24905
+ });
24906
+ }
24833
24907
  function rowString(row, key) {
24834
24908
  const value = Reflect.get(row, key);
24835
24909
  if (typeof value !== "string") {
@@ -24856,6 +24930,15 @@ function parseTargets(encoded) {
24856
24930
  }
24857
24931
  return value.filter((target) => typeof target === "string");
24858
24932
  }
24933
+ function parseSessionConfigurations(encoded) {
24934
+ let value;
24935
+ try {
24936
+ value = JSON.parse(encoded);
24937
+ return decodeSessionConfigurationSelections(value);
24938
+ } catch (cause) {
24939
+ throw new LocalBotAuthorizationError("local_grant_invalid", "The local Bot grant is invalid", { cause });
24940
+ }
24941
+ }
24859
24942
  var LocalBotGrantStore = class {
24860
24943
  #database;
24861
24944
  static containsBot = (path2, botId) => {
@@ -24900,6 +24983,10 @@ var LocalBotGrantStore = class {
24900
24983
  error_code TEXT,
24901
24984
  error_message TEXT
24902
24985
  ) STRICT;
24986
+ CREATE TABLE IF NOT EXISTS local_bot_grant_configurations (
24987
+ local_grant_id TEXT PRIMARY KEY,
24988
+ session_configurations_json TEXT NOT NULL
24989
+ ) STRICT;
24903
24990
  `);
24904
24991
  }
24905
24992
  /** Only the local CLI may invoke this explicit approval transition. */
@@ -25025,6 +25112,11 @@ var LocalBotGrantStore = class {
25025
25112
  now,
25026
25113
  expiresAt
25027
25114
  );
25115
+ this.#database.prepare(
25116
+ `INSERT INTO local_bot_grant_configurations (
25117
+ local_grant_id, session_configurations_json
25118
+ ) VALUES (?, ?)`
25119
+ ).run(localGrantId, JSON.stringify(request.sessionConfigurations));
25028
25120
  this.#database.prepare(
25029
25121
  `INSERT INTO local_bot_binding_resolutions (
25030
25122
  request_id, binding_id, local_grant_id, resolved_at, result
@@ -25050,8 +25142,12 @@ var LocalBotGrantStore = class {
25050
25142
  resolveExecution = async (command, catalog, directories, bindingAuthorityId, now, signal) => {
25051
25143
  signal.throwIfAborted();
25052
25144
  const row = this.#database.prepare(
25053
- `SELECT * FROM local_bot_grants
25054
- WHERE local_grant_id = ? AND bot_id = ?
25145
+ `SELECT grants.*, COALESCE(configurations.session_configurations_json, '[]')
25146
+ AS session_configurations_json
25147
+ FROM local_bot_grants AS grants
25148
+ LEFT JOIN local_bot_grant_configurations AS configurations
25149
+ ON configurations.local_grant_id = grants.local_grant_id
25150
+ WHERE grants.local_grant_id = ? AND grants.bot_id = ?
25055
25151
  AND behavior_revision_id = ? AND behavior_digest = ?
25056
25152
  AND binding_id = ? AND binding_revision = ?
25057
25153
  AND agent_ref = ?
@@ -25080,6 +25176,13 @@ var LocalBotGrantStore = class {
25080
25176
  "The Bot execution target policy changed after local approval"
25081
25177
  );
25082
25178
  }
25179
+ const approvedConfigurations = parseSessionConfigurations(rowString(row, "session_configurations_json"));
25180
+ if (!exactSessionConfigurations(approvedConfigurations, command.sessionConfigurations)) {
25181
+ throw new LocalBotAuthorizationError(
25182
+ "binding_not_approved",
25183
+ "The Bot Agent configuration changed after local approval"
25184
+ );
25185
+ }
25083
25186
  const agent = catalog.find(command.agentId);
25084
25187
  const [adapterUnchanged, agentUnchanged] = await Promise.all([
25085
25188
  revalidateExecutable(agent.adapterIdentity),
@@ -28761,6 +28864,29 @@ var AcpSessionManager = class {
28761
28864
  const runtime = await this.#startPreparation(options);
28762
28865
  return runtime.prepared();
28763
28866
  };
28867
+ /**
28868
+ * Opens a short-lived ACP session only to read the Agent's authoritative
28869
+ * configuration options. The runtime and any persisted native-session
28870
+ * record are released before this method resolves.
28871
+ */
28872
+ inspectSession = async (options) => {
28873
+ if (this.#preparing.has(options.sessionId) || this.#sessions.has(options.sessionId)) {
28874
+ throw new AcpExecutionError("The configuration inspection session is already in use", {}, "session_busy");
28875
+ }
28876
+ const runtime = await this.#startPreparation(options);
28877
+ try {
28878
+ return runtime.prepared();
28879
+ } finally {
28880
+ if (this.#sessions.get(options.sessionId) === runtime) {
28881
+ this.#sessions.delete(options.sessionId);
28882
+ }
28883
+ try {
28884
+ await runtime.close();
28885
+ } finally {
28886
+ this.#store.remove(options.sessionId);
28887
+ }
28888
+ }
28889
+ };
28764
28890
  prepareExecutionSession = async (options) => {
28765
28891
  const pending = this.#preparing.get(options.sessionId);
28766
28892
  if (pending !== void 0) {
@@ -29021,6 +29147,33 @@ var AcpSessionManager = class {
29021
29147
  return started;
29022
29148
  }
29023
29149
  listNativeSessions = async (options, cursor) => await (await this.#ensureNativeSessionBrowser(options)).listNativeSessions(cursor, options.signal);
29150
+ previewNativeSession = async (options, nativeSessionId) => {
29151
+ const key = `${options.agent.id}:${nativeSessionId}`;
29152
+ const linked = this.#store.findNative(options.agent.id, nativeSessionId);
29153
+ if (this.#nativeOperations.has(key) || linked.some((entry) => this.#activeSessionIds.has(entry.sessionId) || this.#preparing.has(entry.sessionId))) {
29154
+ throw new AcpExecutionError(
29155
+ "Wait for the native session's running operation to finish",
29156
+ {},
29157
+ "session_busy"
29158
+ );
29159
+ }
29160
+ this.#nativeOperations.add(key);
29161
+ try {
29162
+ const runtime = await AcpProcessSession.startNativeSessionBrowser(
29163
+ options,
29164
+ () => this.#nativeBrowserObserver,
29165
+ new MemoryAcpSessionStore()
29166
+ );
29167
+ try {
29168
+ runtime.selectNativeSession(nativeSessionId);
29169
+ return await runtime.loadHistory(options.signal);
29170
+ } finally {
29171
+ await runtime.closeProcess();
29172
+ }
29173
+ } finally {
29174
+ this.#nativeOperations.delete(key);
29175
+ }
29176
+ };
29024
29177
  openNativeSession = async (options, origin) => {
29025
29178
  const key = `${options.agent.id}:${origin.nativeSessionId}`;
29026
29179
  if (this.#nativeOperations.has(key)) {
@@ -29247,6 +29400,7 @@ async function publishAgentCatalog(config2, signal) {
29247
29400
  agents: catalog.agents.map((agent) => ({
29248
29401
  agentPath: agent.agentIdentity.requestedPath,
29249
29402
  agentVersion: agent.agentVersion,
29403
+ botSessionConfiguration: true,
29250
29404
  capabilities: agent.capabilities,
29251
29405
  id: agent.id,
29252
29406
  label: agent.label
@@ -30632,6 +30786,23 @@ var NativeSessionService = class {
30632
30786
  );
30633
30787
  }
30634
30788
  const target = await this.resolveTarget(command, options, selected);
30789
+ if (command.action === "preview") {
30790
+ const history = await this.#sessions.previewNativeSession(
30791
+ { ...options, cwd: target.cwd, additionalDirectories: target.additionalDirectories },
30792
+ target.info.sessionId
30793
+ );
30794
+ signal.throwIfAborted();
30795
+ this.record(command, "native_session_previewed");
30796
+ return {
30797
+ ...envelope2,
30798
+ action: "preview",
30799
+ entryId: command.entryId,
30800
+ targetSessionId: command.sessionId,
30801
+ reason: "requested",
30802
+ title: target.info.title ?? "Untitled session",
30803
+ history
30804
+ };
30805
+ }
30635
30806
  if (command.action === "delete") {
30636
30807
  if (!prepared.capabilities.deleteSession) {
30637
30808
  throw new AcpExecutionError(
@@ -32631,13 +32802,14 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
32631
32802
  signal
32632
32803
  );
32633
32804
  const agent = config2.catalog.find(command.agentId);
32634
- const prepared = await sessions.prepareSession({
32805
+ const preparation = {
32635
32806
  additionalDirectories: resolved.additionalDirectories,
32636
32807
  agent,
32637
32808
  cwd: resolved.cwd,
32638
32809
  sessionId: command.sessionId,
32639
32810
  signal
32640
- });
32811
+ };
32812
+ const prepared = command.transient === true ? await sessions.inspectSession(preparation) : await sessions.prepareSession(preparation);
32641
32813
  const listing = await directories.list(config2.bindingId, command.directoryId, signal);
32642
32814
  audit.record({
32643
32815
  commandId: command.requestId,
@@ -32916,6 +33088,20 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
32916
33088
  sessionId: command.sessionId,
32917
33089
  signal: executionSignal
32918
33090
  });
33091
+ for (const selection of command.sessionConfigurations) {
33092
+ await sessions.configureSession({
33093
+ additionalDirectories: resolved.additionalDirectories,
33094
+ agent,
33095
+ booleanValue: selection.booleanValue,
33096
+ configId: selection.configId,
33097
+ cwd: resolved.cwd,
33098
+ requestId: `cfg_${randomUUID6()}`,
33099
+ sessionId: command.sessionId,
33100
+ signal: executionSignal,
33101
+ value: selection.value,
33102
+ valueType: selection.valueType
33103
+ });
33104
+ }
32919
33105
  audit.record({
32920
33106
  commandId: command.commandId,
32921
33107
  details: {