@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
package/dist/bin/exe-doctor.js
CHANGED
|
@@ -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(
|
|
@@ -3279,7 +3306,7 @@ __export(db_backup_exports, {
|
|
|
3279
3306
|
listBackups: () => listBackups,
|
|
3280
3307
|
rotateBackups: () => rotateBackups
|
|
3281
3308
|
});
|
|
3282
|
-
import { copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync4, readdirSync as readdirSync3, unlinkSync as unlinkSync4, statSync as
|
|
3309
|
+
import { copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync4, readdirSync as readdirSync3, unlinkSync as unlinkSync4, statSync as statSync3 } from "fs";
|
|
3283
3310
|
import path9 from "path";
|
|
3284
3311
|
function findActiveDb() {
|
|
3285
3312
|
for (const name of DB_NAMES) {
|
|
@@ -3323,7 +3350,7 @@ function rotateBackups(keepDays = DEFAULT_KEEP_DAYS) {
|
|
|
3323
3350
|
if (!file.endsWith(".db") && !file.endsWith(".db-wal") && !file.endsWith(".db-shm")) continue;
|
|
3324
3351
|
const filePath = path9.join(BACKUP_DIR, file);
|
|
3325
3352
|
try {
|
|
3326
|
-
const stat =
|
|
3353
|
+
const stat = statSync3(filePath);
|
|
3327
3354
|
if (stat.mtimeMs < cutoff) {
|
|
3328
3355
|
unlinkSync4(filePath);
|
|
3329
3356
|
deleted++;
|
|
@@ -3341,7 +3368,7 @@ function listBackups() {
|
|
|
3341
3368
|
const files = readdirSync3(BACKUP_DIR).filter((f) => f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm"));
|
|
3342
3369
|
return files.map((name) => {
|
|
3343
3370
|
const p = path9.join(BACKUP_DIR, name);
|
|
3344
|
-
const stat =
|
|
3371
|
+
const stat = statSync3(p);
|
|
3345
3372
|
return { path: p, name, size: stat.size, date: stat.mtime };
|
|
3346
3373
|
}).sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
3347
3374
|
} catch {
|
|
@@ -3316,7 +3316,7 @@ __export(shard_manager_exports, {
|
|
|
3316
3316
|
shardExists: () => shardExists
|
|
3317
3317
|
});
|
|
3318
3318
|
import path7 from "path";
|
|
3319
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
3319
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync2 } from "fs";
|
|
3320
3320
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3321
3321
|
function initShardManager(encryptionKey) {
|
|
3322
3322
|
_encryptionKey = encryptionKey;
|
|
@@ -3338,7 +3338,7 @@ function getShardClient(projectName2) {
|
|
|
3338
3338
|
if (!_encryptionKey) {
|
|
3339
3339
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3340
3340
|
}
|
|
3341
|
-
const safeName = projectName2
|
|
3341
|
+
const safeName = safeShardName(projectName2);
|
|
3342
3342
|
if (!safeName || safeName === "unknown") {
|
|
3343
3343
|
throw new Error(`Invalid project name for shard: "${projectName2}" (resolved to "${safeName}")`);
|
|
3344
3344
|
}
|
|
@@ -3360,9 +3360,12 @@ function getShardClient(projectName2) {
|
|
|
3360
3360
|
return client;
|
|
3361
3361
|
}
|
|
3362
3362
|
function shardExists(projectName2) {
|
|
3363
|
-
const safeName = projectName2
|
|
3363
|
+
const safeName = safeShardName(projectName2);
|
|
3364
3364
|
return existsSync7(path7.join(SHARDS_DIR, `${safeName}.db`));
|
|
3365
3365
|
}
|
|
3366
|
+
function safeShardName(projectName2) {
|
|
3367
|
+
return projectName2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3368
|
+
}
|
|
3366
3369
|
function listShards() {
|
|
3367
3370
|
if (!existsSync7(SHARDS_DIR)) return [];
|
|
3368
3371
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -3456,7 +3459,8 @@ async function ensureShardSchema(client) {
|
|
|
3456
3459
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
3457
3460
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
3458
3461
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
3459
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
3462
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
3463
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
3460
3464
|
]) {
|
|
3461
3465
|
try {
|
|
3462
3466
|
await client.execute(col);
|
|
@@ -3552,9 +3556,32 @@ async function ensureShardSchema(client) {
|
|
|
3552
3556
|
}
|
|
3553
3557
|
}
|
|
3554
3558
|
async function getReadyShardClient(projectName2) {
|
|
3555
|
-
const
|
|
3556
|
-
|
|
3557
|
-
|
|
3559
|
+
const safeName = safeShardName(projectName2);
|
|
3560
|
+
let client = getShardClient(projectName2);
|
|
3561
|
+
try {
|
|
3562
|
+
await ensureShardSchema(client);
|
|
3563
|
+
return client;
|
|
3564
|
+
} catch (err) {
|
|
3565
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3566
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
3567
|
+
client.close();
|
|
3568
|
+
_shards.delete(safeName);
|
|
3569
|
+
_shardLastAccess.delete(safeName);
|
|
3570
|
+
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3571
|
+
if (existsSync7(dbPath)) {
|
|
3572
|
+
const stat = statSync2(dbPath);
|
|
3573
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3574
|
+
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3575
|
+
renameSync3(dbPath, archivedPath);
|
|
3576
|
+
process.stderr.write(
|
|
3577
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
3578
|
+
`
|
|
3579
|
+
);
|
|
3580
|
+
}
|
|
3581
|
+
client = getShardClient(projectName2);
|
|
3582
|
+
await ensureShardSchema(client);
|
|
3583
|
+
return client;
|
|
3584
|
+
}
|
|
3558
3585
|
}
|
|
3559
3586
|
function evictLRU() {
|
|
3560
3587
|
let oldest = null;
|
|
@@ -3775,7 +3802,7 @@ var init_platform_procedures = __esm({
|
|
|
3775
3802
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
3776
3803
|
domain: "tool-use",
|
|
3777
3804
|
priority: "p1",
|
|
3778
|
-
content: "
|
|
3805
|
+
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."
|
|
3779
3806
|
},
|
|
3780
3807
|
{
|
|
3781
3808
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -3793,7 +3820,7 @@ var init_platform_procedures = __esm({
|
|
|
3793
3820
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3794
3821
|
domain: "tool-use",
|
|
3795
3822
|
priority: "p1",
|
|
3796
|
-
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
|
|
3823
|
+
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."
|
|
3797
3824
|
}
|
|
3798
3825
|
];
|
|
3799
3826
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -4559,7 +4586,7 @@ import {
|
|
|
4559
4586
|
existsSync as existsSync8,
|
|
4560
4587
|
mkdirSync as mkdirSync3,
|
|
4561
4588
|
readdirSync as readdirSync2,
|
|
4562
|
-
statSync as
|
|
4589
|
+
statSync as statSync3,
|
|
4563
4590
|
unlinkSync as unlinkSync3,
|
|
4564
4591
|
writeFileSync as writeFileSync3
|
|
4565
4592
|
} from "fs";
|
|
@@ -4624,7 +4651,7 @@ function sweepStaleBehaviorExports(now = Date.now()) {
|
|
|
4624
4651
|
for (const entry of entries) {
|
|
4625
4652
|
const filePath = path8.join(BEHAVIORS_EXPORT_DIR, entry);
|
|
4626
4653
|
try {
|
|
4627
|
-
const stat =
|
|
4654
|
+
const stat = statSync3(filePath);
|
|
4628
4655
|
if (now - stat.mtimeMs > STALE_EXPORT_AGE_MS) {
|
|
4629
4656
|
unlinkSync3(filePath);
|
|
4630
4657
|
}
|
package/dist/bin/exe-forget.js
CHANGED
|
@@ -3250,7 +3250,7 @@ __export(shard_manager_exports, {
|
|
|
3250
3250
|
shardExists: () => shardExists
|
|
3251
3251
|
});
|
|
3252
3252
|
import path7 from "path";
|
|
3253
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
3253
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync2 } from "fs";
|
|
3254
3254
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3255
3255
|
function initShardManager(encryptionKey) {
|
|
3256
3256
|
_encryptionKey = encryptionKey;
|
|
@@ -3272,7 +3272,7 @@ function getShardClient(projectName) {
|
|
|
3272
3272
|
if (!_encryptionKey) {
|
|
3273
3273
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3274
3274
|
}
|
|
3275
|
-
const safeName = projectName
|
|
3275
|
+
const safeName = safeShardName(projectName);
|
|
3276
3276
|
if (!safeName || safeName === "unknown") {
|
|
3277
3277
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3278
3278
|
}
|
|
@@ -3294,9 +3294,12 @@ function getShardClient(projectName) {
|
|
|
3294
3294
|
return client;
|
|
3295
3295
|
}
|
|
3296
3296
|
function shardExists(projectName) {
|
|
3297
|
-
const safeName = projectName
|
|
3297
|
+
const safeName = safeShardName(projectName);
|
|
3298
3298
|
return existsSync7(path7.join(SHARDS_DIR, `${safeName}.db`));
|
|
3299
3299
|
}
|
|
3300
|
+
function safeShardName(projectName) {
|
|
3301
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3302
|
+
}
|
|
3300
3303
|
function listShards() {
|
|
3301
3304
|
if (!existsSync7(SHARDS_DIR)) return [];
|
|
3302
3305
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -3390,7 +3393,8 @@ async function ensureShardSchema(client) {
|
|
|
3390
3393
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
3391
3394
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
3392
3395
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
3393
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
3396
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
3397
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
3394
3398
|
]) {
|
|
3395
3399
|
try {
|
|
3396
3400
|
await client.execute(col);
|
|
@@ -3486,9 +3490,32 @@ async function ensureShardSchema(client) {
|
|
|
3486
3490
|
}
|
|
3487
3491
|
}
|
|
3488
3492
|
async function getReadyShardClient(projectName) {
|
|
3489
|
-
const
|
|
3490
|
-
|
|
3491
|
-
|
|
3493
|
+
const safeName = safeShardName(projectName);
|
|
3494
|
+
let client = getShardClient(projectName);
|
|
3495
|
+
try {
|
|
3496
|
+
await ensureShardSchema(client);
|
|
3497
|
+
return client;
|
|
3498
|
+
} catch (err) {
|
|
3499
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3500
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
3501
|
+
client.close();
|
|
3502
|
+
_shards.delete(safeName);
|
|
3503
|
+
_shardLastAccess.delete(safeName);
|
|
3504
|
+
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3505
|
+
if (existsSync7(dbPath)) {
|
|
3506
|
+
const stat = statSync2(dbPath);
|
|
3507
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3508
|
+
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3509
|
+
renameSync3(dbPath, archivedPath);
|
|
3510
|
+
process.stderr.write(
|
|
3511
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
3512
|
+
`
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3515
|
+
client = getShardClient(projectName);
|
|
3516
|
+
await ensureShardSchema(client);
|
|
3517
|
+
return client;
|
|
3518
|
+
}
|
|
3492
3519
|
}
|
|
3493
3520
|
function evictLRU() {
|
|
3494
3521
|
let oldest = null;
|
|
@@ -3709,7 +3736,7 @@ var init_platform_procedures = __esm({
|
|
|
3709
3736
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
3710
3737
|
domain: "tool-use",
|
|
3711
3738
|
priority: "p1",
|
|
3712
|
-
content: "
|
|
3739
|
+
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."
|
|
3713
3740
|
},
|
|
3714
3741
|
{
|
|
3715
3742
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -3727,7 +3754,7 @@ var init_platform_procedures = __esm({
|
|
|
3727
3754
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3728
3755
|
domain: "tool-use",
|
|
3729
3756
|
priority: "p1",
|
|
3730
|
-
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
|
|
3757
|
+
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."
|
|
3731
3758
|
}
|
|
3732
3759
|
];
|
|
3733
3760
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
package/dist/bin/exe-gateway.js
CHANGED
|
@@ -906,7 +906,8 @@ function isMultiInstance(agentName, employees) {
|
|
|
906
906
|
return MULTI_INSTANCE_ROLES.has(emp.role.toLowerCase());
|
|
907
907
|
}
|
|
908
908
|
function addEmployee(employees, employee) {
|
|
909
|
-
const
|
|
909
|
+
const { systemPrompt: _legacyPrompt, ...rest } = employee;
|
|
910
|
+
const normalized = { ...rest, name: employee.name.toLowerCase() };
|
|
910
911
|
if (employees.some((e) => e.name.toLowerCase() === normalized.name)) {
|
|
911
912
|
throw new Error(`Employee '${normalized.name}' already exists`);
|
|
912
913
|
}
|
|
@@ -3908,7 +3909,7 @@ __export(shard_manager_exports, {
|
|
|
3908
3909
|
shardExists: () => shardExists
|
|
3909
3910
|
});
|
|
3910
3911
|
import path9 from "path";
|
|
3911
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
3912
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync2 } from "fs";
|
|
3912
3913
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3913
3914
|
function initShardManager(encryptionKey) {
|
|
3914
3915
|
_encryptionKey = encryptionKey;
|
|
@@ -3930,7 +3931,7 @@ function getShardClient(projectName) {
|
|
|
3930
3931
|
if (!_encryptionKey) {
|
|
3931
3932
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3932
3933
|
}
|
|
3933
|
-
const safeName = projectName
|
|
3934
|
+
const safeName = safeShardName(projectName);
|
|
3934
3935
|
if (!safeName || safeName === "unknown") {
|
|
3935
3936
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3936
3937
|
}
|
|
@@ -3952,9 +3953,12 @@ function getShardClient(projectName) {
|
|
|
3952
3953
|
return client;
|
|
3953
3954
|
}
|
|
3954
3955
|
function shardExists(projectName) {
|
|
3955
|
-
const safeName = projectName
|
|
3956
|
+
const safeName = safeShardName(projectName);
|
|
3956
3957
|
return existsSync8(path9.join(SHARDS_DIR, `${safeName}.db`));
|
|
3957
3958
|
}
|
|
3959
|
+
function safeShardName(projectName) {
|
|
3960
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3961
|
+
}
|
|
3958
3962
|
function listShards() {
|
|
3959
3963
|
if (!existsSync8(SHARDS_DIR)) return [];
|
|
3960
3964
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -4048,7 +4052,8 @@ async function ensureShardSchema(client) {
|
|
|
4048
4052
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
4049
4053
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
4050
4054
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
4051
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
4055
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
4056
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
4052
4057
|
]) {
|
|
4053
4058
|
try {
|
|
4054
4059
|
await client.execute(col);
|
|
@@ -4144,9 +4149,32 @@ async function ensureShardSchema(client) {
|
|
|
4144
4149
|
}
|
|
4145
4150
|
}
|
|
4146
4151
|
async function getReadyShardClient(projectName) {
|
|
4147
|
-
const
|
|
4148
|
-
|
|
4149
|
-
|
|
4152
|
+
const safeName = safeShardName(projectName);
|
|
4153
|
+
let client = getShardClient(projectName);
|
|
4154
|
+
try {
|
|
4155
|
+
await ensureShardSchema(client);
|
|
4156
|
+
return client;
|
|
4157
|
+
} catch (err) {
|
|
4158
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
4159
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
4160
|
+
client.close();
|
|
4161
|
+
_shards.delete(safeName);
|
|
4162
|
+
_shardLastAccess.delete(safeName);
|
|
4163
|
+
const dbPath = path9.join(SHARDS_DIR, `${safeName}.db`);
|
|
4164
|
+
if (existsSync8(dbPath)) {
|
|
4165
|
+
const stat = statSync2(dbPath);
|
|
4166
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
4167
|
+
const archivedPath = path9.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
4168
|
+
renameSync3(dbPath, archivedPath);
|
|
4169
|
+
process.stderr.write(
|
|
4170
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
4171
|
+
`
|
|
4172
|
+
);
|
|
4173
|
+
}
|
|
4174
|
+
client = getShardClient(projectName);
|
|
4175
|
+
await ensureShardSchema(client);
|
|
4176
|
+
return client;
|
|
4177
|
+
}
|
|
4150
4178
|
}
|
|
4151
4179
|
function evictLRU() {
|
|
4152
4180
|
let oldest = null;
|
|
@@ -4367,7 +4395,7 @@ var init_platform_procedures = __esm({
|
|
|
4367
4395
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
4368
4396
|
domain: "tool-use",
|
|
4369
4397
|
priority: "p1",
|
|
4370
|
-
content: "
|
|
4398
|
+
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."
|
|
4371
4399
|
},
|
|
4372
4400
|
{
|
|
4373
4401
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -4385,7 +4413,7 @@ var init_platform_procedures = __esm({
|
|
|
4385
4413
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
4386
4414
|
domain: "tool-use",
|
|
4387
4415
|
priority: "p1",
|
|
4388
|
-
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
|
|
4416
|
+
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."
|
|
4389
4417
|
}
|
|
4390
4418
|
];
|
|
4391
4419
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -6394,8 +6422,8 @@ async function validateLicense(apiKey, deviceId) {
|
|
|
6394
6422
|
}
|
|
6395
6423
|
function getCacheAgeMs() {
|
|
6396
6424
|
try {
|
|
6397
|
-
const { statSync:
|
|
6398
|
-
const s =
|
|
6425
|
+
const { statSync: statSync3 } = __require("fs");
|
|
6426
|
+
const s = statSync3(CACHE_PATH);
|
|
6399
6427
|
return Date.now() - s.mtimeMs;
|
|
6400
6428
|
} catch {
|
|
6401
6429
|
return Infinity;
|
|
@@ -6609,6 +6637,24 @@ import { randomUUID as randomUUID4 } from "crypto";
|
|
|
6609
6637
|
import { homedir } from "os";
|
|
6610
6638
|
import { join } from "path";
|
|
6611
6639
|
import { mkdirSync as mkdirSync4 } from "fs";
|
|
6640
|
+
function createBaileysLogger(accountName) {
|
|
6641
|
+
const prefix = accountName ? `[whatsapp:${accountName}]` : "[whatsapp]";
|
|
6642
|
+
let logger;
|
|
6643
|
+
logger = {
|
|
6644
|
+
level: "warn",
|
|
6645
|
+
trace: () => {
|
|
6646
|
+
},
|
|
6647
|
+
debug: () => {
|
|
6648
|
+
},
|
|
6649
|
+
info: () => {
|
|
6650
|
+
},
|
|
6651
|
+
warn: (...args) => console.warn(prefix, ...args),
|
|
6652
|
+
error: (...args) => console.error(prefix, ...args),
|
|
6653
|
+
fatal: (...args) => console.error(prefix, ...args),
|
|
6654
|
+
child: () => logger
|
|
6655
|
+
};
|
|
6656
|
+
return logger;
|
|
6657
|
+
}
|
|
6612
6658
|
function calculateBackoff(retryCount) {
|
|
6613
6659
|
const base = Math.min(
|
|
6614
6660
|
INITIAL_BACKOFF_MS * BACKOFF_MULTIPLIER ** retryCount,
|
|
@@ -6633,6 +6679,7 @@ var init_whatsapp = __esm({
|
|
|
6633
6679
|
connected = false;
|
|
6634
6680
|
abortController = null;
|
|
6635
6681
|
authDir = AUTH_DIR;
|
|
6682
|
+
baileysLogger = createBaileysLogger();
|
|
6636
6683
|
// Resilience state
|
|
6637
6684
|
retryCount = 0;
|
|
6638
6685
|
disconnectedAt = 0;
|
|
@@ -6643,6 +6690,7 @@ var init_whatsapp = __esm({
|
|
|
6643
6690
|
const { makeWASocket, useMultiFileAuthState, fetchLatestBaileysVersion, DisconnectReason, makeCacheableSignalKeyStore } = baileys;
|
|
6644
6691
|
const { state, saveCreds } = await useMultiFileAuthState(this.authDir);
|
|
6645
6692
|
const { version } = await fetchLatestBaileysVersion();
|
|
6693
|
+
this.baileysLogger = createBaileysLogger();
|
|
6646
6694
|
this.abortController = new AbortController();
|
|
6647
6695
|
let agent;
|
|
6648
6696
|
const socksProxy = config2.credentials.socksProxy;
|
|
@@ -6661,8 +6709,9 @@ var init_whatsapp = __esm({
|
|
|
6661
6709
|
const sock = makeWASocket({
|
|
6662
6710
|
auth: {
|
|
6663
6711
|
creds: state.creds,
|
|
6664
|
-
keys: makeCacheableSignalKeyStore(state.keys,
|
|
6712
|
+
keys: makeCacheableSignalKeyStore(state.keys, this.baileysLogger)
|
|
6665
6713
|
},
|
|
6714
|
+
logger: this.baileysLogger,
|
|
6666
6715
|
version,
|
|
6667
6716
|
printQRInTerminal: true,
|
|
6668
6717
|
browser: ["exe-os", "cli", "1.0"],
|
|
@@ -8597,7 +8646,7 @@ __export(intercom_queue_exports, {
|
|
|
8597
8646
|
queueIntercom: () => queueIntercom,
|
|
8598
8647
|
readQueue: () => readQueue
|
|
8599
8648
|
});
|
|
8600
|
-
import { readFileSync as readFileSync9, writeFileSync as writeFileSync6, renameSync as
|
|
8649
|
+
import { readFileSync as readFileSync9, writeFileSync as writeFileSync6, renameSync as renameSync4, existsSync as existsSync11, mkdirSync as mkdirSync6 } from "fs";
|
|
8601
8650
|
import path13 from "path";
|
|
8602
8651
|
import os10 from "os";
|
|
8603
8652
|
function ensureDir() {
|
|
@@ -8616,7 +8665,7 @@ function writeQueue(queue) {
|
|
|
8616
8665
|
ensureDir();
|
|
8617
8666
|
const tmp = `${QUEUE_PATH}.tmp`;
|
|
8618
8667
|
writeFileSync6(tmp, JSON.stringify(queue, null, 2));
|
|
8619
|
-
|
|
8668
|
+
renameSync4(tmp, QUEUE_PATH);
|
|
8620
8669
|
}
|
|
8621
8670
|
function queueIntercom(targetSession, reason) {
|
|
8622
8671
|
const queue = readQueue();
|
|
@@ -3280,7 +3280,7 @@ __export(shard_manager_exports, {
|
|
|
3280
3280
|
shardExists: () => shardExists
|
|
3281
3281
|
});
|
|
3282
3282
|
import path7 from "path";
|
|
3283
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
3283
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync2 } from "fs";
|
|
3284
3284
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3285
3285
|
function initShardManager(encryptionKey) {
|
|
3286
3286
|
_encryptionKey = encryptionKey;
|
|
@@ -3302,7 +3302,7 @@ function getShardClient(projectName) {
|
|
|
3302
3302
|
if (!_encryptionKey) {
|
|
3303
3303
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3304
3304
|
}
|
|
3305
|
-
const safeName = projectName
|
|
3305
|
+
const safeName = safeShardName(projectName);
|
|
3306
3306
|
if (!safeName || safeName === "unknown") {
|
|
3307
3307
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3308
3308
|
}
|
|
@@ -3324,9 +3324,12 @@ function getShardClient(projectName) {
|
|
|
3324
3324
|
return client;
|
|
3325
3325
|
}
|
|
3326
3326
|
function shardExists(projectName) {
|
|
3327
|
-
const safeName = projectName
|
|
3327
|
+
const safeName = safeShardName(projectName);
|
|
3328
3328
|
return existsSync7(path7.join(SHARDS_DIR, `${safeName}.db`));
|
|
3329
3329
|
}
|
|
3330
|
+
function safeShardName(projectName) {
|
|
3331
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3332
|
+
}
|
|
3330
3333
|
function listShards() {
|
|
3331
3334
|
if (!existsSync7(SHARDS_DIR)) return [];
|
|
3332
3335
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -3420,7 +3423,8 @@ async function ensureShardSchema(client) {
|
|
|
3420
3423
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
3421
3424
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
3422
3425
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
3423
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
3426
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
3427
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
3424
3428
|
]) {
|
|
3425
3429
|
try {
|
|
3426
3430
|
await client.execute(col);
|
|
@@ -3516,9 +3520,32 @@ async function ensureShardSchema(client) {
|
|
|
3516
3520
|
}
|
|
3517
3521
|
}
|
|
3518
3522
|
async function getReadyShardClient(projectName) {
|
|
3519
|
-
const
|
|
3520
|
-
|
|
3521
|
-
|
|
3523
|
+
const safeName = safeShardName(projectName);
|
|
3524
|
+
let client = getShardClient(projectName);
|
|
3525
|
+
try {
|
|
3526
|
+
await ensureShardSchema(client);
|
|
3527
|
+
return client;
|
|
3528
|
+
} catch (err) {
|
|
3529
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3530
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
3531
|
+
client.close();
|
|
3532
|
+
_shards.delete(safeName);
|
|
3533
|
+
_shardLastAccess.delete(safeName);
|
|
3534
|
+
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3535
|
+
if (existsSync7(dbPath)) {
|
|
3536
|
+
const stat = statSync2(dbPath);
|
|
3537
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3538
|
+
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3539
|
+
renameSync3(dbPath, archivedPath);
|
|
3540
|
+
process.stderr.write(
|
|
3541
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
3542
|
+
`
|
|
3543
|
+
);
|
|
3544
|
+
}
|
|
3545
|
+
client = getShardClient(projectName);
|
|
3546
|
+
await ensureShardSchema(client);
|
|
3547
|
+
return client;
|
|
3548
|
+
}
|
|
3522
3549
|
}
|
|
3523
3550
|
function evictLRU() {
|
|
3524
3551
|
let oldest = null;
|
|
@@ -3739,7 +3766,7 @@ var init_platform_procedures = __esm({
|
|
|
3739
3766
|
title: "MCP tools \u2014 wiki, documents, and content",
|
|
3740
3767
|
domain: "tool-use",
|
|
3741
3768
|
priority: "p1",
|
|
3742
|
-
content: "
|
|
3769
|
+
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."
|
|
3743
3770
|
},
|
|
3744
3771
|
{
|
|
3745
3772
|
title: "MCP tools \u2014 system, operations, and admin",
|
|
@@ -3757,7 +3784,7 @@ var init_platform_procedures = __esm({
|
|
|
3757
3784
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3758
3785
|
domain: "tool-use",
|
|
3759
3786
|
priority: "p1",
|
|
3760
|
-
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
|
|
3787
|
+
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."
|
|
3761
3788
|
}
|
|
3762
3789
|
];
|
|
3763
3790
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -4721,7 +4748,7 @@ var init_agent_config = __esm({
|
|
|
4721
4748
|
});
|
|
4722
4749
|
|
|
4723
4750
|
// src/lib/intercom-queue.ts
|
|
4724
|
-
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, renameSync as
|
|
4751
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, renameSync as renameSync4, existsSync as existsSync9, mkdirSync as mkdirSync3 } from "fs";
|
|
4725
4752
|
import path10 from "path";
|
|
4726
4753
|
import os7 from "os";
|
|
4727
4754
|
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|