@openacp/cli 2026.406.5 → 2026.408.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/cli.js +124 -55
- package/dist/cli.js.map +1 -1
- package/dist/index.js +73 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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)) {
|
|
@@ -1304,15 +1306,6 @@ function stripPythonPackageVersion(pkg) {
|
|
|
1304
1306
|
async function installAgent(agent, store, progress, agentsDir) {
|
|
1305
1307
|
const agentKey = getAgentAlias(agent.id);
|
|
1306
1308
|
await progress?.onStart(agent.id, agent.name);
|
|
1307
|
-
await progress?.onStep("Checking requirements...");
|
|
1308
|
-
const depResult = checkDependencies(agent.id);
|
|
1309
|
-
if (!depResult.available) {
|
|
1310
|
-
const hints = depResult.missing.map((m) => ` ${m.label}: ${m.installHint}`).join("\n");
|
|
1311
|
-
const msg = `${agent.name} needs some tools installed first:
|
|
1312
|
-
${hints}`;
|
|
1313
|
-
await progress?.onError(msg);
|
|
1314
|
-
return { ok: false, agentKey, error: msg };
|
|
1315
|
-
}
|
|
1316
1309
|
const dist = resolveDistribution(agent);
|
|
1317
1310
|
if (!dist) {
|
|
1318
1311
|
const platformKey = getPlatformKey();
|
|
@@ -1326,6 +1319,7 @@ Install it with: pip install uv`;
|
|
|
1326
1319
|
await progress?.onError(msg, "pip install uv");
|
|
1327
1320
|
return { ok: false, agentKey, error: msg, hint: "pip install uv" };
|
|
1328
1321
|
}
|
|
1322
|
+
const depResult = checkDependencies(agent.id);
|
|
1329
1323
|
let binaryPath;
|
|
1330
1324
|
if (dist.type === "binary") {
|
|
1331
1325
|
try {
|
|
@@ -1341,8 +1335,9 @@ Install it with: pip install uv`;
|
|
|
1341
1335
|
const installed = buildInstalledAgent(agent.id, agent.name, agent.version, dist, binaryPath);
|
|
1342
1336
|
store.addAgent(agentKey, installed);
|
|
1343
1337
|
const setup = getAgentSetup(agent.id);
|
|
1338
|
+
const setupSteps = setup?.setupSteps ?? (depResult.missing?.map((m) => `${m.label}: ${m.installHint}`) ?? []);
|
|
1344
1339
|
await progress?.onSuccess(agent.name);
|
|
1345
|
-
return { ok: true, agentKey, setupSteps:
|
|
1340
|
+
return { ok: true, agentKey, setupSteps: setupSteps.length > 0 ? setupSteps : void 0 };
|
|
1346
1341
|
}
|
|
1347
1342
|
async function downloadAndExtract(agentId, archiveUrl, progress, agentsDir) {
|
|
1348
1343
|
const destDir = path12.join(agentsDir ?? DEFAULT_AGENTS_DIR, agentId);
|
|
@@ -5889,7 +5884,7 @@ async function runUpdate() {
|
|
|
5889
5884
|
});
|
|
5890
5885
|
}
|
|
5891
5886
|
async function checkAndPromptUpdate() {
|
|
5892
|
-
if (process.env.OPENACP_DEV_LOOP || process.env.OPENACP_SKIP_UPDATE_CHECK) return;
|
|
5887
|
+
if (process.env.OPENACP_DEV_LOOP || process.env.OPENACP_SKIP_UPDATE_CHECK || !process.stdin.isTTY) return;
|
|
5893
5888
|
const current = getCurrentVersion();
|
|
5894
5889
|
if (current === "0.0.0-dev") return;
|
|
5895
5890
|
const latest = await getLatestVersion();
|
|
@@ -6216,6 +6211,50 @@ async function createSessionDirect(ctx, core, chatId, agentName, workspace, onCo
|
|
|
6216
6211
|
return null;
|
|
6217
6212
|
}
|
|
6218
6213
|
}
|
|
6214
|
+
function _pruneExpiredForceReplies() {
|
|
6215
|
+
const cutoff = Date.now() - 10 * 60 * 1e3;
|
|
6216
|
+
for (const [msgId, entry] of _forceReplyMap) {
|
|
6217
|
+
if (entry.createdAt < cutoff) _forceReplyMap.delete(msgId);
|
|
6218
|
+
}
|
|
6219
|
+
}
|
|
6220
|
+
async function _sendCustomPathPrompt(ctx, chatId, agentKey) {
|
|
6221
|
+
const threadId = ctx.message?.message_thread_id ?? ctx.callbackQuery?.message?.message_thread_id;
|
|
6222
|
+
const sent = await ctx.api.sendMessage(
|
|
6223
|
+
chatId,
|
|
6224
|
+
`Please type the workspace path.
|
|
6225
|
+
|
|
6226
|
+
Examples:
|
|
6227
|
+
\u2022 <code>/absolute/path/to/project</code>
|
|
6228
|
+
\u2022 <code>~/my-project</code>
|
|
6229
|
+
\u2022 <code>project-name</code> (created under your base directory)
|
|
6230
|
+
|
|
6231
|
+
Reply to this message with your path.`,
|
|
6232
|
+
{
|
|
6233
|
+
parse_mode: "HTML",
|
|
6234
|
+
reply_markup: { force_reply: true },
|
|
6235
|
+
...threadId !== void 0 ? { message_thread_id: threadId } : {}
|
|
6236
|
+
}
|
|
6237
|
+
);
|
|
6238
|
+
_forceReplyMap.set(sent.message_id, { agentKey, chatId, createdAt: Date.now() });
|
|
6239
|
+
}
|
|
6240
|
+
async function _handleCustomPathReply(ctx, core, chatId, entry) {
|
|
6241
|
+
const input2 = (ctx.message.text ?? "").trim();
|
|
6242
|
+
let resolvedPath;
|
|
6243
|
+
try {
|
|
6244
|
+
resolvedPath = core.configManager.resolveWorkspace(input2);
|
|
6245
|
+
} catch (err) {
|
|
6246
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
6247
|
+
await ctx.reply(`\u274C ${escapeHtml(message)}
|
|
6248
|
+
|
|
6249
|
+
Please try again:`, {
|
|
6250
|
+
parse_mode: "HTML"
|
|
6251
|
+
}).catch(() => {
|
|
6252
|
+
});
|
|
6253
|
+
await _sendCustomPathPrompt(ctx, chatId, entry.agentKey);
|
|
6254
|
+
return;
|
|
6255
|
+
}
|
|
6256
|
+
await createSessionDirect(ctx, core, chatId, entry.agentKey, resolvedPath);
|
|
6257
|
+
}
|
|
6219
6258
|
function cacheWorkspace(agentKey, workspace) {
|
|
6220
6259
|
const now = Date.now();
|
|
6221
6260
|
for (const [id2, entry] of workspaceCache) {
|
|
@@ -6296,7 +6335,16 @@ Select workspace:`;
|
|
|
6296
6335
|
}
|
|
6297
6336
|
}
|
|
6298
6337
|
}
|
|
6299
|
-
function setupNewSessionCallbacks(bot, core, chatId
|
|
6338
|
+
function setupNewSessionCallbacks(bot, core, chatId) {
|
|
6339
|
+
bot.on("message:text", async (ctx, next) => {
|
|
6340
|
+
_pruneExpiredForceReplies();
|
|
6341
|
+
const replyToId = ctx.message.reply_to_message?.message_id;
|
|
6342
|
+
if (replyToId === void 0) return next();
|
|
6343
|
+
const entry = _forceReplyMap.get(replyToId);
|
|
6344
|
+
if (!entry || entry.chatId !== ctx.message.chat.id) return next();
|
|
6345
|
+
_forceReplyMap.delete(replyToId);
|
|
6346
|
+
await _handleCustomPathReply(ctx, core, chatId, entry);
|
|
6347
|
+
});
|
|
6300
6348
|
bot.callbackQuery("ns:start", async (ctx) => {
|
|
6301
6349
|
try {
|
|
6302
6350
|
await ctx.answerCallbackQuery();
|
|
@@ -6373,33 +6421,20 @@ Try again with /new or /menu`,
|
|
|
6373
6421
|
await ctx.answerCallbackQuery();
|
|
6374
6422
|
} catch {
|
|
6375
6423
|
}
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
await ctx.editMessageText(
|
|
6380
|
-
`<b>\u{1F195} New Session</b>
|
|
6424
|
+
try {
|
|
6425
|
+
await ctx.editMessageText(
|
|
6426
|
+
`<b>\u{1F195} New Session</b>
|
|
6381
6427
|
Agent: <code>${escapeHtml(agentKey)}</code>
|
|
6382
6428
|
|
|
6383
|
-
\
|
|
6384
|
-
|
|
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.`
|
|
6429
|
+
\u2328\uFE0F Waiting for workspace path...`,
|
|
6430
|
+
{ parse_mode: "HTML" }
|
|
6390
6431
|
);
|
|
6391
|
-
}
|
|
6392
|
-
try {
|
|
6393
|
-
await ctx.editMessageText(
|
|
6394
|
-
`Usage: <code>/new ${escapeHtml(agentKey)} <workspace-path></code>`,
|
|
6395
|
-
{ parse_mode: "HTML" }
|
|
6396
|
-
);
|
|
6397
|
-
} catch {
|
|
6398
|
-
}
|
|
6432
|
+
} catch {
|
|
6399
6433
|
}
|
|
6434
|
+
await _sendCustomPathPrompt(ctx, chatId, agentKey);
|
|
6400
6435
|
});
|
|
6401
6436
|
}
|
|
6402
|
-
var log23, WS_CACHE_MAX, workspaceCache, nextWsId;
|
|
6437
|
+
var log23, WS_CACHE_MAX, workspaceCache, nextWsId, _forceReplyMap;
|
|
6403
6438
|
var init_new_session = __esm({
|
|
6404
6439
|
"src/plugins/telegram/commands/new-session.ts"() {
|
|
6405
6440
|
"use strict";
|
|
@@ -6411,6 +6446,7 @@ var init_new_session = __esm({
|
|
|
6411
6446
|
WS_CACHE_MAX = 50;
|
|
6412
6447
|
workspaceCache = /* @__PURE__ */ new Map();
|
|
6413
6448
|
nextWsId = 0;
|
|
6449
|
+
_forceReplyMap = /* @__PURE__ */ new Map();
|
|
6414
6450
|
}
|
|
6415
6451
|
});
|
|
6416
6452
|
|
|
@@ -8173,7 +8209,7 @@ function setupAllCallbacks(bot, core, chatId, systemTopicIds, getAssistantSessio
|
|
|
8173
8209
|
core.configManager.get().workspace.baseDir
|
|
8174
8210
|
);
|
|
8175
8211
|
});
|
|
8176
|
-
setupNewSessionCallbacks(bot, core, chatId
|
|
8212
|
+
setupNewSessionCallbacks(bot, core, chatId);
|
|
8177
8213
|
bot.callbackQuery(/^ar:/, (ctx) => handleArchiveConfirm(ctx, core, chatId));
|
|
8178
8214
|
bot.callbackQuery(/^m:/, async (ctx) => {
|
|
8179
8215
|
const itemId = ctx.callbackQuery.data.replace("m:", "");
|
|
@@ -13422,7 +13458,7 @@ var SessionBridge = class {
|
|
|
13422
13458
|
this.deps.sessionManager.patchRecord(this.session.id, { currentPromptCount: count });
|
|
13423
13459
|
});
|
|
13424
13460
|
this.listen(this.session, SessionEv.TURN_STARTED, (ctx) => {
|
|
13425
|
-
if (ctx.sourceAdapterId !== "sse"
|
|
13461
|
+
if (ctx.sourceAdapterId !== "sse") {
|
|
13426
13462
|
this.deps.eventBus?.emit(BusEvent.MESSAGE_PROCESSING, {
|
|
13427
13463
|
sessionId: this.session.id,
|
|
13428
13464
|
turnId: ctx.turnId,
|
|
@@ -14639,7 +14675,7 @@ var AgentCatalog = class {
|
|
|
14639
14675
|
description: agent.description,
|
|
14640
14676
|
distribution: dist?.type ?? "binary",
|
|
14641
14677
|
installed: false,
|
|
14642
|
-
available: dist !== null
|
|
14678
|
+
available: dist !== null,
|
|
14643
14679
|
missingDeps: availability.missing?.map((m) => m.label)
|
|
14644
14680
|
});
|
|
14645
14681
|
}
|