@askexenow/exe-os 0.9.203 → 0.9.205
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/compose/init-db.sql +162 -0
- package/deploy/stack-manifests/v0.9.json +45 -1
- package/dist/{active-agent-EFWC3HGP.js → active-agent-4RUP4VYK.js} +2 -2
- package/dist/{active-agent-NXX5Z3LX.js → active-agent-VEML3XMS.js} +2 -2
- package/dist/{agentic-ontology-JS6DPKQB.js → agentic-ontology-FNJAKZF5.js} +1 -1
- package/dist/{backfill-metadata-PTACRLYK.js → backfill-metadata-BT4RLVMZ.js} +3 -3
- package/dist/{behaviors-WDIKLZA3.js → behaviors-LCPNHP5Q.js} +2 -2
- package/dist/bin/agentic-ontology-backfill.js +4 -4
- package/dist/bin/agentic-reflection-backfill.js +5 -5
- package/dist/bin/agentic-semantic-label.js +4 -4
- package/dist/bin/backfill-conversations.js +3 -3
- package/dist/bin/backfill-responses.js +3 -3
- package/dist/bin/backfill-vectors.js +4 -4
- package/dist/bin/bulk-sync-postgres.js +5 -5
- package/dist/bin/cleanup-stale-review-tasks.js +8 -8
- package/dist/bin/cli.js +12 -12
- package/dist/bin/exe-agent-config.js +1 -1
- package/dist/bin/exe-agent.js +3 -3
- package/dist/bin/exe-assign.js +4 -4
- package/dist/bin/exe-boot.js +15 -15
- package/dist/bin/exe-call.js +3 -3
- package/dist/bin/exe-cloud.js +3 -3
- package/dist/bin/exe-dispatch.js +8 -8
- package/dist/bin/exe-doctor.js +1 -1
- package/dist/bin/exe-export-behaviors.js +6 -6
- package/dist/bin/exe-forget.js +5 -5
- package/dist/bin/exe-gateway.js +5 -5
- package/dist/bin/exe-heartbeat.js +8 -8
- package/dist/bin/exe-kill.js +11 -11
- package/dist/bin/exe-launch-agent.js +9 -9
- package/dist/bin/exe-new-employee.js +5 -5
- package/dist/bin/exe-pending-messages.js +9 -9
- package/dist/bin/exe-pending-notifications.js +8 -8
- package/dist/bin/exe-pending-reviews.js +8 -8
- package/dist/bin/exe-rename.js +3 -3
- package/dist/bin/exe-review.js +10 -10
- package/dist/bin/exe-search.js +4 -4
- package/dist/bin/exe-session-cleanup.js +13 -13
- package/dist/bin/exe-settings.js +3 -3
- package/dist/bin/exe-start-codex.js +10 -10
- package/dist/bin/exe-start-opencode.js +7 -7
- package/dist/bin/exe-status.js +9 -9
- package/dist/bin/exe-team.js +2 -2
- package/dist/bin/git-sweep.js +8 -8
- package/dist/bin/graph-backfill.js +3 -3
- package/dist/bin/graph-export.js +4 -4
- package/dist/bin/import-history.js +4 -4
- package/dist/bin/install.js +5 -5
- package/dist/bin/intercom-check.js +4 -4
- package/dist/bin/orchestration-metrics.js +4 -3
- package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
- package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
- package/dist/bin/scan-tasks.js +8 -8
- package/dist/bin/setup.js +1 -1
- package/dist/bin/shard-migrate.js +3 -3
- package/dist/{capacity-monitor-TGSIL7W4.js → capacity-monitor-EPHJTSKF.js} +9 -9
- package/dist/{catchup-brief-ABL4NSAE.js → catchup-brief-HVITENL5.js} +10 -10
- package/dist/{chunk-25K6KNZ5.js → chunk-22GPB6FO.js} +58 -6
- package/dist/chunk-2THPPZF2.js +81 -0
- package/dist/{chunk-K3O4MWMS.js → chunk-3MHKTBHZ.js} +1 -0
- package/dist/{chunk-UY6RQK5F.js → chunk-3N4ZEPZI.js} +1 -1
- package/dist/{chunk-SN6Z3CBF.js → chunk-3PDZQICZ.js} +1 -1
- package/dist/{chunk-CGM6BIK3.js → chunk-3S3ERUUH.js} +1 -1
- package/dist/{chunk-5EW4GKGZ.js → chunk-434A3L6O.js} +1 -1
- package/dist/{chunk-BQ4U2SYC.js → chunk-4FNJPA5O.js} +1 -1
- package/dist/{chunk-O5RJH6GU.js → chunk-4RJD3GXL.js} +1 -1
- package/dist/{chunk-3K2BCD5Y.js → chunk-5HTEMMOJ.js} +21 -4
- package/dist/{chunk-SZDSQ3AW.js → chunk-6JORPKMR.js} +3 -3
- package/dist/{chunk-DAFEIA2M.js → chunk-6MOFCQFH.js} +124 -65
- package/dist/{chunk-K62M5FIM.js → chunk-6VVSXO3M.js} +4 -4
- package/dist/{chunk-SPMVTZ7Z.js → chunk-723DSUG3.js} +3 -3
- package/dist/{chunk-5POKNLFV.js → chunk-7DTEJAIC.js} +2 -2
- package/dist/{chunk-E66FQ7IN.js → chunk-7HIWJLXK.js} +1 -1
- package/dist/{chunk-IGRQE5Y5.js → chunk-BGLXECHT.js} +2 -2
- package/dist/{chunk-BYHFW5CT.js → chunk-COOX4FXM.js} +1 -1
- package/dist/{chunk-GZLGB72W.js → chunk-CXBLK3ZA.js} +1 -1
- package/dist/{chunk-MJNI3S5H.js → chunk-EDQ4GH2D.js} +2 -2
- package/dist/{chunk-GPK2WJXA.js → chunk-EF57I73W.js} +1 -1
- package/dist/{chunk-HXYL4QX6.js → chunk-EUMLEWXO.js} +2 -2
- package/dist/{chunk-RJCZY4BY.js → chunk-FMKD6N33.js} +86 -10
- package/dist/{chunk-RN6XYY7U.js → chunk-FYJCMGTD.js} +71 -0
- package/dist/{chunk-USQF2GGF.js → chunk-H7U7FPQF.js} +82 -6
- package/dist/{chunk-FMI7SCZJ.js → chunk-HLYNKMAG.js} +1 -1
- package/dist/{chunk-BGOQFJ2H.js → chunk-HMGIQNME.js} +3 -3
- package/dist/chunk-IR4L6K5L.js +147 -0
- package/dist/chunk-ITYWLFYC.js +609 -0
- package/dist/{chunk-FFECDA24.js → chunk-JUB74GFQ.js} +2 -2
- package/dist/{chunk-D4B6SVEC.js → chunk-MKOW4EXB.js} +1 -1
- package/dist/{chunk-XWM23YJO.js → chunk-MQX47XMP.js} +2 -2
- package/dist/{chunk-IXFE5R6T.js → chunk-MZ2BL3JP.js} +2 -2
- package/dist/{chunk-WGMHQVGX.js → chunk-O2JGR7EU.js} +83 -6
- package/dist/{chunk-BV3L2S54.js → chunk-P2ZIM765.js} +1 -1
- package/dist/{chunk-DEGQESR7.js → chunk-PHCK4KQW.js} +3 -3
- package/dist/{chunk-Y2W54BET.js → chunk-PXDR3UTB.js} +8 -8
- package/dist/{chunk-ETHQJXO3.js → chunk-PYLNOBNW.js} +1 -1
- package/dist/{chunk-HXNTQP4B.js → chunk-RN6DEMC7.js} +1 -1
- package/dist/{chunk-3WMXVABU.js → chunk-S4AXKNPT.js} +1 -1
- package/dist/{chunk-X2BTDYHZ.js → chunk-SEAFDIKF.js} +13 -1
- package/dist/{chunk-QLKRYO7O.js → chunk-TCBUBBTL.js} +8 -8
- package/dist/{chunk-ZQMOF6E7.js → chunk-THFFC43M.js} +1 -1
- package/dist/{chunk-XXHDXAZV.js → chunk-VG3VVFF5.js} +1 -1
- package/dist/{chunk-P4JQGT4Q.js → chunk-VH6WU3GK.js} +2 -2
- package/dist/{chunk-AH6MV6CC.js → chunk-W4BFBCZA.js} +3 -3
- package/dist/{chunk-PVVA5SY5.js → chunk-XSOKVFQ6.js} +14 -3
- package/dist/{chunk-JUTI2DXY.js → chunk-YCL4RHFY.js} +1 -1
- package/dist/{chunk-UXD5KOND.js → chunk-YGUWCJN2.js} +2 -2
- package/dist/{chunk-AUPGTF7I.js → chunk-YOXXZAOR.js} +2 -2
- package/dist/{chunk-GPNUPCTZ.js → chunk-YXHY5F34.js} +2 -2
- package/dist/{chunk-6FJ2TJYB.js → chunk-ZDK3M72Z.js} +1 -1
- package/dist/{chunk-6H6Q4MJC.js → chunk-ZIBSTUGU.js} +1 -1
- package/dist/{chunk-LIHR5DQF.js → chunk-ZXZJLVGD.js} +1 -1
- package/dist/{co-occurrence-A2SJL5AH.js → co-occurrence-TJRQ5V7W.js} +1 -1
- package/dist/{crdt-sync-SGAW6DJQ.js → crdt-sync-RI7XPXTI.js} +1 -1
- package/dist/{crm-webhook-FBENY6FW.js → crm-webhook-AVG4F2NB.js} +2 -2
- package/dist/{cto-delegation-gate-A53RLTJZ.js → cto-delegation-gate-ZTNJLSPO.js} +7 -7
- package/dist/{daemon-orchestration-3U3XXFG7.js → daemon-orchestration-AKICH7C5.js} +10 -10
- package/dist/{exe-drift-3OUOHWAI.js → exe-drift-BPVS4MOJ.js} +2 -2
- package/dist/{exe-export-AFXTJ63F.js → exe-export-LL4CXNLT.js} +4 -4
- package/dist/{exe-import-QRZBTBBG.js → exe-import-JNKAAJ5T.js} +4 -4
- package/dist/{exe-key-BXN7WPOX.js → exe-key-C5UQ77AT.js} +1 -1
- package/dist/{fast-db-init-YVJD4JT2.js → fast-db-init-UNK4BEEO.js} +1 -1
- package/dist/gateway/index.js +6 -6
- package/dist/{git-staleness-DBFCOX65.js → git-staleness-WTJFIPHH.js} +1 -1
- package/dist/{git-task-sweep-O5CH3MKA.js → git-task-sweep-PT3RIE6W.js} +8 -8
- package/dist/{global-procedures-SL2TTCED.js → global-procedures-ZPN7KZH5.js} +2 -2
- package/dist/{graph-auto-extract-JGNJ3BB7.js → graph-auto-extract-4M4J42NA.js} +1 -1
- package/dist/hooks/bug-report-worker.js +9 -9
- package/dist/hooks/codex-stop-task-finalizer.js +9 -9
- package/dist/hooks/commit-complete.js +10 -10
- package/dist/hooks/error-recall.js +5 -5
- package/dist/hooks/exe-heartbeat-hook.js +2 -2
- package/dist/hooks/ingest.js +5 -5
- package/dist/hooks/instructions-loaded.js +3 -3
- package/dist/hooks/manifest.json +19 -19
- package/dist/hooks/notification.js +3 -3
- package/dist/hooks/post-compact.js +9 -9
- package/dist/hooks/post-tool-combined.js +4 -4
- package/dist/hooks/pre-compact.js +10 -10
- package/dist/hooks/pre-tool-use.js +13 -13
- package/dist/hooks/prompt-submit.js +29 -18
- package/dist/hooks/session-end.js +13 -13
- package/dist/hooks/session-start.js +30 -7
- package/dist/hooks/stop.js +13 -13
- package/dist/hooks/subagent-stop.js +9 -9
- package/dist/hooks/summary-worker.js +13 -13
- package/dist/index.js +15 -15
- package/dist/{installer-TAPAEWRV.js → installer-3DE2IDUZ.js} +4 -4
- package/dist/{installer-5FI6CX62.js → installer-IYELX3KG.js} +4 -4
- package/dist/{installer-HNOVAUW6.js → installer-SCWIMZT7.js} +4 -4
- package/dist/lib/cloud-sync.js +3 -3
- package/dist/lib/consolidation.js +4 -4
- package/dist/lib/database.js +1 -1
- package/dist/lib/db.js +1 -1
- package/dist/lib/employee-templates.js +3 -3
- package/dist/lib/employees.js +1 -1
- package/dist/lib/exe-daemon.js +102 -27
- package/dist/lib/hybrid-search.js +4 -4
- package/dist/lib/identity.js +1 -1
- package/dist/lib/messaging.js +8 -8
- package/dist/lib/reminders.js +2 -2
- package/dist/lib/schedules.js +4 -4
- package/dist/lib/session-registry.js +9 -1
- package/dist/lib/skill-learning.js +3 -3
- package/dist/lib/store.js +3 -3
- package/dist/lib/task-router.js +2 -2
- package/dist/lib/tasks.js +8 -8
- package/dist/lib/tmux-routing.js +7 -7
- package/dist/lib/token-spend.js +2 -2
- package/dist/mcp/register-tools.js +46 -46
- package/dist/mcp/server.js +47 -47
- package/dist/mcp/tools/complete-reminder.js +3 -3
- package/dist/mcp/tools/create-reminder.js +3 -3
- package/dist/mcp/tools/create-task.js +10 -10
- package/dist/mcp/tools/deactivate-behavior.js +4 -4
- package/dist/mcp/tools/list-reminders.js +3 -3
- package/dist/mcp/tools/list-tasks.js +10 -10
- package/dist/mcp/tools/send-message.js +10 -10
- package/dist/mcp/tools/update-task.js +9 -9
- package/dist/{mcp-http-config-6UAI2FAV.js → mcp-http-config-EWIT2DEN.js} +2 -2
- package/dist/{memory-cards-PVPUQ7MX.js → memory-cards-W4VTTFYM.js} +1 -1
- package/dist/{memory-graph-extractor-RP7ZXDTE.js → memory-graph-extractor-A3HRDXY6.js} +2 -2
- package/dist/{memory-poisoning-defense-DDBUHHGB.js → memory-poisoning-defense-MH6QBXVT.js} +1 -1
- package/dist/{memory-reflection-HLR26FXG.js → memory-reflection-RUCTWMQ5.js} +1 -1
- package/dist/{notifications-GHNYYITD.js → notifications-6GRSVIP6.js} +7 -7
- package/dist/{orchestration-events-2SVPXMK2.js → orchestration-events-MSJVUR4T.js} +6 -2
- package/dist/{orchestrator-3BDZ6OUC.js → orchestrator-QQKU4VM2.js} +9 -9
- package/dist/{plan-limits-QBNFIU45.js → plan-limits-NKUSDF3I.js} +2 -2
- package/dist/{projection-worker-B7HHFYEG.js → projection-worker-UEG6I5DV.js} +1 -1
- package/dist/{reranker-B3BOGR3A.js → reranker-JTDM3MV2.js} +1 -1
- package/dist/{review-polling-RUXU45AK.js → review-polling-MWBVXHG3.js} +8 -8
- package/dist/runtime/index.js +10 -10
- package/dist/{session-events-ICZPUGJN.js → session-events-FRB3UYJG.js} +8 -8
- package/dist/{session-kill-telemetry-OGFLFTYX.js → session-kill-telemetry-GPZUHBCT.js} +2 -2
- package/dist/{session-scope-UJI35BLD.js → session-scope-7BZTNB2X.js} +7 -7
- package/dist/{setup-wizard-M6ZZ2VNM.js → setup-wizard-2INM4CSL.js} +1 -1
- package/dist/{skill-refinement-WZL35CMY.js → skill-refinement-7C7X42Z5.js} +1 -1
- package/dist/{task-enforcement-AYHKGR45.js → task-enforcement-VB5P45ZM.js} +7 -7
- package/dist/{task-scope-EYAOY6YX.js → task-scope-ULC62J6G.js} +7 -7
- package/dist/{tasks-crud-K3UGPCPT.js → tasks-crud-IBSTM6ID.js} +9 -7
- package/dist/{tasks-review-J6LTVVO5.js → tasks-review-P4MCKBDT.js} +7 -7
- package/dist/telemetry-upload-Y3CPHI7M.js +214 -0
- package/dist/{token-budget-XU2QZEWX.js → token-budget-CO74EBTY.js} +1 -1
- package/dist/{tool-telemetry-OE57ERK7.js → tool-telemetry-5PX7A6TX.js} +3 -1
- package/dist/tui/App.js +15 -15
- package/dist/{tui-data-32OEC3DH.js → tui-data-YAT6A36V.js} +7 -7
- package/dist/{worker-gate-UIGQCEUE.js → worker-gate-27O2WEYU.js} +1 -1
- package/dist/{workflow-engine-IY7KO7DU.js → workflow-engine-4T36KCTQ.js} +2 -2
- package/dist/{worktree-VIXR2Z4J.js → worktree-QTCOX6RV.js} +7 -1
- package/package.json +1 -1
- package/release-notes.json +95 -95
- package/dist/chunk-64WZEXXA.js +0 -64
- package/dist/chunk-L63IOJ5N.js +0 -69
- package/dist/chunk-ZGQH3V2F.js +0 -254
- /package/dist/{chunk-3GFR2TX6.js → chunk-AF7A5IQ5.js} +0 -0
- /package/dist/{chunk-7SY5JOLR.js → chunk-ATKMIQXP.js} +0 -0
- /package/dist/{chunk-KCWIOR55.js → chunk-GONOOIFL.js} +0 -0
- /package/dist/{chunk-QQN7MHQG.js → chunk-ONCFSN5C.js} +0 -0
- /package/dist/{chunk-Q3MRTJLA.js → chunk-WVNWAV36.js} +0 -0
- /package/dist/{chunk-RH5NYRQH.js → chunk-XJQASQPO.js} +0 -0
- /package/dist/{chunk-LJA6RQ3L.js → chunk-YKCH4T4T.js} +0 -0
- /package/dist/{core-memory-VZ4YJVMA.js → core-memory-3QGHBERR.js} +0 -0
- /package/dist/{wiki-acl-NUUPHYWC.js → wiki-acl-WCBKBLGQ.js} +0 -0
package/dist/chunk-ZGQH3V2F.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getClient
|
|
3
|
-
} from "./chunk-K3O4MWMS.js";
|
|
4
|
-
|
|
5
|
-
// src/lib/orchestration-events.ts
|
|
6
|
-
import crypto from "crypto";
|
|
7
|
-
var SENSITIVE_PAYLOAD_KEY = /(context|prompt|secret|token|password|passphrase|recovery|raw|key)/i;
|
|
8
|
-
async function ensureOrchestrationEventsSchema(client = getClient()) {
|
|
9
|
-
await client.execute({
|
|
10
|
-
sql: `CREATE TABLE IF NOT EXISTS orchestration_events (
|
|
11
|
-
id TEXT PRIMARY KEY,
|
|
12
|
-
ts TEXT NOT NULL,
|
|
13
|
-
event_type TEXT NOT NULL,
|
|
14
|
-
source TEXT NOT NULL,
|
|
15
|
-
severity TEXT NOT NULL DEFAULT 'info',
|
|
16
|
-
task_id TEXT,
|
|
17
|
-
agent_id TEXT,
|
|
18
|
-
reviewer TEXT,
|
|
19
|
-
session_scope TEXT,
|
|
20
|
-
project_name TEXT,
|
|
21
|
-
instance_id TEXT,
|
|
22
|
-
tmux_session TEXT,
|
|
23
|
-
runtime TEXT,
|
|
24
|
-
correlation_id TEXT,
|
|
25
|
-
attempt INTEGER,
|
|
26
|
-
duration_ms INTEGER,
|
|
27
|
-
result TEXT,
|
|
28
|
-
error_code TEXT,
|
|
29
|
-
payload_json TEXT,
|
|
30
|
-
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
31
|
-
)`,
|
|
32
|
-
args: []
|
|
33
|
-
});
|
|
34
|
-
await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_ts ON orchestration_events(ts)", args: [] });
|
|
35
|
-
await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_task ON orchestration_events(task_id, ts)", args: [] });
|
|
36
|
-
await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_agent ON orchestration_events(agent_id, session_scope, ts)", args: [] });
|
|
37
|
-
await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_type ON orchestration_events(event_type, ts)", args: [] });
|
|
38
|
-
}
|
|
39
|
-
async function recordOrchestrationEvent(input) {
|
|
40
|
-
try {
|
|
41
|
-
const client = getClient();
|
|
42
|
-
await ensureOrchestrationEventsSchema(client);
|
|
43
|
-
const payloadJson = sanitizePayload(input.payload);
|
|
44
|
-
await client.execute({
|
|
45
|
-
sql: `INSERT INTO orchestration_events (
|
|
46
|
-
id, ts, event_type, source, severity,
|
|
47
|
-
task_id, agent_id, reviewer, session_scope, project_name,
|
|
48
|
-
instance_id, tmux_session, runtime, correlation_id, attempt,
|
|
49
|
-
duration_ms, result, error_code, payload_json
|
|
50
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
51
|
-
args: [
|
|
52
|
-
crypto.randomUUID(),
|
|
53
|
-
input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
54
|
-
input.eventType,
|
|
55
|
-
input.source,
|
|
56
|
-
input.severity ?? "info",
|
|
57
|
-
input.taskId ?? null,
|
|
58
|
-
input.agentId ?? null,
|
|
59
|
-
input.reviewer ?? null,
|
|
60
|
-
input.sessionScope ?? null,
|
|
61
|
-
input.projectName ?? null,
|
|
62
|
-
input.instanceId ?? null,
|
|
63
|
-
input.tmuxSession ?? null,
|
|
64
|
-
input.runtime ?? null,
|
|
65
|
-
input.correlationId ?? null,
|
|
66
|
-
input.attempt ?? null,
|
|
67
|
-
input.durationMs ?? null,
|
|
68
|
-
input.result ?? null,
|
|
69
|
-
input.errorCode ?? null,
|
|
70
|
-
payloadJson
|
|
71
|
-
]
|
|
72
|
-
});
|
|
73
|
-
return true;
|
|
74
|
-
} catch (err) {
|
|
75
|
-
if (process.env.EXE_DEBUG === "1") {
|
|
76
|
-
process.stderr.write(
|
|
77
|
-
`[orchestration-events] write skipped: ${err instanceof Error ? err.message : String(err)}
|
|
78
|
-
`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function recordOrchestrationEventBestEffort(input) {
|
|
85
|
-
void recordOrchestrationEvent(input);
|
|
86
|
-
}
|
|
87
|
-
async function getOrchestrationMetrics(input = {}) {
|
|
88
|
-
const client = getClient();
|
|
89
|
-
await ensureOrchestrationEventsSchema(client);
|
|
90
|
-
const sinceIso = input.sinceIso ?? null;
|
|
91
|
-
const result = sinceIso ? await client.execute({
|
|
92
|
-
sql: `SELECT event_type, ts, task_id, duration_ms
|
|
93
|
-
FROM orchestration_events
|
|
94
|
-
WHERE ts >= ?
|
|
95
|
-
ORDER BY ts ASC`,
|
|
96
|
-
args: [sinceIso]
|
|
97
|
-
}) : await client.execute({
|
|
98
|
-
sql: `SELECT event_type, ts, task_id, duration_ms
|
|
99
|
-
FROM orchestration_events
|
|
100
|
-
ORDER BY ts ASC`,
|
|
101
|
-
args: []
|
|
102
|
-
});
|
|
103
|
-
const rows = result.rows;
|
|
104
|
-
const taskEvents = /* @__PURE__ */ new Map();
|
|
105
|
-
const daemonTickDurations = [];
|
|
106
|
-
const counts = {
|
|
107
|
-
duplicateNudges: 0,
|
|
108
|
-
missedReviews: 0,
|
|
109
|
-
tmuxCommandTimeouts: 0,
|
|
110
|
-
claimCollisions: 0,
|
|
111
|
-
crossSessionBlocks: 0,
|
|
112
|
-
dispatchUnclaimed: 0,
|
|
113
|
-
sessionExits: 0,
|
|
114
|
-
eventLoopBlocks: 0,
|
|
115
|
-
shardCircuitOpens: 0,
|
|
116
|
-
taskBlocked: 0,
|
|
117
|
-
taskCancelled: 0,
|
|
118
|
-
checkpoints: 0,
|
|
119
|
-
messagesSent: 0,
|
|
120
|
-
reviewsCreated: 0,
|
|
121
|
-
dispatches: 0
|
|
122
|
-
};
|
|
123
|
-
for (const row of rows) {
|
|
124
|
-
const type = String(row.event_type ?? "");
|
|
125
|
-
const taskId = row.task_id == null ? "" : String(row.task_id);
|
|
126
|
-
const ts = Date.parse(String(row.ts ?? ""));
|
|
127
|
-
if (type === "nudge.duplicate") counts.duplicateNudges++;
|
|
128
|
-
if (type === "review.missed") counts.missedReviews++;
|
|
129
|
-
if (type === "tmux.command.timeout") counts.tmuxCommandTimeouts++;
|
|
130
|
-
if (type === "claim.collision") counts.claimCollisions++;
|
|
131
|
-
if (type === "session.scope_violation") counts.crossSessionBlocks++;
|
|
132
|
-
if (type === "dispatch.unclaimed") counts.dispatchUnclaimed++;
|
|
133
|
-
if (type === "session.exit") counts.sessionExits++;
|
|
134
|
-
if (type === "daemon.event_loop_blocked") counts.eventLoopBlocks++;
|
|
135
|
-
if (type === "shard.circuit_open") counts.shardCircuitOpens++;
|
|
136
|
-
if (type === "task.blocked") counts.taskBlocked++;
|
|
137
|
-
if (type === "task.cancelled") counts.taskCancelled++;
|
|
138
|
-
if (type === "task.checkpoint") counts.checkpoints++;
|
|
139
|
-
if (type === "message.sent") counts.messagesSent++;
|
|
140
|
-
if (type === "review.created") counts.reviewsCreated++;
|
|
141
|
-
if (type === "dispatch.completed") counts.dispatches++;
|
|
142
|
-
if (type === "daemon.tick.completed") {
|
|
143
|
-
const duration = Number(row.duration_ms ?? NaN);
|
|
144
|
-
if (Number.isFinite(duration)) daemonTickDurations.push(duration);
|
|
145
|
-
}
|
|
146
|
-
if (!taskId || !Number.isFinite(ts)) continue;
|
|
147
|
-
const bucket = taskEvents.get(taskId) ?? {};
|
|
148
|
-
if (type === "task.created" && bucket.created === void 0) bucket.created = ts;
|
|
149
|
-
if (type === "task.claimed" && bucket.claimed === void 0) bucket.claimed = ts;
|
|
150
|
-
if (type === "task.done" && bucket.done === void 0) bucket.done = ts;
|
|
151
|
-
if (type === "review.ready" && bucket.reviewReady === void 0) bucket.reviewReady = ts;
|
|
152
|
-
taskEvents.set(taskId, bucket);
|
|
153
|
-
}
|
|
154
|
-
const createToClaim = [];
|
|
155
|
-
const doneToReview = [];
|
|
156
|
-
for (const eventSet of taskEvents.values()) {
|
|
157
|
-
if (eventSet.created !== void 0 && eventSet.claimed !== void 0 && eventSet.claimed >= eventSet.created) {
|
|
158
|
-
createToClaim.push(eventSet.claimed - eventSet.created);
|
|
159
|
-
}
|
|
160
|
-
if (eventSet.done !== void 0 && eventSet.reviewReady !== void 0 && eventSet.reviewReady >= eventSet.done) {
|
|
161
|
-
doneToReview.push(eventSet.reviewReady - eventSet.done);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
sinceIso,
|
|
166
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
167
|
-
totalEvents: rows.length,
|
|
168
|
-
counts,
|
|
169
|
-
createToClaimMs: percentileMetric(createToClaim),
|
|
170
|
-
doneToReviewMs: percentileMetric(doneToReview),
|
|
171
|
-
daemonTickMs: percentileMetric(daemonTickDurations)
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function formatOrchestrationMetrics(metrics) {
|
|
175
|
-
const lines = [
|
|
176
|
-
"# Orchestration Metrics",
|
|
177
|
-
"",
|
|
178
|
-
`Generated: ${metrics.generatedAt}`,
|
|
179
|
-
`Since: ${metrics.sinceIso ?? "beginning"}`,
|
|
180
|
-
`Total events: ${metrics.totalEvents}`,
|
|
181
|
-
"",
|
|
182
|
-
"## Latency",
|
|
183
|
-
`- create\u2192claim: ${formatMetric(metrics.createToClaimMs)}`,
|
|
184
|
-
`- done\u2192review.ready: ${formatMetric(metrics.doneToReviewMs)}`,
|
|
185
|
-
`- daemon tick: ${formatMetric(metrics.daemonTickMs)}`,
|
|
186
|
-
"",
|
|
187
|
-
"## Task Lifecycle",
|
|
188
|
-
`- dispatches: ${metrics.counts.dispatches}`,
|
|
189
|
-
`- checkpoints: ${metrics.counts.checkpoints}`,
|
|
190
|
-
`- reviews created: ${metrics.counts.reviewsCreated}`,
|
|
191
|
-
`- tasks blocked: ${metrics.counts.taskBlocked}`,
|
|
192
|
-
`- tasks cancelled: ${metrics.counts.taskCancelled}`,
|
|
193
|
-
`- messages sent: ${metrics.counts.messagesSent}`,
|
|
194
|
-
"",
|
|
195
|
-
"## Errors & Anomalies",
|
|
196
|
-
`- claim collisions: ${metrics.counts.claimCollisions}`,
|
|
197
|
-
`- duplicate nudges: ${metrics.counts.duplicateNudges}`,
|
|
198
|
-
`- missed reviews: ${metrics.counts.missedReviews}`,
|
|
199
|
-
`- dispatch unclaimed: ${metrics.counts.dispatchUnclaimed}`,
|
|
200
|
-
`- cross-session blocks: ${metrics.counts.crossSessionBlocks}`,
|
|
201
|
-
`- tmux command timeouts: ${metrics.counts.tmuxCommandTimeouts}`,
|
|
202
|
-
"",
|
|
203
|
-
"## Daemon Health",
|
|
204
|
-
`- session exits: ${metrics.counts.sessionExits}`,
|
|
205
|
-
`- event loop blocks: ${metrics.counts.eventLoopBlocks}`,
|
|
206
|
-
`- shard circuit opens: ${metrics.counts.shardCircuitOpens}`
|
|
207
|
-
];
|
|
208
|
-
return lines.join("\n");
|
|
209
|
-
}
|
|
210
|
-
function sanitizePayload(payload) {
|
|
211
|
-
if (!payload) return null;
|
|
212
|
-
const safe = {};
|
|
213
|
-
for (const [key, value] of Object.entries(payload)) {
|
|
214
|
-
if (SENSITIVE_PAYLOAD_KEY.test(key)) continue;
|
|
215
|
-
if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
216
|
-
safe[key] = value;
|
|
217
|
-
} else if (Array.isArray(value)) {
|
|
218
|
-
safe[key] = value.filter((item) => ["string", "number", "boolean"].includes(typeof item)).slice(0, 20);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return Object.keys(safe).length > 0 ? JSON.stringify(safe) : null;
|
|
222
|
-
}
|
|
223
|
-
function percentileMetric(values) {
|
|
224
|
-
if (values.length === 0) return { count: 0, p50: null, p95: null, p99: null };
|
|
225
|
-
const sorted = [...values].sort((a, b) => a - b);
|
|
226
|
-
return {
|
|
227
|
-
count: sorted.length,
|
|
228
|
-
p50: percentile(sorted, 50),
|
|
229
|
-
p95: percentile(sorted, 95),
|
|
230
|
-
p99: percentile(sorted, 99)
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
function percentile(sorted, percentileValue) {
|
|
234
|
-
if (sorted.length === 0) return 0;
|
|
235
|
-
const rank = Math.ceil(percentileValue / 100 * sorted.length) - 1;
|
|
236
|
-
return sorted[Math.min(sorted.length - 1, Math.max(0, rank))] ?? 0;
|
|
237
|
-
}
|
|
238
|
-
function formatMetric(metric) {
|
|
239
|
-
if (metric.count === 0) return "n=0";
|
|
240
|
-
return `n=${metric.count}, p50=${formatMs(metric.p50)}, p95=${formatMs(metric.p95)}, p99=${formatMs(metric.p99)}`;
|
|
241
|
-
}
|
|
242
|
-
function formatMs(value) {
|
|
243
|
-
if (value == null) return "n/a";
|
|
244
|
-
if (value < 1e3) return `${value}ms`;
|
|
245
|
-
return `${Math.round(value / 1e3 * 10) / 10}s`;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export {
|
|
249
|
-
ensureOrchestrationEventsSchema,
|
|
250
|
-
recordOrchestrationEvent,
|
|
251
|
-
recordOrchestrationEventBestEffort,
|
|
252
|
-
getOrchestrationMetrics,
|
|
253
|
-
formatOrchestrationMetrics
|
|
254
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|