@askexenow/exe-os 0.9.60 → 0.9.61

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.
Files changed (73) hide show
  1. package/dist/bin/backfill-conversations.js +72 -5
  2. package/dist/bin/backfill-responses.js +72 -5
  3. package/dist/bin/backfill-vectors.js +72 -5
  4. package/dist/bin/cc-doctor.js +376 -0
  5. package/dist/bin/cleanup-stale-review-tasks.js +72 -5
  6. package/dist/bin/cli.js +157 -55
  7. package/dist/bin/customer-readiness.js +33 -0
  8. package/dist/bin/exe-agent.js +1 -1
  9. package/dist/bin/exe-assign.js +72 -5
  10. package/dist/bin/exe-boot.js +78 -11
  11. package/dist/bin/exe-call.js +1 -1
  12. package/dist/bin/exe-dispatch.js +72 -5
  13. package/dist/bin/exe-doctor.js +72 -5
  14. package/dist/bin/exe-export-behaviors.js +72 -5
  15. package/dist/bin/exe-forget.js +72 -5
  16. package/dist/bin/exe-gateway.js +72 -5
  17. package/dist/bin/exe-heartbeat.js +72 -5
  18. package/dist/bin/exe-kill.js +72 -5
  19. package/dist/bin/exe-launch-agent.js +72 -5
  20. package/dist/bin/exe-link.js +74 -7
  21. package/dist/bin/exe-new-employee.js +48 -19
  22. package/dist/bin/exe-pending-messages.js +72 -5
  23. package/dist/bin/exe-pending-notifications.js +72 -5
  24. package/dist/bin/exe-pending-reviews.js +72 -5
  25. package/dist/bin/exe-rename.js +72 -5
  26. package/dist/bin/exe-review.js +72 -5
  27. package/dist/bin/exe-search.js +72 -5
  28. package/dist/bin/exe-session-cleanup.js +72 -5
  29. package/dist/bin/exe-start-codex.js +115 -18
  30. package/dist/bin/exe-start-opencode.js +93 -7
  31. package/dist/bin/exe-status.js +72 -5
  32. package/dist/bin/exe-team.js +72 -5
  33. package/dist/bin/git-sweep.js +72 -5
  34. package/dist/bin/graph-backfill.js +72 -5
  35. package/dist/bin/graph-export.js +72 -5
  36. package/dist/bin/install.js +56 -31
  37. package/dist/bin/intercom-check.js +72 -5
  38. package/dist/bin/pre-build-guard.js +98 -0
  39. package/dist/bin/scan-tasks.js +72 -5
  40. package/dist/bin/setup.js +75 -8
  41. package/dist/bin/shard-migrate.js +72 -5
  42. package/dist/gateway/index.js +78 -11
  43. package/dist/hooks/bug-report-worker.js +72 -5
  44. package/dist/hooks/codex-stop-task-finalizer.js +72 -5
  45. package/dist/hooks/commit-complete.js +72 -5
  46. package/dist/hooks/error-recall.js +72 -5
  47. package/dist/hooks/ingest.js +72 -5
  48. package/dist/hooks/instructions-loaded.js +72 -5
  49. package/dist/hooks/notification.js +72 -5
  50. package/dist/hooks/post-compact.js +72 -5
  51. package/dist/hooks/post-tool-combined.js +72 -5
  52. package/dist/hooks/pre-compact.js +72 -5
  53. package/dist/hooks/pre-tool-use.js +72 -5
  54. package/dist/hooks/prompt-submit.js +72 -5
  55. package/dist/hooks/session-end.js +72 -5
  56. package/dist/hooks/session-start.js +72 -5
  57. package/dist/hooks/stop.js +72 -5
  58. package/dist/hooks/subagent-stop.js +72 -5
  59. package/dist/hooks/summary-worker.js +78 -11
  60. package/dist/index.js +78 -11
  61. package/dist/lib/cloud-sync.js +74 -7
  62. package/dist/lib/database.js +68 -1
  63. package/dist/lib/db.js +68 -1
  64. package/dist/lib/device-registry.js +68 -1
  65. package/dist/lib/employee-templates.js +1 -1
  66. package/dist/lib/exe-daemon.js +103 -26
  67. package/dist/lib/hybrid-search.js +72 -5
  68. package/dist/lib/schedules.js +72 -5
  69. package/dist/lib/store.js +72 -5
  70. package/dist/mcp/server.js +103 -26
  71. package/dist/runtime/index.js +72 -5
  72. package/dist/tui/App.js +80 -13
  73. package/package.json +1 -1
