@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/index.js CHANGED
@@ -2412,8 +2412,7 @@ Each session gets its own topic \u2014 chat there to work with the agent.
2412
2412
  /menu \u2014 Show action menu
2413
2413
 
2414
2414
  \u{1F512} <b>Session Options</b>
2415
- /enable_bypass \u2014 Auto-approve permissions
2416
- /disable_bypass \u2014 Restore permission prompts
2415
+ /bypass_permissions \u2014 Toggle bypass permissions
2417
2416
  /handoff \u2014 Continue session in terminal
2418
2417
  /archive \u2014 Archive session topic
2419
2418
  /clear \u2014 Clear assistant history
@@ -3178,7 +3177,14 @@ var DebugTracer = class {
3178
3177
  this.dirCreated = true;
3179
3178
  }
3180
3179
  const filePath = path6.join(this.logDir, `${this.sessionId}_${layer}.jsonl`);
3181
- const line = JSON.stringify({ ts: Date.now(), ...data }) + "\n";
3180
+ const seen = /* @__PURE__ */ new WeakSet();
3181
+ const line = JSON.stringify({ ts: Date.now(), ...data }, (_key, value) => {
3182
+ if (typeof value === "object" && value !== null) {
3183
+ if (seen.has(value)) return "[Circular]";
3184
+ seen.add(value);
3185
+ }
3186
+ return value;
3187
+ }) + "\n";
3182
3188
  fs7.appendFileSync(filePath, line);
3183
3189
  } catch {
3184
3190
  }
