@askexenow/exe-os 0.9.64 → 0.9.66

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 (105) hide show
  1. package/deploy/stack-manifests/v0.9.json +4 -4
  2. package/dist/bin/backfill-conversations.js +22 -0
  3. package/dist/bin/backfill-responses.js +22 -0
  4. package/dist/bin/backfill-vectors.js +22 -0
  5. package/dist/bin/cleanup-stale-review-tasks.js +22 -0
  6. package/dist/bin/cli.js +2280 -1199
  7. package/dist/bin/exe-agent-config.js +4 -0
  8. package/dist/bin/exe-agent.js +16 -0
  9. package/dist/bin/exe-assign.js +22 -0
  10. package/dist/bin/exe-boot.js +116 -7
  11. package/dist/bin/exe-call.js +16 -0
  12. package/dist/bin/exe-cloud.js +6671 -464
  13. package/dist/bin/exe-dispatch.js +24 -0
  14. package/dist/bin/exe-doctor.js +2845 -1223
  15. package/dist/bin/exe-export-behaviors.js +24 -0
  16. package/dist/bin/exe-forget.js +22 -0
  17. package/dist/bin/exe-gateway.js +24 -0
  18. package/dist/bin/exe-heartbeat.js +23 -0
  19. package/dist/bin/exe-kill.js +22 -0
  20. package/dist/bin/exe-launch-agent.js +24 -0
  21. package/dist/bin/exe-link.js +310 -178
  22. package/dist/bin/exe-new-employee.js +127 -1
  23. package/dist/bin/exe-pending-messages.js +22 -0
  24. package/dist/bin/exe-pending-notifications.js +22 -0
  25. package/dist/bin/exe-pending-reviews.js +22 -0
  26. package/dist/bin/exe-rename.js +22 -0
  27. package/dist/bin/exe-review.js +22 -0
  28. package/dist/bin/exe-search.js +24 -0
  29. package/dist/bin/exe-session-cleanup.js +24 -0
  30. package/dist/bin/exe-settings.js +10 -0
  31. package/dist/bin/exe-start-codex.js +135 -1
  32. package/dist/bin/exe-start-opencode.js +149 -1
  33. package/dist/bin/exe-status.js +22 -0
  34. package/dist/bin/exe-team.js +22 -0
  35. package/dist/bin/git-sweep.js +24 -0
  36. package/dist/bin/graph-backfill.js +22 -0
  37. package/dist/bin/graph-export.js +22 -0
  38. package/dist/bin/install.js +115 -1
  39. package/dist/bin/intercom-check.js +24 -0
  40. package/dist/bin/scan-tasks.js +24 -0
  41. package/dist/bin/setup.js +412 -157
  42. package/dist/bin/shard-migrate.js +22 -0
  43. package/dist/bin/update.js +4 -0
  44. package/dist/gateway/index.js +24 -0
  45. package/dist/hooks/bug-report-worker.js +135 -42
  46. package/dist/hooks/codex-stop-task-finalizer.js +24 -0
  47. package/dist/hooks/commit-complete.js +24 -0
  48. package/dist/hooks/error-recall.js +24 -0
  49. package/dist/hooks/exe-heartbeat-hook.js +4 -0
  50. package/dist/hooks/ingest-worker.js +4 -0
  51. package/dist/hooks/ingest.js +23 -0
  52. package/dist/hooks/instructions-loaded.js +22 -0
  53. package/dist/hooks/notification.js +22 -0
  54. package/dist/hooks/post-compact.js +22 -0
  55. package/dist/hooks/post-tool-combined.js +24 -0
  56. package/dist/hooks/pre-compact.js +260 -109
  57. package/dist/hooks/pre-tool-use.js +22 -0
  58. package/dist/hooks/prompt-submit.js +24 -0
  59. package/dist/hooks/session-end.js +161 -122
  60. package/dist/hooks/session-start.js +142 -0
  61. package/dist/hooks/stop.js +23 -0
  62. package/dist/hooks/subagent-stop.js +22 -0
  63. package/dist/hooks/summary-worker.js +195 -79
  64. package/dist/index.js +24 -0
  65. package/dist/lib/agent-config.js +4 -0
  66. package/dist/lib/cloud-sync.js +50 -6
  67. package/dist/lib/config.js +12 -0
  68. package/dist/lib/consolidation.js +4 -0
  69. package/dist/lib/database.js +4 -0
  70. package/dist/lib/db-daemon-client.js +4 -0
  71. package/dist/lib/db.js +4 -0
  72. package/dist/lib/device-registry.js +4 -0
  73. package/dist/lib/embedder.js +12 -0
  74. package/dist/lib/employee-templates.js +16 -0
  75. package/dist/lib/employees.js +4 -0
  76. package/dist/lib/exe-daemon-client.js +4 -0
  77. package/dist/lib/exe-daemon.js +1144 -480
  78. package/dist/lib/hybrid-search.js +24 -0
  79. package/dist/lib/identity.js +4 -0
  80. package/dist/lib/license.js +4 -0
  81. package/dist/lib/messaging.js +4 -0
  82. package/dist/lib/reminders.js +4 -0
  83. package/dist/lib/schedules.js +22 -0
  84. package/dist/lib/skill-learning.js +12 -0
  85. package/dist/lib/status-brief.js +39 -0
  86. package/dist/lib/store.js +22 -0
  87. package/dist/lib/task-router.js +4 -0
  88. package/dist/lib/tasks.js +12 -0
  89. package/dist/lib/tmux-routing.js +12 -0
  90. package/dist/lib/token-spend.js +4 -0
  91. package/dist/mcp/server.js +1045 -427
  92. package/dist/mcp/tools/complete-reminder.js +4 -0
  93. package/dist/mcp/tools/create-reminder.js +4 -0
  94. package/dist/mcp/tools/create-task.js +12 -0
  95. package/dist/mcp/tools/deactivate-behavior.js +4 -0
  96. package/dist/mcp/tools/list-reminders.js +4 -0
  97. package/dist/mcp/tools/list-tasks.js +4 -0
  98. package/dist/mcp/tools/send-message.js +4 -0
  99. package/dist/mcp/tools/update-task.js +12 -0
  100. package/dist/runtime/index.js +24 -0
  101. package/dist/tui/App.js +24 -0
  102. package/package.json +3 -2
  103. package/src/commands/exe/cloud.md +15 -8
  104. package/src/commands/exe/link.md +7 -6
  105. package/stack.release.json +2 -2
