@askexenow/exe-os 0.8.109 → 0.9.0

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.
package/dist/bin/cli.js CHANGED
@@ -10315,7 +10315,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
10315
10315
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
10316
10316
  `
10317
10317
  );
10318
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
10318
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
10319
10319
  } else if (useOpencode) {
10320
10320
  const binName = `${employeeName}-opencode`;
10321
10321
  process.stderr.write(
@@ -6268,7 +6268,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
6268
6268
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
6269
6269
  `
6270
6270
  );
6271
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
6271
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
6272
6272
  } else if (useOpencode) {
6273
6273
  const binName = `${employeeName}-opencode`;
6274
6274
  process.stderr.write(
@@ -4434,7 +4434,7 @@ function spawnEmployee(employeeName2, exeSession2, projectDir2, opts) {
4434
4434
  `[tmux-routing] agent-config: ${employeeName2} \u2192 codex (${agentRtConfig.model})
4435
4435
  `
4436
4436
  );
4437
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName2}${cleanupSuffix}`;
4437
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName2} --session ${sessionName}${cleanupSuffix}`;
4438
4438
  } else if (useOpencode) {
4439
4439
  const binName = `${employeeName2}-opencode`;
4440
4440
  process.stderr.write(
@@ -9159,7 +9159,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
9159
9159
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
9160
9160
  `
9161
9161
  );
9162
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
9162
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
9163
9163
  } else if (useOpencode) {
9164
9164
  const binName = `${employeeName}-opencode`;
9165
9165
  process.stderr.write(
@@ -6270,7 +6270,7 @@ function spawnEmployee(employeeName, exeSession2, projectDir, opts) {
6270
6270
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
6271
6271
  `
6272
6272
  );
6273
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
6273
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
6274
6274
  } else if (useOpencode) {
6275
6275
  const binName = `${employeeName}-opencode`;
6276
6276
  process.stderr.write(
@@ -2791,8 +2791,17 @@ function resolveAgent(argv) {
2791
2791
  );
2792
2792
  }
2793
2793
  const agent = rest[idx + 1].toLowerCase();
2794
- const passthrough = [...rest.slice(0, idx), ...rest.slice(idx + 2)];
2795
- return { agent, passthrough };
2794
+ const withoutAgent = [...rest.slice(0, idx), ...rest.slice(idx + 2)];
2795
+ const sessIdx = withoutAgent.indexOf("--session");
2796
+ let sessionName;
2797
+ let passthrough;
2798
+ if (sessIdx !== -1 && withoutAgent[sessIdx + 1]) {
2799
+ sessionName = withoutAgent[sessIdx + 1];
2800
+ passthrough = [...withoutAgent.slice(0, sessIdx), ...withoutAgent.slice(sessIdx + 2)];
2801
+ } else {
2802
+ passthrough = withoutAgent;
2803
+ }
2804
+ return { agent, passthrough, sessionName };
2796
2805
  }
