@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.
- package/README.md +9 -7
- package/dist/bin/agentic-ontology-backfill.js +78 -23
- package/dist/bin/agentic-reflection-backfill.js +53 -13
- package/dist/bin/agentic-semantic-label.js +53 -13
- package/dist/bin/backfill-conversations.js +77 -22
- package/dist/bin/backfill-responses.js +78 -23
- package/dist/bin/backfill-vectors.js +53 -13
- package/dist/bin/bulk-sync-postgres.js +78 -23
- package/dist/bin/cleanup-stale-review-tasks.js +98 -26
- package/dist/bin/cli.js +388 -97
- package/dist/bin/exe-agent-config.js +7 -1
- package/dist/bin/exe-agent.js +55 -2
- package/dist/bin/exe-assign.js +78 -23
- package/dist/bin/exe-boot.js +524 -161
- package/dist/bin/exe-call.js +53 -4
- package/dist/bin/exe-cloud.js +127 -26
- package/dist/bin/exe-dispatch.js +402 -39
- package/dist/bin/exe-doctor.js +76 -21
- package/dist/bin/exe-export-behaviors.js +77 -22
- package/dist/bin/exe-forget.js +77 -22
- package/dist/bin/exe-gateway.js +161 -38
- package/dist/bin/exe-heartbeat.js +98 -26
- package/dist/bin/exe-kill.js +77 -22
- package/dist/bin/exe-launch-agent.js +173 -29
- package/dist/bin/exe-new-employee.js +183 -7
- package/dist/bin/exe-pending-messages.js +98 -26
- package/dist/bin/exe-pending-notifications.js +98 -26
- package/dist/bin/exe-pending-reviews.js +98 -26
- package/dist/bin/exe-rename.js +77 -22
- package/dist/bin/exe-review.js +77 -22
- package/dist/bin/exe-search.js +77 -22
- package/dist/bin/exe-session-cleanup.js +523 -160
- package/dist/bin/exe-settings.js +10 -4
- package/dist/bin/exe-start-codex.js +554 -255
- package/dist/bin/exe-start-opencode.js +564 -175
- package/dist/bin/exe-status.js +98 -26
- package/dist/bin/exe-support.js +1 -1
- package/dist/bin/exe-team.js +77 -22
- package/dist/bin/git-sweep.js +402 -39
- package/dist/bin/graph-backfill.js +78 -23
- package/dist/bin/graph-export.js +77 -22
- package/dist/bin/install.js +70 -4
- package/dist/bin/intercom-check.js +523 -160
- package/dist/bin/pre-publish.js +13 -1
- package/dist/bin/scan-tasks.js +402 -39
- package/dist/bin/setup.js +151 -24
- package/dist/bin/shard-migrate.js +78 -23
- package/dist/bin/stack-update.js +1 -1
- package/dist/bin/update.js +3 -3
- package/dist/gateway/index.js +161 -38
- package/dist/hooks/bug-report-worker.js +161 -38
- package/dist/hooks/codex-stop-task-finalizer.js +542 -150
- package/dist/hooks/commit-complete.js +402 -39
- package/dist/hooks/error-recall.js +77 -22
- package/dist/hooks/ingest.js +4592 -251
- package/dist/hooks/instructions-loaded.js +77 -22
- package/dist/hooks/notification.js +77 -22
- package/dist/hooks/post-compact.js +98 -26
- package/dist/hooks/post-tool-combined.js +98 -26
- package/dist/hooks/pre-compact.js +482 -119
- package/dist/hooks/pre-tool-use.js +148 -26
- package/dist/hooks/prompt-submit.js +162 -39
- package/dist/hooks/session-end.js +484 -124
- package/dist/hooks/session-start.js +135 -27
- package/dist/hooks/stop.js +97 -25
- package/dist/hooks/subagent-stop.js +98 -26
- package/dist/hooks/summary-worker.js +107 -18
- package/dist/index.js +188 -38
- package/dist/lib/agent-config.js +24 -1
- package/dist/lib/cloud-sync.js +72 -12
- package/dist/lib/consolidation.js +25 -2
- package/dist/lib/database.js +16 -0
- package/dist/lib/db.js +16 -0
- package/dist/lib/device-registry.js +16 -0
- package/dist/lib/employee-templates.js +29 -3
- package/dist/lib/employees.js +24 -1
- package/dist/lib/exe-daemon.js +441 -58
- package/dist/lib/hybrid-search.js +77 -22
- package/dist/lib/keychain.js +24 -12
- package/dist/lib/license.js +3 -3
- package/dist/lib/messaging.js +21 -4
- package/dist/lib/schedules.js +53 -13
- package/dist/lib/skill-learning.js +466 -70
- package/dist/lib/status-brief.js +14 -1
- package/dist/lib/store.js +78 -23
- package/dist/lib/tasks.js +403 -95
- package/dist/lib/tmux-routing.js +326 -18
- package/dist/mcp/server.js +213 -45
- package/dist/mcp/tools/create-task.js +85 -17
- package/dist/mcp/tools/deactivate-behavior.js +33 -24
- package/dist/mcp/tools/list-tasks.js +21 -4
- package/dist/mcp/tools/send-message.js +21 -4
- package/dist/mcp/tools/update-task.js +400 -95
- package/dist/runtime/index.js +506 -116
- package/dist/tui/App.js +268 -69
- package/package.json +1 -1
|
@@ -3251,6 +3251,22 @@ async function ensureSchema() {
|
|
|
3251
3251
|
} catch (e) {
|
|
3252
3252
|
logCatchDebug("migration", e);
|
|
3253
3253
|
}
|
|
3254
|
+
try {
|
|
3255
|
+
await client.execute({
|
|
3256
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3257
|
+
args: []
|
|
3258
|
+
});
|
|
3259
|
+
} catch (e) {
|
|
3260
|
+
logCatchDebug("migration", e);
|
|
3261
|
+
}
|
|
3262
|
+
try {
|
|
3263
|
+
await client.execute({
|
|
3264
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3265
|
+
args: []
|
|
3266
|
+
});
|
|
3267
|
+
} catch (e) {
|
|
3268
|
+
logCatchDebug("migration", e);
|
|
3269
|
+
}
|
|
3254
3270
|
}
|
|
3255
3271
|
async function disposeDatabase() {
|
|
3256
3272
|
if (_walCheckpointTimer) {
|
|
@@ -3302,7 +3318,7 @@ var init_database = __esm({
|
|
|
3302
3318
|
});
|
|
3303
3319
|
|
|
3304
3320
|
// src/lib/keychain.ts
|
|
3305
|
-
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3321
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
|
|
3306
3322
|
import { existsSync as existsSync8, statSync as statSync3 } from "fs";
|
|
3307
3323
|
import { execSync as execSync5 } from "child_process";
|
|
3308
3324
|
import path8 from "path";
|
|
@@ -3337,12 +3353,14 @@ function linuxSecretAvailable() {
|
|
|
3337
3353
|
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3338
3354
|
if (process.platform !== "linux") return false;
|
|
3339
3355
|
try {
|
|
3340
|
-
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3341
3356
|
const st = statSync3(keyPath);
|
|
3342
3357
|
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3358
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3343
3359
|
if (uid === 0) return true;
|
|
3344
3360
|
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3345
|
-
|
|
3361
|
+
if (exeOsDir && path8.resolve(keyPath).startsWith(path8.resolve(exeOsDir) + path8.sep)) return true;
|
|
3362
|
+
if (!linuxSecretAvailable()) return true;
|
|
3363
|
+
return false;
|
|
3346
3364
|
} catch {
|
|
3347
3365
|
return false;
|
|
3348
3366
|
}
|
|
@@ -3492,15 +3510,25 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3492
3510
|
await mkdir3(dir, { recursive: true });
|
|
3493
3511
|
const keyPath = getKeyPath();
|
|
3494
3512
|
const machineKey = deriveMachineKey();
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3513
|
+
const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
|
|
3514
|
+
const result = machineKey ? "encrypted" : "plaintext";
|
|
3515
|
+
const tmpPath = keyPath + ".tmp";
|
|
3516
|
+
try {
|
|
3517
|
+
if (existsSync8(keyPath)) {
|
|
3518
|
+
await copyFile(keyPath, keyPath + ".bak").catch(() => {
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
await writeFile3(tmpPath, content, "utf-8");
|
|
3522
|
+
await chmod2(tmpPath, 384);
|
|
3523
|
+
await rename(tmpPath, keyPath);
|
|
3524
|
+
} catch (err) {
|
|
3525
|
+
try {
|
|
3526
|
+
await unlink(tmpPath);
|
|
3527
|
+
} catch {
|
|
3528
|
+
}
|
|
3529
|
+
throw err;
|
|
3500
3530
|
}
|
|
3501
|
-
|
|
3502
|
-
await chmod2(keyPath, 384);
|
|
3503
|
-
return "plaintext";
|
|
3531
|
+
return result;
|
|
3504
3532
|
}
|
|
3505
3533
|
async function getMasterKey() {
|
|
3506
3534
|
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
@@ -4374,11 +4402,17 @@ var init_platform_procedures = __esm({
|
|
|
4374
4402
|
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."
|
|
4375
4403
|
},
|
|
4376
4404
|
{
|
|
4377
|
-
title: "
|
|
4405
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4378
4406
|
domain: "workflow",
|
|
4379
4407
|
priority: "p1",
|
|
4380
4408
|
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."
|
|
4381
4409
|
},
|
|
4410
|
+
{
|
|
4411
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4412
|
+
domain: "identity",
|
|
4413
|
+
priority: "p0",
|
|
4414
|
+
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."
|
|
4415
|
+
},
|
|
4382
4416
|
{
|
|
4383
4417
|
title: "Single dispatch path \u2014 create_task only",
|
|
4384
4418
|
domain: "workflow",
|
|
@@ -4412,6 +4446,12 @@ var init_platform_procedures = __esm({
|
|
|
4412
4446
|
priority: "p0",
|
|
4413
4447
|
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."
|
|
4414
4448
|
},
|
|
4449
|
+
{
|
|
4450
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4451
|
+
domain: "security",
|
|
4452
|
+
priority: "p0",
|
|
4453
|
+
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."
|
|
4454
|
+
},
|
|
4415
4455
|
{
|
|
4416
4456
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4417
4457
|
domain: "support",
|
|
@@ -4697,10 +4737,24 @@ function stableId(memoryId, type, content) {
|
|
|
4697
4737
|
return createHash3("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4698
4738
|
}
|
|
4699
4739
|
function cleanText(text) {
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4740
|
+
let cleaned = text.replace(
|
|
4741
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4742
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4743
|
+
);
|
|
4744
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4745
|
+
return cleaned;
|
|
4746
|
+
}
|
|
4747
|
+
function splitSegments(text) {
|
|
4748
|
+
const cleaned = cleanText(text);
|
|
4749
|
+
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);
|
|
4750
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4751
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4752
|
+
if (lines.length > 0) return lines;
|
|
4753
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4754
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
return segments;
|
|
4704
4758
|
}
|
|
4705
4759
|
function inferCardType(sentence, toolName) {
|
|
4706
4760
|
const lower = sentence.toLowerCase();
|
|
@@ -4732,12 +4786,12 @@ function predicateFor(type) {
|
|
|
4732
4786
|
}
|
|
4733
4787
|
}
|
|
4734
4788
|
function extractMemoryCards(row) {
|
|
4735
|
-
const
|
|
4789
|
+
const segments = splitSegments(row.raw_text);
|
|
4736
4790
|
const cards = [];
|
|
4737
|
-
for (const sentence of
|
|
4791
|
+
for (const sentence of segments) {
|
|
4738
4792
|
const type = inferCardType(sentence, row.tool_name);
|
|
4739
4793
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4740
|
-
const content = sentence.length >
|
|
4794
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4741
4795
|
cards.push({
|
|
4742
4796
|
id: stableId(row.id, type, content),
|
|
4743
4797
|
memory_id: row.id,
|
|
@@ -4833,13 +4887,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4833
4887
|
last_accessed: String(row.timestamp)
|
|
4834
4888
|
}));
|
|
4835
4889
|
}
|
|
4836
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4890
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4837
4891
|
var init_memory_cards = __esm({
|
|
4838
4892
|
"src/lib/memory-cards.ts"() {
|
|
4839
4893
|
"use strict";
|
|
4840
4894
|
init_database();
|
|
4841
|
-
MAX_CARDS_PER_MEMORY =
|
|
4842
|
-
|
|
4895
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4896
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4897
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4843
4898
|
}
|
|
4844
4899
|
});
|
|
4845
4900
|
|
|
@@ -3251,6 +3251,22 @@ async function ensureSchema() {
|
|
|
3251
3251
|
} catch (e) {
|
|
3252
3252
|
logCatchDebug("migration", e);
|
|
3253
3253
|
}
|
|
3254
|
+
try {
|
|
3255
|
+
await client.execute({
|
|
3256
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3257
|
+
args: []
|
|
3258
|
+
});
|
|
3259
|
+
} catch (e) {
|
|
3260
|
+
logCatchDebug("migration", e);
|
|
3261
|
+
}
|
|
3262
|
+
try {
|
|
3263
|
+
await client.execute({
|
|
3264
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3265
|
+
args: []
|
|
3266
|
+
});
|
|
3267
|
+
} catch (e) {
|
|
3268
|
+
logCatchDebug("migration", e);
|
|
3269
|
+
}
|
|
3254
3270
|
}
|
|
3255
3271
|
async function disposeDatabase() {
|
|
3256
3272
|
if (_walCheckpointTimer) {
|
|
@@ -3302,7 +3318,7 @@ var init_database = __esm({
|
|
|
3302
3318
|
});
|
|
3303
3319
|
|
|
3304
3320
|
// src/lib/keychain.ts
|
|
3305
|
-
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3321
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
|
|
3306
3322
|
import { existsSync as existsSync7, statSync as statSync3 } from "fs";
|
|
3307
3323
|
import { execSync as execSync5 } from "child_process";
|
|
3308
3324
|
import path7 from "path";
|
|
@@ -3337,12 +3353,14 @@ function linuxSecretAvailable() {
|
|
|
3337
3353
|
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3338
3354
|
if (process.platform !== "linux") return false;
|
|
3339
3355
|
try {
|
|
3340
|
-
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3341
3356
|
const st = statSync3(keyPath);
|
|
3342
3357
|
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3358
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3343
3359
|
if (uid === 0) return true;
|
|
3344
3360
|
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3345
|
-
|
|
3361
|
+
if (exeOsDir && path7.resolve(keyPath).startsWith(path7.resolve(exeOsDir) + path7.sep)) return true;
|
|
3362
|
+
if (!linuxSecretAvailable()) return true;
|
|
3363
|
+
return false;
|
|
3346
3364
|
} catch {
|
|
3347
3365
|
return false;
|
|
3348
3366
|
}
|
|
@@ -3492,15 +3510,25 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3492
3510
|
await mkdir3(dir, { recursive: true });
|
|
3493
3511
|
const keyPath = getKeyPath();
|
|
3494
3512
|
const machineKey = deriveMachineKey();
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3513
|
+
const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
|
|
3514
|
+
const result = machineKey ? "encrypted" : "plaintext";
|
|
3515
|
+
const tmpPath = keyPath + ".tmp";
|
|
3516
|
+
try {
|
|
3517
|
+
if (existsSync7(keyPath)) {
|
|
3518
|
+
await copyFile(keyPath, keyPath + ".bak").catch(() => {
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
await writeFile3(tmpPath, content, "utf-8");
|
|
3522
|
+
await chmod2(tmpPath, 384);
|
|
3523
|
+
await rename(tmpPath, keyPath);
|
|
3524
|
+
} catch (err) {
|
|
3525
|
+
try {
|
|
3526
|
+
await unlink(tmpPath);
|
|
3527
|
+
} catch {
|
|
3528
|
+
}
|
|
3529
|
+
throw err;
|
|
3500
3530
|
}
|
|
3501
|
-
|
|
3502
|
-
await chmod2(keyPath, 384);
|
|
3503
|
-
return "plaintext";
|
|
3531
|
+
return result;
|
|
3504
3532
|
}
|
|
3505
3533
|
async function getMasterKey() {
|
|
3506
3534
|
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
@@ -4374,11 +4402,17 @@ var init_platform_procedures = __esm({
|
|
|
4374
4402
|
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."
|
|
4375
4403
|
},
|
|
4376
4404
|
{
|
|
4377
|
-
title: "
|
|
4405
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4378
4406
|
domain: "workflow",
|
|
4379
4407
|
priority: "p1",
|
|
4380
4408
|
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."
|
|
4381
4409
|
},
|
|
4410
|
+
{
|
|
4411
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4412
|
+
domain: "identity",
|
|
4413
|
+
priority: "p0",
|
|
4414
|
+
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."
|
|
4415
|
+
},
|
|
4382
4416
|
{
|
|
4383
4417
|
title: "Single dispatch path \u2014 create_task only",
|
|
4384
4418
|
domain: "workflow",
|
|
@@ -4412,6 +4446,12 @@ var init_platform_procedures = __esm({
|
|
|
4412
4446
|
priority: "p0",
|
|
4413
4447
|
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."
|
|
4414
4448
|
},
|
|
4449
|
+
{
|
|
4450
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4451
|
+
domain: "security",
|
|
4452
|
+
priority: "p0",
|
|
4453
|
+
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."
|
|
4454
|
+
},
|
|
4415
4455
|
{
|
|
4416
4456
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4417
4457
|
domain: "support",
|
|
@@ -4697,10 +4737,24 @@ function stableId(memoryId, type, content) {
|
|
|
4697
4737
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4698
4738
|
}
|
|
4699
4739
|
function cleanText(text) {
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4740
|
+
let cleaned = text.replace(
|
|
4741
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4742
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4743
|
+
);
|
|
4744
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4745
|
+
return cleaned;
|
|
4746
|
+
}
|
|
4747
|
+
function splitSegments(text) {
|
|
4748
|
+
const cleaned = cleanText(text);
|
|
4749
|
+
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);
|
|
4750
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4751
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4752
|
+
if (lines.length > 0) return lines;
|
|
4753
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4754
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
return segments;
|
|
4704
4758
|
}
|
|
4705
4759
|
function inferCardType(sentence, toolName) {
|
|
4706
4760
|
const lower = sentence.toLowerCase();
|
|
@@ -4732,12 +4786,12 @@ function predicateFor(type) {
|
|
|
4732
4786
|
}
|
|
4733
4787
|
}
|
|
4734
4788
|
function extractMemoryCards(row) {
|
|
4735
|
-
const
|
|
4789
|
+
const segments = splitSegments(row.raw_text);
|
|
4736
4790
|
const cards = [];
|
|
4737
|
-
for (const sentence of
|
|
4791
|
+
for (const sentence of segments) {
|
|
4738
4792
|
const type = inferCardType(sentence, row.tool_name);
|
|
4739
4793
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4740
|
-
const content = sentence.length >
|
|
4794
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4741
4795
|
cards.push({
|
|
4742
4796
|
id: stableId(row.id, type, content),
|
|
4743
4797
|
memory_id: row.id,
|
|
@@ -4833,13 +4887,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4833
4887
|
last_accessed: String(row.timestamp)
|
|
4834
4888
|
}));
|
|
4835
4889
|
}
|
|
4836
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4890
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4837
4891
|
var init_memory_cards = __esm({
|
|
4838
4892
|
"src/lib/memory-cards.ts"() {
|
|
4839
4893
|
"use strict";
|
|
4840
4894
|
init_database();
|
|
4841
|
-
MAX_CARDS_PER_MEMORY =
|
|
4842
|
-
|
|
4895
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4896
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4897
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4843
4898
|
}
|
|
4844
4899
|
});
|
|
4845
4900
|
|
|
@@ -3546,6 +3546,22 @@ async function ensureSchema() {
|
|
|
3546
3546
|
} catch (e) {
|
|
3547
3547
|
logCatchDebug("migration", e);
|
|
3548
3548
|
}
|
|
3549
|
+
try {
|
|
3550
|
+
await client.execute({
|
|
3551
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3552
|
+
args: []
|
|
3553
|
+
});
|
|
3554
|
+
} catch (e) {
|
|
3555
|
+
logCatchDebug("migration", e);
|
|
3556
|
+
}
|
|
3557
|
+
try {
|
|
3558
|
+
await client.execute({
|
|
3559
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3560
|
+
args: []
|
|
3561
|
+
});
|
|
3562
|
+
} catch (e) {
|
|
3563
|
+
logCatchDebug("migration", e);
|
|
3564
|
+
}
|
|
3549
3565
|
}
|
|
3550
3566
|
async function disposeDatabase() {
|
|
3551
3567
|
if (_walCheckpointTimer) {
|
|
@@ -3612,7 +3628,7 @@ var init_license = __esm({
|
|
|
3612
3628
|
LICENSE_PATH = path10.join(EXE_AI_DIR, "license.key");
|
|
3613
3629
|
CACHE_PATH = path10.join(EXE_AI_DIR, "license-cache.json");
|
|
3614
3630
|
DEVICE_ID_PATH = path10.join(EXE_AI_DIR, "device-id");
|
|
3615
|
-
API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://askexe.com
|
|
3631
|
+
API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://cloud.askexe.com";
|
|
3616
3632
|
}
|
|
3617
3633
|
});
|
|
3618
3634
|
|
|
@@ -3665,6 +3681,18 @@ function extractRootExe(name) {
|
|
|
3665
3681
|
const parts = name.split("-").filter(Boolean);
|
|
3666
3682
|
return parts.length > 0 ? parts[parts.length - 1] : null;
|
|
3667
3683
|
}
|
|
3684
|
+
function registerParentExe(sessionKey, parentExe, dispatchedBy) {
|
|
3685
|
+
if (!existsSync12(SESSION_CACHE)) {
|
|
3686
|
+
mkdirSync7(SESSION_CACHE, { recursive: true });
|
|
3687
|
+
}
|
|
3688
|
+
const rootExe = extractRootExe(parentExe) ?? parentExe;
|
|
3689
|
+
const filePath = path13.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`);
|
|
3690
|
+
writeFileSync7(filePath, JSON.stringify({
|
|
3691
|
+
parentExe: rootExe,
|
|
3692
|
+
dispatchedBy: dispatchedBy || rootExe,
|
|
3693
|
+
registeredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3694
|
+
}));
|
|
3695
|
+
}
|
|
3668
3696
|
function getParentExe(sessionKey) {
|
|
3669
3697
|
try {
|
|
3670
3698
|
const data = JSON.parse(readFileSync10(path13.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`), "utf8"));
|
|
@@ -3674,11 +3702,12 @@ function getParentExe(sessionKey) {
|
|
|
3674
3702
|
}
|
|
3675
3703
|
}
|
|
3676
3704
|
function resolveExeSession() {
|
|
3705
|
+
if (process.env.EXE_SESSION_NAME) {
|
|
3706
|
+
const fromEnv = extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
|
|
3707
|
+
if (fromEnv) return fromEnv;
|
|
3708
|
+
}
|
|
3677
3709
|
const mySession = getMySession();
|
|
3678
3710
|
if (!mySession) {
|
|
3679
|
-
if (process.env.EXE_SESSION_NAME) {
|
|
3680
|
-
return extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
|
|
3681
|
-
}
|
|
3682
3711
|
return null;
|
|
3683
3712
|
}
|
|
3684
3713
|
const fromSessionName = extractRootExe(mySession);
|
|
@@ -3693,6 +3722,10 @@ function resolveExeSession() {
|
|
|
3693
3722
|
`[tmux-routing] WARN: cache says "${fromCache}" but session name says "${fromSessionName}". Trusting session name.
|
|
3694
3723
|
`
|
|
3695
3724
|
);
|
|
3725
|
+
try {
|
|
3726
|
+
registerParentExe(key, fromSessionName);
|
|
3727
|
+
} catch {
|
|
3728
|
+
}
|
|
3696
3729
|
candidate = fromSessionName;
|
|
3697
3730
|
} else {
|
|
3698
3731
|
candidate = fromCache;
|
|
@@ -3924,7 +3957,7 @@ var init_identity = __esm({
|
|
|
3924
3957
|
});
|
|
3925
3958
|
|
|
3926
3959
|
// src/lib/keychain.ts
|
|
3927
|
-
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3960
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
|
|
3928
3961
|
import { existsSync as existsSync14, statSync as statSync3 } from "fs";
|
|
3929
3962
|
import { execSync as execSync6 } from "child_process";
|
|
3930
3963
|
import path15 from "path";
|
|
@@ -3959,12 +3992,14 @@ function linuxSecretAvailable() {
|
|
|
3959
3992
|
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3960
3993
|
if (process.platform !== "linux") return false;
|
|
3961
3994
|
try {
|
|
3962
|
-
const uid = typeof os10.userInfo().uid === "number" ? os10.userInfo().uid : -1;
|
|
3963
3995
|
const st = statSync3(keyPath);
|
|
3964
3996
|
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3997
|
+
const uid = typeof os10.userInfo().uid === "number" ? os10.userInfo().uid : -1;
|
|
3965
3998
|
if (uid === 0) return true;
|
|
3966
3999
|
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3967
|
-
|
|
4000
|
+
if (exeOsDir && path15.resolve(keyPath).startsWith(path15.resolve(exeOsDir) + path15.sep)) return true;
|
|
4001
|
+
if (!linuxSecretAvailable()) return true;
|
|
4002
|
+
return false;
|
|
3968
4003
|
} catch {
|
|
3969
4004
|
return false;
|
|
3970
4005
|
}
|
|
@@ -4114,15 +4149,25 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
4114
4149
|
await mkdir3(dir, { recursive: true });
|
|
4115
4150
|
const keyPath = getKeyPath();
|
|
4116
4151
|
const machineKey = deriveMachineKey();
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4152
|
+
const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
|
|
4153
|
+
const result = machineKey ? "encrypted" : "plaintext";
|
|
4154
|
+
const tmpPath = keyPath + ".tmp";
|
|
4155
|
+
try {
|
|
4156
|
+
if (existsSync14(keyPath)) {
|
|
4157
|
+
await copyFile(keyPath, keyPath + ".bak").catch(() => {
|
|
4158
|
+
});
|
|
4159
|
+
}
|
|
4160
|
+
await writeFile3(tmpPath, content, "utf-8");
|
|
4161
|
+
await chmod2(tmpPath, 384);
|
|
4162
|
+
await rename(tmpPath, keyPath);
|
|
4163
|
+
} catch (err) {
|
|
4164
|
+
try {
|
|
4165
|
+
await unlink(tmpPath);
|
|
4166
|
+
} catch {
|
|
4167
|
+
}
|
|
4168
|
+
throw err;
|
|
4122
4169
|
}
|
|
4123
|
-
|
|
4124
|
-
await chmod2(keyPath, 384);
|
|
4125
|
-
return "plaintext";
|
|
4170
|
+
return result;
|
|
4126
4171
|
}
|
|
4127
4172
|
async function getMasterKey() {
|
|
4128
4173
|
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
@@ -4996,11 +5041,17 @@ var init_platform_procedures = __esm({
|
|
|
4996
5041
|
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."
|
|
4997
5042
|
},
|
|
4998
5043
|
{
|
|
4999
|
-
title: "
|
|
5044
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
5000
5045
|
domain: "workflow",
|
|
5001
5046
|
priority: "p1",
|
|
5002
5047
|
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."
|
|
5003
5048
|
},
|
|
5049
|
+
{
|
|
5050
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
5051
|
+
domain: "identity",
|
|
5052
|
+
priority: "p0",
|
|
5053
|
+
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."
|
|
5054
|
+
},
|
|
5004
5055
|
{
|
|
5005
5056
|
title: "Single dispatch path \u2014 create_task only",
|
|
5006
5057
|
domain: "workflow",
|
|
@@ -5034,6 +5085,12 @@ var init_platform_procedures = __esm({
|
|
|
5034
5085
|
priority: "p0",
|
|
5035
5086
|
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."
|
|
5036
5087
|
},
|
|
5088
|
+
{
|
|
5089
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
5090
|
+
domain: "security",
|
|
5091
|
+
priority: "p0",
|
|
5092
|
+
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."
|
|
5093
|
+
},
|
|
5037
5094
|
{
|
|
5038
5095
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
5039
5096
|
domain: "support",
|
|
@@ -5319,10 +5376,24 @@ function stableId(memoryId, type, content) {
|
|
|
5319
5376
|
return createHash3("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
5320
5377
|
}
|
|
5321
5378
|
function cleanText(text) {
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5379
|
+
let cleaned = text.replace(
|
|
5380
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
5381
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
5382
|
+
);
|
|
5383
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
5384
|
+
return cleaned;
|
|
5385
|
+
}
|
|
5386
|
+
function splitSegments(text) {
|
|
5387
|
+
const cleaned = cleanText(text);
|
|
5388
|
+
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);
|
|
5389
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
5390
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
5391
|
+
if (lines.length > 0) return lines;
|
|
5392
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
5393
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
return segments;
|
|
5326
5397
|
}
|
|
5327
5398
|
function inferCardType(sentence, toolName) {
|
|
5328
5399
|
const lower = sentence.toLowerCase();
|
|
@@ -5354,12 +5425,12 @@ function predicateFor(type) {
|
|
|
5354
5425
|
}
|
|
5355
5426
|
}
|
|
5356
5427
|
function extractMemoryCards(row) {
|
|
5357
|
-
const
|
|
5428
|
+
const segments = splitSegments(row.raw_text);
|
|
5358
5429
|
const cards = [];
|
|
5359
|
-
for (const sentence of
|
|
5430
|
+
for (const sentence of segments) {
|
|
5360
5431
|
const type = inferCardType(sentence, row.tool_name);
|
|
5361
5432
|
const subject = extractSubject(sentence, row.agent_id);
|
|
5362
|
-
const content = sentence.length >
|
|
5433
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
5363
5434
|
cards.push({
|
|
5364
5435
|
id: stableId(row.id, type, content),
|
|
5365
5436
|
memory_id: row.id,
|
|
@@ -5455,13 +5526,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
5455
5526
|
last_accessed: String(row.timestamp)
|
|
5456
5527
|
}));
|
|
5457
5528
|
}
|
|
5458
|
-
var MAX_CARDS_PER_MEMORY,
|
|
5529
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
5459
5530
|
var init_memory_cards = __esm({
|
|
5460
5531
|
"src/lib/memory-cards.ts"() {
|
|
5461
5532
|
"use strict";
|
|
5462
5533
|
init_database();
|
|
5463
|
-
MAX_CARDS_PER_MEMORY =
|
|
5464
|
-
|
|
5534
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
5535
|
+
MAX_SEGMENT_CHARS = 500;
|
|
5536
|
+
MIN_SEGMENT_CHARS = 20;
|
|
5465
5537
|
}
|
|
5466
5538
|
});
|
|
5467
5539
|
|