@askexenow/exe-os 0.8.40 → 0.8.42
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 +805 -642
- package/dist/bin/backfill-responses.js +804 -641
- package/dist/bin/backfill-vectors.js +791 -634
- package/dist/bin/cleanup-stale-review-tasks.js +788 -631
- package/dist/bin/cli.js +1376 -659
- package/dist/bin/exe-agent.js +20 -1
- package/dist/bin/exe-assign.js +1503 -1343
- package/dist/bin/exe-boot.js +2549 -1784
- package/dist/bin/exe-call.js +39 -1
- package/dist/bin/exe-cloud.js +12 -2
- package/dist/bin/exe-dispatch.js +39 -2
- package/dist/bin/exe-doctor.js +791 -634
- package/dist/bin/exe-export-behaviors.js +792 -637
- package/dist/bin/exe-forget.js +145 -0
- package/dist/bin/exe-gateway.js +2501 -1846
- package/dist/bin/exe-heartbeat.js +147 -1
- package/dist/bin/exe-kill.js +795 -640
- package/dist/bin/exe-launch-agent.js +2168 -2008
- package/dist/bin/exe-link.js +44 -12
- package/dist/bin/exe-new-employee.js +6 -2
- package/dist/bin/exe-pending-messages.js +146 -1
- package/dist/bin/exe-pending-notifications.js +788 -631
- package/dist/bin/exe-pending-reviews.js +176 -1
- package/dist/bin/exe-rename.js +23 -0
- package/dist/bin/exe-review.js +490 -327
- package/dist/bin/exe-search.js +157 -4
- package/dist/bin/exe-session-cleanup.js +2487 -403
- package/dist/bin/exe-settings.js +2 -1
- package/dist/bin/exe-status.js +474 -317
- package/dist/bin/exe-team.js +474 -317
- package/dist/bin/git-sweep.js +2691 -151
- package/dist/bin/graph-backfill.js +794 -637
- package/dist/bin/graph-export.js +798 -641
- package/dist/bin/scan-tasks.js +2951 -44
- package/dist/bin/setup.js +50 -26
- package/dist/bin/shard-migrate.js +792 -637
- package/dist/bin/wiki-sync.js +794 -637
- package/dist/gateway/index.js +2542 -1887
- package/dist/hooks/bug-report-worker.js +2118 -576
- package/dist/hooks/commit-complete.js +2690 -150
- package/dist/hooks/error-recall.js +157 -4
- package/dist/hooks/ingest-worker.js +1455 -803
- package/dist/hooks/instructions-loaded.js +151 -0
- package/dist/hooks/notification.js +153 -2
- package/dist/hooks/post-compact.js +164 -0
- package/dist/hooks/pre-compact.js +3073 -101
- package/dist/hooks/pre-tool-use.js +151 -0
- package/dist/hooks/prompt-ingest-worker.js +1670 -1509
- package/dist/hooks/prompt-submit.js +2650 -1074
- package/dist/hooks/response-ingest-worker.js +154 -6
- package/dist/hooks/session-end.js +153 -2
- package/dist/hooks/session-start.js +157 -4
- package/dist/hooks/stop.js +151 -0
- package/dist/hooks/subagent-stop.js +155 -2
- package/dist/hooks/summary-worker.js +190 -21
- package/dist/index.js +326 -102
- package/dist/lib/cloud-sync.js +31 -10
- package/dist/lib/config.js +2 -0
- package/dist/lib/consolidation.js +69 -2
- package/dist/lib/database.js +19 -0
- package/dist/lib/device-registry.js +19 -0
- package/dist/lib/embedder.js +3 -1
- package/dist/lib/employee-templates.js +20 -1
- package/dist/lib/exe-daemon.js +285 -18
- package/dist/lib/hybrid-search.js +157 -4
- package/dist/lib/messaging.js +39 -2
- package/dist/lib/schedules.js +792 -637
- package/dist/lib/store.js +796 -636
- package/dist/lib/tasks.js +1485 -918
- package/dist/lib/tmux-routing.js +194 -10
- package/dist/mcp/server.js +1643 -924
- package/dist/mcp/tools/create-task.js +2283 -829
- package/dist/mcp/tools/list-tasks.js +2788 -159
- package/dist/mcp/tools/send-message.js +39 -2
- package/dist/mcp/tools/update-task.js +79 -0
- package/dist/runtime/index.js +280 -68
- package/dist/tui/App.js +1485 -645
- package/package.json +3 -2
package/dist/hooks/stop.js
CHANGED
|
@@ -532,6 +532,13 @@ async function ensureSchema() {
|
|
|
532
532
|
});
|
|
533
533
|
} catch {
|
|
534
534
|
}
|
|
535
|
+
try {
|
|
536
|
+
await client.execute({
|
|
537
|
+
sql: `ALTER TABLE tasks ADD COLUMN session_scope TEXT`,
|
|
538
|
+
args: []
|
|
539
|
+
});
|
|
540
|
+
} catch {
|
|
541
|
+
}
|
|
535
542
|
try {
|
|
536
543
|
await client.execute({
|
|
537
544
|
sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
|
|
@@ -978,6 +985,18 @@ async function ensureSchema() {
|
|
|
978
985
|
CREATE INDEX IF NOT EXISTS idx_session_kills_agent
|
|
979
986
|
ON session_kills(agent_id);
|
|
980
987
|
`);
|
|
988
|
+
await client.execute(`
|
|
989
|
+
CREATE TABLE IF NOT EXISTS global_procedures (
|
|
990
|
+
id TEXT PRIMARY KEY,
|
|
991
|
+
title TEXT NOT NULL,
|
|
992
|
+
content TEXT NOT NULL,
|
|
993
|
+
priority TEXT NOT NULL DEFAULT 'p0',
|
|
994
|
+
domain TEXT,
|
|
995
|
+
active INTEGER NOT NULL DEFAULT 1,
|
|
996
|
+
created_at TEXT NOT NULL,
|
|
997
|
+
updated_at TEXT NOT NULL
|
|
998
|
+
)
|
|
999
|
+
`);
|
|
981
1000
|
await client.executeMultiple(`
|
|
982
1001
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
983
1002
|
id TEXT PRIMARY KEY,
|
|
@@ -1185,6 +1204,61 @@ var init_keychain = __esm({
|
|
|
1185
1204
|
}
|
|
1186
1205
|
});
|
|
1187
1206
|
|
|
1207
|
+
// src/lib/state-bus.ts
|
|
1208
|
+
var StateBus, orgBus;
|
|
1209
|
+
var init_state_bus = __esm({
|
|
1210
|
+
"src/lib/state-bus.ts"() {
|
|
1211
|
+
"use strict";
|
|
1212
|
+
StateBus = class {
|
|
1213
|
+
handlers = /* @__PURE__ */ new Map();
|
|
1214
|
+
globalHandlers = /* @__PURE__ */ new Set();
|
|
1215
|
+
/** Emit an event to all subscribers */
|
|
1216
|
+
emit(event) {
|
|
1217
|
+
const typeHandlers = this.handlers.get(event.type);
|
|
1218
|
+
if (typeHandlers) {
|
|
1219
|
+
for (const handler of typeHandlers) {
|
|
1220
|
+
try {
|
|
1221
|
+
handler(event);
|
|
1222
|
+
} catch {
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
for (const handler of this.globalHandlers) {
|
|
1227
|
+
try {
|
|
1228
|
+
handler(event);
|
|
1229
|
+
} catch {
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
/** Subscribe to a specific event type */
|
|
1234
|
+
on(type, handler) {
|
|
1235
|
+
if (!this.handlers.has(type)) {
|
|
1236
|
+
this.handlers.set(type, /* @__PURE__ */ new Set());
|
|
1237
|
+
}
|
|
1238
|
+
this.handlers.get(type).add(handler);
|
|
1239
|
+
}
|
|
1240
|
+
/** Subscribe to ALL events */
|
|
1241
|
+
onAny(handler) {
|
|
1242
|
+
this.globalHandlers.add(handler);
|
|
1243
|
+
}
|
|
1244
|
+
/** Unsubscribe from a specific event type */
|
|
1245
|
+
off(type, handler) {
|
|
1246
|
+
this.handlers.get(type)?.delete(handler);
|
|
1247
|
+
}
|
|
1248
|
+
/** Unsubscribe from ALL events */
|
|
1249
|
+
offAny(handler) {
|
|
1250
|
+
this.globalHandlers.delete(handler);
|
|
1251
|
+
}
|
|
1252
|
+
/** Remove all listeners */
|
|
1253
|
+
clear() {
|
|
1254
|
+
this.handlers.clear();
|
|
1255
|
+
this.globalHandlers.clear();
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
orgBus = new StateBus();
|
|
1259
|
+
}
|
|
1260
|
+
});
|
|
1261
|
+
|
|
1188
1262
|
// src/lib/shard-manager.ts
|
|
1189
1263
|
var shard_manager_exports = {};
|
|
1190
1264
|
__export(shard_manager_exports, {
|
|
@@ -1426,6 +1500,71 @@ var init_shard_manager = __esm({
|
|
|
1426
1500
|
}
|
|
1427
1501
|
});
|
|
1428
1502
|
|
|
1503
|
+
// src/lib/global-procedures.ts
|
|
1504
|
+
var global_procedures_exports = {};
|
|
1505
|
+
__export(global_procedures_exports, {
|
|
1506
|
+
deactivateGlobalProcedure: () => deactivateGlobalProcedure,
|
|
1507
|
+
getGlobalProceduresBlock: () => getGlobalProceduresBlock,
|
|
1508
|
+
loadGlobalProcedures: () => loadGlobalProcedures,
|
|
1509
|
+
storeGlobalProcedure: () => storeGlobalProcedure
|
|
1510
|
+
});
|
|
1511
|
+
import { randomUUID } from "crypto";
|
|
1512
|
+
async function loadGlobalProcedures() {
|
|
1513
|
+
const client = getClient();
|
|
1514
|
+
const result = await client.execute({
|
|
1515
|
+
sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
1516
|
+
args: []
|
|
1517
|
+
});
|
|
1518
|
+
const procedures = result.rows;
|
|
1519
|
+
if (procedures.length > 0) {
|
|
1520
|
+
_cache = procedures.map((p) => `### ${p.title}
|
|
1521
|
+
${p.content}`).join("\n\n");
|
|
1522
|
+
} else {
|
|
1523
|
+
_cache = "";
|
|
1524
|
+
}
|
|
1525
|
+
_cacheLoaded = true;
|
|
1526
|
+
return procedures;
|
|
1527
|
+
}
|
|
1528
|
+
function getGlobalProceduresBlock() {
|
|
1529
|
+
if (!_cacheLoaded) return "";
|
|
1530
|
+
if (!_cache) return "";
|
|
1531
|
+
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
1532
|
+
|
|
1533
|
+
${_cache}
|
|
1534
|
+
`;
|
|
1535
|
+
}
|
|
1536
|
+
async function storeGlobalProcedure(input2) {
|
|
1537
|
+
const id = randomUUID();
|
|
1538
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1539
|
+
const client = getClient();
|
|
1540
|
+
await client.execute({
|
|
1541
|
+
sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
1542
|
+
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
1543
|
+
args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
|
|
1544
|
+
});
|
|
1545
|
+
await loadGlobalProcedures();
|
|
1546
|
+
return id;
|
|
1547
|
+
}
|
|
1548
|
+
async function deactivateGlobalProcedure(id) {
|
|
1549
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1550
|
+
const client = getClient();
|
|
1551
|
+
const result = await client.execute({
|
|
1552
|
+
sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
1553
|
+
args: [now, id]
|
|
1554
|
+
});
|
|
1555
|
+
await loadGlobalProcedures();
|
|
1556
|
+
return result.rowsAffected > 0;
|
|
1557
|
+
}
|
|
1558
|
+
var _cache, _cacheLoaded;
|
|
1559
|
+
var init_global_procedures = __esm({
|
|
1560
|
+
"src/lib/global-procedures.ts"() {
|
|
1561
|
+
"use strict";
|
|
1562
|
+
init_database();
|
|
1563
|
+
_cache = "";
|
|
1564
|
+
_cacheLoaded = false;
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
|
|
1429
1568
|
// src/lib/store.ts
|
|
1430
1569
|
var store_exports = {};
|
|
1431
1570
|
__export(store_exports, {
|
|
@@ -1505,6 +1644,11 @@ async function initStore(options) {
|
|
|
1505
1644
|
"version-query"
|
|
1506
1645
|
);
|
|
1507
1646
|
_nextVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
|
|
1647
|
+
try {
|
|
1648
|
+
const { loadGlobalProcedures: loadGlobalProcedures2 } = await Promise.resolve().then(() => (init_global_procedures(), global_procedures_exports));
|
|
1649
|
+
await loadGlobalProcedures2();
|
|
1650
|
+
} catch {
|
|
1651
|
+
}
|
|
1508
1652
|
}
|
|
1509
1653
|
function classifyTier(record) {
|
|
1510
1654
|
if (record.tool_name === "commit_to_long_term_memory" && (record.importance ?? 0) >= 8) return 1;
|
|
@@ -1546,6 +1690,12 @@ async function writeMemory(record) {
|
|
|
1546
1690
|
supersedes_id: record.supersedes_id ?? null
|
|
1547
1691
|
};
|
|
1548
1692
|
_pendingRecords.push(dbRow);
|
|
1693
|
+
orgBus.emit({
|
|
1694
|
+
type: "memory_stored",
|
|
1695
|
+
agentId: record.agent_id,
|
|
1696
|
+
project: record.project_name,
|
|
1697
|
+
timestamp: record.timestamp
|
|
1698
|
+
});
|
|
1549
1699
|
const MAX_PENDING = 1e3;
|
|
1550
1700
|
if (_pendingRecords.length > MAX_PENDING) {
|
|
1551
1701
|
const dropped = _pendingRecords.length - MAX_PENDING;
|
|
@@ -1891,6 +2041,7 @@ var init_store = __esm({
|
|
|
1891
2041
|
init_database();
|
|
1892
2042
|
init_keychain();
|
|
1893
2043
|
init_config();
|
|
2044
|
+
init_state_bus();
|
|
1894
2045
|
INIT_MAX_RETRIES = 3;
|
|
1895
2046
|
INIT_RETRY_DELAY_MS = 1e3;
|
|
1896
2047
|
_pendingRecords = [];
|
|
@@ -111,7 +111,7 @@ async function loadConfig() {
|
|
|
111
111
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
|
|
114
|
+
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, COO_AGENT_NAME, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
|
|
115
115
|
var init_config = __esm({
|
|
116
116
|
"src/lib/config.ts"() {
|
|
117
117
|
"use strict";
|
|
@@ -119,6 +119,7 @@ var init_config = __esm({
|
|
|
119
119
|
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
120
120
|
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
121
121
|
CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
122
|
+
COO_AGENT_NAME = "exe";
|
|
122
123
|
LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
123
124
|
CURRENT_CONFIG_VERSION = 1;
|
|
124
125
|
DEFAULT_CONFIG = {
|
|
@@ -513,6 +514,13 @@ async function ensureSchema() {
|
|
|
513
514
|
});
|
|
514
515
|
} catch {
|
|
515
516
|
}
|
|
517
|
+
try {
|
|
518
|
+
await client.execute({
|
|
519
|
+
sql: `ALTER TABLE tasks ADD COLUMN session_scope TEXT`,
|
|
520
|
+
args: []
|
|
521
|
+
});
|
|
522
|
+
} catch {
|
|
523
|
+
}
|
|
516
524
|
try {
|
|
517
525
|
await client.execute({
|
|
518
526
|
sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
|
|
@@ -959,6 +967,18 @@ async function ensureSchema() {
|
|
|
959
967
|
CREATE INDEX IF NOT EXISTS idx_session_kills_agent
|
|
960
968
|
ON session_kills(agent_id);
|
|
961
969
|
`);
|
|
970
|
+
await client.execute(`
|
|
971
|
+
CREATE TABLE IF NOT EXISTS global_procedures (
|
|
972
|
+
id TEXT PRIMARY KEY,
|
|
973
|
+
title TEXT NOT NULL,
|
|
974
|
+
content TEXT NOT NULL,
|
|
975
|
+
priority TEXT NOT NULL DEFAULT 'p0',
|
|
976
|
+
domain TEXT,
|
|
977
|
+
active INTEGER NOT NULL DEFAULT 1,
|
|
978
|
+
created_at TEXT NOT NULL,
|
|
979
|
+
updated_at TEXT NOT NULL
|
|
980
|
+
)
|
|
981
|
+
`);
|
|
962
982
|
await client.executeMultiple(`
|
|
963
983
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
964
984
|
id TEXT PRIMARY KEY,
|
|
@@ -1166,6 +1186,61 @@ var init_keychain = __esm({
|
|
|
1166
1186
|
}
|
|
1167
1187
|
});
|
|
1168
1188
|
|
|
1189
|
+
// src/lib/state-bus.ts
|
|
1190
|
+
var StateBus, orgBus;
|
|
1191
|
+
var init_state_bus = __esm({
|
|
1192
|
+
"src/lib/state-bus.ts"() {
|
|
1193
|
+
"use strict";
|
|
1194
|
+
StateBus = class {
|
|
1195
|
+
handlers = /* @__PURE__ */ new Map();
|
|
1196
|
+
globalHandlers = /* @__PURE__ */ new Set();
|
|
1197
|
+
/** Emit an event to all subscribers */
|
|
1198
|
+
emit(event) {
|
|
1199
|
+
const typeHandlers = this.handlers.get(event.type);
|
|
1200
|
+
if (typeHandlers) {
|
|
1201
|
+
for (const handler of typeHandlers) {
|
|
1202
|
+
try {
|
|
1203
|
+
handler(event);
|
|
1204
|
+
} catch {
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
for (const handler of this.globalHandlers) {
|
|
1209
|
+
try {
|
|
1210
|
+
handler(event);
|
|
1211
|
+
} catch {
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
/** Subscribe to a specific event type */
|
|
1216
|
+
on(type, handler) {
|
|
1217
|
+
if (!this.handlers.has(type)) {
|
|
1218
|
+
this.handlers.set(type, /* @__PURE__ */ new Set());
|
|
1219
|
+
}
|
|
1220
|
+
this.handlers.get(type).add(handler);
|
|
1221
|
+
}
|
|
1222
|
+
/** Subscribe to ALL events */
|
|
1223
|
+
onAny(handler) {
|
|
1224
|
+
this.globalHandlers.add(handler);
|
|
1225
|
+
}
|
|
1226
|
+
/** Unsubscribe from a specific event type */
|
|
1227
|
+
off(type, handler) {
|
|
1228
|
+
this.handlers.get(type)?.delete(handler);
|
|
1229
|
+
}
|
|
1230
|
+
/** Unsubscribe from ALL events */
|
|
1231
|
+
offAny(handler) {
|
|
1232
|
+
this.globalHandlers.delete(handler);
|
|
1233
|
+
}
|
|
1234
|
+
/** Remove all listeners */
|
|
1235
|
+
clear() {
|
|
1236
|
+
this.handlers.clear();
|
|
1237
|
+
this.globalHandlers.clear();
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
orgBus = new StateBus();
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1169
1244
|
// src/lib/shard-manager.ts
|
|
1170
1245
|
var shard_manager_exports = {};
|
|
1171
1246
|
__export(shard_manager_exports, {
|
|
@@ -1407,6 +1482,71 @@ var init_shard_manager = __esm({
|
|
|
1407
1482
|
}
|
|
1408
1483
|
});
|
|
1409
1484
|
|
|
1485
|
+
// src/lib/global-procedures.ts
|
|
1486
|
+
var global_procedures_exports = {};
|
|
1487
|
+
__export(global_procedures_exports, {
|
|
1488
|
+
deactivateGlobalProcedure: () => deactivateGlobalProcedure,
|
|
1489
|
+
getGlobalProceduresBlock: () => getGlobalProceduresBlock,
|
|
1490
|
+
loadGlobalProcedures: () => loadGlobalProcedures,
|
|
1491
|
+
storeGlobalProcedure: () => storeGlobalProcedure
|
|
1492
|
+
});
|
|
1493
|
+
import { randomUUID } from "crypto";
|
|
1494
|
+
async function loadGlobalProcedures() {
|
|
1495
|
+
const client = getClient();
|
|
1496
|
+
const result = await client.execute({
|
|
1497
|
+
sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
1498
|
+
args: []
|
|
1499
|
+
});
|
|
1500
|
+
const procedures = result.rows;
|
|
1501
|
+
if (procedures.length > 0) {
|
|
1502
|
+
_cache = procedures.map((p) => `### ${p.title}
|
|
1503
|
+
${p.content}`).join("\n\n");
|
|
1504
|
+
} else {
|
|
1505
|
+
_cache = "";
|
|
1506
|
+
}
|
|
1507
|
+
_cacheLoaded = true;
|
|
1508
|
+
return procedures;
|
|
1509
|
+
}
|
|
1510
|
+
function getGlobalProceduresBlock() {
|
|
1511
|
+
if (!_cacheLoaded) return "";
|
|
1512
|
+
if (!_cache) return "";
|
|
1513
|
+
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
1514
|
+
|
|
1515
|
+
${_cache}
|
|
1516
|
+
`;
|
|
1517
|
+
}
|
|
1518
|
+
async function storeGlobalProcedure(input2) {
|
|
1519
|
+
const id = randomUUID();
|
|
1520
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1521
|
+
const client = getClient();
|
|
1522
|
+
await client.execute({
|
|
1523
|
+
sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
1524
|
+
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
1525
|
+
args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
|
|
1526
|
+
});
|
|
1527
|
+
await loadGlobalProcedures();
|
|
1528
|
+
return id;
|
|
1529
|
+
}
|
|
1530
|
+
async function deactivateGlobalProcedure(id) {
|
|
1531
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1532
|
+
const client = getClient();
|
|
1533
|
+
const result = await client.execute({
|
|
1534
|
+
sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
1535
|
+
args: [now, id]
|
|
1536
|
+
});
|
|
1537
|
+
await loadGlobalProcedures();
|
|
1538
|
+
return result.rowsAffected > 0;
|
|
1539
|
+
}
|
|
1540
|
+
var _cache, _cacheLoaded;
|
|
1541
|
+
var init_global_procedures = __esm({
|
|
1542
|
+
"src/lib/global-procedures.ts"() {
|
|
1543
|
+
"use strict";
|
|
1544
|
+
init_database();
|
|
1545
|
+
_cache = "";
|
|
1546
|
+
_cacheLoaded = false;
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1410
1550
|
// src/lib/store.ts
|
|
1411
1551
|
var store_exports = {};
|
|
1412
1552
|
__export(store_exports, {
|
|
@@ -1486,6 +1626,11 @@ async function initStore(options) {
|
|
|
1486
1626
|
"version-query"
|
|
1487
1627
|
);
|
|
1488
1628
|
_nextVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
|
|
1629
|
+
try {
|
|
1630
|
+
const { loadGlobalProcedures: loadGlobalProcedures2 } = await Promise.resolve().then(() => (init_global_procedures(), global_procedures_exports));
|
|
1631
|
+
await loadGlobalProcedures2();
|
|
1632
|
+
} catch {
|
|
1633
|
+
}
|
|
1489
1634
|
}
|
|
1490
1635
|
function classifyTier(record) {
|
|
1491
1636
|
if (record.tool_name === "commit_to_long_term_memory" && (record.importance ?? 0) >= 8) return 1;
|
|
@@ -1527,6 +1672,12 @@ async function writeMemory(record) {
|
|
|
1527
1672
|
supersedes_id: record.supersedes_id ?? null
|
|
1528
1673
|
};
|
|
1529
1674
|
_pendingRecords.push(dbRow);
|
|
1675
|
+
orgBus.emit({
|
|
1676
|
+
type: "memory_stored",
|
|
1677
|
+
agentId: record.agent_id,
|
|
1678
|
+
project: record.project_name,
|
|
1679
|
+
timestamp: record.timestamp
|
|
1680
|
+
});
|
|
1530
1681
|
const MAX_PENDING = 1e3;
|
|
1531
1682
|
if (_pendingRecords.length > MAX_PENDING) {
|
|
1532
1683
|
const dropped = _pendingRecords.length - MAX_PENDING;
|
|
@@ -1872,6 +2023,7 @@ var init_store = __esm({
|
|
|
1872
2023
|
init_database();
|
|
1873
2024
|
init_keychain();
|
|
1874
2025
|
init_config();
|
|
2026
|
+
init_state_bus();
|
|
1875
2027
|
INIT_MAX_RETRIES = 3;
|
|
1876
2028
|
INIT_RETRY_DELAY_MS = 1e3;
|
|
1877
2029
|
_pendingRecords = [];
|
|
@@ -1973,6 +2125,7 @@ function getActiveAgent() {
|
|
|
1973
2125
|
}
|
|
1974
2126
|
|
|
1975
2127
|
// src/adapters/claude/hooks/subagent-stop.ts
|
|
2128
|
+
init_config();
|
|
1976
2129
|
if (!process.env.AGENT_ID) {
|
|
1977
2130
|
process.env.AGENT_ID = "default";
|
|
1978
2131
|
process.env.AGENT_ROLE = "employee";
|
|
@@ -1991,7 +2144,7 @@ process.stdin.on("end", async () => {
|
|
|
1991
2144
|
try {
|
|
1992
2145
|
JSON.parse(input);
|
|
1993
2146
|
const agent = getActiveAgent();
|
|
1994
|
-
if (agent.agentId ===
|
|
2147
|
+
if (agent.agentId === COO_AGENT_NAME || agent.agentId === "default") {
|
|
1995
2148
|
process.exit(0);
|
|
1996
2149
|
}
|
|
1997
2150
|
const { initStore: initStore2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|