@@ -181,6 +181,10 @@ var init_config = __esm({
181
181
  checkOnBoot: true,
182
182
  autoInstall: false,
183
183
  checkIntervalMs: 24 * 60 * 60 * 1e3
184
+ },
185
+ orchestration: {
186
+ phase: "phase_1_coo",
187
+ phaseSetBy: "default"
184
188
  }
185
189
  };
186
190
  }
@@ -3421,31 +3425,43 @@ var ROSTER_LOCK_PATH = path10.join(EXE_AI_DIR, "roster-merge.lock");
3421
3425
  var LOCK_STALE_MS = 3e4;
3422
3426
  var _pgPromise = null;
3423
3427
  var _pgFailed = false;
3428
+ function isTruthyEnv(value) {
3429
+ return /^(1|true|yes|on)$/i.test(value ?? "");
3430
+ }
3424
3431
  function loadPgClient() {
3425
3432
  if (_pgFailed) return null;
3426
- const postgresUrl = process.env.DATABASE_URL;
3427
3433
  const configPath = path10.join(EXE_AI_DIR, "config.json");
3428
3434
  let cloudPostgresUrl;
3435
+ let configEnabled = false;
3429
3436
  try {
3430
3437
  if (existsSync10(configPath)) {
3431
3438
  const cfg = JSON.parse(readFileSync7(configPath, "utf8"));
3432
3439
  cloudPostgresUrl = cfg.cloud?.postgresUrl;
3433
- if (cfg.cloud?.syncToPostgres === false) {
3434
- _pgFailed = true;
3435
- return null;
3436
- }
3440
+ configEnabled = cfg.cloud?.syncToPostgres === true;
3437
3441
  }
3438
3442
  } catch {
3439
3443
  }
3440
- const url = postgresUrl || cloudPostgresUrl;
3444
+ const envEnabled = isTruthyEnv(process.env.EXE_CLOUD_SYNC_TO_POSTGRES);
3445
+ if (!envEnabled && !configEnabled) {
3446
+ return null;
3447
+ }
3448
+ const url = process.env.DATABASE_URL || cloudPostgresUrl;
3441
3449
  if (!url) {
3442
3450
  _pgFailed = true;
3443
3451
  return null;
3444
3452
  }
3445
3453
  if (!_pgPromise) {
3446
3454
  _pgPromise = (async () => {
3455
+ if (!process.env.DATABASE_URL) process.env.DATABASE_URL = url;
3447
3456
  const { createRequire: createRequire3 } = await import("module");
3448
3457
  const { pathToFileURL: pathToFileURL3 } = await import("url");
3458
+ const explicitPath = process.env.EXE_OS_PRISMA_CLIENT_PATH;
3459
+ if (explicitPath) {
3460
+ const mod2 = await import(pathToFileURL3(explicitPath).href);
3461
+ const Ctor2 = mod2.PrismaClient ?? mod2.default?.PrismaClient;
3462
+ if (!Ctor2) throw new Error(`No PrismaClient at ${explicitPath}`);
3463
+ return new Ctor2();
3464
+ }
3449
3465
  const exeDbRoot = process.env.EXE_DB_ROOT ?? path10.join(homedir2(), "exe-db");
3450
3466
  const req = createRequire3(path10.join(exeDbRoot, "package.json"));
3451
3467
  const entry = req.resolve("@prisma/client");
@@ -3622,6 +3638,25 @@ async function cloudPull(sinceVersion, config) {
3622
3638
  return { records: [], maxVersion: sinceVersion };
3623
3639
  }
3624
3640
  }
3641
+ var CLOUD_RELINK_REQUIRED_MESSAGE = "[cloud-sync] Paused after key rotation. Run `exe-os cloud relink --dry-run` for the safe relink checklist.";
3642
+ async function getCloudRelinkRequired(client = getClient()) {
3643
+ try {
3644
+ await client.execute("CREATE TABLE IF NOT EXISTS sync_meta (key TEXT PRIMARY KEY, value TEXT NOT NULL)");
3645
+ const relink = await client.execute("SELECT value FROM sync_meta WHERE key = 'cloud_relink_required' LIMIT 1");
3646
+ return String(relink.rows[0]?.value ?? "") === "1";
3647
+ } catch {
3648
+ return false;
3649
+ }
3650
+ }
3651
+ async function clearCloudRelinkRequired(client = getClient()) {
3652
+ await client.execute("CREATE TABLE IF NOT EXISTS sync_meta (key TEXT PRIMARY KEY, value TEXT NOT NULL)");
3653
+ await client.execute("INSERT OR REPLACE INTO sync_meta (key, value) VALUES ('cloud_relink_required', '0')");
3654
+ await client.execute({
3655
+ sql: "INSERT OR REPLACE INTO sync_meta (key, value) VALUES ('cloud_relinked_at', ?)",
3656
+ args: [(/* @__PURE__ */ new Date()).toISOString()]
3657
+ });
3658
+ await client.execute("DELETE FROM sync_meta WHERE key IN ('last_cloud_pull_version', 'last_cloud_push_version')");
3659
+ }
3625
3660
  async function cloudSync(config) {
3626
3661
  if (!isSyncCryptoInitialized()) {
3627
3662
  try {
@@ -3642,6 +3677,12 @@ async function cloudSync(config) {
3642
3677
  } catch {
3643
3678
  throw new Error("[cloud-sync] Database not initialized. Call initStore() before cloudSync().");
3644
3679
  }
3680
+ try {
3681
+ if (await getCloudRelinkRequired(client)) throw new Error(CLOUD_RELINK_REQUIRED_MESSAGE);
3682
+ } catch (err) {
3683
+ const msg = err instanceof Error ? err.message : String(err);
3684
+ if (msg.includes("Paused after key rotation")) throw err;
3685
+ }
3645
3686
  try {
3646
3687
  const { getRawClient: getRawClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
3647
3688
  await getRawClient2().execute("PRAGMA wal_checkpoint(PASSIVE)");
@@ -4571,8 +4612,10 @@ async function cloudPullDocuments(config) {
4571
4612
  return { pulled };
4572
4613
  }
4573
4614
  export {
4615
+ CLOUD_RELINK_REQUIRED_MESSAGE,
4574
4616
  assertSecureEndpoint,
4575
4617
  buildRosterBlob,
4618
+ clearCloudRelinkRequired,
4576
4619
  cloudPull,
4577
4620
  cloudPullBehaviors,
4578
4621
  cloudPullBlob,
@@ -4592,6 +4635,7 @@ export {
4592
4635
  cloudPushRoster,
4593
4636
  cloudPushTasks,
4594
4637
  cloudSync,
4638
+ getCloudRelinkRequired,
4595
4639
  mergeConfig,
4596
4640
  mergeRosterFromRemote,
4597
4641
  pushToPostgres,
@@ -101,6 +101,10 @@ var DEFAULT_CONFIG = {
101
101
  checkOnBoot: true,
102
102
  autoInstall: false,
103
103
  checkIntervalMs: 24 * 60 * 60 * 1e3
104
+ },
105
+ orchestration: {
106
+ phase: "phase_1_coo",
107
+ phaseSetBy: "default"
104
108
  }
105
109
  };
106
110
  function migrateLegacyConfig(raw) {
@@ -163,6 +167,11 @@ function normalizeAutoUpdate(raw) {
163
167
  const userAU = raw.autoUpdate ?? {};
164
168
  raw.autoUpdate = { ...defaultAU, ...userAU };
165
169
  }
170
+ function normalizeOrchestration(raw) {
171
+ const defaultOrg = DEFAULT_CONFIG.orchestration;
172
+ const userOrg = raw.orchestration ?? {};
173
+ raw.orchestration = { ...defaultOrg, ...userOrg };
174
+ }
166
175
  async function loadConfig() {
167
176
  const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
168
177
  await ensurePrivateDir(dir);
@@ -187,6 +196,7 @@ async function loadConfig() {
187
196
  normalizeScalingRoadmap(migratedCfg);
188
197
  normalizeSessionLifecycle(migratedCfg);
189
198
  normalizeAutoUpdate(migratedCfg);
199
+ normalizeOrchestration(migratedCfg);
190
200
  const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
191
201
  if (config.dbPath.startsWith("~")) {
192
202
  config.dbPath = config.dbPath.replace(/^~/, os.homedir());
@@ -210,6 +220,7 @@ function loadConfigSync() {
210
220
  normalizeScalingRoadmap(migratedCfg);
211
221
  normalizeSessionLifecycle(migratedCfg);
212
222
  normalizeAutoUpdate(migratedCfg);
223
+ normalizeOrchestration(migratedCfg);
213
224
  return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
214
225
  } catch {
215
226
  return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
@@ -231,6 +242,7 @@ async function loadConfigFrom(configPath) {
231
242
  normalizeScalingRoadmap(migratedCfg);
232
243
  normalizeSessionLifecycle(migratedCfg);
233
244
  normalizeAutoUpdate(migratedCfg);
245
+ normalizeOrchestration(migratedCfg);
234
246
  return { ...DEFAULT_CONFIG, ...migratedCfg };
235
247
  } catch {
236
248
  return { ...DEFAULT_CONFIG };
@@ -134,6 +134,10 @@ var init_config = __esm({
134
134
  checkOnBoot: true,
135
135
  autoInstall: false,
136
136
  checkIntervalMs: 24 * 60 * 60 * 1e3
137
+ },
138
+ orchestration: {
139
+ phase: "phase_1_coo",
140
+ phaseSetBy: "default"
137
141
  }
138
142
  };
139
143
  }
@@ -126,6 +126,10 @@ var init_config = __esm({
126
126
  checkOnBoot: true,
127
127
  autoInstall: false,
128
128
  checkIntervalMs: 24 * 60 * 60 * 1e3
129
+ },
130
+ orchestration: {
131
+ phase: "phase_1_coo",
132
+ phaseSetBy: "default"
129
133
  }
130
134
  };
131
135
  }
@@ -117,6 +117,10 @@ var DEFAULT_CONFIG = {
117
117
  checkOnBoot: true,
118
118
  autoInstall: false,
119
119
  checkIntervalMs: 24 * 60 * 60 * 1e3
120
+ },
121
+ orchestration: {
122
+ phase: "phase_1_coo",
123
+ phaseSetBy: "default"
120
124
  }
121
125
  };
122
126
 
package/dist/lib/db.js CHANGED
@@ -126,6 +126,10 @@ var init_config = __esm({
126
126
  checkOnBoot: true,
127
127
  autoInstall: false,
128
128
  checkIntervalMs: 24 * 60 * 60 * 1e3
129
+ },
130
+ orchestration: {
131
+ phase: "phase_1_coo",
132
+ phaseSetBy: "default"
129
133
  }
130
134
  };
131
135
  }
@@ -126,6 +126,10 @@ var init_config = __esm({
126
126
  checkOnBoot: true,
127
127
  autoInstall: false,
128
128
  checkIntervalMs: 24 * 60 * 60 * 1e3
129
+ },
130
+ orchestration: {
131
+ phase: "phase_1_coo",
132
+ phaseSetBy: "default"
129
133
  }
130
134
  };
131
135
  }
@@ -138,6 +138,11 @@ function normalizeAutoUpdate(raw) {
138
138
  const userAU = raw.autoUpdate ?? {};
139
139
  raw.autoUpdate = { ...defaultAU, ...userAU };
140
140
  }
141
+ function normalizeOrchestration(raw) {
142
+ const defaultOrg = DEFAULT_CONFIG.orchestration;
143
+ const userOrg = raw.orchestration ?? {};
144
+ raw.orchestration = { ...defaultOrg, ...userOrg };
145
+ }
141
146
  async function loadConfig() {
142
147
  const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
143
148
  await ensurePrivateDir(dir);
@@ -162,6 +167,7 @@ async function loadConfig() {
162
167
  normalizeScalingRoadmap(migratedCfg);
163
168
  normalizeSessionLifecycle(migratedCfg);
164
169
  normalizeAutoUpdate(migratedCfg);
170
+ normalizeOrchestration(migratedCfg);
165
171
  const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
166
172
  if (config.dbPath.startsWith("~")) {
167
173
  config.dbPath = config.dbPath.replace(/^~/, os.homedir());
@@ -185,6 +191,7 @@ function loadConfigSync() {
185
191
  normalizeScalingRoadmap(migratedCfg);
186
192
  normalizeSessionLifecycle(migratedCfg);
187
193
  normalizeAutoUpdate(migratedCfg);
194
+ normalizeOrchestration(migratedCfg);
188
195
  return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
189
196
  } catch {
190
197
  return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
@@ -206,6 +213,7 @@ async function loadConfigFrom(configPath) {
206
213
  normalizeScalingRoadmap(migratedCfg);
207
214
  normalizeSessionLifecycle(migratedCfg);
208
215
  normalizeAutoUpdate(migratedCfg);
216
+ normalizeOrchestration(migratedCfg);
209
217
  return { ...DEFAULT_CONFIG, ...migratedCfg };
210
218
  } catch {
211
219
  return { ...DEFAULT_CONFIG };
@@ -277,6 +285,10 @@ var init_config = __esm({
277
285
  checkOnBoot: true,
278
286
  autoInstall: false,
279
287
  checkIntervalMs: 24 * 60 * 60 * 1e3
288
+ },
289
+ orchestration: {
290
+ phase: "phase_1_coo",
291
+ phaseSetBy: "default"
280
292
  }
281
293
  };
282
294
  CONFIG_MIGRATIONS = [
@@ -99,6 +99,10 @@ var init_config = __esm({
99
99
  checkOnBoot: true,
100
100
  autoInstall: false,
101
101
  checkIntervalMs: 24 * 60 * 60 * 1e3
102
+ },
103
+ orchestration: {
104
+ phase: "phase_1_coo",
105
+ phaseSetBy: "default"
102
106
  }
103
107
  };
104
108
  }
@@ -169,6 +173,12 @@ var PLATFORM_PROCEDURES = [
169
173
  priority: "p0",
170
174
  content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
171
175
  },
176
+ {
177
+ title: "Customer orchestration maturity \u2014 recommend, never trap",
178
+ domain: "workflow",
179
+ priority: "p1",
180
+ content: "New customers start best in Phase 1: founder \u2194 coordinator/Chief of Staff, building company context. Suggest Phase 2 executives when domain work repeats; suggest Phase 3 parallel execution only when review/permission gates are ready. This is guidance, not a blocker: users may jump phases anytime. Never overwrite their phase, role titles, identities, or custom org design."
181
+ },
172
182
  {
173
183
  title: "Single dispatch path \u2014 create_task only",
174
184
  domain: "workflow",
@@ -227,6 +237,12 @@ var PLATFORM_PROCEDURES = [
227
237
  priority: "p0",
228
238
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
229
239
  },
240
+ {
241
+ title: "Commit discipline \u2014 never leave verified work floating",
242
+ domain: "workflow",
243
+ priority: "p1",
244
+ content: "After any code-change batch passes typecheck/tests/build, run git status, summarize changed files, and commit with a clear message before ending the session. If work must remain uncommitted for review/dogfood, explicitly say so, list the files, and state the blocker. Never imply work is complete while verified changes are still floating locally."
245
+ },
230
246
  {
231
247
  title: "Desktop and TUI are the same product",
232
248
  domain: "architecture",
@@ -120,6 +120,10 @@ var init_config = __esm({
120
120
  checkOnBoot: true,
121
121
  autoInstall: false,
122
122
  checkIntervalMs: 24 * 60 * 60 * 1e3
123
+ },
124
+ orchestration: {
125
+ phase: "phase_1_coo",
126
+ phaseSetBy: "default"
123
127
  }
124
128
  };
125
129
  }
@@ -117,6 +117,10 @@ var DEFAULT_CONFIG = {
117
117
  checkOnBoot: true,
118
118
  autoInstall: false,
119
119
  checkIntervalMs: 24 * 60 * 60 * 1e3
120
+ },
121
+ orchestration: {
122
+ phase: "phase_1_coo",
123
+ phaseSetBy: "default"
120
124
  }
121
125
  };
122
126