@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
|
@@ -2366,7 +2366,7 @@ async function ensureSchema() {
|
|
|
2366
2366
|
ON session_kills(agent_id);
|
|
2367
2367
|
`);
|
|
2368
2368
|
await client.execute(`
|
|
2369
|
-
CREATE TABLE IF NOT EXISTS
|
|
2369
|
+
CREATE TABLE IF NOT EXISTS company_procedures (
|
|
2370
2370
|
id TEXT PRIMARY KEY,
|
|
2371
2371
|
title TEXT NOT NULL,
|
|
2372
2372
|
content TEXT NOT NULL,
|
|
@@ -2377,6 +2377,73 @@ async function ensureSchema() {
|
|
|
2377
2377
|
updated_at TEXT NOT NULL
|
|
2378
2378
|
)
|
|
2379
2379
|
`);
|
|
2380
|
+
const legacyProcedureObject = await client.execute({
|
|
2381
|
+
sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
|
|
2382
|
+
args: []
|
|
2383
|
+
});
|
|
2384
|
+
const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
|
|
2385
|
+
if (legacyProcedureType === "table") {
|
|
2386
|
+
await client.execute(`
|
|
2387
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2388
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2389
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2390
|
+
FROM global_procedures
|
|
2391
|
+
`);
|
|
2392
|
+
await client.executeMultiple(`
|
|
2393
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
|
|
2394
|
+
AFTER INSERT ON global_procedures
|
|
2395
|
+
BEGIN
|
|
2396
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2397
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2398
|
+
VALUES
|
|
2399
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2400
|
+
END;
|
|
2401
|
+
|
|
2402
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
|
|
2403
|
+
AFTER UPDATE ON global_procedures
|
|
2404
|
+
BEGIN
|
|
2405
|
+
UPDATE company_procedures
|
|
2406
|
+
SET title = NEW.title,
|
|
2407
|
+
content = NEW.content,
|
|
2408
|
+
priority = NEW.priority,
|
|
2409
|
+
domain = NEW.domain,
|
|
2410
|
+
active = NEW.active,
|
|
2411
|
+
created_at = NEW.created_at,
|
|
2412
|
+
updated_at = NEW.updated_at
|
|
2413
|
+
WHERE id = OLD.id;
|
|
2414
|
+
END;
|
|
2415
|
+
`);
|
|
2416
|
+
} else {
|
|
2417
|
+
await client.execute(`
|
|
2418
|
+
CREATE VIEW IF NOT EXISTS global_procedures AS
|
|
2419
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2420
|
+
FROM company_procedures
|
|
2421
|
+
`);
|
|
2422
|
+
await client.executeMultiple(`
|
|
2423
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_insert
|
|
2424
|
+
INSTEAD OF INSERT ON global_procedures
|
|
2425
|
+
BEGIN
|
|
2426
|
+
INSERT INTO company_procedures
|
|
2427
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2428
|
+
VALUES
|
|
2429
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2430
|
+
END;
|
|
2431
|
+
|
|
2432
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_update
|
|
2433
|
+
INSTEAD OF UPDATE ON global_procedures
|
|
2434
|
+
BEGIN
|
|
2435
|
+
UPDATE company_procedures
|
|
2436
|
+
SET title = NEW.title,
|
|
2437
|
+
content = NEW.content,
|
|
2438
|
+
priority = NEW.priority,
|
|
2439
|
+
domain = NEW.domain,
|
|
2440
|
+
active = NEW.active,
|
|
2441
|
+
created_at = NEW.created_at,
|
|
2442
|
+
updated_at = NEW.updated_at
|
|
2443
|
+
WHERE id = OLD.id;
|
|
2444
|
+
END;
|
|
2445
|
+
`);
|
|
2446
|
+
}
|
|
2380
2447
|
await client.executeMultiple(`
|
|
2381
2448
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
2382
2449
|
id TEXT PRIMARY KEY,
|
|
@@ -3253,7 +3320,7 @@ var init_platform_procedures = __esm({
|
|
|
3253
3320
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3254
3321
|
domain: "tool-use",
|
|
3255
3322
|
priority: "p1",
|
|
3256
|
-
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.
|
|
3323
|
+
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."
|
|
3257
3324
|
}
|
|
3258
3325
|
];
|
|
3259
3326
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -3274,7 +3341,7 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
3274
3341
|
async function loadGlobalProcedures() {
|
|
3275
3342
|
const client = getClient();
|
|
3276
3343
|
const result = await client.execute({
|
|
3277
|
-
sql: "SELECT * FROM
|
|
3344
|
+
sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
3278
3345
|
args: []
|
|
3279
3346
|
});
|
|
3280
3347
|
const allRows = result.rows;
|
|
@@ -3303,7 +3370,7 @@ async function storeGlobalProcedure(input) {
|
|
|
3303
3370
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3304
3371
|
const client = getClient();
|
|
3305
3372
|
await client.execute({
|
|
3306
|
-
sql: `INSERT INTO
|
|
3373
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
3307
3374
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
3308
3375
|
args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
|
|
3309
3376
|
});
|
|
@@ -3314,7 +3381,7 @@ async function deactivateGlobalProcedure(id) {
|
|
|
3314
3381
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3315
3382
|
const client = getClient();
|
|
3316
3383
|
const result = await client.execute({
|
|
3317
|
-
sql: "UPDATE
|
|
3384
|
+
sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
3318
3385
|
args: [now, id]
|
|
3319
3386
|
});
|
|
3320
3387
|
await loadGlobalProcedures();
|
|
@@ -3671,6 +3738,39 @@ var init_preferences = __esm({
|
|
|
3671
3738
|
}
|
|
3672
3739
|
});
|
|
3673
3740
|
|
|
3741
|
+
// src/adapters/runtime-hook-manifest.ts
|
|
3742
|
+
function commandHasAnyMarker(command, markers) {
|
|
3743
|
+
return markers.some((marker) => command.includes(marker));
|
|
3744
|
+
}
|
|
3745
|
+
function isLegacySplitPostToolCommand(command) {
|
|
3746
|
+
return commandHasAnyMarker(command, LEGACY_SPLIT_POST_TOOL_HOOK_MARKERS);
|
|
3747
|
+
}
|
|
3748
|
+
var EXE_HOOKS, LEGACY_SPLIT_POST_TOOL_HOOK_MARKERS;
|
|
3749
|
+
var init_runtime_hook_manifest = __esm({
|
|
3750
|
+
"src/adapters/runtime-hook-manifest.ts"() {
|
|
3751
|
+
"use strict";
|
|
3752
|
+
EXE_HOOKS = {
|
|
3753
|
+
postToolCombined: "dist/hooks/post-tool-combined.js",
|
|
3754
|
+
sessionStart: "dist/hooks/session-start.js",
|
|
3755
|
+
promptSubmit: "dist/hooks/prompt-submit.js",
|
|
3756
|
+
heartbeat: "dist/hooks/exe-heartbeat-hook.js",
|
|
3757
|
+
stop: "dist/hooks/stop.js",
|
|
3758
|
+
preToolUse: "dist/hooks/pre-tool-use.js",
|
|
3759
|
+
subagentStop: "dist/hooks/subagent-stop.js",
|
|
3760
|
+
preCompact: "dist/hooks/pre-compact.js",
|
|
3761
|
+
postCompact: "dist/hooks/post-compact.js",
|
|
3762
|
+
sessionEnd: "dist/hooks/session-end.js",
|
|
3763
|
+
notification: "dist/hooks/notification.js",
|
|
3764
|
+
instructionsLoaded: "dist/hooks/instructions-loaded.js"
|
|
3765
|
+
};
|
|
3766
|
+
LEGACY_SPLIT_POST_TOOL_HOOK_MARKERS = [
|
|
3767
|
+
"dist/hooks/ingest.js",
|
|
3768
|
+
"dist/hooks/error-recall.js",
|
|
3769
|
+
"dist/hooks/ingest-worker.js"
|
|
3770
|
+
];
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
3773
|
+
|
|
3674
3774
|
// src/adapters/claude/installer.ts
|
|
3675
3775
|
import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4, readdir } from "fs/promises";
|
|
3676
3776
|
import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, copyFileSync, mkdirSync as mkdirSync6, chmodSync as chmodSync2 } from "fs";
|
|
@@ -3703,6 +3803,7 @@ var init_installer = __esm({
|
|
|
3703
3803
|
init_agent_symlinks();
|
|
3704
3804
|
init_mcp_prefix();
|
|
3705
3805
|
init_preferences();
|
|
3806
|
+
init_runtime_hook_manifest();
|
|
3706
3807
|
EXE_SECTION_START = "<!-- exe-os:orchestration-start -->";
|
|
3707
3808
|
EXE_SECTION_END = "<!-- exe-os:orchestration-end -->";
|
|
3708
3809
|
ORCHESTRATION_RULES = `${EXE_SECTION_START}
|
|
@@ -3764,7 +3865,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os10.homedir()) {
|
|
|
3764
3865
|
}
|
|
3765
3866
|
]
|
|
3766
3867
|
},
|
|
3767
|
-
marker:
|
|
3868
|
+
marker: EXE_HOOKS.sessionStart
|
|
3768
3869
|
},
|
|
3769
3870
|
{
|
|
3770
3871
|
event: "PostToolUse",
|
|
@@ -3779,7 +3880,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os10.homedir()) {
|
|
|
3779
3880
|
}
|
|
3780
3881
|
]
|
|
3781
3882
|
},
|
|
3782
|
-
marker:
|
|
3883
|
+
marker: EXE_HOOKS.postToolCombined
|
|
3783
3884
|
},
|
|
3784
3885
|
{
|
|
3785
3886
|
event: "UserPromptSubmit",
|
|
@@ -3793,7 +3894,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os10.homedir()) {
|
|
|
3793
3894
|
}
|
|
3794
3895
|
]
|
|
3795
3896
|
},
|
|
3796
|
-
marker:
|
|
3897
|
+
marker: EXE_HOOKS.promptSubmit
|
|
3797
3898
|
},
|
|
3798
3899
|
{
|
|
3799
3900
|
event: "Stop",
|
|
@@ -3805,7 +3906,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os10.homedir()) {
|
|
|
3805
3906
|
}
|
|
3806
3907
|
]
|
|
3807
3908
|
},
|
|
3808
|
-
marker:
|
|
3909
|
+
marker: EXE_HOOKS.stop
|
|
3809
3910
|
},
|
|
3810
3911
|
{
|
|
3811
3912
|
event: "PreToolUse",
|
|
@@ -3818,21 +3919,16 @@ async function mergeCodexHooks(packageRoot, homeDir = os10.homedir()) {
|
|
|
3818
3919
|
}
|
|
3819
3920
|
]
|
|
3820
3921
|
},
|
|
3821
|
-
marker:
|
|
3922
|
+
marker: EXE_HOOKS.preToolUse
|
|
3822
3923
|
}
|
|
3823
3924
|
];
|
|
3824
3925
|
let added = 0;
|
|
3825
3926
|
let skipped = 0;
|
|
3826
|
-
const legacyPostToolMarkers = [
|
|
3827
|
-
"dist/hooks/ingest.js",
|
|
3828
|
-
"dist/hooks/error-recall.js",
|
|
3829
|
-
"dist/hooks/ingest-worker.js"
|
|
3830
|
-
];
|
|
3831
3927
|
const postToolGroups = hooksJson.hooks["PostToolUse"];
|
|
3832
3928
|
if (Array.isArray(postToolGroups)) {
|
|
3833
3929
|
hooksJson.hooks["PostToolUse"] = postToolGroups.map((g) => ({
|
|
3834
3930
|
...g,
|
|
3835
|
-
hooks: g.hooks.filter((h) => !
|
|
3931
|
+
hooks: g.hooks.filter((h) => !isLegacySplitPostToolCommand(h.command))
|
|
3836
3932
|
})).filter((g) => g.hooks.length > 0);
|
|
3837
3933
|
}
|
|
3838
3934
|
for (const { event, group, marker } of hooksToRegister) {
|
|
@@ -3875,11 +3971,11 @@ function verifyCodexHooks(homeDir = os10.homedir()) {
|
|
|
3875
3971
|
}
|
|
3876
3972
|
}
|
|
3877
3973
|
const postToolCommands = (hooksJson.hooks.PostToolUse ?? []).flatMap((g) => g.hooks.map((h) => h.command));
|
|
3878
|
-
if (!postToolCommands.some((cmd) => cmd.includes(
|
|
3974
|
+
if (!postToolCommands.some((cmd) => cmd.includes(EXE_HOOKS.postToolCombined))) {
|
|
3879
3975
|
return false;
|
|
3880
3976
|
}
|
|
3881
3977
|
if (postToolCommands.some(
|
|
3882
|
-
(cmd) =>
|
|
3978
|
+
(cmd) => isLegacySplitPostToolCommand(cmd)
|
|
3883
3979
|
)) {
|
|
3884
3980
|
return false;
|
|
3885
3981
|
}
|
|
@@ -4040,6 +4136,7 @@ var init_installer2 = __esm({
|
|
|
4040
4136
|
"use strict";
|
|
4041
4137
|
init_installer();
|
|
4042
4138
|
init_preferences();
|
|
4139
|
+
init_runtime_hook_manifest();
|
|
4043
4140
|
DEFAULT_CODEX_STATUS_LINE = [
|
|
4044
4141
|
"model-with-reasoning",
|
|
4045
4142
|
"current-dir",
|
|
@@ -2366,7 +2366,7 @@ async function ensureSchema() {
|
|
|
2366
2366
|
ON session_kills(agent_id);
|
|
2367
2367
|
`);
|
|
2368
2368
|
await client.execute(`
|
|
2369
|
-
CREATE TABLE IF NOT EXISTS
|
|
2369
|
+
CREATE TABLE IF NOT EXISTS company_procedures (
|
|
2370
2370
|
id TEXT PRIMARY KEY,
|
|
2371
2371
|
title TEXT NOT NULL,
|
|
2372
2372
|
content TEXT NOT NULL,
|
|
@@ -2377,6 +2377,73 @@ async function ensureSchema() {
|
|
|
2377
2377
|
updated_at TEXT NOT NULL
|
|
2378
2378
|
)
|
|
2379
2379
|
`);
|
|
2380
|
+
const legacyProcedureObject = await client.execute({
|
|
2381
|
+
sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
|
|
2382
|
+
args: []
|
|
2383
|
+
});
|
|
2384
|
+
const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
|
|
2385
|
+
if (legacyProcedureType === "table") {
|
|
2386
|
+
await client.execute(`
|
|
2387
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2388
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2389
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2390
|
+
FROM global_procedures
|
|
2391
|
+
`);
|
|
2392
|
+
await client.executeMultiple(`
|
|
2393
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
|
|
2394
|
+
AFTER INSERT ON global_procedures
|
|
2395
|
+
BEGIN
|
|
2396
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2397
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2398
|
+
VALUES
|
|
2399
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2400
|
+
END;
|
|
2401
|
+
|
|
2402
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
|
|
2403
|
+
AFTER UPDATE ON global_procedures
|
|
2404
|
+
BEGIN
|
|
2405
|
+
UPDATE company_procedures
|
|
2406
|
+
SET title = NEW.title,
|
|
2407
|
+
content = NEW.content,
|
|
2408
|
+
priority = NEW.priority,
|
|
2409
|
+
domain = NEW.domain,
|
|
2410
|
+
active = NEW.active,
|
|
2411
|
+
created_at = NEW.created_at,
|
|
2412
|
+
updated_at = NEW.updated_at
|
|
2413
|
+
WHERE id = OLD.id;
|
|
2414
|
+
END;
|
|
2415
|
+
`);
|
|
2416
|
+
} else {
|
|
2417
|
+
await client.execute(`
|
|
2418
|
+
CREATE VIEW IF NOT EXISTS global_procedures AS
|
|
2419
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2420
|
+
FROM company_procedures
|
|
2421
|
+
`);
|
|
2422
|
+
await client.executeMultiple(`
|
|
2423
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_insert
|
|
2424
|
+
INSTEAD OF INSERT ON global_procedures
|
|
2425
|
+
BEGIN
|
|
2426
|
+
INSERT INTO company_procedures
|
|
2427
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2428
|
+
VALUES
|
|
2429
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2430
|
+
END;
|
|
2431
|
+
|
|
2432
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_update
|
|
2433
|
+
INSTEAD OF UPDATE ON global_procedures
|
|
2434
|
+
BEGIN
|
|
2435
|
+
UPDATE company_procedures
|
|
2436
|
+
SET title = NEW.title,
|
|
2437
|
+
content = NEW.content,
|
|
2438
|
+
priority = NEW.priority,
|
|
2439
|
+
domain = NEW.domain,
|
|
2440
|
+
active = NEW.active,
|
|
2441
|
+
created_at = NEW.created_at,
|
|
2442
|
+
updated_at = NEW.updated_at
|
|
2443
|
+
WHERE id = OLD.id;
|
|
2444
|
+
END;
|
|
2445
|
+
`);
|
|
2446
|
+
}
|
|
2380
2447
|
await client.executeMultiple(`
|
|
2381
2448
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
2382
2449
|
id TEXT PRIMARY KEY,
|
|
@@ -3253,7 +3320,7 @@ var init_platform_procedures = __esm({
|
|
|
3253
3320
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3254
3321
|
domain: "tool-use",
|
|
3255
3322
|
priority: "p1",
|
|
3256
|
-
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.
|
|
3323
|
+
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."
|
|
3257
3324
|
}
|
|
3258
3325
|
];
|
|
3259
3326
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -3274,7 +3341,7 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
3274
3341
|
async function loadGlobalProcedures() {
|
|
3275
3342
|
const client = getClient();
|
|
3276
3343
|
const result = await client.execute({
|
|
3277
|
-
sql: "SELECT * FROM
|
|
3344
|
+
sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
3278
3345
|
args: []
|
|
3279
3346
|
});
|
|
3280
3347
|
const allRows = result.rows;
|
|
@@ -3303,7 +3370,7 @@ async function storeGlobalProcedure(input) {
|
|
|
3303
3370
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3304
3371
|
const client = getClient();
|
|
3305
3372
|
await client.execute({
|
|
3306
|
-
sql: `INSERT INTO
|
|
3373
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
3307
3374
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
3308
3375
|
args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
|
|
3309
3376
|
});
|
|
@@ -3314,7 +3381,7 @@ async function deactivateGlobalProcedure(id) {
|
|
|
3314
3381
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3315
3382
|
const client = getClient();
|
|
3316
3383
|
const result = await client.execute({
|
|
3317
|
-
sql: "UPDATE
|
|
3384
|
+
sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
3318
3385
|
args: [now, id]
|
|
3319
3386
|
});
|
|
3320
3387
|
await loadGlobalProcedures();
|
|
@@ -3660,6 +3727,23 @@ var init_preferences = __esm({
|
|
|
3660
3727
|
}
|
|
3661
3728
|
});
|
|
3662
3729
|
|
|
3730
|
+
// src/adapters/runtime-hook-manifest.ts
|
|
3731
|
+
function textHasLegacySplitPostToolHook(text) {
|
|
3732
|
+
return [EXE_HOOK_FILES.ingest, EXE_HOOK_FILES.errorRecall, EXE_HOOK_FILES.ingestWorker].some((file) => text.includes(file));
|
|
3733
|
+
}
|
|
3734
|
+
var EXE_HOOK_FILES;
|
|
3735
|
+
var init_runtime_hook_manifest = __esm({
|
|
3736
|
+
"src/adapters/runtime-hook-manifest.ts"() {
|
|
3737
|
+
"use strict";
|
|
3738
|
+
EXE_HOOK_FILES = {
|
|
3739
|
+
postToolCombined: "post-tool-combined.js",
|
|
3740
|
+
ingest: "ingest.js",
|
|
3741
|
+
errorRecall: "error-recall.js",
|
|
3742
|
+
ingestWorker: "ingest-worker.js"
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
});
|
|
3746
|
+
|
|
3663
3747
|
// src/adapters/claude/installer.ts
|
|
3664
3748
|
import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4, readdir } from "fs/promises";
|
|
3665
3749
|
import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, copyFileSync, mkdirSync as mkdirSync6, chmodSync as chmodSync2 } from "fs";
|
|
@@ -3692,6 +3776,7 @@ var init_installer = __esm({
|
|
|
3692
3776
|
init_agent_symlinks();
|
|
3693
3777
|
init_mcp_prefix();
|
|
3694
3778
|
init_preferences();
|
|
3779
|
+
init_runtime_hook_manifest();
|
|
3695
3780
|
EXE_SECTION_START = "<!-- exe-os:orchestration-start -->";
|
|
3696
3781
|
EXE_SECTION_END = "<!-- exe-os:orchestration-end -->";
|
|
3697
3782
|
ORCHESTRATION_RULES = `${EXE_SECTION_START}
|
|
@@ -3965,8 +4050,8 @@ function verifyOpenCodeHooks(homeDir = os10.homedir()) {
|
|
|
3965
4050
|
if (!existsSync12(pluginPath)) return false;
|
|
3966
4051
|
try {
|
|
3967
4052
|
const plugin = readFileSync8(pluginPath, "utf-8");
|
|
3968
|
-
if (!plugin.includes(
|
|
3969
|
-
if (
|
|
4053
|
+
if (!plugin.includes(EXE_HOOK_FILES.postToolCombined)) return false;
|
|
4054
|
+
if (textHasLegacySplitPostToolHook(plugin)) return false;
|
|
3970
4055
|
} catch {
|
|
3971
4056
|
return false;
|
|
3972
4057
|
}
|
|
@@ -3990,6 +4075,7 @@ var init_installer2 = __esm({
|
|
|
3990
4075
|
"use strict";
|
|
3991
4076
|
init_installer();
|
|
3992
4077
|
init_plugin_template();
|
|
4078
|
+
init_runtime_hook_manifest();
|
|
3993
4079
|
}
|
|
3994
4080
|
});
|
|
3995
4081
|
|
package/dist/bin/exe-status.js
CHANGED
|
@@ -2526,7 +2526,7 @@ async function ensureSchema() {
|
|
|
2526
2526
|
ON session_kills(agent_id);
|
|
2527
2527
|
`);
|
|
2528
2528
|
await client.execute(`
|
|
2529
|
-
CREATE TABLE IF NOT EXISTS
|
|
2529
|
+
CREATE TABLE IF NOT EXISTS company_procedures (
|
|
2530
2530
|
id TEXT PRIMARY KEY,
|
|
2531
2531
|
title TEXT NOT NULL,
|
|
2532
2532
|
content TEXT NOT NULL,
|
|
@@ -2537,6 +2537,73 @@ async function ensureSchema() {
|
|
|
2537
2537
|
updated_at TEXT NOT NULL
|
|
2538
2538
|
)
|
|
2539
2539
|
`);
|
|
2540
|
+
const legacyProcedureObject = await client.execute({
|
|
2541
|
+
sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
|
|
2542
|
+
args: []
|
|
2543
|
+
});
|
|
2544
|
+
const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
|
|
2545
|
+
if (legacyProcedureType === "table") {
|
|
2546
|
+
await client.execute(`
|
|
2547
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2548
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2549
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2550
|
+
FROM global_procedures
|
|
2551
|
+
`);
|
|
2552
|
+
await client.executeMultiple(`
|
|
2553
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
|
|
2554
|
+
AFTER INSERT ON global_procedures
|
|
2555
|
+
BEGIN
|
|
2556
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2557
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2558
|
+
VALUES
|
|
2559
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2560
|
+
END;
|
|
2561
|
+
|
|
2562
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
|
|
2563
|
+
AFTER UPDATE ON global_procedures
|
|
2564
|
+
BEGIN
|
|
2565
|
+
UPDATE company_procedures
|
|
2566
|
+
SET title = NEW.title,
|
|
2567
|
+
content = NEW.content,
|
|
2568
|
+
priority = NEW.priority,
|
|
2569
|
+
domain = NEW.domain,
|
|
2570
|
+
active = NEW.active,
|
|
2571
|
+
created_at = NEW.created_at,
|
|
2572
|
+
updated_at = NEW.updated_at
|
|
2573
|
+
WHERE id = OLD.id;
|
|
2574
|
+
END;
|
|
2575
|
+
`);
|
|
2576
|
+
} else {
|
|
2577
|
+
await client.execute(`
|
|
2578
|
+
CREATE VIEW IF NOT EXISTS global_procedures AS
|
|
2579
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2580
|
+
FROM company_procedures
|
|
2581
|
+
`);
|
|
2582
|
+
await client.executeMultiple(`
|
|
2583
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_insert
|
|
2584
|
+
INSTEAD OF INSERT ON global_procedures
|
|
2585
|
+
BEGIN
|
|
2586
|
+
INSERT INTO company_procedures
|
|
2587
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2588
|
+
VALUES
|
|
2589
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2590
|
+
END;
|
|
2591
|
+
|
|
2592
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_update
|
|
2593
|
+
INSTEAD OF UPDATE ON global_procedures
|
|
2594
|
+
BEGIN
|
|
2595
|
+
UPDATE company_procedures
|
|
2596
|
+
SET title = NEW.title,
|
|
2597
|
+
content = NEW.content,
|
|
2598
|
+
priority = NEW.priority,
|
|
2599
|
+
domain = NEW.domain,
|
|
2600
|
+
active = NEW.active,
|
|
2601
|
+
created_at = NEW.created_at,
|
|
2602
|
+
updated_at = NEW.updated_at
|
|
2603
|
+
WHERE id = OLD.id;
|
|
2604
|
+
END;
|
|
2605
|
+
`);
|
|
2606
|
+
}
|
|
2540
2607
|
await client.executeMultiple(`
|
|
2541
2608
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
2542
2609
|
id TEXT PRIMARY KEY,
|
|
@@ -3885,7 +3952,7 @@ var init_platform_procedures = __esm({
|
|
|
3885
3952
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3886
3953
|
domain: "tool-use",
|
|
3887
3954
|
priority: "p1",
|
|
3888
|
-
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.
|
|
3955
|
+
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."
|
|
3889
3956
|
}
|
|
3890
3957
|
];
|
|
3891
3958
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -3906,7 +3973,7 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
3906
3973
|
async function loadGlobalProcedures() {
|
|
3907
3974
|
const client = getClient();
|
|
3908
3975
|
const result = await client.execute({
|
|
3909
|
-
sql: "SELECT * FROM
|
|
3976
|
+
sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
3910
3977
|
args: []
|
|
3911
3978
|
});
|
|
3912
3979
|
const allRows = result.rows;
|
|
@@ -3935,7 +4002,7 @@ async function storeGlobalProcedure(input) {
|
|
|
3935
4002
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3936
4003
|
const client = getClient();
|
|
3937
4004
|
await client.execute({
|
|
3938
|
-
sql: `INSERT INTO
|
|
4005
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
3939
4006
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
3940
4007
|
args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
|
|
3941
4008
|
});
|
|
@@ -3946,7 +4013,7 @@ async function deactivateGlobalProcedure(id) {
|
|
|
3946
4013
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3947
4014
|
const client = getClient();
|
|
3948
4015
|
const result = await client.execute({
|
|
3949
|
-
sql: "UPDATE
|
|
4016
|
+
sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
3950
4017
|
args: [now, id]
|
|
3951
4018
|
});
|
|
3952
4019
|
await loadGlobalProcedures();
|
package/dist/bin/exe-team.js
CHANGED
|
@@ -2515,7 +2515,7 @@ async function ensureSchema() {
|
|
|
2515
2515
|
ON session_kills(agent_id);
|
|
2516
2516
|
`);
|
|
2517
2517
|
await client.execute(`
|
|
2518
|
-
CREATE TABLE IF NOT EXISTS
|
|
2518
|
+
CREATE TABLE IF NOT EXISTS company_procedures (
|
|
2519
2519
|
id TEXT PRIMARY KEY,
|
|
2520
2520
|
title TEXT NOT NULL,
|
|
2521
2521
|
content TEXT NOT NULL,
|
|
@@ -2526,6 +2526,73 @@ async function ensureSchema() {
|
|
|
2526
2526
|
updated_at TEXT NOT NULL
|
|
2527
2527
|
)
|
|
2528
2528
|
`);
|
|
2529
|
+
const legacyProcedureObject = await client.execute({
|
|
2530
|
+
sql: "SELECT type FROM sqlite_master WHERE name = 'global_procedures'",
|
|
2531
|
+
args: []
|
|
2532
|
+
});
|
|
2533
|
+
const legacyProcedureType = legacyProcedureObject.rows[0]?.type == null ? null : String(legacyProcedureObject.rows[0].type);
|
|
2534
|
+
if (legacyProcedureType === "table") {
|
|
2535
|
+
await client.execute(`
|
|
2536
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2537
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2538
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2539
|
+
FROM global_procedures
|
|
2540
|
+
`);
|
|
2541
|
+
await client.executeMultiple(`
|
|
2542
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_insert
|
|
2543
|
+
AFTER INSERT ON global_procedures
|
|
2544
|
+
BEGIN
|
|
2545
|
+
INSERT OR IGNORE INTO company_procedures
|
|
2546
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2547
|
+
VALUES
|
|
2548
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2549
|
+
END;
|
|
2550
|
+
|
|
2551
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_mirror_update
|
|
2552
|
+
AFTER UPDATE ON global_procedures
|
|
2553
|
+
BEGIN
|
|
2554
|
+
UPDATE company_procedures
|
|
2555
|
+
SET title = NEW.title,
|
|
2556
|
+
content = NEW.content,
|
|
2557
|
+
priority = NEW.priority,
|
|
2558
|
+
domain = NEW.domain,
|
|
2559
|
+
active = NEW.active,
|
|
2560
|
+
created_at = NEW.created_at,
|
|
2561
|
+
updated_at = NEW.updated_at
|
|
2562
|
+
WHERE id = OLD.id;
|
|
2563
|
+
END;
|
|
2564
|
+
`);
|
|
2565
|
+
} else {
|
|
2566
|
+
await client.execute(`
|
|
2567
|
+
CREATE VIEW IF NOT EXISTS global_procedures AS
|
|
2568
|
+
SELECT id, title, content, priority, domain, active, created_at, updated_at
|
|
2569
|
+
FROM company_procedures
|
|
2570
|
+
`);
|
|
2571
|
+
await client.executeMultiple(`
|
|
2572
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_insert
|
|
2573
|
+
INSTEAD OF INSERT ON global_procedures
|
|
2574
|
+
BEGIN
|
|
2575
|
+
INSERT INTO company_procedures
|
|
2576
|
+
(id, title, content, priority, domain, active, created_at, updated_at)
|
|
2577
|
+
VALUES
|
|
2578
|
+
(NEW.id, NEW.title, NEW.content, NEW.priority, NEW.domain, NEW.active, NEW.created_at, NEW.updated_at);
|
|
2579
|
+
END;
|
|
2580
|
+
|
|
2581
|
+
CREATE TRIGGER IF NOT EXISTS global_procedures_update
|
|
2582
|
+
INSTEAD OF UPDATE ON global_procedures
|
|
2583
|
+
BEGIN
|
|
2584
|
+
UPDATE company_procedures
|
|
2585
|
+
SET title = NEW.title,
|
|
2586
|
+
content = NEW.content,
|
|
2587
|
+
priority = NEW.priority,
|
|
2588
|
+
domain = NEW.domain,
|
|
2589
|
+
active = NEW.active,
|
|
2590
|
+
created_at = NEW.created_at,
|
|
2591
|
+
updated_at = NEW.updated_at
|
|
2592
|
+
WHERE id = OLD.id;
|
|
2593
|
+
END;
|
|
2594
|
+
`);
|
|
2595
|
+
}
|
|
2529
2596
|
await client.executeMultiple(`
|
|
2530
2597
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
2531
2598
|
id TEXT PRIMARY KEY,
|
|
@@ -3874,7 +3941,7 @@ var init_platform_procedures = __esm({
|
|
|
3874
3941
|
title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
|
|
3875
3942
|
domain: "tool-use",
|
|
3876
3943
|
priority: "p1",
|
|
3877
|
-
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.
|
|
3944
|
+
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."
|
|
3878
3945
|
}
|
|
3879
3946
|
];
|
|
3880
3947
|
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
@@ -3895,7 +3962,7 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
3895
3962
|
async function loadGlobalProcedures() {
|
|
3896
3963
|
const client = getClient();
|
|
3897
3964
|
const result = await client.execute({
|
|
3898
|
-
sql: "SELECT * FROM
|
|
3965
|
+
sql: "SELECT * FROM company_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
3899
3966
|
args: []
|
|
3900
3967
|
});
|
|
3901
3968
|
const allRows = result.rows;
|
|
@@ -3924,7 +3991,7 @@ async function storeGlobalProcedure(input) {
|
|
|
3924
3991
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3925
3992
|
const client = getClient();
|
|
3926
3993
|
await client.execute({
|
|
3927
|
-
sql: `INSERT INTO
|
|
3994
|
+
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
3928
3995
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
3929
3996
|
args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
|
|
3930
3997
|
});
|
|
@@ -3935,7 +4002,7 @@ async function deactivateGlobalProcedure(id) {
|
|
|
3935
4002
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3936
4003
|
const client = getClient();
|
|
3937
4004
|
const result = await client.execute({
|
|
3938
|
-
sql: "UPDATE
|
|
4005
|
+
sql: "UPDATE company_procedures SET active = 0, updated_at = ? WHERE id = ?",
|
|
3939
4006
|
args: [now, id]
|
|
3940
4007
|
});
|
|
3941
4008
|
await loadGlobalProcedures();
|