@askexenow/exe-os 0.9.112 → 0.9.113
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 +54 -11
- package/dist/bin/agentic-reflection-backfill.js +29 -1
- package/dist/bin/agentic-semantic-label.js +29 -1
- package/dist/bin/backfill-conversations.js +53 -10
- package/dist/bin/backfill-responses.js +54 -11
- package/dist/bin/backfill-vectors.js +29 -1
- package/dist/bin/bulk-sync-postgres.js +55 -12
- package/dist/bin/cleanup-stale-review-tasks.js +75 -15
- package/dist/bin/cli.js +293 -76
- package/dist/bin/exe-agent-config.js +7 -1
- package/dist/bin/exe-agent.js +28 -2
- package/dist/bin/exe-assign.js +54 -11
- package/dist/bin/exe-boot.js +481 -147
- package/dist/bin/exe-call.js +45 -4
- package/dist/bin/exe-cloud.js +93 -15
- package/dist/bin/exe-dispatch.js +369 -24
- package/dist/bin/exe-doctor.js +53 -10
- package/dist/bin/exe-export-behaviors.js +54 -11
- package/dist/bin/exe-forget.js +54 -11
- package/dist/bin/exe-gateway.js +128 -23
- package/dist/bin/exe-heartbeat.js +75 -15
- package/dist/bin/exe-kill.js +54 -11
- package/dist/bin/exe-launch-agent.js +70 -12
- package/dist/bin/exe-new-employee.js +175 -7
- package/dist/bin/exe-pending-messages.js +75 -15
- package/dist/bin/exe-pending-notifications.js +75 -15
- package/dist/bin/exe-pending-reviews.js +75 -15
- package/dist/bin/exe-rename.js +54 -11
- package/dist/bin/exe-review.js +54 -11
- package/dist/bin/exe-search.js +54 -11
- package/dist/bin/exe-session-cleanup.js +491 -146
- package/dist/bin/exe-settings.js +10 -4
- package/dist/bin/exe-start-codex.js +524 -245
- package/dist/bin/exe-start-opencode.js +534 -165
- package/dist/bin/exe-status.js +75 -15
- package/dist/bin/exe-support.js +1 -1
- package/dist/bin/exe-team.js +54 -11
- package/dist/bin/git-sweep.js +369 -24
- package/dist/bin/graph-backfill.js +54 -11
- package/dist/bin/graph-export.js +54 -11
- package/dist/bin/install.js +62 -4
- package/dist/bin/intercom-check.js +491 -146
- package/dist/bin/pre-publish.js +13 -1
- package/dist/bin/scan-tasks.js +369 -24
- package/dist/bin/setup.js +91 -13
- package/dist/bin/shard-migrate.js +54 -11
- package/dist/bin/stack-update.js +1 -1
- package/dist/bin/update.js +3 -3
- package/dist/gateway/index.js +128 -23
- package/dist/hooks/bug-report-worker.js +128 -23
- package/dist/hooks/codex-stop-task-finalizer.js +512 -140
- package/dist/hooks/commit-complete.js +369 -24
- package/dist/hooks/error-recall.js +54 -11
- package/dist/hooks/ingest.js +4575 -252
- package/dist/hooks/instructions-loaded.js +54 -11
- package/dist/hooks/notification.js +54 -11
- package/dist/hooks/post-compact.js +75 -15
- package/dist/hooks/post-tool-combined.js +75 -15
- package/dist/hooks/pre-compact.js +449 -104
- package/dist/hooks/pre-tool-use.js +90 -15
- package/dist/hooks/prompt-submit.js +129 -24
- package/dist/hooks/session-end.js +451 -109
- package/dist/hooks/session-start.js +104 -16
- package/dist/hooks/stop.js +74 -14
- package/dist/hooks/subagent-stop.js +75 -15
- package/dist/hooks/summary-worker.js +73 -7
- package/dist/index.js +128 -23
- package/dist/lib/agent-config.js +16 -1
- package/dist/lib/cloud-sync.js +38 -1
- package/dist/lib/consolidation.js +16 -1
- 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 +16 -1
- package/dist/lib/exe-daemon.js +268 -42
- package/dist/lib/hybrid-search.js +54 -11
- package/dist/lib/license.js +3 -3
- package/dist/lib/messaging.js +21 -4
- package/dist/lib/schedules.js +29 -1
- package/dist/lib/skill-learning.js +458 -70
- package/dist/lib/status-brief.js +14 -1
- package/dist/lib/store.js +54 -11
- package/dist/lib/tasks.js +393 -91
- package/dist/lib/tmux-routing.js +316 -14
- package/dist/mcp/server.js +169 -30
- package/dist/mcp/tools/create-task.js +75 -13
- 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 +390 -91
- package/dist/runtime/index.js +446 -101
- package/dist/tui/App.js +208 -54
- package/package.json +1 -1
package/dist/bin/exe-doctor.js
CHANGED
|
@@ -4360,6 +4360,22 @@ async function ensureSchema() {
|
|
|
4360
4360
|
} catch (e) {
|
|
4361
4361
|
logCatchDebug("migration", e);
|
|
4362
4362
|
}
|
|
4363
|
+
try {
|
|
4364
|
+
await client.execute({
|
|
4365
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
4366
|
+
args: []
|
|
4367
|
+
});
|
|
4368
|
+
} catch (e) {
|
|
4369
|
+
logCatchDebug("migration", e);
|
|
4370
|
+
}
|
|
4371
|
+
try {
|
|
4372
|
+
await client.execute({
|
|
4373
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
4374
|
+
args: []
|
|
4375
|
+
});
|
|
4376
|
+
} catch (e) {
|
|
4377
|
+
logCatchDebug("migration", e);
|
|
4378
|
+
}
|
|
4363
4379
|
}
|
|
4364
4380
|
async function disposeDatabase() {
|
|
4365
4381
|
if (_walCheckpointTimer) {
|
|
@@ -4711,11 +4727,17 @@ var init_platform_procedures = __esm({
|
|
|
4711
4727
|
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."
|
|
4712
4728
|
},
|
|
4713
4729
|
{
|
|
4714
|
-
title: "
|
|
4730
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4715
4731
|
domain: "workflow",
|
|
4716
4732
|
priority: "p1",
|
|
4717
4733
|
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."
|
|
4718
4734
|
},
|
|
4735
|
+
{
|
|
4736
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4737
|
+
domain: "identity",
|
|
4738
|
+
priority: "p0",
|
|
4739
|
+
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."
|
|
4740
|
+
},
|
|
4719
4741
|
{
|
|
4720
4742
|
title: "Single dispatch path \u2014 create_task only",
|
|
4721
4743
|
domain: "workflow",
|
|
@@ -4749,6 +4771,12 @@ var init_platform_procedures = __esm({
|
|
|
4749
4771
|
priority: "p0",
|
|
4750
4772
|
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."
|
|
4751
4773
|
},
|
|
4774
|
+
{
|
|
4775
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4776
|
+
domain: "security",
|
|
4777
|
+
priority: "p0",
|
|
4778
|
+
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."
|
|
4779
|
+
},
|
|
4752
4780
|
{
|
|
4753
4781
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4754
4782
|
domain: "support",
|
|
@@ -5034,10 +5062,24 @@ function stableId(memoryId, type, content) {
|
|
|
5034
5062
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
5035
5063
|
}
|
|
5036
5064
|
function cleanText(text) {
|
|
5037
|
-
|
|
5065
|
+
let cleaned = text.replace(
|
|
5066
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
5067
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
5068
|
+
);
|
|
5069
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
5070
|
+
return cleaned;
|
|
5038
5071
|
}
|
|
5039
|
-
function
|
|
5040
|
-
|
|
5072
|
+
function splitSegments(text) {
|
|
5073
|
+
const cleaned = cleanText(text);
|
|
5074
|
+
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);
|
|
5075
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
5076
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
5077
|
+
if (lines.length > 0) return lines;
|
|
5078
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
5079
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
return segments;
|
|
5041
5083
|
}
|
|
5042
5084
|
function inferCardType(sentence, toolName) {
|
|
5043
5085
|
const lower = sentence.toLowerCase();
|
|
@@ -5069,12 +5111,12 @@ function predicateFor(type) {
|
|
|
5069
5111
|
}
|
|
5070
5112
|
}
|
|
5071
5113
|
function extractMemoryCards(row) {
|
|
5072
|
-
const
|
|
5114
|
+
const segments = splitSegments(row.raw_text);
|
|
5073
5115
|
const cards = [];
|
|
5074
|
-
for (const sentence of
|
|
5116
|
+
for (const sentence of segments) {
|
|
5075
5117
|
const type = inferCardType(sentence, row.tool_name);
|
|
5076
5118
|
const subject = extractSubject(sentence, row.agent_id);
|
|
5077
|
-
const content = sentence.length >
|
|
5119
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
5078
5120
|
cards.push({
|
|
5079
5121
|
id: stableId(row.id, type, content),
|
|
5080
5122
|
memory_id: row.id,
|
|
@@ -5170,13 +5212,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
5170
5212
|
last_accessed: String(row.timestamp)
|
|
5171
5213
|
}));
|
|
5172
5214
|
}
|
|
5173
|
-
var MAX_CARDS_PER_MEMORY,
|
|
5215
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
5174
5216
|
var init_memory_cards = __esm({
|
|
5175
5217
|
"src/lib/memory-cards.ts"() {
|
|
5176
5218
|
"use strict";
|
|
5177
5219
|
init_database();
|
|
5178
|
-
MAX_CARDS_PER_MEMORY =
|
|
5179
|
-
|
|
5220
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
5221
|
+
MAX_SEGMENT_CHARS = 500;
|
|
5222
|
+
MIN_SEGMENT_CHARS = 20;
|
|
5180
5223
|
}
|
|
5181
5224
|
});
|
|
5182
5225
|
|
|
@@ -3325,6 +3325,22 @@ async function ensureSchema() {
|
|
|
3325
3325
|
} catch (e) {
|
|
3326
3326
|
logCatchDebug("migration", e);
|
|
3327
3327
|
}
|
|
3328
|
+
try {
|
|
3329
|
+
await client.execute({
|
|
3330
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3331
|
+
args: []
|
|
3332
|
+
});
|
|
3333
|
+
} catch (e) {
|
|
3334
|
+
logCatchDebug("migration", e);
|
|
3335
|
+
}
|
|
3336
|
+
try {
|
|
3337
|
+
await client.execute({
|
|
3338
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3339
|
+
args: []
|
|
3340
|
+
});
|
|
3341
|
+
} catch (e) {
|
|
3342
|
+
logCatchDebug("migration", e);
|
|
3343
|
+
}
|
|
3328
3344
|
}
|
|
3329
3345
|
async function disposeDatabase() {
|
|
3330
3346
|
if (_walCheckpointTimer) {
|
|
@@ -4448,11 +4464,17 @@ var init_platform_procedures = __esm({
|
|
|
4448
4464
|
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."
|
|
4449
4465
|
},
|
|
4450
4466
|
{
|
|
4451
|
-
title: "
|
|
4467
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4452
4468
|
domain: "workflow",
|
|
4453
4469
|
priority: "p1",
|
|
4454
4470
|
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."
|
|
4455
4471
|
},
|
|
4472
|
+
{
|
|
4473
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4474
|
+
domain: "identity",
|
|
4475
|
+
priority: "p0",
|
|
4476
|
+
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."
|
|
4477
|
+
},
|
|
4456
4478
|
{
|
|
4457
4479
|
title: "Single dispatch path \u2014 create_task only",
|
|
4458
4480
|
domain: "workflow",
|
|
@@ -4486,6 +4508,12 @@ var init_platform_procedures = __esm({
|
|
|
4486
4508
|
priority: "p0",
|
|
4487
4509
|
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."
|
|
4488
4510
|
},
|
|
4511
|
+
{
|
|
4512
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4513
|
+
domain: "security",
|
|
4514
|
+
priority: "p0",
|
|
4515
|
+
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."
|
|
4516
|
+
},
|
|
4489
4517
|
{
|
|
4490
4518
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4491
4519
|
domain: "support",
|
|
@@ -4771,10 +4799,24 @@ function stableId(memoryId, type, content) {
|
|
|
4771
4799
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4772
4800
|
}
|
|
4773
4801
|
function cleanText(text) {
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4802
|
+
let cleaned = text.replace(
|
|
4803
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4804
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4805
|
+
);
|
|
4806
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4807
|
+
return cleaned;
|
|
4808
|
+
}
|
|
4809
|
+
function splitSegments(text) {
|
|
4810
|
+
const cleaned = cleanText(text);
|
|
4811
|
+
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);
|
|
4812
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4813
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4814
|
+
if (lines.length > 0) return lines;
|
|
4815
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4816
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
return segments;
|
|
4778
4820
|
}
|
|
4779
4821
|
function inferCardType(sentence, toolName) {
|
|
4780
4822
|
const lower = sentence.toLowerCase();
|
|
@@ -4806,12 +4848,12 @@ function predicateFor(type) {
|
|
|
4806
4848
|
}
|
|
4807
4849
|
}
|
|
4808
4850
|
function extractMemoryCards(row) {
|
|
4809
|
-
const
|
|
4851
|
+
const segments = splitSegments(row.raw_text);
|
|
4810
4852
|
const cards = [];
|
|
4811
|
-
for (const sentence of
|
|
4853
|
+
for (const sentence of segments) {
|
|
4812
4854
|
const type = inferCardType(sentence, row.tool_name);
|
|
4813
4855
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4814
|
-
const content = sentence.length >
|
|
4856
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4815
4857
|
cards.push({
|
|
4816
4858
|
id: stableId(row.id, type, content),
|
|
4817
4859
|
memory_id: row.id,
|
|
@@ -4907,13 +4949,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4907
4949
|
last_accessed: String(row.timestamp)
|
|
4908
4950
|
}));
|
|
4909
4951
|
}
|
|
4910
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4952
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4911
4953
|
var init_memory_cards = __esm({
|
|
4912
4954
|
"src/lib/memory-cards.ts"() {
|
|
4913
4955
|
"use strict";
|
|
4914
4956
|
init_database();
|
|
4915
|
-
MAX_CARDS_PER_MEMORY =
|
|
4916
|
-
|
|
4957
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4958
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4959
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4917
4960
|
}
|
|
4918
4961
|
});
|
|
4919
4962
|
|
package/dist/bin/exe-forget.js
CHANGED
|
@@ -3249,6 +3249,22 @@ async function ensureSchema() {
|
|
|
3249
3249
|
} catch (e) {
|
|
3250
3250
|
logCatchDebug("migration", e);
|
|
3251
3251
|
}
|
|
3252
|
+
try {
|
|
3253
|
+
await client.execute({
|
|
3254
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3255
|
+
args: []
|
|
3256
|
+
});
|
|
3257
|
+
} catch (e) {
|
|
3258
|
+
logCatchDebug("migration", e);
|
|
3259
|
+
}
|
|
3260
|
+
try {
|
|
3261
|
+
await client.execute({
|
|
3262
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3263
|
+
args: []
|
|
3264
|
+
});
|
|
3265
|
+
} catch (e) {
|
|
3266
|
+
logCatchDebug("migration", e);
|
|
3267
|
+
}
|
|
3252
3268
|
}
|
|
3253
3269
|
async function disposeDatabase() {
|
|
3254
3270
|
if (_walCheckpointTimer) {
|
|
@@ -4372,11 +4388,17 @@ var init_platform_procedures = __esm({
|
|
|
4372
4388
|
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."
|
|
4373
4389
|
},
|
|
4374
4390
|
{
|
|
4375
|
-
title: "
|
|
4391
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4376
4392
|
domain: "workflow",
|
|
4377
4393
|
priority: "p1",
|
|
4378
4394
|
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."
|
|
4379
4395
|
},
|
|
4396
|
+
{
|
|
4397
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4398
|
+
domain: "identity",
|
|
4399
|
+
priority: "p0",
|
|
4400
|
+
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."
|
|
4401
|
+
},
|
|
4380
4402
|
{
|
|
4381
4403
|
title: "Single dispatch path \u2014 create_task only",
|
|
4382
4404
|
domain: "workflow",
|
|
@@ -4410,6 +4432,12 @@ var init_platform_procedures = __esm({
|
|
|
4410
4432
|
priority: "p0",
|
|
4411
4433
|
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."
|
|
4412
4434
|
},
|
|
4435
|
+
{
|
|
4436
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4437
|
+
domain: "security",
|
|
4438
|
+
priority: "p0",
|
|
4439
|
+
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."
|
|
4440
|
+
},
|
|
4413
4441
|
{
|
|
4414
4442
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4415
4443
|
domain: "support",
|
|
@@ -4695,10 +4723,24 @@ function stableId(memoryId, type, content) {
|
|
|
4695
4723
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4696
4724
|
}
|
|
4697
4725
|
function cleanText(text) {
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4726
|
+
let cleaned = text.replace(
|
|
4727
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4728
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4729
|
+
);
|
|
4730
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4731
|
+
return cleaned;
|
|
4732
|
+
}
|
|
4733
|
+
function splitSegments(text) {
|
|
4734
|
+
const cleaned = cleanText(text);
|
|
4735
|
+
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);
|
|
4736
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4737
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4738
|
+
if (lines.length > 0) return lines;
|
|
4739
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4740
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
return segments;
|
|
4702
4744
|
}
|
|
4703
4745
|
function inferCardType(sentence, toolName) {
|
|
4704
4746
|
const lower = sentence.toLowerCase();
|
|
@@ -4730,12 +4772,12 @@ function predicateFor(type) {
|
|
|
4730
4772
|
}
|
|
4731
4773
|
}
|
|
4732
4774
|
function extractMemoryCards(row) {
|
|
4733
|
-
const
|
|
4775
|
+
const segments = splitSegments(row.raw_text);
|
|
4734
4776
|
const cards = [];
|
|
4735
|
-
for (const sentence of
|
|
4777
|
+
for (const sentence of segments) {
|
|
4736
4778
|
const type = inferCardType(sentence, row.tool_name);
|
|
4737
4779
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4738
|
-
const content = sentence.length >
|
|
4780
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4739
4781
|
cards.push({
|
|
4740
4782
|
id: stableId(row.id, type, content),
|
|
4741
4783
|
memory_id: row.id,
|
|
@@ -4831,13 +4873,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4831
4873
|
last_accessed: String(row.timestamp)
|
|
4832
4874
|
}));
|
|
4833
4875
|
}
|
|
4834
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4876
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4835
4877
|
var init_memory_cards = __esm({
|
|
4836
4878
|
"src/lib/memory-cards.ts"() {
|
|
4837
4879
|
"use strict";
|
|
4838
4880
|
init_database();
|
|
4839
|
-
MAX_CARDS_PER_MEMORY =
|
|
4840
|
-
|
|
4881
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4882
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4883
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4841
4884
|
}
|
|
4842
4885
|
});
|
|
4843
4886
|
|
package/dist/bin/exe-gateway.js
CHANGED
|
@@ -750,6 +750,7 @@ __export(agent_config_exports, {
|
|
|
750
750
|
getAgentRuntime: () => getAgentRuntime,
|
|
751
751
|
loadAgentConfig: () => loadAgentConfig,
|
|
752
752
|
saveAgentConfig: () => saveAgentConfig,
|
|
753
|
+
setAgentMcps: () => setAgentMcps,
|
|
753
754
|
setAgentRuntime: () => setAgentRuntime
|
|
754
755
|
});
|
|
755
756
|
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync3 } from "fs";
|
|
@@ -776,7 +777,7 @@ function getAgentRuntime(agentId) {
|
|
|
776
777
|
if (orgDefault) return orgDefault;
|
|
777
778
|
return { runtime: DEFAULT_RUNTIME, model: DEFAULT_MODELS[DEFAULT_RUNTIME] };
|
|
778
779
|
}
|
|
779
|
-
function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
|
|
780
|
+
function setAgentRuntime(agentId, runtime, model, reasoning_effort, mcps) {
|
|
780
781
|
const knownModels = KNOWN_RUNTIMES[runtime];
|
|
781
782
|
if (!knownModels) {
|
|
782
783
|
return {
|
|
@@ -791,12 +792,26 @@ function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
|
|
|
791
792
|
};
|
|
792
793
|
}
|
|
793
794
|
const config2 = loadAgentConfig();
|
|
795
|
+
const existing = config2[agentId];
|
|
794
796
|
const entry = { runtime, model };
|
|
795
797
|
if (reasoning_effort) entry.reasoning_effort = reasoning_effort;
|
|
798
|
+
if (mcps !== void 0) {
|
|
799
|
+
entry.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
|
|
800
|
+
} else if (existing?.mcps) {
|
|
801
|
+
entry.mcps = existing.mcps;
|
|
802
|
+
}
|
|
796
803
|
config2[agentId] = entry;
|
|
797
804
|
saveAgentConfig(config2);
|
|
798
805
|
return { ok: true };
|
|
799
806
|
}
|
|
807
|
+
function setAgentMcps(agentId, mcps) {
|
|
808
|
+
const config2 = loadAgentConfig();
|
|
809
|
+
const existing = config2[agentId] ?? getAgentRuntime(agentId);
|
|
810
|
+
existing.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
|
|
811
|
+
config2[agentId] = existing;
|
|
812
|
+
saveAgentConfig(config2);
|
|
813
|
+
return { ok: true };
|
|
814
|
+
}
|
|
800
815
|
function clearAgentRuntime(agentId) {
|
|
801
816
|
const config2 = loadAgentConfig();
|
|
802
817
|
delete config2[agentId];
|
|
@@ -3920,6 +3935,22 @@ async function ensureSchema() {
|
|
|
3920
3935
|
} catch (e) {
|
|
3921
3936
|
logCatchDebug("migration", e);
|
|
3922
3937
|
}
|
|
3938
|
+
try {
|
|
3939
|
+
await client.execute({
|
|
3940
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3941
|
+
args: []
|
|
3942
|
+
});
|
|
3943
|
+
} catch (e) {
|
|
3944
|
+
logCatchDebug("migration", e);
|
|
3945
|
+
}
|
|
3946
|
+
try {
|
|
3947
|
+
await client.execute({
|
|
3948
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3949
|
+
args: []
|
|
3950
|
+
});
|
|
3951
|
+
} catch (e) {
|
|
3952
|
+
logCatchDebug("migration", e);
|
|
3953
|
+
}
|
|
3923
3954
|
}
|
|
3924
3955
|
async function disposeDatabase() {
|
|
3925
3956
|
if (_walCheckpointTimer) {
|
|
@@ -5056,11 +5087,17 @@ var init_platform_procedures = __esm({
|
|
|
5056
5087
|
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."
|
|
5057
5088
|
},
|
|
5058
5089
|
{
|
|
5059
|
-
title: "
|
|
5090
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
5060
5091
|
domain: "workflow",
|
|
5061
5092
|
priority: "p1",
|
|
5062
5093
|
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."
|
|
5063
5094
|
},
|
|
5095
|
+
{
|
|
5096
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
5097
|
+
domain: "identity",
|
|
5098
|
+
priority: "p0",
|
|
5099
|
+
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."
|
|
5100
|
+
},
|
|
5064
5101
|
{
|
|
5065
5102
|
title: "Single dispatch path \u2014 create_task only",
|
|
5066
5103
|
domain: "workflow",
|
|
@@ -5094,6 +5131,12 @@ var init_platform_procedures = __esm({
|
|
|
5094
5131
|
priority: "p0",
|
|
5095
5132
|
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."
|
|
5096
5133
|
},
|
|
5134
|
+
{
|
|
5135
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
5136
|
+
domain: "security",
|
|
5137
|
+
priority: "p0",
|
|
5138
|
+
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."
|
|
5139
|
+
},
|
|
5097
5140
|
{
|
|
5098
5141
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
5099
5142
|
domain: "support",
|
|
@@ -5379,10 +5422,24 @@ function stableId(memoryId, type, content) {
|
|
|
5379
5422
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
5380
5423
|
}
|
|
5381
5424
|
function cleanText(text) {
|
|
5382
|
-
|
|
5425
|
+
let cleaned = text.replace(
|
|
5426
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
5427
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
5428
|
+
);
|
|
5429
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
5430
|
+
return cleaned;
|
|
5383
5431
|
}
|
|
5384
|
-
function
|
|
5385
|
-
|
|
5432
|
+
function splitSegments(text) {
|
|
5433
|
+
const cleaned = cleanText(text);
|
|
5434
|
+
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);
|
|
5435
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
5436
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
5437
|
+
if (lines.length > 0) return lines;
|
|
5438
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
5439
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
return segments;
|
|
5386
5443
|
}
|
|
5387
5444
|
function inferCardType(sentence, toolName) {
|
|
5388
5445
|
const lower = sentence.toLowerCase();
|
|
@@ -5414,12 +5471,12 @@ function predicateFor(type) {
|
|
|
5414
5471
|
}
|
|
5415
5472
|
}
|
|
5416
5473
|
function extractMemoryCards(row) {
|
|
5417
|
-
const
|
|
5474
|
+
const segments = splitSegments(row.raw_text);
|
|
5418
5475
|
const cards = [];
|
|
5419
|
-
for (const sentence of
|
|
5476
|
+
for (const sentence of segments) {
|
|
5420
5477
|
const type = inferCardType(sentence, row.tool_name);
|
|
5421
5478
|
const subject = extractSubject(sentence, row.agent_id);
|
|
5422
|
-
const content = sentence.length >
|
|
5479
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
5423
5480
|
cards.push({
|
|
5424
5481
|
id: stableId(row.id, type, content),
|
|
5425
5482
|
memory_id: row.id,
|
|
@@ -5515,13 +5572,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
5515
5572
|
last_accessed: String(row.timestamp)
|
|
5516
5573
|
}));
|
|
5517
5574
|
}
|
|
5518
|
-
var MAX_CARDS_PER_MEMORY,
|
|
5575
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
5519
5576
|
var init_memory_cards = __esm({
|
|
5520
5577
|
"src/lib/memory-cards.ts"() {
|
|
5521
5578
|
"use strict";
|
|
5522
5579
|
init_database();
|
|
5523
|
-
MAX_CARDS_PER_MEMORY =
|
|
5524
|
-
|
|
5580
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
5581
|
+
MAX_SEGMENT_CHARS = 500;
|
|
5582
|
+
MIN_SEGMENT_CHARS = 20;
|
|
5525
5583
|
}
|
|
5526
5584
|
});
|
|
5527
5585
|
|
|
@@ -7966,7 +8024,7 @@ async function assertVpsLicense(opts) {
|
|
|
7966
8024
|
}
|
|
7967
8025
|
if (!transientFailure) {
|
|
7968
8026
|
throw new Error(
|
|
7969
|
-
"License validation failed: unknown backend state. Restore network connectivity to https://askexe.com
|
|
8027
|
+
"License validation failed: unknown backend state. Restore network connectivity to https://cloud.askexe.com and retry."
|
|
7970
8028
|
);
|
|
7971
8029
|
}
|
|
7972
8030
|
const fresh = await getCachedLicense();
|
|
@@ -8003,7 +8061,7 @@ async function assertVpsLicense(opts) {
|
|
|
8003
8061
|
} catch {
|
|
8004
8062
|
}
|
|
8005
8063
|
throw new Error(
|
|
8006
|
-
`License validation unreachable for more than ${graceDays} days. Restore network connectivity to https://askexe.com
|
|
8064
|
+
`License validation unreachable for more than ${graceDays} days. Restore network connectivity to https://cloud.askexe.com and retry. This VPS image refuses to boot after the offline grace window.`
|
|
8007
8065
|
);
|
|
8008
8066
|
}
|
|
8009
8067
|
function startLicenseRevalidation(intervalMs = 36e5) {
|
|
@@ -8035,7 +8093,7 @@ var init_license = __esm({
|
|
|
8035
8093
|
LICENSE_PATH = path10.join(EXE_AI_DIR, "license.key");
|
|
8036
8094
|
CACHE_PATH = path10.join(EXE_AI_DIR, "license-cache.json");
|
|
8037
8095
|
DEVICE_ID_PATH = path10.join(EXE_AI_DIR, "device-id");
|
|
8038
|
-
API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://askexe.com
|
|
8096
|
+
API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://cloud.askexe.com";
|
|
8039
8097
|
RETRY_DELAY_MS = 500;
|
|
8040
8098
|
LICENSE_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----
|
|
8041
8099
|
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
|
|
@@ -10654,6 +10712,19 @@ async function resolveTask(client, identifier, scopeSession) {
|
|
|
10654
10712
|
args: [identifier, ...scope.args]
|
|
10655
10713
|
});
|
|
10656
10714
|
if (result.rows.length === 1) return result.rows[0];
|
|
10715
|
+
if (/^[a-f0-9]{7,12}$/i.test(identifier)) {
|
|
10716
|
+
result = await client.execute({
|
|
10717
|
+
sql: `SELECT * FROM tasks WHERE id LIKE ?`,
|
|
10718
|
+
args: [`${identifier}%`]
|
|
10719
|
+
});
|
|
10720
|
+
if (result.rows.length === 1) return result.rows[0];
|
|
10721
|
+
if (result.rows.length > 1) {
|
|
10722
|
+
const matches = result.rows.map((r) => `${String(r.id)} "${String(r.title)}" (${String(r.status)})`).join(", ");
|
|
10723
|
+
throw new Error(
|
|
10724
|
+
`Multiple tasks match short-ID "${identifier}": ${matches}. Use a longer prefix to disambiguate.`
|
|
10725
|
+
);
|
|
10726
|
+
}
|
|
10727
|
+
}
|
|
10657
10728
|
result = await client.execute({
|
|
10658
10729
|
sql: `SELECT * FROM tasks WHERE task_file LIKE ?${scope.sql}`,
|
|
10659
10730
|
args: [`%${identifier}%`, ...scope.args]
|
|
@@ -11508,12 +11579,13 @@ async function cascadeUnblock(taskId, baseDir, now) {
|
|
|
11508
11579
|
WHERE blocked_by = ? AND status = 'blocked'`,
|
|
11509
11580
|
args: [now, taskId]
|
|
11510
11581
|
});
|
|
11511
|
-
if (
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11582
|
+
if (unblocked.rowsAffected === 0) return;
|
|
11583
|
+
const ubScope = sessionScopeFilter();
|
|
11584
|
+
const unblockedRows = await client.execute({
|
|
11585
|
+
sql: `SELECT id, title, assigned_to, priority, task_file FROM tasks WHERE blocked_by IS NULL AND updated_at = ?${ubScope.sql}`,
|
|
11586
|
+
args: [now, ...ubScope.args]
|
|
11587
|
+
});
|
|
11588
|
+
if (baseDir) {
|
|
11517
11589
|
for (const ur of unblockedRows.rows) {
|
|
11518
11590
|
try {
|
|
11519
11591
|
const ubFile = path20.join(baseDir, String(ur.task_file));
|
|
@@ -11525,6 +11597,19 @@ async function cascadeUnblock(taskId, baseDir, now) {
|
|
|
11525
11597
|
}
|
|
11526
11598
|
}
|
|
11527
11599
|
}
|
|
11600
|
+
if (unblockedRows.rows.length > 0 && !process.env.VITEST) {
|
|
11601
|
+
try {
|
|
11602
|
+
const { queueIntercom: queueIntercom2 } = await Promise.resolve().then(() => (init_intercom_queue(), intercom_queue_exports));
|
|
11603
|
+
const dispatched = /* @__PURE__ */ new Set();
|
|
11604
|
+
for (const ur of unblockedRows.rows) {
|
|
11605
|
+
const assignee = String(ur.assigned_to);
|
|
11606
|
+
if (dispatched.has(assignee)) continue;
|
|
11607
|
+
dispatched.add(assignee);
|
|
11608
|
+
queueIntercom2(`${assignee}`, `unblocked: "${String(ur.title)}" is now ready`);
|
|
11609
|
+
}
|
|
11610
|
+
} catch {
|
|
11611
|
+
}
|
|
11612
|
+
}
|
|
11528
11613
|
}
|
|
11529
11614
|
async function findNextTask(assignedTo) {
|
|
11530
11615
|
const client = getClient();
|
|
@@ -11666,6 +11751,15 @@ var init_tasks_notify = __esm({
|
|
|
11666
11751
|
// src/lib/behaviors.ts
|
|
11667
11752
|
import crypto8 from "crypto";
|
|
11668
11753
|
async function storeBehavior(opts) {
|
|
11754
|
+
try {
|
|
11755
|
+
const { loadEmployeesSync: loadEmployeesSync2 } = await Promise.resolve().then(() => (init_employees(), employees_exports));
|
|
11756
|
+
const roster = loadEmployeesSync2();
|
|
11757
|
+
if (roster.length > 0 && !roster.some((e) => e.name === opts.agentId)) {
|
|
11758
|
+
throw new Error(`Agent "${opts.agentId}" not found in roster. Cannot store behavior for unregistered agent.`);
|
|
11759
|
+
}
|
|
11760
|
+
} catch (e) {
|
|
11761
|
+
if (e instanceof Error && e.message.includes("not found in roster")) throw e;
|
|
11762
|
+
}
|
|
11669
11763
|
const client = getClient();
|
|
11670
11764
|
const id = crypto8.randomUUID();
|
|
11671
11765
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -12119,6 +12213,12 @@ async function updateTask(input) {
|
|
|
12119
12213
|
}
|
|
12120
12214
|
}
|
|
12121
12215
|
}
|
|
12216
|
+
if (input.status === "cancelled") {
|
|
12217
|
+
try {
|
|
12218
|
+
await cascadeUnblock(taskId, input.baseDir, now);
|
|
12219
|
+
} catch {
|
|
12220
|
+
}
|
|
12221
|
+
}
|
|
12122
12222
|
if ((input.status === "done" || input.status === "closed") && !isCoordinatorName(String(row.assigned_to)) && !process.env.VITEST) {
|
|
12123
12223
|
Promise.resolve().then(() => (init_skill_learning(), skill_learning_exports)).then(
|
|
12124
12224
|
({ captureAndLearn: captureAndLearn2 }) => captureAndLearn2({
|
|
@@ -12650,11 +12750,12 @@ function getDispatchedBy(sessionKey) {
|
|
|
12650
12750
|
}
|
|
12651
12751
|
}
|
|
12652
12752
|
function resolveExeSession() {
|
|
12753
|
+
if (process.env.EXE_SESSION_NAME) {
|
|
12754
|
+
const fromEnv = extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
|
|
12755
|
+
if (fromEnv) return fromEnv;
|
|
12756
|
+
}
|
|
12653
12757
|
const mySession = getMySession();
|
|
12654
12758
|
if (!mySession) {
|
|
12655
|
-
if (process.env.EXE_SESSION_NAME) {
|
|
12656
|
-
return extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
|
|
12657
|
-
}
|
|
12658
12759
|
return null;
|
|
12659
12760
|
}
|
|
12660
12761
|
const fromSessionName = extractRootExe(mySession);
|
|
@@ -12669,6 +12770,10 @@ function resolveExeSession() {
|
|
|
12669
12770
|
`[tmux-routing] WARN: cache says "${fromCache}" but session name says "${fromSessionName}". Trusting session name.
|
|
12670
12771
|
`
|
|
12671
12772
|
);
|
|
12773
|
+
try {
|
|
12774
|
+
registerParentExe(key, fromSessionName);
|
|
12775
|
+
} catch {
|
|
12776
|
+
}
|
|
12672
12777
|
candidate = fromSessionName;
|
|
12673
12778
|
} else {
|
|
12674
12779
|
candidate = fromCache;
|