@askexenow/exe-os 0.8.80 → 0.8.82
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 +359 -267
- package/dist/bin/backfill-responses.js +357 -265
- package/dist/bin/backfill-vectors.js +339 -264
- package/dist/bin/cleanup-stale-review-tasks.js +315 -256
- package/dist/bin/cli.js +494 -240
- package/dist/bin/exe-agent.js +141 -46
- package/dist/bin/exe-assign.js +151 -63
- package/dist/bin/exe-boot.js +294 -115
- package/dist/bin/exe-call.js +76 -51
- package/dist/bin/exe-cloud.js +58 -45
- package/dist/bin/exe-dispatch.js +434 -277
- package/dist/bin/exe-doctor.js +317 -246
- package/dist/bin/exe-export-behaviors.js +328 -248
- package/dist/bin/exe-forget.js +314 -231
- package/dist/bin/exe-gateway.js +2676 -1402
- package/dist/bin/exe-heartbeat.js +329 -264
- package/dist/bin/exe-kill.js +324 -244
- package/dist/bin/exe-launch-agent.js +574 -463
- package/dist/bin/exe-link.js +1055 -95
- package/dist/bin/exe-new-employee.js +49 -54
- package/dist/bin/exe-pending-messages.js +310 -253
- package/dist/bin/exe-pending-notifications.js +299 -228
- package/dist/bin/exe-pending-reviews.js +314 -245
- package/dist/bin/exe-rename.js +259 -195
- package/dist/bin/exe-review.js +140 -64
- package/dist/bin/exe-search.js +543 -356
- package/dist/bin/exe-session-cleanup.js +463 -382
- package/dist/bin/exe-settings.js +129 -99
- package/dist/bin/exe-start.sh +6 -6
- package/dist/bin/exe-status.js +95 -36
- package/dist/bin/exe-team.js +116 -51
- package/dist/bin/git-sweep.js +482 -307
- package/dist/bin/graph-backfill.js +357 -245
- package/dist/bin/graph-export.js +324 -244
- package/dist/bin/install.js +33 -10
- package/dist/bin/scan-tasks.js +481 -307
- package/dist/bin/setup.js +1147 -140
- package/dist/bin/shard-migrate.js +321 -241
- package/dist/bin/update.js +1 -7
- package/dist/bin/wiki-sync.js +318 -238
- package/dist/gateway/index.js +2656 -1383
- package/dist/hooks/bug-report-worker.js +641 -472
- package/dist/hooks/commit-complete.js +482 -307
- package/dist/hooks/error-recall.js +363 -135
- package/dist/hooks/exe-heartbeat-hook.js +97 -27
- package/dist/hooks/ingest-worker.js +584 -397
- package/dist/hooks/ingest.js +123 -58
- package/dist/hooks/instructions-loaded.js +212 -82
- package/dist/hooks/notification.js +200 -70
- package/dist/hooks/post-compact.js +199 -81
- package/dist/hooks/pre-compact.js +352 -140
- package/dist/hooks/pre-tool-use.js +416 -278
- package/dist/hooks/prompt-ingest-worker.js +376 -299
- package/dist/hooks/prompt-submit.js +414 -188
- package/dist/hooks/response-ingest-worker.js +408 -338
- package/dist/hooks/session-end.js +209 -83
- package/dist/hooks/session-start.js +382 -158
- package/dist/hooks/stop.js +209 -83
- package/dist/hooks/subagent-stop.js +209 -85
- package/dist/hooks/summary-worker.js +606 -510
- package/dist/index.js +2133 -855
- package/dist/lib/cloud-sync.js +1175 -184
- package/dist/lib/config.js +1 -9
- package/dist/lib/consolidation.js +71 -34
- package/dist/lib/database.js +166 -14
- package/dist/lib/device-registry.js +189 -117
- package/dist/lib/embedder.js +6 -10
- package/dist/lib/employee-templates.js +134 -39
- package/dist/lib/employees.js +30 -7
- package/dist/lib/exe-daemon-client.js +5 -7
- package/dist/lib/exe-daemon.js +514 -152
- package/dist/lib/hybrid-search.js +543 -356
- package/dist/lib/identity-templates.js +15 -15
- package/dist/lib/identity.js +19 -15
- package/dist/lib/license.js +1 -7
- package/dist/lib/messaging.js +157 -135
- package/dist/lib/reminders.js +97 -0
- package/dist/lib/schedules.js +302 -231
- package/dist/lib/skill-learning.js +33 -27
- package/dist/lib/status-brief.js +11 -14
- package/dist/lib/store.js +326 -237
- package/dist/lib/task-router.js +105 -1
- package/dist/lib/tasks.js +233 -116
- package/dist/lib/tmux-routing.js +173 -56
- package/dist/lib/ws-client.js +13 -3
- package/dist/mcp/server.js +2009 -1015
- package/dist/mcp/tools/complete-reminder.js +97 -0
- package/dist/mcp/tools/create-reminder.js +97 -0
- package/dist/mcp/tools/create-task.js +426 -262
- package/dist/mcp/tools/deactivate-behavior.js +119 -44
- package/dist/mcp/tools/list-reminders.js +97 -0
- package/dist/mcp/tools/list-tasks.js +56 -57
- package/dist/mcp/tools/send-message.js +206 -143
- package/dist/mcp/tools/update-task.js +259 -85
- package/dist/runtime/index.js +495 -316
- package/dist/tui/App.js +1128 -919
- package/package.json +2 -10
- package/src/commands/exe/afk.md +8 -8
- package/src/commands/exe/assign.md +1 -1
- package/src/commands/exe/build-adv.md +1 -1
- package/src/commands/exe/call.md +10 -10
- package/src/commands/exe/employee-heartbeat.md +9 -6
- package/src/commands/exe/heartbeat.md +5 -5
- package/src/commands/exe/intercom.md +26 -15
- package/src/commands/exe/launch.md +2 -2
- package/src/commands/exe/new-employee.md +1 -1
- package/src/commands/exe/review.md +2 -2
- package/src/commands/exe/schedule.md +1 -1
- package/src/commands/exe/sessions.md +2 -2
- package/src/commands/exe.md +22 -20
package/dist/bin/exe-review.js
CHANGED
|
@@ -155,13 +155,7 @@ var init_config = __esm({
|
|
|
155
155
|
wikiUrl: "",
|
|
156
156
|
wikiApiKey: "",
|
|
157
157
|
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
158
|
-
wikiWorkspaceMapping: {
|
|
159
|
-
exe: "Executive",
|
|
160
|
-
yoshi: "Engineering",
|
|
161
|
-
mari: "Marketing",
|
|
162
|
-
tom: "Engineering",
|
|
163
|
-
sasha: "Production"
|
|
164
|
-
},
|
|
158
|
+
wikiWorkspaceMapping: {},
|
|
165
159
|
wikiAutoUpdate: true,
|
|
166
160
|
wikiAutoUpdateThreshold: 0.5,
|
|
167
161
|
wikiAutoUpdateCreateNew: true,
|
|
@@ -198,6 +192,57 @@ var init_config = __esm({
|
|
|
198
192
|
}
|
|
199
193
|
});
|
|
200
194
|
|
|
195
|
+
// src/lib/employees.ts
|
|
196
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
197
|
+
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
198
|
+
import { execSync } from "child_process";
|
|
199
|
+
import path2 from "path";
|
|
200
|
+
import os2 from "os";
|
|
201
|
+
function normalizeRole(role) {
|
|
202
|
+
return (role ?? "").trim().toLowerCase();
|
|
203
|
+
}
|
|
204
|
+
function isCoordinatorRole(role) {
|
|
205
|
+
return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
|
|
206
|
+
}
|
|
207
|
+
function getCoordinatorEmployee(employees) {
|
|
208
|
+
return employees.find((e) => isCoordinatorRole(e.role));
|
|
209
|
+
}
|
|
210
|
+
function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
211
|
+
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
212
|
+
}
|
|
213
|
+
async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
|
|
214
|
+
if (!existsSync2(employeesPath)) {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
const raw = await readFile2(employeesPath, "utf-8");
|
|
218
|
+
try {
|
|
219
|
+
return JSON.parse(raw);
|
|
220
|
+
} catch {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
225
|
+
if (!existsSync2(employeesPath)) return [];
|
|
226
|
+
try {
|
|
227
|
+
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
228
|
+
} catch {
|
|
229
|
+
return [];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function getEmployee(employees, name) {
|
|
233
|
+
return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
|
|
234
|
+
}
|
|
235
|
+
var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
|
|
236
|
+
var init_employees = __esm({
|
|
237
|
+
"src/lib/employees.ts"() {
|
|
238
|
+
"use strict";
|
|
239
|
+
init_config();
|
|
240
|
+
EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
241
|
+
DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
|
|
242
|
+
COORDINATOR_ROLE = "COO";
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
|
|
201
246
|
// src/lib/db-retry.ts
|
|
202
247
|
function isBusyError(err) {
|
|
203
248
|
if (err instanceof Error) {
|
|
@@ -237,7 +282,7 @@ function wrapWithRetry(client) {
|
|
|
237
282
|
return (sql) => retryOnBusy(() => target.execute(sql), "execute");
|
|
238
283
|
}
|
|
239
284
|
if (prop === "batch") {
|
|
240
|
-
return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
|
|
285
|
+
return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
|
|
241
286
|
}
|
|
242
287
|
return Reflect.get(target, prop, receiver);
|
|
243
288
|
}
|
|
@@ -386,22 +431,24 @@ async function ensureSchema() {
|
|
|
386
431
|
ON behaviors(agent_id, active);
|
|
387
432
|
`);
|
|
388
433
|
try {
|
|
434
|
+
const coordinatorName = getCoordinatorName();
|
|
389
435
|
const existing = await client.execute({
|
|
390
|
-
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id =
|
|
391
|
-
args: []
|
|
436
|
+
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
|
|
437
|
+
args: [coordinatorName]
|
|
392
438
|
});
|
|
393
439
|
if (Number(existing.rows[0]?.cnt) === 0) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
440
|
+
const seededAt = "2026-03-25T00:00:00Z";
|
|
441
|
+
for (const [domain, content] of [
|
|
442
|
+
["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
|
|
443
|
+
["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
|
|
444
|
+
["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
|
|
445
|
+
]) {
|
|
446
|
+
await client.execute({
|
|
447
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
|
|
448
|
+
VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
|
|
449
|
+
args: [coordinatorName, domain, content, seededAt, seededAt]
|
|
450
|
+
});
|
|
451
|
+
}
|
|
405
452
|
}
|
|
406
453
|
} catch {
|
|
407
454
|
}
|
|
@@ -1093,12 +1140,46 @@ async function ensureSchema() {
|
|
|
1093
1140
|
} catch {
|
|
1094
1141
|
}
|
|
1095
1142
|
}
|
|
1143
|
+
try {
|
|
1144
|
+
await client.execute({
|
|
1145
|
+
sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
|
|
1146
|
+
args: []
|
|
1147
|
+
});
|
|
1148
|
+
} catch {
|
|
1149
|
+
}
|
|
1150
|
+
try {
|
|
1151
|
+
await client.execute(
|
|
1152
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
|
|
1153
|
+
);
|
|
1154
|
+
} catch {
|
|
1155
|
+
}
|
|
1156
|
+
try {
|
|
1157
|
+
await client.execute({
|
|
1158
|
+
sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
|
|
1159
|
+
args: []
|
|
1160
|
+
});
|
|
1161
|
+
} catch {
|
|
1162
|
+
}
|
|
1163
|
+
try {
|
|
1164
|
+
await client.execute(
|
|
1165
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
|
|
1166
|
+
);
|
|
1167
|
+
} catch {
|
|
1168
|
+
}
|
|
1169
|
+
try {
|
|
1170
|
+
await client.execute({
|
|
1171
|
+
sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
|
|
1172
|
+
args: []
|
|
1173
|
+
});
|
|
1174
|
+
} catch {
|
|
1175
|
+
}
|
|
1096
1176
|
}
|
|
1097
1177
|
var _client, _resilientClient, initTurso;
|
|
1098
1178
|
var init_database = __esm({
|
|
1099
1179
|
"src/lib/database.ts"() {
|
|
1100
1180
|
"use strict";
|
|
1101
1181
|
init_db_retry();
|
|
1182
|
+
init_employees();
|
|
1102
1183
|
_client = null;
|
|
1103
1184
|
_resilientClient = null;
|
|
1104
1185
|
initTurso = initDatabase;
|
|
@@ -1227,7 +1308,11 @@ async function ensureShardSchema(client) {
|
|
|
1227
1308
|
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1228
1309
|
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1229
1310
|
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1230
|
-
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1311
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
|
|
1312
|
+
// MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
|
|
1313
|
+
"ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
|
|
1314
|
+
"ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
|
|
1315
|
+
"ALTER TABLE memories ADD COLUMN trajectory TEXT"
|
|
1231
1316
|
]) {
|
|
1232
1317
|
try {
|
|
1233
1318
|
await client.execute(col);
|
|
@@ -1357,26 +1442,26 @@ var init_platform_procedures = __esm({
|
|
|
1357
1442
|
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1358
1443
|
domain: "architecture",
|
|
1359
1444
|
priority: "p0",
|
|
1360
|
-
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO
|
|
1445
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO, CTO, CMO, engineers, and content production specialists. Each agent has identity, expertise, and experience layers \u2014 persistent memory that makes them better over time. All data is local-first, E2EE, owned by the user. The MCP server is the ONLY data interface \u2014 never access the DB directly."
|
|
1361
1446
|
},
|
|
1362
1447
|
{
|
|
1363
1448
|
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1364
1449
|
domain: "architecture",
|
|
1365
1450
|
priority: "p0",
|
|
1366
|
-
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC
|
|
1451
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC and boots the COO. The COO manages employees in tmux sessions. Each coordinator session is a separate CC window/project. Employees run in their own tmux panes via create_task auto-spawn. The founder talks to the COO; the COO orchestrates the team. CC is the shell, exe-os is the brain."
|
|
1367
1452
|
},
|
|
1368
1453
|
{
|
|
1369
|
-
title: "Sessions explained \u2014
|
|
1454
|
+
title: "Sessions explained \u2014 coordinator session names and projects",
|
|
1370
1455
|
domain: "architecture",
|
|
1371
1456
|
priority: "p0",
|
|
1372
|
-
content: "Each
|
|
1457
|
+
content: "Each coordinator session is an isolated project session. One might be exe-os development, another might be exe-wiki. Each session spawns its own employees using {employee}-{coordinatorSession}. Sessions share the same memory DB but tasks are scoped to the session that created them. A founder can run multiple projects simultaneously. Sessions never interfere with each other."
|
|
1373
1458
|
},
|
|
1374
1459
|
// --- Hierarchy and dispatch ---
|
|
1375
1460
|
{
|
|
1376
1461
|
title: "Chain of command \u2014 who talks to whom",
|
|
1377
1462
|
domain: "workflow",
|
|
1378
1463
|
priority: "p0",
|
|
1379
|
-
content: "Founder
|
|
1464
|
+
content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
|
|
1380
1465
|
},
|
|
1381
1466
|
{
|
|
1382
1467
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -1386,30 +1471,30 @@ var init_platform_procedures = __esm({
|
|
|
1386
1471
|
},
|
|
1387
1472
|
// --- Session isolation ---
|
|
1388
1473
|
{
|
|
1389
|
-
title: "Session scoping \u2014 stay in your
|
|
1474
|
+
title: "Session scoping \u2014 stay in your coordinator boundary",
|
|
1390
1475
|
domain: "security",
|
|
1391
1476
|
priority: "p0",
|
|
1392
|
-
content: "Session scoping is mandatory. Managers dispatch to workers within their own
|
|
1477
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own coordinator session ONLY. Employee sessions use {employee}-{coordinatorSession}. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating coordinator session."
|
|
1393
1478
|
},
|
|
1394
1479
|
{
|
|
1395
1480
|
title: "Session isolation \u2014 never touch another session's work",
|
|
1396
1481
|
domain: "workflow",
|
|
1397
1482
|
priority: "p0",
|
|
1398
|
-
content:
|
|
1483
|
+
content: "Sessions are isolated. A coordinator session owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another coordinator session. (2) Never review work from a different session \u2014 report that it belongs to another session and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: employee sessions work ONLY on their parent coordinator session's tasks. Cross-session work is a system violation."
|
|
1399
1484
|
},
|
|
1400
1485
|
// --- Engineering: session scoping in code ---
|
|
1401
1486
|
{
|
|
1402
1487
|
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1403
1488
|
domain: "architecture",
|
|
1404
1489
|
priority: "p0",
|
|
1405
|
-
content: "Every DB query, notification, review count, and task operation MUST be scoped on 3 dimensions: (1) Session \u2014 filter by session_scope matching current
|
|
1490
|
+
content: "Every DB query, notification, review count, and task operation MUST be scoped on 3 dimensions: (1) Session \u2014 filter by session_scope matching the current coordinator session. (2) Project \u2014 filter by project_name. (3) Role \u2014 agents only see data at their hierarchy level. When writing ANY function that touches tasks, reviews, messages, or notifications: always accept a sessionScope parameter and pass it to the SQL WHERE clause. Unscoped queries are bugs. Test by running 2+ coordinator sessions simultaneously."
|
|
1406
1491
|
},
|
|
1407
1492
|
// --- Hard constraints ---
|
|
1408
1493
|
{
|
|
1409
1494
|
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1410
1495
|
domain: "security",
|
|
1411
1496
|
priority: "p0",
|
|
1412
|
-
content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014
|
|
1497
|
+
content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
1413
1498
|
},
|
|
1414
1499
|
// --- Operations ---
|
|
1415
1500
|
{
|
|
@@ -1528,31 +1613,9 @@ ${p.content}`).join("\n\n");
|
|
|
1528
1613
|
});
|
|
1529
1614
|
|
|
1530
1615
|
// src/bin/exe-review.ts
|
|
1616
|
+
init_employees();
|
|
1531
1617
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1532
1618
|
|
|
1533
|
-
// src/lib/employees.ts
|
|
1534
|
-
init_config();
|
|
1535
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
1536
|
-
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
1537
|
-
import { execSync } from "child_process";
|
|
1538
|
-
import path2 from "path";
|
|
1539
|
-
import os2 from "os";
|
|
1540
|
-
var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
1541
|
-
async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
|
|
1542
|
-
if (!existsSync2(employeesPath)) {
|
|
1543
|
-
return [];
|
|
1544
|
-
}
|
|
1545
|
-
const raw = await readFile2(employeesPath, "utf-8");
|
|
1546
|
-
try {
|
|
1547
|
-
return JSON.parse(raw);
|
|
1548
|
-
} catch {
|
|
1549
|
-
return [];
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
function getEmployee(employees, name) {
|
|
1553
|
-
return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
1619
|
// src/types/memory.ts
|
|
1557
1620
|
var EMBEDDING_DIM = 1024;
|
|
1558
1621
|
|
|
@@ -1768,7 +1831,10 @@ async function writeMemory(record) {
|
|
|
1768
1831
|
source_path: record.source_path ?? null,
|
|
1769
1832
|
source_type: record.source_type ?? null,
|
|
1770
1833
|
tier: record.tier ?? classifyTier(record),
|
|
1771
|
-
supersedes_id: record.supersedes_id ?? null
|
|
1834
|
+
supersedes_id: record.supersedes_id ?? null,
|
|
1835
|
+
draft: record.draft ? 1 : 0,
|
|
1836
|
+
memory_type: record.memory_type ?? "raw",
|
|
1837
|
+
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
|
|
1772
1838
|
};
|
|
1773
1839
|
_pendingRecords.push(dbRow);
|
|
1774
1840
|
orgBus.emit({
|
|
@@ -1823,6 +1889,9 @@ async function flushBatch() {
|
|
|
1823
1889
|
const sourceType = row.source_type ?? null;
|
|
1824
1890
|
const tier = row.tier ?? 3;
|
|
1825
1891
|
const supersedesId = row.supersedes_id ?? null;
|
|
1892
|
+
const draft = row.draft ? 1 : 0;
|
|
1893
|
+
const memoryType = row.memory_type ?? "raw";
|
|
1894
|
+
const trajectory = row.trajectory ?? null;
|
|
1826
1895
|
return {
|
|
1827
1896
|
sql: hasVector ? `INSERT OR IGNORE INTO memories
|
|
1828
1897
|
(id, agent_id, agent_role, session_id, timestamp,
|
|
@@ -1830,15 +1899,15 @@ async function flushBatch() {
|
|
|
1830
1899
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
1831
1900
|
confidence, last_accessed,
|
|
1832
1901
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
1833
|
-
source_path, source_type, tier, supersedes_id)
|
|
1834
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
|
|
1902
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
|
|
1903
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
|
|
1835
1904
|
(id, agent_id, agent_role, session_id, timestamp,
|
|
1836
1905
|
tool_name, project_name,
|
|
1837
1906
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
1838
1907
|
confidence, last_accessed,
|
|
1839
1908
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
1840
|
-
source_path, source_type, tier, supersedes_id)
|
|
1841
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1909
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
|
|
1910
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1842
1911
|
args: hasVector ? [
|
|
1843
1912
|
row.id,
|
|
1844
1913
|
row.agent_id,
|
|
@@ -1864,7 +1933,10 @@ async function flushBatch() {
|
|
|
1864
1933
|
sourcePath,
|
|
1865
1934
|
sourceType,
|
|
1866
1935
|
tier,
|
|
1867
|
-
supersedesId
|
|
1936
|
+
supersedesId,
|
|
1937
|
+
draft,
|
|
1938
|
+
memoryType,
|
|
1939
|
+
trajectory
|
|
1868
1940
|
] : [
|
|
1869
1941
|
row.id,
|
|
1870
1942
|
row.agent_id,
|
|
@@ -1889,7 +1961,10 @@ async function flushBatch() {
|
|
|
1889
1961
|
sourcePath,
|
|
1890
1962
|
sourceType,
|
|
1891
1963
|
tier,
|
|
1892
|
-
supersedesId
|
|
1964
|
+
supersedesId,
|
|
1965
|
+
draft,
|
|
1966
|
+
memoryType,
|
|
1967
|
+
trajectory
|
|
1893
1968
|
]
|
|
1894
1969
|
};
|
|
1895
1970
|
};
|
|
@@ -2025,9 +2100,10 @@ function generateReviewReport(employeeName, analysis, memories) {
|
|
|
2025
2100
|
return lines.join("\n");
|
|
2026
2101
|
}
|
|
2027
2102
|
function createReviewMemory(employeeName, report) {
|
|
2103
|
+
const coordinatorName = getCoordinatorName();
|
|
2028
2104
|
return {
|
|
2029
2105
|
id: randomUUID2(),
|
|
2030
|
-
agent_id:
|
|
2106
|
+
agent_id: coordinatorName,
|
|
2031
2107
|
agent_role: "COO",
|
|
2032
2108
|
session_id: `review-${employeeName}-${Date.now()}`,
|
|
2033
2109
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2100,7 +2176,7 @@ async function main() {
|
|
|
2100
2176
|
await flushBatch();
|
|
2101
2177
|
console.log(report);
|
|
2102
2178
|
console.log("");
|
|
2103
|
-
console.log("Review saved to
|
|
2179
|
+
console.log("Review saved to the coordinator's organizational memory.");
|
|
2104
2180
|
}
|
|
2105
2181
|
if (isMainModule(import.meta.url)) {
|
|
2106
2182
|
main().catch((err) => {
|