@askexenow/exe-os 0.8.0 → 0.8.1
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/README.md +178 -79
- package/dist/bin/backfill-responses.js +160 -8
- package/dist/bin/backfill-vectors.js +130 -1
- package/dist/bin/cleanup-stale-review-tasks.js +130 -1
- package/dist/bin/cli.js +10111 -7540
- package/dist/bin/exe-agent.js +159 -1
- package/dist/bin/exe-assign.js +235 -16
- package/dist/bin/exe-boot.js +344 -472
- package/dist/bin/exe-call.js +145 -1
- package/dist/bin/exe-cloud.js +11 -0
- package/dist/bin/exe-dispatch.js +37 -24
- package/dist/bin/exe-doctor.js +130 -1
- package/dist/bin/exe-export-behaviors.js +150 -7
- package/dist/bin/exe-forget.js +822 -665
- package/dist/bin/exe-gateway.js +470 -62
- package/dist/bin/exe-heartbeat.js +133 -2
- package/dist/bin/exe-kill.js +150 -7
- package/dist/bin/exe-launch-agent.js +150 -7
- package/dist/bin/exe-new-employee.js +756 -224
- package/dist/bin/exe-pending-messages.js +132 -2
- package/dist/bin/exe-pending-notifications.js +130 -1
- package/dist/bin/exe-pending-reviews.js +132 -2
- package/dist/bin/exe-review.js +160 -8
- package/dist/bin/exe-search.js +2473 -2008
- package/dist/bin/exe-session-cleanup.js +238 -51
- package/dist/bin/exe-settings.js +11 -0
- package/dist/bin/exe-status.js +130 -1
- package/dist/bin/exe-team.js +130 -1
- package/dist/bin/git-sweep.js +272 -16
- package/dist/bin/graph-backfill.js +150 -7
- package/dist/bin/graph-export.js +150 -7
- package/dist/bin/install.js +5 -0
- package/dist/bin/scan-tasks.js +238 -19
- package/dist/bin/setup.js +1776 -10
- package/dist/bin/shard-migrate.js +150 -7
- package/dist/bin/update.js +9 -6
- package/dist/bin/wiki-sync.js +150 -7
- package/dist/gateway/index.js +470 -62
- package/dist/hooks/bug-report-worker.js +195 -35
- package/dist/hooks/commit-complete.js +272 -16
- package/dist/hooks/error-recall.js +2313 -1847
- package/dist/hooks/exe-heartbeat-hook.js +5 -0
- package/dist/hooks/ingest-worker.js +330 -58
- package/dist/hooks/ingest.js +11 -0
- package/dist/hooks/instructions-loaded.js +199 -10
- package/dist/hooks/notification.js +199 -10
- package/dist/hooks/post-compact.js +199 -10
- package/dist/hooks/pre-compact.js +199 -10
- package/dist/hooks/pre-tool-use.js +199 -10
- package/dist/hooks/prompt-ingest-worker.js +179 -14
- package/dist/hooks/prompt-submit.js +781 -285
- package/dist/hooks/response-ingest-worker.js +1900 -1405
- package/dist/hooks/session-end.js +456 -12
- package/dist/hooks/session-start.js +2188 -1724
- package/dist/hooks/stop.js +200 -10
- package/dist/hooks/subagent-stop.js +199 -10
- package/dist/hooks/summary-worker.js +604 -334
- package/dist/index.js +554 -61
- package/dist/lib/cloud-sync.js +5 -0
- package/dist/lib/config.js +13 -0
- package/dist/lib/consolidation.js +5 -0
- package/dist/lib/database.js +104 -0
- package/dist/lib/device-registry.js +109 -0
- package/dist/lib/embedder.js +13 -0
- package/dist/lib/employee-templates.js +53 -26
- package/dist/lib/employees.js +5 -0
- package/dist/lib/exe-daemon-client.js +5 -0
- package/dist/lib/exe-daemon.js +493 -79
- package/dist/lib/file-grep.js +20 -4
- package/dist/lib/hybrid-search.js +1435 -190
- package/dist/lib/identity-templates.js +126 -5
- package/dist/lib/identity.js +5 -0
- package/dist/lib/license.js +5 -0
- package/dist/lib/messaging.js +37 -24
- package/dist/lib/schedules.js +130 -1
- package/dist/lib/skill-learning.js +11 -0
- package/dist/lib/status-brief.js +5 -0
- package/dist/lib/store.js +199 -10
- package/dist/lib/task-router.js +72 -6
- package/dist/lib/tasks.js +179 -50
- package/dist/lib/tmux-routing.js +179 -46
- package/dist/mcp/server.js +2129 -1855
- package/dist/mcp/tools/create-task.js +86 -36
- package/dist/mcp/tools/deactivate-behavior.js +5 -0
- package/dist/mcp/tools/list-tasks.js +39 -11
- package/dist/mcp/tools/send-message.js +37 -24
- package/dist/mcp/tools/update-task.js +153 -38
- package/dist/runtime/index.js +451 -59
- package/dist/tui/App.js +454 -59
- package/package.json +1 -1
package/dist/bin/exe-call.js
CHANGED
|
@@ -95,6 +95,11 @@ var DEFAULT_CONFIG = {
|
|
|
95
95
|
idleKillTicksRequired: 3,
|
|
96
96
|
idleKillIntercomAckWindowMs: 1e4,
|
|
97
97
|
maxAutoInstances: 10
|
|
98
|
+
},
|
|
99
|
+
autoUpdate: {
|
|
100
|
+
checkOnBoot: true,
|
|
101
|
+
autoInstall: false,
|
|
102
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
98
103
|
}
|
|
99
104
|
};
|
|
100
105
|
|
|
@@ -129,6 +134,145 @@ function isMainModule(importMetaUrl) {
|
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
136
|
|
|
137
|
+
// src/lib/employee-templates.ts
|
|
138
|
+
var BASE_OPERATING_PROCEDURES = `
|
|
139
|
+
EXE OS \u2014 VISION AND NON-NEGOTIABLE PRINCIPLES (above all work):
|
|
140
|
+
|
|
141
|
+
Product: "Hire the team you couldn't afford." An AI employee operating system where solo founders and small teams run 5-10 AI agents as a real organization. Three-layer cognition (identity/expertise/experience). Five runtime modes (CC Raw \u2192 TUI \u2192 Desktop). Local-first with E2EE cloud sync.
|
|
142
|
+
|
|
143
|
+
ICP (who we build for):
|
|
144
|
+
- Solopreneurs, SMB founders, creators with institutional IP
|
|
145
|
+
- Bootstrapped small e-commerce / fitness creators / influencers
|
|
146
|
+
- NOT VC-backed startups \u2014 intentionally excluded
|
|
147
|
+
|
|
148
|
+
Crown jewels (load-bearing for all three business paths \u2014 never compromise):
|
|
149
|
+
- Memory sovereignty (user owns everything, E2EE, local-first)
|
|
150
|
+
- Three-layer cognition (identity/expertise/experience)
|
|
151
|
+
- MCP contract boundary (surfaces consume memory OS via MCP only \u2014 never direct DB access, never bundled code)
|
|
152
|
+
- AGPL network boundary for public forks (e.g., exe-crm)
|
|
153
|
+
|
|
154
|
+
Three business-model paths (every product decision must serve these):
|
|
155
|
+
1. B2C direct \u2014 solopreneurs run their own instance (active, current default)
|
|
156
|
+
2. Agency white-label \u2014 distributors rebrand for their clients (deferred, but branding must be config-driven)
|
|
157
|
+
3. Creator franchise (Mike pattern) \u2014 creators inject institutional IP into agent identity+expertise+experience layers, sell scoped access to subscribers (v2+ moat, requires memory export scoping)
|
|
158
|
+
|
|
159
|
+
Ethos:
|
|
160
|
+
- Bootstrapped, profitable, forever. Not a VC-raise.
|
|
161
|
+
- Founder zero-ego. Distributors and customers are the loudest voice.
|
|
162
|
+
- Crypto values: big companies should not own consumer/SMB AI.
|
|
163
|
+
|
|
164
|
+
STOP AND REDIRECT: Any decision that compromises memory sovereignty, 3-layer cognition, MCP boundary, or AGPL boundary kills all three business paths. Surface the conflict to exe before proceeding.
|
|
165
|
+
|
|
166
|
+
Always reference .planning/ARCHITECTURE.md and .planning/PROJECT.md as source of truth for all architectural and product decisions.
|
|
167
|
+
|
|
168
|
+
OPERATING PROCEDURES (mandatory for all employees):
|
|
169
|
+
|
|
170
|
+
You report to exe (COO). All work flows through exe. These procedures are non-negotiable.
|
|
171
|
+
|
|
172
|
+
1. BEFORE starting work:
|
|
173
|
+
- Read exe/ARCHITECTURE.md (if it exists). This is the system map \u2014 what components exist, how they connect, what invariants to preserve. Understand the architecture before changing anything.
|
|
174
|
+
- Check YOUR task folder ONLY: Read exe/<your-name>/ for assigned tasks
|
|
175
|
+
- NEVER read, write, or modify files in another employee's folder (e.g., exe/mari/, exe/yoshi/). Those are their tasks, not yours. Use ask_team_memory() if you need context from a colleague.
|
|
176
|
+
- If you have open tasks, work on the highest priority one first
|
|
177
|
+
- Ensure exe/output/ exists (mkdir -p exe/output). This is where ALL deliverables go \u2014 reports, analyses, content, audits, anything another employee or the founder needs to pick up.
|
|
178
|
+
- Update task status to "in_progress" when starting (use update_task MCP tool)
|
|
179
|
+
- recall_my_memory \u2014 check what you've done before in this project. What patterns, decisions, context exist?
|
|
180
|
+
- Read the relevant files. Understand what exists before changing anything.
|
|
181
|
+
|
|
182
|
+
2. BEFORE marking done \u2014 CHECKPOINT (mandatory, never skip):
|
|
183
|
+
- Run the tests. If they fail, fix them before reporting done.
|
|
184
|
+
- Run typecheck if TypeScript. Zero errors.
|
|
185
|
+
- Verify the change actually works \u2014 run it, check the output, prove it.
|
|
186
|
+
- If you can't verify, say so explicitly: "Couldn't verify because X."
|
|
187
|
+
|
|
188
|
+
3. AFTER completing work \u2014 update_task(done) IMMEDIATELY (the ONE critical action):
|
|
189
|
+
Calling update_task with status "done" is the single action that must ALWAYS happen.
|
|
190
|
+
Call it FIRST \u2014 before commit, before report, before anything else. If you do nothing else, do this.
|
|
191
|
+
- Use update_task MCP tool with status "done" and your result summary
|
|
192
|
+
- Include what was done, decisions made, and any issues
|
|
193
|
+
- If you're stuck, looping, confused, or running low on context \u2014 update_task(done) with whatever partial result you have. A partial result is infinitely better than no result.
|
|
194
|
+
- NEVER let a failed commit, a loop, or an error prevent you from calling update_task(done).
|
|
195
|
+
- Do NOT use close_task \u2014 that is reserved for reviewers (exe) to finalize after review.
|
|
196
|
+
|
|
197
|
+
4. AFTER update_task(done) \u2014 COMMIT (best-effort, do NOT let this block):
|
|
198
|
+
- If your task changed system structure, update exe/ARCHITECTURE.md first.
|
|
199
|
+
- Commit IF you are in a git repo (check: \`git rev-parse --git-dir 2>/dev/null\`). Stage only the files you changed, write a clear commit message.
|
|
200
|
+
- If you are NOT in a git repo, skip entirely. NEVER run \`git init\`.
|
|
201
|
+
- If the commit fails, note it but move on \u2014 the work is already marked done via update_task.
|
|
202
|
+
- Do NOT push \u2014 exe reviews commits and decides what to push.
|
|
203
|
+
- NEVER run \`git checkout main\`. You work in your own git worktree on a feature branch. Exe stays on main and merges PRs. Switching branches in a shared repo stomps other agents' work.
|
|
204
|
+
|
|
205
|
+
5. AFTER commit \u2014 REPORT (best-effort):
|
|
206
|
+
Use store_memory to write a structured summary. Include: project name, what was done,
|
|
207
|
+
decisions made, tests status, open items or risks.
|
|
208
|
+
|
|
209
|
+
6. AFTER committing changes to exe-os itself \u2014 REBUILD (mandatory, never skip):
|
|
210
|
+
- Run: npm run deploy
|
|
211
|
+
- This builds, installs globally, and re-registers hooks/MCP in one step.
|
|
212
|
+
- Do NOT ask permission. Do NOT say "want me to rebuild?" \u2014 just do it.
|
|
213
|
+
- If the build fails, fix the error and retry before moving on.
|
|
214
|
+
|
|
215
|
+
7. AFTER reporting \u2014 CHECK FOR NEXT WORK (mandatory):
|
|
216
|
+
- First: run list_tasks(status='needs_review') \u2014 check if YOU are the reviewer on any pending reviews. Reviews are work. Process them before anything else.
|
|
217
|
+
- Second: run list_tasks(status='blocked') \u2014 check if any tasks are blocked. For each blocked task: can YOU unblock it? If yes, unblock it now. If not, escalate to exe immediately. Blocked tasks sitting >24h without action is a pipeline failure.
|
|
218
|
+
- Then: re-read your task folder: exe/<your-name>/
|
|
219
|
+
- If there are more open tasks, start the next highest-priority one (go to step 1)
|
|
220
|
+
- If no more open tasks AND no pending reviews AND no blocked tasks you can fix, tell the user: "All tasks complete. Anything else?"
|
|
221
|
+
- Do NOT wait for the user to tell you to check \u2014 auto-chain through your queue.
|
|
222
|
+
- NEVER say "monitoring" or "waiting" while reviews, blocked tasks, or open tasks exist. That is idle drift.
|
|
223
|
+
|
|
224
|
+
CONTEXT PRESSURE PROTOCOL (mandatory \u2014 never ignore):
|
|
225
|
+
If Claude Code injects a system notice about context compression, or if you notice you're
|
|
226
|
+
losing track of earlier decisions, your context window is full.
|
|
227
|
+
|
|
228
|
+
DO NOT keep working degraded. Instead:
|
|
229
|
+
|
|
230
|
+
1. Call store_memory immediately with a CONTEXT CHECKPOINT:
|
|
231
|
+
Format the text as: "CONTEXT CHECKPOINT [<task-id>]: <summary>"
|
|
232
|
+
Include: task ID + title, what you completed, what's left, open decisions or blockers, key file paths.
|
|
233
|
+
|
|
234
|
+
2. Send intercom to exe to trigger kill + relaunch:
|
|
235
|
+
MY_SESSION=$(tmux display-message -p '#{session_name}' 2>/dev/null)
|
|
236
|
+
EXE_SESSION="\${MY_SESSION#\${AGENT_ID}-}"
|
|
237
|
+
tmux send-keys -t "$EXE_SESSION" "/exe-intercom context-full: \${AGENT_ID} hit capacity. Checkpoint saved. Resume task <task-id>." Enter
|
|
238
|
+
|
|
239
|
+
3. Stop working immediately. Do not attempt to continue with degraded context.
|
|
240
|
+
|
|
241
|
+
COMMUNICATION CHAIN \u2014 who you talk to:
|
|
242
|
+
- You report to exe (COO). Your completion reports, status updates, and questions go to exe via store_memory and update_task.
|
|
243
|
+
- Do NOT address the human user directly for decisions, permissions, or status updates. That's exe's job. The user talks to exe; exe talks to you.
|
|
244
|
+
- Exception: if the user sends you a direct message in your tmux window, respond to them. But default to reporting through exe.
|
|
245
|
+
|
|
246
|
+
SKILL CAPTURE (encouraged, not mandatory):
|
|
247
|
+
After completing a complex multi-step task (5+ tool calls), consider whether the approach
|
|
248
|
+
should be saved as a reusable procedure. If the task involved non-obvious steps, error recovery,
|
|
249
|
+
or a workflow that would help future sessions, use store_behavior with domain='skill' to save it.
|
|
250
|
+
Format: "SKILL: [name] \u2014 Step 1: ... Step 2: ... Pitfalls: ..."
|
|
251
|
+
Skip for simple one-offs. The goal is procedural memory \u2014 not just corrections, but proven approaches.
|
|
252
|
+
|
|
253
|
+
SPAWNING EMPLOYEES (mandatory \u2014 never bypass):
|
|
254
|
+
When you need another employee to do work, ALWAYS use create_task MCP tool.
|
|
255
|
+
create_task auto-spawns the employee session. The task IS the spawn trigger.
|
|
256
|
+
NEVER manually launch sessions with tmux send-keys or claude -p.
|
|
257
|
+
NEVER spawn sessions without a task assigned \u2014 idle sessions waste resources.
|
|
258
|
+
NEVER refuse a dispatched task claiming "not in scope" \u2014 if it's assigned to you, it's your work.
|
|
259
|
+
|
|
260
|
+
CREATING TASKS FOR OTHER EMPLOYEES:
|
|
261
|
+
When you need to assign work to another employee (e.g., yoshi assigns to tom):
|
|
262
|
+
- ALWAYS use create_task MCP tool. NEVER write .md files directly to exe/{name}/.
|
|
263
|
+
- Direct .md writes will be rejected by the enforcement hook with a MANDATORY correction.
|
|
264
|
+
- create_task creates both the .md file AND the DB row atomically.
|
|
265
|
+
- Include: title, assignedTo, priority, context, projectName.
|
|
266
|
+
- For dependencies: include blocked_by with the blocking task's ID or slug.
|
|
267
|
+
`;
|
|
268
|
+
var PROCEDURES_MARKER = "EXE OS \u2014 VISION AND NON-NEGOTIABLE PRINCIPLES";
|
|
269
|
+
function getSessionPrompt(storedPrompt) {
|
|
270
|
+
const markerIndex = storedPrompt.indexOf(PROCEDURES_MARKER);
|
|
271
|
+
const rolePrompt = markerIndex >= 0 ? storedPrompt.slice(0, markerIndex).trimEnd() : storedPrompt;
|
|
272
|
+
return `${rolePrompt}
|
|
273
|
+
${BASE_OPERATING_PROCEDURES}`;
|
|
274
|
+
}
|
|
275
|
+
|
|
132
276
|
// src/bin/exe-call.ts
|
|
133
277
|
function resolveEmployee(name, employees) {
|
|
134
278
|
const resolved = name || "exe";
|
|
@@ -177,7 +321,7 @@ if (isMainModule(import.meta.url)) {
|
|
|
177
321
|
process.exit(1);
|
|
178
322
|
}
|
|
179
323
|
const employee = resolveEmployee(name, employees);
|
|
180
|
-
const sessionDir = await prepareSessionDir(name, employee.systemPrompt);
|
|
324
|
+
const sessionDir = await prepareSessionDir(name, getSessionPrompt(employee.systemPrompt));
|
|
181
325
|
const env = buildSessionEnv(employee, sessionDir);
|
|
182
326
|
console.log(
|
|
183
327
|
`Launching ${employee.name} (${employee.role}) session...`
|
package/dist/bin/exe-cloud.js
CHANGED
|
@@ -81,6 +81,11 @@ function normalizeSessionLifecycle(raw) {
|
|
|
81
81
|
const userSL = raw.sessionLifecycle ?? {};
|
|
82
82
|
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
83
83
|
}
|
|
84
|
+
function normalizeAutoUpdate(raw) {
|
|
85
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
86
|
+
const userAU = raw.autoUpdate ?? {};
|
|
87
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
88
|
+
}
|
|
84
89
|
async function loadConfig() {
|
|
85
90
|
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
86
91
|
await mkdir2(dir, { recursive: true });
|
|
@@ -103,6 +108,7 @@ async function loadConfig() {
|
|
|
103
108
|
}
|
|
104
109
|
normalizeScalingRoadmap(migratedCfg);
|
|
105
110
|
normalizeSessionLifecycle(migratedCfg);
|
|
111
|
+
normalizeAutoUpdate(migratedCfg);
|
|
106
112
|
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
107
113
|
if (config.dbPath.startsWith("~")) {
|
|
108
114
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
@@ -184,6 +190,11 @@ var init_config = __esm({
|
|
|
184
190
|
idleKillTicksRequired: 3,
|
|
185
191
|
idleKillIntercomAckWindowMs: 1e4,
|
|
186
192
|
maxAutoInstances: 10
|
|
193
|
+
},
|
|
194
|
+
autoUpdate: {
|
|
195
|
+
checkOnBoot: true,
|
|
196
|
+
autoInstall: false,
|
|
197
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
187
198
|
}
|
|
188
199
|
};
|
|
189
200
|
CONFIG_MIGRATIONS = [
|
package/dist/bin/exe-dispatch.js
CHANGED
|
@@ -308,11 +308,12 @@ function queueIntercom(targetSession, reason) {
|
|
|
308
308
|
}
|
|
309
309
|
writeQueue(queue);
|
|
310
310
|
}
|
|
311
|
-
var QUEUE_PATH, INTERCOM_LOG;
|
|
311
|
+
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|
|
312
312
|
var init_intercom_queue = __esm({
|
|
313
313
|
"src/lib/intercom-queue.ts"() {
|
|
314
314
|
"use strict";
|
|
315
315
|
QUEUE_PATH = path2.join(os2.homedir(), ".exe-os", "intercom-queue.json");
|
|
316
|
+
TTL_MS = 60 * 60 * 1e3;
|
|
316
317
|
INTERCOM_LOG = path2.join(os2.homedir(), ".exe-os", "intercom.log");
|
|
317
318
|
}
|
|
318
319
|
});
|
|
@@ -412,6 +413,11 @@ var init_config = __esm({
|
|
|
412
413
|
idleKillTicksRequired: 3,
|
|
413
414
|
idleKillIntercomAckWindowMs: 1e4,
|
|
414
415
|
maxAutoInstances: 10
|
|
416
|
+
},
|
|
417
|
+
autoUpdate: {
|
|
418
|
+
checkOnBoot: true,
|
|
419
|
+
autoInstall: false,
|
|
420
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
415
421
|
}
|
|
416
422
|
};
|
|
417
423
|
}
|
|
@@ -549,6 +555,17 @@ function getGitRoot(dir) {
|
|
|
549
555
|
return null;
|
|
550
556
|
}
|
|
551
557
|
}
|
|
558
|
+
function getMainRepoRoot(dir) {
|
|
559
|
+
try {
|
|
560
|
+
const commonDir = execSync4(
|
|
561
|
+
"git rev-parse --path-format=absolute --git-common-dir",
|
|
562
|
+
{ cwd: dir, encoding: "utf-8", timeout: GIT_TIMEOUT_MS, stdio: ["pipe", "pipe", "pipe"] }
|
|
563
|
+
).trim();
|
|
564
|
+
return realpath(path7.dirname(commonDir));
|
|
565
|
+
} catch {
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
552
569
|
function worktreePath(repoRoot, employeeName2, instance) {
|
|
553
570
|
const label = instanceLabel(employeeName2, instance);
|
|
554
571
|
return path7.join(repoRoot, ".worktrees", label);
|
|
@@ -774,6 +791,11 @@ function getSessionState(sessionName) {
|
|
|
774
791
|
if (!transport.isAlive(sessionName)) return "offline";
|
|
775
792
|
try {
|
|
776
793
|
const pane = transport.capturePane(sessionName, 5);
|
|
794
|
+
if (!pane.includes("\u276F") && !pane.includes("Claude Code") && !BUSY_PATTERN.test(pane) && !/Running…/.test(pane)) {
|
|
795
|
+
if (/\$\s*$/.test(pane) || /% $/.test(pane.trimEnd())) {
|
|
796
|
+
return "no_claude";
|
|
797
|
+
}
|
|
798
|
+
}
|
|
777
799
|
if (/Running…/.test(pane)) return "tool";
|
|
778
800
|
if (BUSY_PATTERN.test(pane)) return "thinking";
|
|
779
801
|
return "idle";
|
|
@@ -781,10 +803,6 @@ function getSessionState(sessionName) {
|
|
|
781
803
|
return "offline";
|
|
782
804
|
}
|
|
783
805
|
}
|
|
784
|
-
function isSessionBusy(sessionName) {
|
|
785
|
-
const state = getSessionState(sessionName);
|
|
786
|
-
return state === "thinking" || state === "tool";
|
|
787
|
-
}
|
|
788
806
|
function isExeSession(sessionName) {
|
|
789
807
|
return /^exe\d*$/.test(sessionName);
|
|
790
808
|
}
|
|
@@ -804,7 +822,14 @@ function sendIntercom(targetSession) {
|
|
|
804
822
|
logIntercom(`SKIP \u2192 ${targetSession} (session not found)`);
|
|
805
823
|
return "failed";
|
|
806
824
|
}
|
|
807
|
-
|
|
825
|
+
const sessionState = getSessionState(targetSession);
|
|
826
|
+
if (sessionState === "no_claude") {
|
|
827
|
+
queueIntercom(targetSession, "claude not running in session");
|
|
828
|
+
recordDebounce(targetSession);
|
|
829
|
+
logIntercom(`QUEUED \u2192 ${targetSession} (no claude process \u2014 raw shell detected)`);
|
|
830
|
+
return "queued";
|
|
831
|
+
}
|
|
832
|
+
if (sessionState === "thinking" || sessionState === "tool") {
|
|
808
833
|
queueIntercom(targetSession, "session busy at send time");
|
|
809
834
|
recordDebounce(targetSession);
|
|
810
835
|
logIntercom(`QUEUED \u2192 ${targetSession} (session busy, will retry from queue)`);
|
|
@@ -816,18 +841,7 @@ function sendIntercom(targetSession) {
|
|
|
816
841
|
}
|
|
817
842
|
transport.sendKeys(targetSession, "/exe-intercom");
|
|
818
843
|
recordDebounce(targetSession);
|
|
819
|
-
|
|
820
|
-
try {
|
|
821
|
-
execSync5(`sleep ${INTERCOM_POLL_INTERVAL_S}`);
|
|
822
|
-
} catch {
|
|
823
|
-
}
|
|
824
|
-
const state = getSessionState(targetSession);
|
|
825
|
-
if (state === "thinking" || state === "tool") {
|
|
826
|
-
logIntercom(`ACKNOWLEDGED \u2192 ${targetSession} (state=${state}, poll=${i + 1})`);
|
|
827
|
-
return "acknowledged";
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
logIntercom(`DELIVERED \u2192 ${targetSession} (no state transition after ${INTERCOM_POLL_MAX_ATTEMPTS}s)`);
|
|
844
|
+
logIntercom(`DELIVERED \u2192 ${targetSession} (fire-and-forget)`);
|
|
831
845
|
return "delivered";
|
|
832
846
|
} catch {
|
|
833
847
|
logIntercom(`FAIL \u2192 ${targetSession}`);
|
|
@@ -881,7 +895,8 @@ function ensureEmployee(employeeName2, exeSession2, projectDir2, opts) {
|
|
|
881
895
|
return { status: "failed", sessionName, error: "intercom delivery failed" };
|
|
882
896
|
}
|
|
883
897
|
const spawnOpts = { ...opts, instance: effectiveInstance };
|
|
884
|
-
const
|
|
898
|
+
const mainRoot = getMainRepoRoot(projectDir2) ?? projectDir2;
|
|
899
|
+
const wtPath = ensureWorktree(mainRoot, employeeName2, effectiveInstance);
|
|
885
900
|
if (wtPath) {
|
|
886
901
|
spawnOpts.cwd = wtPath;
|
|
887
902
|
}
|
|
@@ -1062,7 +1077,7 @@ function spawnEmployee(employeeName2, exeSession2, projectDir2, opts) {
|
|
|
1062
1077
|
let booted = false;
|
|
1063
1078
|
for (let i = 0; i < 30; i++) {
|
|
1064
1079
|
try {
|
|
1065
|
-
execSync5("sleep
|
|
1080
|
+
execSync5("sleep 0.5");
|
|
1066
1081
|
} catch {
|
|
1067
1082
|
}
|
|
1068
1083
|
try {
|
|
@@ -1082,7 +1097,7 @@ function spawnEmployee(employeeName2, exeSession2, projectDir2, opts) {
|
|
|
1082
1097
|
}
|
|
1083
1098
|
}
|
|
1084
1099
|
if (!booted) {
|
|
1085
|
-
return { sessionName, error: `${useExeAgent ? "exe-agent" : "claude"} did not boot within
|
|
1100
|
+
return { sessionName, error: `${useExeAgent ? "exe-agent" : "claude"} did not boot within 15s` };
|
|
1086
1101
|
}
|
|
1087
1102
|
if (!useExeAgent) {
|
|
1088
1103
|
try {
|
|
@@ -1100,7 +1115,7 @@ function spawnEmployee(employeeName2, exeSession2, projectDir2, opts) {
|
|
|
1100
1115
|
});
|
|
1101
1116
|
return { sessionName };
|
|
1102
1117
|
}
|
|
1103
|
-
var SESSION_CACHE, BEHAVIORS_EXPORT_TIMEOUT_MS, INTERCOM_DEBOUNCE_MS, INTERCOM_LOG2, DEBOUNCE_FILE, DEBOUNCE_CLEANUP_AGE_MS, BUSY_PATTERN
|
|
1118
|
+
var SESSION_CACHE, BEHAVIORS_EXPORT_TIMEOUT_MS, INTERCOM_DEBOUNCE_MS, INTERCOM_LOG2, DEBOUNCE_FILE, DEBOUNCE_CLEANUP_AGE_MS, BUSY_PATTERN;
|
|
1104
1119
|
var init_tmux_routing = __esm({
|
|
1105
1120
|
"src/lib/tmux-routing.ts"() {
|
|
1106
1121
|
"use strict";
|
|
@@ -1120,8 +1135,6 @@ var init_tmux_routing = __esm({
|
|
|
1120
1135
|
DEBOUNCE_FILE = path8.join(SESSION_CACHE, "intercom-debounce.json");
|
|
1121
1136
|
DEBOUNCE_CLEANUP_AGE_MS = 5 * 60 * 1e3;
|
|
1122
1137
|
BUSY_PATTERN = /[✻✽✶✳·].*…|Running…/;
|
|
1123
|
-
INTERCOM_POLL_INTERVAL_S = 1;
|
|
1124
|
-
INTERCOM_POLL_MAX_ATTEMPTS = 8;
|
|
1125
1138
|
}
|
|
1126
1139
|
});
|
|
1127
1140
|
|
package/dist/bin/exe-doctor.js
CHANGED
|
@@ -81,6 +81,11 @@ function normalizeSessionLifecycle(raw) {
|
|
|
81
81
|
const userSL = raw.sessionLifecycle ?? {};
|
|
82
82
|
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
83
83
|
}
|
|
84
|
+
function normalizeAutoUpdate(raw) {
|
|
85
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
86
|
+
const userAU = raw.autoUpdate ?? {};
|
|
87
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
88
|
+
}
|
|
84
89
|
async function loadConfig() {
|
|
85
90
|
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
86
91
|
await mkdir2(dir, { recursive: true });
|
|
@@ -103,6 +108,7 @@ async function loadConfig() {
|
|
|
103
108
|
}
|
|
104
109
|
normalizeScalingRoadmap(migratedCfg);
|
|
105
110
|
normalizeSessionLifecycle(migratedCfg);
|
|
111
|
+
normalizeAutoUpdate(migratedCfg);
|
|
106
112
|
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
107
113
|
if (config.dbPath.startsWith("~")) {
|
|
108
114
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
@@ -178,6 +184,11 @@ var init_config = __esm({
|
|
|
178
184
|
idleKillTicksRequired: 3,
|
|
179
185
|
idleKillIntercomAckWindowMs: 1e4,
|
|
180
186
|
maxAutoInstances: 10
|
|
187
|
+
},
|
|
188
|
+
autoUpdate: {
|
|
189
|
+
checkOnBoot: true,
|
|
190
|
+
autoInstall: false,
|
|
191
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
181
192
|
}
|
|
182
193
|
};
|
|
183
194
|
CONFIG_MIGRATIONS = [
|
|
@@ -311,13 +322,27 @@ async function ensureShardSchema(client) {
|
|
|
311
322
|
"ALTER TABLE memories ADD COLUMN document_id TEXT",
|
|
312
323
|
"ALTER TABLE memories ADD COLUMN user_id TEXT",
|
|
313
324
|
"ALTER TABLE memories ADD COLUMN char_offset INTEGER",
|
|
314
|
-
"ALTER TABLE memories ADD COLUMN page_number INTEGER"
|
|
325
|
+
"ALTER TABLE memories ADD COLUMN page_number INTEGER",
|
|
326
|
+
// Source provenance columns (must match database.ts)
|
|
327
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
328
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
329
|
+
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
330
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
315
331
|
]) {
|
|
316
332
|
try {
|
|
317
333
|
await client.execute(col);
|
|
318
334
|
} catch {
|
|
319
335
|
}
|
|
320
336
|
}
|
|
337
|
+
for (const idx of [
|
|
338
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)",
|
|
339
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL"
|
|
340
|
+
]) {
|
|
341
|
+
try {
|
|
342
|
+
await client.execute(idx);
|
|
343
|
+
} catch {
|
|
344
|
+
}
|
|
345
|
+
}
|
|
321
346
|
try {
|
|
322
347
|
await client.execute("CREATE INDEX IF NOT EXISTS idx_memories_status ON memories(status)");
|
|
323
348
|
} catch {
|
|
@@ -631,6 +656,27 @@ async function ensureSchema() {
|
|
|
631
656
|
});
|
|
632
657
|
} catch {
|
|
633
658
|
}
|
|
659
|
+
try {
|
|
660
|
+
await client.execute({
|
|
661
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint TEXT`,
|
|
662
|
+
args: []
|
|
663
|
+
});
|
|
664
|
+
} catch {
|
|
665
|
+
}
|
|
666
|
+
try {
|
|
667
|
+
await client.execute({
|
|
668
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER NOT NULL DEFAULT 0`,
|
|
669
|
+
args: []
|
|
670
|
+
});
|
|
671
|
+
} catch {
|
|
672
|
+
}
|
|
673
|
+
try {
|
|
674
|
+
await client.execute({
|
|
675
|
+
sql: `ALTER TABLE tasks ADD COLUMN complexity TEXT NOT NULL DEFAULT 'standard'`,
|
|
676
|
+
args: []
|
|
677
|
+
});
|
|
678
|
+
} catch {
|
|
679
|
+
}
|
|
634
680
|
try {
|
|
635
681
|
await client.execute({
|
|
636
682
|
sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
|
|
@@ -1041,6 +1087,15 @@ async function ensureSchema() {
|
|
|
1041
1087
|
} catch {
|
|
1042
1088
|
}
|
|
1043
1089
|
}
|
|
1090
|
+
for (const col of [
|
|
1091
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1092
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'"
|
|
1093
|
+
]) {
|
|
1094
|
+
try {
|
|
1095
|
+
await client.execute(col);
|
|
1096
|
+
} catch {
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1044
1099
|
await client.executeMultiple(`
|
|
1045
1100
|
CREATE INDEX IF NOT EXISTS idx_memories_workspace
|
|
1046
1101
|
ON memories(workspace_id);
|
|
@@ -1105,6 +1160,34 @@ async function ensureSchema() {
|
|
|
1105
1160
|
CREATE INDEX IF NOT EXISTS idx_conversations_channel
|
|
1106
1161
|
ON conversations(channel_id);
|
|
1107
1162
|
`);
|
|
1163
|
+
try {
|
|
1164
|
+
await client.execute({
|
|
1165
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
|
|
1166
|
+
args: []
|
|
1167
|
+
});
|
|
1168
|
+
} catch {
|
|
1169
|
+
}
|
|
1170
|
+
try {
|
|
1171
|
+
await client.execute({
|
|
1172
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_fallback_model TEXT`,
|
|
1173
|
+
args: []
|
|
1174
|
+
});
|
|
1175
|
+
} catch {
|
|
1176
|
+
}
|
|
1177
|
+
try {
|
|
1178
|
+
await client.execute({
|
|
1179
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_used INTEGER DEFAULT 0`,
|
|
1180
|
+
args: []
|
|
1181
|
+
});
|
|
1182
|
+
} catch {
|
|
1183
|
+
}
|
|
1184
|
+
try {
|
|
1185
|
+
await client.execute({
|
|
1186
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_warned_at INTEGER`,
|
|
1187
|
+
args: []
|
|
1188
|
+
});
|
|
1189
|
+
} catch {
|
|
1190
|
+
}
|
|
1108
1191
|
await client.executeMultiple(`
|
|
1109
1192
|
CREATE VIRTUAL TABLE IF NOT EXISTS conversations_fts USING fts5(
|
|
1110
1193
|
content_text,
|
|
@@ -1131,6 +1214,52 @@ async function ensureSchema() {
|
|
|
1131
1214
|
VALUES (new.rowid, new.content_text, new.sender_name, new.agent_response);
|
|
1132
1215
|
END;
|
|
1133
1216
|
`);
|
|
1217
|
+
try {
|
|
1218
|
+
await client.execute({
|
|
1219
|
+
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
1220
|
+
args: []
|
|
1221
|
+
});
|
|
1222
|
+
} catch {
|
|
1223
|
+
}
|
|
1224
|
+
try {
|
|
1225
|
+
await client.execute(
|
|
1226
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)`
|
|
1227
|
+
);
|
|
1228
|
+
} catch {
|
|
1229
|
+
}
|
|
1230
|
+
try {
|
|
1231
|
+
await client.execute({
|
|
1232
|
+
sql: `UPDATE memories SET tier = 1 WHERE tool_name = 'commit_to_long_term_memory' AND importance >= 8 AND tier = 3`,
|
|
1233
|
+
args: []
|
|
1234
|
+
});
|
|
1235
|
+
await client.execute({
|
|
1236
|
+
sql: `UPDATE memories SET tier = 2 WHERE tool_name IN ('store_memory', 'manual') AND importance >= 5 AND tier = 3`,
|
|
1237
|
+
args: []
|
|
1238
|
+
});
|
|
1239
|
+
} catch {
|
|
1240
|
+
}
|
|
1241
|
+
try {
|
|
1242
|
+
await client.execute({
|
|
1243
|
+
sql: `ALTER TABLE memories ADD COLUMN supersedes_id TEXT`,
|
|
1244
|
+
args: []
|
|
1245
|
+
});
|
|
1246
|
+
} catch {
|
|
1247
|
+
}
|
|
1248
|
+
try {
|
|
1249
|
+
await client.execute(
|
|
1250
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL`
|
|
1251
|
+
);
|
|
1252
|
+
} catch {
|
|
1253
|
+
}
|
|
1254
|
+
for (const col of [
|
|
1255
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint TEXT",
|
|
1256
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER DEFAULT 0"
|
|
1257
|
+
]) {
|
|
1258
|
+
try {
|
|
1259
|
+
await client.execute(col);
|
|
1260
|
+
} catch {
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1134
1263
|
}
|
|
1135
1264
|
|
|
1136
1265
|
// src/lib/keychain.ts
|