@@ -3971,8 +3977,9 @@ var Session = class extends TypedEmitter {
3971
3977
  activate() {
3972
3978
  this.transition("active");
3973
3979
  }
3974
- /** Transition to error — from initializing or active */
3980
+ /** Transition to error — from initializing or active. Idempotent if already in error. */
3975
3981
  fail(reason) {
3982
+ if (this._status === "error") return;
3976
3983
  this.transition("error");
3977
3984
  this.emit("error", new Error(reason));
3978
3985
  }
@@ -4831,7 +4838,7 @@ var SessionManager = class {
4831
4838
  init_log();
4832
4839
 
4833
4840
  // src/core/utils/bypass-detection.ts
4834
- var BYPASS_KEYWORDS = ["bypass", "dangerous", "skip", "dontask", "dont_ask", "auto_accept"];
4841
+ var BYPASS_KEYWORDS = ["bypass", "dangerous", "auto_accept"];
4835
4842
  function isPermissionBypass(value) {
4836
4843
  const lower = value.toLowerCase();
4837
4844
  return BYPASS_KEYWORDS.some((kw) => lower.includes(kw));
@@ -10565,11 +10572,13 @@ function formatToolSummary(name, rawInput, displaySummary) {
10565
10572
  return desc ? `\u{1F9E0} Agent: ${desc}` : `\u{1F527} ${name}`;
10566
10573
  }
10567
10574
  if (lowerName === "webfetch" || lowerName === "web_fetch") {
10568
- const url = String(args.url ?? "").slice(0, 60);
10575
+ const raw = args.url ?? "";
10576
+ const url = (raw !== "undefined" ? String(raw) : "").slice(0, 60);
10569
10577
  return url ? `\u{1F310} Fetch ${url}` : `\u{1F527} ${name}`;
10570
10578
  }
10571
10579
  if (lowerName === "websearch" || lowerName === "web_search") {
10572
- const query = String(args.query ?? "").slice(0, 60);
10580
+ const raw = args.query ?? "";
10581
+ const query = (raw !== "undefined" ? String(raw) : "").slice(0, 60);
10573
10582
  return query ? `\u{1F310} Search "${query}"` : `\u{1F527} ${name}`;
10574
10583
  }
10575
10584
  return `\u{1F527} ${name}`;
@@ -10598,10 +10607,12 @@ function formatToolTitle(name, rawInput, displayTitle) {
10598
10607
  return String(args.description ?? name).slice(0, 60);
10599
10608
  }
10600
10609
  if (["webfetch", "web_fetch"].includes(lowerName)) {
10601
- return String(args.url ?? name).slice(0, 60);
10610
+ const url = typeof args.url === "string" && args.url !== "undefined" ? args.url : null;
10611
+ return (url ?? name).slice(0, 60);
10602
10612
  }
10603
10613
  if (["websearch", "web_search"].includes(lowerName)) {
10604
- return String(args.query ?? name).slice(0, 60);
10614
+ const query = typeof args.query === "string" && args.query !== "undefined" ? args.query : null;
10615
+ return (query ?? name).slice(0, 60);
10605
10616
  }
10606
10617
  return name;
10607
10618
  }
@@ -11530,6 +11541,13 @@ function buildTitle(entry, kind) {
11530
11541
  }
11531
11542
  return capitalize(entry.name);
11532
11543
  }
11544
+ if (kind === "fetch" || kind === "web") {
11545
+ const url = typeof input2.url === "string" ? input2.url : null;
11546
+ if (url && url !== "undefined") return url.length > 60 ? url.slice(0, 57) + "..." : url;
11547
+ const query = typeof input2.query === "string" ? input2.query : null;
11548
+ if (query && query !== "undefined") return query.length > 60 ? query.slice(0, 57) + "..." : query;
11549
+ return capitalize(entry.name);
11550
+ }
11533
11551
  if (entry.name.toLowerCase() === "skill" && typeof input2.skill === "string" && input2.skill) {
11534
11552
  return input2.skill;
11535
11553
  }
@@ -11743,8 +11761,8 @@ A notification also appears in the Notifications topic with a link to the reques
11743
11761
 
11744
11762
  ### Bypass permissions
11745
11763
  Auto-approves ALL permission requests \u2014 the agent runs any command without asking.
11746
- - Enable: \`/enable_bypass\` or tap the \u2620\uFE0F button in the session
11747
- - Disable: \`/disable_bypass\` or tap the \u{1F510} button
11764
+ - Toggle: \`/bypass_permissions on\` or tap the \u2620\uFE0F button in the session
11765
+ - Disable: \`/bypass_permissions off\` or tap the \u{1F510} button
11748
11766
  - \u26A0\uFE0F Use with caution \u2014 the agent can execute anything
11749
11767
 
11750
11768
  ### Session timeout
@@ -11820,8 +11838,7 @@ Just chat naturally: "How do I create a session?", "What's the status?", "Someth
11820
11838
  | \`/sessions\` | Anywhere | List all sessions |
11821
11839
  | \`/agents\` | Anywhere | Browse & install agents from ACP Registry |
11822
11840
  | \`/install <name>\` | Anywhere | Install an agent |
11823
- | \`/enable_bypass\` | Session topic | Auto-approve all permissions |
11824
- | \`/disable_bypass\` | Session topic | Restore permission prompts |
11841
+ | \`/bypass_permissions\` | Session topic | Toggle bypass permissions (on/off) |
11825
11842
  | \`/handoff\` | Session topic | Transfer session to terminal |
11826
11843
  | \`/clear\` | Assistant topic | Clear assistant history |
11827
11844
  | \`/menu\` | Anywhere | Show action menu |
@@ -12015,7 +12032,7 @@ Override config with env vars:
12015
12032
 
12016
12033
  ### Permission request not showing
12017
12034
  - Check Notifications topic for the alert
12018
- - Try \`/enable_bypass\` to auto-approve (if you trust the agent)
12035
+ - Try \`/bypass_permissions on\` to auto-approve (if you trust the agent)
12019
12036
 
12020
12037
  ### Session disappeared after restart
12021
12038
  - Sessions persist across restarts
@@ -12335,7 +12352,7 @@ function setupDangerousModeCallbacks(bot, core) {
12335
12352
  }
12336
12353
  const registry = core.lifecycleManager?.serviceRegistry?.get("command-registry");
12337
12354
  if (registry) {
12338
- await registry.execute(wantOn ? "/bypass on" : "/bypass off", {
12355
+ await registry.execute(wantOn ? "/bypass_permissions on" : "/bypass_permissions off", {
12339
12356
  raw: wantOn ? "on" : "off",
12340
12357
  sessionId,
12341
12358
  channelId: "telegram",
@@ -12389,104 +12406,6 @@ function setupDangerousModeCallbacks(bot, core) {
12389
12406
  }
12390
12407
  });
12391
12408
  }
12392
- async function handleEnableDangerous(ctx, core) {
12393
- const threadId = ctx.message?.message_thread_id;
12394
- if (!threadId) {
12395
- await ctx.reply("\u26A0\uFE0F This command only works inside a session topic.", {
12396
- parse_mode: "HTML"
12397
- });
12398
- return;
12399
- }
12400
- const session = await core.getOrResumeSession(
12401
- "telegram",
12402
- String(threadId)
12403
- );
12404
- if (session) {
12405
- if (session.clientOverrides.bypassPermissions) {
12406
- await ctx.reply("\u2620\uFE0F Bypass is already enabled.", {
12407
- parse_mode: "HTML"
12408
- });
12409
- return;
12410
- }
12411
- session.clientOverrides.bypassPermissions = true;
12412
- core.sessionManager.patchRecord(session.id, { clientOverrides: session.clientOverrides }).catch(() => {
12413
- });
12414
- } else {
12415
- const record = core.sessionManager.getRecordByThread(
12416
- "telegram",
12417
- String(threadId)
12418
- );
12419
- if (!record || record.status === "cancelled" || record.status === "error") {
12420
- await ctx.reply("\u26A0\uFE0F No active session in this topic.", {
12421
- parse_mode: "HTML"
12422
- });
12423
- return;
12424
- }
12425
- if (record.clientOverrides?.bypassPermissions ?? record.dangerousMode) {
12426
- await ctx.reply("\u2620\uFE0F Bypass is already enabled.", {
12427
- parse_mode: "HTML"
12428
- });
12429
- return;
12430
- }
12431
- core.sessionManager.patchRecord(record.sessionId, { clientOverrides: { bypassPermissions: true } }).catch(() => {
12432
- });
12433
- }
12434
- await ctx.reply(
12435
- `\u2620\uFE0F <b>Bypass Permissions enabled</b>
12436
-
12437
- All permission requests will be auto-approved \u2014 the agent can run any action without asking.
12438
-
12439
- Use /disable_bypass to turn this off.`,
12440
- { parse_mode: "HTML" }
12441
- );
12442
- }
12443
- async function handleDisableDangerous(ctx, core) {
12444
- const threadId = ctx.message?.message_thread_id;
12445
- if (!threadId) {
12446
- await ctx.reply("\u26A0\uFE0F This command only works inside a session topic.", {
12447
- parse_mode: "HTML"
12448
- });
12449
- return;
12450
- }
12451
- const session = await core.getOrResumeSession(
12452
- "telegram",
12453
- String(threadId)
12454
- );
12455
- if (session) {
12456
- if (!session.clientOverrides.bypassPermissions) {
12457
- await ctx.reply("\u{1F510} Bypass is already disabled.", {
12458
- parse_mode: "HTML"
12459
- });
12460
- return;
12461
- }
12462
- session.clientOverrides.bypassPermissions = false;
12463
- core.sessionManager.patchRecord(session.id, { clientOverrides: session.clientOverrides }).catch(() => {
12464
- });
12465
- } else {
12466
- const record = core.sessionManager.getRecordByThread(
12467
- "telegram",
12468
- String(threadId)
12469
- );
12470
- if (!record || record.status === "cancelled" || record.status === "error") {
12471
- await ctx.reply("\u26A0\uFE0F No active session in this topic.", {
12472
- parse_mode: "HTML"
12473
- });
12474
- return;
12475
- }
12476
- if (!(record.clientOverrides?.bypassPermissions ?? record.dangerousMode)) {
12477
- await ctx.reply("\u{1F510} Bypass is already disabled.", {
12478
- parse_mode: "HTML"
12479
- });
12480
- return;
12481
- }
12482
- core.sessionManager.patchRecord(record.sessionId, { clientOverrides: { bypassPermissions: false } }).catch(() => {
12483
- });
12484
- }
12485
- await ctx.reply(
12486
- "\u{1F510} <b>Bypass Permissions disabled</b>\n\nYou will be asked to approve risky actions.",
12487
- { parse_mode: "HTML" }
12488
- );
12489
- }
12490
12409
  function buildSessionControlKeyboard(sessionId, dangerousMode, voiceMode) {
12491
12410
  return new InlineKeyboard().text(
12492
12411
  dangerousMode ? "\u{1F510} Disable Bypass Permissions" : "\u2620\uFE0F Enable Bypass Permissions",
@@ -12893,9 +12812,6 @@ async function createSessionDirect(ctx, core, chatId, agentName, workspace, onCo
12893
12812
  }
12894
12813
  );
12895
12814
  onControlMessage?.(session.id, controlMsg.message_id);
12896
- await core.sessionManager.patchRecord(session.id, {
12897
- platform: { topicId: threadId }
12898
- });
12899
12815
  return threadId ?? null;
12900
12816
  } catch (err) {
12901
12817
  log19.error({ err }, "Session creation failed");
@@ -12975,9 +12891,6 @@ async function handleNewChat(ctx, core, chatId, onControlMessage) {
12975
12891
  }
12976
12892
  );
12977
12893
  onControlMessage?.(session.id, controlMsg.message_id);
12978
- await core.sessionManager.patchRecord(session.id, {
12979
- platform: { topicId: newThreadId }
12980
- });
12981
12894
  } catch (err) {
12982
12895
  if (newThreadId) {
12983
12896
  try {
@@ -14042,9 +13955,6 @@ Repo: <code>${escapeHtml(repoPath)}</code>`,
14042
13955
  }
