@askexenow/exe-os 0.8.53 → 0.8.55
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 +113 -10
- package/dist/bin/backfill-responses.js +113 -10
- package/dist/bin/backfill-vectors.js +147 -13
- package/dist/bin/cleanup-stale-review-tasks.js +113 -10
- package/dist/bin/cli.js +337 -211
- package/dist/bin/exe-agent.js +99 -4
- package/dist/bin/exe-assign.js +113 -10
- package/dist/bin/exe-boot.js +276 -85
- package/dist/bin/exe-call.js +107 -5
- package/dist/bin/exe-doctor.js +183 -13
- package/dist/bin/exe-export-behaviors.js +113 -10
- package/dist/bin/exe-forget.js +113 -10
- package/dist/bin/exe-gateway.js +131 -12
- package/dist/bin/exe-heartbeat.js +121 -11
- package/dist/bin/exe-kill.js +113 -10
- package/dist/bin/exe-launch-agent.js +113 -10
- package/dist/bin/exe-link.js +10 -2
- package/dist/bin/exe-new-employee.js +95 -0
- package/dist/bin/exe-pending-messages.js +113 -10
- package/dist/bin/exe-pending-notifications.js +113 -10
- package/dist/bin/exe-pending-reviews.js +122 -11
- package/dist/bin/exe-rename.js +95 -0
- package/dist/bin/exe-review.js +113 -10
- package/dist/bin/exe-search.js +113 -10
- package/dist/bin/exe-session-cleanup.js +131 -12
- package/dist/bin/exe-status.js +113 -10
- package/dist/bin/exe-team.js +113 -10
- package/dist/bin/git-sweep.js +131 -12
- package/dist/bin/graph-backfill.js +113 -10
- package/dist/bin/graph-export.js +113 -10
- package/dist/bin/scan-tasks.js +131 -12
- package/dist/bin/setup.js +107 -5
- package/dist/bin/shard-migrate.js +113 -10
- package/dist/bin/wiki-sync.js +113 -10
- package/dist/gateway/index.js +131 -12
- package/dist/hooks/bug-report-worker.js +131 -12
- package/dist/hooks/commit-complete.js +131 -12
- package/dist/hooks/error-recall.js +113 -10
- package/dist/hooks/ingest-worker.js +131 -12
- package/dist/hooks/instructions-loaded.js +113 -10
- package/dist/hooks/notification.js +113 -10
- package/dist/hooks/post-compact.js +113 -10
- package/dist/hooks/pre-compact.js +131 -12
- package/dist/hooks/pre-tool-use.js +113 -10
- package/dist/hooks/prompt-ingest-worker.js +113 -10
- package/dist/hooks/prompt-submit.js +140 -14
- package/dist/hooks/response-ingest-worker.js +113 -10
- package/dist/hooks/session-end.js +113 -10
- package/dist/hooks/session-start.js +113 -10
- package/dist/hooks/stop.js +113 -10
- package/dist/hooks/subagent-stop.js +113 -10
- package/dist/hooks/summary-worker.js +231 -114
- package/dist/index.js +131 -12
- package/dist/lib/cloud-sync.js +10 -2
- package/dist/lib/employee-templates.js +99 -4
- package/dist/lib/exe-daemon.js +4859 -4706
- package/dist/lib/hybrid-search.js +113 -10
- package/dist/lib/schedules.js +113 -10
- package/dist/lib/store.js +113 -10
- package/dist/lib/tasks.js +18 -2
- package/dist/lib/tmux-routing.js +18 -2
- package/dist/mcp/server.js +214 -28
- package/dist/mcp/tools/create-task.js +18 -2
- package/dist/mcp/tools/list-tasks.js +18 -2
- package/dist/runtime/index.js +131 -12
- package/dist/tui/App.js +337 -211
- package/package.json +2 -2
package/dist/bin/exe-kill.js
CHANGED
|
@@ -1354,6 +1354,103 @@ var init_shard_manager = __esm({
|
|
|
1354
1354
|
}
|
|
1355
1355
|
});
|
|
1356
1356
|
|
|
1357
|
+
// src/lib/platform-procedures.ts
|
|
1358
|
+
var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
|
|
1359
|
+
var init_platform_procedures = __esm({
|
|
1360
|
+
"src/lib/platform-procedures.ts"() {
|
|
1361
|
+
"use strict";
|
|
1362
|
+
PLATFORM_PROCEDURES = [
|
|
1363
|
+
// --- Foundation: what is exe-os ---
|
|
1364
|
+
{
|
|
1365
|
+
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1366
|
+
domain: "architecture",
|
|
1367
|
+
priority: "p0",
|
|
1368
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). 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."
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1372
|
+
domain: "architecture",
|
|
1373
|
+
priority: "p0",
|
|
1374
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
title: "Sessions explained \u2014 what exeN means and how projects work",
|
|
1378
|
+
domain: "architecture",
|
|
1379
|
+
priority: "p0",
|
|
1380
|
+
content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. 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."
|
|
1381
|
+
},
|
|
1382
|
+
// --- Hierarchy and dispatch ---
|
|
1383
|
+
{
|
|
1384
|
+
title: "Chain of command \u2014 who talks to whom",
|
|
1385
|
+
domain: "workflow",
|
|
1386
|
+
priority: "p0",
|
|
1387
|
+
content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
title: "Single dispatch path \u2014 create_task only",
|
|
1391
|
+
domain: "workflow",
|
|
1392
|
+
priority: "p0",
|
|
1393
|
+
content: "create_task is the ONLY way to dispatch work to another agent. No direct ensureEmployee calls, no manual tmux spawns, no send_message for actionable work. create_task \u2192 system auto-spawns \u2192 session correctly named. ONE PATH. No backdoors. No exceptions."
|
|
1394
|
+
},
|
|
1395
|
+
// --- Session isolation ---
|
|
1396
|
+
{
|
|
1397
|
+
title: "Session scoping \u2014 stay in your exe boundary",
|
|
1398
|
+
domain: "security",
|
|
1399
|
+
priority: "p0",
|
|
1400
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
title: "Session isolation \u2014 never touch another session's work",
|
|
1404
|
+
domain: "workflow",
|
|
1405
|
+
priority: "p0",
|
|
1406
|
+
content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
|
|
1407
|
+
},
|
|
1408
|
+
// --- Engineering: session scoping in code ---
|
|
1409
|
+
{
|
|
1410
|
+
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1411
|
+
domain: "architecture",
|
|
1412
|
+
priority: "p0",
|
|
1413
|
+
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 exeN. (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+ exe sessions simultaneously."
|
|
1414
|
+
},
|
|
1415
|
+
// --- Hard constraints ---
|
|
1416
|
+
{
|
|
1417
|
+
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1418
|
+
domain: "security",
|
|
1419
|
+
priority: "p0",
|
|
1420
|
+
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 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
1421
|
+
},
|
|
1422
|
+
// --- Operations ---
|
|
1423
|
+
{
|
|
1424
|
+
title: "Managers must supervise deployed workers",
|
|
1425
|
+
domain: "workflow",
|
|
1426
|
+
priority: "p0",
|
|
1427
|
+
content: `Every manager (COO/CTO/CMO) who dispatches work to a worker MUST actively monitor them. Check tmux capture-pane every 10 minutes. Verify they're working, not stuck. If idle at prompt with in_progress task \u2192 send intercom. If stuck \u2192 unblock or escalate. "Standing by" without checking is negligence.`
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
|
|
1431
|
+
domain: "workflow",
|
|
1432
|
+
priority: "p0",
|
|
1433
|
+
content: "On every /exe boot, COO MUST check system health BEFORE other work: (1) daemon \u2014 is exed PID alive, (2) cloud sync \u2014 grep workers.log for recent cloud-sync errors, (3) memory count \u2014 total in DB, (4) sync delta \u2014 local vs cloud storage_bytes. Report as 4-line status table. If ANY check fails, surface to founder immediately. Do not proceed to tasks until health confirmed."
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
title: "exe-build-adv mandatory for 3+ files",
|
|
1437
|
+
domain: "workflow",
|
|
1438
|
+
priority: "p0",
|
|
1439
|
+
content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
title: "Desktop and TUI are the same product",
|
|
1443
|
+
domain: "architecture",
|
|
1444
|
+
priority: "p0",
|
|
1445
|
+
content: "Desktop and TUI are the SAME product in different renderers. Same data contracts, same interactions, same acceptance criteria. Desktop tab specs in ARCHITECTURE.md ARE the TUI specs. When building TUI, cross-reference Desktop spec. Different tab names, identical behavior. Never treat them as separate products."
|
|
1446
|
+
}
|
|
1447
|
+
];
|
|
1448
|
+
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
1449
|
+
PLATFORM_PROCEDURES.map((p) => p.title)
|
|
1450
|
+
);
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
|
|
1357
1454
|
// src/lib/global-procedures.ts
|
|
1358
1455
|
var global_procedures_exports = {};
|
|
1359
1456
|
__export(global_procedures_exports, {
|
|
@@ -1369,22 +1466,25 @@ async function loadGlobalProcedures() {
|
|
|
1369
1466
|
sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
1370
1467
|
args: []
|
|
1371
1468
|
});
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1374
|
-
|
|
1469
|
+
const allRows = result.rows;
|
|
1470
|
+
const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
|
|
1471
|
+
if (customerOnly.length > 0) {
|
|
1472
|
+
_customerCache = customerOnly.map((p) => `### ${p.title}
|
|
1375
1473
|
${p.content}`).join("\n\n");
|
|
1376
1474
|
} else {
|
|
1377
|
-
|
|
1475
|
+
_customerCache = "";
|
|
1378
1476
|
}
|
|
1379
1477
|
_cacheLoaded = true;
|
|
1380
|
-
return
|
|
1478
|
+
return customerOnly;
|
|
1381
1479
|
}
|
|
1382
1480
|
function getGlobalProceduresBlock() {
|
|
1383
|
-
|
|
1384
|
-
if (
|
|
1481
|
+
const sections = [];
|
|
1482
|
+
if (_platformCache) sections.push(_platformCache);
|
|
1483
|
+
if (_cacheLoaded && _customerCache) sections.push(_customerCache);
|
|
1484
|
+
if (sections.length === 0) return "";
|
|
1385
1485
|
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
1386
1486
|
|
|
1387
|
-
${
|
|
1487
|
+
${sections.join("\n\n")}
|
|
1388
1488
|
`;
|
|
1389
1489
|
}
|
|
1390
1490
|
async function storeGlobalProcedure(input) {
|
|
@@ -1409,13 +1509,16 @@ async function deactivateGlobalProcedure(id) {
|
|
|
1409
1509
|
await loadGlobalProcedures();
|
|
1410
1510
|
return result.rowsAffected > 0;
|
|
1411
1511
|
}
|
|
1412
|
-
var
|
|
1512
|
+
var _customerCache, _cacheLoaded, _platformCache;
|
|
1413
1513
|
var init_global_procedures = __esm({
|
|
1414
1514
|
"src/lib/global-procedures.ts"() {
|
|
1415
1515
|
"use strict";
|
|
1416
1516
|
init_database();
|
|
1417
|
-
|
|
1517
|
+
init_platform_procedures();
|
|
1518
|
+
_customerCache = "";
|
|
1418
1519
|
_cacheLoaded = false;
|
|
1520
|
+
_platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
|
|
1521
|
+
${p.content}`).join("\n\n");
|
|
1419
1522
|
}
|
|
1420
1523
|
});
|
|
1421
1524
|
|
|
@@ -1360,6 +1360,103 @@ var init_shard_manager = __esm({
|
|
|
1360
1360
|
}
|
|
1361
1361
|
});
|
|
1362
1362
|
|
|
1363
|
+
// src/lib/platform-procedures.ts
|
|
1364
|
+
var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
|
|
1365
|
+
var init_platform_procedures = __esm({
|
|
1366
|
+
"src/lib/platform-procedures.ts"() {
|
|
1367
|
+
"use strict";
|
|
1368
|
+
PLATFORM_PROCEDURES = [
|
|
1369
|
+
// --- Foundation: what is exe-os ---
|
|
1370
|
+
{
|
|
1371
|
+
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1372
|
+
domain: "architecture",
|
|
1373
|
+
priority: "p0",
|
|
1374
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). 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."
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1378
|
+
domain: "architecture",
|
|
1379
|
+
priority: "p0",
|
|
1380
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
title: "Sessions explained \u2014 what exeN means and how projects work",
|
|
1384
|
+
domain: "architecture",
|
|
1385
|
+
priority: "p0",
|
|
1386
|
+
content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. 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."
|
|
1387
|
+
},
|
|
1388
|
+
// --- Hierarchy and dispatch ---
|
|
1389
|
+
{
|
|
1390
|
+
title: "Chain of command \u2014 who talks to whom",
|
|
1391
|
+
domain: "workflow",
|
|
1392
|
+
priority: "p0",
|
|
1393
|
+
content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
title: "Single dispatch path \u2014 create_task only",
|
|
1397
|
+
domain: "workflow",
|
|
1398
|
+
priority: "p0",
|
|
1399
|
+
content: "create_task is the ONLY way to dispatch work to another agent. No direct ensureEmployee calls, no manual tmux spawns, no send_message for actionable work. create_task \u2192 system auto-spawns \u2192 session correctly named. ONE PATH. No backdoors. No exceptions."
|
|
1400
|
+
},
|
|
1401
|
+
// --- Session isolation ---
|
|
1402
|
+
{
|
|
1403
|
+
title: "Session scoping \u2014 stay in your exe boundary",
|
|
1404
|
+
domain: "security",
|
|
1405
|
+
priority: "p0",
|
|
1406
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
title: "Session isolation \u2014 never touch another session's work",
|
|
1410
|
+
domain: "workflow",
|
|
1411
|
+
priority: "p0",
|
|
1412
|
+
content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
|
|
1413
|
+
},
|
|
1414
|
+
// --- Engineering: session scoping in code ---
|
|
1415
|
+
{
|
|
1416
|
+
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1417
|
+
domain: "architecture",
|
|
1418
|
+
priority: "p0",
|
|
1419
|
+
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 exeN. (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+ exe sessions simultaneously."
|
|
1420
|
+
},
|
|
1421
|
+
// --- Hard constraints ---
|
|
1422
|
+
{
|
|
1423
|
+
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1424
|
+
domain: "security",
|
|
1425
|
+
priority: "p0",
|
|
1426
|
+
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 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
1427
|
+
},
|
|
1428
|
+
// --- Operations ---
|
|
1429
|
+
{
|
|
1430
|
+
title: "Managers must supervise deployed workers",
|
|
1431
|
+
domain: "workflow",
|
|
1432
|
+
priority: "p0",
|
|
1433
|
+
content: `Every manager (COO/CTO/CMO) who dispatches work to a worker MUST actively monitor them. Check tmux capture-pane every 10 minutes. Verify they're working, not stuck. If idle at prompt with in_progress task \u2192 send intercom. If stuck \u2192 unblock or escalate. "Standing by" without checking is negligence.`
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
|
|
1437
|
+
domain: "workflow",
|
|
1438
|
+
priority: "p0",
|
|
1439
|
+
content: "On every /exe boot, COO MUST check system health BEFORE other work: (1) daemon \u2014 is exed PID alive, (2) cloud sync \u2014 grep workers.log for recent cloud-sync errors, (3) memory count \u2014 total in DB, (4) sync delta \u2014 local vs cloud storage_bytes. Report as 4-line status table. If ANY check fails, surface to founder immediately. Do not proceed to tasks until health confirmed."
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
title: "exe-build-adv mandatory for 3+ files",
|
|
1443
|
+
domain: "workflow",
|
|
1444
|
+
priority: "p0",
|
|
1445
|
+
content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
title: "Desktop and TUI are the same product",
|
|
1449
|
+
domain: "architecture",
|
|
1450
|
+
priority: "p0",
|
|
1451
|
+
content: "Desktop and TUI are the SAME product in different renderers. Same data contracts, same interactions, same acceptance criteria. Desktop tab specs in ARCHITECTURE.md ARE the TUI specs. When building TUI, cross-reference Desktop spec. Different tab names, identical behavior. Never treat them as separate products."
|
|
1452
|
+
}
|
|
1453
|
+
];
|
|
1454
|
+
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
1455
|
+
PLATFORM_PROCEDURES.map((p) => p.title)
|
|
1456
|
+
);
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1363
1460
|
// src/lib/global-procedures.ts
|
|
1364
1461
|
var global_procedures_exports = {};
|
|
1365
1462
|
__export(global_procedures_exports, {
|
|
@@ -1375,22 +1472,25 @@ async function loadGlobalProcedures() {
|
|
|
1375
1472
|
sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
1376
1473
|
args: []
|
|
1377
1474
|
});
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1380
|
-
|
|
1475
|
+
const allRows = result.rows;
|
|
1476
|
+
const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
|
|
1477
|
+
if (customerOnly.length > 0) {
|
|
1478
|
+
_customerCache = customerOnly.map((p) => `### ${p.title}
|
|
1381
1479
|
${p.content}`).join("\n\n");
|
|
1382
1480
|
} else {
|
|
1383
|
-
|
|
1481
|
+
_customerCache = "";
|
|
1384
1482
|
}
|
|
1385
1483
|
_cacheLoaded = true;
|
|
1386
|
-
return
|
|
1484
|
+
return customerOnly;
|
|
1387
1485
|
}
|
|
1388
1486
|
function getGlobalProceduresBlock() {
|
|
1389
|
-
|
|
1390
|
-
if (
|
|
1487
|
+
const sections = [];
|
|
1488
|
+
if (_platformCache) sections.push(_platformCache);
|
|
1489
|
+
if (_cacheLoaded && _customerCache) sections.push(_customerCache);
|
|
1490
|
+
if (sections.length === 0) return "";
|
|
1391
1491
|
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
1392
1492
|
|
|
1393
|
-
${
|
|
1493
|
+
${sections.join("\n\n")}
|
|
1394
1494
|
`;
|
|
1395
1495
|
}
|
|
1396
1496
|
async function storeGlobalProcedure(input) {
|
|
@@ -1415,13 +1515,16 @@ async function deactivateGlobalProcedure(id) {
|
|
|
1415
1515
|
await loadGlobalProcedures();
|
|
1416
1516
|
return result.rowsAffected > 0;
|
|
1417
1517
|
}
|
|
1418
|
-
var
|
|
1518
|
+
var _customerCache, _cacheLoaded, _platformCache;
|
|
1419
1519
|
var init_global_procedures = __esm({
|
|
1420
1520
|
"src/lib/global-procedures.ts"() {
|
|
1421
1521
|
"use strict";
|
|
1422
1522
|
init_database();
|
|
1423
|
-
|
|
1523
|
+
init_platform_procedures();
|
|
1524
|
+
_customerCache = "";
|
|
1424
1525
|
_cacheLoaded = false;
|
|
1526
|
+
_platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
|
|
1527
|
+
${p.content}`).join("\n\n");
|
|
1425
1528
|
}
|
|
1426
1529
|
});
|
|
1427
1530
|
|
package/dist/bin/exe-link.js
CHANGED
|
@@ -1094,9 +1094,17 @@ async function cloudPullGlobalProcedures(config) {
|
|
|
1094
1094
|
if (!remoteProcs || remoteProcs.length === 0) return { pulled: 0 };
|
|
1095
1095
|
const client = getClient();
|
|
1096
1096
|
const stmts = remoteProcs.map((p) => ({
|
|
1097
|
-
sql: `INSERT
|
|
1097
|
+
sql: `INSERT INTO global_procedures
|
|
1098
1098
|
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
1099
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
1099
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
1100
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
1101
|
+
title = excluded.title,
|
|
1102
|
+
content = excluded.content,
|
|
1103
|
+
priority = excluded.priority,
|
|
1104
|
+
domain = excluded.domain,
|
|
1105
|
+
active = excluded.active,
|
|
1106
|
+
updated_at = excluded.updated_at
|
|
1107
|
+
WHERE excluded.updated_at > global_procedures.updated_at`,
|
|
1100
1108
|
args: [
|
|
1101
1109
|
p.id ?? null,
|
|
1102
1110
|
p.title ?? null,
|
|
@@ -894,6 +894,101 @@ function registerBinSymlinks(name) {
|
|
|
894
894
|
init_database();
|
|
895
895
|
import { randomUUID } from "crypto";
|
|
896
896
|
|
|
897
|
+
// src/lib/platform-procedures.ts
|
|
898
|
+
var PLATFORM_PROCEDURES = [
|
|
899
|
+
// --- Foundation: what is exe-os ---
|
|
900
|
+
{
|
|
901
|
+
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
902
|
+
domain: "architecture",
|
|
903
|
+
priority: "p0",
|
|
904
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). 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."
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
908
|
+
domain: "architecture",
|
|
909
|
+
priority: "p0",
|
|
910
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
title: "Sessions explained \u2014 what exeN means and how projects work",
|
|
914
|
+
domain: "architecture",
|
|
915
|
+
priority: "p0",
|
|
916
|
+
content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. 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."
|
|
917
|
+
},
|
|
918
|
+
// --- Hierarchy and dispatch ---
|
|
919
|
+
{
|
|
920
|
+
title: "Chain of command \u2014 who talks to whom",
|
|
921
|
+
domain: "workflow",
|
|
922
|
+
priority: "p0",
|
|
923
|
+
content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
title: "Single dispatch path \u2014 create_task only",
|
|
927
|
+
domain: "workflow",
|
|
928
|
+
priority: "p0",
|
|
929
|
+
content: "create_task is the ONLY way to dispatch work to another agent. No direct ensureEmployee calls, no manual tmux spawns, no send_message for actionable work. create_task \u2192 system auto-spawns \u2192 session correctly named. ONE PATH. No backdoors. No exceptions."
|
|
930
|
+
},
|
|
931
|
+
// --- Session isolation ---
|
|
932
|
+
{
|
|
933
|
+
title: "Session scoping \u2014 stay in your exe boundary",
|
|
934
|
+
domain: "security",
|
|
935
|
+
priority: "p0",
|
|
936
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
title: "Session isolation \u2014 never touch another session's work",
|
|
940
|
+
domain: "workflow",
|
|
941
|
+
priority: "p0",
|
|
942
|
+
content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
|
|
943
|
+
},
|
|
944
|
+
// --- Engineering: session scoping in code ---
|
|
945
|
+
{
|
|
946
|
+
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
947
|
+
domain: "architecture",
|
|
948
|
+
priority: "p0",
|
|
949
|
+
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 exeN. (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+ exe sessions simultaneously."
|
|
950
|
+
},
|
|
951
|
+
// --- Hard constraints ---
|
|
952
|
+
{
|
|
953
|
+
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
954
|
+
domain: "security",
|
|
955
|
+
priority: "p0",
|
|
956
|
+
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 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
957
|
+
},
|
|
958
|
+
// --- Operations ---
|
|
959
|
+
{
|
|
960
|
+
title: "Managers must supervise deployed workers",
|
|
961
|
+
domain: "workflow",
|
|
962
|
+
priority: "p0",
|
|
963
|
+
content: `Every manager (COO/CTO/CMO) who dispatches work to a worker MUST actively monitor them. Check tmux capture-pane every 10 minutes. Verify they're working, not stuck. If idle at prompt with in_progress task \u2192 send intercom. If stuck \u2192 unblock or escalate. "Standing by" without checking is negligence.`
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
|
|
967
|
+
domain: "workflow",
|
|
968
|
+
priority: "p0",
|
|
969
|
+
content: "On every /exe boot, COO MUST check system health BEFORE other work: (1) daemon \u2014 is exed PID alive, (2) cloud sync \u2014 grep workers.log for recent cloud-sync errors, (3) memory count \u2014 total in DB, (4) sync delta \u2014 local vs cloud storage_bytes. Report as 4-line status table. If ANY check fails, surface to founder immediately. Do not proceed to tasks until health confirmed."
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
title: "exe-build-adv mandatory for 3+ files",
|
|
973
|
+
domain: "workflow",
|
|
974
|
+
priority: "p0",
|
|
975
|
+
content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
title: "Desktop and TUI are the same product",
|
|
979
|
+
domain: "architecture",
|
|
980
|
+
priority: "p0",
|
|
981
|
+
content: "Desktop and TUI are the SAME product in different renderers. Same data contracts, same interactions, same acceptance criteria. Desktop tab specs in ARCHITECTURE.md ARE the TUI specs. When building TUI, cross-reference Desktop spec. Different tab names, identical behavior. Never treat them as separate products."
|
|
982
|
+
}
|
|
983
|
+
];
|
|
984
|
+
var PLATFORM_PROCEDURE_TITLES = new Set(
|
|
985
|
+
PLATFORM_PROCEDURES.map((p) => p.title)
|
|
986
|
+
);
|
|
987
|
+
|
|
988
|
+
// src/lib/global-procedures.ts
|
|
989
|
+
var _platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
|
|
990
|
+
${p.content}`).join("\n\n");
|
|
991
|
+
|
|
897
992
|
// src/lib/employee-templates.ts
|
|
898
993
|
var TEMPLATE_VERSION = 1;
|
|
899
994
|
var TEMPLATES = {
|
|
@@ -1400,6 +1400,103 @@ var init_shard_manager = __esm({
|
|
|
1400
1400
|
}
|
|
1401
1401
|
});
|
|
1402
1402
|
|
|
1403
|
+
// src/lib/platform-procedures.ts
|
|
1404
|
+
var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
|
|
1405
|
+
var init_platform_procedures = __esm({
|
|
1406
|
+
"src/lib/platform-procedures.ts"() {
|
|
1407
|
+
"use strict";
|
|
1408
|
+
PLATFORM_PROCEDURES = [
|
|
1409
|
+
// --- Foundation: what is exe-os ---
|
|
1410
|
+
{
|
|
1411
|
+
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1412
|
+
domain: "architecture",
|
|
1413
|
+
priority: "p0",
|
|
1414
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). 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."
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1418
|
+
domain: "architecture",
|
|
1419
|
+
priority: "p0",
|
|
1420
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
title: "Sessions explained \u2014 what exeN means and how projects work",
|
|
1424
|
+
domain: "architecture",
|
|
1425
|
+
priority: "p0",
|
|
1426
|
+
content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. 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."
|
|
1427
|
+
},
|
|
1428
|
+
// --- Hierarchy and dispatch ---
|
|
1429
|
+
{
|
|
1430
|
+
title: "Chain of command \u2014 who talks to whom",
|
|
1431
|
+
domain: "workflow",
|
|
1432
|
+
priority: "p0",
|
|
1433
|
+
content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
title: "Single dispatch path \u2014 create_task only",
|
|
1437
|
+
domain: "workflow",
|
|
1438
|
+
priority: "p0",
|
|
1439
|
+
content: "create_task is the ONLY way to dispatch work to another agent. No direct ensureEmployee calls, no manual tmux spawns, no send_message for actionable work. create_task \u2192 system auto-spawns \u2192 session correctly named. ONE PATH. No backdoors. No exceptions."
|
|
1440
|
+
},
|
|
1441
|
+
// --- Session isolation ---
|
|
1442
|
+
{
|
|
1443
|
+
title: "Session scoping \u2014 stay in your exe boundary",
|
|
1444
|
+
domain: "security",
|
|
1445
|
+
priority: "p0",
|
|
1446
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
title: "Session isolation \u2014 never touch another session's work",
|
|
1450
|
+
domain: "workflow",
|
|
1451
|
+
priority: "p0",
|
|
1452
|
+
content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
|
|
1453
|
+
},
|
|
1454
|
+
// --- Engineering: session scoping in code ---
|
|
1455
|
+
{
|
|
1456
|
+
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1457
|
+
domain: "architecture",
|
|
1458
|
+
priority: "p0",
|
|
1459
|
+
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 exeN. (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+ exe sessions simultaneously."
|
|
1460
|
+
},
|
|
1461
|
+
// --- Hard constraints ---
|
|
1462
|
+
{
|
|
1463
|
+
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1464
|
+
domain: "security",
|
|
1465
|
+
priority: "p0",
|
|
1466
|
+
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 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
1467
|
+
},
|
|
1468
|
+
// --- Operations ---
|
|
1469
|
+
{
|
|
1470
|
+
title: "Managers must supervise deployed workers",
|
|
1471
|
+
domain: "workflow",
|
|
1472
|
+
priority: "p0",
|
|
1473
|
+
content: `Every manager (COO/CTO/CMO) who dispatches work to a worker MUST actively monitor them. Check tmux capture-pane every 10 minutes. Verify they're working, not stuck. If idle at prompt with in_progress task \u2192 send intercom. If stuck \u2192 unblock or escalate. "Standing by" without checking is negligence.`
|
|
1474
|
+
},
|
|
1475
|
+
{
|
|
1476
|
+
title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
|
|
1477
|
+
domain: "workflow",
|
|
1478
|
+
priority: "p0",
|
|
1479
|
+
content: "On every /exe boot, COO MUST check system health BEFORE other work: (1) daemon \u2014 is exed PID alive, (2) cloud sync \u2014 grep workers.log for recent cloud-sync errors, (3) memory count \u2014 total in DB, (4) sync delta \u2014 local vs cloud storage_bytes. Report as 4-line status table. If ANY check fails, surface to founder immediately. Do not proceed to tasks until health confirmed."
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
title: "exe-build-adv mandatory for 3+ files",
|
|
1483
|
+
domain: "workflow",
|
|
1484
|
+
priority: "p0",
|
|
1485
|
+
content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
|
|
1486
|
+
},
|
|
1487
|
+
{
|
|
1488
|
+
title: "Desktop and TUI are the same product",
|
|
1489
|
+
domain: "architecture",
|
|
1490
|
+
priority: "p0",
|
|
1491
|
+
content: "Desktop and TUI are the SAME product in different renderers. Same data contracts, same interactions, same acceptance criteria. Desktop tab specs in ARCHITECTURE.md ARE the TUI specs. When building TUI, cross-reference Desktop spec. Different tab names, identical behavior. Never treat them as separate products."
|
|
1492
|
+
}
|
|
1493
|
+
];
|
|
1494
|
+
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
1495
|
+
PLATFORM_PROCEDURES.map((p) => p.title)
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
|
|
1403
1500
|
// src/lib/global-procedures.ts
|
|
1404
1501
|
var global_procedures_exports = {};
|
|
1405
1502
|
__export(global_procedures_exports, {
|
|
@@ -1415,22 +1512,25 @@ async function loadGlobalProcedures() {
|
|
|
1415
1512
|
sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
1416
1513
|
args: []
|
|
1417
1514
|
});
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
|
|
1515
|
+
const allRows = result.rows;
|
|
1516
|
+
const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
|
|
1517
|
+
if (customerOnly.length > 0) {
|
|
1518
|
+
_customerCache = customerOnly.map((p) => `### ${p.title}
|
|
1421
1519
|
${p.content}`).join("\n\n");
|
|
1422
1520
|
} else {
|
|
1423
|
-
|
|
1521
|
+
_customerCache = "";
|
|
1424
1522
|
}
|
|
1425
1523
|
_cacheLoaded = true;
|
|
1426
|
-
return
|
|
1524
|
+
return customerOnly;
|
|
1427
1525
|
}
|
|
1428
1526
|
function getGlobalProceduresBlock() {
|
|
1429
|
-
|
|
1430
|
-
if (
|
|
1527
|
+
const sections = [];
|
|
1528
|
+
if (_platformCache) sections.push(_platformCache);
|
|
1529
|
+
if (_cacheLoaded && _customerCache) sections.push(_customerCache);
|
|
1530
|
+
if (sections.length === 0) return "";
|
|
1431
1531
|
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
1432
1532
|
|
|
1433
|
-
${
|
|
1533
|
+
${sections.join("\n\n")}
|
|
1434
1534
|
`;
|
|
1435
1535
|
}
|
|
1436
1536
|
async function storeGlobalProcedure(input) {
|
|
@@ -1455,13 +1555,16 @@ async function deactivateGlobalProcedure(id) {
|
|
|
1455
1555
|
await loadGlobalProcedures();
|
|
1456
1556
|
return result.rowsAffected > 0;
|
|
1457
1557
|
}
|
|
1458
|
-
var
|
|
1558
|
+
var _customerCache, _cacheLoaded, _platformCache;
|
|
1459
1559
|
var init_global_procedures = __esm({
|
|
1460
1560
|
"src/lib/global-procedures.ts"() {
|
|
1461
1561
|
"use strict";
|
|
1462
1562
|
init_database();
|
|
1463
|
-
|
|
1563
|
+
init_platform_procedures();
|
|
1564
|
+
_customerCache = "";
|
|
1464
1565
|
_cacheLoaded = false;
|
|
1566
|
+
_platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
|
|
1567
|
+
${p.content}`).join("\n\n");
|
|
1465
1568
|
}
|
|
1466
1569
|
});
|
|
1467
1570
|
|