@hotmeshio/long-tail 0.4.23 → 0.4.24

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.
@@ -0,0 +1,4 @@
1
+ import type { LTApiResult } from '../types/sdk';
2
+ export declare function overview(input: {
3
+ period?: string;
4
+ }): Promise<LTApiResult>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.overview = overview;
4
+ const overview_1 = require("../services/overview");
5
+ async function overview(input) {
6
+ try {
7
+ const data = await (0, overview_1.getSystemOverview)(input.period);
8
+ return { status: 200, data };
9
+ }
10
+ catch (err) {
11
+ return { status: 500, error: err.message };
12
+ }
13
+ }
@@ -68,4 +68,6 @@ router.use('/knowledge', knowledge_1.default);
68
68
  router.use('/agents', agents_1.default);
69
69
  router.use('/capabilities', capabilities_1.default);
70
70
  router.use('/topics', topics_1.default);
71
+ const overview_1 = __importDefault(require("./overview"));
72
+ router.use('/overview', overview_1.default);
71
73
  exports.default = router;
@@ -0,0 +1,2 @@
1
+ declare const router: import("express-serve-static-core").Router;
2
+ export default router;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const express_1 = require("express");
37
+ const api = __importStar(require("../api/overview"));
38
+ const router = (0, express_1.Router)();
39
+ /**
40
+ * GET /api/overview?period=24h
41
+ * System overview — triage, throughput, trends, infrastructure, processes.
42
+ * Any authenticated user can call this.
43
+ */
44
+ router.get('/', async (req, res) => {
45
+ const result = await api.overview({
46
+ period: req.query.period || undefined,
47
+ });
48
+ res.status(result.status).json(result.data ?? { error: result.error });
49
+ });
50
+ exports.default = router;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * System overview — one call, complete picture.
3
+ *
4
+ * Composes triage, throughput, trends, infrastructure, and process
5
+ * metrics from lt_* tables. All queries run in parallel. No HotMesh
6
+ * schema dependencies — safe regardless of engine initialization state.
7
+ */
8
+ export interface SystemOverview {
9
+ period: string;
10
+ triage: {
11
+ pending: number;
12
+ claimed: number;
13
+ unclaimed: number;
14
+ aging_30m: number;
15
+ aging_1h: number;
16
+ aging_24h: number;
17
+ oldest_unclaimed_minutes: number;
18
+ created_period: number;
19
+ resolved_period: number;
20
+ resolution_rate_pct: number;
21
+ by_role: Array<{
22
+ role: string;
23
+ pending: number;
24
+ claimed: number;
25
+ }>;
26
+ };
27
+ throughput: {
28
+ tasks_pending: number;
29
+ tasks_in_progress: number;
30
+ tasks_failed: number;
31
+ tasks_created_1h: number;
32
+ tasks_completed_1h: number;
33
+ tasks_created_period: number;
34
+ tasks_completed_period: number;
35
+ tasks_failed_1h: number;
36
+ };
37
+ trends: {
38
+ escalation_creation: Array<{
39
+ hour: string;
40
+ created: number;
41
+ }>;
42
+ task_completion: Array<{
43
+ hour: string;
44
+ completed: number;
45
+ }>;
46
+ resolution_velocity: Array<{
47
+ hour: string;
48
+ created: number;
49
+ resolved: number;
50
+ }>;
51
+ };
52
+ infrastructure: {
53
+ mcp_servers: {
54
+ total: number;
55
+ connected: number;
56
+ total_tools: number;
57
+ };
58
+ compiled_workflows: {
59
+ total: number;
60
+ active: number;
61
+ };
62
+ agents: {
63
+ total: number;
64
+ active: number;
65
+ paused: number;
66
+ error: number;
67
+ stale: number;
68
+ };
69
+ workflow_configs: number;
70
+ };
71
+ processes: {
72
+ total: number;
73
+ active: number;
74
+ completed: number;
75
+ escalated: number;
76
+ };
77
+ }
78
+ export declare function getSystemOverview(period?: string): Promise<SystemOverview>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /**
3
+ * System overview — one call, complete picture.
4
+ *
5
+ * Composes triage, throughput, trends, infrastructure, and process
6
+ * metrics from lt_* tables. All queries run in parallel. No HotMesh
7
+ * schema dependencies — safe regardless of engine initialization state.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getSystemOverview = getSystemOverview;
11
+ const db_1 = require("../../lib/db");
12
+ const sql_1 = require("./sql");
13
+ const VALID_PERIODS = {
14
+ '1h': '1 hour',
15
+ '24h': '24 hours',
16
+ '7d': '7 days',
17
+ };
18
+ async function getSystemOverview(period = '24h') {
19
+ const interval = VALID_PERIODS[period] ?? VALID_PERIODS['24h'];
20
+ const pool = (0, db_1.getPool)();
21
+ // Every query is individually guarded — a single table failure
22
+ // (e.g., during migration) must not crash the entire overview.
23
+ const empty = { rows: [] };
24
+ const [escTriage, escByRole, taskThroughput, escTrends, taskTrends, resTrends, mcpInfra, compiledWf, agentHealth, wfConfigs, processSummary,] = await Promise.all([
25
+ pool.query(sql_1.OVERVIEW_ESCALATION_TRIAGE, [interval]).catch(() => empty),
26
+ pool.query(sql_1.OVERVIEW_ESCALATION_BY_ROLE).catch(() => empty),
27
+ pool.query(sql_1.OVERVIEW_TASK_THROUGHPUT, [interval]).catch(() => empty),
28
+ pool.query(sql_1.OVERVIEW_ESCALATION_TRENDS, [interval]).catch(() => empty),
29
+ pool.query(sql_1.OVERVIEW_TASK_TRENDS, [interval]).catch(() => empty),
30
+ pool.query(sql_1.OVERVIEW_RESOLUTION_TRENDS, [interval]).catch(() => empty),
31
+ pool.query(sql_1.OVERVIEW_MCP_INFRASTRUCTURE).catch(() => empty),
32
+ pool.query(sql_1.OVERVIEW_COMPILED_WORKFLOWS).catch(() => empty),
33
+ pool.query(sql_1.OVERVIEW_AGENT_HEALTH).catch(() => empty),
34
+ pool.query(sql_1.OVERVIEW_WORKFLOW_CONFIGS).catch(() => empty),
35
+ pool.query(sql_1.OVERVIEW_PROCESS_SUMMARY, [interval]).catch(() => empty),
36
+ ]);
37
+ const ZEROS = { pending: 0, claimed: 0, unclaimed: 0, aging_30m: 0, aging_1h: 0, aging_24h: 0, oldest_unclaimed_minutes: 0, created_period: 0, resolved_period: 0, in_progress: 0, failed: 0, created_1h: 0, completed_1h: 0, created_period_t: 0, completed_period: 0, failed_1h: 0, total: 0, connected: 0, total_tools: 0, active: 0, paused: 0, error: 0, stale: 0, completed: 0, escalated: 0 };
38
+ const esc = escTriage.rows[0] ?? ZEROS;
39
+ const task = taskThroughput.rows[0] ?? ZEROS;
40
+ const mcp = mcpInfra.rows[0] ?? ZEROS;
41
+ const compiled = compiledWf.rows[0] ?? ZEROS;
42
+ const agents = agentHealth.rows[0] ?? ZEROS;
43
+ const configs = wfConfigs.rows[0] ?? ZEROS;
44
+ const procs = processSummary.rows[0] ?? ZEROS;
45
+ const createdPeriod = esc.created_period || 0;
46
+ const resolvedPeriod = esc.resolved_period || 0;
47
+ const resolutionRate = createdPeriod > 0
48
+ ? Math.round((resolvedPeriod / createdPeriod) * 100)
49
+ : 0;
50
+ return {
51
+ period,
52
+ triage: {
53
+ pending: esc.pending,
54
+ claimed: esc.claimed,
55
+ unclaimed: esc.unclaimed,
56
+ aging_30m: esc.aging_30m,
57
+ aging_1h: esc.aging_1h,
58
+ aging_24h: esc.aging_24h,
59
+ oldest_unclaimed_minutes: esc.oldest_unclaimed_minutes,
60
+ created_period: createdPeriod,
61
+ resolved_period: resolvedPeriod,
62
+ resolution_rate_pct: resolutionRate,
63
+ by_role: escByRole.rows,
64
+ },
65
+ throughput: {
66
+ tasks_pending: task.pending,
67
+ tasks_in_progress: task.in_progress,
68
+ tasks_failed: task.failed,
69
+ tasks_created_1h: task.created_1h,
70
+ tasks_completed_1h: task.completed_1h,
71
+ tasks_created_period: task.created_period,
72
+ tasks_completed_period: task.completed_period,
73
+ tasks_failed_1h: task.failed_1h,
74
+ },
75
+ trends: {
76
+ escalation_creation: escTrends.rows.map((r) => ({
77
+ hour: r.hour, created: r.created,
78
+ })),
79
+ task_completion: taskTrends.rows.map((r) => ({
80
+ hour: r.hour, completed: r.completed,
81
+ })),
82
+ // Filter out zero-activity hours to keep MCP responses compact
83
+ resolution_velocity: resTrends.rows
84
+ .filter((r) => r.created > 0 || r.resolved > 0)
85
+ .map((r) => ({
86
+ hour: r.hour, created: r.created, resolved: r.resolved,
87
+ })),
88
+ },
89
+ infrastructure: {
90
+ mcp_servers: { total: mcp.total, connected: mcp.connected, total_tools: mcp.total_tools },
91
+ compiled_workflows: { total: compiled.total, active: compiled.active },
92
+ agents: {
93
+ total: agents.total, active: agents.active,
94
+ paused: agents.paused, error: agents.error, stale: agents.stale,
95
+ },
96
+ workflow_configs: configs.total,
97
+ },
98
+ processes: {
99
+ total: procs.total,
100
+ active: procs.active,
101
+ completed: procs.completed,
102
+ escalated: procs.escalated,
103
+ },
104
+ };
105
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * SQL for the system overview tool.
3
+ *
4
+ * All queries are SELECT-only, read-safe, and index-backed.
5
+ * They target only lt_* tables — no HotMesh schema dependencies.
6
+ * $1 is always the period interval (e.g., '24 hours').
7
+ */
8
+ /** Escalation queue pressure — aging buckets, claim status, period counts. */
9
+ export declare const OVERVIEW_ESCALATION_TRIAGE = "\n SELECT\n COUNT(*) FILTER (WHERE status = 'pending')::int AS pending,\n COUNT(*) FILTER (WHERE status = 'pending'\n AND assigned_to IS NOT NULL AND assigned_until > NOW())::int AS claimed,\n COUNT(*) FILTER (WHERE status = 'pending'\n AND (assigned_to IS NULL OR assigned_until <= NOW()))::int AS unclaimed,\n COUNT(*) FILTER (WHERE status = 'pending'\n AND created_at < NOW() - INTERVAL '30 minutes')::int AS aging_30m,\n COUNT(*) FILTER (WHERE status = 'pending'\n AND created_at < NOW() - INTERVAL '1 hour')::int AS aging_1h,\n COUNT(*) FILTER (WHERE status = 'pending'\n AND created_at < NOW() - INTERVAL '24 hours')::int AS aging_24h,\n COALESCE(\n EXTRACT(EPOCH FROM (NOW() - MIN(created_at) FILTER (\n WHERE status = 'pending'\n AND (assigned_to IS NULL OR assigned_until <= NOW())\n )))::int / 60, 0\n ) AS oldest_unclaimed_minutes,\n COUNT(*) FILTER (WHERE created_at > NOW() - $1::interval)::int AS created_period,\n COUNT(*) FILTER (WHERE resolved_at > NOW() - $1::interval)::int AS resolved_period\n FROM lt_escalations";
10
+ /** Escalation breakdown by role (pending only). */
11
+ export declare const OVERVIEW_ESCALATION_BY_ROLE = "\n SELECT role,\n COUNT(*)::int AS pending,\n COUNT(*) FILTER (WHERE assigned_to IS NOT NULL AND assigned_until > NOW())::int AS claimed\n FROM lt_escalations\n WHERE status = 'pending'\n GROUP BY role\n ORDER BY COUNT(*) DESC\n LIMIT 10";
12
+ /** Task creation and completion counts for 1h and the configurable period. */
13
+ export declare const OVERVIEW_TASK_THROUGHPUT = "\n SELECT\n COUNT(*) FILTER (WHERE status = 'pending')::int AS pending,\n COUNT(*) FILTER (WHERE status = 'in_progress')::int AS in_progress,\n COUNT(*) FILTER (WHERE status = 'failed')::int AS failed,\n COUNT(*) FILTER (WHERE created_at > NOW() - INTERVAL '1 hour')::int AS created_1h,\n COUNT(*) FILTER (WHERE completed_at > NOW() - INTERVAL '1 hour')::int AS completed_1h,\n COUNT(*) FILTER (WHERE created_at > NOW() - $1::interval)::int AS created_period,\n COUNT(*) FILTER (WHERE completed_at > NOW() - $1::interval)::int AS completed_period,\n COUNT(*) FILTER (WHERE status = 'failed'\n AND created_at > NOW() - INTERVAL '1 hour')::int AS failed_1h\n FROM lt_tasks";
14
+ /** Hourly escalation creation within the period. */
15
+ export declare const OVERVIEW_ESCALATION_TRENDS = "\n SELECT date_trunc('hour', created_at) AS hour, COUNT(*)::int AS created\n FROM lt_escalations\n WHERE created_at > NOW() - $1::interval\n GROUP BY 1 ORDER BY 1";
16
+ /** Hourly task completion within the period. */
17
+ export declare const OVERVIEW_TASK_TRENDS = "\n SELECT date_trunc('hour', completed_at) AS hour, COUNT(*)::int AS completed\n FROM lt_tasks\n WHERE completed_at IS NOT NULL AND completed_at > NOW() - $1::interval\n GROUP BY 1 ORDER BY 1";
18
+ /** Hourly resolution velocity — created vs resolved. */
19
+ export declare const OVERVIEW_RESOLUTION_TRENDS = "\n SELECT\n gs AS hour,\n COALESCE(c.created, 0)::int AS created,\n COALESCE(r.resolved, 0)::int AS resolved\n FROM generate_series(\n date_trunc('hour', NOW() - $1::interval),\n date_trunc('hour', NOW()),\n INTERVAL '1 hour'\n ) AS gs\n LEFT JOIN (\n SELECT date_trunc('hour', created_at) AS h, COUNT(*)::int AS created\n FROM lt_escalations WHERE created_at > NOW() - $1::interval\n GROUP BY 1\n ) c ON c.h = gs\n LEFT JOIN (\n SELECT date_trunc('hour', resolved_at) AS h, COUNT(*)::int AS resolved\n FROM lt_escalations WHERE resolved_at > NOW() - $1::interval\n GROUP BY 1\n ) r ON r.h = gs\n ORDER BY gs";
20
+ /** MCP server and tool counts. */
21
+ export declare const OVERVIEW_MCP_INFRASTRUCTURE = "\n SELECT\n COUNT(*)::int AS total,\n COUNT(*) FILTER (WHERE status = 'connected')::int AS connected,\n COALESCE(SUM(jsonb_array_length(tool_manifest)) FILTER (WHERE tool_manifest IS NOT NULL), 0)::int AS total_tools\n FROM lt_mcp_servers";
22
+ /** Compiled workflow counts. */
23
+ export declare const OVERVIEW_COMPILED_WORKFLOWS = "\n SELECT\n COUNT(*)::int AS total,\n COUNT(*) FILTER (WHERE status = 'active')::int AS active\n FROM lt_yaml_workflows";
24
+ /** Agent health snapshot. */
25
+ export declare const OVERVIEW_AGENT_HEALTH = "\n SELECT\n COUNT(*)::int AS total,\n COUNT(*) FILTER (WHERE status = 'active')::int AS active,\n COUNT(*) FILTER (WHERE status = 'paused')::int AS paused,\n COUNT(*) FILTER (WHERE status = 'error')::int AS error,\n COUNT(*) FILTER (WHERE last_run_at IS NULL\n OR last_run_at < NOW() - INTERVAL '7 days')::int AS stale\n FROM lt_agents";
26
+ /** Registered workflow config count. */
27
+ export declare const OVERVIEW_WORKFLOW_CONFIGS = "\n SELECT COUNT(*)::int AS total FROM lt_config_workflows";
28
+ /** Process summary — grouped by origin_id within the period. */
29
+ export declare const OVERVIEW_PROCESS_SUMMARY = "\n SELECT\n COUNT(DISTINCT origin_id)::int AS total,\n COUNT(DISTINCT origin_id) FILTER (\n WHERE status IN ('pending', 'in_progress'))::int AS active,\n COUNT(DISTINCT origin_id) FILTER (\n WHERE status = 'completed')::int AS completed,\n COUNT(DISTINCT origin_id) FILTER (\n WHERE status = 'needs_intervention')::int AS escalated\n FROM lt_tasks\n WHERE origin_id IS NOT NULL\n AND created_at > NOW() - $1::interval";
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ * SQL for the system overview tool.
4
+ *
5
+ * All queries are SELECT-only, read-safe, and index-backed.
6
+ * They target only lt_* tables — no HotMesh schema dependencies.
7
+ * $1 is always the period interval (e.g., '24 hours').
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.OVERVIEW_PROCESS_SUMMARY = exports.OVERVIEW_WORKFLOW_CONFIGS = exports.OVERVIEW_AGENT_HEALTH = exports.OVERVIEW_COMPILED_WORKFLOWS = exports.OVERVIEW_MCP_INFRASTRUCTURE = exports.OVERVIEW_RESOLUTION_TRENDS = exports.OVERVIEW_TASK_TRENDS = exports.OVERVIEW_ESCALATION_TRENDS = exports.OVERVIEW_TASK_THROUGHPUT = exports.OVERVIEW_ESCALATION_BY_ROLE = exports.OVERVIEW_ESCALATION_TRIAGE = void 0;
11
+ // ── Triage ──────────────────────────────────────────────────────────────────
12
+ /** Escalation queue pressure — aging buckets, claim status, period counts. */
13
+ exports.OVERVIEW_ESCALATION_TRIAGE = `
14
+ SELECT
15
+ COUNT(*) FILTER (WHERE status = 'pending')::int AS pending,
16
+ COUNT(*) FILTER (WHERE status = 'pending'
17
+ AND assigned_to IS NOT NULL AND assigned_until > NOW())::int AS claimed,
18
+ COUNT(*) FILTER (WHERE status = 'pending'
19
+ AND (assigned_to IS NULL OR assigned_until <= NOW()))::int AS unclaimed,
20
+ COUNT(*) FILTER (WHERE status = 'pending'
21
+ AND created_at < NOW() - INTERVAL '30 minutes')::int AS aging_30m,
22
+ COUNT(*) FILTER (WHERE status = 'pending'
23
+ AND created_at < NOW() - INTERVAL '1 hour')::int AS aging_1h,
24
+ COUNT(*) FILTER (WHERE status = 'pending'
25
+ AND created_at < NOW() - INTERVAL '24 hours')::int AS aging_24h,
26
+ COALESCE(
27
+ EXTRACT(EPOCH FROM (NOW() - MIN(created_at) FILTER (
28
+ WHERE status = 'pending'
29
+ AND (assigned_to IS NULL OR assigned_until <= NOW())
30
+ )))::int / 60, 0
31
+ ) AS oldest_unclaimed_minutes,
32
+ COUNT(*) FILTER (WHERE created_at > NOW() - $1::interval)::int AS created_period,
33
+ COUNT(*) FILTER (WHERE resolved_at > NOW() - $1::interval)::int AS resolved_period
34
+ FROM lt_escalations`;
35
+ /** Escalation breakdown by role (pending only). */
36
+ exports.OVERVIEW_ESCALATION_BY_ROLE = `
37
+ SELECT role,
38
+ COUNT(*)::int AS pending,
39
+ COUNT(*) FILTER (WHERE assigned_to IS NOT NULL AND assigned_until > NOW())::int AS claimed
40
+ FROM lt_escalations
41
+ WHERE status = 'pending'
42
+ GROUP BY role
43
+ ORDER BY COUNT(*) DESC
44
+ LIMIT 10`;
45
+ // ── Throughput ───────────────────────────────────────────────────────────────
46
+ /** Task creation and completion counts for 1h and the configurable period. */
47
+ exports.OVERVIEW_TASK_THROUGHPUT = `
48
+ SELECT
49
+ COUNT(*) FILTER (WHERE status = 'pending')::int AS pending,
50
+ COUNT(*) FILTER (WHERE status = 'in_progress')::int AS in_progress,
51
+ COUNT(*) FILTER (WHERE status = 'failed')::int AS failed,
52
+ COUNT(*) FILTER (WHERE created_at > NOW() - INTERVAL '1 hour')::int AS created_1h,
53
+ COUNT(*) FILTER (WHERE completed_at > NOW() - INTERVAL '1 hour')::int AS completed_1h,
54
+ COUNT(*) FILTER (WHERE created_at > NOW() - $1::interval)::int AS created_period,
55
+ COUNT(*) FILTER (WHERE completed_at > NOW() - $1::interval)::int AS completed_period,
56
+ COUNT(*) FILTER (WHERE status = 'failed'
57
+ AND created_at > NOW() - INTERVAL '1 hour')::int AS failed_1h
58
+ FROM lt_tasks`;
59
+ // ── Trends ──────────────────────────────────────────────────────────────────
60
+ /** Hourly escalation creation within the period. */
61
+ exports.OVERVIEW_ESCALATION_TRENDS = `
62
+ SELECT date_trunc('hour', created_at) AS hour, COUNT(*)::int AS created
63
+ FROM lt_escalations
64
+ WHERE created_at > NOW() - $1::interval
65
+ GROUP BY 1 ORDER BY 1`;
66
+ /** Hourly task completion within the period. */
67
+ exports.OVERVIEW_TASK_TRENDS = `
68
+ SELECT date_trunc('hour', completed_at) AS hour, COUNT(*)::int AS completed
69
+ FROM lt_tasks
70
+ WHERE completed_at IS NOT NULL AND completed_at > NOW() - $1::interval
71
+ GROUP BY 1 ORDER BY 1`;
72
+ /** Hourly resolution velocity — created vs resolved. */
73
+ exports.OVERVIEW_RESOLUTION_TRENDS = `
74
+ SELECT
75
+ gs AS hour,
76
+ COALESCE(c.created, 0)::int AS created,
77
+ COALESCE(r.resolved, 0)::int AS resolved
78
+ FROM generate_series(
79
+ date_trunc('hour', NOW() - $1::interval),
80
+ date_trunc('hour', NOW()),
81
+ INTERVAL '1 hour'
82
+ ) AS gs
83
+ LEFT JOIN (
84
+ SELECT date_trunc('hour', created_at) AS h, COUNT(*)::int AS created
85
+ FROM lt_escalations WHERE created_at > NOW() - $1::interval
86
+ GROUP BY 1
87
+ ) c ON c.h = gs
88
+ LEFT JOIN (
89
+ SELECT date_trunc('hour', resolved_at) AS h, COUNT(*)::int AS resolved
90
+ FROM lt_escalations WHERE resolved_at > NOW() - $1::interval
91
+ GROUP BY 1
92
+ ) r ON r.h = gs
93
+ ORDER BY gs`;
94
+ // ── Infrastructure ──────────────────────────────────────────────────────────
95
+ /** MCP server and tool counts. */
96
+ exports.OVERVIEW_MCP_INFRASTRUCTURE = `
97
+ SELECT
98
+ COUNT(*)::int AS total,
99
+ COUNT(*) FILTER (WHERE status = 'connected')::int AS connected,
100
+ COALESCE(SUM(jsonb_array_length(tool_manifest)) FILTER (WHERE tool_manifest IS NOT NULL), 0)::int AS total_tools
101
+ FROM lt_mcp_servers`;
102
+ /** Compiled workflow counts. */
103
+ exports.OVERVIEW_COMPILED_WORKFLOWS = `
104
+ SELECT
105
+ COUNT(*)::int AS total,
106
+ COUNT(*) FILTER (WHERE status = 'active')::int AS active
107
+ FROM lt_yaml_workflows`;
108
+ /** Agent health snapshot. */
109
+ exports.OVERVIEW_AGENT_HEALTH = `
110
+ SELECT
111
+ COUNT(*)::int AS total,
112
+ COUNT(*) FILTER (WHERE status = 'active')::int AS active,
113
+ COUNT(*) FILTER (WHERE status = 'paused')::int AS paused,
114
+ COUNT(*) FILTER (WHERE status = 'error')::int AS error,
115
+ COUNT(*) FILTER (WHERE last_run_at IS NULL
116
+ OR last_run_at < NOW() - INTERVAL '7 days')::int AS stale
117
+ FROM lt_agents`;
118
+ /** Registered workflow config count. */
119
+ exports.OVERVIEW_WORKFLOW_CONFIGS = `
120
+ SELECT COUNT(*)::int AS total FROM lt_config_workflows`;
121
+ // ── Processes ───────────────────────────────────────────────────────────────
122
+ /** Process summary — grouped by origin_id within the period. */
123
+ exports.OVERVIEW_PROCESS_SUMMARY = `
124
+ SELECT
125
+ COUNT(DISTINCT origin_id)::int AS total,
126
+ COUNT(DISTINCT origin_id) FILTER (
127
+ WHERE status IN ('pending', 'in_progress'))::int AS active,
128
+ COUNT(DISTINCT origin_id) FILTER (
129
+ WHERE status = 'completed')::int AS completed,
130
+ COUNT(DISTINCT origin_id) FILTER (
131
+ WHERE status = 'needs_intervention')::int AS escalated
132
+ FROM lt_tasks
133
+ WHERE origin_id IS NOT NULL
134
+ AND created_at > NOW() - $1::interval`;
@@ -53,7 +53,8 @@ const pipelines_1 = require("./pipelines");
53
53
  const topics_1 = require("./topics");
