@askexenow/exe-os 0.9.87 → 0.9.89

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 (102) 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 +11 -0
  4. package/dist/bin/agentic-reflection-backfill.js +11 -0
  5. package/dist/bin/agentic-semantic-label.js +11 -0
  6. package/dist/bin/backfill-conversations.js +12 -0
  7. package/dist/bin/backfill-responses.js +12 -0
  8. package/dist/bin/backfill-vectors.js +12 -0
  9. package/dist/bin/bulk-sync-postgres.js +29 -1
  10. package/dist/bin/cc-doctor.js +3 -2
  11. package/dist/bin/cleanup-stale-review-tasks.js +12 -0
  12. package/dist/bin/cli.js +170 -15
  13. package/dist/bin/exe-agent.js +1 -0
  14. package/dist/bin/exe-assign.js +12 -0
  15. package/dist/bin/exe-boot.js +139 -4
  16. package/dist/bin/exe-call.js +2 -0
  17. package/dist/bin/exe-cloud.js +138 -3
  18. package/dist/bin/exe-dispatch.js +12 -1
  19. package/dist/bin/exe-doctor.js +12 -0
  20. package/dist/bin/exe-export-behaviors.js +11 -0
  21. package/dist/bin/exe-forget.js +12 -0
  22. package/dist/bin/exe-gateway.js +132 -35
  23. package/dist/bin/exe-healthcheck.js +2 -1
  24. package/dist/bin/exe-heartbeat.js +12 -0
  25. package/dist/bin/exe-kill.js +11 -0
  26. package/dist/bin/exe-launch-agent.js +11 -0
  27. package/dist/bin/exe-new-employee.js +4 -2
  28. package/dist/bin/exe-pending-messages.js +11 -0
  29. package/dist/bin/exe-pending-notifications.js +12 -0
  30. package/dist/bin/exe-pending-reviews.js +12 -0
  31. package/dist/bin/exe-rename.js +12 -0
  32. package/dist/bin/exe-review.js +12 -0
  33. package/dist/bin/exe-search.js +12 -0
  34. package/dist/bin/exe-session-cleanup.js +12 -1
  35. package/dist/bin/exe-settings.js +3 -0
  36. package/dist/bin/exe-start-codex.js +13 -2
  37. package/dist/bin/exe-start-opencode.js +13 -2
  38. package/dist/bin/exe-status.js +12 -0
  39. package/dist/bin/exe-team.js +12 -0
  40. package/dist/bin/git-sweep.js +12 -1
  41. package/dist/bin/graph-backfill.js +11 -0
  42. package/dist/bin/graph-export.js +11 -0
  43. package/dist/bin/graph-layer-benchmark.js +9 -1
  44. package/dist/bin/intercom-check.js +13 -1
  45. package/dist/bin/list-providers.js +1 -0
  46. package/dist/bin/postgres-agentic-reflection-backfill.js +7 -1
  47. package/dist/bin/postgres-agentic-semantic-backfill.js +7 -1
  48. package/dist/bin/registry-proxy.js +1 -0
  49. package/dist/bin/scan-tasks.js +13 -1
  50. package/dist/bin/setup.js +141 -7
  51. package/dist/bin/shard-migrate.js +11 -0
  52. package/dist/bin/stack-update.js +24 -7
  53. package/dist/bin/update.js +5 -0
  54. package/dist/gateway/index.js +12 -1
  55. package/dist/hooks/bug-report-worker.js +12 -1
  56. package/dist/hooks/codex-stop-task-finalizer.js +12 -1
  57. package/dist/hooks/commit-complete.js +12 -1
  58. package/dist/hooks/error-recall.js +11 -0
  59. package/dist/hooks/ingest.js +11 -0
  60. package/dist/hooks/instructions-loaded.js +11 -0
  61. package/dist/hooks/notification.js +11 -0
  62. package/dist/hooks/post-compact.js +11 -0
  63. package/dist/hooks/post-tool-combined.js +11 -0
  64. package/dist/hooks/pre-compact.js +12 -1
  65. package/dist/hooks/pre-tool-use.js +11 -0
  66. package/dist/hooks/prompt-submit.js +12 -1
  67. package/dist/hooks/session-end.js +12 -1
  68. package/dist/hooks/session-start.js +11 -0
  69. package/dist/hooks/stop.js +11 -0
  70. package/dist/hooks/subagent-stop.js +11 -0
  71. package/dist/hooks/summary-worker.js +137 -3
  72. package/dist/index.js +12 -1
  73. package/dist/lib/cloud-sync.js +136 -2
  74. package/dist/lib/consolidation.js +1 -0
  75. package/dist/lib/database.js +11 -0
  76. package/dist/lib/db.js +11 -0
  77. package/dist/lib/device-registry.js +11 -0
  78. package/dist/lib/employee-templates.js +1 -0
  79. package/dist/lib/exe-daemon.js +771 -49
  80. package/dist/lib/hybrid-search.js +11 -0
  81. package/dist/lib/identity.js +1 -0
  82. package/dist/lib/messaging.js +2 -1
  83. package/dist/lib/reminders.js +1 -0
  84. package/dist/lib/schedules.js +11 -0
  85. package/dist/lib/skill-learning.js +1 -0
  86. package/dist/lib/store.js +11 -0
  87. package/dist/lib/tasks.js +2 -1
  88. package/dist/lib/tmux-routing.js +2 -1
  89. package/dist/lib/token-spend.js +1 -0
  90. package/dist/lib/ws-client.js +8 -0
  91. package/dist/mcp/server.js +613 -27
  92. package/dist/mcp/tools/complete-reminder.js +1 -0
  93. package/dist/mcp/tools/create-reminder.js +1 -0
  94. package/dist/mcp/tools/create-task.js +2 -1
  95. package/dist/mcp/tools/deactivate-behavior.js +1 -0
  96. package/dist/mcp/tools/list-reminders.js +1 -0
  97. package/dist/mcp/tools/list-tasks.js +1 -0
  98. package/dist/mcp/tools/send-message.js +2 -1
  99. package/dist/mcp/tools/update-task.js +2 -1
  100. package/dist/runtime/index.js +12 -1
  101. package/dist/tui/App.js +12 -1
  102. package/package.json +2 -2
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
 
