abtars 0.2.1 → 0.2.3-alpha.0
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/bundle/{_registry.generated-FNJOX7VV.js → _registry.generated-KM6LXTNJ.js} +3 -3
- package/bundle/abtars-cli.js +69 -14
- package/bundle/abtars-cli.js.map +3 -3
- package/bundle/abtars.js +122 -65
- package/bundle/abtars.js.map +3 -3
- package/bundle/{agent-registry-S2MNHQYQ.js → agent-registry-ABPFQXNL.js} +3 -3
- package/bundle/{chunk-QIAFGDRL.js → chunk-2SFN2VYD.js} +4 -4
- package/bundle/{chunk-3X6VGRL6.js → chunk-2W6JIHZ5.js} +4 -1
- package/bundle/chunk-2W6JIHZ5.js.map +7 -0
- package/bundle/{chunk-HCYENZAB.js → chunk-6TSCOXF6.js} +58 -27
- package/bundle/chunk-6TSCOXF6.js.map +7 -0
- package/bundle/{chunk-2SWKJX64.js → chunk-7B3GK5JQ.js} +3 -3
- package/bundle/{chunk-KL5QRHHK.js → chunk-ENXQMPV3.js} +1 -2
- package/bundle/chunk-ENXQMPV3.js.map +7 -0
- package/bundle/{chunk-WLAVZSVZ.js → chunk-GXKJKYU4.js} +70 -2
- package/bundle/chunk-GXKJKYU4.js.map +7 -0
- package/bundle/{chunk-Z4SWEFIY.js → chunk-HFPXN6NM.js} +4 -4
- package/bundle/chunk-HFPXN6NM.js.map +7 -0
- package/bundle/{chunk-MHK4UPM6.js → chunk-PKHYCNTT.js} +1 -1
- package/bundle/{chunk-OGZXYN6E.js → chunk-SEXVA3GK.js} +224 -46
- package/bundle/chunk-SEXVA3GK.js.map +7 -0
- package/bundle/chunk-W6ELWLAR.js +143 -0
- package/bundle/chunk-W6ELWLAR.js.map +7 -0
- package/bundle/{commands-AXW7L2MZ.js → commands-L6VIMPCR.js} +5 -5
- package/bundle/{direct-api-transport-LSAUIP5S.js → direct-api-transport-BK72AP3I.js} +18 -2
- package/bundle/direct-api-transport-BK72AP3I.js.map +7 -0
- package/bundle/{discord-adapter-LNWTIOUK.js → discord-adapter-DWIQRNDI.js} +6 -6
- package/bundle/{doctor-PIPSGI3H.js → doctor-WHTVSUOF.js} +36 -26
- package/bundle/doctor-WHTVSUOF.js.map +7 -0
- package/bundle/{install-FZT43PTH.js → install-Q4XNCPG7.js} +2 -2
- package/bundle/kanban-board-I52RHNHQ.js +31 -0
- package/bundle/{message-pipeline-QX272U5X.js → message-pipeline-GCSZCQWO.js} +5 -5
- package/bundle/meta.json +971 -768
- package/bundle/{phase-transport-BSGROTHY.js → phase-transport-F7GQRRYE.js} +4 -4
- package/bundle/{sleep-K7EXAFGW.js → sleep-MYOZ73IU.js} +3 -3
- package/bundle/{subagent-runtime-FQAT3564.js → subagent-runtime-QA4LVU4C.js} +2 -2
- package/bundle/{system-status-7K2QTH3J.js → system-status-KMKPAC5Z.js} +4 -2
- package/bundle/system-status-KMKPAC5Z.js.map +7 -0
- package/bundle/{telegram-adapter-LXLSG4SK.js → telegram-adapter-TRMCC634.js} +10 -7
- package/bundle/telegram-adapter-TRMCC634.js.map +7 -0
- package/bundle/{tool-registry-5PXNSYOI.js → tool-registry-CG7GIS64.js} +3 -2
- package/bundle/tool-registry-CG7GIS64.js.map +7 -0
- package/config/transport.default.json +2 -1
- package/install-manifest.json +1 -0
- package/package.json +2 -1
- package/scripts/abtars-daemon.service +0 -1
- package/scripts/abtars@.service +0 -1
- package/scripts/build-and-deploy.sh +35 -7
- package/bundle/chunk-3X6VGRL6.js.map +0 -7
- package/bundle/chunk-HCYENZAB.js.map +0 -7
- package/bundle/chunk-KL5QRHHK.js.map +0 -7
- package/bundle/chunk-OGZXYN6E.js.map +0 -7
- package/bundle/chunk-WLAVZSVZ.js.map +0 -7
- package/bundle/chunk-Z4SWEFIY.js.map +0 -7
- package/bundle/direct-api-transport-LSAUIP5S.js.map +0 -7
- package/bundle/doctor-PIPSGI3H.js.map +0 -7
- package/bundle/system-status-7K2QTH3J.js.map +0 -7
- package/bundle/telegram-adapter-LXLSG4SK.js.map +0 -7
- /package/bundle/{_registry.generated-FNJOX7VV.js.map → _registry.generated-KM6LXTNJ.js.map} +0 -0
- /package/bundle/{agent-registry-S2MNHQYQ.js.map → agent-registry-ABPFQXNL.js.map} +0 -0
- /package/bundle/{chunk-QIAFGDRL.js.map → chunk-2SFN2VYD.js.map} +0 -0
- /package/bundle/{chunk-2SWKJX64.js.map → chunk-7B3GK5JQ.js.map} +0 -0
- /package/bundle/{chunk-MHK4UPM6.js.map → chunk-PKHYCNTT.js.map} +0 -0
- /package/bundle/{commands-AXW7L2MZ.js.map → commands-L6VIMPCR.js.map} +0 -0
- /package/bundle/{discord-adapter-LNWTIOUK.js.map → discord-adapter-DWIQRNDI.js.map} +0 -0
- /package/bundle/{install-FZT43PTH.js.map → install-Q4XNCPG7.js.map} +0 -0
- /package/bundle/{message-pipeline-QX272U5X.js.map → kanban-board-I52RHNHQ.js.map} +0 -0
- /package/bundle/{phase-transport-BSGROTHY.js.map → message-pipeline-GCSZCQWO.js.map} +0 -0
- /package/bundle/{sleep-K7EXAFGW.js.map → phase-transport-F7GQRRYE.js.map} +0 -0
- /package/bundle/{subagent-runtime-FQAT3564.js.map → sleep-MYOZ73IU.js.map} +0 -0
- /package/bundle/{tool-registry-5PXNSYOI.js.map → subagent-runtime-QA4LVU4C.js.map} +0 -0
package/bundle/abtars.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
loadNLMConfig,
|
|
15
15
|
setIdleCompactReset,
|
|
16
16
|
startSession
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SEXVA3GK.js";
|
|
18
18
|
import {
|
|
19
19
|
require_extension,
|
|
20
20
|
require_permessage_deflate,
|
|
@@ -25,11 +25,12 @@ import {
|
|
|
25
25
|
require_websocket,
|
|
26
26
|
require_websocket_server
|
|
27
27
|
} from "./chunk-NIRYBWUW.js";
|
|
28
|
+
import "./chunk-L33WNMCP.js";
|
|
28
29
|
import {
|
|
29
30
|
phaseTransport,
|
|
30
31
|
resetAllCtxStarts,
|
|
31
32
|
updateCtxStart
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-6TSCOXF6.js";
|
|
33
34
|
import {
|
|
34
35
|
addTaskFailure
|
|
35
36
|
} from "./chunk-ZAA7B5BN.js";
|
|
@@ -37,11 +38,12 @@ import "./chunk-SA6YEFNG.js";
|
|
|
37
38
|
import {
|
|
38
39
|
loadAndValidateConfig
|
|
39
40
|
} from "./chunk-BBDKU4EH.js";
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-7B3GK5JQ.js";
|
|
42
|
+
import "./chunk-PKHYCNTT.js";
|
|
43
|
+
import "./chunk-HJQZP5CK.js";
|
|
42
44
|
import {
|
|
43
45
|
SubagentRuntime
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-2SFN2VYD.js";
|
|
45
47
|
import {
|
|
46
48
|
createCapabilityRegistry
|
|
47
49
|
} from "./chunk-FY3QUO2L.js";
|
|
@@ -52,28 +54,31 @@ import {
|
|
|
52
54
|
import {
|
|
53
55
|
sanitizeOutbound
|
|
54
56
|
} from "./chunk-YWZPKBO6.js";
|
|
55
|
-
import
|
|
56
|
-
|
|
57
|
+
import {
|
|
58
|
+
loadTransport,
|
|
59
|
+
resolveAgent
|
|
60
|
+
} from "./chunk-SA44ITVX.js";
|
|
61
|
+
import {
|
|
62
|
+
readEnvWithDefault
|
|
63
|
+
} from "./chunk-HAF2AFBW.js";
|
|
57
64
|
import {
|
|
58
65
|
init_peer_jwt,
|
|
59
66
|
peer_jwt_exports
|
|
60
67
|
} from "./chunk-Q7CH5DA3.js";
|
|
68
|
+
import {
|
|
69
|
+
init_peer_config,
|
|
70
|
+
peer_config_exports
|
|
71
|
+
} from "./chunk-EGA6JQVV.js";
|
|
72
|
+
import "./chunk-DCY7DGMT.js";
|
|
61
73
|
import {
|
|
62
74
|
setPeerActivityCallback
|
|
63
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-GXKJKYU4.js";
|
|
64
76
|
import {
|
|
65
77
|
abmind,
|
|
66
78
|
loadAbmind,
|
|
67
79
|
resetAbmindCache
|
|
68
80
|
} from "./chunk-JAJ3DUQ2.js";
|
|
69
81
|
import "./chunk-DO4INSXE.js";
|
|
70
|
-
import {
|
|
71
|
-
loadTransport,
|
|
72
|
-
resolveAgent
|
|
73
|
-
} from "./chunk-SA44ITVX.js";
|
|
74
|
-
import {
|
|
75
|
-
readEnvWithDefault
|
|
76
|
-
} from "./chunk-HAF2AFBW.js";
|
|
77
82
|
import {
|
|
78
83
|
appendRestartTimestamp,
|
|
79
84
|
initBridgeLock,
|
|
@@ -96,10 +101,11 @@ import "./chunk-VXUVKC66.js";
|
|
|
96
101
|
import "./chunk-OKMN6J4Z.js";
|
|
97
102
|
import "./chunk-MV6CJFWR.js";
|
|
98
103
|
import {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
kanbanComplete,
|
|
105
|
+
kanbanEnqueue,
|
|
106
|
+
kanbanFail,
|
|
107
|
+
kanbanRunning
|
|
108
|
+
} from "./chunk-W6ELWLAR.js";
|
|
103
109
|
import "./chunk-TBLYGCPQ.js";
|
|
104
110
|
import {
|
|
105
111
|
readEntries,
|
|
@@ -189,8 +195,10 @@ for (const envPath of ENV_FILES) {
|
|
|
189
195
|
`);
|
|
190
196
|
}
|
|
191
197
|
}
|
|
192
|
-
|
|
193
|
-
|
|
198
|
+
function reloadSecrets() {
|
|
199
|
+
if (!existsSync(secretDir)) return;
|
|
200
|
+
let purposeKey = null;
|
|
201
|
+
function getPurposeKey() {
|
|
194
202
|
if (purposeKey) return purposeKey;
|
|
195
203
|
try {
|
|
196
204
|
const abmindHome = process.env["ABMIND_HOME"] ?? resolve(homedir(), ".abmind");
|
|
@@ -204,7 +212,8 @@ if (existsSync(secretDir)) {
|
|
|
204
212
|
} catch {
|
|
205
213
|
return null;
|
|
206
214
|
}
|
|
207
|
-
}
|
|
215
|
+
}
|
|
216
|
+
function decryptFile(raw) {
|
|
208
217
|
const key = getPurposeKey();
|
|
209
218
|
if (!key) return null;
|
|
210
219
|
const buf = Buffer.from(raw.slice(4), "base64");
|
|
@@ -214,16 +223,15 @@ if (existsSync(secretDir)) {
|
|
|
214
223
|
const d = createDecipheriv("aes-256-gcm", key, iv);
|
|
215
224
|
d.setAuthTag(tag);
|
|
216
225
|
return d.update(ct, void 0, "utf-8") + d.final("utf-8");
|
|
217
|
-
}
|
|
226
|
+
}
|
|
227
|
+
function encryptFile(plaintext) {
|
|
218
228
|
const key = getPurposeKey();
|
|
219
229
|
if (!key) return null;
|
|
220
230
|
const iv = randomBytes(12);
|
|
221
231
|
const c = createCipheriv("aes-256-gcm", key, iv);
|
|
222
232
|
const enc = Buffer.concat([c.update(plaintext, "utf-8"), c.final()]);
|
|
223
233
|
return "ENC:" + Buffer.concat([Buffer.from([1]), iv, enc, c.getAuthTag()]).toString("base64");
|
|
224
|
-
}
|
|
225
|
-
getPurposeKey2 = getPurposeKey, decryptFile2 = decryptFile, encryptFile2 = encryptFile;
|
|
226
|
-
let purposeKey = null;
|
|
234
|
+
}
|
|
227
235
|
const SKIP_ENCRYPT = /* @__PURE__ */ new Set(["WEB_AUTH_TOKEN"]);
|
|
228
236
|
for (const file of readdirSync(secretDir)) {
|
|
229
237
|
const fullPath = resolve(secretDir, file);
|
|
@@ -257,9 +265,7 @@ if (existsSync(secretDir)) {
|
|
|
257
265
|
}
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
|
-
|
|
261
|
-
var decryptFile2;
|
|
262
|
-
var encryptFile2;
|
|
268
|
+
reloadSecrets();
|
|
263
269
|
try {
|
|
264
270
|
const envPath = resolve(home, "config", ".env");
|
|
265
271
|
if (existsSync(envPath)) {
|
|
@@ -1053,10 +1059,12 @@ ${(output || "(no output)").slice(0, 500)}`);
|
|
|
1053
1059
|
}
|
|
1054
1060
|
logInfo(TAG3, `\u25B6 Agent: "${entry.message.slice(0, 60)}"`);
|
|
1055
1061
|
this.setCurrent(entry, 0, "agent");
|
|
1062
|
+
const boardId = kanbanEnqueue(entry.id, "task", entry.id);
|
|
1063
|
+
kanbanRunning(boardId);
|
|
1056
1064
|
const workspace = join4(abtarsHome(), "workspace", entry.id);
|
|
1057
1065
|
mkdirSync(workspace, { recursive: true });
|
|
1058
1066
|
process.env["WORKSPACE"] = workspace;
|
|
1059
|
-
const { SubagentRuntime: SubagentRuntime2 } = await import("./subagent-runtime-
|
|
1067
|
+
const { SubagentRuntime: SubagentRuntime2 } = await import("./subagent-runtime-QA4LVU4C.js");
|
|
1060
1068
|
const runtime = new SubagentRuntime2();
|
|
1061
1069
|
this.timeout = setTimeout(() => {
|
|
1062
1070
|
logWarn(TAG3, `\u23F1\uFE0F Agent "${entry.id}" timed out (30min) \u2014 shutting down runtime`);
|
|
@@ -1092,6 +1100,11 @@ ${dod.details}`);
|
|
|
1092
1100
|
}
|
|
1093
1101
|
const resultPath = writeResultFile(entry.id, cleaned);
|
|
1094
1102
|
if (resultPath) logInfo(TAG3, `\u25A0 Result: ${resultPath}`);
|
|
1103
|
+
if (exitCode === 0) {
|
|
1104
|
+
kanbanComplete(boardId, resultPath, summary);
|
|
1105
|
+
} else {
|
|
1106
|
+
kanbanFail(boardId, `${summary}${dodResult}`);
|
|
1107
|
+
}
|
|
1095
1108
|
recordRunToFile(entry.id, exitCode);
|
|
1096
1109
|
if (exitCode === 0) recordRun2(entry, 0);
|
|
1097
1110
|
const paused = this.checkAutoPause(entry, exitCode, `${summary}${dodResult}`);
|
|
@@ -1106,6 +1119,7 @@ ${dod.details}`);
|
|
|
1106
1119
|
}
|
|
1107
1120
|
}).catch((err) => {
|
|
1108
1121
|
logWarn(TAG3, `Agent failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1122
|
+
kanbanFail(boardId, err instanceof Error ? err.message : String(err));
|
|
1109
1123
|
recordRunToFile(entry.id, 1);
|
|
1110
1124
|
const paused = this.checkAutoPause(entry, 1, err instanceof Error ? err.message : String(err));
|
|
1111
1125
|
scheduleRetry(entry, !!entry._retrying);
|
|
@@ -1209,7 +1223,7 @@ Result: ${result}${pending}
|
|
|
1209
1223
|
Diagnose the root cause. If you can fix it programmatically (config change, script fix, token refresh), do it. If the fix requires human action (manual browser login, external service down), state clearly: "Requires human intervention: <reason>" \u2014 do NOT create a skill or suggest adding error handling (you ARE the error handling). Be concise.`;
|
|
1210
1224
|
void (async () => {
|
|
1211
1225
|
try {
|
|
1212
|
-
const { SubagentRuntime: SubagentRuntime2 } = await import("./subagent-runtime-
|
|
1226
|
+
const { SubagentRuntime: SubagentRuntime2 } = await import("./subagent-runtime-QA4LVU4C.js");
|
|
1213
1227
|
const runtime = new SubagentRuntime2();
|
|
1214
1228
|
await runtime.complete("coding", msg, { sessionType: "S" });
|
|
1215
1229
|
await runtime.shutdown();
|
|
@@ -1231,28 +1245,9 @@ Resume with: /task resume <id>`;
|
|
|
1231
1245
|
}
|
|
1232
1246
|
);
|
|
1233
1247
|
ctx.cronQueue = cronQueue;
|
|
1234
|
-
const cronCallback = (
|
|
1235
|
-
if (!ctx.platforms.telegram || !ctx.telegramAdapter) return;
|
|
1236
|
-
const adapter = ctx.telegramAdapter;
|
|
1237
|
-
adapter.sendMessage(String(chatId), sanitizeOutbound(result)).catch((err) => {
|
|
1238
|
-
logWarn("main", `Cron task TG report failed: ${err}`);
|
|
1239
|
-
});
|
|
1240
|
-
if (dodFiles?.length) {
|
|
1241
|
-
for (const file of dodFiles) {
|
|
1242
|
-
adapter.sendDocument(String(chatId), file, message.slice(0, 1024)).catch((err) => {
|
|
1243
|
-
logWarn("main", `Cron task TG sendDocument failed: ${err}`);
|
|
1244
|
-
});
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
import("./system-message-BRU267FW.js").then(({ sendSystemMessage }) => {
|
|
1248
|
-
const summary = result.length > 500 ? result.slice(0, 500) + "\u2026" : result;
|
|
1249
|
-
const status = result.length > 4e3 ? "truncated" : "complete";
|
|
1250
|
-
sendSystemMessage(`[SYSTEM] [TASK RESULT] Task "${message}" \u2014 ${status}.
|
|
1251
|
-
Output: ${summary}`).catch((err) => logWarn("main", `Task result injection failed: ${err}`));
|
|
1252
|
-
}).catch(() => {
|
|
1253
|
-
});
|
|
1248
|
+
const cronCallback = (_chatId, _message, _result, _dodFiles) => {
|
|
1254
1249
|
};
|
|
1255
|
-
const { setEnqueueCron, setSecretGetDb } = await import("./tool-registry-
|
|
1250
|
+
const { setEnqueueCron, setSecretGetDb } = await import("./tool-registry-CG7GIS64.js");
|
|
1256
1251
|
setEnqueueCron((id, manual) => {
|
|
1257
1252
|
try {
|
|
1258
1253
|
const entry = readEntry(id);
|
|
@@ -1297,7 +1292,7 @@ Output: ${summary}`).catch((err) => logWarn("main", `Task result injection faile
|
|
|
1297
1292
|
selfHealerTask: null,
|
|
1298
1293
|
hailMary: ctx.hailMary,
|
|
1299
1294
|
rebuildTransport: async () => {
|
|
1300
|
-
const { rebuildTransport } = await import("./phase-transport-
|
|
1295
|
+
const { rebuildTransport } = await import("./phase-transport-F7GQRRYE.js");
|
|
1301
1296
|
await rebuildTransport(ctx);
|
|
1302
1297
|
},
|
|
1303
1298
|
phaseHealth: ctx.phaseHealth,
|
|
@@ -1347,7 +1342,7 @@ async function phasePlatforms(ctx) {
|
|
|
1347
1342
|
registry.register("telegram", {
|
|
1348
1343
|
configured: Boolean(config.telegram.botToken && config.telegram.allowedUserIds.size > 0),
|
|
1349
1344
|
async create() {
|
|
1350
|
-
const { TelegramAdapter } = await import("./telegram-adapter-
|
|
1345
|
+
const { TelegramAdapter } = await import("./telegram-adapter-TRMCC634.js");
|
|
1351
1346
|
const adapter = new TelegramAdapter(
|
|
1352
1347
|
{ botToken: config.telegram.botToken, allowedUserIds: config.telegram.allowedUserIds, pollTimeoutS: config.telegram.pollTimeoutS },
|
|
1353
1348
|
{ pipeline: pipelineDeps, conversationBuffer, transport, memory, sessionManager: ctx.sessionManager, actionGate: ctx.actionGate }
|
|
@@ -1372,7 +1367,7 @@ async function phasePlatforms(ctx) {
|
|
|
1372
1367
|
logInfo("main", "\u{1F4E1} Telegram polling started");
|
|
1373
1368
|
const mainChatId = config.mainChatId;
|
|
1374
1369
|
if (mainChatId && ctx.telegramAdapter) {
|
|
1375
|
-
const { setSendDocument } = await import("./tool-registry-
|
|
1370
|
+
const { setSendDocument } = await import("./tool-registry-CG7GIS64.js");
|
|
1376
1371
|
setSendDocument((path, caption) => ctx.telegramAdapter.sendDocument(String(mainChatId), path, caption));
|
|
1377
1372
|
if (ctx.actionGate) {
|
|
1378
1373
|
const api = ctx.telegramAdapter.api;
|
|
@@ -1397,7 +1392,7 @@ async function phasePlatforms(ctx) {
|
|
|
1397
1392
|
registry.register("discord", {
|
|
1398
1393
|
configured: Boolean(config.discord.enabled && config.discord.botToken),
|
|
1399
1394
|
async create() {
|
|
1400
|
-
const { DiscordAdapter } = await import("./discord-adapter-
|
|
1395
|
+
const { DiscordAdapter } = await import("./discord-adapter-DWIQRNDI.js");
|
|
1401
1396
|
const adapter = new DiscordAdapter(
|
|
1402
1397
|
{
|
|
1403
1398
|
botToken: config.discord.botToken,
|
|
@@ -1439,7 +1434,7 @@ async function phasePlatforms(ctx) {
|
|
|
1439
1434
|
async create() {
|
|
1440
1435
|
const { loadIrcConfig } = await import("./irc-config-XN5VW2V4.js");
|
|
1441
1436
|
const { IrcAdapter } = await import("./irc-adapter-HXO5D4SW.js");
|
|
1442
|
-
const { handleInboundMessage } = await import("./message-pipeline-
|
|
1437
|
+
const { handleInboundMessage } = await import("./message-pipeline-GCSZCQWO.js");
|
|
1443
1438
|
const ircConfig = loadIrcConfig();
|
|
1444
1439
|
if (!ircConfig) throw new Error("irc.json missing or empty");
|
|
1445
1440
|
const adapter = new IrcAdapter(ircConfig, {
|
|
@@ -1461,7 +1456,7 @@ async function phasePlatforms(ctx) {
|
|
|
1461
1456
|
const result = await registry.start("irc", { backgroundRetry: true });
|
|
1462
1457
|
if (result.ok) {
|
|
1463
1458
|
logInfo("main", "\u{1F4E1} IRC started");
|
|
1464
|
-
const { setIrcSend } = await import("./tool-registry-
|
|
1459
|
+
const { setIrcSend } = await import("./tool-registry-CG7GIS64.js");
|
|
1465
1460
|
const ircAdapter = platformAdapters.get("irc");
|
|
1466
1461
|
if (ircAdapter) setIrcSend((channel, message) => {
|
|
1467
1462
|
ircAdapter.sendMessage(channel, message);
|
|
@@ -1490,7 +1485,7 @@ async function phaseCapabilities(ctx) {
|
|
|
1490
1485
|
let loaded = [];
|
|
1491
1486
|
let staticCaps;
|
|
1492
1487
|
try {
|
|
1493
|
-
({ capabilities: staticCaps } = await import("./_registry.generated-
|
|
1488
|
+
({ capabilities: staticCaps } = await import("./_registry.generated-KM6LXTNJ.js"));
|
|
1494
1489
|
} catch (err) {
|
|
1495
1490
|
logError("capabilities", `Registry import failed: ${err instanceof Error ? err.message : String(err)}. Loading individually.`);
|
|
1496
1491
|
staticCaps = [];
|
|
@@ -1890,7 +1885,7 @@ function createSelfHealerTask(getTelegramAdapter, allowedUserIds) {
|
|
|
1890
1885
|
autoFixRunning = false;
|
|
1891
1886
|
}, 5 * 60 * 1e3);
|
|
1892
1887
|
try {
|
|
1893
|
-
const { SubagentRuntime: SubagentRuntime2 } = await import("./subagent-runtime-
|
|
1888
|
+
const { SubagentRuntime: SubagentRuntime2 } = await import("./subagent-runtime-QA4LVU4C.js");
|
|
1894
1889
|
const runtime = new SubagentRuntime2();
|
|
1895
1890
|
const result = await runtime.complete("coding", rule.instruction);
|
|
1896
1891
|
await runtime.shutdown();
|
|
@@ -2098,12 +2093,15 @@ function createUpdateCheckTask(notify) {
|
|
|
2098
2093
|
const { join: join11 } = await import("node:path");
|
|
2099
2094
|
const { abtarsHome: abtarsHome2 } = await import("./paths-QQM74XYT.js");
|
|
2100
2095
|
let version = "0.0.0";
|
|
2096
|
+
let source = "npm";
|
|
2101
2097
|
try {
|
|
2102
2098
|
const m = JSON.parse(readFileSync7(join11(abtarsHome2(), "manifest.json"), "utf-8"));
|
|
2103
2099
|
version = m.version ?? "0.0.0";
|
|
2100
|
+
source = m.source ?? "npm";
|
|
2104
2101
|
} catch (err) {
|
|
2105
2102
|
logAndSwallow(TAG6, "read manifest.json", err);
|
|
2106
2103
|
}
|
|
2104
|
+
if (source === "local") return;
|
|
2107
2105
|
const result = checkForUpdate("abtars", version);
|
|
2108
2106
|
if (result?.shouldNotify) {
|
|
2109
2107
|
notify(`\u26A1 Update available: ${result.current} \u2192 ${result.latest}. Run: abtars update`);
|
|
@@ -2149,6 +2147,54 @@ function createSkillTrashPruneTask() {
|
|
|
2149
2147
|
}
|
|
2150
2148
|
};
|
|
2151
2149
|
}
|
|
2150
|
+
function createKanbanDeliveryTask(deps) {
|
|
2151
|
+
return {
|
|
2152
|
+
name: "kanban-delivery",
|
|
2153
|
+
execute: async () => {
|
|
2154
|
+
try {
|
|
2155
|
+
const { kanbanPending, kanbanSetDelivering, kanbanMarkDelivered, kanbanDeliveryFailed } = await import("./kanban-board-I52RHNHQ.js");
|
|
2156
|
+
const pending = kanbanPending();
|
|
2157
|
+
if (pending.length === 0) return;
|
|
2158
|
+
for (const card of pending) {
|
|
2159
|
+
kanbanSetDelivering(card.id);
|
|
2160
|
+
try {
|
|
2161
|
+
await deps.sendSystemMessage(
|
|
2162
|
+
`[SYSTEM] [TASK COMPLETE] Your task "${card.title}" is done. Announce completion briefly and tell the user to see the attached file. Do not reproduce the full content.
|
|
2163
|
+
|
|
2164
|
+
Summary for your memory: ${card.result_summary ?? "(no summary)"}`
|
|
2165
|
+
);
|
|
2166
|
+
if (card.result_path) {
|
|
2167
|
+
await deps.sendDocument(deps.chatId(), card.result_path, `\u{1F4C4} ${card.title}`);
|
|
2168
|
+
}
|
|
2169
|
+
kanbanMarkDelivered(card.id);
|
|
2170
|
+
} catch (err) {
|
|
2171
|
+
kanbanDeliveryFailed(card.id);
|
|
2172
|
+
logError(TAG6, `Kanban delivery failed for card ${card.id}: ${err}`);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
} catch (err) {
|
|
2176
|
+
logAndSwallow(TAG6, "kanban-delivery", err);
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
function createKanbanCleanupTask() {
|
|
2182
|
+
let counter = 0;
|
|
2183
|
+
return {
|
|
2184
|
+
name: "kanban-cleanup",
|
|
2185
|
+
execute: async () => {
|
|
2186
|
+
counter++;
|
|
2187
|
+
if (counter % 72 !== 0) return;
|
|
2188
|
+
try {
|
|
2189
|
+
const { kanbanCleanup } = await import("./kanban-board-I52RHNHQ.js");
|
|
2190
|
+
const purged = kanbanCleanup(7);
|
|
2191
|
+
if (purged > 0) logInfo(TAG6, `Kanban: purged ${purged} delivered cards > 7d`);
|
|
2192
|
+
} catch (err) {
|
|
2193
|
+
logAndSwallow(TAG6, "kanban-cleanup", err);
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2152
2198
|
|
|
2153
2199
|
// src/boot/phase-heartbeat.ts
|
|
2154
2200
|
init_logger();
|
|
@@ -2237,7 +2283,7 @@ function createModelHealthTask(ctx) {
|
|
|
2237
2283
|
method: "POST",
|
|
2238
2284
|
headers: { "Content-Type": "application/json", ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {} },
|
|
2239
2285
|
body: JSON.stringify({ model, messages: [{ role: "user", content: "hi" }], max_tokens: 1 }),
|
|
2240
|
-
signal: AbortSignal.timeout(
|
|
2286
|
+
signal: AbortSignal.timeout(3e4)
|
|
2241
2287
|
});
|
|
2242
2288
|
if (!res.ok) {
|
|
2243
2289
|
warnings.push(`\u26A0\uFE0F ${model} \u2014 ${res.status} ${res.statusText} (affects ${agentNames.join(", ")})`);
|
|
@@ -2392,6 +2438,16 @@ async function phaseHeartbeat(ctx) {
|
|
|
2392
2438
|
heartbeat.registerTask(createDbIntegrityTask(memory));
|
|
2393
2439
|
heartbeat.registerTask(createSkillStatsFlushTask());
|
|
2394
2440
|
heartbeat.registerTask(createSkillTrashPruneTask());
|
|
2441
|
+
const masterChatId = [...config.telegram.allowedUserIds][0] ?? 0;
|
|
2442
|
+
heartbeat.registerTask(createKanbanDeliveryTask({
|
|
2443
|
+
sendSystemMessage,
|
|
2444
|
+
sendDocument: async (chatId, filePath, caption) => {
|
|
2445
|
+
if (!ctx.telegramAdapter) return;
|
|
2446
|
+
await ctx.telegramAdapter.sendDocument(chatId, filePath, caption);
|
|
2447
|
+
},
|
|
2448
|
+
chatId: () => String(masterChatId)
|
|
2449
|
+
}));
|
|
2450
|
+
heartbeat.registerTask(createKanbanCleanupTask());
|
|
2395
2451
|
heartbeat.registerTask(createUpdateCheckTask((msg) => {
|
|
2396
2452
|
import("./notification-ULESRDHB.js").then(({ sendNotification: sendNotification2 }) => sendNotification2(ctx, msg)).catch((err) => logAndSwallow(TAG7, "sendNotification update-check", err));
|
|
2397
2453
|
}));
|
|
@@ -2415,7 +2471,7 @@ async function phaseHeartbeat(ctx) {
|
|
|
2415
2471
|
}
|
|
2416
2472
|
ctx.selfHealerTask = selfHealerTask;
|
|
2417
2473
|
pipelineDeps.selfHealerTask = selfHealerTask;
|
|
2418
|
-
const { registerCommand } = await import("./commands-
|
|
2474
|
+
const { registerCommand } = await import("./commands-L6VIMPCR.js");
|
|
2419
2475
|
for (const [name, handler2] of capabilities.commands) {
|
|
2420
2476
|
registerCommand(name, handler2);
|
|
2421
2477
|
}
|
|
@@ -2445,8 +2501,8 @@ async function phaseSleep(ctx) {
|
|
|
2445
2501
|
logWarn("boot", `${phaseSleep.name}: skipping \u2014 heartbeat not available`);
|
|
2446
2502
|
return "skipped";
|
|
2447
2503
|
}
|
|
2448
|
-
const { createSleepHandle } = await import("./sleep-
|
|
2449
|
-
const { killWakeInhibit } = await import("./commands-
|
|
2504
|
+
const { createSleepHandle } = await import("./sleep-MYOZ73IU.js");
|
|
2505
|
+
const { killWakeInhibit } = await import("./commands-L6VIMPCR.js");
|
|
2450
2506
|
const SLEEP_HOUR = parseInt(readEnvWithDefault("BED_TIME", "2", "bedtime hour").split(":")[0] ?? "2", 10);
|
|
2451
2507
|
let subagent = null;
|
|
2452
2508
|
const { getEnv: getEnv2 } = await import("./env-schema-T43X43BU.js");
|
|
@@ -3439,7 +3495,7 @@ async function handleEmbeddings(body, memory) {
|
|
|
3439
3495
|
};
|
|
3440
3496
|
}
|
|
3441
3497
|
const inputs = Array.isArray(req.input) ? req.input : [req.input];
|
|
3442
|
-
const vectors = await provider.batchEmbed(inputs);
|
|
3498
|
+
const vectors = (await provider.batchEmbed(inputs)).map((v) => v ? Array.from(v) : null);
|
|
3443
3499
|
if (vectors.some((v) => v === null)) {
|
|
3444
3500
|
return {
|
|
3445
3501
|
status: 502,
|
|
@@ -4178,6 +4234,7 @@ process.on("unhandledRejection", (reason) => {
|
|
|
4178
4234
|
if (code !== 0) process.exit(code);
|
|
4179
4235
|
logInfo("main", "\u267B\uFE0F Bridge restart requested \u2014 restarting...");
|
|
4180
4236
|
_resetEnv();
|
|
4237
|
+
reloadSecrets();
|
|
4181
4238
|
resetAbmindCache();
|
|
4182
4239
|
initEnv();
|
|
4183
4240
|
}
|