@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
@@ -3082,7 +3082,7 @@ async function ensureSchema() {
3082
3082
  ON session_kills(agent_id);
3083
3083
  `);
3084
3084
  await client.execute(`
3085
- CREATE TABLE IF NOT EXISTS global_procedures (
3085
+ CREATE TABLE IF NOT EXISTS company_procedures (
3086
3086
  id TEXT PRIMARY KEY,
3087
3087
  title TEXT NOT NULL,
3088
3088
  content TEXT NOT NULL,
@@ -3093,6 +3093,73 @@ async function ensureSchema() {
3093
3093
  updated_at TEXT NOT NULL
3094
3094
  )
3095
3095
  `);
3096
+ const legacyProcedureObject = await client.execute({
3097
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
3098
+ args: []
3099
+ });
3100
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
3101
+ if (legacyProcedureType === "table") {
3102
+ await client.execute(`
3103
+ INSERT OR IGNORE INTO company_procedures
3104
+ (id, title, content, priority, domain, active, created_at, updated_at)
3105
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3106
+ FROM global_procedures
3107
+ `);
3108
+ await client.executeMultiple(`
3109
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
3110
+ AFTER INSERT ON global_procedures
3111
+ BEGIN
3112
+ INSERT OR IGNORE INTO company_procedures
3113
+ (id, title, content, priority, domain, active, created_at, updated_at)
3114
+ VALUES
3115
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3116
+ END;
3117
+
3118
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
3119
+ AFTER UPDATE ON global_procedures
3120
+ BEGIN
3121
+ UPDATE company_procedures
3122
+ SET title = NEW.title,
3123
+ content = NEW.content,
3124
+ priority = NEW.priority,
3125
+ domain = NEW.domain,
3126
+ active = NEW.active,
3127
+ created_at = NEW.created_at,
3128
+ updated_at = NEW.updated_at
3129
+ WHERE id = OLD.id;
3130
+ END;
3131
+ `);
3132
+ } else {
3133
+ await client.execute(`
3134
+ CREATE VIEW IF NOT EXISTS global_procedures AS
3135
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3136
+ FROM company_procedures
3137
+ `);
3138
+ await client.executeMultiple(`
3139
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
3140
+ INSTEAD OF INSERT ON global_procedures
3141
+ BEGIN
3142
+ INSERT INTO company_procedures
3143
+ (id, title, content, priority, domain, active, created_at, updated_at)
3144
+ VALUES
3145
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3146
+ END;
3147
+
3148
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
3149
+ INSTEAD OF UPDATE ON global_procedures
3150
+ BEGIN
3151
+ UPDATE company_procedures
3152
+ SET title = NEW.title,
3153
+ content = NEW.content,
3154
+ priority = NEW.priority,
3155
+ domain = NEW.domain,
3156
+ active = NEW.active,
3157
+ created_at = NEW.created_at,
3158
+ updated_at = NEW.updated_at
3159
+ WHERE id = OLD.id;
3160
+ END;
3161
+ `);
3162
+ }
3096
3163
  await client.executeMultiple(`
3097
3164
  CREATE TABLE IF NOT EXISTS conversations (
3098
3165
  id TEXT PRIMARY KEY,
@@ -7618,7 +7685,7 @@ var init_platform_procedures = __esm({
7618
7685
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
7619
7686
  domain: "tool-use",
7620
7687
  priority: "p1",
7621
- 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."
7688
+ 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."
7622
7689
  }
7623
7690
  ];
7624
7691
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -7639,7 +7706,7 @@ import { randomUUID as randomUUID3 } from "crypto";
7639
7706
  async function loadGlobalProcedures() {
7640
7707
  const client = getClient();
7641
7708
  const result = await client.execute({
7642
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
7709
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
7643
7710
  args: []
7644
7711
  });
7645
7712
  const allRows = result.rows;
@@ -7668,7 +7735,7 @@ async function storeGlobalProcedure(input2) {
7668
7735
  const now = (/* @__PURE__ */ new Date()).toISOString();
7669
7736
  const client = getClient();
7670
7737
  await client.execute({
7671
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
7738
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
7672
7739
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
7673
7740
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
7674
7741
  });
@@ -7679,7 +7746,7 @@ async function deactivateGlobalProcedure(id) {
7679
7746
  const now = (/* @__PURE__ */ new Date()).toISOString();
7680
7747
  const client = getClient();
7681
7748
  const result = await client.execute({
7682
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
7749
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
7683
7750
  args: [now, id]
7684
7751
  });
7685
7752
  await loadGlobalProcedures();
@@ -3088,7 +3088,7 @@ async function ensureSchema() {
3088
3088
  ON session_kills(agent_id);
3089
3089
  `);
3090
3090
  await client.execute(`
3091
- CREATE TABLE IF NOT EXISTS global_procedures (
3091
+ CREATE TABLE IF NOT EXISTS company_procedures (
3092
3092
  id TEXT PRIMARY KEY,
3093
3093
  title TEXT NOT NULL,
3094
3094
  content TEXT NOT NULL,
@@ -3099,6 +3099,73 @@ async function ensureSchema() {
3099
3099
  updated_at TEXT NOT NULL
3100
3100
  )
3101
3101
  `);
3102
+ const legacyProcedureObject = await client.execute({
3103
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
3104
+ args: []
3105
+ });
3106
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
3107
+ if (legacyProcedureType === "table") {
3108
+ await client.execute(`
3109
+ INSERT OR IGNORE INTO company_procedures
3110
+ (id, title, content, priority, domain, active, created_at, updated_at)
3111
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3112
+ FROM global_procedures
3113
+ `);
3114
+ await client.executeMultiple(`
3115
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
3116
+ AFTER INSERT ON global_procedures
3117
+ BEGIN
3118
+ INSERT OR IGNORE INTO company_procedures
3119
+ (id, title, content, priority, domain, active, created_at, updated_at)
3120
+ VALUES
3121
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3122
+ END;
3123
+
3124
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
3125
+ AFTER UPDATE ON global_procedures
3126
+ BEGIN
3127
+ UPDATE company_procedures
3128
+ SET title = NEW.title,
3129
+ content = NEW.content,
3130
+ priority = NEW.priority,
3131
+ domain = NEW.domain,
3132
+ active = NEW.active,
3133
+ created_at = NEW.created_at,
3134
+ updated_at = NEW.updated_at
3135
+ WHERE id = OLD.id;
3136
+ END;
3137
+ `);
3138
+ } else {
3139
+ await client.execute(`
3140
+ CREATE VIEW IF NOT EXISTS global_procedures AS
3141
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3142
+ FROM company_procedures
3143
+ `);
3144
+ await client.executeMultiple(`
3145
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
3146
+ INSTEAD OF INSERT ON global_procedures
3147
+ BEGIN
3148
+ INSERT INTO company_procedures
3149
+ (id, title, content, priority, domain, active, created_at, updated_at)
3150
+ VALUES
3151
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3152
+ END;
3153
+
3154
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
3155
+ INSTEAD OF UPDATE ON global_procedures
3156
+ BEGIN
3157
+ UPDATE company_procedures
3158
+ SET title = NEW.title,
3159
+ content = NEW.content,
3160
+ priority = NEW.priority,
3161
+ domain = NEW.domain,
3162
+ active = NEW.active,
3163
+ created_at = NEW.created_at,
3164
+ updated_at = NEW.updated_at
3165
+ WHERE id = OLD.id;
3166
+ END;
3167
+ `);
3168
+ }
3102
3169
  await client.executeMultiple(`
3103
3170
  CREATE TABLE IF NOT EXISTS conversations (
3104
3171
  id TEXT PRIMARY KEY,
@@ -4774,7 +4841,7 @@ var init_platform_procedures = __esm({
4774
4841
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
4775
4842
  domain: "tool-use",
4776
4843
  priority: "p1",
4777
- 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."
4844
+ 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."
4778
4845
  }
4779
4846
  ];
4780
4847
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -4795,7 +4862,7 @@ import { randomUUID as randomUUID3 } from "crypto";
4795
4862
  async function loadGlobalProcedures() {
4796
4863
  const client = getClient();
4797
4864
  const result = await client.execute({
4798
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4865
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4799
4866
  args: []
4800
4867
  });
4801
4868
  const allRows = result.rows;
@@ -4824,7 +4891,7 @@ async function storeGlobalProcedure(input2) {
4824
4891
  const now = (/* @__PURE__ */ new Date()).toISOString();
4825
4892
  const client = getClient();
4826
4893
  await client.execute({
4827
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4894
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4828
4895
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
4829
4896
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
4830
4897
  });
@@ -4835,7 +4902,7 @@ async function deactivateGlobalProcedure(id) {
4835
4902
  const now = (/* @__PURE__ */ new Date()).toISOString();
4836
4903
  const client = getClient();
4837
4904
  const result = await client.execute({
4838
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4905
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
4839
4906
  args: [now, id]
4840
4907
  });
4841
4908
  await loadGlobalProcedures();
@@ -2838,7 +2838,7 @@ async function ensureSchema() {
2838
2838
  ON session_kills(agent_id);
2839
2839
  `);
2840
2840
  await client.execute(`
2841
- CREATE TABLE IF NOT EXISTS global_procedures (
2841
+ CREATE TABLE IF NOT EXISTS company_procedures (
2842
2842
  id TEXT PRIMARY KEY,
2843
2843
  title TEXT NOT NULL,
2844
2844
  content TEXT NOT NULL,
@@ -2849,6 +2849,73 @@ async function ensureSchema() {
2849
2849
  updated_at TEXT NOT NULL
2850
2850
  )
2851
2851
  `);
2852
+ const legacyProcedureObject = await client.execute({
2853
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2854
+ args: []
2855
+ });
2856
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2857
+ if (legacyProcedureType === "table") {
2858
+ await client.execute(`
2859
+ INSERT OR IGNORE INTO company_procedures
2860
+ (id, title, content, priority, domain, active, created_at, updated_at)
2861
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2862
+ FROM global_procedures
2863
+ `);
2864
+ await client.executeMultiple(`
2865
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2866
+ AFTER INSERT ON global_procedures
2867
+ BEGIN
2868
+ INSERT OR IGNORE INTO company_procedures
2869
+ (id, title, content, priority, domain, active, created_at, updated_at)
2870
+ VALUES
2871
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2872
+ END;
2873
+
2874
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2875
+ AFTER UPDATE ON global_procedures
2876
+ BEGIN
2877
+ UPDATE company_procedures
2878
+ SET title = NEW.title,
2879
+ content = NEW.content,
2880
+ priority = NEW.priority,
2881
+ domain = NEW.domain,
2882
+ active = NEW.active,
2883
+ created_at = NEW.created_at,
2884
+ updated_at = NEW.updated_at
2885
+ WHERE id = OLD.id;
2886
+ END;
2887
+ `);
2888
+ } else {
2889
+ await client.execute(`
2890
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2891
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2892
+ FROM company_procedures
2893
+ `);
2894
+ await client.executeMultiple(`
2895
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2896
+ INSTEAD OF INSERT ON global_procedures
2897
+ BEGIN
2898
+ INSERT INTO company_procedures
2899
+ (id, title, content, priority, domain, active, created_at, updated_at)
2900
+ VALUES
2901
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2902
+ END;
2903
+
2904
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2905
+ INSTEAD OF UPDATE ON global_procedures
2906
+ BEGIN
2907
+ UPDATE company_procedures
2908
+ SET title = NEW.title,
2909
+ content = NEW.content,
2910
+ priority = NEW.priority,
2911
+ domain = NEW.domain,
2912
+ active = NEW.active,
2913
+ created_at = NEW.created_at,
2914
+ updated_at = NEW.updated_at
2915
+ WHERE id = OLD.id;
2916
+ END;
2917
+ `);
2918
+ }
2852
2919
  await client.executeMultiple(`
2853
2920
  CREATE TABLE IF NOT EXISTS conversations (
2854
2921
  id TEXT PRIMARY KEY,
@@ -4197,7 +4264,7 @@ var init_platform_procedures = __esm({
4197
4264
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
4198
4265
  domain: "tool-use",
4199
4266
  priority: "p1",
4200
- 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."
4267
+ 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."
4201
4268
  }
4202
4269
  ];
4203
4270
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -4218,7 +4285,7 @@ import { randomUUID as randomUUID2 } from "crypto";
4218
4285
  async function loadGlobalProcedures() {
4219
4286
  const client = getClient();
4220
4287
  const result = await client.execute({
4221
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4288
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4222
4289
  args: []
4223
4290
  });
4224
4291
  const allRows = result.rows;
@@ -4247,7 +4314,7 @@ async function storeGlobalProcedure(input2) {
4247
4314
  const now = (/* @__PURE__ */ new Date()).toISOString();
4248
4315
  const client = getClient();
4249
4316
  await client.execute({
4250
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4317
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4251
4318
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
4252
4319
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
4253
4320
  });
@@ -4258,7 +4325,7 @@ async function deactivateGlobalProcedure(id) {
4258
4325
  const now = (/* @__PURE__ */ new Date()).toISOString();
4259
4326
  const client = getClient();
4260
4327
  const result = await client.execute({
4261
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4328
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
4262
4329
  args: [now, id]
4263
4330
  });
4264
4331
  await loadGlobalProcedures();
@@ -3085,7 +3085,7 @@ async function ensureSchema() {
3085
3085
  ON session_kills(agent_id);
3086
3086
  `);
3087
3087
  await client.execute(`
3088
- CREATE TABLE IF NOT EXISTS global_procedures (
3088
+ CREATE TABLE IF NOT EXISTS company_procedures (
3089
3089
  id TEXT PRIMARY KEY,
3090
3090
  title TEXT NOT NULL,
3091
3091
  content TEXT NOT NULL,
@@ -3096,6 +3096,73 @@ async function ensureSchema() {
3096
3096
  updated_at TEXT NOT NULL
3097
3097
  )
3098
3098
  `);
3099
+ const legacyProcedureObject = await client.execute({
3100
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
3101
+ args: []
3102
+ });
3103
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
3104
+ if (legacyProcedureType === "table") {
3105
+ await client.execute(`
3106
+ INSERT OR IGNORE INTO company_procedures
3107
+ (id, title, content, priority, domain, active, created_at, updated_at)
3108
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3109
+ FROM global_procedures
3110
+ `);
3111
+ await client.executeMultiple(`
3112
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
3113
+ AFTER INSERT ON global_procedures
3114
+ BEGIN
3115
+ INSERT OR IGNORE INTO company_procedures
3116
+ (id, title, content, priority, domain, active, created_at, updated_at)
3117
+ VALUES
3118
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3119
+ END;
3120
+
3121
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
3122
+ AFTER UPDATE ON global_procedures
3123
+ BEGIN
3124
+ UPDATE company_procedures
3125
+ SET title = NEW.title,
3126
+ content = NEW.content,
3127
+ priority = NEW.priority,
3128
+ domain = NEW.domain,
3129
+ active = NEW.active,
3130
+ created_at = NEW.created_at,
3131
+ updated_at = NEW.updated_at
3132
+ WHERE id = OLD.id;
3133
+ END;
3134
+ `);
3135
+ } else {
3136
+ await client.execute(`
3137
+ CREATE VIEW IF NOT EXISTS global_procedures AS
3138
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
3139
+ FROM company_procedures
3140
+ `);
3141
+ await client.executeMultiple(`
3142
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
3143
+ INSTEAD OF INSERT ON global_procedures
3144
+ BEGIN
3145
+ INSERT INTO company_procedures
3146
+ (id, title, content, priority, domain, active, created_at, updated_at)
3147
+ VALUES
3148
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
3149
+ END;
3150
+
3151
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
3152
+ INSTEAD OF UPDATE ON global_procedures
3153
+ BEGIN
3154
+ UPDATE company_procedures
3155
+ SET title = NEW.title,
3156
+ content = NEW.content,
3157
+ priority = NEW.priority,
3158
+ domain = NEW.domain,
3159
+ active = NEW.active,
3160
+ created_at = NEW.created_at,
3161
+ updated_at = NEW.updated_at
3162
+ WHERE id = OLD.id;
3163
+ END;
3164
+ `);
3165
+ }
3099
3166
  await client.executeMultiple(`
3100
3167
  CREATE TABLE IF NOT EXISTS conversations (
3101
3168
  id TEXT PRIMARY KEY,
@@ -7827,7 +7894,7 @@ var init_platform_procedures = __esm({
7827
7894
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
7828
7895
  domain: "tool-use",
7829
7896
  priority: "p1",
7830
- 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."
7897
+ 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."
7831
7898
  }
7832
7899
  ];
7833
7900
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -7848,7 +7915,7 @@ import { randomUUID as randomUUID3 } from "crypto";
7848
7915
  async function loadGlobalProcedures() {
7849
7916
  const client = getClient();
7850
7917
  const result = await client.execute({
7851
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
7918
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
7852
7919
  args: []
7853
7920
  });
7854
7921
  const allRows = result.rows;
@@ -7877,7 +7944,7 @@ async function storeGlobalProcedure(input2) {
7877
7944
  const now = (/* @__PURE__ */ new Date()).toISOString();
7878
7945
  const client = getClient();
7879
7946
  await client.execute({
7880
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
7947
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
7881
7948
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
7882
7949
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
7883
7950
  });
@@ -7888,7 +7955,7 @@ async function deactivateGlobalProcedure(id) {
7888
7955
  const now = (/* @__PURE__ */ new Date()).toISOString();
7889
7956
  const client = getClient();
7890
7957
  const result = await client.execute({
7891
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
7958
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
7892
7959
  args: [now, id]
7893
7960
  });
7894
7961
  await loadGlobalProcedures();
@@ -2904,7 +2904,7 @@ async function ensureSchema() {
2904
2904
  ON session_kills(agent_id);
2905
2905
  `);
2906
2906
  await client.execute(`
2907
- CREATE TABLE IF NOT EXISTS global_procedures (
2907
+ CREATE TABLE IF NOT EXISTS company_procedures (
2908
2908
  id TEXT PRIMARY KEY,
2909
2909
  title TEXT NOT NULL,
2910
2910
  content TEXT NOT NULL,
@@ -2915,6 +2915,73 @@ async function ensureSchema() {
2915
2915
  updated_at TEXT NOT NULL
2916
2916
  )
2917
2917
  `);
2918
+ const legacyProcedureObject = await client.execute({
2919
+ sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
2920
+ args: []
2921
+ });
2922
+ const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
2923
+ if (legacyProcedureType === "table") {
2924
+ await client.execute(`
2925
+ INSERT OR IGNORE INTO company_procedures
2926
+ (id, title, content, priority, domain, active, created_at, updated_at)
2927
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2928
+ FROM global_procedures
2929
+ `);
2930
+ await client.executeMultiple(`
2931
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
2932
+ AFTER INSERT ON global_procedures
2933
+ BEGIN
2934
+ INSERT OR IGNORE INTO company_procedures
2935
+ (id, title, content, priority, domain, active, created_at, updated_at)
2936
+ VALUES
2937
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2938
+ END;
2939
+
2940
+ CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
2941
+ AFTER UPDATE ON global_procedures
2942
+ BEGIN
2943
+ UPDATE company_procedures
2944
+ SET title = NEW.title,
2945
+ content = NEW.content,
2946
+ priority = NEW.priority,
2947
+ domain = NEW.domain,
2948
+ active = NEW.active,
2949
+ created_at = NEW.created_at,
2950
+ updated_at = NEW.updated_at
2951
+ WHERE id = OLD.id;
2952
+ END;
2953
+ `);
2954
+ } else {
2955
+ await client.execute(`
2956
+ CREATE VIEW IF NOT EXISTS global_procedures AS
2957
+ SELECT id, title, content, priority, domain, active, created_at, updated_at
2958
+ FROM company_procedures
2959
+ `);
2960
+ await client.executeMultiple(`
2961
+ CREATE TRIGGER IF NOT EXISTS global_procedures_insert
2962
+ INSTEAD OF INSERT ON global_procedures
2963
+ BEGIN
2964
+ INSERT INTO company_procedures
2965
+ (id, title, content, priority, domain, active, created_at, updated_at)
2966
+ VALUES
2967
+ (NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
2968
+ END;
2969
+
2970
+ CREATE TRIGGER IF NOT EXISTS global_procedures_update
2971
+ INSTEAD OF UPDATE ON global_procedures
2972
+ BEGIN
2973
+ UPDATE company_procedures
2974
+ SET title = NEW.title,
2975
+ content = NEW.content,
2976
+ priority = NEW.priority,
2977
+ domain = NEW.domain,
2978
+ active = NEW.active,
2979
+ created_at = NEW.created_at,
2980
+ updated_at = NEW.updated_at
2981
+ WHERE id = OLD.id;
2982
+ END;
2983
+ `);
2984
+ }
2918
2985
  await client.executeMultiple(`
2919
2986
  CREATE TABLE IF NOT EXISTS conversations (
2920
2987
  id TEXT PRIMARY KEY,
@@ -4263,7 +4330,7 @@ var init_platform_procedures = __esm({
4263
4330
  title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
4264
4331
  domain: "tool-use",
4265
4332
  priority: "p1",
4266
- 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."
4333
+ 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."
4267
4334
  }
4268
4335
  ];
4269
4336
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -4284,7 +4351,7 @@ import { randomUUID as randomUUID2 } from "crypto";
4284
4351
  async function loadGlobalProcedures() {
4285
4352
  const client = getClient();
4286
4353
  const result = await client.execute({
4287
- sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4354
+ sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
4288
4355
  args: []
4289
4356
  });
4290
4357
  const allRows = result.rows;
@@ -4313,7 +4380,7 @@ async function storeGlobalProcedure(input2) {
4313
4380
  const now = (/* @__PURE__ */ new Date()).toISOString();
4314
4381
  const client = getClient();
4315
4382
  await client.execute({
4316
- sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4383
+ sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
4317
4384
  VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
4318
4385
  args: [id, input2.title, input2.content, input2.priority ?? "p0", input2.domain ?? null, now, now]
4319
4386
  });
@@ -4324,7 +4391,7 @@ async function deactivateGlobalProcedure(id) {
4324
4391
  const now = (/* @__PURE__ */ new Date()).toISOString();
4325
4392
  const client = getClient();
4326
4393
  const result = await client.execute({
4327
- sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
4394
+ sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
4328
4395
  args: [now, id]
4329
4396
  });
4330
4397
  await loadGlobalProcedures();