@askexenow/exe-os 0.9.60 → 0.9.61
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/dist/bin/backfill-conversations.js +72 -5
- package/dist/bin/backfill-responses.js +72 -5
- package/dist/bin/backfill-vectors.js +72 -5
- package/dist/bin/cc-doctor.js +376 -0
- package/dist/bin/cleanup-stale-review-tasks.js +72 -5
- package/dist/bin/cli.js +157 -55
- package/dist/bin/customer-readiness.js +33 -0
- package/dist/bin/exe-agent.js +1 -1
- package/dist/bin/exe-assign.js +72 -5
- package/dist/bin/exe-boot.js +78 -11
- package/dist/bin/exe-call.js +1 -1
- package/dist/bin/exe-dispatch.js +72 -5
- package/dist/bin/exe-doctor.js +72 -5
- package/dist/bin/exe-export-behaviors.js +72 -5
- package/dist/bin/exe-forget.js +72 -5
- package/dist/bin/exe-gateway.js +72 -5
- package/dist/bin/exe-heartbeat.js +72 -5
- package/dist/bin/exe-kill.js +72 -5
- package/dist/bin/exe-launch-agent.js +72 -5
- package/dist/bin/exe-link.js +74 -7
- package/dist/bin/exe-new-employee.js +48 -19
- package/dist/bin/exe-pending-messages.js +72 -5
- package/dist/bin/exe-pending-notifications.js +72 -5
- package/dist/bin/exe-pending-reviews.js +72 -5
- package/dist/bin/exe-rename.js +72 -5
- package/dist/bin/exe-review.js +72 -5
- package/dist/bin/exe-search.js +72 -5
- package/dist/bin/exe-session-cleanup.js +72 -5
- package/dist/bin/exe-start-codex.js +115 -18
- package/dist/bin/exe-start-opencode.js +93 -7
- package/dist/bin/exe-status.js +72 -5
- package/dist/bin/exe-team.js +72 -5
- package/dist/bin/git-sweep.js +72 -5
- package/dist/bin/graph-backfill.js +72 -5
- package/dist/bin/graph-export.js +72 -5
- package/dist/bin/install.js +56 -31
- package/dist/bin/intercom-check.js +72 -5
- package/dist/bin/pre-build-guard.js +98 -0
- package/dist/bin/scan-tasks.js +72 -5
- package/dist/bin/setup.js +75 -8
- package/dist/bin/shard-migrate.js +72 -5
- package/dist/gateway/index.js +78 -11
- package/dist/hooks/bug-report-worker.js +72 -5
- package/dist/hooks/codex-stop-task-finalizer.js +72 -5
- package/dist/hooks/commit-complete.js +72 -5
- package/dist/hooks/error-recall.js +72 -5
- package/dist/hooks/ingest.js +72 -5
- package/dist/hooks/instructions-loaded.js +72 -5
- package/dist/hooks/notification.js +72 -5
- package/dist/hooks/post-compact.js +72 -5
- package/dist/hooks/post-tool-combined.js +72 -5
- package/dist/hooks/pre-compact.js +72 -5
- package/dist/hooks/pre-tool-use.js +72 -5
- package/dist/hooks/prompt-submit.js +72 -5
- package/dist/hooks/session-end.js +72 -5
- package/dist/hooks/session-start.js +72 -5
- package/dist/hooks/stop.js +72 -5
- package/dist/hooks/subagent-stop.js +72 -5
- package/dist/hooks/summary-worker.js +78 -11
- package/dist/index.js +78 -11
- package/dist/lib/cloud-sync.js +74 -7
- package/dist/lib/database.js +68 -1
- package/dist/lib/db.js +68 -1
- package/dist/lib/device-registry.js +68 -1
- package/dist/lib/employee-templates.js +1 -1
- package/dist/lib/exe-daemon.js +103 -26
- package/dist/lib/hybrid-search.js +72 -5
- package/dist/lib/schedules.js +72 -5
- package/dist/lib/store.js +72 -5
- package/dist/mcp/server.js +103 -26
- package/dist/runtime/index.js +72 -5
- package/dist/tui/App.js +80 -13
- package/package.json +1 -1
package/dist/lib/store.js
CHANGED
|
@@ -2288,7 +2288,7 @@ async function ensureSchema() {
|
|
|
2288
2288
|
ON session_kills(agent_id);
|
|
2289
2289
|
`);
|
|
2290
2290
|
await client.execute(`
|
|
2291
|
-
CREATE TABLE IF NOT EXISTS
|
|
2291
|
+
CREATE TABLE IF NOT EXISTS company_procedures (
|
|
2292
2292
|
id TEXT PRIMARY KEY,
|
|
2293
2293
|
title TEXT NOT NULL,
|
|
2294
2294
|
content TEXT NOT NULL,
|
|
@@ -2299,6 +2299,73 @@ async function ensureSchema() {
|
|
|
2299
2299
|
updated_at TEXT NOT NULL
|
|
2300
2300
|
)
|
|
2301
2301
|
`);
|
|
2302
|
+
const legacyProcedureObject = await client.execute({
|
|
2303
|
+
sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
|
|
2304
|
+
args: []
|
|
2305
|
+
});
|
|
2306
|
+
const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
|
|
2307
|
+
if (legacyProcedureType === "table") {
|
|
2308
|
+
await client.execute(`
|
|
2309
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2310
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2311
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2312
|
+
FROM global_procedures
|
|
2313
|
+
`);
|
|
2314
|
+
await client.executeMultiple(`
|
|
2315
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
|
|
2316
|
+
AFTER INSERT ON global_procedures
|
|
2317
|
+
BEGIN
|
|
2318
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2319
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2320
|
+
VALUES
|
|
2321
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2322
|
+
END;
|
|
2323
|
+
|
|
2324
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
|
|
2325
|
+
AFTER UPDATE ON global_procedures
|
|
2326
|
+
BEGIN
|
|
2327
|
+
UPDATE company_procedures
|
|
2328
|
+
SET title = NEW.title,
|
|
2329
|
+
content = NEW.content,
|
|
2330
|
+
priority = NEW.priority,
|
|
2331
|
+
domain = NEW.domain,
|
|
2332
|
+
active = NEW.active,
|
|
2333
|
+
created_at = NEW.created_at,
|
|
2334
|
+
updated_at = NEW.updated_at
|
|
2335
|
+
WHERE id = OLD.id;
|
|
2336
|
+
END;
|
|
2337
|
+
`);
|
|
2338
|
+
} else {
|
|
2339
|
+
await client.execute(`
|
|
2340
|
+
CREATE VIEW IF NOT EXISTS global_procedures AS
|
|
2341
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2342
|
+
FROM company_procedures
|
|
2343
|
+
`);
|
|
2344
|
+
await client.executeMultiple(`
|
|
2345
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_insert
|
|
2346
|
+
INSTEAD OF INSERT ON global_procedures
|
|
2347
|
+
BEGIN
|
|
2348
|
+
INSERT INTO company_procedures
|
|
2349
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2350
|
+
VALUES
|
|
2351
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2352
|
+
END;
|
|
2353
|
+
|
|
2354
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_update
|
|
2355
|
+
INSTEAD OF UPDATE ON global_procedures
|
|
2356
|
+
BEGIN
|
|
2357
|
+
UPDATE company_procedures
|
|
2358
|
+
SET title = NEW.title,
|
|
2359
|
+
content = NEW.content,
|
|
2360
|
+
priority = NEW.priority,
|
|
2361
|
+
domain = NEW.domain,
|
|
2362
|
+
active = NEW.active,
|
|
2363
|
+
created_at = NEW.created_at,
|
|
2364
|
+
updated_at = NEW.updated_at
|
|
2365
|
+
WHERE id = OLD.id;
|
|
2366
|
+
END;
|
|
2367
|
+
`);
|
|
2368
|
+
}
|
|
2302
2369
|
await client.executeMultiple(`
|
|
2303
2370
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
2304
2371
|
id TEXT PRIMARY KEY,
|
|
@@ -3175,7 +3242,7 @@ var init_platform_procedures = __esm({
|
|
|
3175
3242
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3176
3243
|
domain: "tool-use",
|
|
3177
3244
|
priority: "p1",
|
|
3178
|
-
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.
|
|
3245
|
+
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. company_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: global_procedure, store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
3179
3246
|
}
|
|
3180
3247
|
];
|
|
3181
3248
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -3196,7 +3263,7 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
3196
3263
|
async function loadGlobalProcedures() {
|
|
3197
3264
|
const client = getClient();
|
|
3198
3265
|
const result = await client.execute({
|
|
3199
|
-
sql: "SELECT * FROM
|
|
3266
|
+
sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
3200
3267
|
args: []
|
|
3201
3268
|
});
|
|
3202
3269
|
const allRows = result.rows;
|
|
@@ -3225,7 +3292,7 @@ async function storeGlobalProcedure(input) {
|
|
|
3225
3292
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3226
3293
|
const client = getClient();
|
|
3227
3294
|
await client.execute({
|
|
3228
|
-
sql: `INSERT INTO
|
|
3295
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
3229
3296
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
3230
3297
|
args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
|
|
3231
3298
|
});
|
|
@@ -3236,7 +3303,7 @@ async function deactivateGlobalProcedure(id) {
|
|
|
3236
3303
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3237
3304
|
const client = getClient();
|
|
3238
3305
|
const result = await client.execute({
|
|
3239
|
-
sql: "UPDATE
|
|
3306
|
+
sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
3240
3307
|
args: [now, id]
|
|
3241
3308
|
});
|
|
3242
3309
|
await loadGlobalProcedures();
|
package/dist/mcp/server.js
CHANGED
|
@@ -2937,7 +2937,7 @@ async function ensureSchema() {
|
|
|
2937
2937
|
ON session_kills(agent_id);
|
|
2938
2938
|
`);
|
|
2939
2939
|
await client.execute(`
|
|
2940
|
-
CREATE TABLE IF NOT EXISTS
|
|
2940
|
+
CREATE TABLE IF NOT EXISTS company_procedures (
|
|
2941
2941
|
id TEXT PRIMARY KEY,
|
|
2942
2942
|
title TEXT NOT NULL,
|
|
2943
2943
|
content TEXT NOT NULL,
|
|
@@ -2948,6 +2948,73 @@ async function ensureSchema() {
|
|
|
2948
2948
|
updated_at TEXT NOT NULL
|
|
2949
2949
|
)
|
|
2950
2950
|
`);
|
|
2951
|
+
const legacyProcedureObject = await client.execute({
|
|
2952
|
+
sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
|
|
2953
|
+
args: []
|
|
2954
|
+
});
|
|
2955
|
+
const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
|
|
2956
|
+
if (legacyProcedureType === "table") {
|
|
2957
|
+
await client.execute(`
|
|
2958
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2959
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2960
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2961
|
+
FROM global_procedures
|
|
2962
|
+
`);
|
|
2963
|
+
await client.executeMultiple(`
|
|
2964
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
|
|
2965
|
+
AFTER INSERT ON global_procedures
|
|
2966
|
+
BEGIN
|
|
2967
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2968
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2969
|
+
VALUES
|
|
2970
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2971
|
+
END;
|
|
2972
|
+
|
|
2973
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
|
|
2974
|
+
AFTER UPDATE ON global_procedures
|
|
2975
|
+
BEGIN
|
|
2976
|
+
UPDATE company_procedures
|
|
2977
|
+
SET title = NEW.title,
|
|
2978
|
+
content = NEW.content,
|
|
2979
|
+
priority = NEW.priority,
|
|
2980
|
+
domain = NEW.domain,
|
|
2981
|
+
active = NEW.active,
|
|
2982
|
+
created_at = NEW.created_at,
|
|
2983
|
+
updated_at = NEW.updated_at
|
|
2984
|
+
WHERE id = OLD.id;
|
|
2985
|
+
END;
|
|
2986
|
+
`);
|
|
2987
|
+
} else {
|
|
2988
|
+
await client.execute(`
|
|
2989
|
+
CREATE VIEW IF NOT EXISTS global_procedures AS
|
|
2990
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2991
|
+
FROM company_procedures
|
|
2992
|
+
`);
|
|
2993
|
+
await client.executeMultiple(`
|
|
2994
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_insert
|
|
2995
|
+
INSTEAD OF INSERT ON global_procedures
|
|
2996
|
+
BEGIN
|
|
2997
|
+
INSERT INTO company_procedures
|
|
2998
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2999
|
+
VALUES
|
|
3000
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
3001
|
+
END;
|
|
3002
|
+
|
|
3003
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_update
|
|
3004
|
+
INSTEAD OF UPDATE ON global_procedures
|
|
3005
|
+
BEGIN
|
|
3006
|
+
UPDATE company_procedures
|
|
3007
|
+
SET title = NEW.title,
|
|
3008
|
+
content = NEW.content,
|
|
3009
|
+
priority = NEW.priority,
|
|
3010
|
+
domain = NEW.domain,
|
|
3011
|
+
active = NEW.active,
|
|
3012
|
+
created_at = NEW.created_at,
|
|
3013
|
+
updated_at = NEW.updated_at
|
|
3014
|
+
WHERE id = OLD.id;
|
|
3015
|
+
END;
|
|
3016
|
+
`);
|
|
3017
|
+
}
|
|
2951
3018
|
await client.executeMultiple(`
|
|
2952
3019
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
2953
3020
|
id TEXT PRIMARY KEY,
|
|
@@ -4394,7 +4461,7 @@ var init_platform_procedures = __esm({
|
|
|
4394
4461
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
4395
4462
|
domain: "tool-use",
|
|
4396
4463
|
priority: "p1",
|
|
4397
|
-
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.
|
|
4464
|
+
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. company_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: global_procedure, store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
4398
4465
|
}
|
|
4399
4466
|
];
|
|
4400
4467
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -4415,7 +4482,7 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
4415
4482
|
async function loadGlobalProcedures() {
|
|
4416
4483
|
const client = getClient();
|
|
4417
4484
|
const result = await client.execute({
|
|
4418
|
-
sql: "SELECT * FROM
|
|
4485
|
+
sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
4419
4486
|
args: []
|
|
4420
4487
|
});
|
|
4421
4488
|
const allRows = result.rows;
|
|
@@ -4444,7 +4511,7 @@ async function storeGlobalProcedure(input) {
|
|
|
4444
4511
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4445
4512
|
const client = getClient();
|
|
4446
4513
|
await client.execute({
|
|
4447
|
-
sql: `INSERT INTO
|
|
4514
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
4448
4515
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
4449
4516
|
args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
|
|
4450
4517
|
});
|
|
@@ -4455,7 +4522,7 @@ async function deactivateGlobalProcedure(id) {
|
|
|
4455
4522
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4456
4523
|
const client = getClient();
|
|
4457
4524
|
const result = await client.execute({
|
|
4458
|
-
sql: "UPDATE
|
|
4525
|
+
sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
4459
4526
|
args: [now, id]
|
|
4460
4527
|
});
|
|
4461
4528
|
await loadGlobalProcedures();
|
|
@@ -19860,12 +19927,12 @@ async function cloudSync(config2) {
|
|
|
19860
19927
|
try {
|
|
19861
19928
|
await cloudPushGlobalProcedures(config2);
|
|
19862
19929
|
} catch (err) {
|
|
19863
|
-
logError(`[cloud-sync]
|
|
19930
|
+
logError(`[cloud-sync] Company procedures push: ${err instanceof Error ? err.message : String(err)}`);
|
|
19864
19931
|
}
|
|
19865
19932
|
try {
|
|
19866
19933
|
await cloudPullGlobalProcedures(config2);
|
|
19867
19934
|
} catch (err) {
|
|
19868
|
-
logError(`[cloud-sync]
|
|
19935
|
+
logError(`[cloud-sync] Company procedures pull: ${err instanceof Error ? err.message : String(err)}`);
|
|
19869
19936
|
}
|
|
19870
19937
|
const countRows = async (sql) => {
|
|
19871
19938
|
try {
|
|
@@ -20264,12 +20331,12 @@ async function cloudPullBlob(route, config2) {
|
|
|
20264
20331
|
}
|
|
20265
20332
|
async function cloudPushGlobalProcedures(config2) {
|
|
20266
20333
|
const client = getClient();
|
|
20267
|
-
const result = await client.execute("SELECT * FROM
|
|
20334
|
+
const result = await client.execute("SELECT * FROM company_procedures LIMIT 1000");
|
|
20268
20335
|
const rows = result.rows;
|
|
20269
20336
|
const { ok } = await cloudPushBlob(
|
|
20270
20337
|
"/sync/push-global-procedures",
|
|
20271
20338
|
rows,
|
|
20272
|
-
"
|
|
20339
|
+
"last_company_procedures_push_version",
|
|
20273
20340
|
config2
|
|
20274
20341
|
);
|
|
20275
20342
|
return ok;
|
|
@@ -20282,7 +20349,7 @@ async function cloudPullGlobalProcedures(config2) {
|
|
|
20282
20349
|
if (!remoteProcs || remoteProcs.length === 0) return { pulled: 0 };
|
|
20283
20350
|
const client = getClient();
|
|
20284
20351
|
const stmts = remoteProcs.map((p) => ({
|
|
20285
|
-
sql: `INSERT INTO
|
|
20352
|
+
sql: `INSERT INTO company_procedures
|
|
20286
20353
|
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
20287
20354
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
20288
20355
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -20292,7 +20359,7 @@ async function cloudPullGlobalProcedures(config2) {
|
|
|
20292
20359
|
domain = excluded.domain,
|
|
20293
20360
|
active = excluded.active,
|
|
20294
20361
|
updated_at = excluded.updated_at
|
|
20295
|
-
WHERE excluded.updated_at >
|
|
20362
|
+
WHERE excluded.updated_at > company_procedures.updated_at`,
|
|
20296
20363
|
args: [
|
|
20297
20364
|
sqlSafe(p.id),
|
|
20298
20365
|
sqlSafe(p.title),
|
|
@@ -22935,7 +23002,7 @@ async function insertProcedures(procedures, timestamp, options) {
|
|
|
22935
23002
|
continue;
|
|
22936
23003
|
}
|
|
22937
23004
|
await client.execute({
|
|
22938
|
-
sql: `INSERT INTO
|
|
23005
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
22939
23006
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
22940
23007
|
args: [
|
|
22941
23008
|
randomUUID8(),
|
|
@@ -23017,7 +23084,7 @@ async function importIdentities(identities, updatedBy) {
|
|
|
23017
23084
|
async function getActiveProcedureTitles() {
|
|
23018
23085
|
const client = getClient();
|
|
23019
23086
|
const result = await client.execute({
|
|
23020
|
-
sql: "SELECT title FROM
|
|
23087
|
+
sql: "SELECT title FROM company_procedures WHERE active = 1",
|
|
23021
23088
|
args: []
|
|
23022
23089
|
});
|
|
23023
23090
|
return new Set(result.rows.map((row) => String(row.title)));
|
|
@@ -23040,7 +23107,7 @@ async function exportOrchestration(createdBy) {
|
|
|
23040
23107
|
args: []
|
|
23041
23108
|
});
|
|
23042
23109
|
const procedureResult = await client.execute({
|
|
23043
|
-
sql: "SELECT title, content, priority, domain FROM
|
|
23110
|
+
sql: "SELECT title, content, priority, domain FROM company_procedures WHERE active = 1",
|
|
23044
23111
|
args: []
|
|
23045
23112
|
});
|
|
23046
23113
|
const behaviors = behaviorResult.rows.map((row) => ({
|
|
@@ -23237,9 +23304,9 @@ init_active_agent();
|
|
|
23237
23304
|
init_database();
|
|
23238
23305
|
init_employees();
|
|
23239
23306
|
import { z as z71 } from "zod";
|
|
23240
|
-
function
|
|
23307
|
+
function registerCompanyProcedureTool(server2, toolName) {
|
|
23241
23308
|
server2.registerTool(
|
|
23242
|
-
|
|
23309
|
+
toolName,
|
|
23243
23310
|
{
|
|
23244
23311
|
title: "Company Procedure",
|
|
23245
23312
|
description: "Manage company procedures (customer-owned Layer 0 rules) that supersede identity, expertise, and experience. Actions: store (create new, restricted), list (view all, open), deactivate (soft-delete, restricted).",
|
|
@@ -23249,7 +23316,7 @@ function registerGlobalProcedure(server2) {
|
|
|
23249
23316
|
content: z71.string().max(500).optional().describe("The procedure content \u2014 clear, actionable instruction (store)"),
|
|
23250
23317
|
priority: z71.enum(["p0", "p1", "p2"]).optional().describe("Priority tier. p0 = always (default). p1 = standard. p2 = nice-to-have."),
|
|
23251
23318
|
domain: z71.string().optional().describe("Category: workflow, code-style, communication, architecture, testing, security"),
|
|
23252
|
-
procedure_id: z71.string().optional().describe("UUID of the
|
|
23319
|
+
procedure_id: z71.string().optional().describe("UUID of the company procedure (deactivate)")
|
|
23253
23320
|
}
|
|
23254
23321
|
},
|
|
23255
23322
|
async ({ action, title, content, priority, domain, procedure_id }) => {
|
|
@@ -23260,7 +23327,7 @@ function registerGlobalProcedure(server2) {
|
|
|
23260
23327
|
content: [{
|
|
23261
23328
|
type: "text",
|
|
23262
23329
|
text: `No custom company procedures. ${PLATFORM_PROCEDURES.length} platform procedures are active (shipped with exe-os, not editable).
|
|
23263
|
-
Use
|
|
23330
|
+
Use company_procedure with action "store" to add company-specific rules.`
|
|
23264
23331
|
}]
|
|
23265
23332
|
};
|
|
23266
23333
|
}
|
|
@@ -23326,7 +23393,7 @@ Domain: ${domain ?? "none"}`
|
|
|
23326
23393
|
}
|
|
23327
23394
|
const client = getClient();
|
|
23328
23395
|
const result = await client.execute({
|
|
23329
|
-
sql: "SELECT id, title, content, priority, domain FROM
|
|
23396
|
+
sql: "SELECT id, title, content, priority, domain FROM company_procedures WHERE id = ?",
|
|
23330
23397
|
args: [procedure_id]
|
|
23331
23398
|
});
|
|
23332
23399
|
if (result.rows.length === 0) {
|
|
@@ -23344,7 +23411,7 @@ Domain: ${domain ?? "none"}`
|
|
|
23344
23411
|
return {
|
|
23345
23412
|
content: [{
|
|
23346
23413
|
type: "text",
|
|
23347
|
-
text: `
|
|
23414
|
+
text: `Company procedure ${procedure_id} was already inactive.`
|
|
23348
23415
|
}]
|
|
23349
23416
|
};
|
|
23350
23417
|
}
|
|
@@ -23362,6 +23429,12 @@ Content: ${row.content}`
|
|
|
23362
23429
|
}
|
|
23363
23430
|
);
|
|
23364
23431
|
}
|
|
23432
|
+
function registerCompanyProcedure(server2) {
|
|
23433
|
+
registerCompanyProcedureTool(server2, "company_procedure");
|
|
23434
|
+
}
|
|
23435
|
+
function registerGlobalProcedure(server2) {
|
|
23436
|
+
registerCompanyProcedureTool(server2, "global_procedure");
|
|
23437
|
+
}
|
|
23365
23438
|
|
|
23366
23439
|
// src/mcp/tools/config.ts
|
|
23367
23440
|
var ACTION_TO_TOOL2 = {
|
|
@@ -23388,6 +23461,7 @@ var ACTION_TO_TOOL2 = {
|
|
|
23388
23461
|
load_skill: "load_skill",
|
|
23389
23462
|
export_orchestration: "export_orchestration",
|
|
23390
23463
|
import_orchestration: "import_orchestration",
|
|
23464
|
+
company_procedure: "company_procedure",
|
|
23391
23465
|
global_procedure: "global_procedure"
|
|
23392
23466
|
};
|
|
23393
23467
|
function errorResult8(text3) {
|
|
@@ -23423,6 +23497,7 @@ function buildHandlers5() {
|
|
|
23423
23497
|
registerLoadSkill(localServer);
|
|
23424
23498
|
registerExportOrchestration(localServer);
|
|
23425
23499
|
registerImportOrchestration(localServer);
|
|
23500
|
+
registerCompanyProcedure(localServer);
|
|
23426
23501
|
registerGlobalProcedure(localServer);
|
|
23427
23502
|
return tools;
|
|
23428
23503
|
}
|
|
@@ -23463,7 +23538,7 @@ function registerConfig(server2) {
|
|
|
23463
23538
|
priority: z72.enum(["p0", "p1", "p2"]).optional().describe("Procedure priority"),
|
|
23464
23539
|
domain: z72.string().optional().describe("Procedure domain"),
|
|
23465
23540
|
procedure_id: z72.string().optional().describe("Procedure id for deactivate"),
|
|
23466
|
-
subaction: z72.enum(["store", "list", "deactivate"]).optional().describe("Nested action for global_procedure"),
|
|
23541
|
+
subaction: z72.enum(["store", "list", "deactivate"]).optional().describe("Nested action for company_procedure/global_procedure"),
|
|
23467
23542
|
max_clusters: z72.coerce.number().optional().describe("Consolidation max clusters"),
|
|
23468
23543
|
force: z72.boolean().optional().describe("Force operation where supported"),
|
|
23469
23544
|
domain_name: z72.string().optional().describe("Client deployment domain")
|
|
@@ -23471,14 +23546,14 @@ function registerConfig(server2) {
|
|
|
23471
23546
|
}, async (input, extra) => {
|
|
23472
23547
|
const action = input.action;
|
|
23473
23548
|
const { action: _action, subaction, ...args } = input;
|
|
23474
|
-
if (action === "global_procedure") {
|
|
23549
|
+
if (action === "company_procedure" || action === "global_procedure") {
|
|
23475
23550
|
args.action = subaction ?? "list";
|
|
23476
23551
|
}
|
|
23477
23552
|
if (action === "export_orchestration" && !args.output_path) return errorResult8('config action "export_orchestration" requires output_path');
|
|
23478
23553
|
if (action === "import_orchestration" && !args.input_path) return errorResult8('config action "import_orchestration" requires input_path');
|
|
23479
23554
|
if (action === "activate_license" && !args.license_key) return errorResult8('config action "activate_license" requires license_key');
|
|
23480
23555
|
if (action === "create_trigger" && (!args.name || !args.event || !Array.isArray(args.actions))) return errorResult8('config action "create_trigger" requires name, event, and actions');
|
|
23481
|
-
if (action === "global_procedure" && args.action === "store" && (!args.title || !args.content)) return errorResult8(
|
|
23556
|
+
if ((action === "company_procedure" || action === "global_procedure") && args.action === "store" && (!args.title || !args.content)) return errorResult8(`config action "${action}" subaction=store requires title and content`);
|
|
23482
23557
|
const toolName = ACTION_TO_TOOL2[action];
|
|
23483
23558
|
const tool = legacy.get(toolName);
|
|
23484
23559
|
if (!tool) return errorResult8(`Legacy config handler not found for action "${action}" (${toolName})`);
|
|
@@ -24181,7 +24256,7 @@ function registerDeactivateGlobalProcedure(server2) {
|
|
|
24181
24256
|
title: "Deactivate Company Procedure (use global_procedure instead)",
|
|
24182
24257
|
description: "DEPRECATED \u2014 use global_procedure with action='deactivate'. Soft-delete a company procedure. RESTRICTED: only coordinator or founder sessions.",
|
|
24183
24258
|
inputSchema: {
|
|
24184
|
-
procedure_id: z79.string().describe("UUID of the
|
|
24259
|
+
procedure_id: z79.string().describe("UUID of the company procedure to deactivate")
|
|
24185
24260
|
}
|
|
24186
24261
|
},
|
|
24187
24262
|
async ({ procedure_id }) => {
|
|
@@ -24198,7 +24273,7 @@ function registerDeactivateGlobalProcedure(server2) {
|
|
|
24198
24273
|
}
|
|
24199
24274
|
const client = getClient();
|
|
24200
24275
|
const result = await client.execute({
|
|
24201
|
-
sql: "SELECT id, title, content, priority, domain FROM
|
|
24276
|
+
sql: "SELECT id, title, content, priority, domain FROM company_procedures WHERE id = ?",
|
|
24202
24277
|
args: [procedure_id]
|
|
24203
24278
|
});
|
|
24204
24279
|
if (result.rows.length === 0) {
|
|
@@ -24216,7 +24291,7 @@ function registerDeactivateGlobalProcedure(server2) {
|
|
|
24216
24291
|
return {
|
|
24217
24292
|
content: [{
|
|
24218
24293
|
type: "text",
|
|
24219
|
-
text: `
|
|
24294
|
+
text: `Company procedure ${procedure_id} was already inactive.`
|
|
24220
24295
|
}]
|
|
24221
24296
|
};
|
|
24222
24297
|
}
|
|
@@ -25160,6 +25235,7 @@ var TOOL_CATEGORIES = {
|
|
|
25160
25235
|
registerLoadSkill: "orchestration",
|
|
25161
25236
|
registerExportOrchestration: "orchestration",
|
|
25162
25237
|
registerImportOrchestration: "orchestration",
|
|
25238
|
+
registerCompanyProcedure: "orchestration",
|
|
25163
25239
|
registerGlobalProcedure: "orchestration",
|
|
25164
25240
|
registerStoreGlobalProcedure: "orchestration",
|
|
25165
25241
|
registerListGlobalProcedures: "orchestration",
|
|
@@ -25316,6 +25392,7 @@ function registerAllTools(server2) {
|
|
|
25316
25392
|
gate("registerConsolidateMemories", registerConsolidateMemories);
|
|
25317
25393
|
}
|
|
25318
25394
|
if (exposeLegacyConfig) {
|
|
25395
|
+
gate("registerCompanyProcedure", registerCompanyProcedure);
|
|
25319
25396
|
gate("registerGlobalProcedure", registerGlobalProcedure);
|
|
25320
25397
|
gate("registerStoreGlobalProcedure", registerStoreGlobalProcedure);
|
|
25321
25398
|
gate("registerListGlobalProcedures", registerListGlobalProcedures);
|
package/dist/runtime/index.js
CHANGED
|
@@ -3063,7 +3063,7 @@ async function ensureSchema() {
|
|
|
3063
3063
|
ON session_kills(agent_id);
|
|
3064
3064
|
`);
|
|
3065
3065
|
await client.execute(`
|
|
3066
|
-
CREATE TABLE IF NOT EXISTS
|
|
3066
|
+
CREATE TABLE IF NOT EXISTS company_procedures (
|
|
3067
3067
|
id TEXT PRIMARY KEY,
|
|
3068
3068
|
title TEXT NOT NULL,
|
|
3069
3069
|
content TEXT NOT NULL,
|
|
@@ -3074,6 +3074,73 @@ async function ensureSchema() {
|
|
|
3074
3074
|
updated_at TEXT NOT NULL
|
|
3075
3075
|
)
|
|
3076
3076
|
`);
|
|
3077
|
+
const legacyProcedureObject = await client.execute({
|
|
3078
|
+
sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
|
|
3079
|
+
args: []
|
|
3080
|
+
});
|
|
3081
|
+
const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
|
|
3082
|
+
if (legacyProcedureType === "table") {
|
|
3083
|
+
await client.execute(`
|
|
3084
|
+
INSERT OR IGNORE INTO company_procedures
|
|
3085
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
3086
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
3087
|
+
FROM global_procedures
|
|
3088
|
+
`);
|
|
3089
|
+
await client.executeMultiple(`
|
|
3090
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
|
|
3091
|
+
AFTER INSERT ON global_procedures
|
|
3092
|
+
BEGIN
|
|
3093
|
+
INSERT OR IGNORE INTO company_procedures
|
|
3094
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
3095
|
+
VALUES
|
|
3096
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
3097
|
+
END;
|
|
3098
|
+
|
|
3099
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
|
|
3100
|
+
AFTER UPDATE ON global_procedures
|
|
3101
|
+
BEGIN
|
|
3102
|
+
UPDATE company_procedures
|
|
3103
|
+
SET title = NEW.title,
|
|
3104
|
+
content = NEW.content,
|
|
3105
|
+
priority = NEW.priority,
|
|
3106
|
+
domain = NEW.domain,
|
|
3107
|
+
active = NEW.active,
|
|
3108
|
+
created_at = NEW.created_at,
|
|
3109
|
+
updated_at = NEW.updated_at
|
|
3110
|
+
WHERE id = OLD.id;
|
|
3111
|
+
END;
|
|
3112
|
+
`);
|
|
3113
|
+
} else {
|
|
3114
|
+
await client.execute(`
|
|
3115
|
+
CREATE VIEW IF NOT EXISTS global_procedures AS
|
|
3116
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
3117
|
+
FROM company_procedures
|
|
3118
|
+
`);
|
|
3119
|
+
await client.executeMultiple(`
|
|
3120
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_insert
|
|
3121
|
+
INSTEAD OF INSERT ON global_procedures
|
|
3122
|
+
BEGIN
|
|
3123
|
+
INSERT INTO company_procedures
|
|
3124
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
3125
|
+
VALUES
|
|
3126
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
3127
|
+
END;
|
|
3128
|
+
|
|
3129
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_update
|
|
3130
|
+
INSTEAD OF UPDATE ON global_procedures
|
|
3131
|
+
BEGIN
|
|
3132
|
+
UPDATE company_procedures
|
|
3133
|
+
SET title = NEW.title,
|
|
3134
|
+
content = NEW.content,
|
|
3135
|
+
priority = NEW.priority,
|
|
3136
|
+
domain = NEW.domain,
|
|
3137
|
+
active = NEW.active,
|
|
3138
|
+
created_at = NEW.created_at,
|
|
3139
|
+
updated_at = NEW.updated_at
|
|
3140
|
+
WHERE id = OLD.id;
|
|
3141
|
+
END;
|
|
3142
|
+
`);
|
|
3143
|
+
}
|
|
3077
3144
|
await client.executeMultiple(`
|
|
3078
3145
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
3079
3146
|
id TEXT PRIMARY KEY,
|
|
@@ -7676,7 +7743,7 @@ var init_platform_procedures = __esm({
|
|
|
7676
7743
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
7677
7744
|
domain: "tool-use",
|
|
7678
7745
|
priority: "p1",
|
|
7679
|
-
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.
|
|
7746
|
+
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. company_procedure: manage customer-owned company procedures (Layer 0; actions: store, list, deactivate). Legacy aliases: global_procedure, store_global_procedure, list_global_procedures, deactivate_global_procedure."
|
|
7680
7747
|
}
|
|
7681
7748
|
];
|
|
7682
7749
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -7697,7 +7764,7 @@ import { randomUUID as randomUUID4 } from "crypto";
|
|
|
7697
7764
|
async function loadGlobalProcedures() {
|
|
7698
7765
|
const client = getClient();
|
|
7699
7766
|
const result = await client.execute({
|
|
7700
|
-
sql: "SELECT * FROM
|
|
7767
|
+
sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
7701
7768
|
args: []
|
|
7702
7769
|
});
|
|
7703
7770
|
const allRows = result.rows;
|
|
@@ -7726,7 +7793,7 @@ async function storeGlobalProcedure(input) {
|
|
|
7726
7793
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7727
7794
|
const client = getClient();
|
|
7728
7795
|
await client.execute({
|
|
7729
|
-
sql: `INSERT INTO
|
|
7796
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
7730
7797
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
7731
7798
|
args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
|
|
7732
7799
|
});
|
|
@@ -7737,7 +7804,7 @@ async function deactivateGlobalProcedure(id) {
|
|
|
7737
7804
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7738
7805
|
const client = getClient();
|
|
7739
7806
|
const result = await client.execute({
|
|
7740
|
-
sql: "UPDATE
|
|
7807
|
+
sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
7741
7808
|
args: [now, id]
|
|
7742
7809
|
});
|
|
7743
7810
|
await loadGlobalProcedures();
|