@openacp/cli 2026.401.4 → 2026.401.7

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
@@ -9756,11 +9756,13 @@ function formatToolSummary(name, rawInput, displaySummary) {
9756
9756
  return desc ? `\u{1F9E0} Agent: ${desc}` : `\u{1F527} ${name}`;
9757
9757
  }
9758
9758
  if (lowerName === "webfetch" || lowerName === "web_fetch") {
9759
- const url = String(args2.url ?? "").slice(0, 60);
9759
+ const raw = args2.url ?? "";
9760
+ const url = (raw !== "undefined" ? String(raw) : "").slice(0, 60);
9760
9761
  return url ? `\u{1F310} Fetch ${url}` : `\u{1F527} ${name}`;
9761
9762
  }
9762
9763
  if (lowerName === "websearch" || lowerName === "web_search") {
9763
- const query = String(args2.query ?? "").slice(0, 60);
9764
+ const raw = args2.query ?? "";
9765
+ const query = (raw !== "undefined" ? String(raw) : "").slice(0, 60);
9764
9766
  return query ? `\u{1F310} Search "${query}"` : `\u{1F527} ${name}`;
9765
9767
  }
9766
9768
  return `\u{1F527} ${name}`;
@@ -9789,10 +9791,12 @@ function formatToolTitle(name, rawInput, displayTitle) {
9789
9791
  return String(args2.description ?? name).slice(0, 60);
9790
9792
  }
9791
9793
  if (["webfetch", "web_fetch"].includes(lowerName)) {
9792
- return String(args2.url ?? name).slice(0, 60);
9794
+ const url = typeof args2.url === "string" && args2.url !== "undefined" ? args2.url : null;
9795
+ return (url ?? name).slice(0, 60);
9793
9796
  }
9794
9797
  if (["websearch", "web_search"].includes(lowerName)) {
9795
- return String(args2.query ?? name).slice(0, 60);
9798
+ const query = typeof args2.query === "string" && args2.query !== "undefined" ? args2.query : null;
9799
+ return (query ?? name).slice(0, 60);
9796
9800
  }
9797
9801
  return name;
9798
9802
  }
@@ -10070,7 +10074,7 @@ var BYPASS_KEYWORDS;
10070
10074
  var init_bypass_detection = __esm({
10071
10075
  "src/core/utils/bypass-detection.ts"() {
10072
10076
  "use strict";
10073
- BYPASS_KEYWORDS = ["bypass", "dangerous", "skip", "dontask", "dont_ask", "auto_accept"];
10077
+ BYPASS_KEYWORDS = ["bypass", "dangerous", "auto_accept"];
10074
10078
  }
10075
10079
  });
10076
10080
 
@@ -10093,7 +10097,7 @@ function setupDangerousModeCallbacks(bot, core) {
10093
10097
  }
10094
10098
  const registry = core.lifecycleManager?.serviceRegistry?.get("command-registry");
