@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
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Exe OS
|
|
2
2
|
|
|
3
|
-
   
|
|
4
4
|
|
|
5
5
|
**Hire the team you couldn't afford.** AI employee operating system with persistent memory, identity, and multi-agent orchestration.
|
|
6
6
|
|
|
@@ -51,9 +51,10 @@ Best for: managing multiple projects and employees.
|
|
|
51
51
|
| Feature | What it does |
|
|
52
52
|
|---------|-------------|
|
|
53
53
|
| **Persistent memory** | Every interaction stored in encrypted SQLCipher + vector search. Searchable across sessions. |
|
|
54
|
-
| **
|
|
54
|
+
| **Four-layer cognition** | Company Procedures (org-wide rules) + Identity (who you are) + Expertise (what you've learned) + Experience (what you remember) |
|
|
55
55
|
| **Multi-agent orchestration** | COO coordinates CTO, CMO, engineers. Parallel task execution via tmux. |
|
|
56
56
|
| **Task system** | Create, assign, review, chain tasks. Auto-dispatch. Review pipeline with cascading approval. |
|
|
57
|
+
| **Company procedures** | Org-wide rules that every employee follows. Set once, cascades everywhere. |
|
|
57
58
|
| **Identity injection** | Each employee gets a permanent identity doc. Claude Code's `--agent` flag replaces the default system prompt. |
|
|
58
59
|
| **Skill learning** | Agents learn procedures from repeated patterns. Corrections become permanent behaviors. |
|
|
59
60
|
| **Cloud sync** | End-to-end encrypted memory sync across devices. Your key, your data. |
|
|
@@ -80,6 +81,7 @@ You talk to your COO. Your COO delegates. Each employee has:
|
|
|
80
81
|
- **Identity** — permanent role doc that defines who they are
|
|
81
82
|
- **Task queue** — auto-chains through assigned work
|
|
82
83
|
- **Behavioral expertise** — corrections accumulate as permanent rules
|
|
84
|
+
- **Company procedures** — org-wide rules that cascade to every employee
|
|
83
85
|
|
|
84
86
|
---
|
|
85
87
|
|
|
@@ -100,7 +102,7 @@ npm install -g @askexenow/exe-os
|
|
|
100
102
|
# Run `wsl --install` in PowerShell first, then follow Linux steps inside WSL2
|
|
101
103
|
```
|
|
102
104
|
|
|
103
|
-
Requires Node.js 22+ and tmux. See **[docs/install.md](docs/install.md)** for full platform-specific instructions and
|
|
105
|
+
Requires Node.js 22+ and tmux. See **[docs/install.md](docs/install.md)** for full platform-specific instructions and **[docs/quickstart.md](docs/quickstart.md)** for the 5-minute getting started guide.
|
|
104
106
|
|
|
105
107
|
### 2. Run Setup
|
|
106
108
|
|
|
@@ -136,8 +138,8 @@ exe-os # launch the TUI dashboard
|
|
|
136
138
|
|
|
137
139
|
| Plan | Price | Employees | Memories | Devices |
|
|
138
140
|
|------|-------|-----------|----------|---------|
|
|
139
|
-
| Free | $0 | 1 (COO) |
|
|
140
|
-
| Solopreneur | $97/mo | 5 |
|
|
141
|
+
| Free | $0 | 1 (COO) | 50,000 | 1 |
|
|
142
|
+
| Solopreneur | $97/mo | 5 | 250,000 | 2 |
|
|
141
143
|
| Company | $297/mo | 20 | 1,000,000 | 10 |
|
|
142
144
|
| Agency | $497/mo | 100 | 10,000,000 | 50 |
|
|
143
145
|
| Enterprise | Custom | Unlimited | Unlimited | Unlimited |
|
|
@@ -202,7 +204,7 @@ See [docs/Agency-Playbook.md](docs/Agency-Playbook.md) for multi-client VPS depl
|
|
|
202
204
|
exe-os/
|
|
203
205
|
src/
|
|
204
206
|
lib/ # Core: memory, tasks, identity, behaviors, search, sync, encryption
|
|
205
|
-
mcp/ # MCP server (
|
|
207
|
+
mcp/ # MCP server (100+ tools for Claude Code integration)
|
|
206
208
|
adapters/ # Claude Code hooks (ingest, session-start, pre-tool-use, etc.)
|
|
207
209
|
tui/ # Ink-based terminal dashboard (Mode 2)
|
|
208
210
|
runtime/ # Agent loop, tool registry, permissions (Mode 2 standalone)
|
|
@@ -244,4 +246,4 @@ Full guide: **[docs/install.md](docs/install.md)**
|
|
|
244
246
|
|
|
245
247
|
## License
|
|
246
248
|
|
|
247
|
-
|
|
249
|
+
AGPL-3.0. Commercial licenses available at [askexe.com](https://askexe.com).
|
|
@@ -3034,6 +3034,22 @@ async function ensureSchema() {
|
|
|
3034
3034
|
} catch (e) {
|
|
3035
3035
|
logCatchDebug("migration", e);
|
|
3036
3036
|
}
|
|
3037
|
+
try {
|
|
3038
|
+
await client.execute({
|
|
3039
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3040
|
+
args: []
|
|
3041
|
+
});
|
|
3042
|
+
} catch (e) {
|
|
3043
|
+
logCatchDebug("migration", e);
|
|
3044
|
+
}
|
|
3045
|
+
try {
|
|
3046
|
+
await client.execute({
|
|
3047
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3048
|
+
args: []
|
|
3049
|
+
});
|
|
3050
|
+
} catch (e) {
|
|
3051
|
+
logCatchDebug("migration", e);
|
|
3052
|
+
}
|
|
3037
3053
|
}
|
|
3038
3054
|
async function disposeDatabase() {
|
|
3039
3055
|
if (_walCheckpointTimer) {
|
|
@@ -3600,11 +3616,17 @@ var init_platform_procedures = __esm({
|
|
|
3600
3616
|
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."
|
|
3601
3617
|
},
|
|
3602
3618
|
{
|
|
3603
|
-
title: "
|
|
3619
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
3604
3620
|
domain: "workflow",
|
|
3605
3621
|
priority: "p1",
|
|
3606
3622
|
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."
|
|
3607
3623
|
},
|
|
3624
|
+
{
|
|
3625
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
3626
|
+
domain: "identity",
|
|
3627
|
+
priority: "p0",
|
|
3628
|
+
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."
|
|
3629
|
+
},
|
|
3608
3630
|
{
|
|
3609
3631
|
title: "Single dispatch path \u2014 create_task only",
|
|
3610
3632
|
domain: "workflow",
|
|
@@ -3638,6 +3660,12 @@ var init_platform_procedures = __esm({
|
|
|
3638
3660
|
priority: "p0",
|
|
3639
3661
|
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."
|
|
3640
3662
|
},
|
|
3663
|
+
{
|
|
3664
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
3665
|
+
domain: "security",
|
|
3666
|
+
priority: "p0",
|
|
3667
|
+
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."
|
|
3668
|
+
},
|
|
3641
3669
|
{
|
|
3642
3670
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
3643
3671
|
domain: "support",
|
|
@@ -3923,10 +3951,24 @@ function stableId(memoryId, type, content) {
|
|
|
3923
3951
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
3924
3952
|
}
|
|
3925
3953
|
function cleanText(text) {
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3954
|
+
let cleaned = text.replace(
|
|
3955
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
3956
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
3957
|
+
);
|
|
3958
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
3959
|
+
return cleaned;
|
|
3960
|
+
}
|
|
3961
|
+
function splitSegments(text) {
|
|
3962
|
+
const cleaned = cleanText(text);
|
|
3963
|
+
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);
|
|
3964
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
3965
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
3966
|
+
if (lines.length > 0) return lines;
|
|
3967
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
3968
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
return segments;
|
|
3930
3972
|
}
|
|
3931
3973
|
function inferCardType(sentence, toolName) {
|
|
3932
3974
|
const lower = sentence.toLowerCase();
|
|
@@ -3958,12 +4000,12 @@ function predicateFor(type) {
|
|
|
3958
4000
|
}
|
|
3959
4001
|
}
|
|
3960
4002
|
function extractMemoryCards(row) {
|
|
3961
|
-
const
|
|
4003
|
+
const segments = splitSegments(row.raw_text);
|
|
3962
4004
|
const cards = [];
|
|
3963
|
-
for (const sentence of
|
|
4005
|
+
for (const sentence of segments) {
|
|
3964
4006
|
const type = inferCardType(sentence, row.tool_name);
|
|
3965
4007
|
const subject = extractSubject(sentence, row.agent_id);
|
|
3966
|
-
const content = sentence.length >
|
|
4008
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
3967
4009
|
cards.push({
|
|
3968
4010
|
id: stableId(row.id, type, content),
|
|
3969
4011
|
memory_id: row.id,
|
|
@@ -4059,13 +4101,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4059
4101
|
last_accessed: String(row.timestamp)
|
|
4060
4102
|
}));
|
|
4061
4103
|
}
|
|
4062
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4104
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4063
4105
|
var init_memory_cards = __esm({
|
|
4064
4106
|
"src/lib/memory-cards.ts"() {
|
|
4065
4107
|
"use strict";
|
|
4066
4108
|
init_database();
|
|
4067
|
-
MAX_CARDS_PER_MEMORY =
|
|
4068
|
-
|
|
4109
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4110
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4111
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4069
4112
|
}
|
|
4070
4113
|
});
|
|
4071
4114
|
|
|
@@ -4342,7 +4385,7 @@ init_memory();
|
|
|
4342
4385
|
init_database();
|
|
4343
4386
|
|
|
4344
4387
|
// src/lib/keychain.ts
|
|
4345
|
-
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
4388
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
|
|
4346
4389
|
import { existsSync as existsSync7, statSync as statSync3 } from "fs";
|
|
4347
4390
|
import { execSync as execSync3 } from "child_process";
|
|
4348
4391
|
import path6 from "path";
|
|
@@ -4381,12 +4424,14 @@ function linuxSecretAvailable() {
|
|
|
4381
4424
|
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
4382
4425
|
if (process.platform !== "linux") return false;
|
|
4383
4426
|
try {
|
|
4384
|
-
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
4385
4427
|
const st = statSync3(keyPath);
|
|
4386
4428
|
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
4429
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
4387
4430
|
if (uid === 0) return true;
|
|
4388
4431
|
const exeOsDir = process.env.EXE_OS_DIR;
|
|
4389
|
-
|
|
4432
|
+
if (exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep)) return true;
|
|
4433
|
+
if (!linuxSecretAvailable()) return true;
|
|
4434
|
+
return false;
|
|
4390
4435
|
} catch {
|
|
4391
4436
|
return false;
|
|
4392
4437
|
}
|
|
@@ -4537,15 +4582,25 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
4537
4582
|
await mkdir3(dir, { recursive: true });
|
|
4538
4583
|
const keyPath = getKeyPath();
|
|
4539
4584
|
const machineKey = deriveMachineKey();
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4585
|
+
const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
|
|
4586
|
+
const result = machineKey ? "encrypted" : "plaintext";
|
|
4587
|
+
const tmpPath = keyPath + ".tmp";
|
|
4588
|
+
try {
|
|
4589
|
+
if (existsSync7(keyPath)) {
|
|
4590
|
+
await copyFile(keyPath, keyPath + ".bak").catch(() => {
|
|
4591
|
+
});
|
|
4592
|
+
}
|
|
4593
|
+
await writeFile3(tmpPath, content, "utf-8");
|
|
4594
|
+
await chmod2(tmpPath, 384);
|
|
4595
|
+
await rename(tmpPath, keyPath);
|
|
4596
|
+
} catch (err) {
|
|
4597
|
+
try {
|
|
4598
|
+
await unlink(tmpPath);
|
|
4599
|
+
} catch {
|
|
4600
|
+
}
|
|
4601
|
+
throw err;
|
|
4602
|
+
}
|
|
4603
|
+
return result;
|
|
4549
4604
|
}
|
|
4550
4605
|
async function getMasterKey() {
|
|
4551
4606
|
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
@@ -3034,6 +3034,22 @@ async function ensureSchema() {
|
|
|
3034
3034
|
} catch (e) {
|
|
3035
3035
|
logCatchDebug("migration", e);
|
|
3036
3036
|
}
|
|
3037
|
+
try {
|
|
3038
|
+
await client.execute({
|
|
3039
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3040
|
+
args: []
|
|
3041
|
+
});
|
|
3042
|
+
} catch (e) {
|
|
3043
|
+
logCatchDebug("migration", e);
|
|
3044
|
+
}
|
|
3045
|
+
try {
|
|
3046
|
+
await client.execute({
|
|
3047
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3048
|
+
args: []
|
|
3049
|
+
});
|
|
3050
|
+
} catch (e) {
|
|
3051
|
+
logCatchDebug("migration", e);
|
|
3052
|
+
}
|
|
3037
3053
|
}
|
|
3038
3054
|
async function disposeDatabase() {
|
|
3039
3055
|
if (_walCheckpointTimer) {
|
|
@@ -3600,11 +3616,17 @@ var init_platform_procedures = __esm({
|
|
|
3600
3616
|
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."
|
|
3601
3617
|
},
|
|
3602
3618
|
{
|
|
3603
|
-
title: "
|
|
3619
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
3604
3620
|
domain: "workflow",
|
|
3605
3621
|
priority: "p1",
|
|
3606
3622
|
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."
|
|
3607
3623
|
},
|
|
3624
|
+
{
|
|
3625
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
3626
|
+
domain: "identity",
|
|
3627
|
+
priority: "p0",
|
|
3628
|
+
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."
|
|
3629
|
+
},
|
|
3608
3630
|
{
|
|
3609
3631
|
title: "Single dispatch path \u2014 create_task only",
|
|
3610
3632
|
domain: "workflow",
|
|
@@ -3638,6 +3660,12 @@ var init_platform_procedures = __esm({
|
|
|
3638
3660
|
priority: "p0",
|
|
3639
3661
|
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."
|
|
3640
3662
|
},
|
|
3663
|
+
{
|
|
3664
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
3665
|
+
domain: "security",
|
|
3666
|
+
priority: "p0",
|
|
3667
|
+
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."
|
|
3668
|
+
},
|
|
3641
3669
|
{
|
|
3642
3670
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
3643
3671
|
domain: "support",
|
|
@@ -3930,7 +3958,7 @@ init_memory();
|
|
|
3930
3958
|
init_database();
|
|
3931
3959
|
|
|
3932
3960
|
// src/lib/keychain.ts
|
|
3933
|
-
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3961
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
|
|
3934
3962
|
import { existsSync as existsSync7, statSync as statSync3 } from "fs";
|
|
3935
3963
|
import { execSync as execSync3 } from "child_process";
|
|
3936
3964
|
import path6 from "path";
|
|
@@ -3969,12 +3997,14 @@ function linuxSecretAvailable() {
|
|
|
3969
3997
|
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3970
3998
|
if (process.platform !== "linux") return false;
|
|
3971
3999
|
try {
|
|
3972
|
-
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3973
4000
|
const st = statSync3(keyPath);
|
|
3974
4001
|
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
4002
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3975
4003
|
if (uid === 0) return true;
|
|
3976
4004
|
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3977
|
-
|
|
4005
|
+
if (exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep)) return true;
|
|
4006
|
+
if (!linuxSecretAvailable()) return true;
|
|
4007
|
+
return false;
|
|
3978
4008
|
} catch {
|
|
3979
4009
|
return false;
|
|
3980
4010
|
}
|
|
@@ -4125,15 +4155,25 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
4125
4155
|
await mkdir3(dir, { recursive: true });
|
|
4126
4156
|
const keyPath = getKeyPath();
|
|
4127
4157
|
const machineKey = deriveMachineKey();
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4158
|
+
const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
|
|
4159
|
+
const result = machineKey ? "encrypted" : "plaintext";
|
|
4160
|
+
const tmpPath = keyPath + ".tmp";
|
|
4161
|
+
try {
|
|
4162
|
+
if (existsSync7(keyPath)) {
|
|
4163
|
+
await copyFile(keyPath, keyPath + ".bak").catch(() => {
|
|
4164
|
+
});
|
|
4165
|
+
}
|
|
4166
|
+
await writeFile3(tmpPath, content, "utf-8");
|
|
4167
|
+
await chmod2(tmpPath, 384);
|
|
4168
|
+
await rename(tmpPath, keyPath);
|
|
4169
|
+
} catch (err) {
|
|
4170
|
+
try {
|
|
4171
|
+
await unlink(tmpPath);
|
|
4172
|
+
} catch {
|
|
4173
|
+
}
|
|
4174
|
+
throw err;
|
|
4175
|
+
}
|
|
4176
|
+
return result;
|
|
4137
4177
|
}
|
|
4138
4178
|
async function getMasterKey() {
|
|
4139
4179
|
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
@@ -3034,6 +3034,22 @@ async function ensureSchema() {
|
|
|
3034
3034
|
} catch (e) {
|
|
3035
3035
|
logCatchDebug("migration", e);
|
|
3036
3036
|
}
|
|
3037
|
+
try {
|
|
3038
|
+
await client.execute({
|
|
3039
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3040
|
+
args: []
|
|
3041
|
+
});
|
|
3042
|
+
} catch (e) {
|
|
3043
|
+
logCatchDebug("migration", e);
|
|
3044
|
+
}
|
|
3045
|
+
try {
|
|
3046
|
+
await client.execute({
|
|
3047
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3048
|
+
args: []
|
|
3049
|
+
});
|
|
3050
|
+
} catch (e) {
|
|
3051
|
+
logCatchDebug("migration", e);
|
|
3052
|
+
}
|
|
3037
3053
|
}
|
|
3038
3054
|
async function disposeDatabase() {
|
|
3039
3055
|
if (_walCheckpointTimer) {
|
|
@@ -3600,11 +3616,17 @@ var init_platform_procedures = __esm({
|
|
|
3600
3616
|
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."
|
|
3601
3617
|
},
|
|
3602
3618
|
{
|
|
3603
|
-
title: "
|
|
3619
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
3604
3620
|
domain: "workflow",
|
|
3605
3621
|
priority: "p1",
|
|
3606
3622
|
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."
|
|
3607
3623
|
},
|
|
3624
|
+
{
|
|
3625
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
3626
|
+
domain: "identity",
|
|
3627
|
+
priority: "p0",
|
|
3628
|
+
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."
|
|
3629
|
+
},
|
|
3608
3630
|
{
|
|
3609
3631
|
title: "Single dispatch path \u2014 create_task only",
|
|
3610
3632
|
domain: "workflow",
|
|
@@ -3638,6 +3660,12 @@ var init_platform_procedures = __esm({
|
|
|
3638
3660
|
priority: "p0",
|
|
3639
3661
|
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."
|
|
3640
3662
|
},
|
|
3663
|
+
{
|
|
3664
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
3665
|
+
domain: "security",
|
|
3666
|
+
priority: "p0",
|
|
3667
|
+
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."
|
|
3668
|
+
},
|
|
3641
3669
|
{
|
|
3642
3670
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
3643
3671
|
domain: "support",
|
|
@@ -4054,7 +4082,7 @@ init_memory();
|
|
|
4054
4082
|
init_database();
|
|
4055
4083
|
|
|
4056
4084
|
// src/lib/keychain.ts
|
|
4057
|
-
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
4085
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
|
|
4058
4086
|
import { existsSync as existsSync7, statSync as statSync3 } from "fs";
|
|
4059
4087
|
import { execSync as execSync3 } from "child_process";
|
|
4060
4088
|
import path6 from "path";
|
|
@@ -4093,12 +4121,14 @@ function linuxSecretAvailable() {
|
|
|
4093
4121
|
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
4094
4122
|
if (process.platform !== "linux") return false;
|
|
4095
4123
|
try {
|
|
4096
|
-
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
4097
4124
|
const st = statSync3(keyPath);
|
|
4098
4125
|
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
4126
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
4099
4127
|
if (uid === 0) return true;
|
|
4100
4128
|
const exeOsDir = process.env.EXE_OS_DIR;
|
|
4101
|
-
|
|
4129
|
+
if (exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep)) return true;
|
|
4130
|
+
if (!linuxSecretAvailable()) return true;
|
|
4131
|
+
return false;
|
|
4102
4132
|
} catch {
|
|
4103
4133
|
return false;
|
|
4104
4134
|
}
|
|
@@ -4249,15 +4279,25 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
4249
4279
|
await mkdir3(dir, { recursive: true });
|
|
4250
4280
|
const keyPath = getKeyPath();
|
|
4251
4281
|
const machineKey = deriveMachineKey();
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4282
|
+
const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
|
|
4283
|
+
const result = machineKey ? "encrypted" : "plaintext";
|
|
4284
|
+
const tmpPath = keyPath + ".tmp";
|
|
4285
|
+
try {
|
|
4286
|
+
if (existsSync7(keyPath)) {
|
|
4287
|
+
await copyFile(keyPath, keyPath + ".bak").catch(() => {
|
|
4288
|
+
});
|
|
4289
|
+
}
|
|
4290
|
+
await writeFile3(tmpPath, content, "utf-8");
|
|
4291
|
+
await chmod2(tmpPath, 384);
|
|
4292
|
+
await rename(tmpPath, keyPath);
|
|
4293
|
+
} catch (err) {
|
|
4294
|
+
try {
|
|
4295
|
+
await unlink(tmpPath);
|
|
4296
|
+
} catch {
|
|
4297
|
+
}
|
|
4298
|
+
throw err;
|
|
4299
|
+
}
|
|
4300
|
+
return result;
|
|
4261
4301
|
}
|
|
4262
4302
|
async function getMasterKey() {
|
|
4263
4303
|
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
@@ -3174,6 +3174,22 @@ async function ensureSchema() {
|
|
|
3174
3174
|
} catch (e) {
|
|
3175
3175
|
logCatchDebug("migration", e);
|
|
3176
3176
|
}
|
|
3177
|
+
try {
|
|
3178
|
+
await client.execute({
|
|
3179
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3180
|
+
args: []
|
|
3181
|
+
});
|
|
3182
|
+
} catch (e) {
|
|
3183
|
+
logCatchDebug("migration", e);
|
|
3184
|
+
}
|
|
3185
|
+
try {
|
|
3186
|
+
await client.execute({
|
|
3187
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3188
|
+
args: []
|
|
3189
|
+
});
|
|
3190
|
+
} catch (e) {
|
|
3191
|
+
logCatchDebug("migration", e);
|
|
3192
|
+
}
|
|
3177
3193
|
}
|
|
3178
3194
|
async function disposeDatabase() {
|
|
3179
3195
|
if (_walCheckpointTimer) {
|
|
@@ -3740,11 +3756,17 @@ var init_platform_procedures = __esm({
|
|
|
3740
3756
|
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."
|
|
3741
3757
|
},
|
|
3742
3758
|
{
|
|
3743
|
-
title: "
|
|
3759
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
3744
3760
|
domain: "workflow",
|
|
3745
3761
|
priority: "p1",
|
|
3746
3762
|
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."
|
|
3747
3763
|
},
|
|
3764
|
+
{
|
|
3765
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
3766
|
+
domain: "identity",
|
|
3767
|
+
priority: "p0",
|
|
3768
|
+
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."
|
|
3769
|
+
},
|
|
3748
3770
|
{
|
|
3749
3771
|
title: "Single dispatch path \u2014 create_task only",
|
|
3750
3772
|
domain: "workflow",
|
|
@@ -3778,6 +3800,12 @@ var init_platform_procedures = __esm({
|
|
|
3778
3800
|
priority: "p0",
|
|
3779
3801
|
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."
|
|
3780
3802
|
},
|
|
3803
|
+
{
|
|
3804
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
3805
|
+
domain: "security",
|
|
3806
|
+
priority: "p0",
|
|
3807
|
+
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."
|
|
3808
|
+
},
|
|
3781
3809
|
{
|
|
3782
3810
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
3783
3811
|
domain: "support",
|
|
@@ -4063,10 +4091,24 @@ function stableId(memoryId, type, content) {
|
|
|
4063
4091
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4064
4092
|
}
|
|
4065
4093
|
function cleanText(text) {
|
|
4066
|
-
|
|
4094
|
+
let cleaned = text.replace(
|
|
4095
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4096
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4097
|
+
);
|
|
4098
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4099
|
+
return cleaned;
|
|
4067
4100
|
}
|
|
4068
|
-
function
|
|
4069
|
-
|
|
4101
|
+
function splitSegments(text) {
|
|
4102
|
+
const cleaned = cleanText(text);
|
|
4103
|
+
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);
|
|
4104
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4105
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4106
|
+
if (lines.length > 0) return lines;
|
|
4107
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4108
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
return segments;
|
|
4070
4112
|
}
|
|
4071
4113
|
function inferCardType(sentence, toolName) {
|
|
4072
4114
|
const lower = sentence.toLowerCase();
|
|
@@ -4098,12 +4140,12 @@ function predicateFor(type) {
|
|
|
4098
4140
|
}
|
|
4099
4141
|
}
|
|
4100
4142
|
function extractMemoryCards(row) {
|
|
4101
|
-
const
|
|
4143
|
+
const segments = splitSegments(row.raw_text);
|
|
4102
4144
|
const cards = [];
|
|
4103
|
-
for (const sentence of
|
|
4145
|
+
for (const sentence of segments) {
|
|
4104
4146
|
const type = inferCardType(sentence, row.tool_name);
|
|
4105
4147
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4106
|
-
const content = sentence.length >
|
|
4148
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4107
4149
|
cards.push({
|
|
4108
4150
|
id: stableId(row.id, type, content),
|
|
4109
4151
|
memory_id: row.id,
|
|
@@ -4199,13 +4241,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4199
4241
|
last_accessed: String(row.timestamp)
|
|
4200
4242
|
}));
|
|
4201
4243
|
}
|
|
4202
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4244
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4203
4245
|
var init_memory_cards = __esm({
|
|
4204
4246
|
"src/lib/memory-cards.ts"() {
|
|
4205
4247
|
"use strict";
|
|
4206
4248
|
init_database();
|
|
4207
|
-
MAX_CARDS_PER_MEMORY =
|
|
4208
|
-
|
|
4249
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4250
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4251
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4209
4252
|
}
|
|
4210
4253
|
});
|
|
4211
4254
|
|
|
@@ -4491,7 +4534,7 @@ init_memory();
|
|
|
4491
4534
|
init_database();
|
|
4492
4535
|
|
|
4493
4536
|
// src/lib/keychain.ts
|
|
4494
|
-
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
4537
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2, rename, copyFile } from "fs/promises";
|
|
4495
4538
|
import { existsSync as existsSync7, statSync as statSync3 } from "fs";
|
|
4496
4539
|
import { execSync as execSync3 } from "child_process";
|
|
4497
4540
|
import path6 from "path";
|
|
@@ -4530,12 +4573,14 @@ function linuxSecretAvailable() {
|
|
|
4530
4573
|
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
4531
4574
|
if (process.platform !== "linux") return false;
|
|
4532
4575
|
try {
|
|
4533
|
-
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
4534
4576
|
const st = statSync3(keyPath);
|
|
4535
4577
|
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
4578
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
4536
4579
|
if (uid === 0) return true;
|
|
4537
4580
|
const exeOsDir = process.env.EXE_OS_DIR;
|
|
4538
|
-
|
|
4581
|
+
if (exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep)) return true;
|
|
4582
|
+
if (!linuxSecretAvailable()) return true;
|
|
4583
|
+
return false;
|
|
4539
4584
|
} catch {
|
|
4540
4585
|
return false;
|
|
4541
4586
|
}
|
|
@@ -4686,15 +4731,25 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
4686
4731
|
await mkdir3(dir, { recursive: true });
|
|
4687
4732
|
const keyPath = getKeyPath();
|
|
4688
4733
|
const machineKey = deriveMachineKey();
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4734
|
+
const content = machineKey ? encryptWithMachineKey(b64, machineKey) + "\n" : b64 + "\n";
|
|
4735
|
+
const result = machineKey ? "encrypted" : "plaintext";
|
|
4736
|
+
const tmpPath = keyPath + ".tmp";
|
|
4737
|
+
try {
|
|
4738
|
+
if (existsSync7(keyPath)) {
|
|
4739
|
+
await copyFile(keyPath, keyPath + ".bak").catch(() => {
|
|
4740
|
+
});
|
|
4741
|
+
}
|
|
4742
|
+
await writeFile3(tmpPath, content, "utf-8");
|
|
4743
|
+
await chmod2(tmpPath, 384);
|
|
4744
|
+
await rename(tmpPath, keyPath);
|
|
4745
|
+
} catch (err) {
|
|
4746
|
+
try {
|
|
4747
|
+
await unlink(tmpPath);
|
|
4748
|
+
} catch {
|
|
4749
|
+
}
|
|
4750
|
+
throw err;
|
|
4751
|
+
}
|
|
4752
|
+
return result;
|
|
4698
4753
|
}
|
|
4699
4754
|
async function getMasterKey() {
|
|
4700
4755
|
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|