@openacp/cli 2026.406.5 → 2026.407.1

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
@@ -428,7 +428,9 @@ var init_config_registry = __esm({
428
428
  displayName: "Default Agent",
429
429
  group: "agent",
430
430
  type: "select",
431
- options: () => {
431
+ options: (config) => {
432
+ const configAgents = Object.keys(config.agents ?? {});
433
+ if (configAgents.length > 0) return configAgents;
432
434
  try {
433
435
  const agentsPath = path3.join(getGlobalRoot(), "agents.json");
434
436
  if (fs3.existsSync(agentsPath)) {
@@ -5889,7 +5891,7 @@ async function runUpdate() {
5889
5891
  });
5890
5892
  }
5891
5893
  async function checkAndPromptUpdate() {
5892
- if (process.env.OPENACP_DEV_LOOP || process.env.OPENACP_SKIP_UPDATE_CHECK) return;
5894
+ if (process.env.OPENACP_DEV_LOOP || process.env.OPENACP_SKIP_UPDATE_CHECK || !process.stdin.isTTY) return;
5893
5895
  const current = getCurrentVersion();
5894
5896
  if (current === "0.0.0-dev") return;
5895
5897
  const latest = await getLatestVersion();
@@ -6216,6 +6218,50 @@ async function createSessionDirect(ctx, core, chatId, agentName, workspace, onCo
6216
6218
  return null;
6217
6219
  }
6218
6220
  }
6221
+ function _pruneExpiredForceReplies() {
6222
+ const cutoff = Date.now() - 10 * 60 * 1e3;
6223
+ for (const [msgId, entry] of _forceReplyMap) {
6224
+ if (entry.createdAt < cutoff) _forceReplyMap.delete(msgId);
6225
+ }
6226
+ }
6227
+ async function _sendCustomPathPrompt(ctx, chatId, agentKey) {
6228
+ const threadId = ctx.message?.message_thread_id ?? ctx.callbackQuery?.message?.message_thread_id;
6229
+ const sent = await ctx.api.sendMessage(
6230
+ chatId,
6231
+ `Please type the workspace path.
6232
+
6233
+ Examples:
6234
+ \u2022 <code>/absolute/path/to/project</code>
6235
+ \u2022 <code>~/my-project</code>
6236
+ \u2022 <code>project-name</code> (created under your base directory)
6237
+
6238
+ Reply to this message with your path.`,
6239
+ {
6240
+ parse_mode: "HTML",
6241
+ reply_markup: { force_reply: true },
6242
+ ...threadId !== void 0 ? { message_thread_id: threadId } : {}
6243
+ }
6244
+ );
6245
+ _forceReplyMap.set(sent.message_id, { agentKey, chatId, createdAt: Date.now() });
6246
+ }
6247
+ async function _handleCustomPathReply(ctx, core, chatId, entry) {
6248
+ const input2 = (ctx.message.text ?? "").trim();
6249
+ let resolvedPath;
6250
+ try {
6251
+ resolvedPath = core.configManager.resolveWorkspace(input2);
6252
+ } catch (err) {
6253
+ const message = err instanceof Error ? err.message : String(err);
6254
+ await ctx.reply(`\u274C ${escapeHtml(message)}
6255
+
6256
+ Please try again:`, {
6257
+ parse_mode: "HTML"
6258
+ }).catch(() => {
6259
+ });
6260
+ await _sendCustomPathPrompt(ctx, chatId, entry.agentKey);
6261
+ return;
6262
+ }
6263
+ await createSessionDirect(ctx, core, chatId, entry.agentKey, resolvedPath);
6264
+ }
6219
6265
  function cacheWorkspace(agentKey, workspace) {
6220
6266
  const now = Date.now();
6221
6267
  for (const [id2, entry] of workspaceCache) {
@@ -6296,7 +6342,16 @@ Select workspace:`;
6296
6342
  }
6297
6343
  }
6298
6344
  }
6299
- function setupNewSessionCallbacks(bot, core, chatId, getAssistantSession) {
6345
+ function setupNewSessionCallbacks(bot, core, chatId) {
6346
+ bot.on("message:text", async (ctx, next) => {
6347
+ _pruneExpiredForceReplies();
6348
+ const replyToId = ctx.message.reply_to_message?.message_id;
6349
+ if (replyToId === void 0) return next();
6350
+ const entry = _forceReplyMap.get(replyToId);
6351
+ if (!entry || entry.chatId !== ctx.message.chat.id) return next();
6352
+ _forceReplyMap.delete(replyToId);
6353
+ await _handleCustomPathReply(ctx, core, chatId, entry);
6354
+ });
6300
6355
  bot.callbackQuery("ns:start", async (ctx) => {
6301
6356
  try {
6302
6357
  await ctx.answerCallbackQuery();
@@ -6373,33 +6428,20 @@ Try again with /new or /menu`,
6373
6428
  await ctx.answerCallbackQuery();
6374
6429
  } catch {
6375
6430
  }
6376
- const assistant = getAssistantSession?.();
6377
- if (assistant) {
6378
- try {
6379
- await ctx.editMessageText(
6380
- `<b>\u{1F195} New Session</b>
6431
+ try {
6432
+ await ctx.editMessageText(
6433
+ `<b>\u{1F195} New Session</b>
6381
6434
  Agent: <code>${escapeHtml(agentKey)}</code>
6382
6435
 
6383
- \u{1F4AC} Type your workspace path in the chat below.`,
6384
- { parse_mode: "HTML" }
6385
- );
6386
- } catch {
6387
- }
6388
- await assistant.enqueuePrompt(
6389
- `User wants to create a new session with agent "${agentKey}". Ask them for the workspace (project directory) path, then create the session.`
6436
+ \u2328\uFE0F Waiting for workspace path...`,
6437
+ { parse_mode: "HTML" }
6390
6438
  );
6391
- } else {
6392
- try {
6393
- await ctx.editMessageText(
6394
- `Usage: <code>/new ${escapeHtml(agentKey)} &lt;workspace-path&gt;</code>`,
6395
- { parse_mode: "HTML" }
6396
- );
6397
- } catch {
6398
- }
6439
+ } catch {
6399
6440
  }
6441
+ await _sendCustomPathPrompt(ctx, chatId, agentKey);
6400
6442
  });
6401
6443
  }
6402
- var log23, WS_CACHE_MAX, workspaceCache, nextWsId;
6444
+ var log23, WS_CACHE_MAX, workspaceCache, nextWsId, _forceReplyMap;
6403
6445
  var init_new_session = __esm({
6404
6446
  "src/plugins/telegram/commands/new-session.ts"() {
6405
6447
  "use strict";
@@ -6411,6 +6453,7 @@ var init_new_session = __esm({
6411
6453
  WS_CACHE_MAX = 50;
6412
6454
  workspaceCache = /* @__PURE__ */ new Map();
6413
6455
  nextWsId = 0;
6456
+ _forceReplyMap = /* @__PURE__ */ new Map();
6414
6457
  }
6415
6458
  });
6416
6459
 
@@ -8173,7 +8216,7 @@ function setupAllCallbacks(bot, core, chatId, systemTopicIds, getAssistantSessio
8173
8216
  core.configManager.get().workspace.baseDir
8174
8217
  );
8175
8218
  });
8176
- setupNewSessionCallbacks(bot, core, chatId, getAssistantSession);
8219
+ setupNewSessionCallbacks(bot, core, chatId);
8177
8220
  bot.callbackQuery(/^ar:/, (ctx) => handleArchiveConfirm(ctx, core, chatId));
8178
8221
  bot.callbackQuery(/^m:/, async (ctx) => {
8179
8222
  const itemId = ctx.callbackQuery.data.replace("m:", "");
@@ -13422,7 +13465,7 @@ var SessionBridge = class {
13422
13465
  this.deps.sessionManager.patchRecord(this.session.id, { currentPromptCount: count });
13423
13466
  });
13424
13467
  this.listen(this.session, SessionEv.TURN_STARTED, (ctx) => {
13425
- if (ctx.sourceAdapterId !== "sse" && ctx.sourceAdapterId !== "api") {
13468
+ if (ctx.sourceAdapterId !== "sse") {
13426
13469
  this.deps.eventBus?.emit(BusEvent.MESSAGE_PROCESSING, {
13427
13470
  sessionId: this.session.id,
13428
13471
  turnId: ctx.turnId,