@openacp/cli 2026.403.7 → 2026.403.8

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/index.d.ts CHANGED
@@ -1486,6 +1486,15 @@ declare class Session extends TypedEmitter<SessionEvents> {
1486
1486
  private autoName;
1487
1487
  setInitialConfigOptions(options: ConfigOption[]): void;
1488
1488
  setAgentCapabilities(caps: AgentCapabilities | undefined): void;
1489
+ /**
1490
+ * Hydrate configOptions and agentCapabilities from a spawn response.
1491
+ * Handles both the native configOptions format and legacy modes/models fields.
1492
+ */
1493
+ applySpawnResponse(resp: {
1494
+ modes?: unknown;
1495
+ configOptions?: unknown;
1496
+ models?: unknown;
1497
+ } | undefined, caps: AgentCapabilities | undefined): void;
1489
1498
  getConfigOption(id: string): ConfigOption | undefined;
1490
1499
  getConfigByCategory(category: string): ConfigOption | undefined;
1491
1500
  getConfigValue(id: string): string | undefined;
package/dist/index.js CHANGED
@@ -1078,7 +1078,7 @@ var BYPASS_KEYWORDS;
1078
1078
  var init_bypass_detection = __esm({
1079
1079
  "src/core/utils/bypass-detection.ts"() {
1080
1080
  "use strict";
1081
- BYPASS_KEYWORDS = ["bypass", "dangerous", "auto_accept"];
1081
+ BYPASS_KEYWORDS = ["bypass", "dangerous", "auto_accept", "yolo"];
1082
1082
  }
1083
1083
  });
1084
1084
 
@@ -11211,12 +11211,18 @@ ${stderr}`
11211
11211
  cwd: workingDirectory,
11212
11212
  mcpServers: resolvedMcp
11213
11213
  });
11214
+ log4.info(response, "newSession response");
11214
11215
  instance.sessionId = response.sessionId;
11215
11216
  instance.initialSessionResponse = response;
11216
11217
  instance.debugTracer = createDebugTracer(response.sessionId, workingDirectory);
11217
11218
  instance.setupCrashDetection();
11218
11219
  log4.info(
11219
- { sessionId: response.sessionId, durationMs: Date.now() - spawnStart },
11220
+ {
11221
+ sessionId: response.sessionId,
11222
+ durationMs: Date.now() - spawnStart,
11223
+ configOptions: response.configOptions ?? [],
11224
+ agentCapabilities: instance.agentCapabilities ?? null
11225
+ },
11220
11226
  "Agent spawn complete"
11221
11227
  );
11222
11228
  return instance;
@@ -11228,24 +11234,47 @@ ${stderr}`
11228
11234
  agentDef,
11229
11235
  workingDirectory
11230
11236
  );
