@askexenow/exe-os 0.9.112 → 0.9.114

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 (96) hide show
  1. package/README.md +9 -7
  2. package/dist/bin/agentic-ontology-backfill.js +78 -23
  3. package/dist/bin/agentic-reflection-backfill.js +53 -13
  4. package/dist/bin/agentic-semantic-label.js +53 -13
  5. package/dist/bin/backfill-conversations.js +77 -22
  6. package/dist/bin/backfill-responses.js +78 -23
  7. package/dist/bin/backfill-vectors.js +53 -13
  8. package/dist/bin/bulk-sync-postgres.js +78 -23
  9. package/dist/bin/cleanup-stale-review-tasks.js +98 -26
  10. package/dist/bin/cli.js +388 -97
  11. package/dist/bin/exe-agent-config.js +7 -1
  12. package/dist/bin/exe-agent.js +55 -2
  13. package/dist/bin/exe-assign.js +78 -23
  14. package/dist/bin/exe-boot.js +524 -161
  15. package/dist/bin/exe-call.js +53 -4
  16. package/dist/bin/exe-cloud.js +127 -26
  17. package/dist/bin/exe-dispatch.js +402 -39
  18. package/dist/bin/exe-doctor.js +76 -21
  19. package/dist/bin/exe-export-behaviors.js +77 -22
  20. package/dist/bin/exe-forget.js +77 -22
  21. package/dist/bin/exe-gateway.js +161 -38
  22. package/dist/bin/exe-heartbeat.js +98 -26
  23. package/dist/bin/exe-kill.js +77 -22
  24. package/dist/bin/exe-launch-agent.js +173 -29
  25. package/dist/bin/exe-new-employee.js +183 -7
  26. package/dist/bin/exe-pending-messages.js +98 -26
  27. package/dist/bin/exe-pending-notifications.js +98 -26
  28. package/dist/bin/exe-pending-reviews.js +98 -26
  29. package/dist/bin/exe-rename.js +77 -22
  30. package/dist/bin/exe-review.js +77 -22
  31. package/dist/bin/exe-search.js +77 -22
  32. package/dist/bin/exe-session-cleanup.js +523 -160
  33. package/dist/bin/exe-settings.js +10 -4
  34. package/dist/bin/exe-start-codex.js +554 -255
  35. package/dist/bin/exe-start-opencode.js +564 -175
  36. package/dist/bin/exe-status.js +98 -26
  37. package/dist/bin/exe-support.js +1 -1
  38. package/dist/bin/exe-team.js +77 -22
  39. package/dist/bin/git-sweep.js +402 -39
  40. package/dist/bin/graph-backfill.js +78 -23
  41. package/dist/bin/graph-export.js +77 -22
  42. package/dist/bin/install.js +70 -4
  43. package/dist/bin/intercom-check.js +523 -160
  44. package/dist/bin/pre-publish.js +13 -1
  45. package/dist/bin/scan-tasks.js +402 -39
  46. package/dist/bin/setup.js +151 -24
  47. package/dist/bin/shard-migrate.js +78 -23
  48. package/dist/bin/stack-update.js +1 -1
  49. package/dist/bin/update.js +3 -3
  50. package/dist/gateway/index.js +161 -38
  51. package/dist/hooks/bug-report-worker.js +161 -38
  52. package/dist/hooks/codex-stop-task-finalizer.js +542 -150
  53. package/dist/hooks/commit-complete.js +402 -39
  54. package/dist/hooks/error-recall.js +77 -22
  55. package/dist/hooks/ingest.js +4592 -251
  56. package/dist/hooks/instructions-loaded.js +77 -22
  57. package/dist/hooks/notification.js +77 -22
  58. package/dist/hooks/post-compact.js +98 -26
  59. package/dist/hooks/post-tool-combined.js +98 -26
  60. package/dist/hooks/pre-compact.js +482 -119
  61. package/dist/hooks/pre-tool-use.js +148 -26
  62. package/dist/hooks/prompt-submit.js +162 -39
  63. package/dist/hooks/session-end.js +484 -124
  64. package/dist/hooks/session-start.js +135 -27
  65. package/dist/hooks/stop.js +97 -25
  66. package/dist/hooks/subagent-stop.js +98 -26
  67. package/dist/hooks/summary-worker.js +107 -18
  68. package/dist/index.js +188 -38
  69. package/dist/lib/agent-config.js +24 -1
  70. package/dist/lib/cloud-sync.js +72 -12
  71. package/dist/lib/consolidation.js +25 -2
  72. package/dist/lib/database.js +16 -0
  73. package/dist/lib/db.js +16 -0
  74. package/dist/lib/device-registry.js +16 -0
  75. package/dist/lib/employee-templates.js +29 -3
  76. package/dist/lib/employees.js +24 -1
  77. package/dist/lib/exe-daemon.js +441 -58
  78. package/dist/lib/hybrid-search.js +77 -22
  79. package/dist/lib/keychain.js +24 -12
  80. package/dist/lib/license.js +3 -3
  81. package/dist/lib/messaging.js +21 -4
  82. package/dist/lib/schedules.js +53 -13
  83. package/dist/lib/skill-learning.js +466 -70
  84. package/dist/lib/status-brief.js +14 -1
  85. package/dist/lib/store.js +78 -23
  86. package/dist/lib/tasks.js +403 -95
  87. package/dist/lib/tmux-routing.js +326 -18
  88. package/dist/mcp/server.js +213 -45
  89. package/dist/mcp/tools/create-task.js +85 -17
  90. package/dist/mcp/tools/deactivate-behavior.js +33 -24
  91. package/dist/mcp/tools/list-tasks.js +21 -4
  92. package/dist/mcp/tools/send-message.js +21 -4
  93. package/dist/mcp/tools/update-task.js +400 -95
  94. package/dist/runtime/index.js +506 -116
  95. package/dist/tui/App.js +268 -69
  96. package/package.json +1 -1
