@askexenow/exe-os 0.9.37 → 0.9.39
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/deploy/stack-manifests/v0.9.json +55 -0
- package/dist/bin/backfill-conversations.js +36 -9
- package/dist/bin/backfill-responses.js +36 -9
- package/dist/bin/backfill-vectors.js +36 -9
- package/dist/bin/cleanup-stale-review-tasks.js +37 -10
- package/dist/bin/cli.js +624 -204
- package/dist/bin/exe-agent.js +13 -5
- package/dist/bin/exe-assign.js +36 -9
- package/dist/bin/exe-boot.js +50 -20
- package/dist/bin/exe-call.js +134 -342
- package/dist/bin/exe-dispatch.js +36 -9
- package/dist/bin/exe-doctor.js +39 -12
- package/dist/bin/exe-export-behaviors.js +38 -11
- package/dist/bin/exe-forget.js +36 -9
- package/dist/bin/exe-gateway.js +64 -15
- package/dist/bin/exe-heartbeat.js +37 -10
- package/dist/bin/exe-kill.js +36 -9
- package/dist/bin/exe-launch-agent.js +287 -1081
- package/dist/bin/exe-new-employee.js +100 -14
- package/dist/bin/exe-pending-messages.js +36 -9
- package/dist/bin/exe-pending-notifications.js +36 -9
- package/dist/bin/exe-pending-reviews.js +36 -9
- package/dist/bin/exe-rename.js +1780 -204
- package/dist/bin/exe-review.js +36 -9
- package/dist/bin/exe-search.js +38 -11
- package/dist/bin/exe-session-cleanup.js +38 -11
- package/dist/bin/exe-start-codex.js +38 -11
- package/dist/bin/exe-start-opencode.js +38 -11
- package/dist/bin/exe-status.js +37 -10
- package/dist/bin/exe-team.js +36 -9
- package/dist/bin/git-sweep.js +36 -9
- package/dist/bin/graph-backfill.js +36 -9
- package/dist/bin/graph-export.js +36 -9
- package/dist/bin/install.js +70 -3
- package/dist/bin/intercom-check.js +38 -11
- package/dist/bin/scan-tasks.js +36 -9
- package/dist/bin/setup.js +20 -19
- package/dist/bin/shard-migrate.js +36 -9
- package/dist/bin/stack-update.js +308 -0
- package/dist/gateway/index.js +62 -13
- package/dist/hooks/bug-report-worker.js +40 -12
- package/dist/hooks/codex-stop-task-finalizer.js +38 -11
- package/dist/hooks/commit-complete.js +36 -9
- package/dist/hooks/error-recall.js +38 -11
- package/dist/hooks/ingest.js +38 -10
- package/dist/hooks/instructions-loaded.js +44 -12
- package/dist/hooks/notification.js +36 -9
- package/dist/hooks/post-compact.js +36 -9
- package/dist/hooks/post-tool-combined.js +39 -12
- package/dist/hooks/pre-compact.js +37 -10
- package/dist/hooks/pre-tool-use.js +38 -10
- package/dist/hooks/prompt-submit.js +43 -15
- package/dist/hooks/session-end.js +37 -10
- package/dist/hooks/session-start.js +49 -16
- package/dist/hooks/stop.js +37 -10
- package/dist/hooks/subagent-stop.js +36 -9
- package/dist/hooks/summary-worker.js +45 -18
- package/dist/index.js +60 -11
- package/dist/lib/consolidation.js +2 -1
- package/dist/lib/employee-templates.js +4 -3
- package/dist/lib/employees.js +2 -1
- package/dist/lib/exe-daemon.js +11229 -10537
- package/dist/lib/hybrid-search.js +38 -11
- package/dist/lib/identity.js +8 -3
- package/dist/lib/schedules.js +36 -9
- package/dist/lib/store.js +36 -9
- package/dist/mcp/server.js +6873 -6249
- package/dist/mcp/tools/create-task.js +10 -4
- package/dist/runtime/index.js +36 -9
- package/dist/tui/App.js +42 -13
- package/package.json +4 -1
- package/stack.release.json +31 -0
- package/stack.release.schema.json +31 -0
|
@@ -3349,7 +3349,7 @@ __export(shard_manager_exports, {
|
|
|
3349
3349
|
shardExists: () => shardExists
|
|
3350
3350
|
});
|
|
3351
3351
|
import path7 from "path";
|
|
3352
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
3352
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync2 } from "fs";
|
|
3353
3353
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3354
3354
|
function initShardManager(encryptionKey) {
|
|
3355
3355
|
_encryptionKey = encryptionKey;
|
|
@@ -3371,7 +3371,7 @@ function getShardClient(projectName) {
|
|
|
3371
3371
|
if (!_encryptionKey) {
|
|
3372
3372
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3373
3373
|
}
|
|
3374
|
-
const safeName = projectName
|
|
3374
|
+
const safeName = safeShardName(projectName);
|
|
3375
3375
|
if (!safeName || safeName === "unknown") {
|
|
3376
3376
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3377
3377
|
}
|
|
@@ -3393,9 +3393,12 @@ function getShardClient(projectName) {
|
|
|
3393
3393
|
return client;
|
|
3394
3394
|
}
|
|
3395
3395
|
function shardExists(projectName) {
|
|
3396
|
-
const safeName = projectName
|
|
3396
|
+
const safeName = safeShardName(projectName);
|
|
3397
3397
|
return existsSync7(path7.join(SHARDS_DIR, `${safeName}.db`));
|
|
3398
3398
|
}
|
|
3399
|
+
function safeShardName(projectName) {
|
|
3400
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3401
|
+
}
|
|
3399
3402
|
function listShards() {
|
|
3400
3403
|
if (!existsSync7(SHARDS_DIR)) return [];
|
|
3401
3404
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -3489,7 +3492,8 @@ async function ensureShardSchema(client) {
|
|
|
3489
3492
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
3490
3493
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
3491
3494
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
3492
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
3495
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
3496
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
3493
3497
|
]) {
|
|
3494
3498
|
try {
|
|
3495
3499
|
await client.execute(col);
|
|
@@ -3585,9 +3589,32 @@ async function ensureShardSchema(client) {
|
|
|
3585
3589
|
}
|
|
3586
3590
|
}
|
|
3587
3591
|
async function getReadyShardClient(projectName) {
|
|
3588
|
-
const
|
|
3589
|
-
|
|
3590
|
-
|
|
3592
|
+
const safeName = safeShardName(projectName);
|
|
3593
|
+
let client = getShardClient(projectName);
|
|
3594
|
+
try {
|
|
3595
|
+
await ensureShardSchema(client);
|
|
3596
|
+
return client;
|
|
3597
|
+
} catch (err) {
|
|
3598
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3599
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
3600
|
+
client.close();
|
|
3601
|
+
_shards.delete(safeName);
|
|
3602
|
+
_shardLastAccess.delete(safeName);
|
|
3603
|
+
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3604
|
+
if (existsSync7(dbPath)) {
|
|
3605
|
+
const stat = statSync2(dbPath);
|
|
3606
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3607
|
+
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3608
|
+
renameSync3(dbPath, archivedPath);
|
|
3609
|
+
process.stderr.write(
|
|
3610
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
3611
|
+
`
|
|
3612
|
+
);
|
|
3613
|
+
}
|
|
3614
|
+
client = getShardClient(projectName);
|
|
3615
|
+
await ensureShardSchema(client);
|
|
3616
|
+
return client;
|
|
3617
|
+
}
|
|
3591
3618
|
}
|
|
3592
3619
|
function evictLRU() {
|
|
3593
3620
|
let oldest = null;
|
|
@@ -3808,7 +3835,7 @@ var init_platform_procedures = __esm({
|
|
|
3808
3835
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
3809
3836
|
domain: "tool-use",
|
|
3810
3837
|
priority: "p1",
|
|
3811
|
-
content: "
|
|
3838
|
+
content: "wiki: read/list wiki pages only. Direct wiki write tools are removed; wiki updates flow through raw-data ingestion/projection into the curated wiki store. Legacy aliases: list_wiki_pages/get_wiki_page. crm: read/list/get CRM records from exe-db. raw_data: read capped raw landing-pad events from exe-db with payload opt-in. ingest_document: import a file (PDF, MD, etc.) into memory as chunks. list_documents: browse ingested documents by workspace. purge_document: remove a document and its memory chunks. set_document_importance: adjust chunk importance scores. rerank_documents: re-score document relevance for a query."
|
|
3812
3839
|
},
|
|
3813
3840
|
{
|
|
3814
3841
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -3826,7 +3853,7 @@ var init_platform_procedures = __esm({
|
|
|
3826
3853
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3827
3854
|
domain: "tool-use",
|
|
3828
3855
|
priority: "p1",
|
|
3829
|
-
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage
|
|
3856
|
+
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
3830
3857
|
}
|
|
3831
3858
|
];
|
|
3832
3859
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -4966,7 +4993,7 @@ __export(intercom_queue_exports, {
|
|
|
4966
4993
|
queueIntercom: () => queueIntercom,
|
|
4967
4994
|
readQueue: () => readQueue
|
|
4968
4995
|
});
|
|
4969
|
-
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, renameSync as
|
|
4996
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, renameSync as renameSync4, existsSync as existsSync10, mkdirSync as mkdirSync4 } from "fs";
|
|
4970
4997
|
import path10 from "path";
|
|
4971
4998
|
import os7 from "os";
|
|
4972
4999
|
function ensureDir() {
|
|
@@ -4985,7 +5012,7 @@ function writeQueue(queue) {
|
|
|
4985
5012
|
ensureDir();
|
|
4986
5013
|
const tmp = `${QUEUE_PATH}.tmp`;
|
|
4987
5014
|
writeFileSync5(tmp, JSON.stringify(queue, null, 2));
|
|
4988
|
-
|
|
5015
|
+
renameSync4(tmp, QUEUE_PATH);
|
|
4989
5016
|
}
|
|
4990
5017
|
function queueIntercom(targetSession, reason) {
|
|
4991
5018
|
const queue = readQueue();
|
package/dist/bin/scan-tasks.js
CHANGED
|
@@ -6955,7 +6955,7 @@ __export(shard_manager_exports, {
|
|
|
6955
6955
|
shardExists: () => shardExists
|
|
6956
6956
|
});
|
|
6957
6957
|
import path19 from "path";
|
|
6958
|
-
import { existsSync as existsSync16, mkdirSync as mkdirSync7, readdirSync as readdirSync4 } from "fs";
|
|
6958
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync7, readdirSync as readdirSync4, renameSync as renameSync4, statSync as statSync2 } from "fs";
|
|
6959
6959
|
import { createClient as createClient2 } from "@libsql/client";
|
|
6960
6960
|
function initShardManager(encryptionKey) {
|
|
6961
6961
|
_encryptionKey = encryptionKey;
|
|
@@ -6977,7 +6977,7 @@ function getShardClient(projectName) {
|
|
|
6977
6977
|
if (!_encryptionKey) {
|
|
6978
6978
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
6979
6979
|
}
|
|
6980
|
-
const safeName = projectName
|
|
6980
|
+
const safeName = safeShardName(projectName);
|
|
6981
6981
|
if (!safeName || safeName === "unknown") {
|
|
6982
6982
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
6983
6983
|
}
|
|
@@ -6999,9 +6999,12 @@ function getShardClient(projectName) {
|
|
|
6999
6999
|
return client;
|
|
7000
7000
|
}
|
|
7001
7001
|
function shardExists(projectName) {
|
|
7002
|
-
const safeName = projectName
|
|
7002
|
+
const safeName = safeShardName(projectName);
|
|
7003
7003
|
return existsSync16(path19.join(SHARDS_DIR, `${safeName}.db`));
|
|
7004
7004
|
}
|
|
7005
|
+
function safeShardName(projectName) {
|
|
7006
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
7007
|
+
}
|
|
7005
7008
|
function listShards() {
|
|
7006
7009
|
if (!existsSync16(SHARDS_DIR)) return [];
|
|
7007
7010
|
return readdirSync4(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -7095,7 +7098,8 @@ async function ensureShardSchema(client) {
|
|
|
7095
7098
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
7096
7099
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
7097
7100
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
7098
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
7101
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
7102
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
7099
7103
|
]) {
|
|
7100
7104
|
try {
|
|
7101
7105
|
await client.execute(col);
|
|
@@ -7191,9 +7195,32 @@ async function ensureShardSchema(client) {
|
|
|
7191
7195
|
}
|
|
7192
7196
|
}
|
|
7193
7197
|
async function getReadyShardClient(projectName) {
|
|
7194
|
-
const
|
|
7195
|
-
|
|
7196
|
-
|
|
7198
|
+
const safeName = safeShardName(projectName);
|
|
7199
|
+
let client = getShardClient(projectName);
|
|
7200
|
+
try {
|
|
7201
|
+
await ensureShardSchema(client);
|
|
7202
|
+
return client;
|
|
7203
|
+
} catch (err) {
|
|
7204
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7205
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
7206
|
+
client.close();
|
|
7207
|
+
_shards.delete(safeName);
|
|
7208
|
+
_shardLastAccess.delete(safeName);
|
|
7209
|
+
const dbPath = path19.join(SHARDS_DIR, `${safeName}.db`);
|
|
7210
|
+
if (existsSync16(dbPath)) {
|
|
7211
|
+
const stat = statSync2(dbPath);
|
|
7212
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
7213
|
+
const archivedPath = path19.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
7214
|
+
renameSync4(dbPath, archivedPath);
|
|
7215
|
+
process.stderr.write(
|
|
7216
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
7217
|
+
`
|
|
7218
|
+
);
|
|
7219
|
+
}
|
|
7220
|
+
client = getShardClient(projectName);
|
|
7221
|
+
await ensureShardSchema(client);
|
|
7222
|
+
return client;
|
|
7223
|
+
}
|
|
7197
7224
|
}
|
|
7198
7225
|
function evictLRU() {
|
|
7199
7226
|
let oldest = null;
|
|
@@ -7414,7 +7441,7 @@ var init_platform_procedures = __esm({
|
|
|
7414
7441
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
7415
7442
|
domain: "tool-use",
|
|
7416
7443
|
priority: "p1",
|
|
7417
|
-
content: "
|
|
7444
|
+
content: "wiki: read/list wiki pages only. Direct wiki write tools are removed; wiki updates flow through raw-data ingestion/projection into the curated wiki store. Legacy aliases: list_wiki_pages/get_wiki_page. crm: read/list/get CRM records from exe-db. raw_data: read capped raw landing-pad events from exe-db with payload opt-in. ingest_document: import a file (PDF, MD, etc.) into memory as chunks. list_documents: browse ingested documents by workspace. purge_document: remove a document and its memory chunks. set_document_importance: adjust chunk importance scores. rerank_documents: re-score document relevance for a query."
|
|
7418
7445
|
},
|
|
7419
7446
|
{
|
|
7420
7447
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -7432,7 +7459,7 @@ var init_platform_procedures = __esm({
|
|
|
7432
7459
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
7433
7460
|
domain: "tool-use",
|
|
7434
7461
|
priority: "p1",
|
|
7435
|
-
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage
|
|
7462
|
+
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
7436
7463
|
}
|
|
7437
7464
|
];
|
|
7438
7465
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
package/dist/bin/setup.js
CHANGED
|
@@ -1955,7 +1955,8 @@ function isMultiInstance(agentName, employees) {
|
|
|
1955
1955
|
return MULTI_INSTANCE_ROLES.has(emp.role.toLowerCase());
|
|
1956
1956
|
}
|
|
1957
1957
|
function addEmployee(employees, employee) {
|
|
1958
|
-
const
|
|
1958
|
+
const { systemPrompt: _legacyPrompt, ...rest } = employee;
|
|
1959
|
+
const normalized = { ...rest, name: employee.name.toLowerCase() };
|
|
1959
1960
|
if (employees.some((e) => e.name.toLowerCase() === normalized.name)) {
|
|
1960
1961
|
throw new Error(`Employee '${normalized.name}' already exists`);
|
|
1961
1962
|
}
|
|
@@ -5774,7 +5775,7 @@ var init_platform_procedures = __esm({
|
|
|
5774
5775
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
5775
5776
|
domain: "tool-use",
|
|
5776
5777
|
priority: "p1",
|
|
5777
|
-
content: "
|
|
5778
|
+
content: "wiki: read/list wiki pages only. Direct wiki write tools are removed; wiki updates flow through raw-data ingestion/projection into the curated wiki store. Legacy aliases: list_wiki_pages/get_wiki_page. crm: read/list/get CRM records from exe-db. raw_data: read capped raw landing-pad events from exe-db with payload opt-in. ingest_document: import a file (PDF, MD, etc.) into memory as chunks. list_documents: browse ingested documents by workspace. purge_document: remove a document and its memory chunks. set_document_importance: adjust chunk importance scores. rerank_documents: re-score document relevance for a query."
|
|
5778
5779
|
},
|
|
5779
5780
|
{
|
|
5780
5781
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -5792,7 +5793,7 @@ var init_platform_procedures = __esm({
|
|
|
5792
5793
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
5793
5794
|
domain: "tool-use",
|
|
5794
5795
|
priority: "p1",
|
|
5795
|
-
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage
|
|
5796
|
+
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
5796
5797
|
}
|
|
5797
5798
|
];
|
|
5798
5799
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -5843,7 +5844,8 @@ __export(employee_templates_exports, {
|
|
|
5843
5844
|
});
|
|
5844
5845
|
function getSessionPrompt(storedPrompt) {
|
|
5845
5846
|
const markerIndex = storedPrompt.indexOf(PROCEDURES_MARKER);
|
|
5846
|
-
const
|
|
5847
|
+
const withoutProcedures = markerIndex >= 0 ? storedPrompt.slice(0, markerIndex).trimEnd() : storedPrompt;
|
|
5848
|
+
const rolePrompt = withoutProcedures.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "").replace(/<!--[\s\S]*?-->/g, "").trimStart();
|
|
5847
5849
|
const globalBlock = getGlobalProceduresBlock();
|
|
5848
5850
|
return `${globalBlock}${rolePrompt}
|
|
5849
5851
|
${BASE_OPERATING_PROCEDURES}`;
|
|
@@ -6466,6 +6468,9 @@ function ensureDir() {
|
|
|
6466
6468
|
function identityPath(agentId) {
|
|
6467
6469
|
return path14.join(IDENTITY_DIR2, `${agentId}.md`);
|
|
6468
6470
|
}
|
|
6471
|
+
function sanitizeIdentityBody(body) {
|
|
6472
|
+
return body.replace(/<!--[\s\S]*?-->/g, "").trim();
|
|
6473
|
+
}
|
|
6469
6474
|
function parseFrontmatter(raw) {
|
|
6470
6475
|
const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
6471
6476
|
if (!match) {
|
|
@@ -6478,11 +6483,11 @@ function parseFrontmatter(raw) {
|
|
|
6478
6483
|
created_by: "system",
|
|
6479
6484
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
6480
6485
|
},
|
|
6481
|
-
body: raw
|
|
6486
|
+
body: sanitizeIdentityBody(raw)
|
|
6482
6487
|
};
|
|
6483
6488
|
}
|
|
6484
6489
|
const yamlStr = match[1];
|
|
6485
|
-
const body = match[2]
|
|
6490
|
+
const body = sanitizeIdentityBody(match[2]);
|
|
6486
6491
|
const fm = {};
|
|
6487
6492
|
for (const line of yamlStr.split("\n")) {
|
|
6488
6493
|
const kv = line.match(/^(\w+):\s*(.+)$/);
|
|
@@ -6547,7 +6552,9 @@ function listIdentities() {
|
|
|
6547
6552
|
const summary = lines[0]?.trim().slice(0, 120) ?? identity.frontmatter.title;
|
|
6548
6553
|
results.push({
|
|
6549
6554
|
agentId,
|
|
6550
|
-
title
|
|
6555
|
+
// User-facing/team-facing title only. `frontmatter.role` is internal
|
|
6556
|
+
// routing metadata and must not leak as an external title.
|
|
6557
|
+
title: identity.frontmatter.title,
|
|
6551
6558
|
summary
|
|
6552
6559
|
});
|
|
6553
6560
|
}
|
|
@@ -7859,15 +7866,9 @@ async function runSetupWizard(opts = {}) {
|
|
|
7859
7866
|
cooName = (cooNameInput || DEFAULT_COORDINATOR_TEMPLATE_NAME2).toLowerCase();
|
|
7860
7867
|
let employees = await loadEmployees2(EMPLOYEES_PATH2).catch(() => []);
|
|
7861
7868
|
if (!employees.some((e) => e.name === cooName)) {
|
|
7862
|
-
const { DEFAULT_EXE: DEFAULT_EXE2, personalizePrompt: personalizePrompt2 } = await Promise.resolve().then(() => (init_employee_templates(), employee_templates_exports));
|
|
7863
7869
|
const cooEmployee = {
|
|
7864
7870
|
name: cooName,
|
|
7865
7871
|
role: "COO",
|
|
7866
|
-
systemPrompt: personalizePrompt2(
|
|
7867
|
-
DEFAULT_EXE2.systemPrompt,
|
|
7868
|
-
DEFAULT_COORDINATOR_TEMPLATE_NAME2,
|
|
7869
|
-
cooName
|
|
7870
|
-
),
|
|
7871
7872
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7872
7873
|
templateName: DEFAULT_COORDINATOR_TEMPLATE_NAME2,
|
|
7873
7874
|
templateVersion: 1
|
|
@@ -7961,12 +7962,12 @@ async function runSetupWizard(opts = {}) {
|
|
|
7961
7962
|
const ctoNameInput = await ask(rl, `Name your CTO (default: ${ctoDefault}): `);
|
|
7962
7963
|
const ctoName = (ctoNameInput || ctoDefault).toLowerCase();
|
|
7963
7964
|
if (!employees.some((e) => e.name === ctoName)) {
|
|
7964
|
-
const { personalizePrompt: personalizeCto } = await Promise.resolve().then(() => (init_employee_templates(), employee_templates_exports));
|
|
7965
7965
|
const ctoEmployee = {
|
|
7966
7966
|
name: ctoName,
|
|
7967
7967
|
role: "CTO",
|
|
7968
|
-
|
|
7969
|
-
|
|
7968
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7969
|
+
templateName: ctoDefault,
|
|
7970
|
+
templateVersion: 1
|
|
7970
7971
|
};
|
|
7971
7972
|
employees = addEmployee2(employees, ctoEmployee);
|
|
7972
7973
|
await saveEmployees2(employees, EMPLOYEES_PATH2);
|
|
@@ -7984,12 +7985,12 @@ async function runSetupWizard(opts = {}) {
|
|
|
7984
7985
|
const cmoNameInput = await ask(rl, `Name your CMO (default: ${cmoDefault}): `);
|
|
7985
7986
|
const cmoName = (cmoNameInput || cmoDefault).toLowerCase();
|
|
7986
7987
|
if (!employees.some((e) => e.name === cmoName)) {
|
|
7987
|
-
const { personalizePrompt: personalizeCmo } = await Promise.resolve().then(() => (init_employee_templates(), employee_templates_exports));
|
|
7988
7988
|
const cmoEmployee = {
|
|
7989
7989
|
name: cmoName,
|
|
7990
7990
|
role: "CMO",
|
|
7991
|
-
|
|
7992
|
-
|
|
7991
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7992
|
+
templateName: cmoDefault,
|
|
7993
|
+
templateVersion: 1
|
|
7993
7994
|
};
|
|
7994
7995
|
employees = addEmployee2(employees, cmoEmployee);
|
|
7995
7996
|
await saveEmployees2(employees, EMPLOYEES_PATH2);
|
|
@@ -2601,7 +2601,7 @@ __export(shard_manager_exports, {
|
|
|
2601
2601
|
shardExists: () => shardExists
|
|
2602
2602
|
});
|
|
2603
2603
|
import path7 from "path";
|
|
2604
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
2604
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync2 } from "fs";
|
|
2605
2605
|
import { createClient as createClient2 } from "@libsql/client";
|
|
2606
2606
|
function initShardManager(encryptionKey) {
|
|
2607
2607
|
_encryptionKey = encryptionKey;
|
|
@@ -2623,7 +2623,7 @@ function getShardClient(projectName) {
|
|
|
2623
2623
|
if (!_encryptionKey) {
|
|
2624
2624
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
2625
2625
|
}
|
|
2626
|
-
const safeName = projectName
|
|
2626
|
+
const safeName = safeShardName(projectName);
|
|
2627
2627
|
if (!safeName || safeName === "unknown") {
|
|
2628
2628
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
2629
2629
|
}
|
|
@@ -2645,9 +2645,12 @@ function getShardClient(projectName) {
|
|
|
2645
2645
|
return client;
|
|
2646
2646
|
}
|
|
2647
2647
|
function shardExists(projectName) {
|
|
2648
|
-
const safeName = projectName
|
|
2648
|
+
const safeName = safeShardName(projectName);
|
|
2649
2649
|
return existsSync7(path7.join(SHARDS_DIR, `${safeName}.db`));
|
|
2650
2650
|
}
|
|
2651
|
+
function safeShardName(projectName) {
|
|
2652
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2653
|
+
}
|
|
2651
2654
|
function listShards() {
|
|
2652
2655
|
if (!existsSync7(SHARDS_DIR)) return [];
|
|
2653
2656
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -2741,7 +2744,8 @@ async function ensureShardSchema(client) {
|
|
|
2741
2744
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
2742
2745
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
2743
2746
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
2744
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
2747
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
2748
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
2745
2749
|
]) {
|
|
2746
2750
|
try {
|
|
2747
2751
|
await client.execute(col);
|
|
@@ -2837,9 +2841,32 @@ async function ensureShardSchema(client) {
|
|
|
2837
2841
|
}
|
|
2838
2842
|
}
|
|
2839
2843
|
async function getReadyShardClient(projectName) {
|
|
2840
|
-
const
|
|
2841
|
-
|
|
2842
|
-
|
|
2844
|
+
const safeName = safeShardName(projectName);
|
|
2845
|
+
let client = getShardClient(projectName);
|
|
2846
|
+
try {
|
|
2847
|
+
await ensureShardSchema(client);
|
|
2848
|
+
return client;
|
|
2849
|
+
} catch (err) {
|
|
2850
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2851
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
2852
|
+
client.close();
|
|
2853
|
+
_shards.delete(safeName);
|
|
2854
|
+
_shardLastAccess.delete(safeName);
|
|
2855
|
+
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
2856
|
+
if (existsSync7(dbPath)) {
|
|
2857
|
+
const stat = statSync2(dbPath);
|
|
2858
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
2859
|
+
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
2860
|
+
renameSync3(dbPath, archivedPath);
|
|
2861
|
+
process.stderr.write(
|
|
2862
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
2863
|
+
`
|
|
2864
|
+
);
|
|
2865
|
+
}
|
|
2866
|
+
client = getShardClient(projectName);
|
|
2867
|
+
await ensureShardSchema(client);
|
|
2868
|
+
return client;
|
|
2869
|
+
}
|
|
2843
2870
|
}
|
|
2844
2871
|
function evictLRU() {
|
|
2845
2872
|
let oldest = null;
|
|
@@ -3060,7 +3087,7 @@ var init_platform_procedures = __esm({
|
|
|
3060
3087
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
3061
3088
|
domain: "tool-use",
|
|
3062
3089
|
priority: "p1",
|
|
3063
|
-
content: "
|
|
3090
|
+
content: "wiki: read/list wiki pages only. Direct wiki write tools are removed; wiki updates flow through raw-data ingestion/projection into the curated wiki store. Legacy aliases: list_wiki_pages/get_wiki_page. crm: read/list/get CRM records from exe-db. raw_data: read capped raw landing-pad events from exe-db with payload opt-in. ingest_document: import a file (PDF, MD, etc.) into memory as chunks. list_documents: browse ingested documents by workspace. purge_document: remove a document and its memory chunks. set_document_importance: adjust chunk importance scores. rerank_documents: re-score document relevance for a query."
|
|
3064
3091
|
},
|
|
3065
3092
|
{
|
|
3066
3093
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -3078,7 +3105,7 @@ var init_platform_procedures = __esm({
|
|
|
3078
3105
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3079
3106
|
domain: "tool-use",
|
|
3080
3107
|
priority: "p1",
|
|
3081
|
-
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage
|
|
3108
|
+
content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
3082
3109
|
}
|
|
3083
3110
|
];
|
|
3084
3111
|
PLATFORM_PROCEDURE_TITLES = new Set(
|