54
54
  const settings_1 = require("./settings");
55
55
  const exports_1 = require("./exports");
56
- const TOOL_COUNT = 71;
56
+ const overview_1 = require("./overview");
57
+ const TOOL_COUNT = 72;
57
58
  let server = null;
58
59
  async function createAdminServer(options) {
59
60
  if (server && !options?.fresh)
@@ -79,7 +80,8 @@ async function createAdminServer(options) {
79
80
  (0, topics_1.registerTopicTools)(instance); // 5 tools
80
81
  (0, settings_1.registerSettingsTools)(instance); // 1 tool
81
82
  (0, exports_1.registerExportTools)(instance); // 4 tools
82
- // Total: 71 (actual count may vary slightly)
83
+ (0, overview_1.registerOverviewTools)(instance); // 1 tool
84
+ // Total: 72
83
85
  logger_1.loggerRegistry.info(`[lt-mcp:admin] ${name} ready (${TOOL_COUNT} tools registered)`);
84
86
  return instance;
85
87
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * System overview tool — one call, complete picture.
3
+ */
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import { z } from 'zod';
6
+ export declare const systemOverviewSchema: z.ZodObject<{
7
+ period: z.ZodDefault<z.ZodOptional<z.ZodEnum<["1h", "24h", "7d"]>>>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ period: "24h" | "1h" | "7d";
10
+ }, {
11
+ period?: "24h" | "1h" | "7d" | undefined;
12
+ }>;
13
+ export declare function registerOverviewTools(server: McpServer): void;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.systemOverviewSchema = void 0;
4
+ exports.registerOverviewTools = registerOverviewTools;
5
+ const zod_1 = require("zod");
6
+ const overview_1 = require("../../../services/overview");
7
+ exports.systemOverviewSchema = zod_1.z.object({
8
+ period: zod_1.z.enum(['1h', '24h', '7d']).optional().default('24h')
9
+ .describe('Time window for trends and throughput metrics'),
10
+ });
11
+ function registerOverviewTools(server) {
12
+ server.registerTool('get_system_overview', {
13
+ title: 'Get System Overview',
14
+ description: 'Triage-ready system dashboard in one call. Returns escalation queue pressure ' +
15
+ '(aging, unclaimed, by role), task throughput (created/completed/failed), ' +
16
+ 'hourly trends (escalation creation, task completion, resolution velocity), ' +
17
+ 'infrastructure status (MCP servers, agents, compiled workflows), and ' +
18
+ 'business process summary. Use this as the first call to understand system state.',
19
+ inputSchema: exports.systemOverviewSchema,
20
+ }, async (args) => {
21
+ try {
22
+ const overview = await (0, overview_1.getSystemOverview)(args.period);
23
+ return {
24
+ content: [{ type: 'text', text: JSON.stringify(overview) }],
25
+ };
26
+ }
27
+ catch (err) {
28
+ return {
29
+ content: [{ type: 'text', text: JSON.stringify({ error: err.message }) }],
30
+ isError: true,
31
+ };
32
+ }
33
+ });
34
+ }
@@ -391,7 +391,7 @@ export declare const addEscalationChainSchema: z.ZodObject<{
391
391
  target_role: string;
392
392
  }>;
393
393
  export declare const pruneSchema: z.ZodObject<{
394
- app_id: z.ZodString;
394
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
395
395
  expire: z.ZodDefault<z.ZodOptional<z.ZodString>>;
396
396
  jobs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
397
397
  streams: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -405,11 +405,11 @@ export declare const pruneSchema: z.ZodObject<{
405
405
  prune_transient: boolean;
406
406
  entities?: string[] | undefined;
407
407
  }, {
408
- app_id: string;
409
408
  streams?: boolean | undefined;
410
409
  jobs?: boolean | undefined;
411
410
  expire?: string | undefined;
412
411
  entities?: string[] | undefined;
412
+ app_id?: string | undefined;
413
413
  prune_transient?: boolean | undefined;
414
414
  }>;
415
415
  export declare const listAgentsSchema: z.ZodObject<{
@@ -633,17 +633,17 @@ export declare const revokeBotKeySchema: z.ZodObject<{
633
633
  }>;
634
634
  export declare const listAppsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
635
635
  export declare const rollCallSchema: z.ZodObject<{
636
- app_id: z.ZodString;
636
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
637
637
  delay: z.ZodOptional<z.ZodNumber>;
638
638
  }, "strip", z.ZodTypeAny, {
639
639
  app_id: string;
640
640
  delay?: number | undefined;
641
641
  }, {
642
- app_id: string;
642
+ app_id?: string | undefined;
643
643
  delay?: number | undefined;
644
644
  }>;
645
645
  export declare const applyThrottleSchema: z.ZodObject<{
646
- appId: z.ZodString;
646
+ appId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
647
647
  throttle: z.ZodNumber;
648
648
  topic: z.ZodOptional<z.ZodString>;
649
649
  guid: z.ZodOptional<z.ZodString>;
@@ -655,14 +655,14 @@ export declare const applyThrottleSchema: z.ZodObject<{
655
655
  guid?: string | undefined;
656
656
  scope?: string | undefined;
657
657
  }, {
658
- appId: string;
659
658
  throttle: number;
659
+ appId?: string | undefined;
660
660
  topic?: string | undefined;
661
661
  guid?: string | undefined;
662
662
  scope?: string | undefined;
663
663
  }>;
664
664
  export declare const getStreamStatsSchema: z.ZodObject<{
665
- app_id: z.ZodString;
665
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
666
666
  duration: z.ZodOptional<z.ZodString>;
667
667
  stream: z.ZodOptional<z.ZodString>;
668
668
  }, "strip", z.ZodTypeAny, {
@@ -670,12 +670,12 @@ export declare const getStreamStatsSchema: z.ZodObject<{
670
670
  duration?: string | undefined;
671
671
  stream?: string | undefined;
672
672
  }, {
673
- app_id: string;
673
+ app_id?: string | undefined;
674
674
  duration?: string | undefined;
675
675
  stream?: string | undefined;
676
676
  }>;
677
677
  export declare const listStreamMessagesSchema: z.ZodObject<{
678
- namespace: z.ZodString;
678
+ namespace: z.ZodDefault<z.ZodOptional<z.ZodString>>;
679
679
  source: z.ZodString;
680
680
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
681
681
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -704,12 +704,12 @@ export declare const listStreamMessagesSchema: z.ZodObject<{
704
704
  aid?: string | undefined;
705
705
  }, {
706
706
  source: string;
707
- namespace: string;
708
707
  status?: string | undefined;
709
708
  limit?: number | undefined;
710
709
  offset?: number | undefined;
711
710
  workflow_name?: string | undefined;
712
711
  topic?: string | undefined;
712
+ namespace?: string | undefined;
713
713
  sort_by?: string | undefined;
714
714
  order?: "asc" | "desc" | undefined;
715
715
  stream_name?: string | undefined;
@@ -718,14 +718,14 @@ export declare const listStreamMessagesSchema: z.ZodObject<{
718
718
  aid?: string | undefined;
719
719
  }>;
720
720
  export declare const listPipelineEntitiesSchema: z.ZodObject<{
721
- app_id: z.ZodString;
721
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
722
722
  }, "strip", z.ZodTypeAny, {
723
723
  app_id: string;
724
724
  }, {
725
- app_id: string;
725
+ app_id?: string | undefined;
726
726
  }>;
727
727
  export declare const listPipelineJobsSchema: z.ZodObject<{
728
- app_id: z.ZodString;
728
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
729
729
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
730
730
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
731
731
  entity: z.ZodOptional<z.ZodString>;
@@ -743,8 +743,8 @@ export declare const listPipelineJobsSchema: z.ZodObject<{
743
743
  sort_by?: string | undefined;
744
744
  order?: "asc" | "desc" | undefined;
745
745
  }, {
746
- app_id: string;
747
746
  status?: string | undefined;
747
+ app_id?: string | undefined;
748
748
  entity?: string | undefined;
749
749
  search?: string | undefined;
750
750
  limit?: number | undefined;
@@ -754,26 +754,26 @@ export declare const listPipelineJobsSchema: z.ZodObject<{
754
754
  }>;
755
755
  export declare const getJobExecutionSchema: z.ZodObject<{
756
756
  job_id: z.ZodString;
757
- app_id: z.ZodString;
757
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
758
758
  }, "strip", z.ZodTypeAny, {
759
759
  app_id: string;
760
760
  job_id: string;
761
761
  }, {
762
- app_id: string;
763
762
  job_id: string;
763
+ app_id?: string | undefined;
764
764
  }>;
765
765
  export declare const interruptJobSchema: z.ZodObject<{
766
766
  job_id: z.ZodString;
767
767
  topic: z.ZodString;
768
- app_id: z.ZodString;
768
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
769
769
  }, "strip", z.ZodTypeAny, {
770
770
  app_id: string;
771
771
  job_id: string;
772
772
  topic: string;
773
773
  }, {
774
- app_id: string;
775
774
  job_id: string;
776
775
  topic: string;
776
+ app_id?: string | undefined;
777
777
  }>;
778
778
  export declare const listTopicsSchema: z.ZodObject<{
779
779
  category: z.ZodOptional<z.ZodString>;
@@ -951,7 +951,7 @@ export declare const updatePrioritySchema: z.ZodObject<{
951
951
  }>;
952
952
  export declare const getSettingsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
953
953
  export declare const listExportJobsSchema: z.ZodObject<{
954
- app_id: z.ZodString;
954
+ app_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
955
955
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
956
956
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
957
957
  entity: z.ZodOptional<z.ZodString>;
@@ -971,9 +971,9 @@ export declare const listExportJobsSchema: z.ZodObject<{
971
971
  sort_by?: string | undefined;
972
972
  order?: "asc" | "desc" | undefined;
973
973
  }, {
974
- app_id: string;
975
974
  status?: string | undefined;
976
975
  registered?: string | undefined;
976
+ app_id?: string | undefined;
977
977
  entity?: string | undefined;
978
978
  search?: string | undefined;
979
979
  limit?: number | undefined;
@@ -20,7 +20,7 @@ exports.findTasksSchema = zod_1.z.object({
20
20
  workflow_type: zod_1.z.string().optional().describe('Filter by workflow type name'),
21
21
  workflow_id: zod_1.z.string().optional().describe('Filter by workflow execution ID'),
22
22
  origin_id: zod_1.z.string().optional().describe('Filter by origin/process ID'),
23
- limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
23
+ limit: zod_1.z.number().int().min(1).max(100).optional().default(5),
24
24
  offset: zod_1.z.number().int().min(0).optional().default(0),
25
25
  });
26
26
  exports.getProcessDetailSchema = zod_1.z.object({
@@ -32,7 +32,7 @@ exports.findEscalationsSchema = zod_1.z.object({
32
32
  role: zod_1.z.string().optional().describe('Filter by target role'),
33
33
  type: zod_1.z.string().optional().describe('Filter by escalation type'),
34
34
  priority: zod_1.z.number().int().min(1).max(4).optional().describe('Filter by priority (1=critical, 4=low)'),
35
- limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
35
+ limit: zod_1.z.number().int().min(1).max(100).optional().default(5),
36
36
  offset: zod_1.z.number().int().min(0).optional().default(0),
37
37
  });
38
38
  exports.getEscalationStatsSchema = zod_1.z.object({
@@ -170,7 +170,7 @@ exports.addEscalationChainSchema = zod_1.z.object({
170
170
  });
171
171
  // ── maintenance (routes/dba.ts) ─────────────────────────────────────────────
172
172
  exports.pruneSchema = zod_1.z.object({
173
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
173
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
174
174
  expire: zod_1.z.string().optional().default('7 days').describe('Retention period (PostgreSQL interval)'),
175
175
  jobs: zod_1.z.boolean().optional().default(true).describe('Hard-delete expired jobs'),
176
176
  streams: zod_1.z.boolean().optional().default(true).describe('Hard-delete expired streams'),
@@ -181,7 +181,7 @@ exports.pruneSchema = zod_1.z.object({
181
181
  exports.listAgentsSchema = zod_1.z.object({
182
182
  status: zod_1.z.string().optional().describe('Filter by agent status'),
183
183
  knowledge_domain: zod_1.z.string().optional().describe('Filter by knowledge domain'),
184
- limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
184
+ limit: zod_1.z.number().int().min(1).max(100).optional().default(5),
185
185
  offset: zod_1.z.number().int().min(0).optional().default(0),
186
186
  });
187
187
  exports.getAgentSchema = zod_1.z.object({
@@ -264,25 +264,25 @@ exports.revokeBotKeySchema = zod_1.z.object({
264
264
  // ── control plane (routes/controlplane.ts) ──────────────────────────────────
265
265
  exports.listAppsSchema = zod_1.z.object({});
266
266
  exports.rollCallSchema = zod_1.z.object({
267
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
267
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
268
268
  delay: zod_1.z.number().int().optional().describe('Delay in ms before roll call'),
269
269
  });
270
270
  exports.applyThrottleSchema = zod_1.z.object({
271
- appId: zod_1.z.string().describe('HotMesh application namespace (required)'),
271
+ appId: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
272
272
  throttle: zod_1.z.number().int().describe('Throttle value (messages per second)'),
273
273
  topic: zod_1.z.string().optional().describe('Topic to throttle'),
274
274
  guid: zod_1.z.string().optional().describe('Specific GUID to throttle'),
275
275
  scope: zod_1.z.string().optional().describe('Throttle scope'),
276
276
  });
277
277
  exports.getStreamStatsSchema = zod_1.z.object({
278
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
278
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
279
279
  duration: zod_1.z.string().optional().describe('Stats duration window'),
280
280
  stream: zod_1.z.string().optional().describe('Specific stream name'),
281
281
  });
282
282
  exports.listStreamMessagesSchema = zod_1.z.object({
283
- namespace: zod_1.z.string().describe('App namespace'),
283
+ namespace: zod_1.z.string().optional().default('durable').describe('App namespace (default: durable)'),
284
284
  source: zod_1.z.string().describe('Message source'),
285
- limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
285
+ limit: zod_1.z.number().int().min(1).max(100).optional().default(5),
286
286
  offset: zod_1.z.number().int().min(0).optional().default(0),
287
287
  sort_by: zod_1.z.string().optional().describe('Sort field'),
288
288
  order: zod_1.z.enum(['asc', 'desc']).optional().describe('Sort order'),
@@ -296,11 +296,11 @@ exports.listStreamMessagesSchema = zod_1.z.object({
296
296
  });
297
297
  // ── pipelines (routes/pipelines.ts) ─────────────────────────────────────────
298
298
  exports.listPipelineEntitiesSchema = zod_1.z.object({
299
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
299
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
300
300
  });
301
301
  exports.listPipelineJobsSchema = zod_1.z.object({
302
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
303
- limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
302
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
303
+ limit: zod_1.z.number().int().min(1).max(100).optional().default(5),
304
304
  offset: zod_1.z.number().int().min(0).optional().default(0),
305
305
  entity: zod_1.z.string().optional().describe('Filter by entity type'),
306
306
  search: zod_1.z.string().optional().describe('Search term'),
@@ -310,12 +310,12 @@ exports.listPipelineJobsSchema = zod_1.z.object({
310
310
  });
311
311
  exports.getJobExecutionSchema = zod_1.z.object({
312
312
  job_id: zod_1.z.string().describe('Job ID to retrieve'),
313
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
313
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
314
314
  });
315
315
  exports.interruptJobSchema = zod_1.z.object({
316
316
  job_id: zod_1.z.string().describe('Job ID to interrupt'),
317
317
  topic: zod_1.z.string().describe('Topic of the job'),
318
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
318
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
319
319
  });
320
320
  // ── topics (routes/topics.ts) ───────────────────────────────────────────────
321
321
  exports.listTopicsSchema = zod_1.z.object({
@@ -351,7 +351,7 @@ exports.findByMetadataSchema = zod_1.z.object({
351
351
  key: zod_1.z.string().describe('Metadata key to search'),
352
352
  value: zod_1.z.string().describe('Metadata value to match'),
353
353
  status: zod_1.z.string().optional().describe('Filter by escalation status'),
354
- limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
354
+ limit: zod_1.z.number().int().min(1).max(100).optional().default(5),
355
355
  offset: zod_1.z.number().int().min(0).optional().default(0),
356
356
  });
357
357
  exports.claimByMetadataSchema = zod_1.z.object({
@@ -389,8 +389,8 @@ exports.updatePrioritySchema = zod_1.z.object({
389
389
  exports.getSettingsSchema = zod_1.z.object({});
390
390
  // ── exports (routes/exports.ts) ─────────────────────────────────────────────
391
391
  exports.listExportJobsSchema = zod_1.z.object({
392
- app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
393
- limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
392
+ app_id: zod_1.z.string().optional().default('durable').describe('HotMesh application namespace (default: durable)'),
393
+ limit: zod_1.z.number().int().min(1).max(100).optional().default(5),
394
394
  offset: zod_1.z.number().int().min(0).optional().default(0),
395
395
  entity: zod_1.z.string().optional().describe('Filter by entity type'),
396
396
  search: zod_1.z.string().optional().describe('Search term'),
@@ -360,6 +360,8 @@ export declare const ADMIN_TOOLS: ({
360
360
  properties: {
361
361
  period: {
362
362
  type: string;
363
+ enum?: undefined;
364
+ description?: undefined;
363
365
  };
364
366
  status?: undefined;
365
367
  workflow_type?: undefined;
@@ -6590,4 +6592,116 @@ export declare const ADMIN_TOOLS: ({
6590
6592
  };
6591
6593
  required: string[];
6592
6594
  };
6595
+ } | {
6596
+ name: string;
6597
+ description: string;
6598
+ read_safe: boolean;
6599
+ inputSchema: {
6600
+ type: string;
6601
+ properties: {
6602
+ period: {
6603
+ type: string;
6604
+ enum: string[];
6605
+ description: string;
6606
+ };
6607
+ status?: undefined;
6608
+ workflow_type?: undefined;
6609
+ workflow_id?: undefined;
6610
+ origin_id?: undefined;
6611
+ limit?: undefined;
6612
+ offset?: undefined;
6613
+ role?: undefined;
6614
+ type?: undefined;
6615
+ priority?: undefined;
6616
+ id?: undefined;
6617
+ duration_minutes?: undefined;
6618
+ ids?: undefined;
6619
+ hint?: undefined;
6620
+ key?: undefined;
6621
+ value?: undefined;
6622
+ durationMinutes?: undefined;
6623
+ assignee?: undefined;
6624
+ metadata?: undefined;
6625
+ provisionIfAbsent?: undefined;
6626
+ resolverPayload?: undefined;
6627
+ targetUserId?: undefined;
6628
+ targetRole?: undefined;
6629
+ invocable?: undefined;
6630
+ task_queue?: undefined;
6631
+ default_role?: undefined;
6632
+ description?: undefined;
6633
+ execute_as?: undefined;
6634
+ roles?: undefined;
6635
+ invocation_roles?: undefined;
6636
+ consumes?: undefined;
6637
+ tool_tags?: undefined;
6638
+ cron_schedule?: undefined;
6639
+ include_system?: undefined;
6640
+ data?: undefined;
6641
+ tags?: undefined;
6642
+ search?: undefined;
6643
+ name?: undefined;
6644
+ auto_connect?: undefined;
6645
+ app_id?: undefined;
6646
+ source_workflow_id?: undefined;
6647
+ workflow_name?: undefined;
6648
+ compilation_feedback?: undefined;
6649
+ sync?: undefined;
6650
+ timeout?: undefined;
6651
+ external_id?: undefined;
6652
+ display_name?: undefined;
6653
+ email?: undefined;
6654
+ user_id?: undefined;
6655
+ source_role?: undefined;
6656
+ target_role?: undefined;
6657
+ expire?: undefined;
6658
+ jobs?: undefined;
6659
+ streams?: undefined;
6660
+ entities?: undefined;
6661
+ prune_transient?: undefined;
6662
+ knowledge_domain?: undefined;
6663
+ goals?: undefined;
6664
+ rules?: undefined;
6665
+ schedules?: undefined;
6666
+ subscriptions?: undefined;
6667
+ agent_id?: undefined;
6668
+ topic?: undefined;
6669
+ reaction_type?: undefined;
6670
+ pipeline_id?: undefined;
6671
+ mcp_prompt?: undefined;
6672
+ input_mapping?: undefined;
6673
+ filter?: undefined;
6674
+ scopes?: undefined;
6675
+ expires_at?: undefined;
6676
+ key_id?: undefined;
6677
+ delay?: undefined;
6678
+ appId?: undefined;
6679
+ throttle?: undefined;
6680
+ guid?: undefined;
6681
+ scope?: undefined;
6682
+ duration?: undefined;
6683
+ stream?: undefined;
6684
+ namespace?: undefined;
6685
+ source?: undefined;
6686
+ sort_by?: undefined;
6687
+ order?: undefined;
6688
+ stream_name?: undefined;
6689
+ msg_type?: undefined;
6690
+ jid?: undefined;
6691
+ aid?: undefined;
6692
+ entity?: undefined;
6693
+ job_id?: undefined;
6694
+ category?: undefined;
6695
+ payload_schema?: undefined;
6696
+ example_payload?: undefined;
6697
+ allow?: undefined;
6698
+ block?: undefined;
6699
+ values?: undefined;
6700
+ excludeSystem?: undefined;
6701
+ omitResults?: undefined;
6702
+ mode?: undefined;
6703
+ maxDepth?: undefined;
6704
+ };
6705
+ required?: undefined;
6706
+ };
6593
6707
  })[];
@@ -91,4 +91,6 @@ exports.ADMIN_TOOLS = [
91
91
  { name: 'export_workflow_state', description: 'Export the full workflow state using HotMesh durable export.', read_safe: true, inputSchema: { type: 'object', properties: { workflow_id: { type: 'string' }, allow: { type: 'array', items: { type: 'string' } }, block: { type: 'array', items: { type: 'string' } }, values: { type: 'object' } }, required: ['workflow_id'] } },
92
92
  { name: 'export_workflow_execution', description: 'Export workflow state as a structured execution event history.', read_safe: true, inputSchema: { type: 'object', properties: { workflow_id: { type: 'string' }, excludeSystem: { type: 'boolean' }, omitResults: { type: 'boolean' }, mode: { type: 'string' }, maxDepth: { type: 'integer' } }, required: ['workflow_id'] } },
93
93
  { name: 'get_export_status', description: 'Return the numeric status semaphore for a workflow.', read_safe: true, inputSchema: { type: 'object', properties: { workflow_id: { type: 'string' } }, required: ['workflow_id'] } },
94
+ // ── overview.ts ─────────────────────────────────────────────────────────
95
+ { name: 'get_system_overview', description: 'Triage-ready system dashboard: escalation queue pressure, task throughput, hourly trends, infrastructure status, and process summary. One call for complete system state.', read_safe: true, inputSchema: { type: 'object', properties: { period: { type: 'string', enum: ['1h', '24h', '7d'], description: 'Time window (default: 24h)' } } } },
94
96
  ];
@@ -1 +1 @@
1
- {"root":["../index.ts","../vitest.config.ts","../vitest.integration.config.ts","../adapters/express.ts","../api/agent-subscriptions.ts","../api/agents.ts","../api/auth-sso.ts","../api/auth.ts","../api/bot-accounts.ts","../api/capabilities.ts","../api/controlplane.ts","../api/dba.ts","../api/exports.ts","../api/files.ts","../api/index.ts","../api/insight.ts","../api/knowledge.ts","../api/maintenance.ts","../api/namespaces.ts","../api/pipelines.ts","../api/roles.ts","../api/settings.ts","../api/tasks.ts","../api/topics.ts","../api/users.ts","../api/workflow-sets.ts","../api/escalations/bulk.ts","../api/escalations/claim.ts","../api/escalations/create.ts","../api/escalations/helpers.ts","../api/escalations/index.ts","../api/escalations/list.ts","../api/escalations/metadata.ts","../api/escalations/resolve.ts","../api/escalations/single.ts","../api/mcp/index.ts","../api/mcp/servers.ts","../api/mcp/tools.ts","../api/workflows/config.ts","../api/workflows/discovery.ts","../api/workflows/index.ts","../api/workflows/invocation.ts","../api/yaml-workflows/cron.ts","../api/yaml-workflows/crud.ts","../api/yaml-workflows/deploy.ts","../api/yaml-workflows/helpers.ts","../api/yaml-workflows/index.ts","../api/yaml-workflows/versions.ts","../bin/ltc.ts","../lib/cli/auth.ts","../lib/cli/client.ts","../lib/cli/compile.ts","../lib/cli/format.ts","../lib/cli/init.ts","../lib/cli/output.ts","../lib/cli/scanner.ts","../lib/cli/types.ts","../lib/cli/commands/escalations.ts","../lib/cli/commands/knowledge.ts","../lib/cli/commands/mcp.ts","../lib/cli/commands/pipelines.ts","../lib/cli/commands/status.ts","../lib/cli/commands/streams.ts","../lib/cli/commands/users.ts","../lib/cli/commands/workflows.ts","../lib/db/index.ts","../lib/db/migrate.ts","../lib/events/callback.ts","../lib/events/index.ts","../lib/events/matching.ts","../lib/events/memory.ts","../lib/events/nats-ws-proxy.ts","../lib/events/nats.ts","../lib/events/publish.ts","../lib/events/socketio.ts","../lib/logger/index.ts","../lib/logger/pino.ts","../lib/storage/index.ts","../lib/storage/local.ts","../lib/storage/mime.ts","../lib/storage/s3.ts","../lib/storage/types.ts","../lib/telemetry/honeycomb.ts","../lib/telemetry/index.ts","../modules/auth.ts","../modules/config.ts","../modules/defaults.ts","../modules/ltconfig.ts","../modules/maintenance.ts","../modules/sso.ts","../modules/utils.ts","../routes/agents.ts","../routes/auth-sso.ts","../routes/auth.ts","../routes/bot-accounts.ts","../routes/capabilities.ts","../routes/controlplane.ts","../routes/dba.ts","../routes/delegation.ts","../routes/docs.ts","../routes/exports.ts","../routes/file-browser.ts","../routes/files.ts","../routes/index.ts","../routes/insight.ts","../routes/knowledge.ts","../routes/maintenance.ts","../routes/mcp-endpoint.ts","../routes/mcp.ts","../routes/namespaces.ts","../routes/nats-credentials.ts","../routes/oauth.ts","../routes/pipelines.ts","../routes/roles.ts","../routes/settings.ts","../routes/tasks.ts","../routes/topics.ts","../routes/users.ts","../routes/workflow-sets.ts","../routes/escalations/bulk.ts","../routes/escalations/index.ts","../routes/escalations/list.ts","../routes/escalations/metadata.ts","../routes/escalations/resolve.ts","../routes/escalations/single.ts","../routes/workflows/config.ts","../routes/workflows/discovery.ts","../routes/workflows/index.ts","../routes/workflows/invocation.ts","../routes/yaml-workflows/cron.ts","../routes/yaml-workflows/crud.ts","../routes/yaml-workflows/deployment.ts","../routes/yaml-workflows/index.ts","../routes/yaml-workflows/versions.ts","../scripts/process-helpers.ts","../scripts/process.ts","../scripts/token.ts","../sdk/index.ts","../services/dba.ts","../services/hotmesh-utils.ts","../services/workflow-invocation.ts","../services/agent/index.ts","../services/agent/input-mapper.ts","../services/agent/sql.ts","../services/agent/subscription-sql.ts","../services/agent/subscriptions.ts","../services/agent/trigger-registry.ts","../services/auth/bot-api-key.ts","../services/auth/delegation.ts","../services/auth/index.ts","../services/auth/service-token.ts","../services/auth/sql.ts","../services/config/cache.ts","../services/config/index.ts","../services/config/provider.ts","../services/config/read.ts","../services/config/sql.ts","../services/config/write.ts","../services/controlplane/index.ts","../services/controlplane/quorum-bridge.ts","../services/controlplane/sql.ts","../services/controlplane/stream-messages-sql.ts","../services/controlplane/types.ts","../services/cron/index.ts","../services/escalation/bulk.ts","../services/escalation/crud.ts","../services/escalation/index.ts","../services/escalation/queries.ts","../services/escalation/sql.ts","../services/escalation/types.ts","../services/escalation-strategy/default.ts","../services/escalation-strategy/index.ts","../services/escalation-strategy/mcp.ts","../services/export/client.ts","../services/export/index.ts","../services/export/post-process.ts","../services/export/types.ts","../services/iam/activity.ts","../services/iam/bots.ts","../services/iam/context.ts","../services/iam/credentials.ts","../services/iam/envelope.ts","../services/iam/ephemeral.ts","../services/iam/index.ts","../services/iam/principal.ts","../services/iam/resolve.ts","../services/iam/sql.ts","../services/insight/index.ts","../services/insight/prompts.ts","../services/interceptor/activity-interceptor.ts","../services/interceptor/completion.ts","../services/interceptor/context.ts","../services/interceptor/escalation.ts","../services/interceptor/index.ts","../services/interceptor/lifecycle.ts","../services/interceptor/state.ts","../services/interceptor/types.ts","../services/interceptor/activities/config.ts","../services/interceptor/activities/escalation.ts","../services/interceptor/activities/index.ts","../services/interceptor/activities/task.ts","../services/interceptor/activities/workflow.ts","../services/llm/detect.ts","../services/llm/index.ts","../services/llm/translate.ts","../services/llm/types.ts","../services/llm/providers/anthropic.ts","../services/llm/providers/openai.ts","../services/maintenance/index.ts","../services/mcp/adapter.ts","../services/mcp/db.ts","../services/mcp/exposure.ts","../services/mcp/external-server.ts","../services/mcp/index.ts","../services/mcp/register-tool.ts","../services/mcp/seed-service-account.ts","../services/mcp/server-lifecycle.ts","../services/mcp/server-tools.ts","../services/mcp/server.ts","../services/mcp/sql.ts","../services/mcp/types.ts","../services/mcp/workflow-compiler-server.ts","../services/mcp/workflow-server.ts","../services/mcp/client/connection-dispatch.ts","../services/mcp/client/connection-lifecycle.ts","../services/mcp/client/connection-test.ts","../services/mcp/client/connection.ts","../services/mcp/client/index.ts","../services/mcp/client/tools.ts","../services/mcp/db-server/index.ts","../services/mcp/db-server/schemas.ts","../services/mcp/db-server/tools.ts","../services/mcp/playwright-server/index.ts","../services/mcp/playwright-server/lifecycle.ts","../services/mcp/playwright-server/schemas.ts","../services/mcp/playwright-server/tools.ts","../services/namespace/index.ts","../services/namespace/sql.ts","../services/namespace/types.ts","../services/oauth/crypto.ts","../services/oauth/db.ts","../services/oauth/index.ts","../services/oauth/sql.ts","../services/oauth/state.ts","../services/oauth/providers/anthropic.ts","../services/oauth/providers/github.ts","../services/oauth/providers/google.ts","../services/oauth/providers/index.ts","../services/oauth/providers/microsoft.ts","../services/oauth/providers/mock.ts","../services/oauth/providers/registry.ts","../services/oauth/providers/types.ts","../services/orchestrator/condition.ts","../services/orchestrator/index.ts","../services/orchestrator/types.ts","../services/pipelines/enrichment.ts","../services/pipelines/events.ts","../services/pipelines/execution-builder.ts","../services/pipelines/index.ts","../services/pipelines/queries.ts","../services/pipelines/sql.ts","../services/pipelines/types.ts","../services/role/index.ts","../services/role/sql.ts","../services/role/types.ts","../services/task/crud.ts","../services/task/index.ts","../services/task/process.ts","../services/task/resolve.ts","../services/task/sql.ts","../services/task/types.ts","../services/topics/index.ts","../services/topics/sql.ts","../services/topics/system-topics.ts","../services/user/auth.ts","../services/user/crud.ts","../services/user/index.ts","../services/user/rbac.ts","../services/user/roles.ts","../services/user/seed-admin.ts","../services/user/sql.ts","../services/user/sso-provision.ts","../services/user/types.ts","../services/workers/registry.ts","../services/workflow-sets/db.ts","../services/workflow-sets/index.ts","../services/workflow-sets/sql.ts","../services/yaml-workflow/builder-regenerate.ts","../services/yaml-workflow/db-utils.ts","../services/yaml-workflow/db-versions.ts","../services/yaml-workflow/db.ts","../services/yaml-workflow/deployer-helpers.ts","../services/yaml-workflow/deployer.ts","../services/yaml-workflow/generator.ts","../services/yaml-workflow/index.ts","../services/yaml-workflow/input-analyzer-helpers.ts","../services/yaml-workflow/input-analyzer.ts","../services/yaml-workflow/invoke.ts","../services/yaml-workflow/sql.ts","../services/yaml-workflow/types.ts","../services/yaml-workflow/durable-compiler/index.ts","../services/yaml-workflow/durable-compiler/parser.ts","../services/yaml-workflow/durable-compiler/prompts.ts","../services/yaml-workflow/durable-compiler/types.ts","../services/yaml-workflow/pattern-detector/array-source.ts","../services/yaml-workflow/pattern-detector/collapse.ts","../services/yaml-workflow/pattern-detector/index.ts","../services/yaml-workflow/pattern-detector/run-detection.ts","../services/yaml-workflow/pattern-detector/types.ts","../services/yaml-workflow/pipeline/analyze.ts","../services/yaml-workflow/pipeline/extract-helpers.ts","../services/yaml-workflow/pipeline/extract.ts","../services/yaml-workflow/pipeline/index.ts","../services/yaml-workflow/pipeline/prompt-templates.ts","../services/yaml-workflow/pipeline/prompts.ts","../services/yaml-workflow/pipeline/validate.ts","../services/yaml-workflow/pipeline/build/dag-assembly.ts","../services/yaml-workflow/pipeline/build/dag.ts","../services/yaml-workflow/pipeline/build/index.ts","../services/yaml-workflow/pipeline/build/iteration.ts","../services/yaml-workflow/pipeline/build/metadata.ts","../services/yaml-workflow/pipeline/build/transform.ts","../services/yaml-workflow/pipeline/build/utils.ts","../services/yaml-workflow/pipeline/build/wiring.ts","../services/yaml-workflow/pipeline/compile/index.ts","../services/yaml-workflow/pipeline/compile/llm-call.ts","../services/yaml-workflow/pipeline/compile/parse-plan.ts","../services/yaml-workflow/pipeline/compile/summarize.ts","../services/yaml-workflow/workers/callbacks.ts","../services/yaml-workflow/workers/events.ts","../services/yaml-workflow/workers/index.ts","../services/yaml-workflow/workers/register.ts","../services/yaml-workflow/workers/scope.ts","../start/adapters.ts","../start/config.ts","../start/index.ts","../start/server.ts","../start/socket-auth.ts","../start/workers.ts","../system/index.ts","../system/activities/claude-code.ts","../system/activities/file-storage.ts","../system/activities/http.ts","../system/activities/knowledge.ts","../system/activities/oauth.ts","../system/activities/schema-exchange.ts","../system/activities/sql.ts","../system/activities/triage/cache.ts","../system/activities/triage/context.ts","../system/activities/triage/discovery.ts","../system/activities/triage/index.ts","../system/activities/triage/llm.ts","../system/activities/triage/tools.ts","../system/mcp-servers/claude-code.ts","../system/mcp-servers/docs.ts","../system/mcp-servers/events.ts","../system/mcp-servers/file-storage.ts","../system/mcp-servers/http-fetch.ts","../system/mcp-servers/human-queue-schemas.ts","../system/mcp-servers/human-queue.ts","../system/mcp-servers/knowledge.ts","../system/mcp-servers/oauth.ts","../system/mcp-servers/schema-exchange.ts","../system/mcp-servers/translation.ts","../system/mcp-servers/vision-prompts.ts","../system/mcp-servers/vision.ts","../system/mcp-servers/workflow-compiler.ts","../system/mcp-servers/workflow.ts","../system/mcp-servers/admin/agent-subscriptions.ts","../system/mcp-servers/admin/agents.ts","../system/mcp-servers/admin/bot-accounts.ts","../system/mcp-servers/admin/controlplane.ts","../system/mcp-servers/admin/escalations.ts","../system/mcp-servers/admin/exports.ts","../system/mcp-servers/admin/index.ts","../system/mcp-servers/admin/maintenance.ts","../system/mcp-servers/admin/mcp-servers.ts","../system/mcp-servers/admin/pipelines.ts","../system/mcp-servers/admin/schemas.ts","../system/mcp-servers/admin/settings.ts","../system/mcp-servers/admin/tasks.ts","../system/mcp-servers/admin/topics.ts","../system/mcp-servers/admin/users.ts","../system/mcp-servers/admin/workflow-config.ts","../system/mcp-servers/admin/workflows.ts","../system/mcp-servers/admin/yaml-workflows.ts","../system/mcp-servers/db-query/index.ts","../system/mcp-servers/db-query/schemas.ts","../system/mcp-servers/db-query/tools.ts","../system/seed/index.ts","../system/seed/tool-manifests-admin.ts","../system/seed/tool-manifests-data.ts","../system/seed/tool-manifests-escalation.ts","../system/seed/tool-manifests-events.ts","../system/seed/tool-manifests-knowledge.ts","../system/seed/tool-manifests-workflows.ts","../system/workflows/tool-result-guard.ts","../system/workflows/capability-invoke/activities.ts","../system/workflows/capability-invoke/index.ts","../system/workflows/mcp-deterministic/activities.ts","../system/workflows/mcp-deterministic/index.ts","../system/workflows/mcp-query/index.ts","../system/workflows/mcp-query/prompts.ts","../system/workflows/mcp-query/strategy-advisors.ts","../system/workflows/mcp-query/types.ts","../system/workflows/mcp-query/activities/caches.ts","../system/workflows/mcp-query/activities/discovery.ts","../system/workflows/mcp-query/activities/index.ts","../system/workflows/mcp-query/activities/llm.ts","../system/workflows/mcp-query/activities/tool-executor.ts","../system/workflows/mcp-query/activities/tool-loader.ts","../system/workflows/mcp-query-router/activities.ts","../system/workflows/mcp-query-router/index.ts","../system/workflows/mcp-query-router/prompts.ts","../system/workflows/mcp-triage/activities-proxy.ts","../system/workflows/mcp-triage/index.ts","../system/workflows/mcp-triage/prompts.ts","../system/workflows/mcp-triage/response-builders.ts","../system/workflows/mcp-triage/response.ts","../system/workflows/mcp-triage/types.ts","../system/workflows/mcp-triage-deterministic/activities.ts","../system/workflows/mcp-triage-deterministic/index.ts","../system/workflows/mcp-triage-router/activities.ts","../system/workflows/mcp-triage-router/index.ts","../system/workflows/mcp-workflow-builder/index.ts","../system/workflows/mcp-workflow-builder/prompts.ts","../system/workflows/mcp-workflow-builder/activities/caches.ts","../system/workflows/mcp-workflow-builder/activities/index.ts","../system/workflows/mcp-workflow-builder/activities/llm.ts","../system/workflows/mcp-workflow-builder/activities/tool-loader.ts","../system/workflows/mcp-workflow-planner/index.ts","../system/workflows/mcp-workflow-planner/prompts.ts","../system/workflows/mcp-workflow-planner/activities/analyze.ts","../system/workflows/mcp-workflow-planner/activities/index.ts","../system/workflows/mcp-workflow-planner/activities/persist.ts","../system/workflows/mcp-workflow-planner/activities/plan.ts","../system/workflows/shared/discovery.ts","../system/workflows/shared/index.ts","../system/workflows/shared/llm-caller.ts","../system/workflows/shared/prompts.ts","../system/workflows/shared/strategy-advisors.ts","../system/workflows/shared/tool-executor.ts","../system/workflows/shared/tool-loader.ts","../system/workflows/shared/types.ts","../types/agent.ts","../types/auth.ts","../types/config.ts","../types/delegation.ts","../types/discovery.ts","../types/envelope.ts","../types/escalation-strategy.ts","../types/escalation.ts","../types/events.ts","../types/export.ts","../types/express.d.ts","../types/index.ts","../types/logger.ts","../types/maintenance.ts","../types/mcp.ts","../types/oauth.ts","../types/sdk.ts","../types/startup.ts","../types/task.ts","../types/telemetry.ts","../types/tool-context.ts","../types/user.ts","../types/workflow-set.ts","../types/workflow.ts","../types/yaml-workflow.ts","../workers/index.ts"],"version":"5.9.3"}
1
+ {"root":["../index.ts","../vitest.config.ts","../vitest.integration.config.ts","../adapters/express.ts","../api/agent-subscriptions.ts","../api/agents.ts","../api/auth-sso.ts","../api/auth.ts","../api/bot-accounts.ts","../api/capabilities.ts","../api/controlplane.ts","../api/dba.ts","../api/exports.ts","../api/files.ts","../api/index.ts","../api/insight.ts","../api/knowledge.ts","../api/maintenance.ts","../api/namespaces.ts","../api/overview.ts","../api/pipelines.ts","../api/roles.ts","../api/settings.ts","../api/tasks.ts","../api/topics.ts","../api/users.ts","../api/workflow-sets.ts","../api/escalations/bulk.ts","../api/escalations/claim.ts","../api/escalations/create.ts","../api/escalations/helpers.ts","../api/escalations/index.ts","../api/escalations/list.ts","../api/escalations/metadata.ts","../api/escalations/resolve.ts","../api/escalations/single.ts","../api/mcp/index.ts","../api/mcp/servers.ts","../api/mcp/tools.ts","../api/workflows/config.ts","../api/workflows/discovery.ts","../api/workflows/index.ts","../api/workflows/invocation.ts","../api/yaml-workflows/cron.ts","../api/yaml-workflows/crud.ts","../api/yaml-workflows/deploy.ts","../api/yaml-workflows/helpers.ts","../api/yaml-workflows/index.ts","../api/yaml-workflows/versions.ts","../bin/ltc.ts","../lib/cli/auth.ts","../lib/cli/client.ts","../lib/cli/compile.ts","../lib/cli/format.ts","../lib/cli/init.ts","../lib/cli/output.ts","../lib/cli/scanner.ts","../lib/cli/types.ts","../lib/cli/commands/escalations.ts","../lib/cli/commands/knowledge.ts","../lib/cli/commands/mcp.ts","../lib/cli/commands/pipelines.ts","../lib/cli/commands/status.ts","../lib/cli/commands/streams.ts","../lib/cli/commands/users.ts","../lib/cli/commands/workflows.ts","../lib/db/index.ts","../lib/db/migrate.ts","../lib/events/callback.ts","../lib/events/index.ts","../lib/events/matching.ts","../lib/events/memory.ts","../lib/events/nats-ws-proxy.ts","../lib/events/nats.ts","../lib/events/publish.ts","../lib/events/socketio.ts","../lib/logger/index.ts","../lib/logger/pino.ts","../lib/storage/index.ts","../lib/storage/local.ts","../lib/storage/mime.ts","../lib/storage/s3.ts","../lib/storage/types.ts","../lib/telemetry/honeycomb.ts","../lib/telemetry/index.ts","../modules/auth.ts","../modules/config.ts","../modules/defaults.ts","../modules/ltconfig.ts","../modules/maintenance.ts","../modules/sso.ts","../modules/utils.ts","../routes/agents.ts","../routes/auth-sso.ts","../routes/auth.ts","../routes/bot-accounts.ts","../routes/capabilities.ts","../routes/controlplane.ts","../routes/dba.ts","../routes/delegation.ts","../routes/docs.ts","../routes/exports.ts","../routes/file-browser.ts","../routes/files.ts","../routes/index.ts","../routes/insight.ts","../routes/knowledge.ts","../routes/maintenance.ts","../routes/mcp-endpoint.ts","../routes/mcp.ts","../routes/namespaces.ts","../routes/nats-credentials.ts","../routes/oauth.ts","../routes/overview.ts","../routes/pipelines.ts","../routes/roles.ts","../routes/settings.ts","../routes/tasks.ts","../routes/topics.ts","../routes/users.ts","../routes/workflow-sets.ts","../routes/escalations/bulk.ts","../routes/escalations/index.ts","../routes/escalations/list.ts","../routes/escalations/metadata.ts","../routes/escalations/resolve.ts","../routes/escalations/single.ts","../routes/workflows/config.ts","../routes/workflows/discovery.ts","../routes/workflows/index.ts","../routes/workflows/invocation.ts","../routes/yaml-workflows/cron.ts","../routes/yaml-workflows/crud.ts","../routes/yaml-workflows/deployment.ts","../routes/yaml-workflows/index.ts","../routes/yaml-workflows/versions.ts","../scripts/process-helpers.ts","../scripts/process.ts","../scripts/token.ts","../sdk/index.ts","../services/dba.ts","../services/hotmesh-utils.ts","../services/workflow-invocation.ts","../services/agent/index.ts","../services/agent/input-mapper.ts","../services/agent/sql.ts","../services/agent/subscription-sql.ts","../services/agent/subscriptions.ts","../services/agent/trigger-registry.ts","../services/auth/bot-api-key.ts","../services/auth/delegation.ts","../services/auth/index.ts","../services/auth/service-token.ts","../services/auth/sql.ts","../services/config/cache.ts","../services/config/index.ts","../services/config/provider.ts","../services/config/read.ts","../services/config/sql.ts","../services/config/write.ts","../services/controlplane/index.ts","../services/controlplane/quorum-bridge.ts","../services/controlplane/sql.ts","../services/controlplane/stream-messages-sql.ts","../services/controlplane/types.ts","../services/cron/index.ts","../services/escalation/bulk.ts","../services/escalation/crud.ts","../services/escalation/index.ts","../services/escalation/queries.ts","../services/escalation/sql.ts","../services/escalation/types.ts","../services/escalation-strategy/default.ts","../services/escalation-strategy/index.ts","../services/escalation-strategy/mcp.ts","../services/export/client.ts","../services/export/index.ts","../services/export/post-process.ts","../services/export/types.ts","../services/iam/activity.ts","../services/iam/bots.ts","../services/iam/context.ts","../services/iam/credentials.ts","../services/iam/envelope.ts","../services/iam/ephemeral.ts","../services/iam/index.ts","../services/iam/principal.ts","../services/iam/resolve.ts","../services/iam/sql.ts","../services/insight/index.ts","../services/insight/prompts.ts","../services/interceptor/activity-interceptor.ts","../services/interceptor/completion.ts","../services/interceptor/context.ts","../services/interceptor/escalation.ts","../services/interceptor/index.ts","../services/interceptor/lifecycle.ts","../services/interceptor/state.ts","../services/interceptor/types.ts","../services/interceptor/activities/config.ts","../services/interceptor/activities/escalation.ts","../services/interceptor/activities/index.ts","../services/interceptor/activities/task.ts","../services/interceptor/activities/workflow.ts","../services/llm/detect.ts","../services/llm/index.ts","../services/llm/translate.ts","../services/llm/types.ts","../services/llm/providers/anthropic.ts","../services/llm/providers/openai.ts","../services/maintenance/index.ts","../services/mcp/adapter.ts","../services/mcp/db.ts","../services/mcp/exposure.ts","../services/mcp/external-server.ts","../services/mcp/index.ts","../services/mcp/register-tool.ts","../services/mcp/seed-service-account.ts","../services/mcp/server-lifecycle.ts","../services/mcp/server-tools.ts","../services/mcp/server.ts","../services/mcp/sql.ts","../services/mcp/types.ts","../services/mcp/workflow-compiler-server.ts","../services/mcp/workflow-server.ts","../services/mcp/client/connection-dispatch.ts","../services/mcp/client/connection-lifecycle.ts","../services/mcp/client/connection-test.ts","../services/mcp/client/connection.ts","../services/mcp/client/index.ts","../services/mcp/client/tools.ts","../services/mcp/db-server/index.ts","../services/mcp/db-server/schemas.ts","../services/mcp/db-server/tools.ts","../services/mcp/playwright-server/index.ts","../services/mcp/playwright-server/lifecycle.ts","../services/mcp/playwright-server/schemas.ts","../services/mcp/playwright-server/tools.ts","../services/namespace/index.ts","../services/namespace/sql.ts","../services/namespace/types.ts","../services/oauth/crypto.ts","../services/oauth/db.ts","../services/oauth/index.ts","../services/oauth/sql.ts","../services/oauth/state.ts","../services/oauth/providers/anthropic.ts","../services/oauth/providers/github.ts","../services/oauth/providers/google.ts","../services/oauth/providers/index.ts","../services/oauth/providers/microsoft.ts","../services/oauth/providers/mock.ts","../services/oauth/providers/registry.ts","../services/oauth/providers/types.ts","../services/orchestrator/condition.ts","../services/orchestrator/index.ts","../services/orchestrator/types.ts","../services/overview/index.ts","../services/overview/sql.ts","../services/pipelines/enrichment.ts","../services/pipelines/events.ts","../services/pipelines/execution-builder.ts","../services/pipelines/index.ts","../services/pipelines/queries.ts","../services/pipelines/sql.ts","../services/pipelines/types.ts","../services/role/index.ts","../services/role/sql.ts","../services/role/types.ts","../services/task/crud.ts","../services/task/index.ts","../services/task/process.ts","../services/task/resolve.ts","../services/task/sql.ts","../services/task/types.ts","../services/topics/index.ts","../services/topics/sql.ts","../services/topics/system-topics.ts","../services/user/auth.ts","../services/user/crud.ts","../services/user/index.ts","../services/user/rbac.ts","../services/user/roles.ts","../services/user/seed-admin.ts","../services/user/sql.ts","../services/user/sso-provision.ts","../services/user/types.ts","../services/workers/registry.ts","../services/workflow-sets/db.ts","../services/workflow-sets/index.ts","../services/workflow-sets/sql.ts","../services/yaml-workflow/builder-regenerate.ts","../services/yaml-workflow/db-utils.ts","../services/yaml-workflow/db-versions.ts","../services/yaml-workflow/db.ts","../services/yaml-workflow/deployer-helpers.ts","../services/yaml-workflow/deployer.ts","../services/yaml-workflow/generator.ts","../services/yaml-workflow/index.ts","../services/yaml-workflow/input-analyzer-helpers.ts","../services/yaml-workflow/input-analyzer.ts","../services/yaml-workflow/invoke.ts","../services/yaml-workflow/sql.ts","../services/yaml-workflow/types.ts","../services/yaml-workflow/durable-compiler/index.ts","../services/yaml-workflow/durable-compiler/parser.ts","../services/yaml-workflow/durable-compiler/prompts.ts","../services/yaml-workflow/durable-compiler/types.ts","../services/yaml-workflow/pattern-detector/array-source.ts","../services/yaml-workflow/pattern-detector/collapse.ts","../services/yaml-workflow/pattern-detector/index.ts","../services/yaml-workflow/pattern-detector/run-detection.ts","../services/yaml-workflow/pattern-detector/types.ts","../services/yaml-workflow/pipeline/analyze.ts","../services/yaml-workflow/pipeline/extract-helpers.ts","../services/yaml-workflow/pipeline/extract.ts","../services/yaml-workflow/pipeline/index.ts","../services/yaml-workflow/pipeline/prompt-templates.ts","../services/yaml-workflow/pipeline/prompts.ts","../services/yaml-workflow/pipeline/validate.ts","../services/yaml-workflow/pipeline/build/dag-assembly.ts","../services/yaml-workflow/pipeline/build/dag.ts","../services/yaml-workflow/pipeline/build/index.ts","../services/yaml-workflow/pipeline/build/iteration.ts","../services/yaml-workflow/pipeline/build/metadata.ts","../services/yaml-workflow/pipeline/build/transform.ts","../services/yaml-workflow/pipeline/build/utils.ts","../services/yaml-workflow/pipeline/build/wiring.ts","../services/yaml-workflow/pipeline/compile/index.ts","../services/yaml-workflow/pipeline/compile/llm-call.ts","../services/yaml-workflow/pipeline/compile/parse-plan.ts","../services/yaml-workflow/pipeline/compile/summarize.ts","../services/yaml-workflow/workers/callbacks.ts","../services/yaml-workflow/workers/events.ts","../services/yaml-workflow/workers/index.ts","../services/yaml-workflow/workers/register.ts","../services/yaml-workflow/workers/scope.ts","../start/adapters.ts","../start/config.ts","../start/index.ts","../start/server.ts","../start/socket-auth.ts","../start/workers.ts","../system/index.ts","../system/activities/claude-code.ts","../system/activities/file-storage.ts","../system/activities/http.ts","../system/activities/knowledge.ts","../system/activities/oauth.ts","../system/activities/schema-exchange.ts","../system/activities/sql.ts","../system/activities/triage/cache.ts","../system/activities/triage/context.ts","../system/activities/triage/discovery.ts","../system/activities/triage/index.ts","../system/activities/triage/llm.ts","../system/activities/triage/tools.ts","../system/mcp-servers/claude-code.ts","../system/mcp-servers/docs.ts","../system/mcp-servers/events.ts","../system/mcp-servers/file-storage.ts","../system/mcp-servers/http-fetch.ts","../system/mcp-servers/human-queue-schemas.ts","../system/mcp-servers/human-queue.ts","../system/mcp-servers/knowledge.ts","../system/mcp-servers/oauth.ts","../system/mcp-servers/schema-exchange.ts","../system/mcp-servers/translation.ts","../system/mcp-servers/vision-prompts.ts","../system/mcp-servers/vision.ts","../system/mcp-servers/workflow-compiler.ts","../system/mcp-servers/workflow.ts","../system/mcp-servers/admin/agent-subscriptions.ts","../system/mcp-servers/admin/agents.ts","../system/mcp-servers/admin/bot-accounts.ts","../system/mcp-servers/admin/controlplane.ts","../system/mcp-servers/admin/escalations.ts","../system/mcp-servers/admin/exports.ts","../system/mcp-servers/admin/index.ts","../system/mcp-servers/admin/maintenance.ts","../system/mcp-servers/admin/mcp-servers.ts","../system/mcp-servers/admin/overview.ts","../system/mcp-servers/admin/pipelines.ts","../system/mcp-servers/admin/schemas.ts","../system/mcp-servers/admin/settings.ts","../system/mcp-servers/admin/tasks.ts","../system/mcp-servers/admin/topics.ts","../system/mcp-servers/admin/users.ts","../system/mcp-servers/admin/workflow-config.ts","../system/mcp-servers/admin/workflows.ts","../system/mcp-servers/admin/yaml-workflows.ts","../system/mcp-servers/db-query/index.ts","../system/mcp-servers/db-query/schemas.ts","../system/mcp-servers/db-query/tools.ts","../system/seed/index.ts","../system/seed/tool-manifests-admin.ts","../system/seed/tool-manifests-data.ts","../system/seed/tool-manifests-escalation.ts","../system/seed/tool-manifests-events.ts","../system/seed/tool-manifests-knowledge.ts","../system/seed/tool-manifests-workflows.ts","../system/workflows/tool-result-guard.ts","../system/workflows/capability-invoke/activities.ts","../system/workflows/capability-invoke/index.ts","../system/workflows/mcp-deterministic/activities.ts","../system/workflows/mcp-deterministic/index.ts","../system/workflows/mcp-query/index.ts","../system/workflows/mcp-query/prompts.ts","../system/workflows/mcp-query/strategy-advisors.ts","../system/workflows/mcp-query/types.ts","../system/workflows/mcp-query/activities/caches.ts","../system/workflows/mcp-query/activities/discovery.ts","../system/workflows/mcp-query/activities/index.ts","../system/workflows/mcp-query/activities/llm.ts","../system/workflows/mcp-query/activities/tool-executor.ts","../system/workflows/mcp-query/activities/tool-loader.ts","../system/workflows/mcp-query-router/activities.ts","../system/workflows/mcp-query-router/index.ts","../system/workflows/mcp-query-router/prompts.ts","../system/workflows/mcp-triage/activities-proxy.ts","../system/workflows/mcp-triage/index.ts","../system/workflows/mcp-triage/prompts.ts","../system/workflows/mcp-triage/response-builders.ts","../system/workflows/mcp-triage/response.ts","../system/workflows/mcp-triage/types.ts","../system/workflows/mcp-triage-deterministic/activities.ts","../system/workflows/mcp-triage-deterministic/index.ts","../system/workflows/mcp-triage-router/activities.ts","../system/workflows/mcp-triage-router/index.ts","../system/workflows/mcp-workflow-builder/index.ts","../system/workflows/mcp-workflow-builder/prompts.ts","../system/workflows/mcp-workflow-builder/activities/caches.ts","../system/workflows/mcp-workflow-builder/activities/index.ts","../system/workflows/mcp-workflow-builder/activities/llm.ts","../system/workflows/mcp-workflow-builder/activities/tool-loader.ts","../system/workflows/mcp-workflow-planner/index.ts","../system/workflows/mcp-workflow-planner/prompts.ts","../system/workflows/mcp-workflow-planner/activities/analyze.ts","../system/workflows/mcp-workflow-planner/activities/index.ts","../system/workflows/mcp-workflow-planner/activities/persist.ts","../system/workflows/mcp-workflow-planner/activities/plan.ts","../system/workflows/shared/discovery.ts","../system/workflows/shared/index.ts","../system/workflows/shared/llm-caller.ts","../system/workflows/shared/prompts.ts","../system/workflows/shared/strategy-advisors.ts","../system/workflows/shared/tool-executor.ts","../system/workflows/shared/tool-loader.ts","../system/workflows/shared/types.ts","../types/agent.ts","../types/auth.ts","../types/config.ts","../types/delegation.ts","../types/discovery.ts","../types/envelope.ts","../types/escalation-strategy.ts","../types/escalation.ts","../types/events.ts","../types/export.ts","../types/express.d.ts","../types/index.ts","../types/logger.ts","../types/maintenance.ts","../types/mcp.ts","../types/oauth.ts","../types/sdk.ts","../types/startup.ts","../types/task.ts","../types/telemetry.ts","../types/tool-context.ts","../types/user.ts","../types/workflow-set.ts","../types/workflow.ts","../types/yaml-workflow.ts","../workers/index.ts"],"version":"5.9.3"}
@@ -69,6 +69,74 @@ curl -X POST http://localhost:3000/mcp \
69
69
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_settings","arguments":{}},"id":3}'
70
70
  ```
71
71
 
72
+ ## Claude Code Integration
73
+
74
+ Connect Claude Code to your Long Tail instance as an MCP server. Once connected, Claude Code can discover and invoke all 110 tools — query escalations, manage workflows, store knowledge, and more.
75
+
76
+ ### Step 1: Get an API key
77
+
78
+ Start Long Tail (`docker compose up -d --build`). The startup log shows two seeded API keys:
79
+
80
+ ```
81
+ [seed-mcp] read key: lt_bot_<read-key>
82
+ [seed-mcp] full key: lt_bot_<full-key>
83
+ ```
84
+
85
+ The **read key** exposes 57 read-safe tools (queries, listings). The **full key** exposes all 110 tools.
86
+
87
+ ### Step 2: Configure Claude Code
88
+
89
+ Copy the example config and add your API key:
90
+
91
+ ```bash
92
+ cp .mcp.example.json .mcp.json
93
+ ```
94
+
95
+ Edit `.mcp.json` and replace `<your-api-key>` with the key from step 1:
96
+
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "long-tail": {
101
+ "type": "http",
102
+ "url": "http://localhost:3000/mcp",
103
+ "headers": {
104
+ "Authorization": "Bearer lt_bot_<your-api-key>"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ `.mcp.json` is gitignored (it contains secrets). `.mcp.example.json` is committed as a template — same pattern as `.env` and `.env.example`.
112
+
113
+ Or use the CLI:
114
+
115
+ ```bash
116
+ claude mcp add --transport http long-tail http://localhost:3000/mcp \
117
+ --header "Authorization: Bearer lt_bot_<your-key>"
118
+ ```
119
+
120
+ ### Step 3: Verify
121
+
122
+ Restart Claude Code, then try:
123
+
124
+ > "How's the system doing?"
125
+
126
+ Claude Code calls `get_system_overview` — one call returns triage, throughput, trends, infrastructure, and process status. Try more:
127
+
128
+ > "What roles exist in the system?"
129
+
130
+ > "Show me the most recent worker stream message"
131
+
132
+ > "List all pending escalations"
133
+
134
+ > "Store a knowledge entry: domain=notes, key=today, data={message: 'shipped MCP'}"
135
+
136
+ > "What MCP servers are registered?"
137
+
138
+ ---
139
+
72
140
  ## Authentication
73
141
 
74
142
  Two token types are supported:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/long-tail",
3
- "version": "0.4.23",
3
+ "version": "0.4.24",
4
4
  "description": "Long Tail Workflows — Durable AI workflows with human-in-the-loop escalation. Powered by PostgreSQL.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",