@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
@@ -2672,7 +2672,7 @@ async function ensureSchema() {
2672
2672
  ON session_kills(agent_id);
2673
2673
  `);
2674
2674
  await client.execute(`
2675
- CREATE TABLE IF NOT EXISTS global_procedures (
2675
+ CREATE TABLE IF NOT EXISTS company_procedures (
2676
2676
  id TEXT PRIMARY KEY,
2677
2677
  title TEXT NOT NULL,
2678
2678
  content TEXT NOT NULL,
@@ -2683,6 +2683,73 @@ async function ensureSchema() {
2683
2683
  updated_at TEXT NOT NULL
2684
2684
  )
2685
2685
  `);
2686
+ const legacyProcedureObject = await client.execute({
2687
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2688
+ args: []
2689
+ });
2690
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2691
+ if (legacyProcedureType === "table") {
2692
+ await client.execute(`
2693
+ INSERT OR IGNORE INTO company_procedures
2694
+ (id, title, content, priority, domain, active, created_at, updated_at)
2695
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2696
+ FROM global_procedures
2697
+ `);
2698
+ await client.executeMultiple(`
2699
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2700
+ AFTER INSERT ON global_procedures
2701
+ BEGIN
2702
+ INSERT OR IGNORE INTO company_procedures
2703
+ (id, title, content, priority, domain, active, created_at, updated_at)
2704
+ VALUES
2705
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2706
+ END;
2707
+
2708
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2709
+ AFTER UPDATE ON global_procedures
2710
+ BEGIN
2711
+ UPDATE company_procedures
2712
+ SET title = NEW.title,
2713
+ content = NEW.content,
2714
+ priority = NEW.priority,
2715
+ domain = NEW.domain,
2716
+ active = NEW.active,
2717
+ created_at = NEW.created_at,
2718
+ updated_at = NEW.updated_at
2719
+ WHERE id = OLD.id;
2720
+ END;
2721
+ `);
2722
+ } else {
2723
+ await client.execute(`
2724
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2725
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2726
+ FROM company_procedures
2727
+ `);
2728
+ await client.executeMultiple(`
2729
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2730
+ INSTEAD OF INSERT ON global_procedures
2731
+ BEGIN
2732
+ INSERT INTO company_procedures
2733
+ (id, title, content, priority, domain, active, created_at, updated_at)
2734
+ VALUES
2735
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2736
+ END;
2737
+
2738
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2739
+ INSTEAD OF UPDATE ON global_procedures
2740
+ BEGIN
2741
+ UPDATE company_procedures
2742
+ SET title = NEW.title,
2743
+ content = NEW.content,
2744
+ priority = NEW.priority,
2745
+ domain = NEW.domain,
2746
+ active = NEW.active,
2747
+ created_at = NEW.created_at,
2748
+ updated_at = NEW.updated_at
2749
+ WHERE id = OLD.id;
2750
+ END;
2751
+ `);
2752
+ }
2686
2753
  await client.executeMultiple(`
2687
2754
  CREATE TABLE IF NOT EXISTS conversations (
2688
2755
  id TEXT PRIMARY KEY,
@@ -4031,7 +4098,7 @@ var init_platform_procedures = __esm({
4031
4098
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
4032
4099
  domain: "tool-use",
4033
4100
  priority: "p1",
4034
- 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."
4101
+ 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."
4035
4102
  }
4036
4103
  ];
4037
4104
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -4052,7 +4119,7 @@ import { randomUUID as randomUUID2 } from "crypto";
4052
4119
  async function loadGlobalProcedures() {
4053
4120
  const client = getClient();
4054
4121
  const result = await client.execute({
4055
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4122
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4056
4123
  args: []
4057
4124
  });
4058
4125
  const allRows = result.rows;
@@ -4081,7 +4148,7 @@ async function storeGlobalProcedure(input2) {
4081
4148
  const now = (/* @__PURE__ */ new Date()).toISOString();
4082
4149
  const client = getClient();
4083
4150
  await client.execute({
4084
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4151
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4085
4152
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
4086
4153
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
4087
4154
  });
@@ -4092,7 +4159,7 @@ async function deactivateGlobalProcedure(id) {
4092
4159
  const now = (/* @__PURE__ */ new Date()).toISOString();
4093
4160
  const client = getClient();
4094
4161
  const result = await client.execute({
4095
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4162
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
4096
4163
  args: [now, id]
4097
4164
  });
4098
4165
  await loadGlobalProcedures();
@@ -2506,7 +2506,7 @@ async function ensureSchema() {
2506
2506
  ON session_kills(agent_id);
2507
2507
  `);
2508
2508
  await client.execute(`
2509
- CREATE TABLE IF NOT EXISTS global_procedures (
2509
+ CREATE TABLE IF NOT EXISTS company_procedures (
2510
2510
  id TEXT PRIMARY KEY,
2511
2511
  title TEXT NOT NULL,
2512
2512
  content TEXT NOT NULL,
@@ -2517,6 +2517,73 @@ async function ensureSchema() {
2517
2517
  updated_at TEXT NOT NULL
2518
2518
  )
2519
2519
  `);
2520
+ const legacyProcedureObject = await client.execute({
2521
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2522
+ args: []
2523
+ });
2524
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2525
+ if (legacyProcedureType === "table") {
2526
+ await client.execute(`
2527
+ INSERT OR IGNORE INTO company_procedures
2528
+ (id, title, content, priority, domain, active, created_at, updated_at)
2529
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2530
+ FROM global_procedures
2531
+ `);
2532
+ await client.executeMultiple(`
2533
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2534
+ AFTER INSERT ON global_procedures
2535
+ BEGIN
2536
+ INSERT OR IGNORE INTO company_procedures
2537
+ (id, title, content, priority, domain, active, created_at, updated_at)
2538
+ VALUES
2539
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2540
+ END;
2541
+
2542
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2543
+ AFTER UPDATE ON global_procedures
2544
+ BEGIN
2545
+ UPDATE company_procedures
2546
+ SET title = NEW.title,
2547
+ content = NEW.content,
2548
+ priority = NEW.priority,
2549
+ domain = NEW.domain,
2550
+ active = NEW.active,
2551
+ created_at = NEW.created_at,
2552
+ updated_at = NEW.updated_at
2553
+ WHERE id = OLD.id;
2554
+ END;
2555
+ `);
2556
+ } else {
2557
+ await client.execute(`
2558
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2559
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2560
+ FROM company_procedures
2561
+ `);
2562
+ await client.executeMultiple(`
2563
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2564
+ INSTEAD OF INSERT ON global_procedures
2565
+ BEGIN
2566
+ INSERT INTO company_procedures
2567
+ (id, title, content, priority, domain, active, created_at, updated_at)
2568
+ VALUES
2569
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2570
+ END;
2571
+
2572
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2573
+ INSTEAD OF UPDATE ON global_procedures
2574
+ BEGIN
2575
+ UPDATE company_procedures
2576
+ SET title = NEW.title,
2577
+ content = NEW.content,
2578
+ priority = NEW.priority,
2579
+ domain = NEW.domain,
2580
+ active = NEW.active,
2581
+ created_at = NEW.created_at,
2582
+ updated_at = NEW.updated_at
2583
+ WHERE id = OLD.id;
2584
+ END;
2585
+ `);
2586
+ }
2520
2587
  await client.executeMultiple(`
2521
2588
  CREATE TABLE IF NOT EXISTS conversations (
2522
2589
  id TEXT PRIMARY KEY,
@@ -3865,7 +3932,7 @@ var init_platform_procedures = __esm({
3865
3932
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3866
3933
  domain: "tool-use",
3867
3934
  priority: "p1",
3868
- 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."
3935
+ 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."
3869
3936
  }
3870
3937
  ];
3871
3938
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3886,7 +3953,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3886
3953
  async function loadGlobalProcedures() {
3887
3954
  const client = getClient();
3888
3955
  const result = await client.execute({
3889
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3956
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3890
3957
  args: []
3891
3958
  });
3892
3959
  const allRows = result.rows;
@@ -3915,7 +3982,7 @@ async function storeGlobalProcedure(input2) {
3915
3982
  const now = (/* @__PURE__ */ new Date()).toISOString();
3916
3983
  const client = getClient();
3917
3984
  await client.execute({
3918
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3985
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3919
3986
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3920
3987
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
3921
3988
  });
@@ -3926,7 +3993,7 @@ async function deactivateGlobalProcedure(id) {
3926
3993
  const now = (/* @__PURE__ */ new Date()).toISOString();
3927
3994
  const client = getClient();
3928
3995
  const result = await client.execute({
3929
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
3996
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3930
3997
  args: [now, id]
3931
3998
  });
3932
3999
  await loadGlobalProcedures();
@@ -2506,7 +2506,7 @@ async function ensureSchema() {
2506
2506
  ON session_kills(agent_id);
2507
2507
  `);
2508
2508
  await client.execute(`
2509
- CREATE TABLE IF NOT EXISTS global_procedures (
2509
+ CREATE TABLE IF NOT EXISTS company_procedures (
2510
2510
  id TEXT PRIMARY KEY,
2511
2511
  title TEXT NOT NULL,
2512
2512
  content TEXT NOT NULL,
@@ -2517,6 +2517,73 @@ async function ensureSchema() {
2517
2517
  updated_at TEXT NOT NULL
2518
2518
  )
2519
2519
  `);
2520
+ const legacyProcedureObject = await client.execute({
2521
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2522
+ args: []
2523
+ });
2524
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2525
+ if (legacyProcedureType === "table") {
2526
+ await client.execute(`
2527
+ INSERT OR IGNORE INTO company_procedures
2528
+ (id, title, content, priority, domain, active, created_at, updated_at)
2529
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2530
+ FROM global_procedures
2531
+ `);
2532
+ await client.executeMultiple(`
2533
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2534
+ AFTER INSERT ON global_procedures
2535
+ BEGIN
2536
+ INSERT OR IGNORE INTO company_procedures
2537
+ (id, title, content, priority, domain, active, created_at, updated_at)
2538
+ VALUES
2539
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2540
+ END;
2541
+
2542
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2543
+ AFTER UPDATE ON global_procedures
2544
+ BEGIN
2545
+ UPDATE company_procedures
2546
+ SET title = NEW.title,
2547
+ content = NEW.content,
2548
+ priority = NEW.priority,
2549
+ domain = NEW.domain,
2550
+ active = NEW.active,
2551
+ created_at = NEW.created_at,
2552
+ updated_at = NEW.updated_at
2553
+ WHERE id = OLD.id;
2554
+ END;
2555
+ `);
2556
+ } else {
2557
+ await client.execute(`
2558
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2559
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2560
+ FROM company_procedures
2561
+ `);
2562
+ await client.executeMultiple(`
2563
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2564
+ INSTEAD OF INSERT ON global_procedures
2565
+ BEGIN
2566
+ INSERT INTO company_procedures
2567
+ (id, title, content, priority, domain, active, created_at, updated_at)
2568
+ VALUES
2569
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2570
+ END;
2571
+
2572
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2573
+ INSTEAD OF UPDATE ON global_procedures
2574
+ BEGIN
2575
+ UPDATE company_procedures
2576
+ SET title = NEW.title,
2577
+ content = NEW.content,
2578
+ priority = NEW.priority,
2579
+ domain = NEW.domain,
2580
+ active = NEW.active,
2581
+ created_at = NEW.created_at,
2582
+ updated_at = NEW.updated_at
2583
+ WHERE id = OLD.id;
2584
+ END;
2585
+ `);
2586
+ }
2520
2587
  await client.executeMultiple(`
2521
2588
  CREATE TABLE IF NOT EXISTS conversations (
2522
2589
  id TEXT PRIMARY KEY,
@@ -3865,7 +3932,7 @@ var init_platform_procedures = __esm({
3865
3932
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3866
3933
  domain: "tool-use",
3867
3934
  priority: "p1",
3868
- 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."
3935
+ 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."
3869
3936
  }
3870
3937
  ];
3871
3938
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3886,7 +3953,7 @@ import { randomUUID as randomUUID2 } from "crypto";
3886
3953
  async function loadGlobalProcedures() {
3887
3954
  const client = getClient();
3888
3955
  const result = await client.execute({
3889
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3956
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
3890
3957
  args: []
3891
3958
  });
3892
3959
  const allRows = result.rows;
@@ -3915,7 +3982,7 @@ async function storeGlobalProcedure(input2) {
3915
3982
  const now = (/* @__PURE__ */ new Date()).toISOString();
3916
3983
  const client = getClient();
3917
3984
  await client.execute({
3918
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3985
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
3919
3986
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
3920
3987
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
3921
3988
  });
@@ -3926,7 +3993,7 @@ async function deactivateGlobalProcedure(id) {
3926
3993
  const now = (/* @__PURE__ */ new Date()).toISOString();
3927
3994
  const client = getClient();
3928
3995
  const result = await client.execute({
3929
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
3996
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
3930
3997
  args: [now, id]
3931
3998
  });
3932
3999
  await loadGlobalProcedures();
@@ -2801,7 +2801,7 @@ async function ensureSchema() {
2801
2801
  ON session_kills(agent_id);
2802
2802
  `);
2803
2803
  await client.execute(`
2804
- CREATE TABLE IF NOT EXISTS global_procedures (
2804
+ CREATE TABLE IF NOT EXISTS company_procedures (
2805
2805
  id TEXT PRIMARY KEY,
2806
2806
  title TEXT NOT NULL,
2807
2807
  content TEXT NOT NULL,
@@ -2812,6 +2812,73 @@ async function ensureSchema() {
2812
2812
  updated_at TEXT NOT NULL
2813
2813
  )
2814
2814
  `);
2815
+ const legacyProcedureObject = await client.execute({
2816
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2817
+ args: []
2818
+ });
2819
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2820
+ if (legacyProcedureType === "table") {
2821
+ await client.execute(`
2822
+ INSERT OR IGNORE INTO company_procedures
2823
+ (id, title, content, priority, domain, active, created_at, updated_at)
2824
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2825
+ FROM global_procedures
2826
+ `);
2827
+ await client.executeMultiple(`
2828
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2829
+ AFTER INSERT ON global_procedures
2830
+ BEGIN
2831
+ INSERT OR IGNORE INTO company_procedures
2832
+ (id, title, content, priority, domain, active, created_at, updated_at)
2833
+ VALUES
2834
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2835
+ END;
2836
+
2837
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2838
+ AFTER UPDATE ON global_procedures
2839
+ BEGIN
2840
+ UPDATE company_procedures
2841
+ SET title = NEW.title,
2842
+ content = NEW.content,
2843
+ priority = NEW.priority,
2844
+ domain = NEW.domain,
2845
+ active = NEW.active,
2846
+ created_at = NEW.created_at,
2847
+ updated_at = NEW.updated_at
2848
+ WHERE id = OLD.id;
2849
+ END;
2850
+ `);
2851
+ } else {
2852
+ await client.execute(`
2853
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2854
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2855
+ FROM company_procedures
2856
+ `);
2857
+ await client.executeMultiple(`
2858
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2859
+ INSTEAD OF INSERT ON global_procedures
2860
+ BEGIN
2861
+ INSERT INTO company_procedures
2862
+ (id, title, content, priority, domain, active, created_at, updated_at)
2863
+ VALUES
2864
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2865
+ END;
2866
+
2867
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2868
+ INSTEAD OF UPDATE ON global_procedures
2869
+ BEGIN
2870
+ UPDATE company_procedures
2871
+ SET title = NEW.title,
2872
+ content = NEW.content,
2873
+ priority = NEW.priority,
2874
+ domain = NEW.domain,
2875
+ active = NEW.active,
2876
+ created_at = NEW.created_at,
2877
+ updated_at = NEW.updated_at
2878
+ WHERE id = OLD.id;
2879
+ END;
2880
+ `);
2881
+ }
2815
2882
  await client.executeMultiple(`
2816
2883
  CREATE TABLE IF NOT EXISTS conversations (
2817
2884
  id TEXT PRIMARY KEY,
@@ -4303,7 +4370,7 @@ var init_platform_procedures = __esm({
4303
4370
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
4304
4371
  domain: "tool-use",
4305
4372
  priority: "p1",
4306
- 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."
4373
+ 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."
4307
4374
  }
4308
4375
  ];
4309
4376
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -4324,7 +4391,7 @@ import { randomUUID as randomUUID3 } from "crypto";
4324
4391
  async function loadGlobalProcedures() {
4325
4392
  const client = getClient();
4326
4393
  const result = await client.execute({
4327
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4394
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4328
4395
  args: []
4329
4396
  });
4330
4397
  const allRows = result.rows;
@@ -4353,7 +4420,7 @@ async function storeGlobalProcedure(input2) {
4353
4420
  const now = (/* @__PURE__ */ new Date()).toISOString();
4354
4421
  const client = getClient();
4355
4422
  await client.execute({
4356
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4423
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4357
4424
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
4358
4425
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
4359
4426
  });
@@ -4364,7 +4431,7 @@ async function deactivateGlobalProcedure(id) {
4364
4431
  const now = (/* @__PURE__ */ new Date()).toISOString();
4365
4432
  const client = getClient();
4366
4433
  const result = await client.execute({
4367
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4434
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
4368
4435
  args: [now, id]
4369
4436
  });
4370
4437
  await loadGlobalProcedures();
@@ -2670,7 +2670,7 @@ async function ensureSchema() {
2670
2670
  ON session_kills(agent_id);
2671
2671
  `);
2672
2672
  await client.execute(`
2673
- CREATE TABLE IF NOT EXISTS global_procedures (
2673
+ CREATE TABLE IF NOT EXISTS company_procedures (
2674
2674
  id TEXT PRIMARY KEY,
2675
2675
  title TEXT NOT NULL,
2676
2676
  content TEXT NOT NULL,
@@ -2681,6 +2681,73 @@ async function ensureSchema() {
2681
2681
  updated_at TEXT NOT NULL
2682
2682
  )
2683
2683
  `);
2684
+ const legacyProcedureObject = await client.execute({
2685
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2686
+ args: []
2687
+ });
2688
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2689
+ if (legacyProcedureType === "table") {
2690
+ await client.execute(`
2691
+ INSERT OR IGNORE INTO company_procedures
2692
+ (id, title, content, priority, domain, active, created_at, updated_at)
2693
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2694
+ FROM global_procedures
2695
+ `);
2696
+ await client.executeMultiple(`
2697
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2698
+ AFTER INSERT ON global_procedures
2699
+ BEGIN
2700
+ INSERT OR IGNORE INTO company_procedures
2701
+ (id, title, content, priority, domain, active, created_at, updated_at)
2702
+ VALUES
2703
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2704
+ END;
2705
+
2706
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2707
+ AFTER UPDATE ON global_procedures
2708
+ BEGIN
2709
+ UPDATE company_procedures
2710
+ SET title = NEW.title,
2711
+ content = NEW.content,
2712
+ priority = NEW.priority,
2713
+ domain = NEW.domain,
2714
+ active = NEW.active,
2715
+ created_at = NEW.created_at,
2716
+ updated_at = NEW.updated_at
2717
+ WHERE id = OLD.id;
2718
+ END;
2719
+ `);
2720
+ } else {
2721
+ await client.execute(`
2722
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2723
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2724
+ FROM company_procedures
2725
+ `);
2726
+ await client.executeMultiple(`
2727
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2728
+ INSTEAD OF INSERT ON global_procedures
2729
+ BEGIN
2730
+ INSERT INTO company_procedures
2731
+ (id, title, content, priority, domain, active, created_at, updated_at)
2732
+ VALUES
2733
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2734
+ END;
2735
+
2736
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2737
+ INSTEAD OF UPDATE ON global_procedures
2738
+ BEGIN
2739
+ UPDATE company_procedures
2740
+ SET title = NEW.title,
2741
+ content = NEW.content,
2742
+ priority = NEW.priority,
2743
+ domain = NEW.domain,
2744
+ active = NEW.active,
2745
+ created_at = NEW.created_at,
2746
+ updated_at = NEW.updated_at
2747
+ WHERE id = OLD.id;
2748
+ END;
2749
+ `);
2750
+ }
2684
2751
  await client.executeMultiple(`
2685
2752
  CREATE TABLE IF NOT EXISTS conversations (
2686
2753
  id TEXT PRIMARY KEY,
@@ -4029,7 +4096,7 @@ var init_platform_procedures = __esm({
4029
4096
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
4030
4097
  domain: "tool-use",
4031
4098
  priority: "p1",
4032
- 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."
4099
+ 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."
4033
4100
  }
4034
4101
  ];
4035
4102
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -4050,7 +4117,7 @@ import { randomUUID as randomUUID2 } from "crypto";
4050
4117
  async function loadGlobalProcedures() {
4051
4118
  const client = getClient();
4052
4119
  const result = await client.execute({
4053
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4120
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4054
4121
  args: []
4055
4122
  });
4056
4123
  const allRows = result.rows;
@@ -4079,7 +4146,7 @@ async function storeGlobalProcedure(input2) {
4079
4146
  const now = (/* @__PURE__ */ new Date()).toISOString();
4080
4147
  const client = getClient();
4081
4148
  await client.execute({
4082
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4149
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4083
4150
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
4084
4151
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
4085
4152
  });
@@ -4090,7 +4157,7 @@ async function deactivateGlobalProcedure(id) {
4090
4157
  const now = (/* @__PURE__ */ new Date()).toISOString();
4091
4158
  const client = getClient();
4092
4159
  const result = await client.execute({
4093
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4160
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
4094
4161
  args: [now, id]
4095
4162
  });
4096
4163
  await loadGlobalProcedures();