11237
+ const resolvedMcp = _AgentInstance.mcpManager.resolve(mcpServers);
11231
11238
  try {
11232
- const response = await instance.connection.unstable_resumeSession({
11233
- sessionId: agentSessionId,
11234
- cwd: workingDirectory
11235
- });
11236
- instance.sessionId = response.sessionId;
11237
- instance.initialSessionResponse = response;
11238
- instance.debugTracer = createDebugTracer(response.sessionId, workingDirectory);
11239
- log4.info(
11240
- { sessionId: response.sessionId, durationMs: Date.now() - spawnStart },
11241
- "Agent resume complete"
11242
- );
11239
+ if (instance.agentCapabilities?.loadSession) {
11240
+ const response = await instance.connection.loadSession({
11241
+ sessionId: agentSessionId,
11242
+ cwd: workingDirectory,
11243
+ mcpServers: resolvedMcp
11244
+ });
11245
+ instance.sessionId = agentSessionId;
11246
+ instance.initialSessionResponse = response;
11247
+ instance.debugTracer = createDebugTracer(agentSessionId, workingDirectory);
11248
+ log4.info(
11249
+ {
11250
+ sessionId: agentSessionId,
11251
+ durationMs: Date.now() - spawnStart,
11252
+ agentCapabilities: instance.agentCapabilities ?? null
11253
+ },
11254
+ "Agent load complete"
11255
+ );
11256
+ } else {
11257
+ const response = await instance.connection.unstable_resumeSession({
11258
+ sessionId: agentSessionId,
11259
+ cwd: workingDirectory
11260
+ });
11261
+ instance.sessionId = response.sessionId;
11262
+ instance.initialSessionResponse = response;
11263
+ instance.debugTracer = createDebugTracer(response.sessionId, workingDirectory);
11264
+ log4.info(
11265
+ {
11266
+ sessionId: response.sessionId,
11267
+ durationMs: Date.now() - spawnStart,
11268
+ agentCapabilities: instance.agentCapabilities ?? null
11269
+ },
11270
+ "Agent resume complete"
11271
+ );
11272
+ }
11243
11273
  } catch (err) {
11244
11274
  log4.warn(
11245
11275
  { err, agentSessionId },
11246
11276
  "Resume failed, falling back to new session"
11247
11277
  );
11248
- const resolvedMcp = _AgentInstance.mcpManager.resolve(mcpServers);
11249
11278
  const response = await instance.connection.newSession({
11250
11279
  cwd: workingDirectory,
11251
11280
  mcpServers: resolvedMcp
@@ -11476,11 +11505,31 @@ ${stderr}`
11476
11505
  }
11477
11506
  // ── New ACP methods ──────────────────────────────────────────────────
11478
11507
  async setConfigOption(configId, value) {
11479
- return await this.connection.setSessionConfigOption({
11480
- sessionId: this.sessionId,
11481
- configId,
11482
- ...value
11483
- });
11508
+ try {
11509
+ return await this.connection.setSessionConfigOption({
11510
+ sessionId: this.sessionId,
11511
+ configId,
11512
+ ...value
11513
+ });
11514
+ } catch (err) {
11515
+ if (typeof err === "object" && err !== null && err.code === -32601) {
11516
+ if (configId === "mode" && value.type === "select") {
11517
+ await this.connection.setSessionMode({
11518
+ sessionId: this.sessionId,
11519
+ modeId: value.value
11520
+ });
11521
+ return { configOptions: [] };
11522
+ }
11523
+ if (configId === "model" && value.type === "select") {
11524
+ await this.connection.unstable_setSessionModel({
11525
+ sessionId: this.sessionId,
11526
+ modelId: value.value
11527
+ });
11528
+ return { configOptions: [] };
11529
+ }
11530
+ }
11531
+ throw err;
11532
+ }
11484
11533
  }
11485
11534
  async listSessions(cwd, cursor) {
11486
11535
  return await this.connection.listSessions({
@@ -11800,6 +11849,7 @@ var Session = class extends TypedEmitter {
11800
11849
  (err) => {
11801
11850
  this.log.error({ err }, "Prompt execution failed");
11802
11851
  const message = err instanceof Error ? err.message : String(err);
11852
+ this.fail(message);
11803
11853
  this.emit("agent_event", { type: "error", message: `Prompt execution failed: ${message}` });
11804
11854
  }
11805
11855
  );
@@ -12054,6 +12104,42 @@ ${result.text}` : result.text;
12054
12104
  setAgentCapabilities(caps) {
12055
12105
  this.agentCapabilities = caps;
12056
12106
  }
12107
+ /**
12108
+ * Hydrate configOptions and agentCapabilities from a spawn response.
12109
+ * Handles both the native configOptions format and legacy modes/models fields.
12110
+ */
12111
+ applySpawnResponse(resp, caps) {
12112
+ if (caps) this.agentCapabilities = caps;
12113
+ if (!resp) return;
12114
+ if (resp.configOptions) {
12115
+ this.configOptions = resp.configOptions;
12116
+ return;
12117
+ }
12118
+ const legacyOptions = [];
12119
+ if (resp.modes) {
12120
+ const m = resp.modes;
12121
+ legacyOptions.push({
12122
+ id: "mode",
12123
+ name: "Mode",
12124
+ category: "mode",
12125
+ type: "select",
12126
+ currentValue: m.currentModeId,
12127
+ options: m.availableModes.map((x) => ({ value: x.id, name: x.name, description: x.description }))
12128
+ });
12129
+ }
12130
+ if (resp.models) {
12131
+ const m = resp.models;
12132
+ legacyOptions.push({
12133
+ id: "model",
12134
+ name: "Model",
12135
+ category: "model",
12136
+ type: "select",
12137
+ currentValue: m.currentModelId,
12138
+ options: m.availableModels.map((x) => ({ value: x.modelId ?? x.id, name: x.name, description: x.description }))
12139
+ });
12140
+ }
12141
+ if (legacyOptions.length > 0) this.configOptions = legacyOptions;
12142
+ }
12057
12143
  getConfigOption(id) {
12058
12144
  return this.configOptions.find((o) => o.id === id);
12059
12145
  }
@@ -12073,8 +12159,13 @@ ${result.text}` : result.text;
12073
12159
  /** Send a config option change to the agent and update local state from the response. */
12074
12160
  async setConfigOption(configId, value) {
12075
12161
  const response = await this.agentInstance.setConfigOption(configId, value);
12076
- if (response.configOptions) {
12162
+ if (response.configOptions && response.configOptions.length > 0) {
12077
12163
  await this.updateConfigOptions(response.configOptions);
12164
+ } else if (value.type === "select") {
12165
+ const updated = this.configOptions.map(
12166
+ (o) => o.id === configId && o.type === "select" ? { ...o, currentValue: value.value } : o
12167
+ );
12168
+ await this.updateConfigOptions(updated);
12078
12169
  }
12079
12170
  }
12080
12171
  async updateConfigOptions(options) {
@@ -12138,6 +12229,8 @@ ${result.text}` : result.text;
12138
12229
  this.promptCount = 0;
12139
12230
  this.agentCapabilities = void 0;
12140
12231
  this.configOptions = [];
12232
+ this.latestCommands = null;
12233
+ this.applySpawnResponse(newAgent.initialSessionResponse, newAgent.agentCapabilities);
12141
12234
  this.log.info({ from: this.agentSwitchHistory.at(-1).agentName, to: agentName }, "Agent switched");
12142
12235
  }
12143
12236
  async destroy() {
@@ -12814,6 +12907,9 @@ var SessionBridge = class {
12814
12907
  if (this.session.latestCommands !== null) {
12815
12908
  this.session.emit("agent_event", { type: "commands_update", commands: this.session.latestCommands });
12816
12909
  }
12910
+ if (this.session.configOptions.length > 0) {
12911
+ this.session.emit("agent_event", { type: "config_option_update", options: this.session.configOptions });
12912
+ }
12817
12913
  }
12818
12914
  disconnect() {
12819
12915
  if (!this.connected) return;
@@ -13184,17 +13280,7 @@ var SessionFactory = class {
13184
13280
  if (createParams.initialName) {
13185
13281
  session.name = createParams.initialName;
13186
13282
  }
13187
- const resp = agentInstance.initialSessionResponse;
13188
- if (resp) {
13189
- if (resp.configOptions) {
13190
- session.setInitialConfigOptions(resp.configOptions);
13191
- }
13192
- if (agentInstance.agentCapabilities) {
13193
- session.setAgentCapabilities(agentInstance.agentCapabilities);
13194
- }
13195
- } else if (agentInstance.agentCapabilities) {
13196
- session.setAgentCapabilities(agentInstance.agentCapabilities);
13197
- }
13283
+ session.applySpawnResponse(agentInstance.initialSessionResponse, agentInstance.agentCapabilities);
13198
13284
  this.sessionManager.registerSession(session);
13199
13285
  this.eventBus.emit("session:created", {
13200
13286
  sessionId: session.id,