@@ -2359,7 +2359,7 @@ async function ensureSchema() {
2359
2359
  ON session_kills(agent_id);
2360
2360
  `);
2361
2361
  await client.execute(`
2362
- CREATE TABLE IF NOT EXISTS global_procedures (
2362
+ CREATE TABLE IF NOT EXISTS company_procedures (
2363
2363
  id TEXT PRIMARY KEY,
2364
2364
  title TEXT NOT NULL,
2365
2365
  content TEXT NOT NULL,
@@ -2370,6 +2370,73 @@ async function ensureSchema() {
2370
2370
  updated_at TEXT NOT NULL
2371
2371
  )
2372
2372
  `);
2373
+ const legacyProcedureObject = await client.execute({
2374
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2375
+ args: []
2376
+ });
2377
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2378
+ if (legacyProcedureType === "table") {
2379
+ await client.execute(`
2380
+ INSERT OR IGNORE INTO company_procedures
2381
+ (id, title, content, priority, domain, active, created_at, updated_at)
2382
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2383
+ FROM global_procedures
2384
+ `);
2385
+ await client.executeMultiple(`
2386
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2387
+ AFTER INSERT ON global_procedures
2388
+ BEGIN
2389
+ INSERT OR IGNORE INTO company_procedures
2390
+ (id, title, content, priority, domain, active, created_at, updated_at)
2391
+ VALUES
2392
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2393
+ END;
2394
+
2395
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2396
+ AFTER UPDATE ON global_procedures
2397
+ BEGIN
2398
+ UPDATE company_procedures
2399
+ SET title = NEW.title,
2400
+ content = NEW.content,
2401
+ priority = NEW.priority,
2402
+ domain = NEW.domain,
2403
+ active = NEW.active,
2404
+ created_at = NEW.created_at,
2405
+ updated_at = NEW.updated_at
2406
+ WHERE id = OLD.id;
2407
+ END;
2408
+ `);
2409
+ } else {
2410
+ await client.execute(`
2411
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2412
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2413
+ FROM company_procedures
2414
+ `);
2415
+ await client.executeMultiple(`
2416
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2417
+ INSTEAD OF INSERT ON global_procedures
2418
+ BEGIN
2419
+ INSERT INTO company_procedures
2420
+ (id, title, content, priority, domain, active, created_at, updated_at)
2421
+ VALUES
2422
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2423
+ END;
2424
+
2425
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2426
+ INSTEAD OF UPDATE ON global_procedures
2427
+ BEGIN
2428
+ UPDATE company_procedures
2429
+ SET title = NEW.title,
2430
+ content = NEW.content,
2431
+ priority = NEW.priority,
2432
+ domain = NEW.domain,
2433
+ active = NEW.active,
2434
+ created_at = NEW.created_at,
2435
+ updated_at = NEW.updated_at
2436
+ WHERE id = OLD.id;
2437
+ END;
2438
+ `);
2439
+ }
2373
2440
  await client.executeMultiple(`
2374
2441
  CREATE TABLE IF NOT EXISTS conversations (
2375
2442
  id TEXT PRIMARY KEY,
@@ -2831,7 +2898,7 @@ var init_platform_procedures = __esm({
2831
2898
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
2832
2899
  domain: "tool-use",
2833
2900
  priority: "p1",
2834
- 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 customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
2901
+ 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. company_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: global_procedure, store_global_procedure, list_global_procedures, deactivate_global_procedure."
2835
2902
  }
2836
2903
  ];
2837
2904
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -2852,7 +2919,7 @@ import { randomUUID as randomUUID2 } from "crypto";
2852
2919
  async function loadGlobalProcedures() {
2853
2920
  const client = getClient();
2854
2921
  const result = await client.execute({
2855
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
2922
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
2856
2923
  args: []
2857
2924
  });
2858
2925
  const allRows = result.rows;
@@ -2881,7 +2948,7 @@ async function storeGlobalProcedure(input) {
2881
2948
  const now = (/* @__PURE__ */ new Date()).toISOString();
2882
2949
  const client = getClient();
2883
2950
  await client.execute({
2884
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
2951
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
2885
2952
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
2886
2953
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
2887
2954
  });
@@ -2892,7 +2959,7 @@ async function deactivateGlobalProcedure(id) {
2892
2959
  const now = (/* @__PURE__ */ new Date()).toISOString();
2893
2960
  const client = getClient();
2894
2961
  const result = await client.execute({
2895
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
2962
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
2896
2963
  args: [now, id]
2897
2964
  });
2898
2965
  await loadGlobalProcedures();
@@ -2518,7 +2518,7 @@ async function ensureSchema() {
2518
2518
  ON session_kills(agent_id);
2519
2519
  `);
2520
2520
  await client.execute(`
2521
- CREATE TABLE IF NOT EXISTS global_procedures (
2521
+ CREATE TABLE IF NOT EXISTS company_procedures (
2522
2522
  id TEXT PRIMARY KEY,
2523
2523
  title TEXT NOT NULL,
2524
2524
  content TEXT NOT NULL,
@@ -2529,6 +2529,73 @@ async function ensureSchema() {
2529
2529
  updated_at TEXT NOT NULL
2530
2530
  )
2531
2531
  `);
2532
+ const legacyProcedureObject = await client.execute({
2533
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2534
+ args: []
2535
+ });
2536
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2537
+ if (legacyProcedureType === "table") {
2538
+ await client.execute(`
2539
+ INSERT OR IGNORE INTO company_procedures
2540
+ (id, title, content, priority, domain, active, created_at, updated_at)
2541
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2542
+ FROM global_procedures
2543
+ `);
2544
+ await client.executeMultiple(`
2545
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2546
+ AFTER INSERT ON global_procedures
2547
+ BEGIN
2548
+ INSERT OR IGNORE INTO company_procedures
2549
+ (id, title, content, priority, domain, active, created_at, updated_at)
2550
+ VALUES
2551
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2552
+ END;
2553
+
2554
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2555
+ AFTER UPDATE ON global_procedures
2556
+ BEGIN
2557
+ UPDATE company_procedures
2558
+ SET title = NEW.title,
2559
+ content = NEW.content,
2560
+ priority = NEW.priority,
2561
+ domain = NEW.domain,
2562
+ active = NEW.active,
2563
+ created_at = NEW.created_at,
2564
+ updated_at = NEW.updated_at
2565
+ WHERE id = OLD.id;
2566
+ END;
2567
+ `);
2568
+ } else {
2569
+ await client.execute(`
2570
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2571
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2572
+ FROM company_procedures
2573
+ `);
2574
+ await client.executeMultiple(`
2575
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2576
+ INSTEAD OF INSERT ON global_procedures
2577
+ BEGIN
2578
+ INSERT INTO company_procedures
2579
+ (id, title, content, priority, domain, active, created_at, updated_at)
2580
+ VALUES
2581
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2582
+ END;
2583
+
2584
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2585
+ INSTEAD OF UPDATE ON global_procedures
2586
+ BEGIN
2587
+ UPDATE company_procedures
2588
+ SET title = NEW.title,
2589
+ content = NEW.content,
2590
+ priority = NEW.priority,
2591
+ domain = NEW.domain,
2592
+ active = NEW.active,
2593
+ created_at = NEW.created_at,
2594
+ updated_at = NEW.updated_at
2595
+ WHERE id = OLD.id;
2596
+ END;
2597
+ `);
2598
+ }
2532
2599
  await client.executeMultiple(`
2533
2600
  CREATE TABLE IF NOT EXISTS conversations (
2534
2601
  id TEXT PRIMARY KEY,
@@ -3877,7 +3944,7 @@ var init_platform_procedures = __esm({
3877
3944
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3878
3945
  domain: "tool-use",
3879
3946
  priority: "p1",
3880
- 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 customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
3947
+ 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. company_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: global_procedure, store_global_procedure, list_global_procedures, deactivate_global_procedure."
3881
3948
  }
3882
3949
  ];
3883
3950
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3898,7 +3965,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3898
3965
  async function loadGlobalProcedures() {
3899
3966
  const client = getClient();
3900
3967
  const result = await client.execute({
3901
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3968
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3902
3969
  args: []
3903
3970
  });
3904
3971
  const allRows = result.rows;
@@ -3927,7 +3994,7 @@ async function storeGlobalProcedure(input) {
3927
3994
  const now = (/* @__PURE__ */ new Date()).toISOString();
3928
3995
  const client = getClient();
3929
3996
  await client.execute({
3930
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3997
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3931
3998
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3932
3999
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
3933
4000
  });
@@ -3938,7 +4005,7 @@ async function deactivateGlobalProcedure(id) {
3938
4005
  const now = (/* @__PURE__ */ new Date()).toISOString();
3939
4006
  const client = getClient();
3940
4007
  const result = await client.execute({
3941
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4008
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3942
4009
  args: [now, id]
3943
4010
  });
3944
4011
  await loadGlobalProcedures();
@@ -2493,7 +2493,7 @@ async function ensureSchema() {
2493
2493
  ON session_kills(agent_id);
2494
2494
  `);
2495
2495
  await client.execute(`
2496
- CREATE TABLE IF NOT EXISTS global_procedures (
2496
+ CREATE TABLE IF NOT EXISTS company_procedures (
2497
2497
  id TEXT PRIMARY KEY,
2498
2498
  title TEXT NOT NULL,
2499
2499
  content TEXT NOT NULL,
@@ -2504,6 +2504,73 @@ async function ensureSchema() {
2504
2504
  updated_at TEXT NOT NULL
2505
2505
  )
2506
2506
  `);
2507
+ const legacyProcedureObject = await client.execute({
2508
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2509
+ args: []
2510
+ });
2511
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2512
+ if (legacyProcedureType === "table") {
2513
+ await client.execute(`
2514
+ INSERT OR IGNORE INTO company_procedures
2515
+ (id, title, content, priority, domain, active, created_at, updated_at)
2516
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2517
+ FROM global_procedures
2518
+ `);
2519
+ await client.executeMultiple(`
2520
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2521
+ AFTER INSERT ON global_procedures
2522
+ BEGIN
2523
+ INSERT OR IGNORE INTO company_procedures
2524
+ (id, title, content, priority, domain, active, created_at, updated_at)
2525
+ VALUES
2526
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2527
+ END;
2528
+
2529
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2530
+ AFTER UPDATE ON global_procedures
2531
+ BEGIN
2532
+ UPDATE company_procedures
2533
+ SET title = NEW.title,
2534
+ content = NEW.content,
2535
+ priority = NEW.priority,
2536
+ domain = NEW.domain,
2537
+ active = NEW.active,
2538
+ created_at = NEW.created_at,
2539
+ updated_at = NEW.updated_at
2540
+ WHERE id = OLD.id;
2541
+ END;
2542
+ `);
2543
+ } else {
2544
+ await client.execute(`
2545
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2546
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2547
+ FROM company_procedures
2548
+ `);
2549
+ await client.executeMultiple(`
2550
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2551
+ INSTEAD OF INSERT ON global_procedures
2552
+ BEGIN
2553
+ INSERT INTO company_procedures
2554
+ (id, title, content, priority, domain, active, created_at, updated_at)
2555
+ VALUES
2556
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2557
+ END;
2558
+
2559
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2560
+ INSTEAD OF UPDATE ON global_procedures
2561
+ BEGIN
2562
+ UPDATE company_procedures
2563
+ SET title = NEW.title,
2564
+ content = NEW.content,
2565
+ priority = NEW.priority,
2566
+ domain = NEW.domain,
2567
+ active = NEW.active,
2568
+ created_at = NEW.created_at,
2569
+ updated_at = NEW.updated_at
2570
+ WHERE id = OLD.id;
2571
+ END;
2572
+ `);
2573
+ }
2507
2574
  await client.executeMultiple(`
2508
2575
  CREATE TABLE IF NOT EXISTS conversations (
2509
2576
  id TEXT PRIMARY KEY,
@@ -3852,7 +3919,7 @@ var init_platform_procedures = __esm({
3852
3919
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3853
3920
  domain: "tool-use",
3854
3921
  priority: "p1",
3855
- 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 customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
3922
+ 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. company_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: global_procedure, store_global_procedure, list_global_procedures, deactivate_global_procedure."
3856
3923
  }
3857
3924
  ];
3858
3925
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3873,7 +3940,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3873
3940
  async function loadGlobalProcedures() {
3874
3941
  const client = getClient();
3875
3942
  const result = await client.execute({
3876
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3943
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3877
3944
  args: []
3878
3945
  });
3879
3946
  const allRows = result.rows;
@@ -3902,7 +3969,7 @@ async function storeGlobalProcedure(input) {
3902
3969
  const now = (/* @__PURE__ */ new Date()).toISOString();
3903
3970
  const client = getClient();
3904
3971
  await client.execute({
3905
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3972
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3906
3973
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3907
3974
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
3908
3975
  });
@@ -3913,7 +3980,7 @@ async function deactivateGlobalProcedure(id) {
3913
3980
  const now = (/* @__PURE__ */ new Date()).toISOString();
3914
3981
  const client = getClient();
3915
3982
  const result = await client.execute({
3916
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
3983
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3917
3984
  args: [now, id]
3918
3985
  });
3919
3986
  await loadGlobalProcedures();
@@ -2537,7 +2537,7 @@ async function ensureSchema() {
2537
2537
  ON session_kills(agent_id);
2538
2538
  `);
2539
2539
  await client.execute(`
2540
- CREATE TABLE IF NOT EXISTS global_procedures (
2540
+ CREATE TABLE IF NOT EXISTS company_procedures (
2541
2541
  id TEXT PRIMARY KEY,
2542
2542
  title TEXT NOT NULL,
2543
2543
  content TEXT NOT NULL,
@@ -2548,6 +2548,73 @@ async function ensureSchema() {
2548
2548
  updated_at TEXT NOT NULL
2549
2549
  )
2550
2550
  `);
2551
+ const legacyProcedureObject = await client.execute({
2552
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2553
+ args: []
2554
+ });
2555
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2556
+ if (legacyProcedureType === "table") {
2557
+ await client.execute(`
2558
+ INSERT OR IGNORE INTO company_procedures
2559
+ (id, title, content, priority, domain, active, created_at, updated_at)
2560
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2561
+ FROM global_procedures
2562
+ `);
2563
+ await client.executeMultiple(`
2564
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2565
+ AFTER INSERT ON global_procedures
2566
+ BEGIN
2567
+ INSERT OR IGNORE INTO company_procedures
2568
+ (id, title, content, priority, domain, active, created_at, updated_at)
2569
+ VALUES
2570
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2571
+ END;
2572
+
2573
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2574
+ AFTER UPDATE ON global_procedures
2575
+ BEGIN
2576
+ UPDATE company_procedures
2577
+ SET title = NEW.title,
2578
+ content = NEW.content,
2579
+ priority = NEW.priority,
2580
+ domain = NEW.domain,
2581
+ active = NEW.active,
2582
+ created_at = NEW.created_at,
2583
+ updated_at = NEW.updated_at
2584
+ WHERE id = OLD.id;
2585
+ END;
2586
+ `);
2587
+ } else {
2588
+ await client.execute(`
2589
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2590
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2591
+ FROM company_procedures
2592
+ `);
2593
+ await client.executeMultiple(`
2594
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2595
+ INSTEAD OF INSERT ON global_procedures
2596
+ BEGIN
2597
+ INSERT INTO company_procedures
2598
+ (id, title, content, priority, domain, active, created_at, updated_at)
2599
+ VALUES
2600
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2601
+ END;
2602
+
2603
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2604
+ INSTEAD OF UPDATE ON global_procedures
2605
+ BEGIN
2606
+ UPDATE company_procedures
2607
+ SET title = NEW.title,
2608
+ content = NEW.content,
2609
+ priority = NEW.priority,
2610
+ domain = NEW.domain,
2611
+ active = NEW.active,
2612
+ created_at = NEW.created_at,
2613
+ updated_at = NEW.updated_at
2614
+ WHERE id = OLD.id;
2615
+ END;
2616
+ `);
2617
+ }
2551
2618
  await client.executeMultiple(`
2552
2619
  CREATE TABLE IF NOT EXISTS conversations (
2553
2620
  id TEXT PRIMARY KEY,
@@ -3896,7 +3963,7 @@ var init_platform_procedures = __esm({
3896
3963
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3897
3964
  domain: "tool-use",
3898
3965
  priority: "p1",
3899
- 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 customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
3966
+ 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. company_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: global_procedure, store_global_procedure, list_global_procedures, deactivate_global_procedure."
3900
3967
  }
3901
3968
  ];
3902
3969
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3917,7 +3984,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3917
3984
  async function loadGlobalProcedures() {
3918
3985
  const client = getClient();
3919
3986
  const result = await client.execute({
3920
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3987
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3921
3988
  args: []
3922
3989
  });
3923
3990
  const allRows = result.rows;
@@ -3946,7 +4013,7 @@ async function storeGlobalProcedure(input) {
3946
4013
  const now = (/* @__PURE__ */ new Date()).toISOString();
3947
4014
  const client = getClient();
3948
4015
  await client.execute({
3949
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4016
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3950
4017
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3951
4018
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
3952
4019
  });
@@ -3957,7 +4024,7 @@ async function deactivateGlobalProcedure(id) {
3957
4024
  const now = (/* @__PURE__ */ new Date()).toISOString();
3958
4025
  const client = getClient();
3959
4026
  const result = await client.execute({
3960
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4027
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3961
4028
  args: [now, id]
3962
4029
  });
3963
4030
  await loadGlobalProcedures();