agentix-cli 0.8.0 → 0.13.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/README.md +387 -116
- package/dist/agent-5KIMJI3F.js +2 -0
- package/dist/chunk-34UAFPK4.js +10 -0
- package/dist/chunk-34UAFPK4.js.map +1 -0
- package/dist/{chunk-X7UN6JAA.js → chunk-6MKAXEE5.js} +2 -2
- package/dist/chunk-CJ45Y2IR.js +12 -0
- package/dist/chunk-CJ45Y2IR.js.map +1 -0
- package/dist/chunk-D6EDMQRV.js +108 -0
- package/dist/chunk-D6EDMQRV.js.map +1 -0
- package/dist/chunk-DSYKYZMT.js +2 -0
- package/dist/chunk-DSYKYZMT.js.map +1 -0
- package/dist/chunk-HI24KAEY.js +54 -0
- package/dist/chunk-HI24KAEY.js.map +1 -0
- package/dist/{chunk-MGMZNJCE.js → chunk-KXZMYLHQ.js} +27 -27
- package/dist/chunk-KXZMYLHQ.js.map +1 -0
- package/dist/chunk-MCJUAE6V.js +6 -0
- package/dist/chunk-MCJUAE6V.js.map +1 -0
- package/dist/chunk-QOYAX2FT.js +2 -0
- package/dist/chunk-QOYAX2FT.js.map +1 -0
- package/dist/chunk-QZP65I2H.js +45 -0
- package/dist/chunk-QZP65I2H.js.map +1 -0
- package/dist/chunk-T25UEXVK.js +126 -0
- package/dist/chunk-T25UEXVK.js.map +1 -0
- package/dist/chunk-VH23CDHL.js +157 -0
- package/dist/chunk-VH23CDHL.js.map +1 -0
- package/dist/chunk-WJ6ZF6EZ.js +6 -0
- package/dist/chunk-WJ6ZF6EZ.js.map +1 -0
- package/dist/chunk-ZRYBSI5G.js +23 -0
- package/dist/chunk-ZRYBSI5G.js.map +1 -0
- package/dist/cli.js +277 -36
- package/dist/cli.js.map +1 -1
- package/dist/compaction-7I3E5QUO.js +28 -0
- package/dist/compaction-7I3E5QUO.js.map +1 -0
- package/dist/config-HAD5E4YX.js +2 -0
- package/dist/debug-N3B5NVJU.js +2 -0
- package/dist/heal-OTGT5HHJ.js +2 -0
- package/dist/index.d.ts +1849 -368
- package/dist/index.js +39 -35
- package/dist/index.js.map +1 -1
- package/dist/loader-YQE6XJBT.js +2 -0
- package/dist/loader-YQE6XJBT.js.map +1 -0
- package/dist/memory-extract-RGPUPMKU.js +2 -0
- package/dist/memory-extract-RGPUPMKU.js.map +1 -0
- package/dist/{providers-AVYG63KK.js → providers-G3WZ4RVJ.js} +2 -2
- package/dist/providers-G3WZ4RVJ.js.map +1 -0
- package/dist/registry-CDWY7CLL.js +2 -0
- package/dist/registry-CDWY7CLL.js.map +1 -0
- package/dist/subagent-WV7QKQ3L.js +3 -0
- package/dist/subagent-WV7QKQ3L.js.map +1 -0
- package/dist/usage-dashboard-2TJQBFSH.js +404 -0
- package/dist/usage-dashboard-2TJQBFSH.js.map +1 -0
- package/dist/workspace-setup-QQTCJY4B.js +2 -0
- package/dist/workspace-setup-QQTCJY4B.js.map +1 -0
- package/package.json +4 -1
- package/dist/agent-K2YOEOJ5.js +0 -2
- package/dist/chunk-F73GPYCO.js +0 -106
- package/dist/chunk-F73GPYCO.js.map +0 -1
- package/dist/chunk-FRFR27IN.js +0 -3
- package/dist/chunk-FRFR27IN.js.map +0 -1
- package/dist/chunk-MGMZNJCE.js.map +0 -1
- package/dist/chunk-NGKOM4ZZ.js +0 -137
- package/dist/chunk-NGKOM4ZZ.js.map +0 -1
- package/dist/chunk-Z4GC5D6D.js +0 -12
- package/dist/chunk-Z4GC5D6D.js.map +0 -1
- package/dist/heal-UV5A6B5T.js +0 -2
- package/dist/loader-6VSM6FSY.js +0 -2
- /package/dist/{agent-K2YOEOJ5.js.map → agent-5KIMJI3F.js.map} +0 -0
- /package/dist/{chunk-X7UN6JAA.js.map → chunk-6MKAXEE5.js.map} +0 -0
- /package/dist/{heal-UV5A6B5T.js.map → config-HAD5E4YX.js.map} +0 -0
- /package/dist/{loader-6VSM6FSY.js.map → debug-N3B5NVJU.js.map} +0 -0
- /package/dist/{providers-AVYG63KK.js.map → heal-OTGT5HHJ.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { IncomingMessage as IncomingMessage$1, ServerResponse } from 'http';
|
|
2
3
|
import { PackageJson } from 'type-fest';
|
|
3
4
|
|
|
4
5
|
interface GenerationMessage {
|
|
@@ -410,6 +411,8 @@ declare const skillFrontmatterSchema: z.ZodObject<{
|
|
|
410
411
|
pattern: string;
|
|
411
412
|
description?: string | undefined;
|
|
412
413
|
}>, "many">>;
|
|
414
|
+
/** If true, skill is auto-injected into context when triggers match (per-turn) */
|
|
415
|
+
autoInject: z.ZodOptional<z.ZodBoolean>;
|
|
413
416
|
}, "strip", z.ZodTypeAny, {
|
|
414
417
|
name: string;
|
|
415
418
|
description: string;
|
|
@@ -421,6 +424,7 @@ declare const skillFrontmatterSchema: z.ZodObject<{
|
|
|
421
424
|
pattern: string;
|
|
422
425
|
description?: string | undefined;
|
|
423
426
|
}[] | undefined;
|
|
427
|
+
autoInject?: boolean | undefined;
|
|
424
428
|
}, {
|
|
425
429
|
name: string;
|
|
426
430
|
description: string;
|
|
@@ -432,6 +436,7 @@ declare const skillFrontmatterSchema: z.ZodObject<{
|
|
|
432
436
|
pattern: string;
|
|
433
437
|
description?: string | undefined;
|
|
434
438
|
}[] | undefined;
|
|
439
|
+
autoInject?: boolean | undefined;
|
|
435
440
|
}>;
|
|
436
441
|
type SkillFrontmatter = z.infer<typeof skillFrontmatterSchema>;
|
|
437
442
|
interface Skill {
|
|
@@ -598,6 +603,7 @@ declare class ToolExecutor {
|
|
|
598
603
|
private runCommand;
|
|
599
604
|
private editFile;
|
|
600
605
|
private createFiles;
|
|
606
|
+
private spawnAgent;
|
|
601
607
|
private askUser;
|
|
602
608
|
}
|
|
603
609
|
|
|
@@ -809,15 +815,22 @@ declare class UsageTracker {
|
|
|
809
815
|
}
|
|
810
816
|
declare const globalTracker: UsageTracker;
|
|
811
817
|
|
|
812
|
-
|
|
813
|
-
declare function
|
|
818
|
+
type DebugCategory = "webhook" | "agent" | "channel" | "cron" | "mesh" | "context" | "memory" | "config" | "all";
|
|
819
|
+
declare function setDebug(enabled: boolean, categories?: DebugCategory[]): void;
|
|
820
|
+
declare function isDebug(category?: DebugCategory): boolean;
|
|
814
821
|
declare const debug: {
|
|
815
822
|
log(...args: unknown[]): void;
|
|
823
|
+
/** Log with a specific category — only outputs if that category is enabled */
|
|
824
|
+
cat(category: DebugCategory, message: string, ...extra: unknown[]): void;
|
|
816
825
|
step(step: number, message: string): void;
|
|
817
826
|
hook(name: string, duration: number, result: string): void;
|
|
818
827
|
api(method: string, model: string, tokens?: number): void;
|
|
819
828
|
tokens(input: number, output: number, cost: number): void;
|
|
820
829
|
context(label: string, detail: string): void;
|
|
830
|
+
/** Log webhook event with full payload summary */
|
|
831
|
+
webhook(channel: string, event: string, detail: string): void;
|
|
832
|
+
/** Log channel lifecycle event */
|
|
833
|
+
channel(name: string, event: string, detail?: string): void;
|
|
821
834
|
};
|
|
822
835
|
|
|
823
836
|
interface Session {
|
|
@@ -1277,6 +1290,23 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
1277
1290
|
mentions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1278
1291
|
maxConcurrent: z.ZodDefault<z.ZodNumber>;
|
|
1279
1292
|
permissionMode: z.ZodDefault<z.ZodString>;
|
|
1293
|
+
queueMode: z.ZodDefault<z.ZodEnum<["collect", "followup", "drop"]>>;
|
|
1294
|
+
heartbeat: z.ZodDefault<z.ZodObject<{
|
|
1295
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1296
|
+
intervalMinutes: z.ZodDefault<z.ZodNumber>;
|
|
1297
|
+
prompt: z.ZodDefault<z.ZodString>;
|
|
1298
|
+
channel: z.ZodDefault<z.ZodString>;
|
|
1299
|
+
}, "strip", z.ZodTypeAny, {
|
|
1300
|
+
enabled: boolean;
|
|
1301
|
+
prompt: string;
|
|
1302
|
+
channel: string;
|
|
1303
|
+
intervalMinutes: number;
|
|
1304
|
+
}, {
|
|
1305
|
+
enabled?: boolean | undefined;
|
|
1306
|
+
prompt?: string | undefined;
|
|
1307
|
+
channel?: string | undefined;
|
|
1308
|
+
intervalMinutes?: number | undefined;
|
|
1309
|
+
}>>;
|
|
1280
1310
|
}, "strip", z.ZodTypeAny, {
|
|
1281
1311
|
name: string;
|
|
1282
1312
|
workspace: string;
|
|
@@ -1284,6 +1314,13 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
1284
1314
|
mentions: string[];
|
|
1285
1315
|
maxConcurrent: number;
|
|
1286
1316
|
permissionMode: string;
|
|
1317
|
+
queueMode: "collect" | "followup" | "drop";
|
|
1318
|
+
heartbeat: {
|
|
1319
|
+
enabled: boolean;
|
|
1320
|
+
prompt: string;
|
|
1321
|
+
channel: string;
|
|
1322
|
+
intervalMinutes: number;
|
|
1323
|
+
};
|
|
1287
1324
|
provider?: string | undefined;
|
|
1288
1325
|
model?: string | undefined;
|
|
1289
1326
|
systemPrompt?: string | undefined;
|
|
@@ -1292,11 +1329,18 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
1292
1329
|
workspace: string;
|
|
1293
1330
|
provider?: string | undefined;
|
|
1294
1331
|
model?: string | undefined;
|
|
1295
|
-
systemPrompt?: string | undefined;
|
|
1296
1332
|
tier?: "claude-code" | "sdk" | "orchestrator" | undefined;
|
|
1333
|
+
systemPrompt?: string | undefined;
|
|
1297
1334
|
mentions?: string[] | undefined;
|
|
1298
1335
|
maxConcurrent?: number | undefined;
|
|
1299
1336
|
permissionMode?: string | undefined;
|
|
1337
|
+
queueMode?: "collect" | "followup" | "drop" | undefined;
|
|
1338
|
+
heartbeat?: {
|
|
1339
|
+
enabled?: boolean | undefined;
|
|
1340
|
+
prompt?: string | undefined;
|
|
1341
|
+
channel?: string | undefined;
|
|
1342
|
+
intervalMinutes?: number | undefined;
|
|
1343
|
+
} | undefined;
|
|
1300
1344
|
}>;
|
|
1301
1345
|
declare const cronJobSchema: z.ZodObject<{
|
|
1302
1346
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1306,16 +1350,34 @@ declare const cronJobSchema: z.ZodObject<{
|
|
|
1306
1350
|
prompt: z.ZodString;
|
|
1307
1351
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
1308
1352
|
model: z.ZodOptional<z.ZodString>;
|
|
1309
|
-
onError: z.ZodDefault<z.ZodEnum<["log", "notify", "disable"]
|
|
1353
|
+
onError: z.ZodEffects<z.ZodDefault<z.ZodUnion<[z.ZodEnum<["log", "notify", "disable"]>, z.ZodArray<z.ZodEnum<["log", "notify", "disable"]>, "many">]>>, ("log" | "notify" | "disable")[], "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined>;
|
|
1354
|
+
notify: z.ZodOptional<z.ZodObject<{
|
|
1355
|
+
channel: z.ZodString;
|
|
1356
|
+
chatId: z.ZodString;
|
|
1357
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
1358
|
+
}, "strip", z.ZodTypeAny, {
|
|
1359
|
+
channel: string;
|
|
1360
|
+
chatId: string;
|
|
1361
|
+
accountId?: string | undefined;
|
|
1362
|
+
}, {
|
|
1363
|
+
channel: string;
|
|
1364
|
+
chatId: string;
|
|
1365
|
+
accountId?: string | undefined;
|
|
1366
|
+
}>>;
|
|
1310
1367
|
}, "strip", z.ZodTypeAny, {
|
|
1311
1368
|
enabled: boolean;
|
|
1312
1369
|
agent: string;
|
|
1313
|
-
timeout: number;
|
|
1314
1370
|
prompt: string;
|
|
1371
|
+
timeout: number;
|
|
1315
1372
|
schedule: string;
|
|
1316
1373
|
timezone: string;
|
|
1317
|
-
onError: "log" | "notify" | "disable";
|
|
1374
|
+
onError: ("log" | "notify" | "disable")[];
|
|
1318
1375
|
model?: string | undefined;
|
|
1376
|
+
notify?: {
|
|
1377
|
+
channel: string;
|
|
1378
|
+
chatId: string;
|
|
1379
|
+
accountId?: string | undefined;
|
|
1380
|
+
} | undefined;
|
|
1319
1381
|
}, {
|
|
1320
1382
|
agent: string;
|
|
1321
1383
|
prompt: string;
|
|
@@ -1324,7 +1386,12 @@ declare const cronJobSchema: z.ZodObject<{
|
|
|
1324
1386
|
enabled?: boolean | undefined;
|
|
1325
1387
|
timeout?: number | undefined;
|
|
1326
1388
|
timezone?: string | undefined;
|
|
1327
|
-
|
|
1389
|
+
notify?: {
|
|
1390
|
+
channel: string;
|
|
1391
|
+
chatId: string;
|
|
1392
|
+
accountId?: string | undefined;
|
|
1393
|
+
} | undefined;
|
|
1394
|
+
onError?: "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined;
|
|
1328
1395
|
}>;
|
|
1329
1396
|
declare const meshPeerSchema: z.ZodObject<{
|
|
1330
1397
|
url: z.ZodString;
|
|
@@ -1344,13 +1411,17 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1344
1411
|
id: z.ZodString;
|
|
1345
1412
|
name: z.ZodString;
|
|
1346
1413
|
bind: z.ZodDefault<z.ZodString>;
|
|
1414
|
+
/** Default agent for voice/API calls that don't specify one (e.g. Siri) */
|
|
1415
|
+
defaultAgent: z.ZodOptional<z.ZodString>;
|
|
1347
1416
|
}, "strip", z.ZodTypeAny, {
|
|
1348
1417
|
id: string;
|
|
1349
1418
|
name: string;
|
|
1350
1419
|
bind: string;
|
|
1420
|
+
defaultAgent?: string | undefined;
|
|
1351
1421
|
}, {
|
|
1352
1422
|
id: string;
|
|
1353
1423
|
name: string;
|
|
1424
|
+
defaultAgent?: string | undefined;
|
|
1354
1425
|
bind?: string | undefined;
|
|
1355
1426
|
}>;
|
|
1356
1427
|
providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -1376,6 +1447,23 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1376
1447
|
mentions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1377
1448
|
maxConcurrent: z.ZodDefault<z.ZodNumber>;
|
|
1378
1449
|
permissionMode: z.ZodDefault<z.ZodString>;
|
|
1450
|
+
queueMode: z.ZodDefault<z.ZodEnum<["collect", "followup", "drop"]>>;
|
|
1451
|
+
heartbeat: z.ZodDefault<z.ZodObject<{
|
|
1452
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1453
|
+
intervalMinutes: z.ZodDefault<z.ZodNumber>;
|
|
1454
|
+
prompt: z.ZodDefault<z.ZodString>;
|
|
1455
|
+
channel: z.ZodDefault<z.ZodString>;
|
|
1456
|
+
}, "strip", z.ZodTypeAny, {
|
|
1457
|
+
enabled: boolean;
|
|
1458
|
+
prompt: string;
|
|
1459
|
+
channel: string;
|
|
1460
|
+
intervalMinutes: number;
|
|
1461
|
+
}, {
|
|
1462
|
+
enabled?: boolean | undefined;
|
|
1463
|
+
prompt?: string | undefined;
|
|
1464
|
+
channel?: string | undefined;
|
|
1465
|
+
intervalMinutes?: number | undefined;
|
|
1466
|
+
}>>;
|
|
1379
1467
|
}, "strip", z.ZodTypeAny, {
|
|
1380
1468
|
name: string;
|
|
1381
1469
|
workspace: string;
|
|
@@ -1383,6 +1471,13 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1383
1471
|
mentions: string[];
|
|
1384
1472
|
maxConcurrent: number;
|
|
1385
1473
|
permissionMode: string;
|
|
1474
|
+
queueMode: "collect" | "followup" | "drop";
|
|
1475
|
+
heartbeat: {
|
|
1476
|
+
enabled: boolean;
|
|
1477
|
+
prompt: string;
|
|
1478
|
+
channel: string;
|
|
1479
|
+
intervalMinutes: number;
|
|
1480
|
+
};
|
|
1386
1481
|
provider?: string | undefined;
|
|
1387
1482
|
model?: string | undefined;
|
|
1388
1483
|
systemPrompt?: string | undefined;
|
|
@@ -1391,11 +1486,18 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1391
1486
|
workspace: string;
|
|
1392
1487
|
provider?: string | undefined;
|
|
1393
1488
|
model?: string | undefined;
|
|
1394
|
-
systemPrompt?: string | undefined;
|
|
1395
1489
|
tier?: "claude-code" | "sdk" | "orchestrator" | undefined;
|
|
1490
|
+
systemPrompt?: string | undefined;
|
|
1396
1491
|
mentions?: string[] | undefined;
|
|
1397
1492
|
maxConcurrent?: number | undefined;
|
|
1398
1493
|
permissionMode?: string | undefined;
|
|
1494
|
+
queueMode?: "collect" | "followup" | "drop" | undefined;
|
|
1495
|
+
heartbeat?: {
|
|
1496
|
+
enabled?: boolean | undefined;
|
|
1497
|
+
prompt?: string | undefined;
|
|
1498
|
+
channel?: string | undefined;
|
|
1499
|
+
intervalMinutes?: number | undefined;
|
|
1500
|
+
} | undefined;
|
|
1399
1501
|
}>>>;
|
|
1400
1502
|
channels: z.ZodDefault<z.ZodObject<{
|
|
1401
1503
|
telegram: z.ZodDefault<z.ZodObject<{
|
|
@@ -1513,47 +1615,69 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1513
1615
|
agentId: z.ZodString;
|
|
1514
1616
|
gitlabUsernames: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1515
1617
|
keywords: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1618
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1516
1619
|
}, "strip", z.ZodTypeAny, {
|
|
1517
1620
|
agentId: string;
|
|
1518
1621
|
gitlabUsernames: string[];
|
|
1519
1622
|
keywords: string[];
|
|
1623
|
+
token?: string | undefined;
|
|
1520
1624
|
}, {
|
|
1521
1625
|
agentId: string;
|
|
1626
|
+
token?: string | undefined;
|
|
1522
1627
|
gitlabUsernames?: string[] | undefined;
|
|
1523
1628
|
keywords?: string[] | undefined;
|
|
1524
1629
|
}>, "many">>;
|
|
1525
1630
|
}, "strip", z.ZodTypeAny, {
|
|
1526
1631
|
enabled: boolean;
|
|
1527
|
-
host: string;
|
|
1528
1632
|
routes: {
|
|
1529
1633
|
agent: string;
|
|
1530
1634
|
project: string;
|
|
1531
1635
|
}[];
|
|
1532
1636
|
webhookPort: number;
|
|
1637
|
+
host: string;
|
|
1533
1638
|
agentMappings: {
|
|
1534
1639
|
agentId: string;
|
|
1535
1640
|
gitlabUsernames: string[];
|
|
1536
1641
|
keywords: string[];
|
|
1642
|
+
token?: string | undefined;
|
|
1537
1643
|
}[];
|
|
1538
1644
|
token?: string | undefined;
|
|
1539
1645
|
webhookSecret?: string | undefined;
|
|
1540
1646
|
}, {
|
|
1541
1647
|
enabled?: boolean | undefined;
|
|
1542
1648
|
token?: string | undefined;
|
|
1543
|
-
host?: string | undefined;
|
|
1544
1649
|
routes?: {
|
|
1545
1650
|
agent: string;
|
|
1546
1651
|
project: string;
|
|
1547
1652
|
}[] | undefined;
|
|
1548
1653
|
webhookPort?: number | undefined;
|
|
1549
1654
|
webhookSecret?: string | undefined;
|
|
1655
|
+
host?: string | undefined;
|
|
1550
1656
|
agentMappings?: {
|
|
1551
1657
|
agentId: string;
|
|
1658
|
+
token?: string | undefined;
|
|
1552
1659
|
gitlabUsernames?: string[] | undefined;
|
|
1553
1660
|
keywords?: string[] | undefined;
|
|
1554
1661
|
}[] | undefined;
|
|
1555
1662
|
}>>;
|
|
1556
1663
|
}, "strip", z.ZodTypeAny, {
|
|
1664
|
+
gitlab: {
|
|
1665
|
+
enabled: boolean;
|
|
1666
|
+
routes: {
|
|
1667
|
+
agent: string;
|
|
1668
|
+
project: string;
|
|
1669
|
+
}[];
|
|
1670
|
+
webhookPort: number;
|
|
1671
|
+
host: string;
|
|
1672
|
+
agentMappings: {
|
|
1673
|
+
agentId: string;
|
|
1674
|
+
gitlabUsernames: string[];
|
|
1675
|
+
keywords: string[];
|
|
1676
|
+
token?: string | undefined;
|
|
1677
|
+
}[];
|
|
1678
|
+
token?: string | undefined;
|
|
1679
|
+
webhookSecret?: string | undefined;
|
|
1680
|
+
};
|
|
1557
1681
|
telegram: {
|
|
1558
1682
|
enabled: boolean;
|
|
1559
1683
|
accounts: Record<string, {
|
|
@@ -1581,23 +1705,24 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1581
1705
|
token?: string | undefined;
|
|
1582
1706
|
agentBinding?: string | undefined;
|
|
1583
1707
|
};
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1708
|
+
}, {
|
|
1709
|
+
gitlab?: {
|
|
1710
|
+
enabled?: boolean | undefined;
|
|
1711
|
+
token?: string | undefined;
|
|
1712
|
+
routes?: {
|
|
1588
1713
|
agent: string;
|
|
1589
1714
|
project: string;
|
|
1590
|
-
}[];
|
|
1591
|
-
webhookPort
|
|
1592
|
-
agentMappings: {
|
|
1593
|
-
agentId: string;
|
|
1594
|
-
gitlabUsernames: string[];
|
|
1595
|
-
keywords: string[];
|
|
1596
|
-
}[];
|
|
1597
|
-
token?: string | undefined;
|
|
1715
|
+
}[] | undefined;
|
|
1716
|
+
webhookPort?: number | undefined;
|
|
1598
1717
|
webhookSecret?: string | undefined;
|
|
1599
|
-
|
|
1600
|
-
|
|
1718
|
+
host?: string | undefined;
|
|
1719
|
+
agentMappings?: {
|
|
1720
|
+
agentId: string;
|
|
1721
|
+
token?: string | undefined;
|
|
1722
|
+
gitlabUsernames?: string[] | undefined;
|
|
1723
|
+
keywords?: string[] | undefined;
|
|
1724
|
+
}[] | undefined;
|
|
1725
|
+
} | undefined;
|
|
1601
1726
|
telegram?: {
|
|
1602
1727
|
enabled?: boolean | undefined;
|
|
1603
1728
|
accounts?: Record<string, {
|
|
@@ -1625,22 +1750,6 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1625
1750
|
token?: string | undefined;
|
|
1626
1751
|
agentBinding?: string | undefined;
|
|
1627
1752
|
} | undefined;
|
|
1628
|
-
gitlab?: {
|
|
1629
|
-
enabled?: boolean | undefined;
|
|
1630
|
-
token?: string | undefined;
|
|
1631
|
-
host?: string | undefined;
|
|
1632
|
-
routes?: {
|
|
1633
|
-
agent: string;
|
|
1634
|
-
project: string;
|
|
1635
|
-
}[] | undefined;
|
|
1636
|
-
webhookPort?: number | undefined;
|
|
1637
|
-
webhookSecret?: string | undefined;
|
|
1638
|
-
agentMappings?: {
|
|
1639
|
-
agentId: string;
|
|
1640
|
-
gitlabUsernames?: string[] | undefined;
|
|
1641
|
-
keywords?: string[] | undefined;
|
|
1642
|
-
}[] | undefined;
|
|
1643
|
-
} | undefined;
|
|
1644
1753
|
}>>;
|
|
1645
1754
|
crons: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1646
1755
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1650,16 +1759,34 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1650
1759
|
prompt: z.ZodString;
|
|
1651
1760
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
1652
1761
|
model: z.ZodOptional<z.ZodString>;
|
|
1653
|
-
onError: z.ZodDefault<z.ZodEnum<["log", "notify", "disable"]
|
|
1762
|
+
onError: z.ZodEffects<z.ZodDefault<z.ZodUnion<[z.ZodEnum<["log", "notify", "disable"]>, z.ZodArray<z.ZodEnum<["log", "notify", "disable"]>, "many">]>>, ("log" | "notify" | "disable")[], "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined>;
|
|
1763
|
+
notify: z.ZodOptional<z.ZodObject<{
|
|
1764
|
+
channel: z.ZodString;
|
|
1765
|
+
chatId: z.ZodString;
|
|
1766
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
1767
|
+
}, "strip", z.ZodTypeAny, {
|
|
1768
|
+
channel: string;
|
|
1769
|
+
chatId: string;
|
|
1770
|
+
accountId?: string | undefined;
|
|
1771
|
+
}, {
|
|
1772
|
+
channel: string;
|
|
1773
|
+
chatId: string;
|
|
1774
|
+
accountId?: string | undefined;
|
|
1775
|
+
}>>;
|
|
1654
1776
|
}, "strip", z.ZodTypeAny, {
|
|
1655
1777
|
enabled: boolean;
|
|
1656
1778
|
agent: string;
|
|
1657
|
-
timeout: number;
|
|
1658
1779
|
prompt: string;
|
|
1780
|
+
timeout: number;
|
|
1659
1781
|
schedule: string;
|
|
1660
1782
|
timezone: string;
|
|
1661
|
-
onError: "log" | "notify" | "disable";
|
|
1783
|
+
onError: ("log" | "notify" | "disable")[];
|
|
1662
1784
|
model?: string | undefined;
|
|
1785
|
+
notify?: {
|
|
1786
|
+
channel: string;
|
|
1787
|
+
chatId: string;
|
|
1788
|
+
accountId?: string | undefined;
|
|
1789
|
+
} | undefined;
|
|
1663
1790
|
}, {
|
|
1664
1791
|
agent: string;
|
|
1665
1792
|
prompt: string;
|
|
@@ -1668,8 +1795,132 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1668
1795
|
enabled?: boolean | undefined;
|
|
1669
1796
|
timeout?: number | undefined;
|
|
1670
1797
|
timezone?: string | undefined;
|
|
1671
|
-
|
|
1798
|
+
notify?: {
|
|
1799
|
+
channel: string;
|
|
1800
|
+
chatId: string;
|
|
1801
|
+
accountId?: string | undefined;
|
|
1802
|
+
} | undefined;
|
|
1803
|
+
onError?: "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined;
|
|
1804
|
+
}>>>;
|
|
1805
|
+
services: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1806
|
+
name: z.ZodString;
|
|
1807
|
+
triggers: z.ZodArray<z.ZodObject<{
|
|
1808
|
+
pattern: z.ZodString;
|
|
1809
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
1810
|
+
}, "strip", z.ZodTypeAny, {
|
|
1811
|
+
pattern: string;
|
|
1812
|
+
channel?: string | undefined;
|
|
1813
|
+
}, {
|
|
1814
|
+
pattern: string;
|
|
1815
|
+
channel?: string | undefined;
|
|
1816
|
+
}>, "many">;
|
|
1817
|
+
allowedContacts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1818
|
+
agent: z.ZodString;
|
|
1819
|
+
prompt: z.ZodString;
|
|
1820
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
1821
|
+
timezone: z.ZodDefault<z.ZodString>;
|
|
1822
|
+
notify: z.ZodOptional<z.ZodObject<{
|
|
1823
|
+
channel: z.ZodString;
|
|
1824
|
+
chatId: z.ZodString;
|
|
1825
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
1826
|
+
}, "strip", z.ZodTypeAny, {
|
|
1827
|
+
channel: string;
|
|
1828
|
+
chatId: string;
|
|
1829
|
+
accountId?: string | undefined;
|
|
1830
|
+
}, {
|
|
1831
|
+
channel: string;
|
|
1832
|
+
chatId: string;
|
|
1833
|
+
accountId?: string | undefined;
|
|
1834
|
+
}>>;
|
|
1835
|
+
}, "strip", z.ZodTypeAny, {
|
|
1836
|
+
agent: string;
|
|
1837
|
+
name: string;
|
|
1838
|
+
prompt: string;
|
|
1839
|
+
triggers: {
|
|
1840
|
+
pattern: string;
|
|
1841
|
+
channel?: string | undefined;
|
|
1842
|
+
}[];
|
|
1843
|
+
timezone: string;
|
|
1844
|
+
schedule?: string | undefined;
|
|
1845
|
+
notify?: {
|
|
1846
|
+
channel: string;
|
|
1847
|
+
chatId: string;
|
|
1848
|
+
accountId?: string | undefined;
|
|
1849
|
+
} | undefined;
|
|
1850
|
+
allowedContacts?: string[] | undefined;
|
|
1851
|
+
}, {
|
|
1852
|
+
agent: string;
|
|
1853
|
+
name: string;
|
|
1854
|
+
prompt: string;
|
|
1855
|
+
triggers: {
|
|
1856
|
+
pattern: string;
|
|
1857
|
+
channel?: string | undefined;
|
|
1858
|
+
}[];
|
|
1859
|
+
schedule?: string | undefined;
|
|
1860
|
+
timezone?: string | undefined;
|
|
1861
|
+
notify?: {
|
|
1862
|
+
channel: string;
|
|
1863
|
+
chatId: string;
|
|
1864
|
+
accountId?: string | undefined;
|
|
1865
|
+
} | undefined;
|
|
1866
|
+
allowedContacts?: string[] | undefined;
|
|
1672
1867
|
}>>>;
|
|
1868
|
+
notifications: z.ZodDefault<z.ZodObject<{
|
|
1869
|
+
/** Send notification when task takes longer than this (seconds). 0 = disabled. */
|
|
1870
|
+
longTaskThreshold: z.ZodDefault<z.ZodNumber>;
|
|
1871
|
+
/** Where to send notifications */
|
|
1872
|
+
destination: z.ZodOptional<z.ZodObject<{
|
|
1873
|
+
channel: z.ZodString;
|
|
1874
|
+
chatId: z.ZodString;
|
|
1875
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
1876
|
+
}, "strip", z.ZodTypeAny, {
|
|
1877
|
+
channel: string;
|
|
1878
|
+
chatId: string;
|
|
1879
|
+
accountId?: string | undefined;
|
|
1880
|
+
}, {
|
|
1881
|
+
channel: string;
|
|
1882
|
+
chatId: string;
|
|
1883
|
+
accountId?: string | undefined;
|
|
1884
|
+
}>>;
|
|
1885
|
+
/** Notify on these events */
|
|
1886
|
+
on: z.ZodDefault<z.ZodObject<{
|
|
1887
|
+
taskComplete: z.ZodDefault<z.ZodBoolean>;
|
|
1888
|
+
taskError: z.ZodDefault<z.ZodBoolean>;
|
|
1889
|
+
taskQueued: z.ZodDefault<z.ZodBoolean>;
|
|
1890
|
+
}, "strip", z.ZodTypeAny, {
|
|
1891
|
+
taskComplete: boolean;
|
|
1892
|
+
taskError: boolean;
|
|
1893
|
+
taskQueued: boolean;
|
|
1894
|
+
}, {
|
|
1895
|
+
taskComplete?: boolean | undefined;
|
|
1896
|
+
taskError?: boolean | undefined;
|
|
1897
|
+
taskQueued?: boolean | undefined;
|
|
1898
|
+
}>>;
|
|
1899
|
+
}, "strip", z.ZodTypeAny, {
|
|
1900
|
+
on: {
|
|
1901
|
+
taskComplete: boolean;
|
|
1902
|
+
taskError: boolean;
|
|
1903
|
+
taskQueued: boolean;
|
|
1904
|
+
};
|
|
1905
|
+
longTaskThreshold: number;
|
|
1906
|
+
destination?: {
|
|
1907
|
+
channel: string;
|
|
1908
|
+
chatId: string;
|
|
1909
|
+
accountId?: string | undefined;
|
|
1910
|
+
} | undefined;
|
|
1911
|
+
}, {
|
|
1912
|
+
on?: {
|
|
1913
|
+
taskComplete?: boolean | undefined;
|
|
1914
|
+
taskError?: boolean | undefined;
|
|
1915
|
+
taskQueued?: boolean | undefined;
|
|
1916
|
+
} | undefined;
|
|
1917
|
+
longTaskThreshold?: number | undefined;
|
|
1918
|
+
destination?: {
|
|
1919
|
+
channel: string;
|
|
1920
|
+
chatId: string;
|
|
1921
|
+
accountId?: string | undefined;
|
|
1922
|
+
} | undefined;
|
|
1923
|
+
}>>;
|
|
1673
1924
|
mesh: z.ZodDefault<z.ZodObject<{
|
|
1674
1925
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1675
1926
|
peers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -1721,6 +1972,216 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1721
1972
|
interval?: number | undefined;
|
|
1722
1973
|
} | undefined;
|
|
1723
1974
|
}>>;
|
|
1975
|
+
business: z.ZodOptional<z.ZodObject<{
|
|
1976
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1977
|
+
timezone: z.ZodDefault<z.ZodString>;
|
|
1978
|
+
mainChannel: z.ZodObject<{
|
|
1979
|
+
channel: z.ZodString;
|
|
1980
|
+
chatId: z.ZodString;
|
|
1981
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
1982
|
+
}, "strip", z.ZodTypeAny, {
|
|
1983
|
+
channel: string;
|
|
1984
|
+
chatId: string;
|
|
1985
|
+
accountId?: string | undefined;
|
|
1986
|
+
}, {
|
|
1987
|
+
channel: string;
|
|
1988
|
+
chatId: string;
|
|
1989
|
+
accountId?: string | undefined;
|
|
1990
|
+
}>;
|
|
1991
|
+
workSource: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1992
|
+
type: z.ZodLiteral<"backlog">;
|
|
1993
|
+
path: z.ZodDefault<z.ZodString>;
|
|
1994
|
+
}, "strip", z.ZodTypeAny, {
|
|
1995
|
+
path: string;
|
|
1996
|
+
type: "backlog";
|
|
1997
|
+
}, {
|
|
1998
|
+
type: "backlog";
|
|
1999
|
+
path?: string | undefined;
|
|
2000
|
+
}>, z.ZodObject<{
|
|
2001
|
+
type: z.ZodLiteral<"gitlab">;
|
|
2002
|
+
projects: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2003
|
+
}, "strip", z.ZodTypeAny, {
|
|
2004
|
+
type: "gitlab";
|
|
2005
|
+
projects: string[];
|
|
2006
|
+
}, {
|
|
2007
|
+
type: "gitlab";
|
|
2008
|
+
projects?: string[] | undefined;
|
|
2009
|
+
}>, z.ZodObject<{
|
|
2010
|
+
type: z.ZodLiteral<"wiki">;
|
|
2011
|
+
path: z.ZodString;
|
|
2012
|
+
glob: z.ZodDefault<z.ZodString>;
|
|
2013
|
+
}, "strip", z.ZodTypeAny, {
|
|
2014
|
+
path: string;
|
|
2015
|
+
type: "wiki";
|
|
2016
|
+
glob: string;
|
|
2017
|
+
}, {
|
|
2018
|
+
path: string;
|
|
2019
|
+
type: "wiki";
|
|
2020
|
+
glob?: string | undefined;
|
|
2021
|
+
}>]>;
|
|
2022
|
+
roles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2023
|
+
title: z.ZodString;
|
|
2024
|
+
responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2025
|
+
sopPath: z.ZodOptional<z.ZodString>;
|
|
2026
|
+
kpis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2027
|
+
}, "strip", z.ZodTypeAny, {
|
|
2028
|
+
title: string;
|
|
2029
|
+
responsibilities: string[];
|
|
2030
|
+
kpis: string[];
|
|
2031
|
+
sopPath?: string | undefined;
|
|
2032
|
+
}, {
|
|
2033
|
+
title: string;
|
|
2034
|
+
responsibilities?: string[] | undefined;
|
|
2035
|
+
sopPath?: string | undefined;
|
|
2036
|
+
kpis?: string[] | undefined;
|
|
2037
|
+
}>>>;
|
|
2038
|
+
orgChart: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2039
|
+
role: z.ZodString;
|
|
2040
|
+
reportsTo: z.ZodOptional<z.ZodString>;
|
|
2041
|
+
schedule: z.ZodObject<{
|
|
2042
|
+
days: z.ZodDefault<z.ZodArray<z.ZodEnum<["mon", "tue", "wed", "thu", "fri", "sat", "sun"]>, "many">>;
|
|
2043
|
+
start: z.ZodString;
|
|
2044
|
+
end: z.ZodString;
|
|
2045
|
+
lunch: z.ZodOptional<z.ZodObject<{
|
|
2046
|
+
start: z.ZodString;
|
|
2047
|
+
end: z.ZodString;
|
|
2048
|
+
}, "strip", z.ZodTypeAny, {
|
|
2049
|
+
start: string;
|
|
2050
|
+
end: string;
|
|
2051
|
+
}, {
|
|
2052
|
+
start: string;
|
|
2053
|
+
end: string;
|
|
2054
|
+
}>>;
|
|
2055
|
+
}, "strip", z.ZodTypeAny, {
|
|
2056
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
2057
|
+
start: string;
|
|
2058
|
+
end: string;
|
|
2059
|
+
lunch?: {
|
|
2060
|
+
start: string;
|
|
2061
|
+
end: string;
|
|
2062
|
+
} | undefined;
|
|
2063
|
+
}, {
|
|
2064
|
+
start: string;
|
|
2065
|
+
end: string;
|
|
2066
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
2067
|
+
lunch?: {
|
|
2068
|
+
start: string;
|
|
2069
|
+
end: string;
|
|
2070
|
+
} | undefined;
|
|
2071
|
+
}>;
|
|
2072
|
+
utilizationTarget: z.ZodDefault<z.ZodNumber>;
|
|
2073
|
+
}, "strip", z.ZodTypeAny, {
|
|
2074
|
+
role: string;
|
|
2075
|
+
schedule: {
|
|
2076
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
2077
|
+
start: string;
|
|
2078
|
+
end: string;
|
|
2079
|
+
lunch?: {
|
|
2080
|
+
start: string;
|
|
2081
|
+
end: string;
|
|
2082
|
+
} | undefined;
|
|
2083
|
+
};
|
|
2084
|
+
utilizationTarget: number;
|
|
2085
|
+
reportsTo?: string | undefined;
|
|
2086
|
+
}, {
|
|
2087
|
+
role: string;
|
|
2088
|
+
schedule: {
|
|
2089
|
+
start: string;
|
|
2090
|
+
end: string;
|
|
2091
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
2092
|
+
lunch?: {
|
|
2093
|
+
start: string;
|
|
2094
|
+
end: string;
|
|
2095
|
+
} | undefined;
|
|
2096
|
+
};
|
|
2097
|
+
reportsTo?: string | undefined;
|
|
2098
|
+
utilizationTarget?: number | undefined;
|
|
2099
|
+
}>>>;
|
|
2100
|
+
workTickMinutes: z.ZodDefault<z.ZodNumber>;
|
|
2101
|
+
idleQueueThreshold: z.ZodDefault<z.ZodNumber>;
|
|
2102
|
+
}, "strip", z.ZodTypeAny, {
|
|
2103
|
+
enabled: boolean;
|
|
2104
|
+
timezone: string;
|
|
2105
|
+
mainChannel: {
|
|
2106
|
+
channel: string;
|
|
2107
|
+
chatId: string;
|
|
2108
|
+
accountId?: string | undefined;
|
|
2109
|
+
};
|
|
2110
|
+
workSource: {
|
|
2111
|
+
path: string;
|
|
2112
|
+
type: "backlog";
|
|
2113
|
+
} | {
|
|
2114
|
+
type: "gitlab";
|
|
2115
|
+
projects: string[];
|
|
2116
|
+
} | {
|
|
2117
|
+
path: string;
|
|
2118
|
+
type: "wiki";
|
|
2119
|
+
glob: string;
|
|
2120
|
+
};
|
|
2121
|
+
roles: Record<string, {
|
|
2122
|
+
title: string;
|
|
2123
|
+
responsibilities: string[];
|
|
2124
|
+
kpis: string[];
|
|
2125
|
+
sopPath?: string | undefined;
|
|
2126
|
+
}>;
|
|
2127
|
+
orgChart: Record<string, {
|
|
2128
|
+
role: string;
|
|
2129
|
+
schedule: {
|
|
2130
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
2131
|
+
start: string;
|
|
2132
|
+
end: string;
|
|
2133
|
+
lunch?: {
|
|
2134
|
+
start: string;
|
|
2135
|
+
end: string;
|
|
2136
|
+
} | undefined;
|
|
2137
|
+
};
|
|
2138
|
+
utilizationTarget: number;
|
|
2139
|
+
reportsTo?: string | undefined;
|
|
2140
|
+
}>;
|
|
2141
|
+
workTickMinutes: number;
|
|
2142
|
+
idleQueueThreshold: number;
|
|
2143
|
+
}, {
|
|
2144
|
+
mainChannel: {
|
|
2145
|
+
channel: string;
|
|
2146
|
+
chatId: string;
|
|
2147
|
+
accountId?: string | undefined;
|
|
2148
|
+
};
|
|
2149
|
+
workSource: {
|
|
2150
|
+
type: "backlog";
|
|
2151
|
+
path?: string | undefined;
|
|
2152
|
+
} | {
|
|
2153
|
+
type: "gitlab";
|
|
2154
|
+
projects?: string[] | undefined;
|
|
2155
|
+
} | {
|
|
2156
|
+
path: string;
|
|
2157
|
+
type: "wiki";
|
|
2158
|
+
glob?: string | undefined;
|
|
2159
|
+
};
|
|
2160
|
+
enabled?: boolean | undefined;
|
|
2161
|
+
timezone?: string | undefined;
|
|
2162
|
+
roles?: Record<string, {
|
|
2163
|
+
title: string;
|
|
2164
|
+
responsibilities?: string[] | undefined;
|
|
2165
|
+
sopPath?: string | undefined;
|
|
2166
|
+
kpis?: string[] | undefined;
|
|
2167
|
+
}> | undefined;
|
|
2168
|
+
orgChart?: Record<string, {
|
|
2169
|
+
role: string;
|
|
2170
|
+
schedule: {
|
|
2171
|
+
start: string;
|
|
2172
|
+
end: string;
|
|
2173
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
2174
|
+
lunch?: {
|
|
2175
|
+
start: string;
|
|
2176
|
+
end: string;
|
|
2177
|
+
} | undefined;
|
|
2178
|
+
};
|
|
2179
|
+
reportsTo?: string | undefined;
|
|
2180
|
+
utilizationTarget?: number | undefined;
|
|
2181
|
+
}> | undefined;
|
|
2182
|
+
workTickMinutes?: number | undefined;
|
|
2183
|
+
idleQueueThreshold?: number | undefined;
|
|
2184
|
+
}>>;
|
|
1724
2185
|
}, "strip", z.ZodTypeAny, {
|
|
1725
2186
|
agents: Record<string, {
|
|
1726
2187
|
name: string;
|
|
@@ -1729,14 +2190,35 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1729
2190
|
mentions: string[];
|
|
1730
2191
|
maxConcurrent: number;
|
|
1731
2192
|
permissionMode: string;
|
|
2193
|
+
queueMode: "collect" | "followup" | "drop";
|
|
2194
|
+
heartbeat: {
|
|
2195
|
+
enabled: boolean;
|
|
2196
|
+
prompt: string;
|
|
2197
|
+
channel: string;
|
|
2198
|
+
intervalMinutes: number;
|
|
2199
|
+
};
|
|
1732
2200
|
provider?: string | undefined;
|
|
1733
2201
|
model?: string | undefined;
|
|
1734
2202
|
systemPrompt?: string | undefined;
|
|
1735
2203
|
}>;
|
|
2204
|
+
mesh: {
|
|
2205
|
+
enabled: boolean;
|
|
2206
|
+
peers: {
|
|
2207
|
+
name: string;
|
|
2208
|
+
url: string;
|
|
2209
|
+
token?: string | undefined;
|
|
2210
|
+
}[];
|
|
2211
|
+
discovery: "static" | "mdns";
|
|
2212
|
+
healthCheck: {
|
|
2213
|
+
timeout: number;
|
|
2214
|
+
interval: number;
|
|
2215
|
+
};
|
|
2216
|
+
};
|
|
1736
2217
|
node: {
|
|
1737
2218
|
id: string;
|
|
1738
2219
|
name: string;
|
|
1739
2220
|
bind: string;
|
|
2221
|
+
defaultAgent?: string | undefined;
|
|
1740
2222
|
};
|
|
1741
2223
|
providers: Record<string, {
|
|
1742
2224
|
apiKey?: string | undefined;
|
|
@@ -1744,6 +2226,23 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1744
2226
|
baseUrl?: string | undefined;
|
|
1745
2227
|
}>;
|
|
1746
2228
|
channels: {
|
|
2229
|
+
gitlab: {
|
|
2230
|
+
enabled: boolean;
|
|
2231
|
+
routes: {
|
|
2232
|
+
agent: string;
|
|
2233
|
+
project: string;
|
|
2234
|
+
}[];
|
|
2235
|
+
webhookPort: number;
|
|
2236
|
+
host: string;
|
|
2237
|
+
agentMappings: {
|
|
2238
|
+
agentId: string;
|
|
2239
|
+
gitlabUsernames: string[];
|
|
2240
|
+
keywords: string[];
|
|
2241
|
+
token?: string | undefined;
|
|
2242
|
+
}[];
|
|
2243
|
+
token?: string | undefined;
|
|
2244
|
+
webhookSecret?: string | undefined;
|
|
2245
|
+
};
|
|
1747
2246
|
telegram: {
|
|
1748
2247
|
enabled: boolean;
|
|
1749
2248
|
accounts: Record<string, {
|
|
@@ -1771,50 +2270,99 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1771
2270
|
token?: string | undefined;
|
|
1772
2271
|
agentBinding?: string | undefined;
|
|
1773
2272
|
};
|
|
1774
|
-
gitlab: {
|
|
1775
|
-
enabled: boolean;
|
|
1776
|
-
host: string;
|
|
1777
|
-
routes: {
|
|
1778
|
-
agent: string;
|
|
1779
|
-
project: string;
|
|
1780
|
-
}[];
|
|
1781
|
-
webhookPort: number;
|
|
1782
|
-
agentMappings: {
|
|
1783
|
-
agentId: string;
|
|
1784
|
-
gitlabUsernames: string[];
|
|
1785
|
-
keywords: string[];
|
|
1786
|
-
}[];
|
|
1787
|
-
token?: string | undefined;
|
|
1788
|
-
webhookSecret?: string | undefined;
|
|
1789
|
-
};
|
|
1790
2273
|
};
|
|
1791
2274
|
crons: Record<string, {
|
|
1792
2275
|
enabled: boolean;
|
|
1793
2276
|
agent: string;
|
|
1794
|
-
timeout: number;
|
|
1795
2277
|
prompt: string;
|
|
2278
|
+
timeout: number;
|
|
1796
2279
|
schedule: string;
|
|
1797
2280
|
timezone: string;
|
|
1798
|
-
onError: "log" | "notify" | "disable";
|
|
2281
|
+
onError: ("log" | "notify" | "disable")[];
|
|
1799
2282
|
model?: string | undefined;
|
|
2283
|
+
notify?: {
|
|
2284
|
+
channel: string;
|
|
2285
|
+
chatId: string;
|
|
2286
|
+
accountId?: string | undefined;
|
|
2287
|
+
} | undefined;
|
|
1800
2288
|
}>;
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
2289
|
+
services: Record<string, {
|
|
2290
|
+
agent: string;
|
|
2291
|
+
name: string;
|
|
2292
|
+
prompt: string;
|
|
2293
|
+
triggers: {
|
|
2294
|
+
pattern: string;
|
|
2295
|
+
channel?: string | undefined;
|
|
1807
2296
|
}[];
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
2297
|
+
timezone: string;
|
|
2298
|
+
schedule?: string | undefined;
|
|
2299
|
+
notify?: {
|
|
2300
|
+
channel: string;
|
|
2301
|
+
chatId: string;
|
|
2302
|
+
accountId?: string | undefined;
|
|
2303
|
+
} | undefined;
|
|
2304
|
+
allowedContacts?: string[] | undefined;
|
|
2305
|
+
}>;
|
|
2306
|
+
notifications: {
|
|
2307
|
+
on: {
|
|
2308
|
+
taskComplete: boolean;
|
|
2309
|
+
taskError: boolean;
|
|
2310
|
+
taskQueued: boolean;
|
|
1812
2311
|
};
|
|
2312
|
+
longTaskThreshold: number;
|
|
2313
|
+
destination?: {
|
|
2314
|
+
channel: string;
|
|
2315
|
+
chatId: string;
|
|
2316
|
+
accountId?: string | undefined;
|
|
2317
|
+
} | undefined;
|
|
1813
2318
|
};
|
|
2319
|
+
business?: {
|
|
2320
|
+
enabled: boolean;
|
|
2321
|
+
timezone: string;
|
|
2322
|
+
mainChannel: {
|
|
2323
|
+
channel: string;
|
|
2324
|
+
chatId: string;
|
|
2325
|
+
accountId?: string | undefined;
|
|
2326
|
+
};
|
|
2327
|
+
workSource: {
|
|
2328
|
+
path: string;
|
|
2329
|
+
type: "backlog";
|
|
2330
|
+
} | {
|
|
2331
|
+
type: "gitlab";
|
|
2332
|
+
projects: string[];
|
|
2333
|
+
} | {
|
|
2334
|
+
path: string;
|
|
2335
|
+
type: "wiki";
|
|
2336
|
+
glob: string;
|
|
2337
|
+
};
|
|
2338
|
+
roles: Record<string, {
|
|
2339
|
+
title: string;
|
|
2340
|
+
responsibilities: string[];
|
|
2341
|
+
kpis: string[];
|
|
2342
|
+
sopPath?: string | undefined;
|
|
2343
|
+
}>;
|
|
2344
|
+
orgChart: Record<string, {
|
|
2345
|
+
role: string;
|
|
2346
|
+
schedule: {
|
|
2347
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
2348
|
+
start: string;
|
|
2349
|
+
end: string;
|
|
2350
|
+
lunch?: {
|
|
2351
|
+
start: string;
|
|
2352
|
+
end: string;
|
|
2353
|
+
} | undefined;
|
|
2354
|
+
};
|
|
2355
|
+
utilizationTarget: number;
|
|
2356
|
+
reportsTo?: string | undefined;
|
|
2357
|
+
}>;
|
|
2358
|
+
workTickMinutes: number;
|
|
2359
|
+
idleQueueThreshold: number;
|
|
2360
|
+
} | undefined;
|
|
1814
2361
|
}, {
|
|
1815
2362
|
node: {
|
|
1816
2363
|
id: string;
|
|
1817
2364
|
name: string;
|
|
2365
|
+
defaultAgent?: string | undefined;
|
|
1818
2366
|
bind?: string | undefined;
|
|
1819
2367
|
};
|
|
1820
2368
|
agents?: Record<string, {
|
|
@@ -1822,18 +2370,55 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1822
2370
|
workspace: string;
|
|
1823
2371
|
provider?: string | undefined;
|
|
1824
2372
|
model?: string | undefined;
|
|
1825
|
-
systemPrompt?: string | undefined;
|
|
1826
2373
|
tier?: "claude-code" | "sdk" | "orchestrator" | undefined;
|
|
2374
|
+
systemPrompt?: string | undefined;
|
|
1827
2375
|
mentions?: string[] | undefined;
|
|
1828
2376
|
maxConcurrent?: number | undefined;
|
|
1829
2377
|
permissionMode?: string | undefined;
|
|
2378
|
+
queueMode?: "collect" | "followup" | "drop" | undefined;
|
|
2379
|
+
heartbeat?: {
|
|
2380
|
+
enabled?: boolean | undefined;
|
|
2381
|
+
prompt?: string | undefined;
|
|
2382
|
+
channel?: string | undefined;
|
|
2383
|
+
intervalMinutes?: number | undefined;
|
|
2384
|
+
} | undefined;
|
|
1830
2385
|
}> | undefined;
|
|
2386
|
+
mesh?: {
|
|
2387
|
+
enabled?: boolean | undefined;
|
|
2388
|
+
peers?: {
|
|
2389
|
+
name: string;
|
|
2390
|
+
url: string;
|
|
2391
|
+
token?: string | undefined;
|
|
2392
|
+
}[] | undefined;
|
|
2393
|
+
discovery?: "static" | "mdns" | undefined;
|
|
2394
|
+
healthCheck?: {
|
|
2395
|
+
timeout?: number | undefined;
|
|
2396
|
+
interval?: number | undefined;
|
|
2397
|
+
} | undefined;
|
|
2398
|
+
} | undefined;
|
|
1831
2399
|
providers?: Record<string, {
|
|
1832
2400
|
apiKey?: string | undefined;
|
|
1833
2401
|
defaultModel?: string | undefined;
|
|
1834
2402
|
baseUrl?: string | undefined;
|
|
1835
2403
|
}> | undefined;
|
|
1836
2404
|
channels?: {
|
|
2405
|
+
gitlab?: {
|
|
2406
|
+
enabled?: boolean | undefined;
|
|
2407
|
+
token?: string | undefined;
|
|
2408
|
+
routes?: {
|
|
2409
|
+
agent: string;
|
|
2410
|
+
project: string;
|
|
2411
|
+
}[] | undefined;
|
|
2412
|
+
webhookPort?: number | undefined;
|
|
2413
|
+
webhookSecret?: string | undefined;
|
|
2414
|
+
host?: string | undefined;
|
|
2415
|
+
agentMappings?: {
|
|
2416
|
+
agentId: string;
|
|
2417
|
+
token?: string | undefined;
|
|
2418
|
+
gitlabUsernames?: string[] | undefined;
|
|
2419
|
+
keywords?: string[] | undefined;
|
|
2420
|
+
}[] | undefined;
|
|
2421
|
+
} | undefined;
|
|
1837
2422
|
telegram?: {
|
|
1838
2423
|
enabled?: boolean | undefined;
|
|
1839
2424
|
accounts?: Record<string, {
|
|
@@ -1861,22 +2446,6 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1861
2446
|
token?: string | undefined;
|
|
1862
2447
|
agentBinding?: string | undefined;
|
|
1863
2448
|
} | undefined;
|
|
1864
|
-
gitlab?: {
|
|
1865
|
-
enabled?: boolean | undefined;
|
|
1866
|
-
token?: string | undefined;
|
|
1867
|
-
host?: string | undefined;
|
|
1868
|
-
routes?: {
|
|
1869
|
-
agent: string;
|
|
1870
|
-
project: string;
|
|
1871
|
-
}[] | undefined;
|
|
1872
|
-
webhookPort?: number | undefined;
|
|
1873
|
-
webhookSecret?: string | undefined;
|
|
1874
|
-
agentMappings?: {
|
|
1875
|
-
agentId: string;
|
|
1876
|
-
gitlabUsernames?: string[] | undefined;
|
|
1877
|
-
keywords?: string[] | undefined;
|
|
1878
|
-
}[] | undefined;
|
|
1879
|
-
} | undefined;
|
|
1880
2449
|
} | undefined;
|
|
1881
2450
|
crons?: Record<string, {
|
|
1882
2451
|
agent: string;
|
|
@@ -1886,20 +2455,84 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
1886
2455
|
enabled?: boolean | undefined;
|
|
1887
2456
|
timeout?: number | undefined;
|
|
1888
2457
|
timezone?: string | undefined;
|
|
1889
|
-
|
|
2458
|
+
notify?: {
|
|
2459
|
+
channel: string;
|
|
2460
|
+
chatId: string;
|
|
2461
|
+
accountId?: string | undefined;
|
|
2462
|
+
} | undefined;
|
|
2463
|
+
onError?: "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined;
|
|
1890
2464
|
}> | undefined;
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
2465
|
+
services?: Record<string, {
|
|
2466
|
+
agent: string;
|
|
2467
|
+
name: string;
|
|
2468
|
+
prompt: string;
|
|
2469
|
+
triggers: {
|
|
2470
|
+
pattern: string;
|
|
2471
|
+
channel?: string | undefined;
|
|
2472
|
+
}[];
|
|
2473
|
+
schedule?: string | undefined;
|
|
2474
|
+
timezone?: string | undefined;
|
|
2475
|
+
notify?: {
|
|
2476
|
+
channel: string;
|
|
2477
|
+
chatId: string;
|
|
2478
|
+
accountId?: string | undefined;
|
|
2479
|
+
} | undefined;
|
|
2480
|
+
allowedContacts?: string[] | undefined;
|
|
2481
|
+
}> | undefined;
|
|
2482
|
+
notifications?: {
|
|
2483
|
+
on?: {
|
|
2484
|
+
taskComplete?: boolean | undefined;
|
|
2485
|
+
taskError?: boolean | undefined;
|
|
2486
|
+
taskQueued?: boolean | undefined;
|
|
1902
2487
|
} | undefined;
|
|
2488
|
+
longTaskThreshold?: number | undefined;
|
|
2489
|
+
destination?: {
|
|
2490
|
+
channel: string;
|
|
2491
|
+
chatId: string;
|
|
2492
|
+
accountId?: string | undefined;
|
|
2493
|
+
} | undefined;
|
|
2494
|
+
} | undefined;
|
|
2495
|
+
business?: {
|
|
2496
|
+
mainChannel: {
|
|
2497
|
+
channel: string;
|
|
2498
|
+
chatId: string;
|
|
2499
|
+
accountId?: string | undefined;
|
|
2500
|
+
};
|
|
2501
|
+
workSource: {
|
|
2502
|
+
type: "backlog";
|
|
2503
|
+
path?: string | undefined;
|
|
2504
|
+
} | {
|
|
2505
|
+
type: "gitlab";
|
|
2506
|
+
projects?: string[] | undefined;
|
|
2507
|
+
} | {
|
|
2508
|
+
path: string;
|
|
2509
|
+
type: "wiki";
|
|
2510
|
+
glob?: string | undefined;
|
|
2511
|
+
};
|
|
2512
|
+
enabled?: boolean | undefined;
|
|
2513
|
+
timezone?: string | undefined;
|
|
2514
|
+
roles?: Record<string, {
|
|
2515
|
+
title: string;
|
|
2516
|
+
responsibilities?: string[] | undefined;
|
|
2517
|
+
sopPath?: string | undefined;
|
|
2518
|
+
kpis?: string[] | undefined;
|
|
2519
|
+
}> | undefined;
|
|
2520
|
+
orgChart?: Record<string, {
|
|
2521
|
+
role: string;
|
|
2522
|
+
schedule: {
|
|
2523
|
+
start: string;
|
|
2524
|
+
end: string;
|
|
2525
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
2526
|
+
lunch?: {
|
|
2527
|
+
start: string;
|
|
2528
|
+
end: string;
|
|
2529
|
+
} | undefined;
|
|
2530
|
+
};
|
|
2531
|
+
reportsTo?: string | undefined;
|
|
2532
|
+
utilizationTarget?: number | undefined;
|
|
2533
|
+
}> | undefined;
|
|
2534
|
+
workTickMinutes?: number | undefined;
|
|
2535
|
+
idleQueueThreshold?: number | undefined;
|
|
1903
2536
|
} | undefined;
|
|
1904
2537
|
}>;
|
|
1905
2538
|
type DaemonConfig = z.infer<typeof daemonConfigSchema>;
|
|
@@ -1968,14 +2601,30 @@ declare class AgentXDaemon {
|
|
|
1968
2601
|
private cron;
|
|
1969
2602
|
private mesh?;
|
|
1970
2603
|
private hooks;
|
|
2604
|
+
private landscape;
|
|
2605
|
+
private heartbeat;
|
|
2606
|
+
private business?;
|
|
1971
2607
|
private httpServer?;
|
|
1972
2608
|
private webhooks;
|
|
1973
2609
|
private log;
|
|
2610
|
+
private sseClients;
|
|
1974
2611
|
constructor(configPath?: string);
|
|
1975
2612
|
start(): Promise<void>;
|
|
1976
2613
|
stop(): Promise<void>;
|
|
2614
|
+
private midnightTimer?;
|
|
2615
|
+
private scheduleMidnightHook;
|
|
2616
|
+
private runDailyCostReport;
|
|
1977
2617
|
private startChannels;
|
|
1978
2618
|
private startHttpApi;
|
|
2619
|
+
/**
|
|
2620
|
+
* Broadcast an SSE event to all connected clients.
|
|
2621
|
+
*/
|
|
2622
|
+
private broadcastSSE;
|
|
2623
|
+
/**
|
|
2624
|
+
* Handle SSE connection for live event streaming.
|
|
2625
|
+
* GET /events — streams daemon logs in real-time.
|
|
2626
|
+
*/
|
|
2627
|
+
private handleSSE;
|
|
1979
2628
|
private handleHttp;
|
|
1980
2629
|
/**
|
|
1981
2630
|
* OpenAI-compatible chat completions endpoint.
|
|
@@ -2004,6 +2653,79 @@ interface AgentUsage {
|
|
|
2004
2653
|
cacheCreateTokens: number;
|
|
2005
2654
|
totalDuration: number;
|
|
2006
2655
|
errors: number;
|
|
2656
|
+
model?: string;
|
|
2657
|
+
}
|
|
2658
|
+
interface DailyReport {
|
|
2659
|
+
date: string;
|
|
2660
|
+
totalTasks: number;
|
|
2661
|
+
totalInput: number;
|
|
2662
|
+
totalOutput: number;
|
|
2663
|
+
totalCacheRead: number;
|
|
2664
|
+
totalCacheCreate: number;
|
|
2665
|
+
totalCost: number;
|
|
2666
|
+
topAgent: string;
|
|
2667
|
+
topCost: number;
|
|
2668
|
+
agentCosts: Record<string, number>;
|
|
2669
|
+
}
|
|
2670
|
+
declare class TokenTracker {
|
|
2671
|
+
private dir;
|
|
2672
|
+
private cache;
|
|
2673
|
+
constructor(baseDir?: string);
|
|
2674
|
+
/**
|
|
2675
|
+
* Calculate cost for an agent's usage with cache-aware pricing.
|
|
2676
|
+
*/
|
|
2677
|
+
static calculateCost(usage: AgentUsage): number;
|
|
2678
|
+
/**
|
|
2679
|
+
* Record a task execution with real or estimated token counts.
|
|
2680
|
+
*/
|
|
2681
|
+
record(agentId: string, duration: number, realUsage?: {
|
|
2682
|
+
inputTokens: number;
|
|
2683
|
+
outputTokens: number;
|
|
2684
|
+
cacheReadTokens: number;
|
|
2685
|
+
cacheCreateTokens: number;
|
|
2686
|
+
}, messageLength?: number, responseLength?: number, error?: boolean, model?: string): void;
|
|
2687
|
+
/**
|
|
2688
|
+
* Get today's usage summary.
|
|
2689
|
+
*/
|
|
2690
|
+
today(): DailyUsage;
|
|
2691
|
+
/**
|
|
2692
|
+
* Get usage for a specific date.
|
|
2693
|
+
*/
|
|
2694
|
+
getDate(date: string): DailyUsage | null;
|
|
2695
|
+
/**
|
|
2696
|
+
* Generate a daily cost report for a given date.
|
|
2697
|
+
*/
|
|
2698
|
+
generateDailyReport(date?: string): DailyReport | null;
|
|
2699
|
+
/**
|
|
2700
|
+
* Append a daily report row to TOKEN_COSTS.md.
|
|
2701
|
+
*/
|
|
2702
|
+
appendToTokenCosts(report: DailyReport, filePath?: string): void;
|
|
2703
|
+
/**
|
|
2704
|
+
* Get summary across last N days.
|
|
2705
|
+
*/
|
|
2706
|
+
summary(days?: number): {
|
|
2707
|
+
totalTasks: number;
|
|
2708
|
+
totalTokens: number;
|
|
2709
|
+
totalInput: number;
|
|
2710
|
+
totalOutput: number;
|
|
2711
|
+
totalCacheRead: number;
|
|
2712
|
+
totalCacheCreate: number;
|
|
2713
|
+
cacheHitRatio: number;
|
|
2714
|
+
totalErrors: number;
|
|
2715
|
+
totalCost: number;
|
|
2716
|
+
byAgent: Record<string, {
|
|
2717
|
+
tasks: number;
|
|
2718
|
+
input: number;
|
|
2719
|
+
output: number;
|
|
2720
|
+
cacheRead: number;
|
|
2721
|
+
cacheCreate: number;
|
|
2722
|
+
total: number;
|
|
2723
|
+
avgDuration: number;
|
|
2724
|
+
cost: number;
|
|
2725
|
+
}>;
|
|
2726
|
+
};
|
|
2727
|
+
private filePath;
|
|
2728
|
+
private save;
|
|
2007
2729
|
}
|
|
2008
2730
|
|
|
2009
2731
|
interface AgentPeer {
|
|
@@ -2018,7 +2740,13 @@ interface AgentTask {
|
|
|
2018
2740
|
context?: {
|
|
2019
2741
|
channel?: string;
|
|
2020
2742
|
sender?: string;
|
|
2743
|
+
/** Platform user ID (e.g. Telegram user ID) */
|
|
2744
|
+
senderId?: string;
|
|
2745
|
+
/** Platform username (e.g. @username) */
|
|
2746
|
+
senderUsername?: string;
|
|
2021
2747
|
group?: string;
|
|
2748
|
+
/** Stable chat ID for session keying (e.g. "project:issue:123" for GitLab) */
|
|
2749
|
+
chatId?: string;
|
|
2022
2750
|
/** Attached media file (image, audio, video, document) */
|
|
2023
2751
|
mediaPath?: string;
|
|
2024
2752
|
mediaType?: string;
|
|
@@ -2032,6 +2760,21 @@ interface AgentTask {
|
|
|
2032
2760
|
myHandle?: string;
|
|
2033
2761
|
/** Other available agents and their handles */
|
|
2034
2762
|
peers?: AgentPeer[];
|
|
2763
|
+
/** Verified channel metadata (from adapter) */
|
|
2764
|
+
channelMeta?: {
|
|
2765
|
+
agents?: Array<{
|
|
2766
|
+
id: string;
|
|
2767
|
+
name: string;
|
|
2768
|
+
handle?: string;
|
|
2769
|
+
}>;
|
|
2770
|
+
project?: string;
|
|
2771
|
+
issue?: {
|
|
2772
|
+
type: string;
|
|
2773
|
+
iid: string;
|
|
2774
|
+
title: string;
|
|
2775
|
+
};
|
|
2776
|
+
facts?: string[];
|
|
2777
|
+
};
|
|
2035
2778
|
};
|
|
2036
2779
|
}
|
|
2037
2780
|
interface AgentResponse {
|
|
@@ -2062,11 +2805,11 @@ declare function executeClaudeCode(agent: AgentDef, task: AgentTask, historyCont
|
|
|
2062
2805
|
/**
|
|
2063
2806
|
* Execute a task using the Claude Agent SDK (tier: "sdk").
|
|
2064
2807
|
*/
|
|
2065
|
-
declare function executeSdk(agent: AgentDef, task: AgentTask, apiKey: string): Promise<AgentResponse>;
|
|
2808
|
+
declare function executeSdk(agent: AgentDef, task: AgentTask, apiKey: string, historyContext?: string): Promise<AgentResponse>;
|
|
2066
2809
|
/**
|
|
2067
2810
|
* Execute a task using agentx's own orchestrator (tier: "orchestrator").
|
|
2068
2811
|
*/
|
|
2069
|
-
declare function executeOrchestrator(agent: AgentDef, task: AgentTask, apiKey?: string): Promise<AgentResponse>;
|
|
2812
|
+
declare function executeOrchestrator(agent: AgentDef, task: AgentTask, apiKey?: string, historyContext?: string): Promise<AgentResponse>;
|
|
2070
2813
|
/**
|
|
2071
2814
|
* Route a task to the correct execution tier.
|
|
2072
2815
|
*/
|
|
@@ -2074,134 +2817,960 @@ declare function executeTask(agent: AgentDef, task: AgentTask, providers: Record
|
|
|
2074
2817
|
apiKey?: string;
|
|
2075
2818
|
}>, onDelta?: StreamCallback, historyContext?: string, resumeSessionId?: string): Promise<AgentResponse>;
|
|
2076
2819
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2820
|
+
type WikiAccess = "private" | "shared" | "public";
|
|
2821
|
+
/**
|
|
2822
|
+
* Article metadata. Intentionally minimal — tags do the heavy lifting.
|
|
2823
|
+
*/
|
|
2824
|
+
interface WikiArticleMeta {
|
|
2825
|
+
title: string;
|
|
2826
|
+
tags: string[];
|
|
2827
|
+
owner: string;
|
|
2828
|
+
access: WikiAccess;
|
|
2829
|
+
sharedWith?: string[];
|
|
2830
|
+
created: string;
|
|
2831
|
+
lastUpdated: string;
|
|
2832
|
+
sources: string[];
|
|
2833
|
+
}
|
|
2834
|
+
interface WikiArticle {
|
|
2835
|
+
meta: WikiArticleMeta;
|
|
2836
|
+
content: string;
|
|
2837
|
+
path: string;
|
|
2838
|
+
}
|
|
2839
|
+
interface WikiEntry {
|
|
2840
|
+
id: string;
|
|
2841
|
+
date: string;
|
|
2842
|
+
agentId: string;
|
|
2843
|
+
source: string;
|
|
2844
|
+
sourceContext?: string;
|
|
2845
|
+
content: string;
|
|
2846
|
+
meta?: Record<string, unknown>;
|
|
2847
|
+
}
|
|
2848
|
+
interface WikiIndex {
|
|
2849
|
+
articles: Array<{
|
|
2850
|
+
path: string;
|
|
2851
|
+
title: string;
|
|
2852
|
+
tags: string[];
|
|
2853
|
+
owner: string;
|
|
2854
|
+
access: WikiAccess;
|
|
2855
|
+
sharedWith?: string[];
|
|
2856
|
+
aliases: string[];
|
|
2857
|
+
backlinks: number;
|
|
2858
|
+
sources?: string[];
|
|
2859
|
+
lastUpdated?: string;
|
|
2860
|
+
}>;
|
|
2861
|
+
lastRebuilt: string;
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
declare class WikiStore {
|
|
2865
|
+
private baseDir;
|
|
2866
|
+
private rawDir;
|
|
2085
2867
|
private log;
|
|
2086
|
-
constructor(
|
|
2868
|
+
constructor(baseDir?: string, log?: (...args: unknown[]) => void);
|
|
2087
2869
|
/**
|
|
2088
|
-
*
|
|
2870
|
+
* Check if an agent can read an article.
|
|
2089
2871
|
*/
|
|
2090
|
-
|
|
2872
|
+
canRead(article: WikiArticleMeta, agentId?: string): boolean;
|
|
2091
2873
|
/**
|
|
2092
|
-
*
|
|
2093
|
-
* Returns the agent with the longest (most specific) mention match.
|
|
2874
|
+
* Check if an agent can write an article.
|
|
2094
2875
|
*/
|
|
2095
|
-
|
|
2876
|
+
canWrite(article: WikiArticleMeta, agentId: string): boolean;
|
|
2096
2877
|
/**
|
|
2097
|
-
*
|
|
2878
|
+
* Add a raw entry (from a conversation, cron result, etc.)
|
|
2098
2879
|
*/
|
|
2099
|
-
|
|
2880
|
+
addEntry(entry: WikiEntry): string;
|
|
2100
2881
|
/**
|
|
2101
|
-
*
|
|
2882
|
+
* List raw entries, optionally filtered by agent or date range.
|
|
2102
2883
|
*/
|
|
2103
|
-
|
|
2884
|
+
listEntries(filter?: {
|
|
2885
|
+
agentId?: string;
|
|
2886
|
+
after?: string;
|
|
2887
|
+
before?: string;
|
|
2888
|
+
}): WikiEntry[];
|
|
2889
|
+
private parseEntry;
|
|
2104
2890
|
/**
|
|
2105
|
-
*
|
|
2891
|
+
* Write or update a wiki article.
|
|
2106
2892
|
*/
|
|
2107
|
-
|
|
2893
|
+
writeArticle(path: string, meta: WikiArticleMeta, content: string, agentId: string): boolean;
|
|
2108
2894
|
/**
|
|
2109
|
-
*
|
|
2895
|
+
* Save current article content as an immutable version before overwriting.
|
|
2896
|
+
* Versions stored in _versions/{article-path}/{timestamp}.md
|
|
2110
2897
|
*/
|
|
2111
|
-
private
|
|
2898
|
+
private saveVersion;
|
|
2112
2899
|
/**
|
|
2113
|
-
*
|
|
2900
|
+
* List all versions of an article (newest first).
|
|
2114
2901
|
*/
|
|
2115
|
-
|
|
2902
|
+
getVersions(articlePath: string): Array<{
|
|
2903
|
+
timestamp: string;
|
|
2904
|
+
path: string;
|
|
2905
|
+
}>;
|
|
2116
2906
|
/**
|
|
2117
|
-
*
|
|
2907
|
+
* Restore a specific version of an article.
|
|
2118
2908
|
*/
|
|
2119
|
-
|
|
2120
|
-
id: string;
|
|
2121
|
-
name: string;
|
|
2122
|
-
tier: string;
|
|
2123
|
-
workspace: string;
|
|
2124
|
-
active: number;
|
|
2125
|
-
total: number;
|
|
2126
|
-
errors: number;
|
|
2127
|
-
lastActive?: Date;
|
|
2128
|
-
}>;
|
|
2909
|
+
restoreVersion(articlePath: string, versionTimestamp: string): boolean;
|
|
2129
2910
|
/**
|
|
2130
|
-
*
|
|
2911
|
+
* Read an article. Returns null if not found.
|
|
2131
2912
|
*/
|
|
2132
|
-
|
|
2133
|
-
totalTasks: number;
|
|
2134
|
-
totalTokens: number;
|
|
2135
|
-
totalInput: number;
|
|
2136
|
-
totalOutput: number;
|
|
2137
|
-
totalCacheRead: number;
|
|
2138
|
-
totalCacheCreate: number;
|
|
2139
|
-
cacheHitRatio: number;
|
|
2140
|
-
totalErrors: number;
|
|
2141
|
-
byAgent: Record<string, {
|
|
2142
|
-
tasks: number;
|
|
2143
|
-
input: number;
|
|
2144
|
-
output: number;
|
|
2145
|
-
cacheRead: number;
|
|
2146
|
-
cacheCreate: number;
|
|
2147
|
-
total: number;
|
|
2148
|
-
avgDuration: number;
|
|
2149
|
-
}>;
|
|
2150
|
-
};
|
|
2913
|
+
readArticle(path: string): WikiArticle | null;
|
|
2151
2914
|
/**
|
|
2152
|
-
*
|
|
2915
|
+
* Read an article with permission check.
|
|
2153
2916
|
*/
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2917
|
+
readArticleAs(path: string, agentId: string): WikiArticle | null;
|
|
2918
|
+
private parseArticle;
|
|
2919
|
+
/**
|
|
2920
|
+
* List all articles accessible to an agent.
|
|
2921
|
+
*/
|
|
2922
|
+
listArticles(agentId: string): WikiArticle[];
|
|
2923
|
+
/**
|
|
2924
|
+
* Search articles by keyword. Returns articles the agent can read.
|
|
2925
|
+
*/
|
|
2926
|
+
search(query: string, agentId: string, maxResults?: number): WikiArticle[];
|
|
2927
|
+
/**
|
|
2928
|
+
* Find articles relevant to a message (for context injection).
|
|
2929
|
+
* Extracts keywords from the message and searches the wiki.
|
|
2930
|
+
*/
|
|
2931
|
+
findRelevant(message: string, agentId?: string, maxArticles?: number): WikiArticle[];
|
|
2932
|
+
/**
|
|
2933
|
+
* Build context string from relevant wiki articles for prompt injection.
|
|
2934
|
+
* Token-efficient: includes title + first ~500 chars of each article.
|
|
2935
|
+
*/
|
|
2936
|
+
buildContext(articles: WikiArticle[], maxChars?: number): string;
|
|
2937
|
+
/**
|
|
2938
|
+
* Rebuild the master index.
|
|
2939
|
+
*/
|
|
2940
|
+
rebuildIndex(): WikiIndex;
|
|
2941
|
+
/**
|
|
2942
|
+
* Get wiki stats.
|
|
2943
|
+
*/
|
|
2944
|
+
stats(): {
|
|
2945
|
+
totalArticles: number;
|
|
2946
|
+
totalEntries: number;
|
|
2947
|
+
articlesByType: Record<string, number>;
|
|
2948
|
+
articlesByAccess: Record<string, number>;
|
|
2949
|
+
articlesByOwner: Record<string, number>;
|
|
2950
|
+
};
|
|
2951
|
+
/**
|
|
2952
|
+
* Append an entry to log.md.
|
|
2953
|
+
* Format: ## [YYYY-MM-DD HH:MM] action | details
|
|
2954
|
+
*/
|
|
2955
|
+
appendLog(action: string, details: string): void;
|
|
2956
|
+
/**
|
|
2957
|
+
* Get recent log entries.
|
|
2958
|
+
*/
|
|
2959
|
+
getLog(limit?: number): string[];
|
|
2960
|
+
/**
|
|
2961
|
+
* Create _schema.md if it doesn't exist.
|
|
2962
|
+
* This tells the LLM how to operate on the wiki.
|
|
2963
|
+
*/
|
|
2964
|
+
private ensureSchema;
|
|
2965
|
+
/**
|
|
2966
|
+
* Extract all [[wikilinks]] from article content.
|
|
2967
|
+
*/
|
|
2968
|
+
extractWikilinks(content: string): string[];
|
|
2969
|
+
/**
|
|
2970
|
+
* Build backlinks index: for each article, which other articles link to it.
|
|
2971
|
+
*/
|
|
2972
|
+
buildBacklinks(): Record<string, string[]>;
|
|
2973
|
+
/**
|
|
2974
|
+
* Get backlinks for a specific article title.
|
|
2975
|
+
*/
|
|
2976
|
+
getBacklinks(title: string): string[];
|
|
2977
|
+
/**
|
|
2978
|
+
* Find articles matching ANY of the given tags.
|
|
2979
|
+
* This is how agents get relevant context — only articles tagged with
|
|
2980
|
+
* the client/project/topic they're working on.
|
|
2981
|
+
*/
|
|
2982
|
+
findByTags(tags: string[], agentId?: string, limit?: number): WikiArticle[];
|
|
2983
|
+
/**
|
|
2984
|
+
* Get all unique tags across all articles.
|
|
2985
|
+
*/
|
|
2986
|
+
getAllTags(): Map<string, number>;
|
|
2987
|
+
/**
|
|
2988
|
+
* Get the worldview file. This is the user's description of their world —
|
|
2989
|
+
* the LLM uses it during absorb to know where things go.
|
|
2990
|
+
* Returns null if not set.
|
|
2991
|
+
*/
|
|
2992
|
+
getWorldview(): string | null;
|
|
2993
|
+
/**
|
|
2994
|
+
* Set the worldview. The user describes their world: companies, clients,
|
|
2995
|
+
* projects, team, processes. The LLM uses this as context during absorb.
|
|
2996
|
+
*/
|
|
2997
|
+
setWorldview(content: string): void;
|
|
2998
|
+
/**
|
|
2999
|
+
* Run a lint pass on the wiki. Returns issues found.
|
|
3000
|
+
*/
|
|
3001
|
+
lint(): Array<{
|
|
3002
|
+
type: string;
|
|
3003
|
+
article: string;
|
|
3004
|
+
message: string;
|
|
3005
|
+
}>;
|
|
3006
|
+
/**
|
|
3007
|
+
* Get unabsorbed entries (entries not referenced by any article's sources field).
|
|
3008
|
+
*/
|
|
3009
|
+
getUnabsorbedEntries(): WikiEntry[];
|
|
3010
|
+
/**
|
|
3011
|
+
* Build an absorb prompt for unprocessed entries.
|
|
3012
|
+
* Returns a prompt string an agent can execute to compile entries into articles.
|
|
3013
|
+
*/
|
|
3014
|
+
buildAbsorbPrompt(maxEntries?: number): string | null;
|
|
3015
|
+
private walkDir;
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
type WikiMode = "flat" | "graph" | "unified";
|
|
3019
|
+
/**
|
|
3020
|
+
* WikiHub: manages per-agent wikis with a shared raw entry pool.
|
|
3021
|
+
* Supports two compilation modes:
|
|
3022
|
+
* - flat: Karpathy pattern — tags, LLM-chosen paths, worldview, gap detection
|
|
3023
|
+
* - graph: Knowledge graph — kind, parent, hierarchy, events, entities
|
|
3024
|
+
*
|
|
3025
|
+
* Both modes share the same raw entries. Articles stored separately:
|
|
3026
|
+
* agents/<id>/flat/ ← Karpathy compilation
|
|
3027
|
+
* agents/<id>/graph/ ← Knowledge graph compilation
|
|
3028
|
+
*/
|
|
3029
|
+
declare class WikiHub {
|
|
3030
|
+
private baseDir;
|
|
3031
|
+
private agentsDir;
|
|
3032
|
+
private mode;
|
|
3033
|
+
private sharedStore;
|
|
3034
|
+
private agentStores;
|
|
3035
|
+
private log;
|
|
3036
|
+
constructor(baseDir?: string, log?: (...args: unknown[]) => void, mode?: WikiMode);
|
|
3037
|
+
getMode(): WikiMode;
|
|
3038
|
+
/**
|
|
3039
|
+
* Get or create the wiki store for a specific agent (mode-aware).
|
|
3040
|
+
* flat: agents/<id>/flat/
|
|
3041
|
+
* graph: agents/<id>/graph/
|
|
3042
|
+
*/
|
|
3043
|
+
getAgentWiki(agentId: string): WikiStore;
|
|
3044
|
+
getSharedStore(): WikiStore;
|
|
3045
|
+
listAgents(): string[];
|
|
3046
|
+
getAgentEntries(agentId: string): WikiEntry[];
|
|
3047
|
+
getUnabsorbedEntries(agentId: string): WikiEntry[];
|
|
3048
|
+
summary(): AgentWikiSummary[];
|
|
3049
|
+
}
|
|
3050
|
+
interface AgentWikiSummary {
|
|
3051
|
+
agentId: string;
|
|
3052
|
+
totalEntries: number;
|
|
3053
|
+
totalArticles: number;
|
|
3054
|
+
unabsorbed: number;
|
|
3055
|
+
articles: Array<{
|
|
3056
|
+
title: string;
|
|
3057
|
+
path: string;
|
|
3058
|
+
tags?: string[];
|
|
3059
|
+
}>;
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
interface MeshPeerInfo {
|
|
3063
|
+
peer: string;
|
|
3064
|
+
healthy: boolean;
|
|
3065
|
+
skills: Array<{
|
|
3066
|
+
id: string;
|
|
3067
|
+
name: string;
|
|
3068
|
+
description: string;
|
|
3069
|
+
}>;
|
|
3070
|
+
}
|
|
3071
|
+
/**
|
|
3072
|
+
* Build and cache per-agent landscape strings.
|
|
3073
|
+
*/
|
|
3074
|
+
declare class LandscapeBuilder {
|
|
3075
|
+
private cache;
|
|
3076
|
+
private config;
|
|
3077
|
+
private meshPeers;
|
|
3078
|
+
constructor(config: DaemonConfig);
|
|
3079
|
+
/**
|
|
3080
|
+
* Build landscape strings for all agents. Call at startup.
|
|
3081
|
+
*/
|
|
3082
|
+
build(meshPeers?: MeshPeerInfo[]): void;
|
|
3083
|
+
/**
|
|
3084
|
+
* Get the cached landscape string for a specific agent.
|
|
3085
|
+
*/
|
|
3086
|
+
getForAgent(agentId: string): string | undefined;
|
|
3087
|
+
/**
|
|
3088
|
+
* Rebuild after mesh topology changes.
|
|
3089
|
+
*/
|
|
3090
|
+
refresh(meshPeers: MeshPeerInfo[]): void;
|
|
3091
|
+
private renderForAgent;
|
|
3092
|
+
private renderChannels;
|
|
3093
|
+
/**
|
|
3094
|
+
* Get the primary Telegram handle for an agent (the @username).
|
|
3095
|
+
*/
|
|
3096
|
+
private getPrimaryHandle;
|
|
3097
|
+
/**
|
|
3098
|
+
* Extract a short capability description from systemPrompt.
|
|
3099
|
+
* Takes the first sentence, max 80 chars.
|
|
3100
|
+
*/
|
|
3101
|
+
private extractCapability;
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
declare class AgentRegistry {
|
|
3105
|
+
private agents;
|
|
3106
|
+
private config;
|
|
3107
|
+
private providers;
|
|
3108
|
+
private sessions;
|
|
3109
|
+
private wikiHub;
|
|
3110
|
+
private memoryStore;
|
|
3111
|
+
private patternStore;
|
|
3112
|
+
private rateLimiter;
|
|
3113
|
+
private tokenTracker;
|
|
3114
|
+
private landscape?;
|
|
3115
|
+
private messageQueue;
|
|
3116
|
+
/** Active soul profile per agent+chat session: "agentId:channel:chatId" → profile name */
|
|
3117
|
+
private activeSouls;
|
|
3118
|
+
private log;
|
|
3119
|
+
constructor(config: DaemonConfig, log?: (...args: unknown[]) => void);
|
|
3120
|
+
/**
|
|
3121
|
+
* Set landscape builder (called after mesh init).
|
|
3122
|
+
*/
|
|
3123
|
+
setLandscape(builder: LandscapeBuilder): void;
|
|
3124
|
+
/**
|
|
3125
|
+
* Get agent definition by ID.
|
|
3126
|
+
*/
|
|
3127
|
+
getAgent(id: string): AgentDef | undefined;
|
|
3128
|
+
/**
|
|
3129
|
+
* Find agent by mention pattern (e.g., "@my_bot" -> "my-agent").
|
|
3130
|
+
* Returns the agent with the longest (most specific) mention match.
|
|
3131
|
+
*/
|
|
3132
|
+
findByMention(text: string): string | undefined;
|
|
3133
|
+
/**
|
|
3134
|
+
* Find ALL agents mentioned in text (for bot-to-bot detection).
|
|
3135
|
+
*/
|
|
3136
|
+
findAllMentioned(text: string): string[];
|
|
3137
|
+
/** Wiki hub accessor. */
|
|
3138
|
+
getWikiHub(): WikiHub;
|
|
3139
|
+
/**
|
|
3140
|
+
* Build peer list for context engine.
|
|
3141
|
+
*/
|
|
3142
|
+
private buildPeerList;
|
|
3143
|
+
/**
|
|
3144
|
+
* Get the primary channel handle for an agent (e.g. "@my_bot" on telegram).
|
|
3145
|
+
*/
|
|
3146
|
+
private getChannelHandle;
|
|
3147
|
+
/**
|
|
3148
|
+
* Execute a task on an agent. Respects maxConcurrent limit.
|
|
3149
|
+
*/
|
|
3150
|
+
execute(task: AgentTask, onDelta?: StreamCallback): Promise<AgentResponse>;
|
|
3151
|
+
/**
|
|
3152
|
+
* List all agents and their status.
|
|
3153
|
+
*/
|
|
3154
|
+
list(): Array<{
|
|
3155
|
+
id: string;
|
|
3156
|
+
name: string;
|
|
3157
|
+
tier: string;
|
|
3158
|
+
workspace: string;
|
|
3159
|
+
active: number;
|
|
3160
|
+
total: number;
|
|
3161
|
+
errors: number;
|
|
3162
|
+
lastActive?: Date;
|
|
3163
|
+
}>;
|
|
3164
|
+
/**
|
|
3165
|
+
* Get token usage summary.
|
|
3166
|
+
*/
|
|
3167
|
+
getUsage(days?: number): {
|
|
3168
|
+
totalTasks: number;
|
|
3169
|
+
totalTokens: number;
|
|
3170
|
+
totalInput: number;
|
|
3171
|
+
totalOutput: number;
|
|
3172
|
+
totalCacheRead: number;
|
|
3173
|
+
totalCacheCreate: number;
|
|
3174
|
+
cacheHitRatio: number;
|
|
3175
|
+
totalErrors: number;
|
|
3176
|
+
totalCost: number;
|
|
3177
|
+
byAgent: Record<string, {
|
|
3178
|
+
tasks: number;
|
|
3179
|
+
input: number;
|
|
3180
|
+
output: number;
|
|
3181
|
+
cacheRead: number;
|
|
3182
|
+
cacheCreate: number;
|
|
3183
|
+
total: number;
|
|
3184
|
+
avgDuration: number;
|
|
3185
|
+
cost: number;
|
|
3186
|
+
}>;
|
|
3187
|
+
};
|
|
3188
|
+
/**
|
|
3189
|
+
* Get today's usage.
|
|
3190
|
+
*/
|
|
3191
|
+
getTodayUsage(): DailyUsage;
|
|
3192
|
+
/**
|
|
3193
|
+
* Get the token tracker instance (for daemon hooks).
|
|
3194
|
+
*/
|
|
3195
|
+
getTokenTracker(): TokenTracker;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* Verified channel context — facts the channel adapter knows for certain.
|
|
3200
|
+
* Prevents agents from hallucinating about their environment.
|
|
3201
|
+
*/
|
|
3202
|
+
interface ChannelMeta {
|
|
3203
|
+
/** Channel name */
|
|
3204
|
+
channel: string;
|
|
3205
|
+
/** Verified agents/bots present in this chat/group/project */
|
|
3206
|
+
agents?: Array<{
|
|
3207
|
+
id: string;
|
|
3208
|
+
name: string;
|
|
3209
|
+
handle?: string;
|
|
3210
|
+
}>;
|
|
3211
|
+
/** Project path (GitLab) or group topic */
|
|
3212
|
+
project?: string;
|
|
3213
|
+
/** Issue/MR context (GitLab) */
|
|
3214
|
+
issue?: {
|
|
3215
|
+
type: string;
|
|
3216
|
+
iid: string;
|
|
3217
|
+
title: string;
|
|
3218
|
+
};
|
|
3219
|
+
/** Channel-specific facts (e.g., pipeline status, group description) */
|
|
3220
|
+
facts?: string[];
|
|
3221
|
+
}
|
|
3222
|
+
interface IncomingMessage {
|
|
3223
|
+
id: string;
|
|
3224
|
+
channel: string;
|
|
3225
|
+
accountId: string;
|
|
3226
|
+
sender: {
|
|
3227
|
+
id: string;
|
|
3228
|
+
name: string;
|
|
3229
|
+
username?: string;
|
|
3230
|
+
};
|
|
3231
|
+
group?: {
|
|
3232
|
+
id: string;
|
|
3233
|
+
name: string;
|
|
3234
|
+
};
|
|
3235
|
+
text: string;
|
|
3236
|
+
replyTo?: string;
|
|
3237
|
+
replyToText?: string;
|
|
3238
|
+
timestamp: Date;
|
|
3239
|
+
media?: {
|
|
3240
|
+
path: string;
|
|
2176
3241
|
type: string;
|
|
2177
3242
|
fileName?: string;
|
|
2178
3243
|
};
|
|
2179
|
-
raw?: unknown;
|
|
2180
|
-
resolvedAgent?: string;
|
|
3244
|
+
raw?: unknown;
|
|
3245
|
+
resolvedAgent?: string;
|
|
3246
|
+
channelMeta?: ChannelMeta;
|
|
3247
|
+
}
|
|
3248
|
+
interface OutgoingMessage {
|
|
3249
|
+
channel: string;
|
|
3250
|
+
chatId: string;
|
|
3251
|
+
text: string;
|
|
3252
|
+
replyTo?: string;
|
|
3253
|
+
parseMode?: "markdown" | "html" | "plain";
|
|
3254
|
+
agentId?: string;
|
|
3255
|
+
}
|
|
3256
|
+
interface ChannelAdapter {
|
|
3257
|
+
readonly name: string;
|
|
3258
|
+
/** Start polling or webhook listener */
|
|
3259
|
+
start(): Promise<void>;
|
|
3260
|
+
/** Stop the adapter gracefully */
|
|
3261
|
+
stop(): Promise<void>;
|
|
3262
|
+
/** Send a message back to a chat */
|
|
3263
|
+
send(msg: OutgoingMessage): Promise<string | void>;
|
|
3264
|
+
/** Edit an existing message (returns false if not supported) */
|
|
3265
|
+
editMessage?(chatId: string, messageId: string, text: string, parseMode?: string): Promise<boolean>;
|
|
3266
|
+
/** Send typing/action indicator */
|
|
3267
|
+
sendTyping?(chatId: string): Promise<void>;
|
|
3268
|
+
/** React to a message with an emoji (e.g., 👀 for seen) */
|
|
3269
|
+
react?(chatId: string, messageId: string, emoji?: string): Promise<void>;
|
|
3270
|
+
/** Register handler for incoming messages */
|
|
3271
|
+
onMessage(handler: (msg: IncomingMessage) => Promise<void>): void;
|
|
3272
|
+
/** Get verified context for a chat (optional — channels implement what they can) */
|
|
3273
|
+
getChannelMeta?(chatId: string): Promise<ChannelMeta | undefined>;
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
interface ServiceTrigger {
|
|
3277
|
+
pattern: string;
|
|
3278
|
+
channel?: string;
|
|
3279
|
+
}
|
|
3280
|
+
interface ServiceNotify {
|
|
3281
|
+
channel: string;
|
|
3282
|
+
chatId: string;
|
|
3283
|
+
accountId?: string;
|
|
3284
|
+
}
|
|
3285
|
+
interface ServiceDef {
|
|
3286
|
+
id: string;
|
|
3287
|
+
name: string;
|
|
3288
|
+
triggers: ServiceTrigger[];
|
|
3289
|
+
allowedContacts?: string[];
|
|
3290
|
+
agent: string;
|
|
3291
|
+
prompt: string;
|
|
3292
|
+
schedule?: string;
|
|
3293
|
+
timezone?: string;
|
|
3294
|
+
notify?: ServiceNotify;
|
|
3295
|
+
}
|
|
3296
|
+
interface ServiceMatch {
|
|
3297
|
+
service: ServiceDef;
|
|
3298
|
+
trigger: string;
|
|
3299
|
+
captured: string;
|
|
3300
|
+
}
|
|
3301
|
+
declare class ServiceMatcher {
|
|
3302
|
+
private services;
|
|
3303
|
+
private log;
|
|
3304
|
+
constructor(serviceDefs: Record<string, Omit<ServiceDef, "id">>, log?: (...args: unknown[]) => void);
|
|
3305
|
+
/**
|
|
3306
|
+
* Match an incoming message against all service triggers.
|
|
3307
|
+
* Returns the first matching service or null.
|
|
3308
|
+
*/
|
|
3309
|
+
match(text: string, senderId: string, channel: string): ServiceMatch | null;
|
|
3310
|
+
/**
|
|
3311
|
+
* Execute a matched service.
|
|
3312
|
+
* Sends the service's predefined prompt to the agent, returns the response.
|
|
3313
|
+
*/
|
|
3314
|
+
execute(service: ServiceDef, registry: AgentRegistry, context: {
|
|
3315
|
+
channel: string;
|
|
3316
|
+
sender: string;
|
|
3317
|
+
chatId: string;
|
|
3318
|
+
}, replyFn: (text: string) => Promise<void>): Promise<void>;
|
|
3319
|
+
/**
|
|
3320
|
+
* Get all services that have a schedule (for cron registration).
|
|
3321
|
+
*/
|
|
3322
|
+
getScheduledServices(): ServiceDef[];
|
|
3323
|
+
/**
|
|
3324
|
+
* List all registered services.
|
|
3325
|
+
*/
|
|
3326
|
+
list(): Array<{
|
|
3327
|
+
id: string;
|
|
3328
|
+
name: string;
|
|
3329
|
+
triggers: number;
|
|
3330
|
+
agent: string;
|
|
3331
|
+
scheduled: boolean;
|
|
3332
|
+
}>;
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
declare const roleSchema: z.ZodObject<{
|
|
3336
|
+
title: z.ZodString;
|
|
3337
|
+
responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
3338
|
+
sopPath: z.ZodOptional<z.ZodString>;
|
|
3339
|
+
kpis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
3340
|
+
}, "strip", z.ZodTypeAny, {
|
|
3341
|
+
title: string;
|
|
3342
|
+
responsibilities: string[];
|
|
3343
|
+
kpis: string[];
|
|
3344
|
+
sopPath?: string | undefined;
|
|
3345
|
+
}, {
|
|
3346
|
+
title: string;
|
|
3347
|
+
responsibilities?: string[] | undefined;
|
|
3348
|
+
sopPath?: string | undefined;
|
|
3349
|
+
kpis?: string[] | undefined;
|
|
3350
|
+
}>;
|
|
3351
|
+
declare const orgEntrySchema: z.ZodObject<{
|
|
3352
|
+
role: z.ZodString;
|
|
3353
|
+
reportsTo: z.ZodOptional<z.ZodString>;
|
|
3354
|
+
schedule: z.ZodObject<{
|
|
3355
|
+
days: z.ZodDefault<z.ZodArray<z.ZodEnum<["mon", "tue", "wed", "thu", "fri", "sat", "sun"]>, "many">>;
|
|
3356
|
+
start: z.ZodString;
|
|
3357
|
+
end: z.ZodString;
|
|
3358
|
+
lunch: z.ZodOptional<z.ZodObject<{
|
|
3359
|
+
start: z.ZodString;
|
|
3360
|
+
end: z.ZodString;
|
|
3361
|
+
}, "strip", z.ZodTypeAny, {
|
|
3362
|
+
start: string;
|
|
3363
|
+
end: string;
|
|
3364
|
+
}, {
|
|
3365
|
+
start: string;
|
|
3366
|
+
end: string;
|
|
3367
|
+
}>>;
|
|
3368
|
+
}, "strip", z.ZodTypeAny, {
|
|
3369
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
3370
|
+
start: string;
|
|
3371
|
+
end: string;
|
|
3372
|
+
lunch?: {
|
|
3373
|
+
start: string;
|
|
3374
|
+
end: string;
|
|
3375
|
+
} | undefined;
|
|
3376
|
+
}, {
|
|
3377
|
+
start: string;
|
|
3378
|
+
end: string;
|
|
3379
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
3380
|
+
lunch?: {
|
|
3381
|
+
start: string;
|
|
3382
|
+
end: string;
|
|
3383
|
+
} | undefined;
|
|
3384
|
+
}>;
|
|
3385
|
+
utilizationTarget: z.ZodDefault<z.ZodNumber>;
|
|
3386
|
+
}, "strip", z.ZodTypeAny, {
|
|
3387
|
+
role: string;
|
|
3388
|
+
schedule: {
|
|
3389
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
3390
|
+
start: string;
|
|
3391
|
+
end: string;
|
|
3392
|
+
lunch?: {
|
|
3393
|
+
start: string;
|
|
3394
|
+
end: string;
|
|
3395
|
+
} | undefined;
|
|
3396
|
+
};
|
|
3397
|
+
utilizationTarget: number;
|
|
3398
|
+
reportsTo?: string | undefined;
|
|
3399
|
+
}, {
|
|
3400
|
+
role: string;
|
|
3401
|
+
schedule: {
|
|
3402
|
+
start: string;
|
|
3403
|
+
end: string;
|
|
3404
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
3405
|
+
lunch?: {
|
|
3406
|
+
start: string;
|
|
3407
|
+
end: string;
|
|
3408
|
+
} | undefined;
|
|
3409
|
+
};
|
|
3410
|
+
reportsTo?: string | undefined;
|
|
3411
|
+
utilizationTarget?: number | undefined;
|
|
3412
|
+
}>;
|
|
3413
|
+
declare const businessConfigSchema: z.ZodObject<{
|
|
3414
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
3415
|
+
timezone: z.ZodDefault<z.ZodString>;
|
|
3416
|
+
mainChannel: z.ZodObject<{
|
|
3417
|
+
channel: z.ZodString;
|
|
3418
|
+
chatId: z.ZodString;
|
|
3419
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
3420
|
+
}, "strip", z.ZodTypeAny, {
|
|
3421
|
+
channel: string;
|
|
3422
|
+
chatId: string;
|
|
3423
|
+
accountId?: string | undefined;
|
|
3424
|
+
}, {
|
|
3425
|
+
channel: string;
|
|
3426
|
+
chatId: string;
|
|
3427
|
+
accountId?: string | undefined;
|
|
3428
|
+
}>;
|
|
3429
|
+
workSource: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3430
|
+
type: z.ZodLiteral<"backlog">;
|
|
3431
|
+
path: z.ZodDefault<z.ZodString>;
|
|
3432
|
+
}, "strip", z.ZodTypeAny, {
|
|
3433
|
+
path: string;
|
|
3434
|
+
type: "backlog";
|
|
3435
|
+
}, {
|
|
3436
|
+
type: "backlog";
|
|
3437
|
+
path?: string | undefined;
|
|
3438
|
+
}>, z.ZodObject<{
|
|
3439
|
+
type: z.ZodLiteral<"gitlab">;
|
|
3440
|
+
projects: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
3441
|
+
}, "strip", z.ZodTypeAny, {
|
|
3442
|
+
type: "gitlab";
|
|
3443
|
+
projects: string[];
|
|
3444
|
+
}, {
|
|
3445
|
+
type: "gitlab";
|
|
3446
|
+
projects?: string[] | undefined;
|
|
3447
|
+
}>, z.ZodObject<{
|
|
3448
|
+
type: z.ZodLiteral<"wiki">;
|
|
3449
|
+
path: z.ZodString;
|
|
3450
|
+
glob: z.ZodDefault<z.ZodString>;
|
|
3451
|
+
}, "strip", z.ZodTypeAny, {
|
|
3452
|
+
path: string;
|
|
3453
|
+
type: "wiki";
|
|
3454
|
+
glob: string;
|
|
3455
|
+
}, {
|
|
3456
|
+
path: string;
|
|
3457
|
+
type: "wiki";
|
|
3458
|
+
glob?: string | undefined;
|
|
3459
|
+
}>]>;
|
|
3460
|
+
roles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3461
|
+
title: z.ZodString;
|
|
3462
|
+
responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
3463
|
+
sopPath: z.ZodOptional<z.ZodString>;
|
|
3464
|
+
kpis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
3465
|
+
}, "strip", z.ZodTypeAny, {
|
|
3466
|
+
title: string;
|
|
3467
|
+
responsibilities: string[];
|
|
3468
|
+
kpis: string[];
|
|
3469
|
+
sopPath?: string | undefined;
|
|
3470
|
+
}, {
|
|
3471
|
+
title: string;
|
|
3472
|
+
responsibilities?: string[] | undefined;
|
|
3473
|
+
sopPath?: string | undefined;
|
|
3474
|
+
kpis?: string[] | undefined;
|
|
3475
|
+
}>>>;
|
|
3476
|
+
orgChart: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3477
|
+
role: z.ZodString;
|
|
3478
|
+
reportsTo: z.ZodOptional<z.ZodString>;
|
|
3479
|
+
schedule: z.ZodObject<{
|
|
3480
|
+
days: z.ZodDefault<z.ZodArray<z.ZodEnum<["mon", "tue", "wed", "thu", "fri", "sat", "sun"]>, "many">>;
|
|
3481
|
+
start: z.ZodString;
|
|
3482
|
+
end: z.ZodString;
|
|
3483
|
+
lunch: z.ZodOptional<z.ZodObject<{
|
|
3484
|
+
start: z.ZodString;
|
|
3485
|
+
end: z.ZodString;
|
|
3486
|
+
}, "strip", z.ZodTypeAny, {
|
|
3487
|
+
start: string;
|
|
3488
|
+
end: string;
|
|
3489
|
+
}, {
|
|
3490
|
+
start: string;
|
|
3491
|
+
end: string;
|
|
3492
|
+
}>>;
|
|
3493
|
+
}, "strip", z.ZodTypeAny, {
|
|
3494
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
3495
|
+
start: string;
|
|
3496
|
+
end: string;
|
|
3497
|
+
lunch?: {
|
|
3498
|
+
start: string;
|
|
3499
|
+
end: string;
|
|
3500
|
+
} | undefined;
|
|
3501
|
+
}, {
|
|
3502
|
+
start: string;
|
|
3503
|
+
end: string;
|
|
3504
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
3505
|
+
lunch?: {
|
|
3506
|
+
start: string;
|
|
3507
|
+
end: string;
|
|
3508
|
+
} | undefined;
|
|
3509
|
+
}>;
|
|
3510
|
+
utilizationTarget: z.ZodDefault<z.ZodNumber>;
|
|
3511
|
+
}, "strip", z.ZodTypeAny, {
|
|
3512
|
+
role: string;
|
|
3513
|
+
schedule: {
|
|
3514
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
3515
|
+
start: string;
|
|
3516
|
+
end: string;
|
|
3517
|
+
lunch?: {
|
|
3518
|
+
start: string;
|
|
3519
|
+
end: string;
|
|
3520
|
+
} | undefined;
|
|
3521
|
+
};
|
|
3522
|
+
utilizationTarget: number;
|
|
3523
|
+
reportsTo?: string | undefined;
|
|
3524
|
+
}, {
|
|
3525
|
+
role: string;
|
|
3526
|
+
schedule: {
|
|
3527
|
+
start: string;
|
|
3528
|
+
end: string;
|
|
3529
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
3530
|
+
lunch?: {
|
|
3531
|
+
start: string;
|
|
3532
|
+
end: string;
|
|
3533
|
+
} | undefined;
|
|
3534
|
+
};
|
|
3535
|
+
reportsTo?: string | undefined;
|
|
3536
|
+
utilizationTarget?: number | undefined;
|
|
3537
|
+
}>>>;
|
|
3538
|
+
/** Work-tick cadence in minutes during business hours. Default 15. */
|
|
3539
|
+
workTickMinutes: z.ZodDefault<z.ZodNumber>;
|
|
3540
|
+
/** Max queue depth for an idle agent before skipping the work tick (avoids piling up). */
|
|
3541
|
+
idleQueueThreshold: z.ZodDefault<z.ZodNumber>;
|
|
3542
|
+
}, "strip", z.ZodTypeAny, {
|
|
3543
|
+
enabled: boolean;
|
|
3544
|
+
timezone: string;
|
|
3545
|
+
mainChannel: {
|
|
3546
|
+
channel: string;
|
|
3547
|
+
chatId: string;
|
|
3548
|
+
accountId?: string | undefined;
|
|
3549
|
+
};
|
|
3550
|
+
workSource: {
|
|
3551
|
+
path: string;
|
|
3552
|
+
type: "backlog";
|
|
3553
|
+
} | {
|
|
3554
|
+
type: "gitlab";
|
|
3555
|
+
projects: string[];
|
|
3556
|
+
} | {
|
|
3557
|
+
path: string;
|
|
3558
|
+
type: "wiki";
|
|
3559
|
+
glob: string;
|
|
3560
|
+
};
|
|
3561
|
+
roles: Record<string, {
|
|
3562
|
+
title: string;
|
|
3563
|
+
responsibilities: string[];
|
|
3564
|
+
kpis: string[];
|
|
3565
|
+
sopPath?: string | undefined;
|
|
3566
|
+
}>;
|
|
3567
|
+
orgChart: Record<string, {
|
|
3568
|
+
role: string;
|
|
3569
|
+
schedule: {
|
|
3570
|
+
days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
|
|
3571
|
+
start: string;
|
|
3572
|
+
end: string;
|
|
3573
|
+
lunch?: {
|
|
3574
|
+
start: string;
|
|
3575
|
+
end: string;
|
|
3576
|
+
} | undefined;
|
|
3577
|
+
};
|
|
3578
|
+
utilizationTarget: number;
|
|
3579
|
+
reportsTo?: string | undefined;
|
|
3580
|
+
}>;
|
|
3581
|
+
workTickMinutes: number;
|
|
3582
|
+
idleQueueThreshold: number;
|
|
3583
|
+
}, {
|
|
3584
|
+
mainChannel: {
|
|
3585
|
+
channel: string;
|
|
3586
|
+
chatId: string;
|
|
3587
|
+
accountId?: string | undefined;
|
|
3588
|
+
};
|
|
3589
|
+
workSource: {
|
|
3590
|
+
type: "backlog";
|
|
3591
|
+
path?: string | undefined;
|
|
3592
|
+
} | {
|
|
3593
|
+
type: "gitlab";
|
|
3594
|
+
projects?: string[] | undefined;
|
|
3595
|
+
} | {
|
|
3596
|
+
path: string;
|
|
3597
|
+
type: "wiki";
|
|
3598
|
+
glob?: string | undefined;
|
|
3599
|
+
};
|
|
3600
|
+
enabled?: boolean | undefined;
|
|
3601
|
+
timezone?: string | undefined;
|
|
3602
|
+
roles?: Record<string, {
|
|
3603
|
+
title: string;
|
|
3604
|
+
responsibilities?: string[] | undefined;
|
|
3605
|
+
sopPath?: string | undefined;
|
|
3606
|
+
kpis?: string[] | undefined;
|
|
3607
|
+
}> | undefined;
|
|
3608
|
+
orgChart?: Record<string, {
|
|
3609
|
+
role: string;
|
|
3610
|
+
schedule: {
|
|
3611
|
+
start: string;
|
|
3612
|
+
end: string;
|
|
3613
|
+
days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
|
|
3614
|
+
lunch?: {
|
|
3615
|
+
start: string;
|
|
3616
|
+
end: string;
|
|
3617
|
+
} | undefined;
|
|
3618
|
+
};
|
|
3619
|
+
reportsTo?: string | undefined;
|
|
3620
|
+
utilizationTarget?: number | undefined;
|
|
3621
|
+
}> | undefined;
|
|
3622
|
+
workTickMinutes?: number | undefined;
|
|
3623
|
+
idleQueueThreshold?: number | undefined;
|
|
3624
|
+
}>;
|
|
3625
|
+
type BusinessConfig = z.infer<typeof businessConfigSchema>;
|
|
3626
|
+
type BusinessRole = z.infer<typeof roleSchema>;
|
|
3627
|
+
type BusinessOrgEntry = z.infer<typeof orgEntrySchema>;
|
|
3628
|
+
|
|
3629
|
+
interface EmployeeProfile {
|
|
3630
|
+
agentId: string;
|
|
3631
|
+
role: BusinessRole;
|
|
3632
|
+
roleKey: string;
|
|
3633
|
+
reportsTo?: string;
|
|
3634
|
+
schedule: BusinessOrgEntry["schedule"];
|
|
3635
|
+
utilizationTarget: number;
|
|
3636
|
+
}
|
|
3637
|
+
declare class Organization {
|
|
3638
|
+
private employees;
|
|
3639
|
+
constructor(config: BusinessConfig);
|
|
3640
|
+
get(agentId: string): EmployeeProfile | undefined;
|
|
3641
|
+
all(): EmployeeProfile[];
|
|
3642
|
+
reportsTo(agentId: string): string | undefined;
|
|
3643
|
+
directReports(agentId: string): string[];
|
|
3644
|
+
/** Walk up the org tree to the root. First element is `agentId` itself. */
|
|
3645
|
+
chainOfCommand(agentId: string): string[];
|
|
2181
3646
|
}
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
3647
|
+
|
|
3648
|
+
declare class Schedule {
|
|
3649
|
+
private org;
|
|
3650
|
+
private config;
|
|
3651
|
+
constructor(org: Organization, config: BusinessConfig);
|
|
3652
|
+
isOnClock(agentId: string, when?: Date): boolean;
|
|
3653
|
+
/** Is `when` exactly (to the minute) the scheduled day-start for this agent? */
|
|
3654
|
+
isDayStart(agentId: string, when?: Date): boolean;
|
|
3655
|
+
/** Is `when` exactly the scheduled day-end for this agent? */
|
|
3656
|
+
isDayEnd(agentId: string, when?: Date): boolean;
|
|
3657
|
+
clockedInAgents(when?: Date): string[];
|
|
2188
3658
|
}
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
3659
|
+
|
|
3660
|
+
interface WorkItem {
|
|
3661
|
+
id: string;
|
|
3662
|
+
title: string;
|
|
3663
|
+
description?: string;
|
|
3664
|
+
assignee?: string;
|
|
3665
|
+
estimatedSeconds?: number;
|
|
3666
|
+
url?: string;
|
|
3667
|
+
priority?: number;
|
|
3668
|
+
}
|
|
3669
|
+
interface WorkReport {
|
|
3670
|
+
status: "in-progress" | "done" | "blocked";
|
|
3671
|
+
note?: string;
|
|
3672
|
+
timeSeconds?: number;
|
|
3673
|
+
blocker?: string;
|
|
3674
|
+
}
|
|
3675
|
+
interface WorkSource {
|
|
3676
|
+
type: string;
|
|
3677
|
+
listOpen(agentId: string): Promise<WorkItem[]>;
|
|
3678
|
+
claim(agentId: string, itemId: string): Promise<void>;
|
|
3679
|
+
report(itemId: string, update: WorkReport): Promise<void>;
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
declare class Reporter {
|
|
3683
|
+
private router;
|
|
3684
|
+
private org;
|
|
3685
|
+
private config;
|
|
3686
|
+
private log;
|
|
3687
|
+
constructor(router: MessageRouter, org: Organization, config: BusinessConfig, log: (...args: unknown[]) => void);
|
|
3688
|
+
postToMain(text: string, agentId?: string): Promise<void>;
|
|
3689
|
+
/** Post an escalation message up the chain of command. */
|
|
3690
|
+
escalate(fromAgent: string, subject: string, detail: string): Promise<void>;
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3693
|
+
interface DailyStats {
|
|
3694
|
+
date: string;
|
|
3695
|
+
perAgent: Record<string, {
|
|
3696
|
+
tasksCompleted: number;
|
|
3697
|
+
timeLoggedSeconds: number;
|
|
3698
|
+
onClockSeconds: number;
|
|
3699
|
+
blockers: number;
|
|
3700
|
+
utilization: number;
|
|
3701
|
+
}>;
|
|
3702
|
+
}
|
|
3703
|
+
interface TaskCompletion {
|
|
3704
|
+
agentId: string;
|
|
3705
|
+
durationSeconds: number;
|
|
3706
|
+
success: boolean;
|
|
3707
|
+
channel?: string;
|
|
3708
|
+
}
|
|
3709
|
+
declare class KPI {
|
|
3710
|
+
private org;
|
|
3711
|
+
private schedule;
|
|
3712
|
+
private log;
|
|
3713
|
+
private stats;
|
|
3714
|
+
private dir;
|
|
3715
|
+
private onClockTick;
|
|
3716
|
+
constructor(org: Organization, schedule: Schedule, log: (...args: unknown[]) => void);
|
|
3717
|
+
private loadOrInit;
|
|
3718
|
+
/** Called by the day-cycle minute tick to accumulate on-clock time. */
|
|
3719
|
+
tick(): void;
|
|
3720
|
+
recordTaskCompletion(t: TaskCompletion): void;
|
|
3721
|
+
recordBlocker(agentId: string): void;
|
|
3722
|
+
private recomputeUtil;
|
|
3723
|
+
private persist;
|
|
3724
|
+
flush(): void;
|
|
3725
|
+
snapshot(): DailyStats;
|
|
3726
|
+
/** Markdown summary for end-of-day main-channel post. */
|
|
3727
|
+
dailySummaryText(): string;
|
|
3728
|
+
}
|
|
3729
|
+
|
|
3730
|
+
declare class DayCycle {
|
|
3731
|
+
private config;
|
|
3732
|
+
private org;
|
|
3733
|
+
private schedule;
|
|
3734
|
+
private registry;
|
|
3735
|
+
private reporter;
|
|
3736
|
+
private kpi;
|
|
3737
|
+
private workSource;
|
|
3738
|
+
private daemonBase;
|
|
3739
|
+
private log;
|
|
3740
|
+
private timer?;
|
|
3741
|
+
private day;
|
|
3742
|
+
private currentDate;
|
|
3743
|
+
private runningTask;
|
|
3744
|
+
constructor(config: BusinessConfig, org: Organization, schedule: Schedule, registry: AgentRegistry, reporter: Reporter, kpi: KPI, workSource: WorkSource, daemonBase: string, log: (...args: unknown[]) => void);
|
|
3745
|
+
start(): void;
|
|
3746
|
+
stop(): void;
|
|
3747
|
+
private tick;
|
|
3748
|
+
private roleContext;
|
|
3749
|
+
private runLifecycle;
|
|
3750
|
+
private fireStandup;
|
|
3751
|
+
private fireWorkTick;
|
|
3752
|
+
private fireWrap;
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
/**
|
|
3756
|
+
* Business layer facade — constructed once by the daemon when
|
|
3757
|
+
* config.business?.enabled is true.
|
|
3758
|
+
*/
|
|
3759
|
+
declare class BusinessLayer {
|
|
3760
|
+
readonly org: Organization;
|
|
3761
|
+
readonly schedule: Schedule;
|
|
3762
|
+
readonly workSource: WorkSource;
|
|
3763
|
+
readonly reporter: Reporter;
|
|
3764
|
+
readonly kpi: KPI;
|
|
3765
|
+
readonly dayCycle: DayCycle;
|
|
3766
|
+
constructor(business: BusinessConfig, daemon: DaemonConfig, registry: AgentRegistry, router: MessageRouter, log: (...args: unknown[]) => void);
|
|
3767
|
+
start(): void;
|
|
3768
|
+
stop(): void;
|
|
3769
|
+
/** Record a task completion (called by router when an agent finishes a task). */
|
|
3770
|
+
recordTaskCompletion(agentId: string, durationSeconds: number, success: boolean, channel?: string): void;
|
|
3771
|
+
handleHttp(route: string, req: IncomingMessage$1, res: ServerResponse): Promise<boolean>;
|
|
3772
|
+
/** Short startup banner line. */
|
|
3773
|
+
summary(): string;
|
|
2205
3774
|
}
|
|
2206
3775
|
|
|
2207
3776
|
declare class MessageRouter {
|
|
@@ -2210,11 +3779,26 @@ declare class MessageRouter {
|
|
|
2210
3779
|
private channels;
|
|
2211
3780
|
private hooks?;
|
|
2212
3781
|
private mesh?;
|
|
3782
|
+
private serviceMatcher?;
|
|
3783
|
+
private business?;
|
|
2213
3784
|
private groupLog;
|
|
2214
3785
|
private log;
|
|
2215
3786
|
constructor(registry: AgentRegistry, config: DaemonConfig, hooks?: HookRegistry, log?: (...args: unknown[]) => void);
|
|
2216
3787
|
setMesh(mesh: A2AMesh): void;
|
|
3788
|
+
setServiceMatcher(matcher: ServiceMatcher): void;
|
|
3789
|
+
setBusiness(business: BusinessLayer): void;
|
|
2217
3790
|
addChannel(adapter: ChannelAdapter): void;
|
|
3791
|
+
/**
|
|
3792
|
+
* Send an outbound message to any registered channel.
|
|
3793
|
+
* Used for agent-initiated messages, cron notifications, cross-channel routing.
|
|
3794
|
+
*
|
|
3795
|
+
* If accountId is not provided for Telegram, auto-resolves from agentId binding.
|
|
3796
|
+
*/
|
|
3797
|
+
sendOutbound(msg: OutgoingMessage & {
|
|
3798
|
+
accountId?: string;
|
|
3799
|
+
}): Promise<string | void>;
|
|
3800
|
+
/** List registered channel names. */
|
|
3801
|
+
getChannelNames(): string[];
|
|
2218
3802
|
startAll(): Promise<void>;
|
|
2219
3803
|
stopAll(): Promise<void>;
|
|
2220
3804
|
private handleMessage;
|
|
@@ -2224,7 +3808,7 @@ declare class MessageRouter {
|
|
|
2224
3808
|
* Guards:
|
|
2225
3809
|
* 1. Max depth (default 3)
|
|
2226
3810
|
* 2. No agent called twice in the same chain (prevents A→B→A→B loops)
|
|
2227
|
-
*
|
|
3811
|
+
* Works on Telegram (multi-account), WhatsApp (shared number), Discord.
|
|
2228
3812
|
*/
|
|
2229
3813
|
private handleBotToBotChain;
|
|
2230
3814
|
private adapterSend;
|
|
@@ -2269,6 +3853,8 @@ declare class TelegramAdapter implements ChannelAdapter {
|
|
|
2269
3853
|
private resolveToken;
|
|
2270
3854
|
/** Track which account a chat was last seen on (for DMs) */
|
|
2271
3855
|
private chatAccountMap;
|
|
3856
|
+
private botInfo;
|
|
3857
|
+
private groupStore;
|
|
2272
3858
|
/**
|
|
2273
3859
|
* Send a message. Returns the sent message ID.
|
|
2274
3860
|
* Pass accountId to send from a specific bot account.
|
|
@@ -2289,6 +3875,16 @@ declare class TelegramAdapter implements ChannelAdapter {
|
|
|
2289
3875
|
*/
|
|
2290
3876
|
sendTyping(chatId: string, accountId?: string): Promise<void>;
|
|
2291
3877
|
private pollLoop;
|
|
3878
|
+
/**
|
|
3879
|
+
* Get verified context for a Telegram chat.
|
|
3880
|
+
* Reads from persistent group store (fed by my_chat_member events + API seed).
|
|
3881
|
+
*/
|
|
3882
|
+
getChannelMeta(chatId: string): Promise<ChannelMeta | undefined>;
|
|
3883
|
+
/**
|
|
3884
|
+
* Seed group membership by querying the Telegram API for each bot.
|
|
3885
|
+
* Called once per group on first encounter, then maintained via my_chat_member events.
|
|
3886
|
+
*/
|
|
3887
|
+
private seedGroupMembership;
|
|
2292
3888
|
private apiCall;
|
|
2293
3889
|
}
|
|
2294
3890
|
|
|
@@ -2305,6 +3901,9 @@ declare class WhatsAppAdapter implements ChannelAdapter {
|
|
|
2305
3901
|
private routes;
|
|
2306
3902
|
private handler?;
|
|
2307
3903
|
private sock;
|
|
3904
|
+
private reconnectAttempts;
|
|
3905
|
+
/** Generation counter — incremented on each start() to ignore stale socket events */
|
|
3906
|
+
private generation;
|
|
2308
3907
|
private sentMessageIds;
|
|
2309
3908
|
private log;
|
|
2310
3909
|
constructor(config: {
|
|
@@ -2335,11 +3934,16 @@ interface CronJobState {
|
|
|
2335
3934
|
prompt: string;
|
|
2336
3935
|
timeout: number;
|
|
2337
3936
|
model?: string;
|
|
2338
|
-
onError: "log" | "notify" | "disable"
|
|
3937
|
+
onError: Array<"log" | "notify" | "disable">;
|
|
2339
3938
|
lastRun?: Date;
|
|
2340
3939
|
nextRun?: Date;
|
|
3940
|
+
lastSuccess?: Date;
|
|
3941
|
+
lastError?: string;
|
|
2341
3942
|
consecutiveErrors: number;
|
|
2342
3943
|
totalRuns: number;
|
|
3944
|
+
totalFailures: number;
|
|
3945
|
+
/** Whether a retry is currently pending */
|
|
3946
|
+
retryPending?: boolean;
|
|
2343
3947
|
}
|
|
2344
3948
|
interface CronRunResult {
|
|
2345
3949
|
jobId: string;
|
|
@@ -2349,190 +3953,67 @@ interface CronRunResult {
|
|
|
2349
3953
|
response?: string;
|
|
2350
3954
|
error?: string;
|
|
2351
3955
|
duration: number;
|
|
3956
|
+
/** Was this a retry attempt? */
|
|
3957
|
+
isRetry?: boolean;
|
|
3958
|
+
retryAttempt?: number;
|
|
2352
3959
|
}
|
|
2353
3960
|
|
|
3961
|
+
/** Notification callback — injected by daemon to send alerts via channels */
|
|
3962
|
+
type CronNotifyCallback = (jobId: string, agent: string, error: string, consecutiveErrors: number) => Promise<void>;
|
|
2354
3963
|
declare class CronScheduler {
|
|
2355
3964
|
private jobs;
|
|
2356
3965
|
private timers;
|
|
2357
3966
|
private registry;
|
|
2358
3967
|
private hooks?;
|
|
2359
3968
|
private runsDir;
|
|
3969
|
+
private lastRunFile;
|
|
2360
3970
|
private running;
|
|
3971
|
+
private notifyCallback?;
|
|
2361
3972
|
private log;
|
|
2362
3973
|
constructor(config: DaemonConfig, registry: AgentRegistry, hooks?: HookRegistry, log?: (...args: unknown[]) => void);
|
|
3974
|
+
/**
|
|
3975
|
+
* Set a notification callback for failed crons.
|
|
3976
|
+
* Called when onError is "notify" or after multiple consecutive failures.
|
|
3977
|
+
*/
|
|
3978
|
+
setNotifyCallback(cb: CronNotifyCallback): void;
|
|
2363
3979
|
start(): Promise<void>;
|
|
2364
3980
|
stop(): Promise<void>;
|
|
2365
3981
|
private scheduleNext;
|
|
3982
|
+
private scheduleRetry;
|
|
2366
3983
|
private executeJob;
|
|
2367
|
-
private logRun;
|
|
2368
|
-
/**
|
|
2369
|
-
* List all jobs and their status.
|
|
2370
|
-
*/
|
|
2371
|
-
list(): CronJobState[];
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
/**
|
|
2375
|
-
* Access levels for wiki articles:
|
|
2376
|
-
* - private: only the owning agent can read/write
|
|
2377
|
-
* - shared: specific agents listed in `sharedWith` can read, owner can write
|
|
2378
|
-
* - public: all agents on this node can read, owner can write
|
|
2379
|
-
*/
|
|
2380
|
-
type WikiAccess = "private" | "shared" | "public";
|
|
2381
|
-
interface WikiArticleMeta {
|
|
2382
|
-
title: string;
|
|
2383
|
-
type: string;
|
|
2384
|
-
owner: string;
|
|
2385
|
-
access: WikiAccess;
|
|
2386
|
-
sharedWith?: string[];
|
|
2387
|
-
created: string;
|
|
2388
|
-
lastUpdated: string;
|
|
2389
|
-
related: string[];
|
|
2390
|
-
sources: string[];
|
|
2391
|
-
tags?: string[];
|
|
2392
|
-
}
|
|
2393
|
-
interface WikiArticle {
|
|
2394
|
-
meta: WikiArticleMeta;
|
|
2395
|
-
content: string;
|
|
2396
|
-
path: string;
|
|
2397
|
-
}
|
|
2398
|
-
interface WikiEntry {
|
|
2399
|
-
id: string;
|
|
2400
|
-
date: string;
|
|
2401
|
-
agentId: string;
|
|
2402
|
-
source: string;
|
|
2403
|
-
sourceContext?: string;
|
|
2404
|
-
content: string;
|
|
2405
|
-
meta?: Record<string, unknown>;
|
|
2406
|
-
}
|
|
2407
|
-
interface WikiIndex {
|
|
2408
|
-
articles: Array<{
|
|
2409
|
-
path: string;
|
|
2410
|
-
title: string;
|
|
2411
|
-
type: string;
|
|
2412
|
-
owner: string;
|
|
2413
|
-
access: WikiAccess;
|
|
2414
|
-
sharedWith?: string[];
|
|
2415
|
-
aliases: string[];
|
|
2416
|
-
backlinks: number;
|
|
2417
|
-
}>;
|
|
2418
|
-
lastRebuilt: string;
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
declare class WikiStore {
|
|
2422
|
-
private baseDir;
|
|
2423
|
-
private rawDir;
|
|
2424
|
-
private log;
|
|
2425
|
-
constructor(baseDir?: string, log?: (...args: unknown[]) => void);
|
|
2426
|
-
/**
|
|
2427
|
-
* Check if an agent can read an article.
|
|
2428
|
-
*/
|
|
2429
|
-
canRead(article: WikiArticleMeta, agentId: string): boolean;
|
|
2430
|
-
/**
|
|
2431
|
-
* Check if an agent can write an article.
|
|
2432
|
-
*/
|
|
2433
|
-
canWrite(article: WikiArticleMeta, agentId: string): boolean;
|
|
2434
|
-
/**
|
|
2435
|
-
* Add a raw entry (from a conversation, cron result, etc.)
|
|
2436
|
-
*/
|
|
2437
|
-
addEntry(entry: WikiEntry): string;
|
|
2438
|
-
/**
|
|
2439
|
-
* List raw entries, optionally filtered by agent or date range.
|
|
2440
|
-
*/
|
|
2441
|
-
listEntries(filter?: {
|
|
2442
|
-
agentId?: string;
|
|
2443
|
-
after?: string;
|
|
2444
|
-
before?: string;
|
|
2445
|
-
}): WikiEntry[];
|
|
2446
|
-
private parseEntry;
|
|
2447
|
-
/**
|
|
2448
|
-
* Write or update a wiki article.
|
|
2449
|
-
*/
|
|
2450
|
-
writeArticle(path: string, meta: WikiArticleMeta, content: string, agentId: string): boolean;
|
|
2451
|
-
/**
|
|
2452
|
-
* Read an article. Returns null if not found.
|
|
2453
|
-
*/
|
|
2454
|
-
readArticle(path: string): WikiArticle | null;
|
|
2455
|
-
/**
|
|
2456
|
-
* Read an article with permission check.
|
|
2457
|
-
*/
|
|
2458
|
-
readArticleAs(path: string, agentId: string): WikiArticle | null;
|
|
2459
|
-
private parseArticle;
|
|
2460
|
-
/**
|
|
2461
|
-
* List all articles accessible to an agent.
|
|
2462
|
-
*/
|
|
2463
|
-
listArticles(agentId: string): WikiArticle[];
|
|
2464
|
-
/**
|
|
2465
|
-
* Search articles by keyword. Returns articles the agent can read.
|
|
2466
|
-
*/
|
|
2467
|
-
search(query: string, agentId: string, maxResults?: number): WikiArticle[];
|
|
2468
3984
|
/**
|
|
2469
|
-
*
|
|
2470
|
-
*
|
|
3985
|
+
* Detect cron jobs that should have fired while the daemon was down.
|
|
3986
|
+
* Compares saved last-run times against the cron schedule.
|
|
2471
3987
|
*/
|
|
2472
|
-
|
|
3988
|
+
private detectMissedRuns;
|
|
2473
3989
|
/**
|
|
2474
|
-
*
|
|
2475
|
-
* Token-efficient: includes title + first ~500 chars of each article.
|
|
3990
|
+
* Execute missed runs (catch-up). Runs sequentially to avoid overwhelming agents.
|
|
2476
3991
|
*/
|
|
2477
|
-
|
|
3992
|
+
private executeMissedRuns;
|
|
3993
|
+
private notifyFailure;
|
|
3994
|
+
private notifyDisabled;
|
|
3995
|
+
private saveLastRuns;
|
|
3996
|
+
private loadLastRuns;
|
|
3997
|
+
private logRun;
|
|
2478
3998
|
/**
|
|
2479
|
-
*
|
|
3999
|
+
* List all jobs and their status (including failure info).
|
|
2480
4000
|
*/
|
|
2481
|
-
|
|
4001
|
+
list(): CronJobState[];
|
|
2482
4002
|
/**
|
|
2483
|
-
* Get
|
|
2484
|
-
*/
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
4003
|
+
* Get a health summary of cron jobs.
|
|
4004
|
+
*/
|
|
4005
|
+
health(): {
|
|
4006
|
+
healthy: number;
|
|
4007
|
+
failing: number;
|
|
4008
|
+
disabled: number;
|
|
4009
|
+
missed: number;
|
|
4010
|
+
jobs: Array<{
|
|
4011
|
+
id: string;
|
|
4012
|
+
status: string;
|
|
4013
|
+
consecutiveErrors: number;
|
|
4014
|
+
lastError?: string;
|
|
4015
|
+
}>;
|
|
2491
4016
|
};
|
|
2492
|
-
/**
|
|
2493
|
-
* Append an entry to log.md.
|
|
2494
|
-
* Format: ## [YYYY-MM-DD HH:MM] action | details
|
|
2495
|
-
*/
|
|
2496
|
-
appendLog(action: string, details: string): void;
|
|
2497
|
-
/**
|
|
2498
|
-
* Get recent log entries.
|
|
2499
|
-
*/
|
|
2500
|
-
getLog(limit?: number): string[];
|
|
2501
|
-
/**
|
|
2502
|
-
* Create _schema.md if it doesn't exist.
|
|
2503
|
-
* This tells the LLM how to operate on the wiki.
|
|
2504
|
-
*/
|
|
2505
|
-
private ensureSchema;
|
|
2506
|
-
/**
|
|
2507
|
-
* Extract all [[wikilinks]] from article content.
|
|
2508
|
-
*/
|
|
2509
|
-
extractWikilinks(content: string): string[];
|
|
2510
|
-
/**
|
|
2511
|
-
* Build backlinks index: for each article, which other articles link to it.
|
|
2512
|
-
*/
|
|
2513
|
-
buildBacklinks(): Record<string, string[]>;
|
|
2514
|
-
/**
|
|
2515
|
-
* Get backlinks for a specific article title.
|
|
2516
|
-
*/
|
|
2517
|
-
getBacklinks(title: string): string[];
|
|
2518
|
-
/**
|
|
2519
|
-
* Run a lint pass on the wiki. Returns issues found.
|
|
2520
|
-
*/
|
|
2521
|
-
lint(): Array<{
|
|
2522
|
-
type: string;
|
|
2523
|
-
article: string;
|
|
2524
|
-
message: string;
|
|
2525
|
-
}>;
|
|
2526
|
-
/**
|
|
2527
|
-
* Get unabsorbed entries (entries not referenced by any article's sources field).
|
|
2528
|
-
*/
|
|
2529
|
-
getUnabsorbedEntries(): WikiEntry[];
|
|
2530
|
-
/**
|
|
2531
|
-
* Build an absorb prompt for unprocessed entries.
|
|
2532
|
-
* Returns a prompt string an agent can execute to compile entries into articles.
|
|
2533
|
-
*/
|
|
2534
|
-
buildAbsorbPrompt(maxEntries?: number): string | null;
|
|
2535
|
-
private walkDir;
|
|
2536
4017
|
}
|
|
2537
4018
|
|
|
2538
4019
|
interface ProviderCapabilities {
|