@askexenow/exe-os 0.9.86 → 0.9.88

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 (103) hide show
  1. package/deploy/compose/docker-compose.yml +3 -3
  2. package/dist/bin/age-ontology-load.js +8 -2
  3. package/dist/bin/agentic-ontology-backfill.js +29 -0
  4. package/dist/bin/agentic-reflection-backfill.js +29 -0
  5. package/dist/bin/agentic-semantic-label.js +29 -0
  6. package/dist/bin/backfill-conversations.js +30 -0
  7. package/dist/bin/backfill-responses.js +30 -0
  8. package/dist/bin/backfill-vectors.js +30 -0
  9. package/dist/bin/bulk-sync-postgres.js +47 -1
  10. package/dist/bin/cc-doctor.js +3 -2
  11. package/dist/bin/cleanup-stale-review-tasks.js +30 -0
  12. package/dist/bin/cli.js +357 -19
  13. package/dist/bin/exe-agent.js +19 -0
  14. package/dist/bin/exe-assign.js +30 -0
  15. package/dist/bin/exe-boot.js +157 -4
  16. package/dist/bin/exe-call.js +20 -0
  17. package/dist/bin/exe-cloud.js +156 -3
  18. package/dist/bin/exe-dispatch.js +30 -1
  19. package/dist/bin/exe-doctor.js +30 -0
  20. package/dist/bin/exe-export-behaviors.js +29 -0
  21. package/dist/bin/exe-forget.js +30 -0
  22. package/dist/bin/exe-gateway.js +150 -35
  23. package/dist/bin/exe-healthcheck.js +2 -1
  24. package/dist/bin/exe-heartbeat.js +30 -0
  25. package/dist/bin/exe-kill.js +29 -0
  26. package/dist/bin/exe-launch-agent.js +29 -0
  27. package/dist/bin/exe-new-employee.js +37 -4
  28. package/dist/bin/exe-pending-messages.js +29 -0
  29. package/dist/bin/exe-pending-notifications.js +30 -0
  30. package/dist/bin/exe-pending-reviews.js +30 -0
  31. package/dist/bin/exe-rename.js +30 -0
  32. package/dist/bin/exe-review.js +30 -0
  33. package/dist/bin/exe-search.js +30 -0
  34. package/dist/bin/exe-session-cleanup.js +30 -1
  35. package/dist/bin/exe-settings.js +3 -0
  36. package/dist/bin/exe-start-codex.js +31 -2
  37. package/dist/bin/exe-start-opencode.js +31 -2
  38. package/dist/bin/exe-status.js +30 -0
  39. package/dist/bin/exe-team.js +30 -0
  40. package/dist/bin/git-sweep.js +30 -1
  41. package/dist/bin/graph-backfill.js +29 -0
  42. package/dist/bin/graph-export.js +29 -0
  43. package/dist/bin/graph-layer-benchmark.js +9 -1
  44. package/dist/bin/install.js +9 -0
  45. package/dist/bin/intercom-check.js +31 -1
  46. package/dist/bin/list-providers.js +1 -0
  47. package/dist/bin/postgres-agentic-reflection-backfill.js +7 -1
  48. package/dist/bin/postgres-agentic-semantic-backfill.js +7 -1
  49. package/dist/bin/registry-proxy.js +1 -0
  50. package/dist/bin/scan-tasks.js +31 -1
  51. package/dist/bin/setup.js +165 -9
  52. package/dist/bin/shard-migrate.js +29 -0
  53. package/dist/bin/stack-update.js +24 -7
  54. package/dist/bin/update.js +5 -0
  55. package/dist/gateway/index.js +30 -1
  56. package/dist/hooks/bug-report-worker.js +30 -1
  57. package/dist/hooks/codex-stop-task-finalizer.js +30 -1
  58. package/dist/hooks/commit-complete.js +30 -1
  59. package/dist/hooks/error-recall.js +29 -0
  60. package/dist/hooks/ingest.js +29 -0
  61. package/dist/hooks/instructions-loaded.js +29 -0
  62. package/dist/hooks/notification.js +29 -0
  63. package/dist/hooks/post-compact.js +29 -0
  64. package/dist/hooks/post-tool-combined.js +29 -0
  65. package/dist/hooks/pre-compact.js +30 -1
  66. package/dist/hooks/pre-tool-use.js +29 -0
  67. package/dist/hooks/prompt-submit.js +30 -1
  68. package/dist/hooks/session-end.js +30 -1
  69. package/dist/hooks/session-start.js +29 -0
  70. package/dist/hooks/stop.js +29 -0
  71. package/dist/hooks/subagent-stop.js +29 -0
  72. package/dist/hooks/summary-worker.js +155 -3
  73. package/dist/index.js +30 -1
  74. package/dist/lib/cloud-sync.js +136 -2
  75. package/dist/lib/consolidation.js +1 -0
  76. package/dist/lib/database.js +11 -0
  77. package/dist/lib/db.js +11 -0
  78. package/dist/lib/device-registry.js +11 -0
  79. package/dist/lib/employee-templates.js +19 -0
  80. package/dist/lib/exe-daemon.js +1455 -208
  81. package/dist/lib/hybrid-search.js +29 -0
  82. package/dist/lib/identity-templates.js +6 -2
  83. package/dist/lib/identity.js +1 -0
  84. package/dist/lib/messaging.js +2 -1
  85. package/dist/lib/reminders.js +1 -0
  86. package/dist/lib/schedules.js +29 -0
  87. package/dist/lib/skill-learning.js +1 -0
  88. package/dist/lib/store.js +29 -0
  89. package/dist/lib/tasks.js +2 -1
  90. package/dist/lib/tmux-routing.js +2 -1
  91. package/dist/lib/token-spend.js +1 -0
  92. package/dist/mcp/server.js +1278 -165
  93. package/dist/mcp/tools/complete-reminder.js +1 -0
  94. package/dist/mcp/tools/create-reminder.js +1 -0
  95. package/dist/mcp/tools/create-task.js +8 -3
  96. package/dist/mcp/tools/deactivate-behavior.js +1 -0
  97. package/dist/mcp/tools/list-reminders.js +1 -0
  98. package/dist/mcp/tools/list-tasks.js +1 -0
  99. package/dist/mcp/tools/send-message.js +2 -1
  100. package/dist/mcp/tools/update-task.js +2 -1
  101. package/dist/runtime/index.js +30 -1
  102. package/dist/tui/App.js +30 -1
  103. package/package.json +2 -2