@@ -7943,7 +8077,7 @@ import {
7943
8077
  readFileSync as readFileSync12,
7944
8078
  writeFileSync as writeFileSync10,
7945
8079
  mkdirSync as mkdirSync8,
7946
- chmodSync as chmodSync2,
8080
+ chmodSync as chmodSync3,
7947
8081
  readdirSync as readdirSync4,
7948
8082
  unlinkSync as unlinkSync7
7949
8083
  } from "fs";
@@ -7964,7 +8098,7 @@ function generateSessionWrappers(packageRoot, homeDir) {
7964
8098
  for (const src of candidates) {
7965
8099
  if (existsSync16(src)) {
7966
8100
  writeFileSync10(exeStartDst, readFileSync12(src));
7967
- chmodSync2(exeStartDst, 493);
8101
+ chmodSync3(exeStartDst, 493);
7968
8102
  break;
7969
8103
  }
7970
8104
  }
@@ -8028,7 +8162,7 @@ exec "${exeStartDst}" "$0" "$@"
8028
8162
  exec node "${codexLauncher}" --agent ${emp.name} "$@"
8029
8163
  `;
8030
8164
  writeFileSync10(wrapperPath, content);
8031
- chmodSync2(wrapperPath, 493);
8165
+ chmodSync3(wrapperPath, 493);
8032
8166
  created++;
8033
8167
  }
8034
8168
  }
@@ -8038,7 +8172,7 @@ exec node "${codexLauncher}" --agent ${emp.name} "$@"
8038
8172
  function writeWrapper(wrapperPath, content) {
8039
8173
  try {
8040
8174
  writeFileSync10(wrapperPath, content);
8041
- chmodSync2(wrapperPath, 493);
8175
+ chmodSync3(wrapperPath, 493);
8042
8176
  } catch {
8043
8177
  }
8044
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;
@@ -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;
@@ -7594,7 +7605,7 @@ function readQueue() {
7594
7605
  function writeQueue(queue) {
7595
7606
  ensureDir();
7596
7607
  const tmp = `${QUEUE_PATH}.tmp`;
7597
- writeFileSync5(tmp, JSON.stringify(queue, null, 2));
7608
+ writeFileSync5(tmp, JSON.stringify(queue, null, 2), { mode: 384 });
7598
7609
  renameSync4(tmp, QUEUE_PATH);
7599
7610
  }
7600
7611
  function queueIntercom(targetSession, reason) {
@@ -2112,6 +2112,7 @@ __export(database_exports, {
2112
2112
  isInitialized: () => isInitialized,
2113
2113
  setExternalClient: () => setExternalClient
2114
2114
  });
2115
+ import { chmodSync as chmodSync2 } from "fs";
2115
2116
  import { createClient } from "@libsql/client";
2116
2117
  async function initDatabase(config) {
2117
2118
  if (_walCheckpointTimer) {
@@ -2153,6 +2154,16 @@ async function initDatabase(config) {
2153
2154
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
2154
2155
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
2155
2156
  }
2157
+ try {
2158
+ chmodSync2(config.dbPath, 384);
2159
+ for (const suffix of ["-wal", "-shm"]) {
2160
+ try {
2161
+ chmodSync2(config.dbPath + suffix, 384);
2162
+ } catch {
2163
+ }
2164
+ }
2165
+ } catch {
2166
+ }
2156
2167
  }
2157
2168
  function isInitialized() {
2158
2169
  return _adapterClient !== null || _client !== null;
@@ -6140,7 +6151,7 @@ function readQueue() {
6140
6151
  function writeQueue(queue) {
6141
6152
  ensureDir();
6142
6153
  const tmp = `${QUEUE_PATH}.tmp`;
6143
- writeFileSync5(tmp, JSON.stringify(queue, null, 2));
6154
+ writeFileSync5(tmp, JSON.stringify(queue, null, 2), { mode: 384 });
6144
6155
  renameSync4(tmp, QUEUE_PATH);
6145
6156
  }
6146
6157
  function queueIntercom(targetSession, reason) {
@@ -1795,6 +1795,7 @@ __export(database_exports, {
1795
1795
  isInitialized: () => isInitialized,
1796
1796
  setExternalClient: () => setExternalClient
1797
1797
  });
1798
+ import { chmodSync as chmodSync2 } from "fs";
1798
1799
  import { createClient } from "@libsql/client";
1799
1800
  async function initDatabase(config) {
1800
1801
  if (_walCheckpointTimer) {
@@ -1836,6 +1837,16 @@ async function initDatabase(config) {
1836
1837
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1837
1838
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1838
1839
  }
1840
+ try {
1841
+ chmodSync2(config.dbPath, 384);
1842
+ for (const suffix of ["-wal", "-shm"]) {
1843
+ try {
1844
+ chmodSync2(config.dbPath + suffix, 384);
1845
+ } catch {
1846
+ }
1847
+ }
1848
+ } catch {
1849
+ }
1839
1850
  }
1840
1851
  function isInitialized() {
1841
1852
  return _adapterClient !== null || _client !== null;
@@ -5818,7 +5829,7 @@ function readQueue() {
5818
5829
  function writeQueue(queue) {
5819
5830
  ensureDir();
5820
5831
  const tmp = `${QUEUE_PATH}.tmp`;
5821
- writeFileSync4(tmp, JSON.stringify(queue, null, 2));
5832
+ writeFileSync4(tmp, JSON.stringify(queue, null, 2), { mode: 384 });
5822
5833
  renameSync4(tmp, QUEUE_PATH);
5823
5834
  }
5824
5835
  function queueIntercom(targetSession, reason) {
@@ -711,7 +711,7 @@ function readQueue() {
711
711
  function writeQueue(queue) {
712
712
  ensureDir();
713
713
  const tmp = `${QUEUE_PATH}.tmp`;
714
- writeFileSync3(tmp, JSON.stringify(queue, null, 2));
714
+ writeFileSync3(tmp, JSON.stringify(queue, null, 2), { mode: 384 });
715
715
  renameSync2(tmp, QUEUE_PATH);
716
716
  }
717
717
  function queueIntercom(targetSession, reason) {
@@ -2290,6 +2290,7 @@ __export(database_exports, {
2290
2290
  isInitialized: () => isInitialized,
2291
2291
  setExternalClient: () => setExternalClient
2292
2292
  });
2293
+ import { chmodSync as chmodSync2 } from "fs";
2293
2294
  import { createClient } from "@libsql/client";
2294
2295
  async function initDatabase(config) {
2295
2296
  if (_walCheckpointTimer) {
@@ -2331,6 +2332,16 @@ async function initDatabase(config) {
2331
2332
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
2332
2333
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
2333
2334
  }
2335
+ try {
2336
+ chmodSync2(config.dbPath, 384);
2337
+ for (const suffix of ["-wal", "-shm"]) {
2338
+ try {
2339
+ chmodSync2(config.dbPath + suffix, 384);
2340
+ } catch {
2341
+ }
2342
+ }
2343
+ } catch {
2344
+ }
2334
2345
  }
2335
2346
  function isInitialized() {
2336
2347
  return _adapterClient !== null || _client !== null;
@@ -1703,6 +1703,7 @@ __export(database_exports, {
1703
1703
  isInitialized: () => isInitialized,
1704
1704
  setExternalClient: () => setExternalClient
1705
1705
  });
1706
+ import { chmodSync as chmodSync2 } from "fs";
1706
1707
  import { createClient } from "@libsql/client";
1707
1708
  async function initDatabase(config) {
1708
1709
  if (_walCheckpointTimer) {
@@ -1744,6 +1745,16 @@ async function initDatabase(config) {
1744
1745
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1745
1746
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1746
1747
  }
1748
+ try {
1749
+ chmodSync2(config.dbPath, 384);
1750
+ for (const suffix of ["-wal", "-shm"]) {
1751
+ try {
1752
+ chmodSync2(config.dbPath + suffix, 384);
1753
+ } catch {
1754
+ }
1755
+ }
1756
+ } catch {
1757
+ }
1747
1758
  }
1748
1759
  function isInitialized() {
1749
1760
  return _adapterClient !== null || _client !== null;
@@ -1879,6 +1879,7 @@ __export(database_exports, {
1879
1879
  isInitialized: () => isInitialized,
1880
1880
  setExternalClient: () => setExternalClient
1881
1881
  });
1882
+ import { chmodSync as chmodSync2 } from "fs";
1882
1883
  import { createClient } from "@libsql/client";
1883
1884
  async function initDatabase(config) {
1884
1885
  if (_walCheckpointTimer) {
@@ -1920,6 +1921,16 @@ async function initDatabase(config) {
1920
1921
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1921
1922
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1922
1923
  }
1924
+ try {
1925
+ chmodSync2(config.dbPath, 384);
1926
+ for (const suffix of ["-wal", "-shm"]) {
1927
+ try {
1928
+ chmodSync2(config.dbPath + suffix, 384);
1929
+ } catch {
1930
+ }
1931
+ }
1932
+ } catch {
1933
+ }
1923
1934
  }
1924
1935
  function isInitialized() {
1925
1936
  return _adapterClient !== null || _client !== null;
@@ -1704,6 +1704,7 @@ __export(database_exports, {
1704
1704
  isInitialized: () => isInitialized,
1705
1705
  setExternalClient: () => setExternalClient
1706
1706
  });
1707
+ import { chmodSync as chmodSync2 } from "fs";
1707
1708
  import { createClient } from "@libsql/client";
1708
1709
  async function initDatabase(config) {
1709
1710
  if (_walCheckpointTimer) {
@@ -1745,6 +1746,16 @@ async function initDatabase(config) {
1745
1746
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1746
1747
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1747
1748
  }
1749
+ try {
1750
+ chmodSync2(config.dbPath, 384);
1751
+ for (const suffix of ["-wal", "-shm"]) {
1752
+ try {
1753
+ chmodSync2(config.dbPath + suffix, 384);
1754
+ } catch {
1755
+ }
1756
+ }
1757
+ } catch {
1758
+ }
1748
1759
  }
1749
1760
  function isInitialized() {
1750
1761
  return _adapterClient !== null || _client !== null;
@@ -1704,6 +1704,7 @@ __export(database_exports, {
1704
1704
  isInitialized: () => isInitialized,
1705
1705
  setExternalClient: () => setExternalClient
1706
1706
  });
1707
+ import { chmodSync as chmodSync2 } from "fs";
1707
1708
  import { createClient } from "@libsql/client";
1708
1709
  async function initDatabase(config) {
1709
1710
  if (_walCheckpointTimer) {
@@ -1745,6 +1746,16 @@ async function initDatabase(config) {
1745
1746
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1746
1747
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1747
1748
  }
1749
+ try {
1750
+ chmodSync2(config.dbPath, 384);
1751
+ for (const suffix of ["-wal", "-shm"]) {
1752
+ try {
1753
+ chmodSync2(config.dbPath + suffix, 384);
1754
+ } catch {
1755
+ }
1756
+ }
1757
+ } catch {
1758
+ }
1748
1759
  }
1749
1760
  function isInitialized() {
1750
1761
  return _adapterClient !== null || _client !== null;
@@ -1999,6 +1999,7 @@ __export(database_exports, {
1999
1999
  isInitialized: () => isInitialized,
2000
2000
  setExternalClient: () => setExternalClient
2001
2001
  });
2002
+ import { chmodSync as chmodSync2 } from "fs";
2002
2003
  import { createClient } from "@libsql/client";
2003
2004
  async function initDatabase(config) {
2004
2005
  if (_walCheckpointTimer) {
@@ -2040,6 +2041,16 @@ async function initDatabase(config) {
2040
2041
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
2041
2042
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
2042
2043
  }
2044
+ try {
2045
+ chmodSync2(config.dbPath, 384);
2046
+ for (const suffix of ["-wal", "-shm"]) {
2047
+ try {
2048
+ chmodSync2(config.dbPath + suffix, 384);
2049
+ } catch {
2050
+ }
2051
+ }
2052
+ } catch {
2053
+ }
2043
2054
  }
2044
2055
  function isInitialized() {
2045
2056
  return _adapterClient !== null || _client !== null;
@@ -1955,6 +1955,7 @@ __export(database_exports, {
1955
1955
  isInitialized: () => isInitialized,
1956
1956
  setExternalClient: () => setExternalClient
1957
1957
  });
1958
+ import { chmodSync as chmodSync2 } from "fs";
1958
1959
  import { createClient } from "@libsql/client";
1959
1960
  async function initDatabase(config) {
1960
1961
  if (_walCheckpointTimer) {
@@ -1996,6 +1997,16 @@ async function initDatabase(config) {
1996
1997
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1997
1998
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1998
1999
  }
2000
+ try {
2001
+ chmodSync2(config.dbPath, 384);
2002
+ for (const suffix of ["-wal", "-shm"]) {
2003
+ try {
2004
+ chmodSync2(config.dbPath + suffix, 384);
2005
+ } catch {
2006
+ }
2007
+ }
2008
+ } catch {
2009
+ }
1999
2010
  }
2000
2011
  function isInitialized() {
2001
2012
  return _adapterClient !== null || _client !== null;
@@ -782,7 +782,7 @@ function readQueue() {
782
782
  function writeQueue(queue) {
783
783
  ensureDir();
784
784
  const tmp = `${QUEUE_PATH}.tmp`;
785
- writeFileSync5(tmp, JSON.stringify(queue, null, 2));
785
+ writeFileSync5(tmp, JSON.stringify(queue, null, 2), { mode: 384 });
786
786
  renameSync3(tmp, QUEUE_PATH);
787
787
  }
788
788
  function queueIntercom(targetSession, reason) {
@@ -2290,6 +2290,7 @@ __export(database_exports, {
2290
2290
  isInitialized: () => isInitialized,
2291
2291
  setExternalClient: () => setExternalClient
2292
2292
  });
2293
+ import { chmodSync as chmodSync2 } from "fs";
2293
2294
  import { createClient } from "@libsql/client";
2294
2295
  async function initDatabase(config) {
2295
2296
  if (_walCheckpointTimer) {
@@ -2331,6 +2332,16 @@ async function initDatabase(config) {
2331
2332
  if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
2332
2333
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
2333
2334
  }
2335
+ try {
2336
+ chmodSync2(config.dbPath, 384);
2337
+ for (const suffix of ["-wal", "-shm"]) {
2338
+ try {
2339
+ chmodSync2(config.dbPath + suffix, 384);
2340
+ } catch {
2341
+ }
2342
+ }
2343
+ } catch {
2344
+ }
2334
2345
  }
2335
2346
  function isInitialized() {
2336
2347
  return _adapterClient !== null || _client !== null;