@kynver-app/mcp-agent-os 0.3.69 → 0.3.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -19
- package/dist/sse.js +3 -15
- package/dist/worker.js +2 -0
- package/package.json +5 -4
- package/dist/context/context-budget-receipt.d.ts +0 -9
- package/dist/context/context-budget-receipt.js +0 -34
- package/dist/index.d.ts +0 -7
- package/dist/lib/kynver-client.d.ts +0 -23
- package/dist/lib/kynver-client.js +0 -151
- package/dist/lib/mcp-json-result.d.ts +0 -12
- package/dist/lib/mcp-json-result.js +0 -30
- package/dist/lib/mcp-sse-server.d.ts +0 -44
- package/dist/lib/mcp-sse-server.js +0 -441
- package/dist/lib/package-version.d.ts +0 -7
- package/dist/lib/package-version.js +0 -44
- package/dist/server.d.ts +0 -11
- package/dist/server.js +0 -753
- package/dist/sse.d.ts +0 -1
- package/dist/tools/action-required.d.ts +0 -24
- package/dist/tools/action-required.js +0 -140
- package/dist/tools/cmo-context-pack.d.ts +0 -20
- package/dist/tools/cmo-context-pack.js +0 -56
- package/dist/tools/cmo-control.d.ts +0 -20
- package/dist/tools/cmo-control.js +0 -26
- package/dist/tools/command-center.d.ts +0 -24
- package/dist/tools/command-center.js +0 -155
- package/dist/tools/context-expand.d.ts +0 -18
- package/dist/tools/context-expand.js +0 -26
- package/dist/tools/context-preview.d.ts +0 -14
- package/dist/tools/context-preview.js +0 -51
- package/dist/tools/current-focus.d.ts +0 -17
- package/dist/tools/current-focus.js +0 -126
- package/dist/tools/diagnostics.d.ts +0 -24
- package/dist/tools/diagnostics.js +0 -69
- package/dist/tools/graph.d.ts +0 -25
- package/dist/tools/graph.js +0 -153
- package/dist/tools/kariad-marketing-loop.d.ts +0 -21
- package/dist/tools/kariad-marketing-loop.js +0 -41
- package/dist/tools/kariad-outcome-import.d.ts +0 -17
- package/dist/tools/kariad-outcome-import.js +0 -37
- package/dist/tools/macro-controls.d.ts +0 -23
- package/dist/tools/macro-controls.js +0 -54
- package/dist/tools/memory-ledger.d.ts +0 -19
- package/dist/tools/memory-ledger.js +0 -48
- package/dist/tools/memory-quality-feedback.d.ts +0 -23
- package/dist/tools/memory-quality-feedback.js +0 -123
- package/dist/tools/memory-vault.d.ts +0 -21
- package/dist/tools/memory-vault.js +0 -24
- package/dist/tools/mesh-liveness.d.ts +0 -20
- package/dist/tools/mesh-liveness.js +0 -40
- package/dist/tools/monitor.d.ts +0 -17
- package/dist/tools/monitor.js +0 -51
- package/dist/tools/operating-rules.d.ts +0 -7
- package/dist/tools/operating-rules.js +0 -39
- package/dist/tools/plan-audit-rollup.d.ts +0 -19
- package/dist/tools/plan-audit-rollup.js +0 -49
- package/dist/tools/plan-progress.d.ts +0 -2
- package/dist/tools/plan-progress.js +0 -128
- package/dist/tools/plan-to-factory.d.ts +0 -2
- package/dist/tools/plan-to-factory.js +0 -23
- package/dist/tools/plans.d.ts +0 -29
- package/dist/tools/plans.js +0 -205
- package/dist/tools/pr-backlog.d.ts +0 -22
- package/dist/tools/pr-backlog.js +0 -43
- package/dist/tools/provider-evidence.d.ts +0 -23
- package/dist/tools/provider-evidence.js +0 -60
- package/dist/tools/skills.d.ts +0 -28
- package/dist/tools/skills.js +0 -79
- package/dist/tools/task-board-watchdog.d.ts +0 -20
- package/dist/tools/task-board-watchdog.js +0 -42
- package/dist/tools/taskflow.d.ts +0 -21
- package/dist/tools/taskflow.js +0 -124
- package/dist/tools/tasks.d.ts +0 -26
- package/dist/tools/tasks.js +0 -251
- package/dist/tools/workbench.d.ts +0 -17
- package/dist/tools/workbench.js +0 -178
package/dist/sse.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Required inbox MCP tools.
|
|
3
|
-
*
|
|
4
|
-
* Slice 1 exposes two tools:
|
|
5
|
-
* - agent_os_ask_human : create one inbox item (one decision per call)
|
|
6
|
-
* - agent_os_await_action: poll an item until it resolves (or timeout)
|
|
7
|
-
*
|
|
8
|
-
* Each tool proxies to `/api/action-required/*`. The Kynver API enforces
|
|
9
|
-
* per-user ownership and the one-question lint server-side.
|
|
10
|
-
*/
|
|
11
|
-
type ToolResult = {
|
|
12
|
-
content: {
|
|
13
|
-
type: "text";
|
|
14
|
-
text: string;
|
|
15
|
-
}[];
|
|
16
|
-
structuredContent?: unknown;
|
|
17
|
-
};
|
|
18
|
-
export interface ActionRequiredToolDeps {
|
|
19
|
-
register: (name: string, description: string, inputSchema: Record<string, unknown>, cb: (args: any) => any) => void;
|
|
20
|
-
jsonResult: (data: unknown) => ToolResult;
|
|
21
|
-
compact: (source: Record<string, unknown>) => Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
export declare function registerActionRequiredTools({ register, jsonResult, compact, }: ActionRequiredToolDeps): void;
|
|
24
|
-
export {};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Required inbox MCP tools.
|
|
3
|
-
*
|
|
4
|
-
* Slice 1 exposes two tools:
|
|
5
|
-
* - agent_os_ask_human : create one inbox item (one decision per call)
|
|
6
|
-
* - agent_os_await_action: poll an item until it resolves (or timeout)
|
|
7
|
-
*
|
|
8
|
-
* Each tool proxies to `/api/action-required/*`. The Kynver API enforces
|
|
9
|
-
* per-user ownership and the one-question lint server-side.
|
|
10
|
-
*/
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
import { get, post } from "../lib/kynver-client.js";
|
|
13
|
-
const category = z.enum([
|
|
14
|
-
"decision",
|
|
15
|
-
"approval",
|
|
16
|
-
"question",
|
|
17
|
-
"blocker",
|
|
18
|
-
"clarification",
|
|
19
|
-
]);
|
|
20
|
-
const priority = z.enum(["low", "normal", "high", "critical"]);
|
|
21
|
-
const blockerKind = z
|
|
22
|
-
.enum([
|
|
23
|
-
"none",
|
|
24
|
-
"deploy",
|
|
25
|
-
"env",
|
|
26
|
-
"db",
|
|
27
|
-
"npm",
|
|
28
|
-
"live_trade",
|
|
29
|
-
"content_publish",
|
|
30
|
-
"code_review",
|
|
31
|
-
"merge",
|
|
32
|
-
"other",
|
|
33
|
-
])
|
|
34
|
-
.optional();
|
|
35
|
-
const askerKind = z.enum(["agent", "reviewer", "task", "system"]).default("agent");
|
|
36
|
-
const recommendation = z
|
|
37
|
-
.object({
|
|
38
|
-
value: z.string().describe("The recommended answer the user can accept with one tap."),
|
|
39
|
-
confidence: z.enum(["low", "medium", "high"]).optional(),
|
|
40
|
-
rationale: z.string().optional(),
|
|
41
|
-
source: z.enum(["agent", "policy", "history"]).optional(),
|
|
42
|
-
})
|
|
43
|
-
.strict();
|
|
44
|
-
const evidence = z
|
|
45
|
-
.array(z
|
|
46
|
-
.object({
|
|
47
|
-
kind: z.enum(["url", "memory", "task_event", "file", "text", "pr", "commit"]),
|
|
48
|
-
label: z.string().optional(),
|
|
49
|
-
ref: z.string(),
|
|
50
|
-
})
|
|
51
|
-
.strict())
|
|
52
|
-
.optional();
|
|
53
|
-
const options = z
|
|
54
|
-
.array(z
|
|
55
|
-
.object({
|
|
56
|
-
value: z.string(),
|
|
57
|
-
label: z.string().optional(),
|
|
58
|
-
isRecommended: z.boolean().optional(),
|
|
59
|
-
})
|
|
60
|
-
.strict())
|
|
61
|
-
.optional();
|
|
62
|
-
export function registerActionRequiredTools({ register, jsonResult, compact, }) {
|
|
63
|
-
register("agent_os_ask_human", [
|
|
64
|
-
"Surface one decision to the human via the Action Required inbox.",
|
|
65
|
-
"Each call MUST contain exactly one question the human can answer in one breath.",
|
|
66
|
-
"Compound asks ('Do X? Or Y?') are rejected server-side with multiple_questions_detected — split them into two calls.",
|
|
67
|
-
"Recommendation is required for category=decision|approval; supply the best-guess answer the user can one-tap accept.",
|
|
68
|
-
"Returns the created `item` (with id you can pass to agent_os_await_action) and a `created` flag (false = idempotent re-create).",
|
|
69
|
-
].join(" "), {
|
|
70
|
-
title: z.string().describe("Short headline rendered as the card title."),
|
|
71
|
-
question: z
|
|
72
|
-
.string()
|
|
73
|
-
.describe("The single question (one '?'). The user sees this verbatim."),
|
|
74
|
-
body: z
|
|
75
|
-
.string()
|
|
76
|
-
.optional()
|
|
77
|
-
.describe("Expanded context / background. Collapsed in the UI; expand-on-tap."),
|
|
78
|
-
category: category.default("decision"),
|
|
79
|
-
priority: priority.default("normal"),
|
|
80
|
-
askerKind: askerKind.optional(),
|
|
81
|
-
askerRef: z.string().optional().describe("Free-form ref (e.g. agent slug, reviewer id)."),
|
|
82
|
-
blockerKind: blockerKind,
|
|
83
|
-
recommendation: recommendation.optional(),
|
|
84
|
-
evidence,
|
|
85
|
-
options,
|
|
86
|
-
taskId: z.string().optional().describe("Linked AgentTask id — unblocks on answer."),
|
|
87
|
-
planId: z.string().optional(),
|
|
88
|
-
planVersionId: z.string().optional(),
|
|
89
|
-
goalId: z.string().optional(),
|
|
90
|
-
projectId: z.string().optional(),
|
|
91
|
-
sessionId: z.string().optional(),
|
|
92
|
-
sourceEventId: z.number().int().optional(),
|
|
93
|
-
unblockTaskIds: z.array(z.string()).optional(),
|
|
94
|
-
expiresAt: z
|
|
95
|
-
.string()
|
|
96
|
-
.optional()
|
|
97
|
-
.describe("ISO-8601 timestamp for hard deadline. Defaults to 24h for approvals; null otherwise."),
|
|
98
|
-
agentOsId: z.string().optional(),
|
|
99
|
-
createdByAgentRef: z.string().optional(),
|
|
100
|
-
clientRequestId: z
|
|
101
|
-
.string()
|
|
102
|
-
.optional()
|
|
103
|
-
.describe("Dedupe key — repeating the same id within a user returns the existing item with created=false."),
|
|
104
|
-
}, async (args) => {
|
|
105
|
-
return jsonResult(await post("/action-required", compact(args)));
|
|
106
|
-
});
|
|
107
|
-
register("agent_os_await_action", [
|
|
108
|
-
"Poll one Action Required item until it resolves.",
|
|
109
|
-
"Returns immediately if the item is already terminal (answered / resolved_noop / expired / superseded / cancelled).",
|
|
110
|
-
"If still open/snoozed, waits up to `timeoutSeconds` (default 60, max 300) with `pollIntervalSeconds` between checks.",
|
|
111
|
-
"On answer, the answer text + acceptedRecommendation flag are returned so you can resume work without re-fetching.",
|
|
112
|
-
].join(" "), {
|
|
113
|
-
itemId: z.string().describe("The Action Required item id returned by agent_os_ask_human."),
|
|
114
|
-
timeoutSeconds: z.number().int().min(0).max(300).optional(),
|
|
115
|
-
pollIntervalSeconds: z.number().int().min(2).max(60).optional(),
|
|
116
|
-
}, async (args) => {
|
|
117
|
-
const itemId = String(args.itemId);
|
|
118
|
-
const timeout = Math.min(300, Math.max(0, args.timeoutSeconds ?? 60));
|
|
119
|
-
const interval = Math.max(2, Math.min(60, args.pollIntervalSeconds ?? 5));
|
|
120
|
-
const start = Date.now();
|
|
121
|
-
let last = null;
|
|
122
|
-
while (true) {
|
|
123
|
-
const data = (await get(`/action-required/${encodeURIComponent(itemId)}/await`));
|
|
124
|
-
last = data;
|
|
125
|
-
if (data.status !== "open" && data.status !== "snoozed") {
|
|
126
|
-
return jsonResult({ ...data, waited: Math.round((Date.now() - start) / 1000) });
|
|
127
|
-
}
|
|
128
|
-
if (Date.now() - start >= timeout * 1000) {
|
|
129
|
-
return jsonResult({
|
|
130
|
-
...data,
|
|
131
|
-
stillOpen: true,
|
|
132
|
-
waited: Math.round((Date.now() - start) / 1000),
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
await new Promise((r) => setTimeout(r, interval * 1000));
|
|
136
|
-
}
|
|
137
|
-
// eslint-disable-next-line no-unreachable
|
|
138
|
-
return jsonResult(last);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Live CMO Context Pack MCP tool.
|
|
3
|
-
*
|
|
4
|
-
* Compact L3 doctrine fetch for MCP clients (GhostGrok / hosted Agent OS).
|
|
5
|
-
* Does not dump marketing-graph nodes into agent_os_search_memory.
|
|
6
|
-
*/
|
|
7
|
-
type ToolResult = {
|
|
8
|
-
content: {
|
|
9
|
-
type: "text";
|
|
10
|
-
text: string;
|
|
11
|
-
}[];
|
|
12
|
-
structuredContent?: unknown;
|
|
13
|
-
};
|
|
14
|
-
export interface CmoContextPackToolDeps {
|
|
15
|
-
register: (name: string, description: string, inputSchema: Record<string, unknown>, cb: (args: any) => any) => void;
|
|
16
|
-
resolveToolSlug: (explicitSlug?: string) => Promise<string>;
|
|
17
|
-
jsonResult: (data: unknown) => ToolResult;
|
|
18
|
-
}
|
|
19
|
-
export declare function registerCmoContextPackTools({ register, resolveToolSlug, jsonResult, }: CmoContextPackToolDeps): void;
|
|
20
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Live CMO Context Pack MCP tool.
|
|
3
|
-
*
|
|
4
|
-
* Compact L3 doctrine fetch for MCP clients (GhostGrok / hosted Agent OS).
|
|
5
|
-
* Does not dump marketing-graph nodes into agent_os_search_memory.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
import { get } from "../lib/kynver-client.js";
|
|
9
|
-
const slugField = z
|
|
10
|
-
.string()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe("AgentOS slug. Defaults to env/primary AgentOS.");
|
|
13
|
-
const platformField = z
|
|
14
|
-
.enum(["linkedin", "x", "tiktok", "instagram", "reddit", "meta_ads", "email", "all"])
|
|
15
|
-
.optional()
|
|
16
|
-
.describe("Optional platform filter for the compact pack.");
|
|
17
|
-
const funnelField = z
|
|
18
|
-
.enum(["awareness", "trust", "consideration", "conversion", "retention"])
|
|
19
|
-
.optional()
|
|
20
|
-
.describe("Optional funnel-stage filter.");
|
|
21
|
-
export function registerCmoContextPackTools({ register, resolveToolSlug, jsonResult, }) {
|
|
22
|
-
register("agent_os_cmo_context_pack_get", [
|
|
23
|
-
"Fetch a compact live CMO Context Pack from the shared marketing knowledge graph.",
|
|
24
|
-
"Returns promoted doctrine only (playbooks, platform rules, hooks, proof, CTAs, anti-patterns, rubrics).",
|
|
25
|
-
"Unpromoted freshness candidates are excluded. This is not agent_os_search_memory —",
|
|
26
|
-
"do not expect playbook nodes from ordinary agent memory search.",
|
|
27
|
-
"Read-only; safe for unattended verification. Does not publish or spend.",
|
|
28
|
-
"Use on marketing/campaign turns before KariAd generation. Pair with agent_os_cmo_control_status_get.",
|
|
29
|
-
].join(" "), {
|
|
30
|
-
slug: slugField,
|
|
31
|
-
objective: z
|
|
32
|
-
.string()
|
|
33
|
-
.describe("Campaign or turn objective the pack should be scoped to."),
|
|
34
|
-
platform: platformField,
|
|
35
|
-
audienceSegment: z.string().optional().describe("Optional audience segment label."),
|
|
36
|
-
funnelStage: funnelField,
|
|
37
|
-
maxNodesPerSlot: z
|
|
38
|
-
.number()
|
|
39
|
-
.optional()
|
|
40
|
-
.describe("Max nodes per pack slot (default 5, max 8)."),
|
|
41
|
-
}, async (args) => {
|
|
42
|
-
const s = await resolveToolSlug(args.slug);
|
|
43
|
-
const params = new URLSearchParams();
|
|
44
|
-
params.set("objective", args.objective);
|
|
45
|
-
if (args.platform)
|
|
46
|
-
params.set("platform", args.platform);
|
|
47
|
-
if (args.audienceSegment)
|
|
48
|
-
params.set("audienceSegment", args.audienceSegment);
|
|
49
|
-
if (args.funnelStage)
|
|
50
|
-
params.set("funnelStage", args.funnelStage);
|
|
51
|
-
if (args.maxNodesPerSlot !== undefined)
|
|
52
|
-
params.set("maxNodesPerSlot", String(args.maxNodesPerSlot));
|
|
53
|
-
const payload = await get(`/agent-os/${encodeURIComponent(s)}/cmo-context-pack?${params}`);
|
|
54
|
-
return jsonResult(payload);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* M7 — CMO control status MCP tool (verify-live / agent steering).
|
|
3
|
-
*
|
|
4
|
-
* Read-only customer-safe marketing rollup: connection, approvals, trend
|
|
5
|
-
* snapshot summary, campaign evidence rows, and next actions.
|
|
6
|
-
*/
|
|
7
|
-
type ToolResult = {
|
|
8
|
-
content: {
|
|
9
|
-
type: "text";
|
|
10
|
-
text: string;
|
|
11
|
-
}[];
|
|
12
|
-
structuredContent?: unknown;
|
|
13
|
-
};
|
|
14
|
-
export interface CmoControlToolDeps {
|
|
15
|
-
register: (name: string, description: string, inputSchema: Record<string, unknown>, cb: (args: any) => any) => void;
|
|
16
|
-
resolveToolSlug: (explicitSlug?: string) => Promise<string>;
|
|
17
|
-
jsonResult: (data: unknown) => ToolResult;
|
|
18
|
-
}
|
|
19
|
-
export declare function registerCmoControlTools({ register, resolveToolSlug, jsonResult, }: CmoControlToolDeps): void;
|
|
20
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* M7 — CMO control status MCP tool (verify-live / agent steering).
|
|
3
|
-
*
|
|
4
|
-
* Read-only customer-safe marketing rollup: connection, approvals, trend
|
|
5
|
-
* snapshot summary, campaign evidence rows, and next actions.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
import { get } from "../lib/kynver-client.js";
|
|
9
|
-
const slugField = z
|
|
10
|
-
.string()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe("AgentOS slug. Defaults to env/primary AgentOS.");
|
|
13
|
-
export function registerCmoControlTools({ register, resolveToolSlug, jsonResult, }) {
|
|
14
|
-
register("agent_os_cmo_control_status_get", [
|
|
15
|
-
"Fetch the user-facing marketing / CMO control status for Command Center.",
|
|
16
|
-
"Returns connection health, pending marketing approvals, trend snapshot summary,",
|
|
17
|
-
"recent campaign activity evidence, executive summary, and suggested next actions.",
|
|
18
|
-
"Customer-safe copy only — no credentials, lane names, or memory internals.",
|
|
19
|
-
"Read-only; safe for unattended verification.",
|
|
20
|
-
"Workbench: navigate to view=marketing or open_panel system:cmo-campaign.",
|
|
21
|
-
].join(" "), { slug: slugField }, async ({ slug }) => {
|
|
22
|
-
const s = await resolveToolSlug(slug);
|
|
23
|
-
const payload = await get(`/agent-os/${encodeURIComponent(s)}/cmo-control`);
|
|
24
|
-
return jsonResult(payload);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command Center MCP tools — unified rollup for AgentOS operators.
|
|
3
|
-
*
|
|
4
|
-
* agent_os_command_center_get proxies to GET `/api/agent-os/by-id/{agentOsId}/command-center`
|
|
5
|
-
* (full rollup; `countSnapshot` is the canonical badge contract aligned with the UI).
|
|
6
|
-
*
|
|
7
|
-
* agent_os_command_center_dashboard_contract_get proxies to
|
|
8
|
-
* `.../command-center/dashboard-contract` — slim verification payload (counts,
|
|
9
|
-
* packageVersionHealth, runtime capacity, activePlanRollups, blockerSlo) without graph/hierarchy.
|
|
10
|
-
*/
|
|
11
|
-
type ToolResult = {
|
|
12
|
-
content: {
|
|
13
|
-
type: "text";
|
|
14
|
-
text: string;
|
|
15
|
-
}[];
|
|
16
|
-
structuredContent?: unknown;
|
|
17
|
-
};
|
|
18
|
-
export interface CommandCenterToolDeps {
|
|
19
|
-
register: (name: string, description: string, inputSchema: Record<string, unknown>, cb: (args: any) => any) => void;
|
|
20
|
-
resolveToolSlug: (explicitSlug?: string) => Promise<string>;
|
|
21
|
-
jsonResult: (data: unknown) => ToolResult;
|
|
22
|
-
}
|
|
23
|
-
export declare function registerCommandCenterTools({ register, resolveToolSlug, jsonResult, }: CommandCenterToolDeps): void;
|
|
24
|
-
export {};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command Center MCP tools — unified rollup for AgentOS operators.
|
|
3
|
-
*
|
|
4
|
-
* agent_os_command_center_get proxies to GET `/api/agent-os/by-id/{agentOsId}/command-center`
|
|
5
|
-
* (full rollup; `countSnapshot` is the canonical badge contract aligned with the UI).
|
|
6
|
-
*
|
|
7
|
-
* agent_os_command_center_dashboard_contract_get proxies to
|
|
8
|
-
* `.../command-center/dashboard-contract` — slim verification payload (counts,
|
|
9
|
-
* packageVersionHealth, runtime capacity, activePlanRollups, blockerSlo) without graph/hierarchy.
|
|
10
|
-
*/
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
import { get } from "../lib/kynver-client.js";
|
|
13
|
-
import { jsonResultOrdered } from "../lib/mcp-json-result.js";
|
|
14
|
-
const COMMAND_CENTER_MCP_PRIORITY_KEYS = [
|
|
15
|
-
"agentReadable",
|
|
16
|
-
"resultContract",
|
|
17
|
-
"agentOsId",
|
|
18
|
-
"rollupVersion",
|
|
19
|
-
"generatedAt",
|
|
20
|
-
"headsUp",
|
|
21
|
-
"runningTasks",
|
|
22
|
-
"nextActions",
|
|
23
|
-
"followUps",
|
|
24
|
-
"countSnapshot",
|
|
25
|
-
"readiness",
|
|
26
|
-
"attention",
|
|
27
|
-
"runtime",
|
|
28
|
-
"packageVersionHealth",
|
|
29
|
-
"dailyLandedPrs",
|
|
30
|
-
"usefulProgress",
|
|
31
|
-
"usefulProgressLedger",
|
|
32
|
-
"reviewLanes",
|
|
33
|
-
"activePlanRollups",
|
|
34
|
-
"tasksPreview",
|
|
35
|
-
"unparentedTasksPreview",
|
|
36
|
-
"harnessRunsPreview",
|
|
37
|
-
"freshness",
|
|
38
|
-
"sourceFreshness",
|
|
39
|
-
"dashboard",
|
|
40
|
-
];
|
|
41
|
-
async function resolveAgentOsId(slug) {
|
|
42
|
-
const row = await get(`/agent-os/${encodeURIComponent(slug)}`);
|
|
43
|
-
const id = typeof row.id === "string" ? row.id.trim() : "";
|
|
44
|
-
if (!id) {
|
|
45
|
-
throw new Error(`AgentOS slug "${slug}" did not resolve to an id. Pass agentOsId explicitly or ensure GET /api/agent-os/{slug} returns id.`);
|
|
46
|
-
}
|
|
47
|
-
return id;
|
|
48
|
-
}
|
|
49
|
-
export function registerCommandCenterTools({ register, resolveToolSlug, jsonResult, }) {
|
|
50
|
-
register("agent_os_command_center_get", [
|
|
51
|
-
"Fetch the unified Command Center rollup for the AgentOS workspace:",
|
|
52
|
-
"plan rollups, project hierarchy, action-required items, DQ inbox, harness summaries,",
|
|
53
|
-
"prReadyNotifications (journal pr_ready events), dailyLandedPrs (journal merge counts:",
|
|
54
|
-
"today/yesterday, rolling 24h/48h, pace + agentReadable summary), runtime capacity, and",
|
|
55
|
-
"packageVersionHealth (managed npm alignment for @kynver-app/runtime).",
|
|
56
|
-
"Default projection=compact returns a tiny navigable brief (<12k UTF-8): heads-up counts,",
|
|
57
|
-
"capped running tasks, top next actions/blockers, and follow-up tool hints. Deep detail",
|
|
58
|
-
"requires agent_os_task_get, agent_os_plan_get, agent_os_tasks_list, or graph tools.",
|
|
59
|
-
"Pass projection=full only for admin/debug (expensive, truncation-prone browser rollup).",
|
|
60
|
-
"Same aggregate as the browser Command Center. Omit slug to use env/primary workspace;",
|
|
61
|
-
"pass agentOsId when already known from a prior identity fetch.",
|
|
62
|
-
].join(" "), {
|
|
63
|
-
slug: z
|
|
64
|
-
.string()
|
|
65
|
-
.optional()
|
|
66
|
-
.describe("AgentOS slug. Defaults to the configured env/primary AgentOS."),
|
|
67
|
-
agentOsId: z
|
|
68
|
-
.string()
|
|
69
|
-
.optional()
|
|
70
|
-
.describe("Optional AgentOS row id. When omitted, resolved from slug via GET /api/agent-os/{slug}."),
|
|
71
|
-
since: z
|
|
72
|
-
.string()
|
|
73
|
-
.optional()
|
|
74
|
-
.describe("ISO timestamp — only include tasks updated after this instant."),
|
|
75
|
-
limit: z
|
|
76
|
-
.number()
|
|
77
|
-
.optional()
|
|
78
|
-
.describe("Max tasks to load (server cap 10000)."),
|
|
79
|
-
harnessLimit: z
|
|
80
|
-
.number()
|
|
81
|
-
.optional()
|
|
82
|
-
.describe("Max harness runs in the rollup (server cap 200)."),
|
|
83
|
-
projection: z
|
|
84
|
-
.enum(["compact", "full"])
|
|
85
|
-
.optional()
|
|
86
|
-
.describe("Response shape. Default compact — tiny brief flight-board (<12k). Use full only for admin/debug."),
|
|
87
|
-
}, async (args) => {
|
|
88
|
-
const slug = await resolveToolSlug(args.slug);
|
|
89
|
-
const agentOsId = typeof args.agentOsId === "string" && args.agentOsId.trim()
|
|
90
|
-
? args.agentOsId.trim()
|
|
91
|
-
: await resolveAgentOsId(slug);
|
|
92
|
-
const qs = new URLSearchParams();
|
|
93
|
-
if (typeof args.since === "string" && args.since.trim())
|
|
94
|
-
qs.set("since", args.since.trim());
|
|
95
|
-
if (typeof args.limit === "number" && Number.isFinite(args.limit)) {
|
|
96
|
-
qs.set("limit", String(args.limit));
|
|
97
|
-
}
|
|
98
|
-
if (typeof args.harnessLimit === "number" && Number.isFinite(args.harnessLimit)) {
|
|
99
|
-
qs.set("harnessLimit", String(args.harnessLimit));
|
|
100
|
-
}
|
|
101
|
-
const projection = args.projection === "full" ? "full" : "compact";
|
|
102
|
-
qs.set("projection", projection);
|
|
103
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
104
|
-
const payload = await get(`/agent-os/by-id/${encodeURIComponent(agentOsId)}/command-center${suffix}`);
|
|
105
|
-
if (projection === "compact") {
|
|
106
|
-
return jsonResultOrdered(payload, COMMAND_CENTER_MCP_PRIORITY_KEYS);
|
|
107
|
-
}
|
|
108
|
-
return jsonResult(payload);
|
|
109
|
-
});
|
|
110
|
-
register("agent_os_command_center_dashboard_contract_get", [
|
|
111
|
-
"Fetch the Command Center dashboard MCP brief (default projection=mcp): same tiny flight-board",
|
|
112
|
-
"as agent_os_command_center_get compact — heads-up counts, running tasks, next actions, follow-ups.",
|
|
113
|
-
"Pass projection=slim only when you need the full dashboard verification DTO (large on big boards).",
|
|
114
|
-
].join(" "), {
|
|
115
|
-
slug: z
|
|
116
|
-
.string()
|
|
117
|
-
.optional()
|
|
118
|
-
.describe("AgentOS slug. Defaults to the configured env/primary AgentOS."),
|
|
119
|
-
agentOsId: z
|
|
120
|
-
.string()
|
|
121
|
-
.optional()
|
|
122
|
-
.describe("Optional AgentOS row id. When omitted, resolved from slug."),
|
|
123
|
-
since: z
|
|
124
|
-
.string()
|
|
125
|
-
.optional()
|
|
126
|
-
.describe("ISO timestamp — only include tasks updated after this instant."),
|
|
127
|
-
limit: z
|
|
128
|
-
.number()
|
|
129
|
-
.optional()
|
|
130
|
-
.describe("Max tasks to load when building counts (server cap 10000)."),
|
|
131
|
-
projection: z
|
|
132
|
-
.enum(["mcp", "slim"])
|
|
133
|
-
.optional()
|
|
134
|
-
.describe("mcp (default) — tiny brief. slim — full dashboard verification DTO (countSnapshot, activePlanRollups, …)."),
|
|
135
|
-
}, async (args) => {
|
|
136
|
-
const slug = await resolveToolSlug(args.slug);
|
|
137
|
-
const agentOsId = typeof args.agentOsId === "string" && args.agentOsId.trim()
|
|
138
|
-
? args.agentOsId.trim()
|
|
139
|
-
: await resolveAgentOsId(slug);
|
|
140
|
-
const qs = new URLSearchParams();
|
|
141
|
-
if (typeof args.since === "string" && args.since.trim())
|
|
142
|
-
qs.set("since", args.since.trim());
|
|
143
|
-
if (typeof args.limit === "number" && Number.isFinite(args.limit)) {
|
|
144
|
-
qs.set("limit", String(args.limit));
|
|
145
|
-
}
|
|
146
|
-
const projection = args.projection === "slim" ? "slim" : "mcp";
|
|
147
|
-
qs.set("projection", projection === "slim" ? "slim" : "mcp");
|
|
148
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
149
|
-
const payload = await get(`/agent-os/by-id/${encodeURIComponent(agentOsId)}/command-center/dashboard-contract${suffix}`);
|
|
150
|
-
if (projection === "mcp") {
|
|
151
|
-
return jsonResultOrdered(payload, COMMAND_CENTER_MCP_PRIORITY_KEYS);
|
|
152
|
-
}
|
|
153
|
-
return jsonResult(payload);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP adapter for authenticated memory-context expansion (PR5).
|
|
3
|
-
* Endpoints remain dark unless KYNVER_MEMORY_EXPANSION is enabled server-side.
|
|
4
|
-
*/
|
|
5
|
-
type ToolResult = {
|
|
6
|
-
content: {
|
|
7
|
-
type: "text";
|
|
8
|
-
text: string;
|
|
9
|
-
}[];
|
|
10
|
-
structuredContent?: unknown;
|
|
11
|
-
};
|
|
12
|
-
export interface ContextExpandToolDeps {
|
|
13
|
-
register: (name: string, description: string, inputSchema: Record<string, unknown>, cb: (args: any) => any) => void;
|
|
14
|
-
resolveToolSlug: (explicitSlug?: string) => Promise<string>;
|
|
15
|
-
jsonResult: (data: unknown) => ToolResult;
|
|
16
|
-
}
|
|
17
|
-
export declare function registerContextExpandTools({ register, resolveToolSlug, jsonResult, }: ContextExpandToolDeps): void;
|
|
18
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP adapter for authenticated memory-context expansion (PR5).
|
|
3
|
-
* Endpoints remain dark unless KYNVER_MEMORY_EXPANSION is enabled server-side.
|
|
4
|
-
*/
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
import { post } from "../lib/kynver-client.js";
|
|
7
|
-
export function registerContextExpandTools({ register, resolveToolSlug, jsonResult, }) {
|
|
8
|
-
register("agent_os_context_expand", [
|
|
9
|
-
"Expand an opaque runtime-memory envelope handle into a customer-safe preview.",
|
|
10
|
-
"Requires a signed grantToken plus envelopeId from the runtime envelope.",
|
|
11
|
-
"Dark unless the deployment enables KYNVER_MEMORY_EXPANSION.",
|
|
12
|
-
"Read-only and safe for unattended synthetic verification.",
|
|
13
|
-
].join(" "), {
|
|
14
|
-
slug: z.string().optional().describe("AgentOS slug. Defaults to env/primary."),
|
|
15
|
-
grantToken: z.string().describe("Signed expansion grant (kve:g:…)."),
|
|
16
|
-
envelopeId: z.string().describe("Envelope id the grant was minted for."),
|
|
17
|
-
purpose: z.string().optional().describe("Caller purpose label for audit receipts."),
|
|
18
|
-
}, async (args) => {
|
|
19
|
-
const slug = await resolveToolSlug(args.slug);
|
|
20
|
-
return jsonResult(await post(`/agent-os/${encodeURIComponent(slug)}/memory-context/expand`, {
|
|
21
|
-
grantToken: args.grantToken,
|
|
22
|
-
envelopeId: args.envelopeId,
|
|
23
|
-
purpose: args.purpose ?? "mcp_context_expand",
|
|
24
|
-
}, { headers: { "X-Kynver-Expansion-Surface": "memory_context_mcp" } }));
|
|
25
|
-
});
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
type ToolResult = {
|
|
2
|
-
content: {
|
|
3
|
-
type: "text";
|
|
4
|
-
text: string;
|
|
5
|
-
}[];
|
|
6
|
-
structuredContent?: unknown;
|
|
7
|
-
};
|
|
8
|
-
export interface ContextPreviewToolDeps {
|
|
9
|
-
register: (name: string, description: string, inputSchema: Record<string, unknown>, cb: (args: Record<string, unknown>) => unknown) => void;
|
|
10
|
-
jsonResult: (data: unknown) => ToolResult;
|
|
11
|
-
}
|
|
12
|
-
/** Admin-safe MCP tool — reports legacy vs shadow preview deltas (PR6 dark integration). */
|
|
13
|
-
export declare function registerContextPreviewTools({ register, jsonResult }: ContextPreviewToolDeps): void;
|
|
14
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { buildChatMemoryShadowPreview, buildLegacyChatMemorySection, } from "@kynver-app/runtime/server/context-budget-receipt";
|
|
3
|
-
function envTruthy(value) {
|
|
4
|
-
if (!value)
|
|
5
|
-
return false;
|
|
6
|
-
const normalized = value.trim().toLowerCase();
|
|
7
|
-
return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
|
|
8
|
-
}
|
|
9
|
-
const DEFAULT_EXPANSION_ROUTE = "agent_os_search_memory";
|
|
10
|
-
/** Admin-safe MCP tool — reports legacy vs shadow preview deltas (PR6 dark integration). */
|
|
11
|
-
export function registerContextPreviewTools({ register, jsonResult }) {
|
|
12
|
-
register("agent_os_context_preview_shadow", "Compare legacy vs unified preview renderer output for a sample memory list. Dark rollout only — does not mutate prompts. Safe for operator verification.", {
|
|
13
|
-
memories: z
|
|
14
|
-
.array(z.object({
|
|
15
|
-
content: z.string(),
|
|
16
|
-
similarity: z.number().optional(),
|
|
17
|
-
}))
|
|
18
|
-
.optional()
|
|
19
|
-
.describe("Sample recalled memories to shadow-compare (default: one fixture row)."),
|
|
20
|
-
}, async (args) => {
|
|
21
|
-
const memories = args.memories ?? [
|
|
22
|
-
{
|
|
23
|
-
content: "Context maps should use route-map previews before raw payloads.",
|
|
24
|
-
similarity: 0.92,
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
const legacy = buildLegacyChatMemorySection(memories);
|
|
28
|
-
const shadow = buildChatMemoryShadowPreview(memories);
|
|
29
|
-
const flagEnabled = envTruthy(process.env.KYNVER_MEMORY_PREVIEW_ALL_SURFACES);
|
|
30
|
-
const legacyChars = legacy.length;
|
|
31
|
-
const shadowChars = shadow.length;
|
|
32
|
-
return jsonResult({
|
|
33
|
-
flag: {
|
|
34
|
-
enabled: flagEnabled,
|
|
35
|
-
envVar: "KYNVER_MEMORY_PREVIEW_ALL_SURFACES",
|
|
36
|
-
effectiveSource: flagEnabled ? "env_explicit_on" : "default_off",
|
|
37
|
-
},
|
|
38
|
-
comparison: {
|
|
39
|
-
surface: "chat_default",
|
|
40
|
-
legacyChars,
|
|
41
|
-
shadowChars,
|
|
42
|
-
charDelta: shadowChars - legacyChars,
|
|
43
|
-
shadowWithinBaseline: shadowChars <= legacyChars,
|
|
44
|
-
expansionRoutesRetained: shadow.includes(DEFAULT_EXPANSION_ROUTE),
|
|
45
|
-
usingShadow: flagEnabled,
|
|
46
|
-
},
|
|
47
|
-
legacyPreview: legacy.slice(0, 500),
|
|
48
|
-
shadowPreview: shadow.slice(0, 500),
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kynver current-focus / todo-projection MCP tools (M5).
|
|
3
|
-
*
|
|
4
|
-
* kynver.focus.get → agent_os_focus_get
|
|
5
|
-
* kynver.focus.set → agent_os_focus_set
|
|
6
|
-
* kynver.focus.clear → agent_os_focus_clear
|
|
7
|
-
* kynver.todo.project → agent_os_todo_project
|
|
8
|
-
*
|
|
9
|
-
* CRITICAL INVARIANT:
|
|
10
|
-
* `in_progress` on a plan row = agent-loop current focus (set by these tools).
|
|
11
|
-
* `running` on a task = executor worker lease/heartbeat (never set here).
|
|
12
|
-
*
|
|
13
|
-
* Hermes `in_progress` maps ONLY to plan row `in_progress`. These tools never
|
|
14
|
-
* touch AgentTask.status — that is the dispatcher/executor's domain.
|
|
15
|
-
*/
|
|
16
|
-
import type { PlanToolDeps } from "./plans.js";
|
|
17
|
-
export declare function registerCurrentFocusTools({ register, resolveToolSlug, jsonResult, compact, }: PlanToolDeps): void;
|