10095
10099
  if (registry) {
10096
- await registry.execute(wantOn ? "/bypass on" : "/bypass off", {
10100
+ await registry.execute(wantOn ? "/bypass_permissions on" : "/bypass_permissions off", {
10097
10101
  raw: wantOn ? "on" : "off",
10098
10102
  sessionId,
10099
10103
  channelId: "telegram",
@@ -10147,104 +10151,6 @@ function setupDangerousModeCallbacks(bot, core) {
10147
10151
  }
10148
10152
  });
10149
10153
  }
10150
- async function handleEnableDangerous(ctx, core) {
10151
- const threadId = ctx.message?.message_thread_id;
10152
- if (!threadId) {
10153
- await ctx.reply("\u26A0\uFE0F This command only works inside a session topic.", {
10154
- parse_mode: "HTML"
10155
- });
10156
- return;
10157
- }
10158
- const session = await core.getOrResumeSession(
10159
- "telegram",
10160
- String(threadId)
10161
- );
10162
- if (session) {
10163
- if (session.clientOverrides.bypassPermissions) {
10164
- await ctx.reply("\u2620\uFE0F Bypass is already enabled.", {
10165
- parse_mode: "HTML"
10166
- });
10167
- return;
10168
- }
10169
- session.clientOverrides.bypassPermissions = true;
10170
- core.sessionManager.patchRecord(session.id, { clientOverrides: session.clientOverrides }).catch(() => {
10171
- });
10172
- } else {
10173
- const record = core.sessionManager.getRecordByThread(
10174
- "telegram",
10175
- String(threadId)
10176
- );
10177
- if (!record || record.status === "cancelled" || record.status === "error") {
10178
- await ctx.reply("\u26A0\uFE0F No active session in this topic.", {
10179
- parse_mode: "HTML"
10180
- });
10181
- return;
10182
- }
10183
- if (record.clientOverrides?.bypassPermissions ?? record.dangerousMode) {
10184
- await ctx.reply("\u2620\uFE0F Bypass is already enabled.", {
10185
- parse_mode: "HTML"
10186
- });
10187
- return;
10188
- }
10189
- core.sessionManager.patchRecord(record.sessionId, { clientOverrides: { bypassPermissions: true } }).catch(() => {
10190
- });
10191
- }
10192
- await ctx.reply(
10193
- `\u2620\uFE0F <b>Bypass Permissions enabled</b>
10194
-
10195
- All permission requests will be auto-approved \u2014 the agent can run any action without asking.
10196
-
10197
- Use /disable_bypass to turn this off.`,
10198
- { parse_mode: "HTML" }
10199
- );
10200
- }
10201
- async function handleDisableDangerous(ctx, core) {
10202
- const threadId = ctx.message?.message_thread_id;
10203
- if (!threadId) {
10204
- await ctx.reply("\u26A0\uFE0F This command only works inside a session topic.", {
10205
- parse_mode: "HTML"
10206
- });
10207
- return;
10208
- }
10209
- const session = await core.getOrResumeSession(
10210
- "telegram",
10211
- String(threadId)
10212
- );
10213
- if (session) {
10214
- if (!session.clientOverrides.bypassPermissions) {
10215
- await ctx.reply("\u{1F510} Bypass is already disabled.", {
10216
- parse_mode: "HTML"
10217
- });
10218
- return;
10219
- }
10220
- session.clientOverrides.bypassPermissions = false;
10221
- core.sessionManager.patchRecord(session.id, { clientOverrides: session.clientOverrides }).catch(() => {
10222
- });
10223
- } else {
10224
- const record = core.sessionManager.getRecordByThread(
10225
- "telegram",
10226
- String(threadId)
10227
- );
10228
- if (!record || record.status === "cancelled" || record.status === "error") {
10229
- await ctx.reply("\u26A0\uFE0F No active session in this topic.", {
10230
- parse_mode: "HTML"
10231
- });
10232
- return;
10233
- }
10234
- if (!(record.clientOverrides?.bypassPermissions ?? record.dangerousMode)) {
10235
- await ctx.reply("\u{1F510} Bypass is already disabled.", {
10236
- parse_mode: "HTML"
10237
- });
10238
- return;
10239
- }
10240
- core.sessionManager.patchRecord(record.sessionId, { clientOverrides: { bypassPermissions: false } }).catch(() => {
10241
- });
10242
- }
10243
- await ctx.reply(
10244
- "\u{1F510} <b>Bypass Permissions disabled</b>\n\nYou will be asked to approve risky actions.",
10245
- { parse_mode: "HTML" }
10246
- );
10247
- }
10248
10154
  function buildSessionControlKeyboard(sessionId, dangerousMode, voiceMode) {
10249
10155
  return new InlineKeyboard().text(
10250
10156
  dangerousMode ? "\u{1F510} Disable Bypass Permissions" : "\u2620\uFE0F Enable Bypass Permissions",
@@ -10659,9 +10565,6 @@ async function createSessionDirect(ctx, core, chatId, agentName, workspace, onCo
10659
10565
  }
10660
10566
  );
10661
10567
  onControlMessage?.(session.id, controlMsg.message_id);
10662
- await core.sessionManager.patchRecord(session.id, {
10663
- platform: { topicId: threadId }
10664
- });
10665
10568
  return threadId ?? null;
10666
10569
  } catch (err) {
10667
10570
  log15.error({ err }, "Session creation failed");
@@ -10741,9 +10644,6 @@ async function handleNewChat(ctx, core, chatId, onControlMessage) {
10741
10644
  }
10742
10645
  );
10743
10646
  onControlMessage?.(session.id, controlMsg.message_id);
10744
- await core.sessionManager.patchRecord(session.id, {
10745
- platform: { topicId: newThreadId }
10746
- });
10747
10647
  } catch (err) {
10748
10648
  if (newThreadId) {
10749
10649
  try {
@@ -11322,8 +11222,7 @@ Each session gets its own topic \u2014 chat there to work with the agent.
11322
11222
  /menu \u2014 Show action menu
11323
11223
 
11324
11224
  \u{1F512} <b>Session Options</b>
11325
- /enable_bypass \u2014 Auto-approve permissions
11326
- /disable_bypass \u2014 Restore permission prompts
11225
+ /bypass_permissions \u2014 Toggle bypass permissions
11327
11226
  /handoff \u2014 Continue session in terminal
11328
11227
  /archive \u2014 Archive session topic
11329
11228
  /clear \u2014 Clear assistant history
@@ -12305,9 +12204,6 @@ Repo: <code>${escapeHtml4(repoPath)}</code>`,
12305
12204
  }
12306
12205
  );
12307
12206
  onControlMessage?.(session.id, controlMsg.message_id);
12308
- await core.sessionManager.patchRecord(session.id, {
12309
- platform: { topicId: threadId }
12310
- });
12311
12207
  } catch (err) {
12312
12208
  log17.error({ err }, "Resume session creation failed");
12313
12209
  if (threadId) {
@@ -13779,8 +13675,6 @@ function setupCommands(bot, core, chatId, assistant) {
13779
13675
  bot.command("install", (ctx) => handleInstall(ctx, core));
13780
13676
  bot.command("help", (ctx) => handleHelp(ctx));
13781
13677
  bot.command("menu", (ctx) => handleMenu(ctx));
13782
- bot.command("enable_bypass", (ctx) => handleEnableDangerous(ctx, core));
13783
- bot.command("disable_bypass", (ctx) => handleDisableDangerous(ctx, core));
13784
13678
  bot.command("restart", (ctx) => handleRestart(ctx, core));
13785
13679
  bot.command("update", (ctx) => handleUpdate(ctx, core));
13786
13680
  bot.command("integrate", (ctx) => handleIntegrate(ctx, core));
@@ -13888,14 +13782,6 @@ var init_commands3 = __esm({
13888
13782
  { command: "install", description: "Install a new agent" },
13889
13783
  { command: "help", description: "Help" },
13890
13784
  { command: "menu", description: "Show menu" },
13891
- {
13892
- command: "enable_bypass",
13893
- description: "Auto-approve all permission requests (session only)"
13894
- },
13895
- {
13896
- command: "disable_bypass",
13897
- description: "Restore normal permission prompts (session only)"
13898
- },
13899
13785
  { command: "integrate", description: "Manage agent integrations" },
13900
13786
  { command: "handoff", description: "Continue this session in your terminal" },
13901
13787
  { command: "clear", description: "Clear assistant history" },
@@ -13909,7 +13795,11 @@ var init_commands3 = __esm({
13909
13795
  { command: "verbosity", description: "Deprecated: use /outputmode instead" },
13910
13796
  { command: "outputmode", description: "Control output display level (low/medium/high)" },
13911
13797
  { command: "resume", description: "Resume with conversation history from Entire checkpoints" },
13912
- { command: "switch", description: "Switch agent in current session" }
13798
+ { command: "switch", description: "Switch agent in current session" },
13799
+ { command: "mode", description: "Change session mode" },
13800
+ { command: "model", description: "Change AI model" },
13801
+ { command: "thought", description: "Change thinking level" },
13802
+ { command: "bypass_permissions", description: "Toggle bypass permissions (on/off)" }
13913
13803
  ];
13914
13804
  }
13915
13805
  });
@@ -14113,8 +14003,8 @@ A notification also appears in the Notifications topic with a link to the reques
14113
14003
 
14114
14004
  ### Bypass permissions
14115
14005
  Auto-approves ALL permission requests \u2014 the agent runs any command without asking.
14116
- - Enable: \`/enable_bypass\` or tap the \u2620\uFE0F button in the session
14117
- - Disable: \`/disable_bypass\` or tap the \u{1F510} button
14006
+ - Toggle: \`/bypass_permissions on\` or tap the \u2620\uFE0F button in the session
14007
+ - Disable: \`/bypass_permissions off\` or tap the \u{1F510} button
14118
14008
  - \u26A0\uFE0F Use with caution \u2014 the agent can execute anything
14119
14009
 
14120
14010
  ### Session timeout
@@ -14190,8 +14080,7 @@ Just chat naturally: "How do I create a session?", "What's the status?", "Someth
14190
14080
  | \`/sessions\` | Anywhere | List all sessions |
14191
14081
  | \`/agents\` | Anywhere | Browse & install agents from ACP Registry |
14192
14082
  | \`/install <name>\` | Anywhere | Install an agent |
14193
- | \`/enable_bypass\` | Session topic | Auto-approve all permissions |
14194
- | \`/disable_bypass\` | Session topic | Restore permission prompts |
14083
+ | \`/bypass_permissions\` | Session topic | Toggle bypass permissions (on/off) |
14195
14084
  | \`/handoff\` | Session topic | Transfer session to terminal |
14196
14085
  | \`/clear\` | Assistant topic | Clear assistant history |
14197
14086
  | \`/menu\` | Anywhere | Show action menu |
@@ -14385,7 +14274,7 @@ Override config with env vars:
14385
14274
 
14386
14275
  ### Permission request not showing
14387
14276
  - Check Notifications topic for the alert
14388
- - Try \`/enable_bypass\` to auto-approve (if you trust the agent)
14277
+ - Try \`/bypass_permissions on\` to auto-approve (if you trust the agent)
14389
14278
 
14390
14279
  ### Session disappeared after restart
14391
14280
  - Sessions persist across restarts
@@ -14890,6 +14779,13 @@ function buildTitle(entry, kind) {
14890
14779
  }
14891
14780
  return capitalize(entry.name);
14892
14781
  }
14782
+ if (kind === "fetch" || kind === "web") {
14783
+ const url = typeof input2.url === "string" ? input2.url : null;
14784
+ if (url && url !== "undefined") return url.length > 60 ? url.slice(0, 57) + "..." : url;
14785
+ const query = typeof input2.query === "string" ? input2.query : null;
14786
+ if (query && query !== "undefined") return query.length > 60 ? query.slice(0, 57) + "..." : query;
14787
+ return capitalize(entry.name);
14788
+ }
14893
14789
  if (entry.name.toLowerCase() === "skill" && typeof input2.skill === "string" && input2.skill) {
14894
14790
  return input2.skill;
14895
14791
  }
@@ -16444,9 +16340,10 @@ var init_adapter2 = __esm({
16444
16340
  controlMsgIds = /* @__PURE__ */ new Map();
16445
16341
  /** Store control message ID in memory + persist to session record */
16446
16342
  storeControlMsgId(sessionId, msgId) {
16447
- this.storeControlMsgId(sessionId, msgId);
16343
+ this.controlMsgIds.set(sessionId, msgId);
16344
+ const record = this.core.sessionManager.getSessionRecord(sessionId);
16448
16345
  this.core.sessionManager.patchRecord(sessionId, {
16449
- platform: { controlMsgId: msgId }
16346
+ platform: { ...record?.platform ?? {}, controlMsgId: msgId }
16450
16347
  }).catch(() => {
16451
16348
  });
16452
16349
  }
@@ -18826,7 +18723,14 @@ var init_debug_tracer = __esm({
18826
18723
  this.dirCreated = true;
18827
18724
  }
18828
18725
  const filePath = path38.join(this.logDir, `${this.sessionId}_${layer}.jsonl`);
18829
- const line = JSON.stringify({ ts: Date.now(), ...data }) + "\n";
18726
+ const seen = /* @__PURE__ */ new WeakSet();
18727
+ const line = JSON.stringify({ ts: Date.now(), ...data }, (_key, value) => {
18728
+ if (typeof value === "object" && value !== null) {
18729
+ if (seen.has(value)) return "[Circular]";
18730
+ seen.add(value);
18731
+ }
18732
+ return value;
18733
+ }) + "\n";
18830
18734
  fs35.appendFileSync(filePath, line);
18831
18735
  } catch {
18832
18736
  }
@@ -19660,8 +19564,9 @@ Additionally, include a [TTS]...[/TTS] block with a spoken-friendly summary of y
19660
19564
  activate() {
19661
19565
  this.transition("active");
19662
19566
  }
19663
- /** Transition to error — from initializing or active */
19567
+ /** Transition to error — from initializing or active. Idempotent if already in error. */
19664
19568
  fail(reason) {
19569
+ if (this._status === "error") return;
19665
19570
  this.transition("error");
19666
19571
  this.emit("error", new Error(reason));
19667
19572
  }
@@ -23913,7 +23818,7 @@ function registerCategoryCommand(registry, core, category, commandName) {
23913
23818
  }
23914
23819
  function registerDangerousCommand(registry, core) {
23915
23820
  registry.register({
23916
- name: "bypass",
23821
+ name: "bypass_permissions",
23917
23822
  description: "Auto-approve all permission requests (skip confirmation prompts)",
23918
23823
  usage: "[on|off]",
23919
23824
  category: "system",
@@ -23940,17 +23845,17 @@ function registerDangerousCommand(registry, core) {
23940
23845
  return {
23941
23846
  type: "menu",
23942
23847
  title: "\u2620\uFE0F Bypass is ON \u2014 all permissions are auto-approved",
23943
- options: [{ label: "\u{1F510} Turn off bypass", command: "/bypass off" }]
23848
+ options: [{ label: "\u{1F510} Turn off bypass", command: "/bypass_permissions off" }]
23944
23849
  };
23945
23850
  }
23946
23851
  return {
23947
23852
  type: "menu",
23948
23853
  title: "\u{1F510} Bypass is OFF \u2014 you will be asked before risky actions",
23949
- options: [{ label: "\u2620\uFE0F Turn on bypass", command: "/bypass on" }]
23854
+ options: [{ label: "\u2620\uFE0F Turn on bypass", command: "/bypass_permissions on" }]
23950
23855
  };
23951
23856
  }
23952
23857
  if (raw !== "on" && raw !== "off") {
23953
- return { type: "error", message: "Use **/bypass on** or **/bypass off**." };
23858
+ return { type: "error", message: "Use **/bypass_permissions on** or **/bypass_permissions off**." };
23954
23859
  }
23955
23860
  const wantOn = raw === "on";
23956
23861
  if (wantOn === isCurrentlyBypassing) {