@@ -115,6 +115,12 @@ var init_config = __esm({
115
115
  // src/bin/postgres-agentic-reflection-backfill.ts
116
116
  import { Client } from "pg";
117
117
 
118
+ // src/lib/pg-ssl.ts
119
+ function pgSslConfig() {
120
+ if (process.env.EXE_DB_SSL_DISABLED === "true") return {};
121
+ return { ssl: { rejectUnauthorized: process.env.EXE_DB_SSL_ALLOW_SELFSIGNED !== "true" } };
122
+ }
123
+
118
124
  // src/lib/agentic-ontology.ts
119
125
  import { createHash } from "crypto";
120
126
  function stableId(...parts) {
@@ -391,7 +397,7 @@ async function main() {
391
397
  const windowSize = Number(arg("--window") ?? "100");
392
398
  const minEvents = Number(arg("--min-events") ?? "20");
393
399
  const project = arg("--project");
394
- const client = new Client({ connectionString: url });
400
+ const client = new Client({ connectionString: url, ...pgSslConfig() });
395
401
  await client.connect();
396
402
  try {
397
403
  await ensureSchema(client);
@@ -115,6 +115,12 @@ var init_config = __esm({
115
115
  // src/bin/postgres-agentic-semantic-backfill.ts
116
116
  import { Client } from "pg";
117
117
 
118
+ // src/lib/pg-ssl.ts
119
+ function pgSslConfig() {
120
+ if (process.env.EXE_DB_SSL_DISABLED === "true") return {};
121
+ return { ssl: { rejectUnauthorized: process.env.EXE_DB_SSL_ALLOW_SELFSIGNED !== "true" } };
122
+ }
123
+
118
124
  // src/lib/agentic-ontology.ts
119
125
  import { createHash } from "crypto";
120
126
  function stableId(...parts) {
@@ -432,7 +438,7 @@ async function main() {
432
438
  if (!url) throw new Error("DATABASE_URL or EXED_DATABASE_URL is required");
433
439
  const limit = Number(arg("--limit") ?? "20000");
434
440
  const project = arg("--project");
435
- const client = new Client({ connectionString: url });
441
+ const client = new Client({ connectionString: url, ...pgSslConfig() });
436
442
  await client.connect();
437
443
  try {
438
444
  await ensureSchema(client);
@@ -6,6 +6,7 @@ import { fileURLToPath } from "url";
6
6
  function isMainModule(importMetaUrl) {
7
7
  if (process.argv[1] == null) return false;
8
8
  if (process.argv[1].includes("mcp/server")) return false;
9
+ if (process.argv[1].includes("exe-daemon")) return false;
9
10
  try {
10
11
  const scriptPath = realpathSync(process.argv[1]);
11
12
  const modulePath = realpathSync(fileURLToPath(importMetaUrl));
@@ -724,7 +724,7 @@ function readQueue() {
724
724
  function writeQueue(queue) {
725
725
  ensureDir();
726
726
  const tmp = `${QUEUE_PATH}.tmp`;
727
- writeFileSync3(tmp, JSON.stringify(queue, null, 2));
727
+ writeFileSync3(tmp, JSON.stringify(queue, null, 2), { mode: 384 });
728
728
  renameSync2(tmp, QUEUE_PATH);
729
729
  }
730
730
  function queueIntercom(targetSession, reason) {
@@ -2303,6 +2303,7 @@ __export(database_exports, {
2303
2303
  isInitialized: () => isInitialized,
2304
2304
  setExternalClient: () => setExternalClient
2305
2305
  });
2306
+ import { chmodSync as chmodSync2 } from "fs";
2306
2307
  import { createClient } from "@libsql/client";
2307
2308
  async function initDatabase(config) {
2308
2309
  if (_walCheckpointTimer) {
@@ -2344,6 +2345,16 @@ async function initDatabase(config) {
2344
2345
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
2345
2346
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
2346
2347
  }
2348
+ try {
2349
+ chmodSync2(config.dbPath, 384);
2350
+ for (const suffix of ["-wal", "-shm"]) {
2351
+ try {
2352
+ chmodSync2(config.dbPath + suffix, 384);
2353
+ } catch {
2354
+ }
2355
+ }
2356
+ } catch {
2357
+ }
2347
2358
  }
2348
2359
  function isInitialized() {
2349
2360
  return _adapterClient !== null || _client !== null;
@@ -7941,6 +7952,24 @@ var init_platform_procedures = __esm({
7941
7952
  priority: "p0",
7942
7953
  content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, call support_test (MCP) and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues; only ask the founder to run `exe-os support test` if MCP is disconnected/unavailable. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
7943
7954
  },
7955
+ {
7956
+ title: "Bug report status check \u2014 surface available fixes on boot",
7957
+ domain: "support",
7958
+ priority: "p1",
7959
+ content: "Once per session (COO boot only, never repeat), call list_my_bug_reports to check if any previously filed bug reports have been fixed by AskExe. If any report has status 'fixed' with a fixed_version, surface it to the founder immediately: '\u{1F527} N bug fix(es) available \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no reports exist or none are fixed, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
7960
+ },
7961
+ {
7962
+ title: "Feature request triage \u2014 upstream feature vs local customization",
7963
+ domain: "support",
7964
+ priority: "p0",
7965
+ content: "When an agent or founder identifies a desired capability that exe-os does not yet provide, the COO (or equivalent coordinator) must decide: is this a local customization (identity, behavior, procedure, config, branding, workflow preference that can be configured in customer-owned layers) or an upstream feature request (a platform capability that requires changes to exe-os code, shipped via npm update)? Local customizations: implement immediately using store_behavior, update_identity, company_procedure, or config changes. Upstream features: use create_feature_request to submit to AskExe. Include use case, business impact, and current workaround. Do NOT ask the founder for permission to file a feature request \u2014 file it proactively when the need is clear."
7966
+ },
7967
+ {
7968
+ title: "Feature request status check \u2014 surface shipped features on boot",
7969
+ domain: "support",
7970
+ priority: "p1",
7971
+ content: "Once per session (COO boot only, never repeat), call list_my_feature_requests to check if any previously filed feature requests have been shipped by AskExe. If any request has status 'shipped' with a shipped_version, surface it to the founder immediately: '\u{1F680} N feature(s) shipped \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no requests exist or none are shipped, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
7972
+ },
7944
7973
  // --- Operations ---
7945
7974
  {
7946
7975
  title: "Managers must supervise deployed workers",
@@ -9263,6 +9292,7 @@ import { fileURLToPath } from "url";
9263
9292
  function isMainModule(importMetaUrl) {
9264
9293
  if (process.argv[1] == null) return false;
9265
9294
  if (process.argv[1].includes("mcp/server")) return false;
9295
+ if (process.argv[1].includes("exe-daemon")) return false;
9266
9296
  try {
9267
9297
  const scriptPath = realpathSync(process.argv[1]);
9268
9298
  const modulePath = realpathSync(fileURLToPath(importMetaUrl));
package/dist/bin/setup.js CHANGED
@@ -3107,6 +3107,7 @@ __export(database_exports, {
3107
3107
  isInitialized: () => isInitialized,
3108
3108
  setExternalClient: () => setExternalClient
3109
3109
  });
3110
+ import { chmodSync as chmodSync2 } from "fs";
3110
3111
  import { createClient } from "@libsql/client";
3111
3112
  async function initDatabase(config) {
3112
3113
  if (_walCheckpointTimer) {
@@ -3148,6 +3149,16 @@ async function initDatabase(config) {
3148
3149
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
3149
3150
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
3150
3151
  }
3152
+ try {
3153
+ chmodSync2(config.dbPath, 384);
3154
+ for (const suffix of ["-wal", "-shm"]) {
3155
+ try {
3156
+ chmodSync2(config.dbPath + suffix, 384);
3157
+ } catch {
3158
+ }
3159
+ }
3160
+ } catch {
3161
+ }
3151
3162
  }
3152
3163
  function isInitialized() {
3153
3164
  return _adapterClient !== null || _client !== null;
@@ -4750,6 +4761,21 @@ var init_crdt_sync = __esm({
4750
4761
  }
4751
4762
  });
4752
4763
 
4764
+ // src/lib/pg-ssl.ts
4765
+ var pg_ssl_exports = {};
4766
+ __export(pg_ssl_exports, {
4767
+ pgSslConfig: () => pgSslConfig
4768
+ });
4769
+ function pgSslConfig() {
4770
+ if (process.env.EXE_DB_SSL_DISABLED === "true") return {};
4771
+ return { ssl: { rejectUnauthorized: process.env.EXE_DB_SSL_ALLOW_SELFSIGNED !== "true" } };
4772
+ }
4773
+ var init_pg_ssl = __esm({
4774
+ "src/lib/pg-ssl.ts"() {
4775
+ "use strict";
4776
+ }
4777
+ });
4778
+
4753
4779
  // src/lib/db-backup.ts
4754
4780
  var db_backup_exports = {};
4755
4781
  __export(db_backup_exports, {
@@ -4863,6 +4889,7 @@ __export(cloud_sync_exports, {
4863
4889
  cloudPull: () => cloudPull,
4864
4890
  cloudPullBehaviors: () => cloudPullBehaviors,
4865
4891
  cloudPullBlob: () => cloudPullBlob,
4892
+ cloudPullCodeContext: () => cloudPullCodeContext,
4866
4893
  cloudPullConversations: () => cloudPullConversations,
4867
4894
  cloudPullDocuments: () => cloudPullDocuments,
4868
4895
  cloudPullGlobalProcedures: () => cloudPullGlobalProcedures,
@@ -4872,6 +4899,7 @@ __export(cloud_sync_exports, {
4872
4899
  cloudPush: () => cloudPush,
4873
4900
  cloudPushBehaviors: () => cloudPushBehaviors,
4874
4901
  cloudPushBlob: () => cloudPushBlob,
4902
+ cloudPushCodeContext: () => cloudPushCodeContext,
4875
4903
  cloudPushConversations: () => cloudPushConversations,
4876
4904
  cloudPushDocuments: () => cloudPushDocuments,
4877
4905
  cloudPushGlobalProcedures: () => cloudPushGlobalProcedures,
@@ -4950,7 +4978,8 @@ function loadPgClient() {
4950
4978
  return new Ctor();
4951
4979
  }
4952
4980
  const { Pool } = await import("pg");
4953
- const pool = new Pool({ connectionString: process.env.DATABASE_URL });
4981
+ const { pgSslConfig: pgSslConfig2 } = await Promise.resolve().then(() => (init_pg_ssl(), pg_ssl_exports));
4982
+ const pool = new Pool({ connectionString: process.env.DATABASE_URL, ...pgSslConfig2() });
4954
4983
  return {
4955
4984
  async $queryRawUnsafe(query, ...values) {
4956
4985
  const result = await pool.query(query, values);
@@ -5495,6 +5524,17 @@ async function cloudSync(config) {
5495
5524
  } catch (err) {
5496
5525
  logError(`[cloud-sync] DB backup upload error: ${err instanceof Error ? err.message : String(err)}`);
5497
5526
  }
5527
+ let codeContextResult = { pushed: 0, pulled: 0 };
5528
+ try {
5529
+ codeContextResult.pushed = await cloudPushCodeContext(config);
5530
+ } catch (err) {
5531
+ logError(`[cloud-sync] Code context push: ${err instanceof Error ? err.message : String(err)}`);
5532
+ }
5533
+ try {
5534
+ codeContextResult.pulled = await cloudPullCodeContext(config);
5535
+ } catch (err) {
5536
+ logError(`[cloud-sync] Code context pull: ${err instanceof Error ? err.message : String(err)}`);
5537
+ }
5498
5538
  return {
5499
5539
  pushed,
5500
5540
  pulled,
@@ -5504,7 +5544,8 @@ async function cloudSync(config) {
5504
5544
  tasks: tasksResult,
5505
5545
  conversations: conversationsResult,
5506
5546
  documents: documentsResult,
5507
- roster: rosterResult
5547
+ roster: rosterResult,
5548
+ codeContext: codeContextResult
5508
5549
  };
5509
5550
  }
5510
5551
  function recordRosterDeletion(name) {
@@ -6142,7 +6183,99 @@ async function cloudPullDocuments(config) {
6142
6183
  }
6143
6184
  return { pulled };
6144
6185
  }
6145
- var LOCALHOST_PATTERNS, FETCH_TIMEOUT_MS, PUSH_BATCH_SIZE, ROSTER_LOCK_PATH, LOCK_STALE_MS, _pgPromise, _pgFailed, CLOUD_REUPLOAD_REQUIRED_MESSAGE, ROSTER_DELETIONS_PATH;
6186
+ async function cloudPushCodeContext(config) {
6187
+ assertSecureEndpoint(config.endpoint);
6188
+ if (!existsSync12(CODE_CONTEXT_DIR)) return 0;
6189
+ const files = readdirSync2(CODE_CONTEXT_DIR).filter(
6190
+ (f) => f.endsWith(".json") && !f.endsWith(".vectors.json") && !f.startsWith(".")
6191
+ );
6192
+ if (files.length === 0) return 0;
6193
+ const metaPath = path12.join(CODE_CONTEXT_DIR, ".sync-meta.json");
6194
+ let syncMeta = {};
6195
+ if (existsSync12(metaPath)) {
6196
+ try {
6197
+ syncMeta = JSON.parse(readFileSync8(metaPath, "utf-8"));
6198
+ } catch {
6199
+ }
6200
+ }
6201
+ let pushed = 0;
6202
+ for (const file of files) {
6203
+ const filePath = path12.join(CODE_CONTEXT_DIR, file);
6204
+ try {
6205
+ const stat = statSync4(filePath);
6206
+ const lastPushed = syncMeta[file] ?? 0;
6207
+ if (stat.mtimeMs <= lastPushed) continue;
6208
+ const content = readFileSync8(filePath, "utf-8");
6209
+ const header = content.substring(0, 300);
6210
+ if (header.includes("/tmp") || header.includes("/var/folders") || header.includes(".worktrees/")) continue;
6211
+ const compressed = compress(Buffer.from(content, "utf8"));
6212
+ const encrypted = encryptSyncBlob(compressed);
6213
+ const resp = await fetchWithRetry(`${config.endpoint}/sync/push-code-context`, {
6214
+ method: "POST",
6215
+ headers: {
6216
+ Authorization: `Bearer ${config.apiKey}`,
6217
+ "Content-Type": "application/json",
6218
+ "X-Device-Id": loadDeviceId()
6219
+ },
6220
+ body: JSON.stringify({ key: file, blob: encrypted })
6221
+ });
6222
+ if (resp.ok) {
6223
+ syncMeta[file] = stat.mtimeMs;
6224
+ pushed++;
6225
+ }
6226
+ } catch {
6227
+ }
6228
+ }
6229
+ if (pushed > 0) {
6230
+ try {
6231
+ writeFileSync6(metaPath, JSON.stringify(syncMeta));
6232
+ } catch {
6233
+ }
6234
+ }
6235
+ return pushed;
6236
+ }
6237
+ async function cloudPullCodeContext(config) {
6238
+ assertSecureEndpoint(config.endpoint);
6239
+ try {
6240
+ const resp = await fetchWithRetry(`${config.endpoint}/sync/pull-code-context`, {
6241
+ method: "GET",
6242
+ headers: {
6243
+ Authorization: `Bearer ${config.apiKey}`,
6244
+ "X-Device-Id": loadDeviceId()
6245
+ }
6246
+ });
6247
+ if (!resp.ok) return 0;
6248
+ const data = await resp.json();
6249
+ if (!data.indexes || data.indexes.length === 0) return 0;
6250
+ mkdirSync5(CODE_CONTEXT_DIR, { recursive: true });
6251
+ let pulled = 0;
6252
+ for (const { key, blob } of data.indexes) {
6253
+ try {
6254
+ if (key.endsWith(".vectors.json")) continue;
6255
+ const localPath = path12.join(CODE_CONTEXT_DIR, key);
6256
+ const compressed = decryptSyncBlob(blob);
6257
+ const content = decompress(compressed).toString("utf8");
6258
+ if (!existsSync12(localPath)) {
6259
+ writeFileSync6(localPath, content, "utf-8");
6260
+ pulled++;
6261
+ } else {
6262
+ const localContent = readFileSync8(localPath, "utf-8");
6263
+ if (localContent.length !== content.length) {
6264
+ writeFileSync6(localPath, content, "utf-8");
6265
+ pulled++;
6266
+ }
6267
+ }
6268
+ } catch {
6269
+ }
6270
+ }
6271
+ return pulled;
6272
+ } catch (err) {
6273
+ process.stderr.write(`[cloud-sync] Code context pull failed: ${err instanceof Error ? err.message : String(err)}
6274
+ `);
6275
+ return 0;
6276
+ }
6277
+ }
6278
+ var LOCALHOST_PATTERNS, FETCH_TIMEOUT_MS, PUSH_BATCH_SIZE, ROSTER_LOCK_PATH, LOCK_STALE_MS, _pgPromise, _pgFailed, CLOUD_REUPLOAD_REQUIRED_MESSAGE, ROSTER_DELETIONS_PATH, CODE_CONTEXT_DIR;
6146
6279
  var init_cloud_sync = __esm({
6147
6280
  "src/lib/cloud-sync.ts"() {
6148
6281
  "use strict";
@@ -6163,6 +6296,7 @@ var init_cloud_sync = __esm({
6163
6296
  _pgFailed = false;
6164
6297
  CLOUD_REUPLOAD_REQUIRED_MESSAGE = "Cloud sync is blocked because this device rotated its memory encryption key. Run `exe-os cloud reupload` first to re-upload the cloud backup with the new key.";
6165
6298
  ROSTER_DELETIONS_PATH = path12.join(EXE_AI_DIR, "roster-deletions.json");
6299
+ CODE_CONTEXT_DIR = path12.join(EXE_AI_DIR, "code-context");
6166
6300
  }
6167
6301
  });
6168
6302
 
@@ -6441,6 +6575,24 @@ var init_platform_procedures = __esm({
6441
6575
  priority: "p0",
6442
6576
  content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, call support_test (MCP) and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues; only ask the founder to run `exe-os support test` if MCP is disconnected/unavailable. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
6443
6577
  },
6578
+ {
6579
+ title: "Bug report status check \u2014 surface available fixes on boot",
6580
+ domain: "support",
6581
+ priority: "p1",
6582
+ content: "Once per session (COO boot only, never repeat), call list_my_bug_reports to check if any previously filed bug reports have been fixed by AskExe. If any report has status 'fixed' with a fixed_version, surface it to the founder immediately: '\u{1F527} N bug fix(es) available \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no reports exist or none are fixed, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
6583
+ },
6584
+ {
6585
+ title: "Feature request triage \u2014 upstream feature vs local customization",
6586
+ domain: "support",
6587
+ priority: "p0",
6588
+ content: "When an agent or founder identifies a desired capability that exe-os does not yet provide, the COO (or equivalent coordinator) must decide: is this a local customization (identity, behavior, procedure, config, branding, workflow preference that can be configured in customer-owned layers) or an upstream feature request (a platform capability that requires changes to exe-os code, shipped via npm update)? Local customizations: implement immediately using store_behavior, update_identity, company_procedure, or config changes. Upstream features: use create_feature_request to submit to AskExe. Include use case, business impact, and current workaround. Do NOT ask the founder for permission to file a feature request \u2014 file it proactively when the need is clear."
6589
+ },
6590
+ {
6591
+ title: "Feature request status check \u2014 surface shipped features on boot",
6592
+ domain: "support",
6593
+ priority: "p1",
6594
+ content: "Once per session (COO boot only, never repeat), call list_my_feature_requests to check if any previously filed feature requests have been shipped by AskExe. If any request has status 'shipped' with a shipped_version, surface it to the founder immediately: '\u{1F680} N feature(s) shipped \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no requests exist or none are shipped, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
6595
+ },
6444
6596
  // --- Operations ---
6445
6597
  {
6446
6598
  title: "Managers must supervise deployed workers",
@@ -7471,12 +7623,14 @@ On EVERY new conversation, before doing anything else:
7471
7623
  1. **Memory scan**: Run recall_my_memory with broad queries \u2014 "project", "client", "pipeline", "campaign", "deal", "decision", "blocker". Summarize what you find.
7472
7624
  2. **Task scan**: Run list_tasks to see what's open, in progress, blocked, or needs review across all employees.
7473
7625
  3. **Team check**: Run ask_team_memory for recent activity from CTO/CMO/engineers.
7474
- 4. **Present the brief**: Give the founder a concise status report:
7626
+ 4. **Bug fix check** (one-time, never repeat): Call list_my_bug_reports to see if AskExe has fixed any previously filed bugs. If any have status "fixed" with a fixed_version, tell the founder: "\u{1F527} N bug fix(es) available \u2014 run \`exe-os update\` to get version X.Y.Z." Skip silently if none or if the call fails.
7627
+ 5. **Present the brief**: Give the founder a concise status report:
7475
7628
  - What's active and progressing
7476
7629
  - What's blocked and needs attention
7477
7630
  - What decisions are pending
7631
+ - Available bug fixes (from step 4, if any)
7478
7632
  - What you recommend doing next
7479
- 5. Then ask: "What's the priority?"
7633
+ 6. Then ask: "What's the priority?"
7480
7634
 
7481
7635
  If this is your FIRST ever conversation (few or no prior memories):
7482
7636
  - Search more broadly: "product", "SEO", "meeting", "strategy", "revenue"
@@ -7496,6 +7650,8 @@ Never say "I have no memories" without first searching broadly. Your memory may
7496
7650
  - **get_identity** \u2014 read any agent's identity for coordination
7497
7651
  - **set_agent_config** \u2014 view or change which tool (Claude Code, Codex, OpenCode) and model each agent uses. Call with no args to show all agents' current settings. Call with agent_id + runtime + model to change.
7498
7652
  - **send_message** \u2014 direct intercom to employees
7653
+ - **create_bug_report** \u2014 file a bug when you encounter an Exe OS platform issue
7654
+ - **list_my_bug_reports** \u2014 check status of filed bugs (boot check: surface available fixes to founder)
7499
7655
  ${PLAN_MODE_COMPAT}
7500
7656
  ## Completion Workflow
7501
7657
 
@@ -7921,7 +8077,7 @@ import {
7921
8077
  readFileSync as readFileSync12,
7922
8078
  writeFileSync as writeFileSync10,
7923
8079
  mkdirSync as mkdirSync8,
7924
- chmodSync as chmodSync2,
8080
+ chmodSync as chmodSync3,
7925
8081
  readdirSync as readdirSync4,
7926
8082
  unlinkSync as unlinkSync7
7927
8083
  } from "fs";
@@ -7942,7 +8098,7 @@ function generateSessionWrappers(packageRoot, homeDir) {
7942
8098
  for (const src of candidates) {
7943
8099
  if (existsSync16(src)) {
7944
8100
  writeFileSync10(exeStartDst, readFileSync12(src));
7945
- chmodSync2(exeStartDst, 493);
8101
+ chmodSync3(exeStartDst, 493);
7946
8102
  break;
7947
8103
  }
7948
8104
  }
@@ -8006,7 +8162,7 @@ exec "${exeStartDst}" "$0" "$@"
8006
8162
  exec node "${codexLauncher}" --agent ${emp.name} "$@"
8007
8163
  `;
8008
8164
  writeFileSync10(wrapperPath, content);
8009
- chmodSync2(wrapperPath, 493);
8165
+ chmodSync3(wrapperPath, 493);
8010
8166
  created++;
8011
8167
  }
8012
8168
  }
@@ -8016,7 +8172,7 @@ exec node "${codexLauncher}" --agent ${emp.name} "$@"
8016
8172
  function writeWrapper(wrapperPath, content) {
8017
8173
  try {
8018
8174
  writeFileSync10(wrapperPath, content);
8019
- chmodSync2(wrapperPath, 493);
8175
+ chmodSync3(wrapperPath, 493);
8020
8176
  } catch {
8021
8177
  }
8022
8178
  }
@@ -1487,6 +1487,7 @@ __export(database_exports, {
1487
1487
  isInitialized: () => isInitialized,
1488
1488
  setExternalClient: () => setExternalClient
1489
1489
  });
1490
+ import { chmodSync as chmodSync2 } from "fs";
1490
1491
  import { createClient } from "@libsql/client";
1491
1492
  async function initDatabase(config) {
1492
1493
  if (_walCheckpointTimer) {
@@ -1528,6 +1529,16 @@ async function initDatabase(config) {
1528
1529
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1529
1530
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1530
1531
  }
1532
+ try {
1533
+ chmodSync2(config.dbPath, 384);
1534
+ for (const suffix of ["-wal", "-shm"]) {
1535
+ try {
1536
+ chmodSync2(config.dbPath + suffix, 384);
1537
+ } catch {
1538
+ }
1539
+ }
1540
+ } catch {
1541
+ }
1531
1542
  }
1532
1543
  function isInitialized() {
1533
1544
  return _adapterClient !== null || _client !== null;
@@ -3382,6 +3393,24 @@ var init_platform_procedures = __esm({
3382
3393
  priority: "p0",
3383
3394
  content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, call support_test (MCP) and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues; only ask the founder to run `exe-os support test` if MCP is disconnected/unavailable. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
3384
3395
  },
3396
+ {
3397
+ title: "Bug report status check \u2014 surface available fixes on boot",
3398
+ domain: "support",
3399
+ priority: "p1",
3400
+ content: "Once per session (COO boot only, never repeat), call list_my_bug_reports to check if any previously filed bug reports have been fixed by AskExe. If any report has status 'fixed' with a fixed_version, surface it to the founder immediately: '\u{1F527} N bug fix(es) available \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no reports exist or none are fixed, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
3401
+ },
3402
+ {
3403
+ title: "Feature request triage \u2014 upstream feature vs local customization",
3404
+ domain: "support",
3405
+ priority: "p0",
3406
+ content: "When an agent or founder identifies a desired capability that exe-os does not yet provide, the COO (or equivalent coordinator) must decide: is this a local customization (identity, behavior, procedure, config, branding, workflow preference that can be configured in customer-owned layers) or an upstream feature request (a platform capability that requires changes to exe-os code, shipped via npm update)? Local customizations: implement immediately using store_behavior, update_identity, company_procedure, or config changes. Upstream features: use create_feature_request to submit to AskExe. Include use case, business impact, and current workaround. Do NOT ask the founder for permission to file a feature request \u2014 file it proactively when the need is clear."
3407
+ },
3408
+ {
3409
+ title: "Feature request status check \u2014 surface shipped features on boot",
3410
+ domain: "support",
3411
+ priority: "p1",
3412
+ content: "Once per session (COO boot only, never repeat), call list_my_feature_requests to check if any previously filed feature requests have been shipped by AskExe. If any request has status 'shipped' with a shipped_version, surface it to the founder immediately: '\u{1F680} N feature(s) shipped \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no requests exist or none are shipped, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
3413
+ },
3385
3414
  // --- Operations ---
3386
3415
  {
3387
3416
  title: "Managers must supervise deployed workers",
@@ -10,6 +10,7 @@ import { fileURLToPath } from "url";
10
10
  function isMainModule(importMetaUrl) {
11
11
  if (process.argv[1] == null) return false;
12
12
  if (process.argv[1].includes("mcp/server")) return false;
13
+ if (process.argv[1].includes("exe-daemon")) return false;
13
14
  try {
14
15
  const scriptPath = realpathSync(process.argv[1]);
15
16
  const modulePath = realpathSync(fileURLToPath(importMetaUrl));
@@ -455,8 +456,9 @@ function hydrateEnv(raw, opts) {
455
456
  else if (key === "MONITOR_AGENT_KEY") continue;
456
457
  else if (key === "EXE_GATEWAY_WS_RELAY_AUTH_TOKEN") replacements[key] = randomHexSecret(24);
457
458
  else if (key.endsWith("_PASSWORD")) replacements[key] = randomSecret(24);
458
- else if (key.endsWith("_SECRET") || key.endsWith("_TOKEN") || key.endsWith("_KEY") || key.endsWith("_SALT")) replacements[key] = value.replace(/CHANGEME[A-Z0-9_]*/g, randomSecret(32));
459
- else if (key === "EXED_MCP_TOKEN") replacements[key] = randomSecret(32);
459
+ else if (key.endsWith("_TOKEN")) replacements[key] = randomHexSecret(32);
460
+ else if (key.endsWith("_SECRET") || key.endsWith("_SALT")) replacements[key] = randomSecret(32);
461
+ else if (key.endsWith("_KEY") && key !== "EXE_LICENSE_KEY") continue;
460
462
  }
461
463
  if (domain) next = next.replaceAll("CHANGEME_DOMAIN", domain);
462
464
  next = patchEnv(next, replacements);
@@ -839,8 +841,8 @@ Options:
839
841
  }
840
842
  function printChanges(changes, composeFile, envFile) {
841
843
  if (changes.length === 0) {
842
- const running = areCliContainersRunning(composeFile, envFile);
843
- if (running) {
844
+ const running2 = areCliContainersRunning(composeFile, envFile);
845
+ if (running2) {
844
846
  console.log("Stack .env matches target manifest. Checking container health...\n");
845
847
  const unhealthy = printContainerHealth(composeFile, envFile);
846
848
  if (unhealthy > 0) {
@@ -849,16 +851,28 @@ function printChanges(changes, composeFile, envFile) {
849
851
  } else {
850
852
  console.log("\n\u2705 Stack already matches target manifest. All services healthy.");
851
853
  }
854
+ return unhealthy;
852
855
  } else {
853
856
  console.log("\u26A0\uFE0F Stack .env matches target manifest but containers are not running. Will start them.");
857
+ return 1;
854
858
  }
855
- return;
856
859
  }
857
860
  console.log("Planned image tag changes:");
858
861
  for (const c of changes) {
859
862
  console.log(` - ${c.service}: ${c.key}`);
860
863
  console.log(` ${c.before ?? "<unset>"} \u2192 ${c.after}`);
861
864
  }
865
+ const running = areCliContainersRunning(composeFile, envFile);
866
+ if (running) {
867
+ console.log("\nCurrent container health:");
868
+ const unhealthy = printContainerHealth(composeFile, envFile);
869
+ if (unhealthy > 0) {
870
+ console.log(`
871
+ \u{1F534} ${unhealthy} service(s) currently unhealthy or crashlooping.`);
872
+ }
873
+ return unhealthy;
874
+ }
875
+ return 0;
862
876
  }
863
877
  function areCliContainersRunning(composeFile, envFile) {
864
878
  try {
@@ -968,9 +982,12 @@ async function main(args = process.argv.slice(2)) {
968
982
  console.log(`Compose: ${opts.composeFile}`);
969
983
  console.log(`Env: ${opts.envFile}
970
984
  `);
971
- printChanges(plan.changes, opts.composeFile, opts.envFile);
985
+ const unhealthyCount = printChanges(plan.changes, opts.composeFile, opts.envFile);
972
986
  printBreaking(plan.breakingChanges);
973
- if (opts.check || opts.dryRun) return;
987
+ if (opts.check || opts.dryRun) {
988
+ if (unhealthyCount > 0) process.exitCode = 1;
989
+ return;
990
+ }
974
991
  if (!opts.yes) {
975
992
  console.error("\nRefusing to update without --yes. Re-run with --yes after reviewing the plan.");
976
993
  process.exit(2);
@@ -600,6 +600,7 @@ import { fileURLToPath } from "url";
600
600
  function isMainModule(importMetaUrl) {
601
601
  if (process.argv[1] == null) return false;
602
602
  if (process.argv[1].includes("mcp/server")) return false;
603
+ if (process.argv[1].includes("exe-daemon")) return false;
603
604
  try {
604
605
  const scriptPath = realpathSync(process.argv[1]);
605
606
  const modulePath = realpathSync(fileURLToPath(importMetaUrl));
@@ -833,6 +834,10 @@ async function runUpdate(cliArgs) {
833
834
  \u{1F4E6} Update available: v${result.localVersion} \u2192 v${result.remoteVersion}
834
835
  `);
835
836
  let proceed = autoMode;
837
+ if (!proceed && !process.stdin.isTTY) {
838
+ console.log("Non-interactive mode detected (no TTY). Use --yes to auto-confirm, or run interactively.");
839
+ process.exit(1);
840
+ }
836
841
  if (!proceed) {
837
842
  const rl = createInterface({ input: process.stdin, output: process.stdout });
838
843
  const answer = await new Promise((resolve) => {
@@ -2357,6 +2357,7 @@ __export(database_exports, {
2357
2357
  isInitialized: () => isInitialized,
2358
2358
  setExternalClient: () => setExternalClient
2359
2359
  });
2360
+ import { chmodSync as chmodSync2 } from "fs";
2360
2361
  import { createClient } from "@libsql/client";
2361
2362
  async function initDatabase(config2) {
2362
2363
  if (_walCheckpointTimer) {
@@ -2398,6 +2399,16 @@ async function initDatabase(config2) {
2398
2399
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
2399
2400
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
2400
2401
  }
2402
+ try {
2403
+ chmodSync2(config2.dbPath, 384);
2404
+ for (const suffix of ["-wal", "-shm"]) {
2405
+ try {
2406
+ chmodSync2(config2.dbPath + suffix, 384);
2407
+ } catch {
2408
+ }
2409
+ }
2410
+ } catch {
2411
+ }
2401
2412
  }
2402
2413
  function isInitialized() {
2403
2414
  return _adapterClient !== null || _client !== null;
@@ -4822,6 +4833,24 @@ var init_platform_procedures = __esm({
4822
4833
  priority: "p0",
4823
4834
  content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, call support_test (MCP) and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues; only ask the founder to run `exe-os support test` if MCP is disconnected/unavailable. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4824
4835
  },
4836
+ {
4837
+ title: "Bug report status check \u2014 surface available fixes on boot",
4838
+ domain: "support",
4839
+ priority: "p1",
4840
+ content: "Once per session (COO boot only, never repeat), call list_my_bug_reports to check if any previously filed bug reports have been fixed by AskExe. If any report has status 'fixed' with a fixed_version, surface it to the founder immediately: '\u{1F527} N bug fix(es) available \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no reports exist or none are fixed, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
4841
+ },
4842
+ {
4843
+ title: "Feature request triage \u2014 upstream feature vs local customization",
4844
+ domain: "support",
4845
+ priority: "p0",
4846
+ content: "When an agent or founder identifies a desired capability that exe-os does not yet provide, the COO (or equivalent coordinator) must decide: is this a local customization (identity, behavior, procedure, config, branding, workflow preference that can be configured in customer-owned layers) or an upstream feature request (a platform capability that requires changes to exe-os code, shipped via npm update)? Local customizations: implement immediately using store_behavior, update_identity, company_procedure, or config changes. Upstream features: use create_feature_request to submit to AskExe. Include use case, business impact, and current workaround. Do NOT ask the founder for permission to file a feature request \u2014 file it proactively when the need is clear."
4847
+ },
4848
+ {
4849
+ title: "Feature request status check \u2014 surface shipped features on boot",
4850
+ domain: "support",
4851
+ priority: "p1",
4852
+ content: "Once per session (COO boot only, never repeat), call list_my_feature_requests to check if any previously filed feature requests have been shipped by AskExe. If any request has status 'shipped' with a shipped_version, surface it to the founder immediately: '\u{1F680} N feature(s) shipped \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no requests exist or none are shipped, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
4853
+ },
4825
4854
  // --- Operations ---
4826
4855
  {
4827
4856
  title: "Managers must supervise deployed workers",
@@ -7576,7 +7605,7 @@ function readQueue() {
7576
7605
  function writeQueue(queue) {
7577
7606
  ensureDir();
7578
7607
  const tmp = `${QUEUE_PATH}.tmp`;
7579
- writeFileSync5(tmp, JSON.stringify(queue, null, 2));
7608
+ writeFileSync5(tmp, JSON.stringify(queue, null, 2), { mode: 384 });
7580
7609
  renameSync4(tmp, QUEUE_PATH);
7581
7610
  }
7582
7611
  function queueIntercom(targetSession, reason) {