@askexenow/exe-os 0.9.16 → 0.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/backfill-conversations.js +1242 -909
- package/dist/bin/backfill-responses.js +1245 -912
- package/dist/bin/backfill-vectors.js +1244 -906
- package/dist/bin/cleanup-stale-review-tasks.js +1870 -417
- package/dist/bin/cli.js +217 -107
- package/dist/bin/exe-agent-config.js +2 -2
- package/dist/bin/exe-agent.js +62 -0
- package/dist/bin/exe-assign.js +346 -10
- package/dist/bin/exe-boot.js +387 -32
- package/dist/bin/exe-call.js +72 -2
- package/dist/bin/exe-cloud.js +8 -0
- package/dist/bin/exe-dispatch.js +1821 -225
- package/dist/bin/exe-doctor.js +720 -52
- package/dist/bin/exe-export-behaviors.js +1429 -148
- package/dist/bin/exe-forget.js +1408 -34
- package/dist/bin/exe-gateway.js +1629 -1295
- package/dist/bin/exe-heartbeat.js +1899 -448
- package/dist/bin/exe-kill.js +1624 -346
- package/dist/bin/exe-launch-agent.js +726 -90
- package/dist/bin/exe-link.js +27 -8
- package/dist/bin/exe-new-employee.js +75 -9
- package/dist/bin/exe-pending-messages.js +2769 -1316
- package/dist/bin/exe-pending-notifications.js +2829 -1376
- package/dist/bin/exe-pending-reviews.js +2847 -1392
- package/dist/bin/exe-rename.js +89 -8
- package/dist/bin/exe-review.js +1494 -312
- package/dist/bin/exe-search.js +1608 -1300
- package/dist/bin/exe-session-cleanup.js +194 -91
- package/dist/bin/exe-settings.js +10 -2
- package/dist/bin/exe-start-codex.js +769 -120
- package/dist/bin/exe-start-opencode.js +763 -108
- package/dist/bin/exe-status.js +1887 -434
- package/dist/bin/exe-team.js +1782 -324
- package/dist/bin/git-sweep.js +408 -33
- package/dist/bin/graph-backfill.js +681 -27
- package/dist/bin/graph-export.js +1419 -141
- package/dist/bin/install.js +4 -8
- package/dist/bin/intercom-check.js +8641 -0
- package/dist/bin/scan-tasks.js +553 -38
- package/dist/bin/setup.js +82 -10
- package/dist/bin/shard-migrate.js +682 -28
- package/dist/gateway/index.js +1629 -1295
- package/dist/hooks/bug-report-worker.js +1136 -183
- package/dist/hooks/codex-stop-task-finalizer.js +1060 -107
- package/dist/hooks/commit-complete.js +408 -33
- package/dist/hooks/error-recall.js +1608 -1300
- package/dist/hooks/ingest-worker.js +250 -7966
- package/dist/hooks/ingest.js +707 -119
- package/dist/hooks/instructions-loaded.js +383 -20
- package/dist/hooks/notification.js +383 -20
- package/dist/hooks/post-compact.js +384 -21
- package/dist/hooks/{response-ingest-worker.js → post-tool-combined.js} +4157 -1716
- package/dist/hooks/pre-compact.js +486 -45
- package/dist/hooks/pre-tool-use.js +385 -22
- package/dist/hooks/prompt-submit.js +291 -96
- package/dist/hooks/session-end.js +490 -48
- package/dist/hooks/session-start.js +236 -22
- package/dist/hooks/stop.js +192 -50
- package/dist/hooks/subagent-stop.js +95 -18
- package/dist/hooks/summary-worker.js +205 -361
- package/dist/index.js +221 -105
- package/dist/lib/agent-config.js +2 -2
- package/dist/lib/cloud-sync.js +27 -8
- package/dist/lib/consolidation.js +437 -41
- package/dist/lib/database.js +20 -8
- package/dist/lib/db-daemon-client.js +2 -2
- package/dist/lib/db.js +20 -8
- package/dist/lib/device-registry.js +27 -8
- package/dist/lib/employee-templates.js +62 -0
- package/dist/lib/employees.js +2 -2
- package/dist/lib/exe-daemon.js +6703 -6259
- package/dist/lib/hybrid-search.js +1608 -1300
- package/dist/lib/identity.js +1 -1
- package/dist/lib/messaging.js +11 -3
- package/dist/lib/reminders.js +1 -1
- package/dist/lib/schedules.js +718 -26
- package/dist/lib/session-registry.js +11 -0
- package/dist/lib/skill-learning.js +639 -9
- package/dist/lib/store.js +676 -27
- package/dist/lib/tasks.js +665 -27
- package/dist/lib/tmux-routing.js +732 -94
- package/dist/lib/token-spend.js +1 -1
- package/dist/mcp/server.js +856 -383
- package/dist/mcp/tools/complete-reminder.js +1 -1
- package/dist/mcp/tools/create-reminder.js +1 -1
- package/dist/mcp/tools/create-task.js +616 -46
- package/dist/mcp/tools/deactivate-behavior.js +9 -1
- package/dist/mcp/tools/list-reminders.js +1 -1
- package/dist/mcp/tools/list-tasks.js +10 -2
- package/dist/mcp/tools/send-message.js +11 -3
- package/dist/mcp/tools/update-task.js +677 -39
- package/dist/runtime/index.js +425 -37
- package/dist/tui/App.js +365 -34
- package/package.json +5 -2
- package/src/commands/exe/intercom.md +6 -17
- package/dist/bin/wiki-sync.js +0 -2991
- package/dist/hooks/prompt-ingest-worker.js +0 -3979
package/dist/bin/exe-assign.js
CHANGED
|
@@ -290,6 +290,15 @@ var init_employees = __esm({
|
|
|
290
290
|
}
|
|
291
291
|
});
|
|
292
292
|
|
|
293
|
+
// src/types/memory.ts
|
|
294
|
+
var EMBEDDING_DIM;
|
|
295
|
+
var init_memory = __esm({
|
|
296
|
+
"src/types/memory.ts"() {
|
|
297
|
+
"use strict";
|
|
298
|
+
EMBEDDING_DIM = 1024;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
293
302
|
// src/lib/daemon-auth.ts
|
|
294
303
|
import crypto from "crypto";
|
|
295
304
|
import path3 from "path";
|
|
@@ -716,6 +725,9 @@ async function embedViaClient(text, priority = "high") {
|
|
|
716
725
|
);
|
|
717
726
|
return !result.error && result.vectors?.[0] ? result.vectors[0] : null;
|
|
718
727
|
}
|
|
728
|
+
function isClientConnected() {
|
|
729
|
+
return _connected;
|
|
730
|
+
}
|
|
719
731
|
var SOCKET_PATH, PID_PATH, SPAWN_LOCK_PATH, SPAWN_LOCK_STALE_MS, CONNECT_TIMEOUT_MS, REQUEST_TIMEOUT_MS, DAEMON_TOKEN_ENV, _socket, _connected, _buffer, _requestCount, _consecutiveFailures, HEALTH_CHECK_INTERVAL, MAX_RETRIES_BEFORE_RESTART, RETRY_DELAYS_MS, MIN_DAEMON_AGE_MS, _pending, MAX_BUFFER;
|
|
720
732
|
var init_exe_daemon_client = __esm({
|
|
721
733
|
"src/lib/exe-daemon-client.ts"() {
|
|
@@ -792,9 +804,9 @@ var MAX_RETRIES, BASE_DELAY_MS, MAX_JITTER_MS;
|
|
|
792
804
|
var init_db_retry = __esm({
|
|
793
805
|
"src/lib/db-retry.ts"() {
|
|
794
806
|
"use strict";
|
|
795
|
-
MAX_RETRIES =
|
|
796
|
-
BASE_DELAY_MS =
|
|
797
|
-
MAX_JITTER_MS =
|
|
807
|
+
MAX_RETRIES = 5;
|
|
808
|
+
BASE_DELAY_MS = 250;
|
|
809
|
+
MAX_JITTER_MS = 400;
|
|
798
810
|
}
|
|
799
811
|
});
|
|
800
812
|
|
|
@@ -1382,7 +1394,218 @@ var init_database_adapter = __esm({
|
|
|
1382
1394
|
}
|
|
1383
1395
|
});
|
|
1384
1396
|
|
|
1397
|
+
// src/lib/daemon-protocol.ts
|
|
1398
|
+
function serializeValue(v) {
|
|
1399
|
+
if (v === null || v === void 0) return null;
|
|
1400
|
+
if (typeof v === "bigint") return Number(v);
|
|
1401
|
+
if (typeof v === "boolean") return v ? 1 : 0;
|
|
1402
|
+
if (v instanceof Uint8Array) {
|
|
1403
|
+
return { __blob: Buffer.from(v).toString("base64") };
|
|
1404
|
+
}
|
|
1405
|
+
if (ArrayBuffer.isView(v)) {
|
|
1406
|
+
return { __blob: Buffer.from(v.buffer, v.byteOffset, v.byteLength).toString("base64") };
|
|
1407
|
+
}
|
|
1408
|
+
if (v instanceof ArrayBuffer) {
|
|
1409
|
+
return { __blob: Buffer.from(v).toString("base64") };
|
|
1410
|
+
}
|
|
1411
|
+
if (typeof v === "string" || typeof v === "number") return v;
|
|
1412
|
+
return String(v);
|
|
1413
|
+
}
|
|
1414
|
+
function deserializeValue(v) {
|
|
1415
|
+
if (v === null) return null;
|
|
1416
|
+
if (typeof v === "object" && v !== null && "__blob" in v) {
|
|
1417
|
+
const buf = Buffer.from(v.__blob, "base64");
|
|
1418
|
+
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
|
|
1419
|
+
}
|
|
1420
|
+
return v;
|
|
1421
|
+
}
|
|
1422
|
+
function deserializeResultSet(srs) {
|
|
1423
|
+
const rows = srs.rows.map((obj) => {
|
|
1424
|
+
const values = srs.columns.map(
|
|
1425
|
+
(col) => deserializeValue(obj[col] ?? null)
|
|
1426
|
+
);
|
|
1427
|
+
const row = values;
|
|
1428
|
+
for (let i = 0; i < srs.columns.length; i++) {
|
|
1429
|
+
const col = srs.columns[i];
|
|
1430
|
+
if (col !== void 0) {
|
|
1431
|
+
row[col] = values[i] ?? null;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
Object.defineProperty(row, "length", {
|
|
1435
|
+
value: values.length,
|
|
1436
|
+
enumerable: false
|
|
1437
|
+
});
|
|
1438
|
+
return row;
|
|
1439
|
+
});
|
|
1440
|
+
return {
|
|
1441
|
+
columns: srs.columns,
|
|
1442
|
+
columnTypes: srs.columnTypes ?? [],
|
|
1443
|
+
rows,
|
|
1444
|
+
rowsAffected: srs.rowsAffected,
|
|
1445
|
+
lastInsertRowid: srs.lastInsertRowid != null ? BigInt(srs.lastInsertRowid) : void 0,
|
|
1446
|
+
toJSON: () => ({
|
|
1447
|
+
columns: srs.columns,
|
|
1448
|
+
columnTypes: srs.columnTypes ?? [],
|
|
1449
|
+
rows: srs.rows,
|
|
1450
|
+
rowsAffected: srs.rowsAffected,
|
|
1451
|
+
lastInsertRowid: srs.lastInsertRowid
|
|
1452
|
+
})
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
var init_daemon_protocol = __esm({
|
|
1456
|
+
"src/lib/daemon-protocol.ts"() {
|
|
1457
|
+
"use strict";
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
|
|
1461
|
+
// src/lib/db-daemon-client.ts
|
|
1462
|
+
var db_daemon_client_exports = {};
|
|
1463
|
+
__export(db_daemon_client_exports, {
|
|
1464
|
+
createDaemonDbClient: () => createDaemonDbClient,
|
|
1465
|
+
initDaemonDbClient: () => initDaemonDbClient
|
|
1466
|
+
});
|
|
1467
|
+
function normalizeStatement2(stmt) {
|
|
1468
|
+
if (typeof stmt === "string") {
|
|
1469
|
+
return { sql: stmt, args: [] };
|
|
1470
|
+
}
|
|
1471
|
+
const sql = stmt.sql;
|
|
1472
|
+
let args = [];
|
|
1473
|
+
if (Array.isArray(stmt.args)) {
|
|
1474
|
+
args = stmt.args.map((v) => serializeValue(v));
|
|
1475
|
+
} else if (stmt.args && typeof stmt.args === "object") {
|
|
1476
|
+
const named = {};
|
|
1477
|
+
for (const [key, val] of Object.entries(stmt.args)) {
|
|
1478
|
+
named[key] = serializeValue(val);
|
|
1479
|
+
}
|
|
1480
|
+
return { sql, args: named };
|
|
1481
|
+
}
|
|
1482
|
+
return { sql, args };
|
|
1483
|
+
}
|
|
1484
|
+
function createDaemonDbClient(fallbackClient) {
|
|
1485
|
+
let _useDaemon = false;
|
|
1486
|
+
const client = {
|
|
1487
|
+
async execute(stmt) {
|
|
1488
|
+
if (!_useDaemon || !isClientConnected()) {
|
|
1489
|
+
return fallbackClient.execute(stmt);
|
|
1490
|
+
}
|
|
1491
|
+
const { sql, args } = normalizeStatement2(stmt);
|
|
1492
|
+
const response = await sendDaemonRequest({
|
|
1493
|
+
type: "db-execute",
|
|
1494
|
+
sql,
|
|
1495
|
+
args
|
|
1496
|
+
});
|
|
1497
|
+
if (response.error) {
|
|
1498
|
+
const errMsg = String(response.error);
|
|
1499
|
+
if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed" || errMsg === "DB not initialized") {
|
|
1500
|
+
process.stderr.write(`[db-daemon] Transport error (${errMsg}), falling back to direct
|
|
1501
|
+
`);
|
|
1502
|
+
return fallbackClient.execute(stmt);
|
|
1503
|
+
}
|
|
1504
|
+
throw new Error(errMsg);
|
|
1505
|
+
}
|
|
1506
|
+
if (response.db) {
|
|
1507
|
+
return deserializeResultSet(response.db);
|
|
1508
|
+
}
|
|
1509
|
+
process.stderr.write("[db-daemon] Unexpected response shape, falling back to direct\n");
|
|
1510
|
+
return fallbackClient.execute(stmt);
|
|
1511
|
+
},
|
|
1512
|
+
async batch(stmts, mode) {
|
|
1513
|
+
if (!_useDaemon || !isClientConnected()) {
|
|
1514
|
+
return fallbackClient.batch(stmts, mode);
|
|
1515
|
+
}
|
|
1516
|
+
const statements = stmts.map(normalizeStatement2);
|
|
1517
|
+
const response = await sendDaemonRequest({
|
|
1518
|
+
type: "db-batch",
|
|
1519
|
+
statements,
|
|
1520
|
+
mode: mode ?? "deferred"
|
|
1521
|
+
});
|
|
1522
|
+
if (response.error) {
|
|
1523
|
+
const errMsg = String(response.error);
|
|
1524
|
+
if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed" || errMsg === "DB not initialized") {
|
|
1525
|
+
process.stderr.write(`[db-daemon] Batch transport error (${errMsg}), falling back to direct
|
|
1526
|
+
`);
|
|
1527
|
+
return fallbackClient.batch(stmts, mode);
|
|
1528
|
+
}
|
|
1529
|
+
throw new Error(errMsg);
|
|
1530
|
+
}
|
|
1531
|
+
const batchResults = response["db-batch"];
|
|
1532
|
+
if (batchResults) {
|
|
1533
|
+
return batchResults.map(deserializeResultSet);
|
|
1534
|
+
}
|
|
1535
|
+
process.stderr.write("[db-daemon] Unexpected batch response shape, falling back to direct\n");
|
|
1536
|
+
return fallbackClient.batch(stmts, mode);
|
|
1537
|
+
},
|
|
1538
|
+
// Transaction support — delegate to fallback (transactions need direct connection)
|
|
1539
|
+
async transaction(mode) {
|
|
1540
|
+
return fallbackClient.transaction(mode);
|
|
1541
|
+
},
|
|
1542
|
+
// executeMultiple — delegate to fallback (used only for schema migrations)
|
|
1543
|
+
async executeMultiple(sql) {
|
|
1544
|
+
return fallbackClient.executeMultiple(sql);
|
|
1545
|
+
},
|
|
1546
|
+
// migrate — delegate to fallback
|
|
1547
|
+
async migrate(stmts) {
|
|
1548
|
+
return fallbackClient.migrate(stmts);
|
|
1549
|
+
},
|
|
1550
|
+
// Sync mode — delegate to fallback
|
|
1551
|
+
sync() {
|
|
1552
|
+
return fallbackClient.sync();
|
|
1553
|
+
},
|
|
1554
|
+
close() {
|
|
1555
|
+
_useDaemon = false;
|
|
1556
|
+
},
|
|
1557
|
+
get closed() {
|
|
1558
|
+
return fallbackClient.closed;
|
|
1559
|
+
},
|
|
1560
|
+
get protocol() {
|
|
1561
|
+
return fallbackClient.protocol;
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
return {
|
|
1565
|
+
...client,
|
|
1566
|
+
/** Enable daemon routing (call after confirming daemon is connected) */
|
|
1567
|
+
_enableDaemon() {
|
|
1568
|
+
_useDaemon = true;
|
|
1569
|
+
},
|
|
1570
|
+
/** Check if daemon routing is active */
|
|
1571
|
+
_isDaemonActive() {
|
|
1572
|
+
return _useDaemon && isClientConnected();
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
async function initDaemonDbClient(fallbackClient) {
|
|
1577
|
+
if (process.env.EXE_IS_DAEMON === "1") return null;
|
|
1578
|
+
const connected = await connectEmbedDaemon();
|
|
1579
|
+
if (!connected) {
|
|
1580
|
+
process.stderr.write("[db-daemon] Daemon unavailable \u2014 using direct SQLite\n");
|
|
1581
|
+
return null;
|
|
1582
|
+
}
|
|
1583
|
+
const client = createDaemonDbClient(fallbackClient);
|
|
1584
|
+
client._enableDaemon();
|
|
1585
|
+
process.stderr.write("[db-daemon] DB routing through daemon (single-writer)\n");
|
|
1586
|
+
return client;
|
|
1587
|
+
}
|
|
1588
|
+
var init_db_daemon_client = __esm({
|
|
1589
|
+
"src/lib/db-daemon-client.ts"() {
|
|
1590
|
+
"use strict";
|
|
1591
|
+
init_exe_daemon_client();
|
|
1592
|
+
init_daemon_protocol();
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1595
|
+
|
|
1385
1596
|
// src/lib/database.ts
|
|
1597
|
+
var database_exports = {};
|
|
1598
|
+
__export(database_exports, {
|
|
1599
|
+
disposeDatabase: () => disposeDatabase,
|
|
1600
|
+
disposeTurso: () => disposeTurso,
|
|
1601
|
+
ensureSchema: () => ensureSchema,
|
|
1602
|
+
getClient: () => getClient,
|
|
1603
|
+
getRawClient: () => getRawClient,
|
|
1604
|
+
initDaemonClient: () => initDaemonClient,
|
|
1605
|
+
initDatabase: () => initDatabase,
|
|
1606
|
+
initTurso: () => initTurso,
|
|
1607
|
+
isInitialized: () => isInitialized
|
|
1608
|
+
});
|
|
1386
1609
|
import { createClient } from "@libsql/client";
|
|
1387
1610
|
async function initDatabase(config) {
|
|
1388
1611
|
if (_walCheckpointTimer) {
|
|
@@ -1421,15 +1644,18 @@ async function initDatabase(config) {
|
|
|
1421
1644
|
});
|
|
1422
1645
|
}, 3e4);
|
|
1423
1646
|
_walCheckpointTimer.unref();
|
|
1424
|
-
if (process.env.DATABASE_URL) {
|
|
1647
|
+
if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
|
|
1425
1648
|
_adapterClient = await createPrismaDbAdapter(_resilientClient);
|
|
1426
1649
|
}
|
|
1427
1650
|
}
|
|
1651
|
+
function isInitialized() {
|
|
1652
|
+
return _adapterClient !== null || _client !== null;
|
|
1653
|
+
}
|
|
1428
1654
|
function getClient() {
|
|
1429
1655
|
if (!_adapterClient) {
|
|
1430
1656
|
throw new Error("Database client not initialized. Call initDatabase() first.");
|
|
1431
1657
|
}
|
|
1432
|
-
if (process.env.DATABASE_URL) {
|
|
1658
|
+
if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
|
|
1433
1659
|
return _adapterClient;
|
|
1434
1660
|
}
|
|
1435
1661
|
if (process.env.EXE_IS_DAEMON === "1") {
|
|
@@ -1440,6 +1666,22 @@ function getClient() {
|
|
|
1440
1666
|
}
|
|
1441
1667
|
return _resilientClient;
|
|
1442
1668
|
}
|
|
1669
|
+
async function initDaemonClient() {
|
|
1670
|
+
if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") return;
|
|
1671
|
+
if (process.env.EXE_IS_DAEMON === "1") return;
|
|
1672
|
+
if (process.env.VITEST) return;
|
|
1673
|
+
if (!_resilientClient) return;
|
|
1674
|
+
if (_daemonClient) return;
|
|
1675
|
+
try {
|
|
1676
|
+
const { initDaemonDbClient: initDaemonDbClient2 } = await Promise.resolve().then(() => (init_db_daemon_client(), db_daemon_client_exports));
|
|
1677
|
+
_daemonClient = await initDaemonDbClient2(_resilientClient);
|
|
1678
|
+
} catch (err) {
|
|
1679
|
+
process.stderr.write(
|
|
1680
|
+
`[database] Daemon client init failed (non-fatal): ${err instanceof Error ? err.message : String(err)}
|
|
1681
|
+
`
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1443
1685
|
function getRawClient() {
|
|
1444
1686
|
if (!_client) {
|
|
1445
1687
|
throw new Error("Database client not initialized. Call initDatabase() first.");
|
|
@@ -1578,6 +1820,13 @@ async function ensureSchema() {
|
|
|
1578
1820
|
});
|
|
1579
1821
|
} catch {
|
|
1580
1822
|
}
|
|
1823
|
+
try {
|
|
1824
|
+
await client.execute({
|
|
1825
|
+
sql: `ALTER TABLE behaviors ADD COLUMN vector F32_BLOB(${EMBEDDING_DIM})`,
|
|
1826
|
+
args: []
|
|
1827
|
+
});
|
|
1828
|
+
} catch {
|
|
1829
|
+
}
|
|
1581
1830
|
try {
|
|
1582
1831
|
await client.execute({
|
|
1583
1832
|
sql: `ALTER TABLE tasks ADD COLUMN blocked_by TEXT`,
|
|
@@ -2422,19 +2671,40 @@ async function ensureSchema() {
|
|
|
2422
2671
|
} catch {
|
|
2423
2672
|
}
|
|
2424
2673
|
}
|
|
2425
|
-
|
|
2674
|
+
async function disposeDatabase() {
|
|
2675
|
+
if (_walCheckpointTimer) {
|
|
2676
|
+
clearInterval(_walCheckpointTimer);
|
|
2677
|
+
_walCheckpointTimer = null;
|
|
2678
|
+
}
|
|
2679
|
+
if (_daemonClient) {
|
|
2680
|
+
_daemonClient.close();
|
|
2681
|
+
_daemonClient = null;
|
|
2682
|
+
}
|
|
2683
|
+
if (_adapterClient && _adapterClient !== _resilientClient) {
|
|
2684
|
+
_adapterClient.close();
|
|
2685
|
+
}
|
|
2686
|
+
_adapterClient = null;
|
|
2687
|
+
if (_client) {
|
|
2688
|
+
_client.close();
|
|
2689
|
+
_client = null;
|
|
2690
|
+
_resilientClient = null;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
var _client, _resilientClient, _walCheckpointTimer, _daemonClient, _adapterClient, initTurso, disposeTurso;
|
|
2426
2694
|
var init_database = __esm({
|
|
2427
2695
|
"src/lib/database.ts"() {
|
|
2428
2696
|
"use strict";
|
|
2429
2697
|
init_db_retry();
|
|
2430
2698
|
init_employees();
|
|
2431
2699
|
init_database_adapter();
|
|
2700
|
+
init_memory();
|
|
2432
2701
|
_client = null;
|
|
2433
2702
|
_resilientClient = null;
|
|
2434
2703
|
_walCheckpointTimer = null;
|
|
2435
2704
|
_daemonClient = null;
|
|
2436
2705
|
_adapterClient = null;
|
|
2437
2706
|
initTurso = initDatabase;
|
|
2707
|
+
disposeTurso = disposeDatabase;
|
|
2438
2708
|
}
|
|
2439
2709
|
});
|
|
2440
2710
|
|
|
@@ -2868,6 +3138,68 @@ var init_platform_procedures = __esm({
|
|
|
2868
3138
|
domain: "architecture",
|
|
2869
3139
|
priority: "p0",
|
|
2870
3140
|
content: "Tasks live in the DB. Intercom (tmux send-keys) is fire-and-forget \u2014 it may fail, get garbled, or arrive mid-work. Never rely on intercom for task delivery. The UserPromptSubmit hook checks the DB for new tasks on every prompt. Your operating procedures step 7 says check for next work. The daemon nudges idle agents as a speedup. If you have no tasks, you found them all."
|
|
3141
|
+
},
|
|
3142
|
+
// --- MCP is the ONLY data interface ---
|
|
3143
|
+
{
|
|
3144
|
+
title: "MCP disconnect \u2014 ask the user, never work around it",
|
|
3145
|
+
domain: "workflow",
|
|
3146
|
+
priority: "p0",
|
|
3147
|
+
content: "If MCP tools are unavailable, disconnected, or returning connection errors: STOP. Tell the user clearly: 'MCP server is disconnected. Please run /mcp to reconnect.' Do NOT attempt workarounds \u2014 no raw Node imports, no direct DB access, no CLI hacks, no daemon socket calls. MCP is the ONLY data interface. Working around it wastes time, hits bundling issues, and bypasses the contract boundary. Ask once, wait, proceed when reconnected."
|
|
3148
|
+
},
|
|
3149
|
+
// --- MCP Tool Catalog (Layer 0 — every agent knows what tools exist) ---
|
|
3150
|
+
{
|
|
3151
|
+
title: "MCP tools \u2014 memory and search",
|
|
3152
|
+
domain: "tool-use",
|
|
3153
|
+
priority: "p1",
|
|
3154
|
+
content: "recall_my_memory: search your own memories (semantic + FTS). ask_team_memory: search a colleague's memories by agent name. store_memory: persist a memory (decisions, summaries, context). commit_memory: high-importance memory that survives consolidation. search_everything: unified search across memories, tasks, entities, conversations. get_session_context: temporal window of memories around a timestamp. consolidate_memories: merge duplicate/related memories into insights. get_memory_cardinality: count memories per agent (health check)."
|
|
3155
|
+
},
|
|
3156
|
+
{
|
|
3157
|
+
title: "MCP tools \u2014 task orchestration",
|
|
3158
|
+
domain: "tool-use",
|
|
3159
|
+
priority: "p1",
|
|
3160
|
+
content: "create_task: dispatch work to an employee (auto-spawns session). The ONLY dispatch path. list_tasks: query tasks by status, assignee, project. get_task: fetch full task details by ID. update_task: change status (in_progress, done, blocked, cancelled) + add result summary. close_task: finalize a reviewed task (COO only). checkpoint_task: save progress state for crash recovery. resume_employee: re-spawn an employee session for an existing task."
|
|
3161
|
+
},
|
|
3162
|
+
{
|
|
3163
|
+
title: "MCP tools \u2014 knowledge graph (GraphRAG)",
|
|
3164
|
+
domain: "tool-use",
|
|
3165
|
+
priority: "p1",
|
|
3166
|
+
content: "query_relationships: find connections between entities in the knowledge graph. get_entity_neighbors: explore an entity's direct connections. get_hot_entities: find most-referenced entities (trending topics). get_graph_stats: graph health \u2014 entity/relationship counts, density. export_graph: export graph data for visualization. merge_entities: deduplicate entities (alias resolution). find_similar_trajectories: match tool-call patterns to past task solutions."
|
|
3167
|
+
},
|
|
3168
|
+
{
|
|
3169
|
+
title: "MCP tools \u2014 identity, behavior, and decisions",
|
|
3170
|
+
domain: "tool-use",
|
|
3171
|
+
priority: "p1",
|
|
3172
|
+
content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query."
|
|
3173
|
+
},
|
|
3174
|
+
{
|
|
3175
|
+
title: "MCP tools \u2014 communication and messaging",
|
|
3176
|
+
domain: "tool-use",
|
|
3177
|
+
priority: "p1",
|
|
3178
|
+
content: "send_message: send supplementary context to another agent (NOT for actionable work \u2014 use create_task). acknowledge_messages: mark messages as read. send_whatsapp: send WhatsApp message via gateway (customer-facing alerts). query_conversations: search ingested conversations across all channels (WhatsApp, email, etc.)."
|
|
3179
|
+
},
|
|
3180
|
+
{
|
|
3181
|
+
title: "MCP tools \u2014 wiki, documents, and content",
|
|
3182
|
+
domain: "tool-use",
|
|
3183
|
+
priority: "p1",
|
|
3184
|
+
content: "create_wiki_page: create a wiki page in exe-wiki. list_wiki_pages: browse wiki pages. get_wiki_page: read a wiki page. update_wiki_page: edit a wiki page. ingest_document: import a file (PDF, MD, etc.) into memory as chunks. list_documents: browse ingested documents by workspace. purge_document: remove a document and its memory chunks. set_document_importance: adjust chunk importance scores. rerank_documents: re-score document relevance for a query."
|
|
3185
|
+
},
|
|
3186
|
+
{
|
|
3187
|
+
title: "MCP tools \u2014 system, operations, and admin",
|
|
3188
|
+
domain: "tool-use",
|
|
3189
|
+
priority: "p1",
|
|
3190
|
+
content: "get_agent_spend: token usage per agent/session (cost tracking). list_agent_sessions: view agent session history. get_session_kills: audit log of killed sessions. get_daemon_health: check exed daemon status. get_auto_wake_status: daemon auto-wake configuration. get_worker_gate: check worker deployment gates. run_memory_audit: health check \u2014 duplicates, null vectors, orphaned rows. run_consolidation: trigger sleep-time memory consolidation. cloud_sync: force a cloud sync cycle. backup_vps: trigger VPS backup."
|
|
3191
|
+
},
|
|
3192
|
+
{
|
|
3193
|
+
title: "MCP tools \u2014 config, licensing, and team",
|
|
3194
|
+
domain: "tool-use",
|
|
3195
|
+
priority: "p1",
|
|
3196
|
+
content: "set_agent_config: view/change per-agent runtime and model settings. list_employees: view the employee roster. add_person: add a person to the CRM contacts roster. list_people: browse CRM contacts. get_person: fetch contact details. get_license_status: check license validity. create_license: generate a new license key (admin). list_licenses: view all issued licenses. activate_license: activate a license on a device."
|
|
3197
|
+
},
|
|
3198
|
+
{
|
|
3199
|
+
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3200
|
+
domain: "tool-use",
|
|
3201
|
+
priority: "p1",
|
|
3202
|
+
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage Layer 0 procedures (actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
2871
3203
|
}
|
|
2872
3204
|
];
|
|
2873
3205
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -3074,10 +3406,8 @@ function formatAssignmentOutput(employee, task, score, mode, bloomRouting) {
|
|
|
3074
3406
|
return lines.join("\n");
|
|
3075
3407
|
}
|
|
3076
3408
|
|
|
3077
|
-
// src/types/memory.ts
|
|
3078
|
-
var EMBEDDING_DIM = 1024;
|
|
3079
|
-
|
|
3080
3409
|
// src/lib/embedder.ts
|
|
3410
|
+
init_memory();
|
|
3081
3411
|
init_exe_daemon_client();
|
|
3082
3412
|
async function embed(text) {
|
|
3083
3413
|
const priority = process.env.EXE_EMBED_PRIORITY === "low" ? "low" : "high";
|
|
@@ -3096,8 +3426,9 @@ async function embed(text) {
|
|
|
3096
3426
|
}
|
|
3097
3427
|
|
|
3098
3428
|
// src/lib/store.ts
|
|
3099
|
-
|
|
3429
|
+
init_memory();
|
|
3100
3430
|
init_database();
|
|
3431
|
+
import { createHash } from "crypto";
|
|
3101
3432
|
|
|
3102
3433
|
// src/lib/keychain.ts
|
|
3103
3434
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
@@ -3262,6 +3593,11 @@ async function initStore(options) {
|
|
|
3262
3593
|
encryptionKey: hexKey
|
|
3263
3594
|
});
|
|
3264
3595
|
await retryOnBusy2(() => ensureSchema(), "ensureSchema");
|
|
3596
|
+
try {
|
|
3597
|
+
const { initDaemonClient: initDaemonClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
3598
|
+
await initDaemonClient2();
|
|
3599
|
+
} catch {
|
|
3600
|
+
}
|
|
3265
3601
|
if (!options?.lightweight) {
|
|
3266
3602
|
try {
|
|
3267
3603
|
const { initShardManager: initShardManager2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|