@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/scan-tasks.js
CHANGED
|
@@ -369,6 +369,21 @@ var init_secure_files = __esm({
|
|
|
369
369
|
});
|
|
370
370
|
|
|
371
371
|
// src/lib/config.ts
|
|
372
|
+
var config_exports = {};
|
|
373
|
+
__export(config_exports, {
|
|
374
|
+
CONFIG_MIGRATIONS: () => CONFIG_MIGRATIONS,
|
|
375
|
+
CONFIG_PATH: () => CONFIG_PATH,
|
|
376
|
+
CURRENT_CONFIG_VERSION: () => CURRENT_CONFIG_VERSION,
|
|
377
|
+
DB_PATH: () => DB_PATH,
|
|
378
|
+
EXE_AI_DIR: () => EXE_AI_DIR,
|
|
379
|
+
LEGACY_LANCE_PATH: () => LEGACY_LANCE_PATH,
|
|
380
|
+
MODELS_DIR: () => MODELS_DIR,
|
|
381
|
+
loadConfig: () => loadConfig,
|
|
382
|
+
loadConfigFrom: () => loadConfigFrom,
|
|
383
|
+
loadConfigSync: () => loadConfigSync,
|
|
384
|
+
migrateConfig: () => migrateConfig,
|
|
385
|
+
saveConfig: () => saveConfig
|
|
386
|
+
});
|
|
372
387
|
import { readFile, writeFile } from "fs/promises";
|
|
373
388
|
import { readFileSync as readFileSync2, existsSync as existsSync3, renameSync } from "fs";
|
|
374
389
|
import path2 from "path";
|
|
@@ -472,6 +487,46 @@ async function loadConfig() {
|
|
|
472
487
|
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
473
488
|
}
|
|
474
489
|
}
|
|
490
|
+
function loadConfigSync() {
|
|
491
|
+
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
492
|
+
const configPath = path2.join(dir, "config.json");
|
|
493
|
+
if (!existsSync3(configPath)) {
|
|
494
|
+
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
495
|
+
}
|
|
496
|
+
try {
|
|
497
|
+
const raw = readFileSync2(configPath, "utf-8");
|
|
498
|
+
let parsed = JSON.parse(raw);
|
|
499
|
+
parsed = migrateLegacyConfig(parsed);
|
|
500
|
+
const { config: migratedCfg } = migrateConfig(parsed);
|
|
501
|
+
normalizeScalingRoadmap(migratedCfg);
|
|
502
|
+
normalizeSessionLifecycle(migratedCfg);
|
|
503
|
+
normalizeAutoUpdate(migratedCfg);
|
|
504
|
+
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
505
|
+
} catch {
|
|
506
|
+
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
async function saveConfig(config) {
|
|
510
|
+
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
511
|
+
await ensurePrivateDir(dir);
|
|
512
|
+
const configPath = path2.join(dir, "config.json");
|
|
513
|
+
await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
514
|
+
await enforcePrivateFile(configPath);
|
|
515
|
+
}
|
|
516
|
+
async function loadConfigFrom(configPath) {
|
|
517
|
+
const raw = await readFile(configPath, "utf-8");
|
|
518
|
+
try {
|
|
519
|
+
let parsed = JSON.parse(raw);
|
|
520
|
+
parsed = migrateLegacyConfig(parsed);
|
|
521
|
+
const { config: migratedCfg } = migrateConfig(parsed);
|
|
522
|
+
normalizeScalingRoadmap(migratedCfg);
|
|
523
|
+
normalizeSessionLifecycle(migratedCfg);
|
|
524
|
+
normalizeAutoUpdate(migratedCfg);
|
|
525
|
+
return { ...DEFAULT_CONFIG, ...migratedCfg };
|
|
526
|
+
} catch {
|
|
527
|
+
return { ...DEFAULT_CONFIG };
|
|
528
|
+
}
|
|
529
|
+
}
|
|
475
530
|
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
|
|
476
531
|
var init_config = __esm({
|
|
477
532
|
"src/lib/config.ts"() {
|
|
@@ -608,7 +663,7 @@ var init_agent_config = __esm({
|
|
|
608
663
|
init_secure_files();
|
|
609
664
|
AGENT_CONFIG_PATH = path3.join(EXE_AI_DIR, "agent-config.json");
|
|
610
665
|
DEFAULT_MODELS = {
|
|
611
|
-
claude: "claude-opus-4",
|
|
666
|
+
claude: "claude-opus-4.6",
|
|
612
667
|
codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
|
|
613
668
|
opencode: RUNTIME_TABLE.opencode?.defaultModel ?? "anthropic/claude-sonnet-4-6"
|
|
614
669
|
};
|
|
@@ -790,9 +845,9 @@ var MAX_RETRIES2, BASE_DELAY_MS, MAX_JITTER_MS;
|
|
|
790
845
|
var init_db_retry = __esm({
|
|
791
846
|
"src/lib/db-retry.ts"() {
|
|
792
847
|
"use strict";
|
|
793
|
-
MAX_RETRIES2 =
|
|
794
|
-
BASE_DELAY_MS =
|
|
795
|
-
MAX_JITTER_MS =
|
|
848
|
+
MAX_RETRIES2 = 5;
|
|
849
|
+
BASE_DELAY_MS = 250;
|
|
850
|
+
MAX_JITTER_MS = 400;
|
|
796
851
|
}
|
|
797
852
|
});
|
|
798
853
|
|
|
@@ -1451,6 +1506,15 @@ var init_database_adapter = __esm({
|
|
|
1451
1506
|
}
|
|
1452
1507
|
});
|
|
1453
1508
|
|
|
1509
|
+
// src/types/memory.ts
|
|
1510
|
+
var EMBEDDING_DIM;
|
|
1511
|
+
var init_memory = __esm({
|
|
1512
|
+
"src/types/memory.ts"() {
|
|
1513
|
+
"use strict";
|
|
1514
|
+
EMBEDDING_DIM = 1024;
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
|
|
1454
1518
|
// src/lib/daemon-auth.ts
|
|
1455
1519
|
import crypto from "crypto";
|
|
1456
1520
|
import path7 from "path";
|
|
@@ -1489,6 +1553,17 @@ var init_daemon_auth = __esm({
|
|
|
1489
1553
|
});
|
|
1490
1554
|
|
|
1491
1555
|
// src/lib/exe-daemon-client.ts
|
|
1556
|
+
var exe_daemon_client_exports = {};
|
|
1557
|
+
__export(exe_daemon_client_exports, {
|
|
1558
|
+
connectEmbedDaemon: () => connectEmbedDaemon,
|
|
1559
|
+
disconnectClient: () => disconnectClient,
|
|
1560
|
+
embedBatchViaClient: () => embedBatchViaClient,
|
|
1561
|
+
embedViaClient: () => embedViaClient,
|
|
1562
|
+
isClientConnected: () => isClientConnected,
|
|
1563
|
+
pingDaemon: () => pingDaemon,
|
|
1564
|
+
sendDaemonRequest: () => sendDaemonRequest,
|
|
1565
|
+
sendIngestRequest: () => sendIngestRequest
|
|
1566
|
+
});
|
|
1492
1567
|
import net from "net";
|
|
1493
1568
|
import os6 from "os";
|
|
1494
1569
|
import { spawn } from "child_process";
|
|
@@ -1725,6 +1800,9 @@ async function connectEmbedDaemon() {
|
|
|
1725
1800
|
}
|
|
1726
1801
|
return false;
|
|
1727
1802
|
}
|
|
1803
|
+
function sendRequest(texts, priority) {
|
|
1804
|
+
return sendDaemonRequest({ texts, priority });
|
|
1805
|
+
}
|
|
1728
1806
|
function sendDaemonRequest(payload, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
1729
1807
|
return new Promise((resolve) => {
|
|
1730
1808
|
if (!_socket || !_connected) {
|
|
@@ -1747,10 +1825,170 @@ function sendDaemonRequest(payload, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
|
1747
1825
|
}
|
|
1748
1826
|
});
|
|
1749
1827
|
}
|
|
1828
|
+
async function pingDaemon() {
|
|
1829
|
+
if (!_socket || !_connected) return null;
|
|
1830
|
+
const response = await sendDaemonRequest({ type: "health" }, 5e3);
|
|
1831
|
+
if (response.health) {
|
|
1832
|
+
return response.health;
|
|
1833
|
+
}
|
|
1834
|
+
return null;
|
|
1835
|
+
}
|
|
1836
|
+
function killAndRespawnDaemon() {
|
|
1837
|
+
if (!acquireSpawnLock()) {
|
|
1838
|
+
process.stderr.write("[exed-client] Another process is already restarting daemon \u2014 skipping\n");
|
|
1839
|
+
if (_socket) {
|
|
1840
|
+
_socket.destroy();
|
|
1841
|
+
_socket = null;
|
|
1842
|
+
}
|
|
1843
|
+
_connected = false;
|
|
1844
|
+
_buffer = "";
|
|
1845
|
+
return;
|
|
1846
|
+
}
|
|
1847
|
+
try {
|
|
1848
|
+
process.stderr.write("[exed-client] Killing daemon for restart...\n");
|
|
1849
|
+
if (existsSync8(PID_PATH)) {
|
|
1850
|
+
try {
|
|
1851
|
+
const pid = parseInt(readFileSync7(PID_PATH, "utf8").trim(), 10);
|
|
1852
|
+
if (pid > 0) {
|
|
1853
|
+
try {
|
|
1854
|
+
process.kill(pid, "SIGKILL");
|
|
1855
|
+
} catch {
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
} catch {
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
if (_socket) {
|
|
1862
|
+
_socket.destroy();
|
|
1863
|
+
_socket = null;
|
|
1864
|
+
}
|
|
1865
|
+
_connected = false;
|
|
1866
|
+
_buffer = "";
|
|
1867
|
+
try {
|
|
1868
|
+
unlinkSync2(PID_PATH);
|
|
1869
|
+
} catch {
|
|
1870
|
+
}
|
|
1871
|
+
try {
|
|
1872
|
+
unlinkSync2(SOCKET_PATH);
|
|
1873
|
+
} catch {
|
|
1874
|
+
}
|
|
1875
|
+
spawnDaemon();
|
|
1876
|
+
} finally {
|
|
1877
|
+
releaseSpawnLock();
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
function isDaemonTooYoung() {
|
|
1881
|
+
try {
|
|
1882
|
+
const stat = statSync(PID_PATH);
|
|
1883
|
+
return Date.now() - stat.mtimeMs < MIN_DAEMON_AGE_MS;
|
|
1884
|
+
} catch {
|
|
1885
|
+
return false;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
async function retryThenRestart(doRequest, label) {
|
|
1889
|
+
const result = await doRequest();
|
|
1890
|
+
if (!result.error) {
|
|
1891
|
+
_consecutiveFailures = 0;
|
|
1892
|
+
return result;
|
|
1893
|
+
}
|
|
1894
|
+
_consecutiveFailures++;
|
|
1895
|
+
for (let i = 0; i < MAX_RETRIES_BEFORE_RESTART; i++) {
|
|
1896
|
+
const delayMs = RETRY_DELAYS_MS[i] ?? 5e3;
|
|
1897
|
+
process.stderr.write(`[exed-client] ${label} failed (${result.error}), retry ${i + 1}/${MAX_RETRIES_BEFORE_RESTART} in ${delayMs}ms
|
|
1898
|
+
`);
|
|
1899
|
+
await new Promise((r) => setTimeout(r, delayMs));
|
|
1900
|
+
if (!_connected) {
|
|
1901
|
+
if (!await connectToSocket()) continue;
|
|
1902
|
+
}
|
|
1903
|
+
const retry = await doRequest();
|
|
1904
|
+
if (!retry.error) {
|
|
1905
|
+
_consecutiveFailures = 0;
|
|
1906
|
+
return retry;
|
|
1907
|
+
}
|
|
1908
|
+
_consecutiveFailures++;
|
|
1909
|
+
}
|
|
1910
|
+
if (isDaemonTooYoung()) {
|
|
1911
|
+
process.stderr.write(`[exed-client] ${label}: daemon too young (< ${MIN_DAEMON_AGE_MS / 1e3}s) \u2014 skipping restart
|
|
1912
|
+
`);
|
|
1913
|
+
return { error: result.error };
|
|
1914
|
+
}
|
|
1915
|
+
process.stderr.write(`[exed-client] ${label}: ${_consecutiveFailures} consecutive failures \u2014 restarting daemon
|
|
1916
|
+
`);
|
|
1917
|
+
killAndRespawnDaemon();
|
|
1918
|
+
const start = Date.now();
|
|
1919
|
+
let delay2 = 200;
|
|
1920
|
+
while (Date.now() - start < CONNECT_TIMEOUT_MS) {
|
|
1921
|
+
await new Promise((r) => setTimeout(r, delay2));
|
|
1922
|
+
if (await connectToSocket()) break;
|
|
1923
|
+
delay2 = Math.min(delay2 * 2, 3e3);
|
|
1924
|
+
}
|
|
1925
|
+
if (!_connected) return { error: "Daemon restart failed" };
|
|
1926
|
+
const final = await doRequest();
|
|
1927
|
+
if (!final.error) _consecutiveFailures = 0;
|
|
1928
|
+
return final;
|
|
1929
|
+
}
|
|
1930
|
+
async function embedViaClient(text, priority = "high") {
|
|
1931
|
+
if (!_connected && !await connectEmbedDaemon()) return null;
|
|
1932
|
+
_requestCount++;
|
|
1933
|
+
if (_requestCount % HEALTH_CHECK_INTERVAL === 0) {
|
|
1934
|
+
const health = await pingDaemon();
|
|
1935
|
+
if (!health && !isDaemonTooYoung()) {
|
|
1936
|
+
process.stderr.write(`[exed-client] Periodic health check failed at request ${_requestCount} \u2014 restarting daemon
|
|
1937
|
+
`);
|
|
1938
|
+
killAndRespawnDaemon();
|
|
1939
|
+
const start = Date.now();
|
|
1940
|
+
let d = 200;
|
|
1941
|
+
while (Date.now() - start < CONNECT_TIMEOUT_MS) {
|
|
1942
|
+
await new Promise((r) => setTimeout(r, d));
|
|
1943
|
+
if (await connectToSocket()) break;
|
|
1944
|
+
d = Math.min(d * 2, 3e3);
|
|
1945
|
+
}
|
|
1946
|
+
if (!_connected) return null;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
const result = await retryThenRestart(
|
|
1950
|
+
() => sendRequest([text], priority),
|
|
1951
|
+
"Embed"
|
|
1952
|
+
);
|
|
1953
|
+
return !result.error && result.vectors?.[0] ? result.vectors[0] : null;
|
|
1954
|
+
}
|
|
1955
|
+
async function embedBatchViaClient(texts, priority = "high") {
|
|
1956
|
+
if (!_connected && !await connectEmbedDaemon()) return null;
|
|
1957
|
+
_requestCount++;
|
|
1958
|
+
const result = await retryThenRestart(
|
|
1959
|
+
() => sendRequest(texts, priority),
|
|
1960
|
+
"Batch embed"
|
|
1961
|
+
);
|
|
1962
|
+
return !result.error && result.vectors ? result.vectors : null;
|
|
1963
|
+
}
|
|
1964
|
+
function disconnectClient() {
|
|
1965
|
+
if (_socket) {
|
|
1966
|
+
_socket.destroy();
|
|
1967
|
+
_socket = null;
|
|
1968
|
+
}
|
|
1969
|
+
_connected = false;
|
|
1970
|
+
_buffer = "";
|
|
1971
|
+
for (const [id, entry] of _pending) {
|
|
1972
|
+
clearTimeout(entry.timer);
|
|
1973
|
+
_pending.delete(id);
|
|
1974
|
+
entry.resolve({ error: "Client disconnected" });
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1750
1977
|
function isClientConnected() {
|
|
1751
1978
|
return _connected;
|
|
1752
1979
|
}
|
|
1753
|
-
|
|
1980
|
+
function sendIngestRequest(payload) {
|
|
1981
|
+
if (!_socket || !_connected) return false;
|
|
1982
|
+
try {
|
|
1983
|
+
const id = randomUUID();
|
|
1984
|
+
const token = process.env[DAEMON_TOKEN_ENV] ?? readDaemonToken();
|
|
1985
|
+
_socket.write(JSON.stringify({ id, token, type: "ingest", ...payload }) + "\n");
|
|
1986
|
+
return true;
|
|
1987
|
+
} catch {
|
|
1988
|
+
return false;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
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;
|
|
1754
1992
|
var init_exe_daemon_client = __esm({
|
|
1755
1993
|
"src/lib/exe-daemon-client.ts"() {
|
|
1756
1994
|
"use strict";
|
|
@@ -1766,12 +2004,27 @@ var init_exe_daemon_client = __esm({
|
|
|
1766
2004
|
_socket = null;
|
|
1767
2005
|
_connected = false;
|
|
1768
2006
|
_buffer = "";
|
|
2007
|
+
_requestCount = 0;
|
|
2008
|
+
_consecutiveFailures = 0;
|
|
2009
|
+
HEALTH_CHECK_INTERVAL = 100;
|
|
2010
|
+
MAX_RETRIES_BEFORE_RESTART = 3;
|
|
2011
|
+
RETRY_DELAYS_MS = [1e3, 3e3, 5e3];
|
|
2012
|
+
MIN_DAEMON_AGE_MS = 3e4;
|
|
1769
2013
|
_pending = /* @__PURE__ */ new Map();
|
|
1770
2014
|
MAX_BUFFER = 1e7;
|
|
1771
2015
|
}
|
|
1772
2016
|
});
|
|
1773
2017
|
|
|
1774
2018
|
// src/lib/daemon-protocol.ts
|
|
2019
|
+
var daemon_protocol_exports = {};
|
|
2020
|
+
__export(daemon_protocol_exports, {
|
|
2021
|
+
deserializeArgs: () => deserializeArgs,
|
|
2022
|
+
deserializeResultSet: () => deserializeResultSet,
|
|
2023
|
+
deserializeValue: () => deserializeValue,
|
|
2024
|
+
serializeArgs: () => serializeArgs,
|
|
2025
|
+
serializeResultSet: () => serializeResultSet,
|
|
2026
|
+
serializeValue: () => serializeValue
|
|
2027
|
+
});
|
|
1775
2028
|
function serializeValue(v) {
|
|
1776
2029
|
if (v === null || v === void 0) return null;
|
|
1777
2030
|
if (typeof v === "bigint") return Number(v);
|
|
@@ -1796,6 +2049,32 @@ function deserializeValue(v) {
|
|
|
1796
2049
|
}
|
|
1797
2050
|
return v;
|
|
1798
2051
|
}
|
|
2052
|
+
function serializeArgs(args) {
|
|
2053
|
+
return args.map(serializeValue);
|
|
2054
|
+
}
|
|
2055
|
+
function deserializeArgs(args) {
|
|
2056
|
+
return args.map(deserializeValue);
|
|
2057
|
+
}
|
|
2058
|
+
function serializeResultSet(rs) {
|
|
2059
|
+
const rows = [];
|
|
2060
|
+
for (const row of rs.rows) {
|
|
2061
|
+
const obj = {};
|
|
2062
|
+
for (let i = 0; i < rs.columns.length; i++) {
|
|
2063
|
+
const col = rs.columns[i];
|
|
2064
|
+
if (col !== void 0) {
|
|
2065
|
+
obj[col] = serializeValue(row[i]);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
rows.push(obj);
|
|
2069
|
+
}
|
|
2070
|
+
return {
|
|
2071
|
+
columns: [...rs.columns],
|
|
2072
|
+
columnTypes: [...rs.columnTypes ?? []],
|
|
2073
|
+
rows,
|
|
2074
|
+
rowsAffected: typeof rs.rowsAffected === "bigint" ? Number(rs.rowsAffected) : rs.rowsAffected ?? 0,
|
|
2075
|
+
lastInsertRowid: rs.lastInsertRowid != null ? typeof rs.lastInsertRowid === "bigint" ? Number(rs.lastInsertRowid) : rs.lastInsertRowid : null
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
1799
2078
|
function deserializeResultSet(srs) {
|
|
1800
2079
|
const rows = srs.rows.map((obj) => {
|
|
1801
2080
|
const values = srs.columns.map(
|
|
@@ -1873,7 +2152,7 @@ function createDaemonDbClient(fallbackClient) {
|
|
|
1873
2152
|
});
|
|
1874
2153
|
if (response.error) {
|
|
1875
2154
|
const errMsg = String(response.error);
|
|
1876
|
-
if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed") {
|
|
2155
|
+
if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed" || errMsg === "DB not initialized") {
|
|
1877
2156
|
process.stderr.write(`[db-daemon] Transport error (${errMsg}), falling back to direct
|
|
1878
2157
|
`);
|
|
1879
2158
|
return fallbackClient.execute(stmt);
|
|
@@ -1898,7 +2177,7 @@ function createDaemonDbClient(fallbackClient) {
|
|
|
1898
2177
|
});
|
|
1899
2178
|
if (response.error) {
|
|
1900
2179
|
const errMsg = String(response.error);
|
|
1901
|
-
if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed") {
|
|
2180
|
+
if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed" || errMsg === "DB not initialized") {
|
|
1902
2181
|
process.stderr.write(`[db-daemon] Batch transport error (${errMsg}), falling back to direct
|
|
1903
2182
|
`);
|
|
1904
2183
|
return fallbackClient.batch(stmts, mode);
|
|
@@ -2021,7 +2300,7 @@ async function initDatabase(config) {
|
|
|
2021
2300
|
});
|
|
2022
2301
|
}, 3e4);
|
|
2023
2302
|
_walCheckpointTimer.unref();
|
|
2024
|
-
if (process.env.DATABASE_URL) {
|
|
2303
|
+
if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
|
|
2025
2304
|
_adapterClient = await createPrismaDbAdapter(_resilientClient);
|
|
2026
2305
|
}
|
|
2027
2306
|
}
|
|
@@ -2032,7 +2311,7 @@ function getClient() {
|
|
|
2032
2311
|
if (!_adapterClient) {
|
|
2033
2312
|
throw new Error("Database client not initialized. Call initDatabase() first.");
|
|
2034
2313
|
}
|
|
2035
|
-
if (process.env.DATABASE_URL) {
|
|
2314
|
+
if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
|
|
2036
2315
|
return _adapterClient;
|
|
2037
2316
|
}
|
|
2038
2317
|
if (process.env.EXE_IS_DAEMON === "1") {
|
|
@@ -2044,9 +2323,11 @@ function getClient() {
|
|
|
2044
2323
|
return _resilientClient;
|
|
2045
2324
|
}
|
|
2046
2325
|
async function initDaemonClient() {
|
|
2047
|
-
if (process.env.DATABASE_URL) return;
|
|
2326
|
+
if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") return;
|
|
2048
2327
|
if (process.env.EXE_IS_DAEMON === "1") return;
|
|
2328
|
+
if (process.env.VITEST) return;
|
|
2049
2329
|
if (!_resilientClient) return;
|
|
2330
|
+
if (_daemonClient) return;
|
|
2050
2331
|
try {
|
|
2051
2332
|
const { initDaemonDbClient: initDaemonDbClient2 } = await Promise.resolve().then(() => (init_db_daemon_client(), db_daemon_client_exports));
|
|
2052
2333
|
_daemonClient = await initDaemonDbClient2(_resilientClient);
|
|
@@ -2195,6 +2476,13 @@ async function ensureSchema() {
|
|
|
2195
2476
|
});
|
|
2196
2477
|
} catch {
|
|
2197
2478
|
}
|
|
2479
|
+
try {
|
|
2480
|
+
await client.execute({
|
|
2481
|
+
sql: `ALTER TABLE behaviors ADD COLUMN vector F32_BLOB(${EMBEDDING_DIM})`,
|
|
2482
|
+
args: []
|
|
2483
|
+
});
|
|
2484
|
+
} catch {
|
|
2485
|
+
}
|
|
2198
2486
|
try {
|
|
2199
2487
|
await client.execute({
|
|
2200
2488
|
sql: `ALTER TABLE tasks ADD COLUMN blocked_by TEXT`,
|
|
@@ -3065,6 +3353,7 @@ var init_database = __esm({
|
|
|
3065
3353
|
init_db_retry();
|
|
3066
3354
|
init_employees();
|
|
3067
3355
|
init_database_adapter();
|
|
3356
|
+
init_memory();
|
|
3068
3357
|
_client = null;
|
|
3069
3358
|
_resilientClient = null;
|
|
3070
3359
|
_walCheckpointTimer = null;
|
|
@@ -3569,15 +3858,20 @@ async function createTaskCore(input) {
|
|
|
3569
3858
|
const { resolveExeSession: resolveExeSession2 } = await Promise.resolve().then(() => (init_tmux_routing(), tmux_routing_exports));
|
|
3570
3859
|
const resolved = resolveExeSession2();
|
|
3571
3860
|
if (resolved && input.projectName) {
|
|
3572
|
-
const
|
|
3573
|
-
|
|
3574
|
-
if (sessionProject && sessionProject !== input.projectName) {
|
|
3575
|
-
scopeMismatchWarning = `session/project mismatch: session "${resolved}" owns "${sessionProject}" but task targets "${input.projectName}". Routed to default scope.`;
|
|
3576
|
-
process.stderr.write(`[create_task] ${scopeMismatchWarning}
|
|
3577
|
-
`);
|
|
3578
|
-
earlySessionScope = null;
|
|
3579
|
-
} else {
|
|
3861
|
+
const isCoordinatorSession = !resolved.includes("-");
|
|
3862
|
+
if (isCoordinatorSession) {
|
|
3580
3863
|
earlySessionScope = resolved;
|
|
3864
|
+
} else {
|
|
3865
|
+
const { getSessionProject: getSessionProject2 } = await Promise.resolve().then(() => (init_session_scope(), session_scope_exports));
|
|
3866
|
+
const sessionProject = getSessionProject2(resolved);
|
|
3867
|
+
if (sessionProject && sessionProject !== input.projectName) {
|
|
3868
|
+
scopeMismatchWarning = `session/project mismatch: session "${resolved}" owns "${sessionProject}" but task targets "${input.projectName}". Routed to default scope.`;
|
|
3869
|
+
process.stderr.write(`[create_task] ${scopeMismatchWarning}
|
|
3870
|
+
`);
|
|
3871
|
+
earlySessionScope = null;
|
|
3872
|
+
} else {
|
|
3873
|
+
earlySessionScope = resolved;
|
|
3874
|
+
}
|
|
3581
3875
|
}
|
|
3582
3876
|
} else {
|
|
3583
3877
|
earlySessionScope = resolved;
|
|
@@ -4462,6 +4756,10 @@ async function dispatchTaskToEmployee(input) {
|
|
|
4462
4756
|
if (transport.isAlive(sessionName)) {
|
|
4463
4757
|
const result = sendIntercom(sessionName);
|
|
4464
4758
|
const dispatched = result === "acknowledged" || result === "debounced" || result === "queued" ? "verified" : result === "delivered" ? "sent_unverified" : "session_dead";
|
|
4759
|
+
process.stderr.write(
|
|
4760
|
+
`[dispatch-audit] intercom \u2192 ${sessionName} | task="${input.title}" [${input.priority}] | result=${dispatched} (sendIntercom=${result})
|
|
4761
|
+
`
|
|
4762
|
+
);
|
|
4465
4763
|
return { dispatched, session: sessionName, crossProject };
|
|
4466
4764
|
} else {
|
|
4467
4765
|
const projectDir = input.projectDir ?? process.cwd();
|
|
@@ -4470,11 +4768,15 @@ async function dispatchTaskToEmployee(input) {
|
|
|
4470
4768
|
});
|
|
4471
4769
|
if (result.status === "failed") {
|
|
4472
4770
|
process.stderr.write(
|
|
4473
|
-
`[dispatch]
|
|
4771
|
+
`[dispatch-audit] SPAWN FAILED \u2192 ${input.assignedTo} | task="${input.title}" [${input.priority}] | error=${result.error}
|
|
4474
4772
|
`
|
|
4475
4773
|
);
|
|
4476
4774
|
return { dispatched: "session_missing" };
|
|
4477
4775
|
}
|
|
4776
|
+
process.stderr.write(
|
|
4777
|
+
`[dispatch-audit] SPAWNED \u2192 ${result.sessionName} | task="${input.title}" [${input.priority}]
|
|
4778
|
+
`
|
|
4779
|
+
);
|
|
4478
4780
|
return { dispatched: "spawned", session: result.sessionName, crossProject };
|
|
4479
4781
|
}
|
|
4480
4782
|
} catch {
|
|
@@ -4484,7 +4786,13 @@ async function dispatchTaskToEmployee(input) {
|
|
|
4484
4786
|
function notifyTaskDone() {
|
|
4485
4787
|
try {
|
|
4486
4788
|
const key = getSessionKey();
|
|
4487
|
-
if (key && !process.env.VITEST)
|
|
4789
|
+
if (key && !process.env.VITEST) {
|
|
4790
|
+
notifyParentExe(key);
|
|
4791
|
+
process.stderr.write(
|
|
4792
|
+
`[dispatch-audit] notifyTaskDone \u2192 parent coordinator (session=${key})
|
|
4793
|
+
`
|
|
4794
|
+
);
|
|
4795
|
+
}
|
|
4488
4796
|
} catch {
|
|
4489
4797
|
}
|
|
4490
4798
|
}
|
|
@@ -4505,16 +4813,91 @@ var init_tasks_notify = __esm({
|
|
|
4505
4813
|
}
|
|
4506
4814
|
});
|
|
4507
4815
|
|
|
4816
|
+
// src/lib/embedder.ts
|
|
4817
|
+
var embedder_exports = {};
|
|
4818
|
+
__export(embedder_exports, {
|
|
4819
|
+
disposeEmbedder: () => disposeEmbedder,
|
|
4820
|
+
embed: () => embed,
|
|
4821
|
+
embedDirect: () => embedDirect,
|
|
4822
|
+
getEmbedder: () => getEmbedder
|
|
4823
|
+
});
|
|
4824
|
+
async function getEmbedder() {
|
|
4825
|
+
const ok = await connectEmbedDaemon();
|
|
4826
|
+
if (!ok) {
|
|
4827
|
+
throw new Error(
|
|
4828
|
+
"Could not connect to embedding daemon. Ensure the model is installed (run /exe-setup)."
|
|
4829
|
+
);
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
async function embed(text) {
|
|
4833
|
+
const priority = process.env.EXE_EMBED_PRIORITY === "low" ? "low" : "high";
|
|
4834
|
+
const vector = await embedViaClient(text, priority);
|
|
4835
|
+
if (!vector) {
|
|
4836
|
+
throw new Error(
|
|
4837
|
+
"Embedding failed: daemon unavailable. Run /exe-setup to verify model installation."
|
|
4838
|
+
);
|
|
4839
|
+
}
|
|
4840
|
+
if (vector.length !== EMBEDDING_DIM) {
|
|
4841
|
+
throw new Error(
|
|
4842
|
+
`Embedding dimension mismatch: expected ${EMBEDDING_DIM}, got ${vector.length}. Ensure the correct Jina v5-small Q4_K_M GGUF model is installed.`
|
|
4843
|
+
);
|
|
4844
|
+
}
|
|
4845
|
+
return vector;
|
|
4846
|
+
}
|
|
4847
|
+
async function disposeEmbedder() {
|
|
4848
|
+
disconnectClient();
|
|
4849
|
+
}
|
|
4850
|
+
async function embedDirect(text) {
|
|
4851
|
+
const llamaCpp = await import("node-llama-cpp");
|
|
4852
|
+
const { MODELS_DIR: MODELS_DIR2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
4853
|
+
const { existsSync: existsSync18 } = await import("fs");
|
|
4854
|
+
const path21 = await import("path");
|
|
4855
|
+
const modelPath = path21.join(MODELS_DIR2, "jina-embeddings-v5-small-q4_k_m.gguf");
|
|
4856
|
+
if (!existsSync18(modelPath)) {
|
|
4857
|
+
throw new Error(`Embedding model not found at ${modelPath}. Run '/exe-setup' to download it.`);
|
|
4858
|
+
}
|
|
4859
|
+
const llama = await llamaCpp.getLlama();
|
|
4860
|
+
const model = await llama.loadModel({ modelPath });
|
|
4861
|
+
const context = await model.createEmbeddingContext();
|
|
4862
|
+
try {
|
|
4863
|
+
const embedding = await context.getEmbeddingFor(text);
|
|
4864
|
+
const vector = Array.from(embedding.vector);
|
|
4865
|
+
if (vector.length !== EMBEDDING_DIM) {
|
|
4866
|
+
throw new Error(
|
|
4867
|
+
`Embedding dimension mismatch: expected ${EMBEDDING_DIM}, got ${vector.length}.`
|
|
4868
|
+
);
|
|
4869
|
+
}
|
|
4870
|
+
return vector;
|
|
4871
|
+
} finally {
|
|
4872
|
+
await context.dispose();
|
|
4873
|
+
await model.dispose();
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
4876
|
+
var init_embedder = __esm({
|
|
4877
|
+
"src/lib/embedder.ts"() {
|
|
4878
|
+
"use strict";
|
|
4879
|
+
init_memory();
|
|
4880
|
+
init_exe_daemon_client();
|
|
4881
|
+
}
|
|
4882
|
+
});
|
|
4883
|
+
|
|
4508
4884
|
// src/lib/behaviors.ts
|
|
4509
4885
|
import crypto5 from "crypto";
|
|
4510
4886
|
async function storeBehavior(opts) {
|
|
4511
4887
|
const client = getClient();
|
|
4512
4888
|
const id = crypto5.randomUUID();
|
|
4513
4889
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4890
|
+
let vector = null;
|
|
4891
|
+
try {
|
|
4892
|
+
const { embed: embed2 } = await Promise.resolve().then(() => (init_embedder(), embedder_exports));
|
|
4893
|
+
const vec = await embed2(opts.content);
|
|
4894
|
+
vector = new Float32Array(vec);
|
|
4895
|
+
} catch {
|
|
4896
|
+
}
|
|
4514
4897
|
await client.execute({
|
|
4515
|
-
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, priority, content, active, created_at, updated_at)
|
|
4516
|
-
VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
4517
|
-
args: [id, opts.agentId, opts.projectName ?? null, opts.domain ?? null, opts.priority ?? "p1", opts.content, now, now]
|
|
4898
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, priority, content, active, created_at, updated_at, vector)
|
|
4899
|
+
VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?, ?)`,
|
|
4900
|
+
args: [id, opts.agentId, opts.projectName ?? null, opts.domain ?? null, opts.priority ?? "p1", opts.content, now, now, vector ? vector.buffer : null]
|
|
4518
4901
|
});
|
|
4519
4902
|
return id;
|
|
4520
4903
|
}
|
|
@@ -5617,7 +6000,7 @@ function isSessionBusy(sessionName) {
|
|
|
5617
6000
|
function isExeSession(sessionName) {
|
|
5618
6001
|
const matchesBaseWithInstance = (baseName) => sessionName === baseName || sessionName.startsWith(baseName) && /^\d+$/.test(sessionName.slice(baseName.length));
|
|
5619
6002
|
const coordinatorName = getCoordinatorName();
|
|
5620
|
-
return matchesBaseWithInstance(coordinatorName)
|
|
6003
|
+
return matchesBaseWithInstance(coordinatorName);
|
|
5621
6004
|
}
|
|
5622
6005
|
function sendIntercom(targetSession) {
|
|
5623
6006
|
const transport = getTransport();
|
|
@@ -6154,15 +6537,6 @@ var init_task_scope = __esm({
|
|
|
6154
6537
|
}
|
|
6155
6538
|
});
|
|
6156
6539
|
|
|
6157
|
-
// src/types/memory.ts
|
|
6158
|
-
var EMBEDDING_DIM;
|
|
6159
|
-
var init_memory = __esm({
|
|
6160
|
-
"src/types/memory.ts"() {
|
|
6161
|
-
"use strict";
|
|
6162
|
-
EMBEDDING_DIM = 1024;
|
|
6163
|
-
}
|
|
6164
|
-
});
|
|
6165
|
-
|
|
6166
6540
|
// src/lib/keychain.ts
|
|
6167
6541
|
import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
|
|
6168
6542
|
import { existsSync as existsSync15 } from "fs";
|
|
@@ -6650,6 +7024,68 @@ var init_platform_procedures = __esm({
|
|
|
6650
7024
|
domain: "architecture",
|
|
6651
7025
|
priority: "p0",
|
|
6652
7026
|
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."
|
|
7027
|
+
},
|
|
7028
|
+
// --- MCP is the ONLY data interface ---
|
|
7029
|
+
{
|
|
7030
|
+
title: "MCP disconnect \u2014 ask the user, never work around it",
|
|
7031
|
+
domain: "workflow",
|
|
7032
|
+
priority: "p0",
|
|
7033
|
+
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."
|
|
7034
|
+
},
|
|
7035
|
+
// --- MCP Tool Catalog (Layer 0 — every agent knows what tools exist) ---
|
|
7036
|
+
{
|
|
7037
|
+
title: "MCP tools \u2014 memory and search",
|
|
7038
|
+
domain: "tool-use",
|
|
7039
|
+
priority: "p1",
|
|
7040
|
+
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)."
|
|
7041
|
+
},
|
|
7042
|
+
{
|
|
7043
|
+
title: "MCP tools \u2014 task orchestration",
|
|
7044
|
+
domain: "tool-use",
|
|
7045
|
+
priority: "p1",
|
|
7046
|
+
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."
|
|
7047
|
+
},
|
|
7048
|
+
{
|
|
7049
|
+
title: "MCP tools \u2014 knowledge graph (GraphRAG)",
|
|
7050
|
+
domain: "tool-use",
|
|
7051
|
+
priority: "p1",
|
|
7052
|
+
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."
|
|
7053
|
+
},
|
|
7054
|
+
{
|
|
7055
|
+
title: "MCP tools \u2014 identity, behavior, and decisions",
|
|
7056
|
+
domain: "tool-use",
|
|
7057
|
+
priority: "p1",
|
|
7058
|
+
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."
|
|
7059
|
+
},
|
|
7060
|
+
{
|
|
7061
|
+
title: "MCP tools \u2014 communication and messaging",
|
|
7062
|
+
domain: "tool-use",
|
|
7063
|
+
priority: "p1",
|
|
7064
|
+
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.)."
|
|
7065
|
+
},
|
|
7066
|
+
{
|
|
7067
|
+
title: "MCP tools \u2014 wiki, documents, and content",
|
|
7068
|
+
domain: "tool-use",
|
|
7069
|
+
priority: "p1",
|
|
7070
|
+
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."
|
|
7071
|
+
},
|
|
7072
|
+
{
|
|
7073
|
+
title: "MCP tools \u2014 system, operations, and admin",
|
|
7074
|
+
domain: "tool-use",
|
|
7075
|
+
priority: "p1",
|
|
7076
|
+
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."
|
|
7077
|
+
},
|
|
7078
|
+
{
|
|
7079
|
+
title: "MCP tools \u2014 config, licensing, and team",
|
|
7080
|
+
domain: "tool-use",
|
|
7081
|
+
priority: "p1",
|
|
7082
|
+
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."
|
|
7083
|
+
},
|
|
7084
|
+
{
|
|
7085
|
+
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
7086
|
+
domain: "tool-use",
|
|
7087
|
+
priority: "p1",
|
|
7088
|
+
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."
|
|
6653
7089
|
}
|
|
6654
7090
|
];
|
|
6655
7091
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -6799,6 +7235,11 @@ async function initStore(options) {
|
|
|
6799
7235
|
encryptionKey: hexKey
|
|
6800
7236
|
});
|
|
6801
7237
|
await retryOnBusy2(() => ensureSchema(), "ensureSchema");
|
|
7238
|
+
try {
|
|
7239
|
+
const { initDaemonClient: initDaemonClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
7240
|
+
await initDaemonClient2();
|
|
7241
|
+
} catch {
|
|
7242
|
+
}
|
|
6802
7243
|
if (!options?.lightweight) {
|
|
6803
7244
|
try {
|
|
6804
7245
|
const { initShardManager: initShardManager2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
@@ -7312,6 +7753,77 @@ var init_store = __esm({
|
|
|
7312
7753
|
}
|
|
7313
7754
|
});
|
|
7314
7755
|
|
|
7756
|
+
// src/bin/fast-db-init.ts
|
|
7757
|
+
var fast_db_init_exports = {};
|
|
7758
|
+
__export(fast_db_init_exports, {
|
|
7759
|
+
fastDbInit: () => fastDbInit
|
|
7760
|
+
});
|
|
7761
|
+
async function fastDbInit() {
|
|
7762
|
+
const { isInitialized: isInitialized2, getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
7763
|
+
if (isInitialized2()) {
|
|
7764
|
+
return getClient2();
|
|
7765
|
+
}
|
|
7766
|
+
try {
|
|
7767
|
+
const { connectEmbedDaemon: connectEmbedDaemon2, sendDaemonRequest: sendDaemonRequest2, isClientConnected: isClientConnected2 } = await Promise.resolve().then(() => (init_exe_daemon_client(), exe_daemon_client_exports));
|
|
7768
|
+
const { deserializeResultSet: deserializeResultSet2 } = await Promise.resolve().then(() => (init_daemon_protocol(), daemon_protocol_exports));
|
|
7769
|
+
await connectEmbedDaemon2();
|
|
7770
|
+
if (isClientConnected2()) {
|
|
7771
|
+
const daemonClient = {
|
|
7772
|
+
async execute(stmt) {
|
|
7773
|
+
const sql = typeof stmt === "string" ? stmt : stmt.sql;
|
|
7774
|
+
const args = typeof stmt === "string" ? [] : Array.isArray(stmt.args) ? stmt.args : [];
|
|
7775
|
+
const resp = await sendDaemonRequest2({ type: "db-execute", sql, args });
|
|
7776
|
+
if (resp.error) throw new Error(String(resp.error));
|
|
7777
|
+
if (resp.db) return deserializeResultSet2(resp.db);
|
|
7778
|
+
throw new Error("Unexpected daemon response");
|
|
7779
|
+
},
|
|
7780
|
+
async batch(stmts, mode) {
|
|
7781
|
+
const statements = stmts.map((s) => {
|
|
7782
|
+
const sql = typeof s === "string" ? s : s.sql;
|
|
7783
|
+
const args = typeof s === "string" ? [] : Array.isArray(s.args) ? s.args : [];
|
|
7784
|
+
return { sql, args };
|
|
7785
|
+
});
|
|
7786
|
+
const resp = await sendDaemonRequest2({ type: "db-batch", statements, mode: mode ?? "deferred" });
|
|
7787
|
+
if (resp.error) throw new Error(String(resp.error));
|
|
7788
|
+
const batchResults = resp["db-batch"];
|
|
7789
|
+
if (batchResults) return batchResults.map(deserializeResultSet2);
|
|
7790
|
+
throw new Error("Unexpected daemon batch response");
|
|
7791
|
+
},
|
|
7792
|
+
async transaction(_mode) {
|
|
7793
|
+
throw new Error("Transactions not supported via daemon socket");
|
|
7794
|
+
},
|
|
7795
|
+
async executeMultiple(_sql) {
|
|
7796
|
+
throw new Error("executeMultiple not supported via daemon socket");
|
|
7797
|
+
},
|
|
7798
|
+
async migrate(_stmts) {
|
|
7799
|
+
throw new Error("migrate not supported via daemon socket");
|
|
7800
|
+
},
|
|
7801
|
+
sync() {
|
|
7802
|
+
return Promise.resolve(void 0);
|
|
7803
|
+
},
|
|
7804
|
+
close() {
|
|
7805
|
+
},
|
|
7806
|
+
get closed() {
|
|
7807
|
+
return false;
|
|
7808
|
+
},
|
|
7809
|
+
get protocol() {
|
|
7810
|
+
return "file";
|
|
7811
|
+
}
|
|
7812
|
+
};
|
|
7813
|
+
return daemonClient;
|
|
7814
|
+
}
|
|
7815
|
+
} catch {
|
|
7816
|
+
}
|
|
7817
|
+
const { initStore: initStore2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|
|
7818
|
+
await initStore2({ lightweight: true });
|
|
7819
|
+
return getClient2();
|
|
7820
|
+
}
|
|
7821
|
+
var init_fast_db_init = __esm({
|
|
7822
|
+
"src/bin/fast-db-init.ts"() {
|
|
7823
|
+
"use strict";
|
|
7824
|
+
}
|
|
7825
|
+
});
|
|
7826
|
+
|
|
7315
7827
|
// src/bin/scan-tasks.ts
|
|
7316
7828
|
import { existsSync as existsSync17, readFileSync as readFileSync13 } from "fs";
|
|
7317
7829
|
import path20 from "path";
|
|
@@ -7372,12 +7884,15 @@ function checkMcpHealth() {
|
|
|
7372
7884
|
}
|
|
7373
7885
|
}
|
|
7374
7886
|
async function scanFromDb(agentId, tmuxSession, projectName) {
|
|
7375
|
-
const {
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
await
|
|
7887
|
+
const { fastDbInit: fastDbInit2 } = await Promise.resolve().then(() => (init_fast_db_init(), fast_db_init_exports));
|
|
7888
|
+
let client;
|
|
7889
|
+
try {
|
|
7890
|
+
client = await fastDbInit2();
|
|
7891
|
+
} catch (err) {
|
|
7892
|
+
process.stderr.write(`[scan-tasks] FATAL: ${err instanceof Error ? err.message : String(err)}
|
|
7893
|
+
`);
|
|
7894
|
+
return { open: [], inProgress: [], done: 0, total: 0 };
|
|
7379
7895
|
}
|
|
7380
|
-
const client = getClient2();
|
|
7381
7896
|
let resolvedProject = projectName;
|
|
7382
7897
|
if (resolvedProject === void 0) {
|
|
7383
7898
|
try {
|