@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
@@ -2504,7 +2504,7 @@ async function ensureSchema() {
2504
2504
  ON session_kills(agent_id);
2505
2505
  `);
2506
2506
  await client.execute(`
2507
- CREATE TABLE IF NOT EXISTS global_procedures (
2507
+ CREATE TABLE IF NOT EXISTS company_procedures (
2508
2508
  id TEXT PRIMARY KEY,
2509
2509
  title TEXT NOT NULL,
2510
2510
  content TEXT NOT NULL,
@@ -2515,6 +2515,73 @@ async function ensureSchema() {
2515
2515
  updated_at TEXT NOT NULL
2516
2516
  )
2517
2517
  `);
2518
+ const legacyProcedureObject = await client.execute({
2519
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2520
+ args: []
2521
+ });
2522
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2523
+ if (legacyProcedureType === "table") {
2524
+ await client.execute(`
2525
+ INSERT OR IGNORE INTO company_procedures
2526
+ (id, title, content, priority, domain, active, created_at, updated_at)
2527
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2528
+ FROM global_procedures
2529
+ `);
2530
+ await client.executeMultiple(`
2531
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2532
+ AFTER INSERT ON global_procedures
2533
+ BEGIN
2534
+ INSERT OR IGNORE INTO company_procedures
2535
+ (id, title, content, priority, domain, active, created_at, updated_at)
2536
+ VALUES
2537
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2538
+ END;
2539
+
2540
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2541
+ AFTER UPDATE ON global_procedures
2542
+ BEGIN
2543
+ UPDATE company_procedures
2544
+ SET title = NEW.title,
2545
+ content = NEW.content,
2546
+ priority = NEW.priority,
2547
+ domain = NEW.domain,
2548
+ active = NEW.active,
2549
+ created_at = NEW.created_at,
2550
+ updated_at = NEW.updated_at
2551
+ WHERE id = OLD.id;
2552
+ END;
2553
+ `);
2554
+ } else {
2555
+ await client.execute(`
2556
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2557
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2558
+ FROM company_procedures
2559
+ `);
2560
+ await client.executeMultiple(`
2561
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2562
+ INSTEAD OF INSERT ON global_procedures
2563
+ BEGIN
2564
+ INSERT INTO company_procedures
2565
+ (id, title, content, priority, domain, active, created_at, updated_at)
2566
+ VALUES
2567
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2568
+ END;
2569
+
2570
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2571
+ INSTEAD OF UPDATE ON global_procedures
2572
+ BEGIN
2573
+ UPDATE company_procedures
2574
+ SET title = NEW.title,
2575
+ content = NEW.content,
2576
+ priority = NEW.priority,
2577
+ domain = NEW.domain,
2578
+ active = NEW.active,
2579
+ created_at = NEW.created_at,
2580
+ updated_at = NEW.updated_at
2581
+ WHERE id = OLD.id;
2582
+ END;
2583
+ `);
2584
+ }
2518
2585
  await client.executeMultiple(`
2519
2586
  CREATE TABLE IF NOT EXISTS conversations (
2520
2587
  id TEXT PRIMARY KEY,
@@ -3863,7 +3930,7 @@ var init_platform_procedures = __esm({
3863
3930
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3864
3931
  domain: "tool-use",
3865
3932
  priority: "p1",
3866
- 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."
3933
+ 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."
3867
3934
  }
3868
3935
  ];
3869
3936
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3884,7 +3951,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3884
3951
  async function loadGlobalProcedures() {
3885
3952
  const client = getClient();
3886
3953
  const result = await client.execute({
3887
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3954
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3888
3955
  args: []
3889
3956
  });
3890
3957
  const allRows = result.rows;
@@ -3913,7 +3980,7 @@ async function storeGlobalProcedure(input) {
3913
3980
  const now = (/* @__PURE__ */ new Date()).toISOString();
3914
3981
  const client = getClient();
3915
3982
  await client.execute({
3916
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3983
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3917
3984
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3918
3985
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
3919
3986
  });
@@ -3924,7 +3991,7 @@ async function deactivateGlobalProcedure(id) {
3924
3991
  const now = (/* @__PURE__ */ new Date()).toISOString();
3925
3992
  const client = getClient();
3926
3993
  const result = await client.execute({
3927
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
3994
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3928
3995
  args: [now, id]
3929
3996
  });
3930
3997
  await loadGlobalProcedures();
@@ -3150,7 +3150,7 @@ async function ensureSchema() {
3150
3150
  ON session_kills(agent_id);
3151
3151
  `);
3152
3152
  await client.execute(`
3153
- CREATE TABLE IF NOT EXISTS global_procedures (
3153
+ CREATE TABLE IF NOT EXISTS company_procedures (
3154
3154
  id TEXT PRIMARY KEY,
3155
3155
  title TEXT NOT NULL,
3156
3156
  content TEXT NOT NULL,
@@ -3161,6 +3161,73 @@ async function ensureSchema() {
3161
3161
  updated_at TEXT NOT NULL
3162
3162
  )
3163
3163
  `);
3164
+ const legacyProcedureObject = await client.execute({
3165
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
3166
+ args: []
3167
+ });
3168
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
3169
+ if (legacyProcedureType === "table") {
3170
+ await client.execute(`
3171
+ INSERT OR IGNORE INTO company_procedures
3172
+ (id, title, content, priority, domain, active, created_at, updated_at)
3173
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3174
+ FROM global_procedures
3175
+ `);
3176
+ await client.executeMultiple(`
3177
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
3178
+ AFTER INSERT ON global_procedures
3179
+ BEGIN
3180
+ INSERT OR IGNORE INTO company_procedures
3181
+ (id, title, content, priority, domain, active, created_at, updated_at)
3182
+ VALUES
3183
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3184
+ END;
3185
+
3186
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
3187
+ AFTER UPDATE ON global_procedures
3188
+ BEGIN
3189
+ UPDATE company_procedures
3190
+ SET title = NEW.title,
3191
+ content = NEW.content,
3192
+ priority = NEW.priority,
3193
+ domain = NEW.domain,
3194
+ active = NEW.active,
3195
+ created_at = NEW.created_at,
3196
+ updated_at = NEW.updated_at
3197
+ WHERE id = OLD.id;
3198
+ END;
3199
+ `);
3200
+ } else {
3201
+ await client.execute(`
3202
+ CREATE VIEW IF NOT EXISTS global_procedures AS
3203
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3204
+ FROM company_procedures
3205
+ `);
3206
+ await client.executeMultiple(`
3207
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
3208
+ INSTEAD OF INSERT ON global_procedures
3209
+ BEGIN
3210
+ INSERT INTO company_procedures
3211
+ (id, title, content, priority, domain, active, created_at, updated_at)
3212
+ VALUES
3213
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3214
+ END;
3215
+
3216
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
3217
+ INSTEAD OF UPDATE ON global_procedures
3218
+ BEGIN
3219
+ UPDATE company_procedures
3220
+ SET title = NEW.title,
3221
+ content = NEW.content,
3222
+ priority = NEW.priority,
3223
+ domain = NEW.domain,
3224
+ active = NEW.active,
3225
+ created_at = NEW.created_at,
3226
+ updated_at = NEW.updated_at
3227
+ WHERE id = OLD.id;
3228
+ END;
3229
+ `);
3230
+ }
3164
3231
  await client.executeMultiple(`
3165
3232
  CREATE TABLE IF NOT EXISTS conversations (
3166
3233
  id TEXT PRIMARY KEY,
@@ -4522,7 +4589,7 @@ var init_platform_procedures = __esm({
4522
4589
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
4523
4590
  domain: "tool-use",
4524
4591
  priority: "p1",
4525
- 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."
4592
+ 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."
4526
4593
  }
4527
4594
  ];
4528
4595
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -4543,7 +4610,7 @@ import { randomUUID as randomUUID2 } from "crypto";
4543
4610
  async function loadGlobalProcedures() {
4544
4611
  const client = getClient();
4545
4612
  const result = await client.execute({
4546
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4613
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4547
4614
  args: []
4548
4615
  });
4549
4616
  const allRows = result.rows;
@@ -4572,7 +4639,7 @@ async function storeGlobalProcedure(input) {
4572
4639
  const now = (/* @__PURE__ */ new Date()).toISOString();
4573
4640
  const client = getClient();
4574
4641
  await client.execute({
4575
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4642
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4576
4643
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
4577
4644
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
4578
4645
  });
@@ -4583,7 +4650,7 @@ async function deactivateGlobalProcedure(id) {
4583
4650
  const now = (/* @__PURE__ */ new Date()).toISOString();
4584
4651
  const client = getClient();
4585
4652
  const result = await client.execute({
4586
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4653
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
4587
4654
  args: [now, id]
4588
4655
  });
4589
4656
  await loadGlobalProcedures();
@@ -2534,7 +2534,7 @@ async function ensureSchema() {
2534
2534
  ON session_kills(agent_id);
2535
2535
  `);
2536
2536
  await client.execute(`
2537
- CREATE TABLE IF NOT EXISTS global_procedures (
2537
+ CREATE TABLE IF NOT EXISTS company_procedures (
2538
2538
  id TEXT PRIMARY KEY,
2539
2539
  title TEXT NOT NULL,
2540
2540
  content TEXT NOT NULL,
@@ -2545,6 +2545,73 @@ async function ensureSchema() {
2545
2545
  updated_at TEXT NOT NULL
2546
2546
  )
2547
2547
  `);
2548
+ const legacyProcedureObject = await client.execute({
2549
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2550
+ args: []
2551
+ });
2552
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2553
+ if (legacyProcedureType === "table") {
2554
+ await client.execute(`
2555
+ INSERT OR IGNORE INTO company_procedures
2556
+ (id, title, content, priority, domain, active, created_at, updated_at)
2557
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2558
+ FROM global_procedures
2559
+ `);
2560
+ await client.executeMultiple(`
2561
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2562
+ AFTER INSERT ON global_procedures
2563
+ BEGIN
2564
+ INSERT OR IGNORE INTO company_procedures
2565
+ (id, title, content, priority, domain, active, created_at, updated_at)
2566
+ VALUES
2567
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2568
+ END;
2569
+
2570
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2571
+ AFTER UPDATE ON global_procedures
2572
+ BEGIN
2573
+ UPDATE company_procedures
2574
+ SET title = NEW.title,
2575
+ content = NEW.content,
2576
+ priority = NEW.priority,
2577
+ domain = NEW.domain,
2578
+ active = NEW.active,
2579
+ created_at = NEW.created_at,
2580
+ updated_at = NEW.updated_at
2581
+ WHERE id = OLD.id;
2582
+ END;
2583
+ `);
2584
+ } else {
2585
+ await client.execute(`
2586
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2587
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2588
+ FROM company_procedures
2589
+ `);
2590
+ await client.executeMultiple(`
2591
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2592
+ INSTEAD OF INSERT ON global_procedures
2593
+ BEGIN
2594
+ INSERT INTO company_procedures
2595
+ (id, title, content, priority, domain, active, created_at, updated_at)
2596
+ VALUES
2597
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2598
+ END;
2599
+
2600
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2601
+ INSTEAD OF UPDATE ON global_procedures
2602
+ BEGIN
2603
+ UPDATE company_procedures
2604
+ SET title = NEW.title,
2605
+ content = NEW.content,
2606
+ priority = NEW.priority,
2607
+ domain = NEW.domain,
2608
+ active = NEW.active,
2609
+ created_at = NEW.created_at,
2610
+ updated_at = NEW.updated_at
2611
+ WHERE id = OLD.id;
2612
+ END;
2613
+ `);
2614
+ }
2548
2615
  await client.executeMultiple(`
2549
2616
  CREATE TABLE IF NOT EXISTS conversations (
2550
2617
  id TEXT PRIMARY KEY,
@@ -3893,7 +3960,7 @@ var init_platform_procedures = __esm({
3893
3960
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3894
3961
  domain: "tool-use",
3895
3962
  priority: "p1",
3896
- 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."
3963
+ 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."
3897
3964
  }
3898
3965
  ];
3899
3966
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3914,7 +3981,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3914
3981
  async function loadGlobalProcedures() {
3915
3982
  const client = getClient();
3916
3983
  const result = await client.execute({
3917
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3984
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3918
3985
  args: []
3919
3986
  });
3920
3987
  const allRows = result.rows;
@@ -3943,7 +4010,7 @@ async function storeGlobalProcedure(input) {
3943
4010
  const now = (/* @__PURE__ */ new Date()).toISOString();
3944
4011
  const client = getClient();
3945
4012
  await client.execute({
3946
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4013
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3947
4014
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3948
4015
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
3949
4016
  });
@@ -3954,7 +4021,7 @@ async function deactivateGlobalProcedure(id) {
3954
4021
  const now = (/* @__PURE__ */ new Date()).toISOString();
3955
4022
  const client = getClient();
3956
4023
  const result = await client.execute({
3957
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4024
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3958
4025
  args: [now, id]
3959
4026
  });
3960
4027
  await loadGlobalProcedures();
@@ -2504,7 +2504,7 @@ async function ensureSchema() {
2504
2504
  ON session_kills(agent_id);
2505
2505
  `);
2506
2506
  await client.execute(`
2507
- CREATE TABLE IF NOT EXISTS global_procedures (
2507
+ CREATE TABLE IF NOT EXISTS company_procedures (
2508
2508
  id TEXT PRIMARY KEY,
2509
2509
  title TEXT NOT NULL,
2510
2510
  content TEXT NOT NULL,
@@ -2515,6 +2515,73 @@ async function ensureSchema() {
2515
2515
  updated_at TEXT NOT NULL
2516
2516
  )
2517
2517
  `);
2518
+ const legacyProcedureObject = await client.execute({
2519
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2520
+ args: []
2521
+ });
2522
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2523
+ if (legacyProcedureType === "table") {
2524
+ await client.execute(`
2525
+ INSERT OR IGNORE INTO company_procedures
2526
+ (id, title, content, priority, domain, active, created_at, updated_at)
2527
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2528
+ FROM global_procedures
2529
+ `);
2530
+ await client.executeMultiple(`
2531
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2532
+ AFTER INSERT ON global_procedures
2533
+ BEGIN
2534
+ INSERT OR IGNORE INTO company_procedures
2535
+ (id, title, content, priority, domain, active, created_at, updated_at)
2536
+ VALUES
2537
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2538
+ END;
2539
+
2540
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2541
+ AFTER UPDATE ON global_procedures
2542
+ BEGIN
2543
+ UPDATE company_procedures
2544
+ SET title = NEW.title,
2545
+ content = NEW.content,
2546
+ priority = NEW.priority,
2547
+ domain = NEW.domain,
2548
+ active = NEW.active,
2549
+ created_at = NEW.created_at,
2550
+ updated_at = NEW.updated_at
2551
+ WHERE id = OLD.id;
2552
+ END;
2553
+ `);
2554
+ } else {
2555
+ await client.execute(`
2556
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2557
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2558
+ FROM company_procedures
2559
+ `);
2560
+ await client.executeMultiple(`
2561
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2562
+ INSTEAD OF INSERT ON global_procedures
2563
+ BEGIN
2564
+ INSERT INTO company_procedures
2565
+ (id, title, content, priority, domain, active, created_at, updated_at)
2566
+ VALUES
2567
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2568
+ END;
2569
+
2570
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2571
+ INSTEAD OF UPDATE ON global_procedures
2572
+ BEGIN
2573
+ UPDATE company_procedures
2574
+ SET title = NEW.title,
2575
+ content = NEW.content,
2576
+ priority = NEW.priority,
2577
+ domain = NEW.domain,
2578
+ active = NEW.active,
2579
+ created_at = NEW.created_at,
2580
+ updated_at = NEW.updated_at
2581
+ WHERE id = OLD.id;
2582
+ END;
2583
+ `);
2584
+ }
2518
2585
  await client.executeMultiple(`
2519
2586
  CREATE TABLE IF NOT EXISTS conversations (
2520
2587
  id TEXT PRIMARY KEY,
@@ -3863,7 +3930,7 @@ var init_platform_procedures = __esm({
3863
3930
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3864
3931
  domain: "tool-use",
3865
3932
  priority: "p1",
3866
- 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."
3933
+ 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."
3867
3934
  }
3868
3935
  ];
3869
3936
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3884,7 +3951,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3884
3951
  async function loadGlobalProcedures() {
3885
3952
  const client = getClient();
3886
3953
  const result = await client.execute({
3887
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3954
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3888
3955
  args: []
3889
3956
  });
3890
3957
  const allRows = result.rows;
@@ -3913,7 +3980,7 @@ async function storeGlobalProcedure(input) {
3913
3980
  const now = (/* @__PURE__ */ new Date()).toISOString();
3914
3981
  const client = getClient();
3915
3982
  await client.execute({
3916
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3983
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3917
3984
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3918
3985
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
3919
3986
  });
@@ -3924,7 +3991,7 @@ async function deactivateGlobalProcedure(id) {
3924
3991
  const now = (/* @__PURE__ */ new Date()).toISOString();
3925
3992
  const client = getClient();
3926
3993
  const result = await client.execute({
3927
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
3994
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3928
3995
  args: [now, id]
3929
3996
  });
3930
3997
  await loadGlobalProcedures();
@@ -2377,7 +2377,7 @@ async function ensureSchema() {
2377
2377
  ON session_kills(agent_id);
2378
2378
  `);
2379
2379
  await client.execute(`
2380
- CREATE TABLE IF NOT EXISTS global_procedures (
2380
+ CREATE TABLE IF NOT EXISTS company_procedures (
2381
2381
  id TEXT PRIMARY KEY,
2382
2382
  title TEXT NOT NULL,
2383
2383
  content TEXT NOT NULL,
@@ -2388,6 +2388,73 @@ async function ensureSchema() {
2388
2388
  updated_at TEXT NOT NULL
2389
2389
  )
2390
2390
  `);
2391
+ const legacyProcedureObject = await client.execute({
2392
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2393
+ args: []
2394
+ });
2395
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2396
+ if (legacyProcedureType === "table") {
2397
+ await client.execute(`
2398
+ INSERT OR IGNORE INTO company_procedures
2399
+ (id, title, content, priority, domain, active, created_at, updated_at)
2400
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2401
+ FROM global_procedures
2402
+ `);
2403
+ await client.executeMultiple(`
2404
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2405
+ AFTER INSERT ON global_procedures
2406
+ BEGIN
2407
+ INSERT OR IGNORE INTO company_procedures
2408
+ (id, title, content, priority, domain, active, created_at, updated_at)
2409
+ VALUES
2410
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2411
+ END;
2412
+
2413
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2414
+ AFTER UPDATE ON global_procedures
2415
+ BEGIN
2416
+ UPDATE company_procedures
2417
+ SET title = NEW.title,
2418
+ content = NEW.content,
2419
+ priority = NEW.priority,
2420
+ domain = NEW.domain,
2421
+ active = NEW.active,
2422
+ created_at = NEW.created_at,
2423
+ updated_at = NEW.updated_at
2424
+ WHERE id = OLD.id;
2425
+ END;
2426
+ `);
2427
+ } else {
2428
+ await client.execute(`
2429
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2430
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2431
+ FROM company_procedures
2432
+ `);
2433
+ await client.executeMultiple(`
2434
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2435
+ INSTEAD OF INSERT ON global_procedures
2436
+ BEGIN
2437
+ INSERT INTO company_procedures
2438
+ (id, title, content, priority, domain, active, created_at, updated_at)
2439
+ VALUES
2440
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2441
+ END;
2442
+
2443
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2444
+ INSTEAD OF UPDATE ON global_procedures
2445
+ BEGIN
2446
+ UPDATE company_procedures
2447
+ SET title = NEW.title,
2448
+ content = NEW.content,
2449
+ priority = NEW.priority,
2450
+ domain = NEW.domain,
2451
+ active = NEW.active,
2452
+ created_at = NEW.created_at,
2453
+ updated_at = NEW.updated_at
2454
+ WHERE id = OLD.id;
2455
+ END;
2456
+ `);
2457
+ }
2391
2458
  await client.executeMultiple(`
2392
2459
  CREATE TABLE IF NOT EXISTS conversations (
2393
2460
  id TEXT PRIMARY KEY,
@@ -3264,7 +3331,7 @@ var init_platform_procedures = __esm({
3264
3331
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3265
3332
  domain: "tool-use",
3266
3333
  priority: "p1",
3267
- 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."
3334
+ 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."
3268
3335
  }
3269
3336
  ];
3270
3337
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3285,7 +3352,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3285
3352
  async function loadGlobalProcedures() {
3286
3353
  const client = getClient();
3287
3354
  const result = await client.execute({
3288
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3355
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3289
3356
  args: []
3290
3357
  });
3291
3358
  const allRows = result.rows;
@@ -3314,7 +3381,7 @@ async function storeGlobalProcedure(input) {
3314
3381
  const now = (/* @__PURE__ */ new Date()).toISOString();
3315
3382
  const client = getClient();
3316
3383
  await client.execute({
3317
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3384
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3318
3385
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3319
3386
  args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
3320
3387
  });
@@ -3325,7 +3392,7 @@ async function deactivateGlobalProcedure(id) {
3325
3392
  const now = (/* @__PURE__ */ new Date()).toISOString();
3326
3393
  const client = getClient();
3327
3394
  const result = await client.execute({
3328
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
3395
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3329
3396
  args: [now, id]
3330
3397
  });
3331
3398
  await loadGlobalProcedures();