2797
2806
  function loadIdentity(agent) {
2798
2807
  const dir = path11.join(os9.homedir(), ".exe-os", "identity");
@@ -2839,8 +2848,9 @@ function writePromptFile(agent, identity, behaviorsPath) {
2839
2848
  async function main() {
2840
2849
  let agent;
2841
2850
  let passthrough;
2851
+ let sessionName;
2842
2852
  try {
2843
- ({ agent, passthrough } = resolveAgent(process.argv));
2853
+ ({ agent, passthrough, sessionName } = resolveAgent(process.argv));
2844
2854
  } catch (err) {
2845
2855
  process.stderr.write(`${err.message}
2846
2856
  `);
@@ -2941,6 +2951,37 @@ async function main() {
2941
2951
  `
2942
2952
  );
2943
2953
  }
2954
+ const WORKTREE_ROLES = /* @__PURE__ */ new Set(["Principal Engineer", "Staff Code Reviewer"]);
2955
+ let worktreePath = null;
2956
+ const worktreeName = sessionName ? sessionName.split("-")[0] : agent;
2957
+ process.stderr.write(`[exe-start-codex] agent=${agent} session=${sessionName ?? "none"} worktree=${worktreeName} role="${empRole}" worktree-eligible=${WORKTREE_ROLES.has(empRole)}
2958
+ `);
2959
+ if (WORKTREE_ROLES.has(empRole)) {
2960
+ try {
2961
+ const { execSync: es } = await import("child_process");
2962
+ const worktreeDir = path11.join(process.cwd(), ".worktrees", worktreeName);
2963
+ const branchName = `${worktreeName}/codex-${Date.now()}`;
2964
+ if (existsSync10(worktreeDir)) {
2965
+ worktreePath = worktreeDir;
2966
+ process.stderr.write(`[exe-start-codex] Reusing worktree at ${worktreeDir}
2967
+ `);
2968
+ } else {
2969
+ mkdirSync7(path11.dirname(worktreeDir), { recursive: true });
2970
+ es(`git worktree add "${worktreeDir}" -b "${branchName}" HEAD`, {
2971
+ encoding: "utf-8",
2972
+ timeout: 3e4
2973
+ });
2974
+ worktreePath = worktreeDir;
2975
+ process.stderr.write(`[exe-start-codex] Created worktree at ${worktreeDir} (branch: ${branchName})
2976
+ `);
2977
+ }
2978
+ } catch (err) {
2979
+ process.stderr.write(
2980
+ `[exe-start-codex] Worktree creation failed for ${agent}: ${err instanceof Error ? err.message : String(err)}. Falling back to main checkout.
2981
+ `
2982
+ );
2983
+ }
2984
+ }
2944
2985
  const effectiveModel = process.env.EXE_AGENT_MODEL ?? CODEX.defaultModel;
2945
2986
  const args = [
2946
2987
  "-m",
@@ -2949,6 +2990,9 @@ async function main() {
2949
2990
  CODEX.inlineFlag,
2950
2991
  ...passthrough
2951
2992
  ];
2993
+ if (worktreePath) {
2994
+ args.push("-C", worktreePath);
2995
+ }
2952
2996
  if (promptPath) {
2953
2997
  args.push("-c", `model_instructions_file="${promptPath}"`);
2954
2998
  }
@@ -4922,7 +4922,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
4922
4922
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
4923
4923
  `
4924
4924
  );
4925
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
4925
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
4926
4926
  } else if (useOpencode) {
4927
4927
  const binName = `${employeeName}-opencode`;
4928
4928
  process.stderr.write(
@@ -4927,7 +4927,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
4927
4927
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
4928
4928
  `
4929
4929
  );
4930
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
4930
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
4931
4931
  } else if (useOpencode) {
4932
4932
  const binName = `${employeeName}-opencode`;
4933
4933
  process.stderr.write(
@@ -7501,7 +7501,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
7501
7501
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
7502
7502
  `
7503
7503
  );
7504
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
7504
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
7505
7505
  } else if (useOpencode) {
7506
7506
  const binName = `${employeeName}-opencode`;
7507
7507
  process.stderr.write(
@@ -3433,7 +3433,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
3433
3433
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
3434
3434
  `
3435
3435
  );
3436
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
3436
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
3437
3437
  } else if (useOpencode) {
3438
3438
  const binName = `${employeeName}-opencode`;
3439
3439
  process.stderr.write(
@@ -4921,7 +4921,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
4921
4921
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
4922
4922
  `
4923
4923
  );
4924
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
4924
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
4925
4925
  } else if (useOpencode) {
4926
4926
  const binName = `${employeeName}-opencode`;
4927
4927
  process.stderr.write(
@@ -4300,7 +4300,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
4300
4300
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
4301
4301
  `
4302
4302
  );
4303
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
4303
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
4304
4304
  } else if (useOpencode) {
4305
4305
  const binName = `${employeeName}-opencode`;
4306
4306
  process.stderr.write(
@@ -4905,7 +4905,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
4905
4905
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
4906
4906
  `
4907
4907
  );
4908
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
4908
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
4909
4909
  } else if (useOpencode) {
4910
4910
  const binName = `${employeeName}-opencode`;
4911
4911
  process.stderr.write(
@@ -7405,7 +7405,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
7405
7405
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
7406
7406
  `
7407
7407
  );
7408
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
7408
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
7409
7409
  } else if (useOpencode) {
7410
7410
  const binName = `${employeeName}-opencode`;
7411
7411
  process.stderr.write(
@@ -5107,7 +5107,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
5107
5107
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
5108
5108
  `
5109
5109
  );
5110
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
5110
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
5111
5111
  } else if (useOpencode) {
5112
5112
  const binName = `${employeeName}-opencode`;
5113
5113
  process.stderr.write(
package/dist/index.js CHANGED
@@ -5339,7 +5339,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
5339
5339
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
5340
5340
  `
5341
5341
  );
5342
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
5342
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
5343
5343
  } else if (useOpencode) {
5344
5344
  const binName = `${employeeName}-opencode`;
5345
5345
  process.stderr.write(
@@ -0,0 +1,117 @@
1
+ // src/lib/cloudflare-dns.ts
2
+ var CLOUDFLARE_API_BASE_URL = "https://api.cloudflare.com/client/v4";
3
+ var DNS_RECORD_TYPE_A = "A";
4
+ var DEFAULT_PROXIED = true;
5
+ var DEFAULT_TTL = 1;
6
+ var REQUEST_TIMEOUT_MS = 3e4;
7
+ var UNKNOWN_ERROR_CODE = "unknown";
8
+ async function createARecord(cfApiToken, zoneId, domain, ip, opts) {
9
+ const proxied = opts?.proxied ?? DEFAULT_PROXIED;
10
+ const ttl = opts?.ttl ?? DEFAULT_TTL;
11
+ const response = await requestCloudflare(cfApiToken, zoneId, {
12
+ method: "POST",
13
+ body: {
14
+ type: DNS_RECORD_TYPE_A,
15
+ name: domain,
16
+ content: ip,
17
+ proxied,
18
+ ttl
19
+ }
20
+ });
21
+ return mapDnsRecord(response);
22
+ }
23
+ async function deleteARecord(cfApiToken, zoneId, recordId) {
24
+ await requestCloudflare(cfApiToken, zoneId, {
25
+ method: "DELETE",
26
+ path: `/dns_records/${recordId}`
27
+ });
28
+ }
29
+ async function findARecord(cfApiToken, zoneId, name) {
30
+ const query = new URLSearchParams({
31
+ type: DNS_RECORD_TYPE_A,
32
+ name
33
+ });
34
+ const records = await requestCloudflare(cfApiToken, zoneId, {
35
+ method: "GET",
36
+ query
37
+ });
38
+ const record = records[0];
39
+ return record ? mapDnsRecord(record) : null;
40
+ }
41
+ async function requestCloudflare(cfApiToken, zoneId, options) {
42
+ const response = await fetch(buildUrl(zoneId, options.path, options.query), {
43
+ method: options.method,
44
+ headers: buildHeaders(cfApiToken),
45
+ body: options.body ? JSON.stringify(options.body) : void 0,
46
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
47
+ });
48
+ const envelope = await parseEnvelope(response);
49
+ if (!response.ok || !envelope.success) {
50
+ throw toCloudflareError(response, envelope);
51
+ }
52
+ return envelope.result;
53
+ }
54
+ function buildUrl(zoneId, path = "/dns_records", query) {
55
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
56
+ const url = new URL(
57
+ `${CLOUDFLARE_API_BASE_URL}/zones/${zoneId}${normalizedPath}`
58
+ );
59
+ if (query) {
60
+ url.search = query.toString();
61
+ }
62
+ return url.toString();
63
+ }
64
+ function buildHeaders(cfApiToken) {
65
+ return {
66
+ Authorization: `Bearer ${cfApiToken}`,
67
+ "Content-Type": "application/json",
68
+ Accept: "application/json"
69
+ };
70
+ }
71
+ async function parseEnvelope(response) {
72
+ try {
73
+ return await response.json();
74
+ } catch {
75
+ return {
76
+ success: false,
77
+ errors: [
78
+ {
79
+ code: UNKNOWN_ERROR_CODE,
80
+ message: `HTTP ${response.status}: ${response.statusText}`
81
+ }
82
+ ],
83
+ messages: [],
84
+ result: null
85
+ };
86
+ }
87
+ }
88
+ function toCloudflareError(response, envelope) {
89
+ const firstError = envelope.errors[0];
90
+ const errorCode = String(firstError?.code ?? UNKNOWN_ERROR_CODE);
91
+ const message = firstError?.message ?? `HTTP ${response.status}: ${response.statusText}`;
92
+ return new CloudflareError(response.status, errorCode, message);
93
+ }
94
+ function mapDnsRecord(record) {
95
+ return {
96
+ recordId: record.id,
97
+ name: record.name,
98
+ ip: record.content,
99
+ proxied: record.proxied
100
+ };
101
+ }
102
+ var CloudflareError = class extends Error {
103
+ status;
104
+ errorCode;
105
+ constructor(status, errorCode, message) {
106
+ super(message);
107
+ this.name = "CloudflareError";
108
+ this.status = status;
109
+ this.errorCode = errorCode;
110
+ }
111
+ };
112
+ export {
113
+ CloudflareError,
114
+ createARecord,
115
+ deleteARecord,
116
+ findARecord
117
+ };
@@ -5606,7 +5606,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
5606
5606
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
5607
5607
  `
5608
5608
  );
5609
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
5609
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
5610
5610
  } else if (useOpencode) {
5611
5611
  const binName = `${employeeName}-opencode`;
5612
5612
  process.stderr.write(
package/dist/lib/tasks.js CHANGED
@@ -1846,7 +1846,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
1846
1846
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
1847
1847
  `
1848
1848
  );
1849
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
1849
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
1850
1850
  } else if (useOpencode) {
1851
1851
  const binName = `${employeeName}-opencode`;
1852
1852
  process.stderr.write(
@@ -3426,7 +3426,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
3426
3426
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
3427
3427
  `
3428
3428
  );
3429
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
3429
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
3430
3430
  } else if (useOpencode) {
3431
3431
  const binName = `${employeeName}-opencode`;
3432
3432
  process.stderr.write(
@@ -7156,7 +7156,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
7156
7156
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
7157
7157
  `
7158
7158
  );
7159
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
7159
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
7160
7160
  } else if (useOpencode) {
7161
7161
  const binName = `${employeeName}-opencode`;
7162
7162
  process.stderr.write(
@@ -2051,7 +2051,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
2051
2051
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
2052
2052
  `
2053
2053
  );
2054
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
2054
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
2055
2055
  } else if (useOpencode) {
2056
2056
  const binName = `${employeeName}-opencode`;
2057
2057
  process.stderr.write(
@@ -5038,7 +5038,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
5038
5038
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
5039
5039
  `
5040
5040
  );
5041
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
5041
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
5042
5042
  } else if (useOpencode) {
5043
5043
  const binName = `${employeeName}-opencode`;
5044
5044
  process.stderr.write(
package/dist/tui/App.js CHANGED
@@ -5544,7 +5544,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
5544
5544
  `[tmux-routing] agent-config: ${employeeName} \u2192 codex (${agentRtConfig.model})
5545
5545
  `
5546
5546
  );
5547
- spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName}${cleanupSuffix}`;
5547
+ spawnCommand = `${envPrefix} exe-start-codex --agent ${employeeName} --session ${sessionName}${cleanupSuffix}`;
5548
5548
  } else if (useOpencode) {
5549
5549
  const binName = `${employeeName}-opencode`;
5550
5550
  process.stderr.write(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askexenow/exe-os",
3
- "version": "0.8.109",
3
+ "version": "0.9.0",
4
4
  "description": "AI employee operating system — persistent memory, task management, and multi-agent coordination for Claude Code.",
5
5
  "license": "CC-BY-NC-4.0",
6
6
  "type": "module",