14043
13956
  );
14044
13957
  onControlMessage?.(session.id, controlMsg.message_id);
14045
- await core.sessionManager.patchRecord(session.id, {
14046
- platform: { topicId: threadId }
14047
- });
14048
13958
  } catch (err) {
14049
13959
  log21.error({ err }, "Resume session creation failed");
14050
13960
  if (threadId) {
@@ -14768,8 +14678,6 @@ function setupCommands(bot, core, chatId, assistant) {
14768
14678
  bot.command("install", (ctx) => handleInstall(ctx, core));
14769
14679
  bot.command("help", (ctx) => handleHelp(ctx));
14770
14680
  bot.command("menu", (ctx) => handleMenu(ctx));
14771
- bot.command("enable_bypass", (ctx) => handleEnableDangerous(ctx, core));
14772
- bot.command("disable_bypass", (ctx) => handleDisableDangerous(ctx, core));
14773
14681
  bot.command("restart", (ctx) => handleRestart(ctx, core));
14774
14682
  bot.command("update", (ctx) => handleUpdate(ctx, core));
14775
14683
  bot.command("integrate", (ctx) => handleIntegrate(ctx, core));
@@ -14852,14 +14760,6 @@ var STATIC_COMMANDS = [
14852
14760
  { command: "install", description: "Install a new agent" },
14853
14761
  { command: "help", description: "Help" },
14854
14762
  { command: "menu", description: "Show menu" },
14855
- {
14856
- command: "enable_bypass",
14857
- description: "Auto-approve all permission requests (session only)"
14858
- },
14859
- {
14860
- command: "disable_bypass",
14861
- description: "Restore normal permission prompts (session only)"
14862
- },
14863
14763
  { command: "integrate", description: "Manage agent integrations" },
14864
14764
  { command: "handoff", description: "Continue this session in your terminal" },
14865
14765
  { command: "clear", description: "Clear assistant history" },
@@ -14873,7 +14773,11 @@ var STATIC_COMMANDS = [
14873
14773
  { command: "verbosity", description: "Deprecated: use /outputmode instead" },
14874
14774
  { command: "outputmode", description: "Control output display level (low/medium/high)" },
14875
14775
  { command: "resume", description: "Resume with conversation history from Entire checkpoints" },
14876
- { command: "switch", description: "Switch agent in current session" }
14776
+ { command: "switch", description: "Switch agent in current session" },
14777
+ { command: "mode", description: "Change session mode" },
14778
+ { command: "model", description: "Change AI model" },
14779
+ { command: "thought", description: "Change thinking level" },
14780
+ { command: "bypass_permissions", description: "Toggle bypass permissions (on/off)" }
14877
14781
  ];
14878
14782
 
14879
14783
  // src/plugins/telegram/permissions.ts
@@ -16169,9 +16073,10 @@ var TelegramAdapter = class extends MessagingAdapter {
16169
16073
  controlMsgIds = /* @__PURE__ */ new Map();
16170
16074
  /** Store control message ID in memory + persist to session record */
16171
16075
  storeControlMsgId(sessionId, msgId) {
16172
- this.storeControlMsgId(sessionId, msgId);
16076
+ this.controlMsgIds.set(sessionId, msgId);
16077
+ const record = this.core.sessionManager.getSessionRecord(sessionId);
16173
16078
  this.core.sessionManager.patchRecord(sessionId, {
16174
- platform: { controlMsgId: msgId }
16079
+ platform: { ...record?.platform ?? {}, controlMsgId: msgId }
16175
16080
  }).catch(() => {
16176
16081
  });
16177
16082
  }