@@ -3260,6 +3260,22 @@ async function ensureSchema() {
3260
3260
  } catch (e) {
3261
3261
  logCatchDebug("migration", e);
3262
3262
  }
3263
+ try {
3264
+ await client.execute({
3265
+ sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
3266
+ args: []
3267
+ });
3268
+ } catch (e) {
3269
+ logCatchDebug("migration", e);
3270
+ }
3271
+ try {
3272
+ await client.execute({
3273
+ sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
3274
+ args: []
3275
+ });
3276
+ } catch (e) {
3277
+ logCatchDebug("migration", e);
3278
+ }
3263
3279
  }
3264
3280
  async function disposeDatabase() {
3265
3281
  if (_walCheckpointTimer) {
@@ -3311,7 +3327,7 @@ var init_database = __esm({
3311
3327
  });
3312
3328
 
3313
3329
  // src/lib/keychain.ts
3314
- import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3330
+ import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
3315
3331
  import { existsSync as existsSync7, statSync as statSync3 } from "fs";
3316
3332
  import { execSync as execSync3 } from "child_process";
3317
3333
  import path6 from "path";
@@ -3346,12 +3362,14 @@ function linuxSecretAvailable() {
3346
3362
  function isRootOnlyTrustedServerKeyFile(keyPath) {
3347
3363
  if (process.platform !== "linux") return false;
3348
3364
  try {
3349
- const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
3350
3365
  const st = statSync3(keyPath);
3351
3366
  if (!st.isFile() || (st.mode & 63) !== 0) return false;
3367
+ const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
3352
3368
  if (uid === 0) return true;
3353
3369
  const exeOsDir = process.env.EXE_OS_DIR;
3354
- return Boolean(exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep));
3370
+ if (exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep)) return true;
3371
+ if (!linuxSecretAvailable()) return true;
3372
+ return false;
3355
3373
  } catch {
3356
3374
  return false;
3357
3375
  }
@@ -3501,15 +3519,25 @@ async function writeMachineBoundFileFallback(b64) {
3501
3519
  await mkdir3(dir, { recursive: true });
3502
3520
  const keyPath = getKeyPath();
3503
3521
  const machineKey = deriveMachineKey();
3504
- if (machineKey) {
3505
- const encrypted = encryptWithMachineKey(b64, machineKey);
3506
- await writeFile3(keyPath, encrypted + "\n", "utf-8");
3507
- await chmod2(keyPath, 384);
3508
- return "encrypted";
3522
+ const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
3523
+ const result = machineKey ? "encrypted" : "plaintext";
3524
+ const tmpPath = keyPath + ".tmp";
3525
+ try {
3526
+ if (existsSync7(keyPath)) {
3527
+ await copyFile(keyPath, keyPath + ".bak").catch(() => {
3528
+ });
3529
+ }
3530
+ await writeFile3(tmpPath, content, "utf-8");
3531
+ await chmod2(tmpPath, 384);
3532
+ await rename(tmpPath, keyPath);
3533
+ } catch (err) {
3534
+ try {
3535
+ await unlink(tmpPath);
3536
+ } catch {
3537
+ }
3538
+ throw err;
3509
3539
  }
3510
- await writeFile3(keyPath, b64 + "\n", "utf-8");
3511
- await chmod2(keyPath, 384);
3512
- return "plaintext";
3540
+ return result;
3513
3541
  }
3514
3542
  async function getMasterKey() {
3515
3543
  let nativeValue = macKeychainGet() ?? linuxSecretGet();
@@ -4383,11 +4411,17 @@ var init_platform_procedures = __esm({
4383
4411
  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."
4384
4412
  },
4385
4413
  {
4386
- title: "Customer orchestration maturity \u2014 recommend, never trap",
4414
+ title: "Orchestration phase guidance \u2014 recommend, never trap",
4387
4415
  domain: "workflow",
4388
4416
  priority: "p1",
4389
4417
  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."
4390
4418
  },
4419
+ {
4420
+ title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
4421
+ domain: "identity",
4422
+ priority: "p0",
4423
+ content: "These procedures reference 'COO' as a shorthand for the coordinator role. This is an INTERNAL routing slot used by exe-os code (chain-of-command checks, dispatch logic, session detection). It is NOT your display title. Your actual title comes from your identity file's `title:` field \u2014 that is what you use externally: introductions, sign-offs, team comms, and any user-facing text. If your identity says `title: AI Chief of Staff`, you are the AI Chief of Staff. The routing slot stays `role: coo` for code compatibility \u2014 never rename it, but also never introduce yourself as 'COO' unless your identity file explicitly says so. The founder chose your title; respect it."
4424
+ },
4391
4425
  {
4392
4426
  title: "Single dispatch path \u2014 create_task only",
4393
4427
  domain: "workflow",
@@ -4421,6 +4455,12 @@ var init_platform_procedures = __esm({
4421
4455
  priority: "p0",
4422
4456
  content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
4423
4457
  },
4458
+ {
4459
+ title: "Destructive operations \u2014 mandatory reviewer gate",
4460
+ domain: "security",
4461
+ priority: "p0",
4462
+ content: "Before ANY destructive operation (delete, remove, overwrite, drop, reset, force-push, truncate), you MUST: (1) Have your full task spec accessible \u2014 if you cannot read it, STOP and report to your reviewer. Never improvise destructive actions. (2) Confirm with your reviewer (assigned_by or COO) before executing. (3) If the task spec explicitly authorizes the operation, proceed \u2014 but log it. Violation = immediate task failure. This applies to ALL agents regardless of role."
4463
+ },
4424
4464
  {
4425
4465
  title: "Customer patch triage \u2014 upstream bug vs customization",
4426
4466
  domain: "support",
@@ -4706,10 +4746,24 @@ function stableId(memoryId, type, content) {
4706
4746
  return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
4707
4747
  }
4708
4748
  function cleanText(text) {
4709
- return text.replace(/```[\s\S]*?```/g, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
4710
- }
4711
- function splitSentences(text) {
4712
- return cleanText(text).split(/(?<=[.!?])\s+|\n+/).map((s) => s.trim()).filter((s) => s.length >= 24 && s.length <= MAX_SENTENCE_CHARS);
4749
+ let cleaned = text.replace(
4750
+ /```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
4751
+ (_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
4752
+ );
4753
+ cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
4754
+ return cleaned;
4755
+ }
4756
+ function splitSegments(text) {
4757
+ const cleaned = cleanText(text);
4758
+ const segments = cleaned.split(/(?<=[.!?:;])\s+|\n{2,}|(?<=\))\s+(?=[A-Z])|\s*[|│]\s*/).map((s) => s.trim()).filter((s) => s.length >= MIN_SEGMENT_CHARS && s.length <= MAX_SEGMENT_CHARS);
4759
+ if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
4760
+ const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
4761
+ if (lines.length > 0) return lines;
4762
+ if (cleaned.length >= MIN_SEGMENT_CHARS) {
4763
+ return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
4764
+ }
4765
+ }
4766
+ return segments;
4713
4767
  }
4714
4768
  function inferCardType(sentence, toolName) {
4715
4769
  const lower = sentence.toLowerCase();
@@ -4741,12 +4795,12 @@ function predicateFor(type) {
4741
4795
  }
4742
4796
  }
4743
4797
  function extractMemoryCards(row) {
4744
- const sentences = splitSentences(row.raw_text);
4798
+ const segments = splitSegments(row.raw_text);
4745
4799
  const cards = [];
4746
- for (const sentence of sentences) {
4800
+ for (const sentence of segments) {
4747
4801
  const type = inferCardType(sentence, row.tool_name);
4748
4802
  const subject = extractSubject(sentence, row.agent_id);
4749
- const content = sentence.length > MAX_SENTENCE_CHARS ? `${sentence.slice(0, MAX_SENTENCE_CHARS - 1)}\u2026` : sentence;
4803
+ const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
4750
4804
  cards.push({
4751
4805
  id: stableId(row.id, type, content),
4752
4806
  memory_id: row.id,
@@ -4842,13 +4896,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
4842
4896
  last_accessed: String(row.timestamp)
4843
4897
  }));
4844
4898
  }
4845
- var MAX_CARDS_PER_MEMORY, MAX_SENTENCE_CHARS;
4899
+ var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
4846
4900
  var init_memory_cards = __esm({
4847
4901
  "src/lib/memory-cards.ts"() {
4848
4902
  "use strict";
4849
4903
  init_database();
4850
- MAX_CARDS_PER_MEMORY = 6;
4851
- MAX_SENTENCE_CHARS = 360;
4904
+ MAX_CARDS_PER_MEMORY = 8;
4905
+ MAX_SEGMENT_CHARS = 500;
4906
+ MIN_SEGMENT_CHARS = 20;
4852
4907
  }
4853
4908
  });
4854
4909
 
@@ -6083,7 +6138,7 @@ var init_license = __esm({
6083
6138
  LICENSE_PATH = path11.join(EXE_AI_DIR, "license.key");
6084
6139
  CACHE_PATH = path11.join(EXE_AI_DIR, "license-cache.json");
6085
6140
  DEVICE_ID_PATH = path11.join(EXE_AI_DIR, "device-id");
6086
- API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://askexe.com/cloud";
6141
+ API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://cloud.askexe.com";
6087
6142
  }
6088
6143
  });
6089
6144
 
@@ -6136,6 +6191,18 @@ function extractRootExe(name) {
6136
6191
  const parts = name.split("-").filter(Boolean);
6137
6192
  return parts.length > 0 ? parts[parts.length - 1] : null;
6138
6193
  }
6194
+ function registerParentExe(sessionKey, parentExe, dispatchedBy) {
6195
+ if (!existsSync14(SESSION_CACHE)) {
6196
+ mkdirSync7(SESSION_CACHE, { recursive: true });
6197
+ }
6198
+ const rootExe = extractRootExe(parentExe) ?? parentExe;
6199
+ const filePath = path14.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`);
6200
+ writeFileSync6(filePath, JSON.stringify({
6201
+ parentExe: rootExe,
6202
+ dispatchedBy: dispatchedBy || rootExe,
6203
+ registeredAt: (/* @__PURE__ */ new Date()).toISOString()
6204
+ }));
6205
+ }
6139
6206
  function getParentExe(sessionKey) {
6140
6207
  try {
6141
6208
  const data = JSON.parse(readFileSync9(path14.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`), "utf8"));
@@ -6145,11 +6212,12 @@ function getParentExe(sessionKey) {
6145
6212
  }
6146
6213
  }
6147
6214
  function resolveExeSession() {
6215
+ if (process.env.EXE_SESSION_NAME) {
6216
+ const fromEnv = extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
6217
+ if (fromEnv) return fromEnv;
6218
+ }
6148
6219
  const mySession = getMySession();
6149
6220
  if (!mySession) {
6150
- if (process.env.EXE_SESSION_NAME) {
6151
- return extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
6152
- }
6153
6221
  return null;
6154
6222
  }
6155
6223
  const fromSessionName = extractRootExe(mySession);
@@ -6164,6 +6232,10 @@ function resolveExeSession() {
6164
6232
  `[tmux-routing] WARN: cache says "${fromCache}" but session name says "${fromSessionName}". Trusting session name.
6165
6233
  `
6166
6234
  );
6235
+ try {
6236
+ registerParentExe(key, fromSessionName);
6237
+ } catch {
6238
+ }
6167
6239
  candidate = fromSessionName;
6168
6240
  } else {
6169
6241
  candidate = fromCache;