@kynver-app/mcp-agent-os 0.3.68 → 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 -751
- 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-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/server.js
DELETED
|
@@ -1,751 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kynver Agentic OS MCP server: slug-keyed agent identity, goals, projects,
|
|
3
|
-
* sessions, contacts, and long-term memory.
|
|
4
|
-
*
|
|
5
|
-
* Each tool proxies to `/api/agent-os/{slug}/*` on Kynver. The optional `slug`
|
|
6
|
-
* argument resolves in order: explicit arg → `KYNVER_AGENT_OS_SLUG` → cached
|
|
7
|
-
* `GET /api/agent-os` `{ primarySlug }` → list first item → legacy `"ghost"`.
|
|
8
|
-
*/
|
|
9
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import { get, post, patch } from "./lib/kynver-client.js";
|
|
12
|
-
import { registerPlanTools } from "./tools/plans.js";
|
|
13
|
-
import { registerPlanProgressTools } from "./tools/plan-progress.js";
|
|
14
|
-
import { registerPlanToFactoryTools } from "./tools/plan-to-factory.js";
|
|
15
|
-
import { registerTaskTools } from "./tools/tasks.js";
|
|
16
|
-
import { registerActionRequiredTools } from "./tools/action-required.js";
|
|
17
|
-
import { registerGraphTools } from "./tools/graph.js";
|
|
18
|
-
import { registerWorkbenchTools } from "./tools/workbench.js";
|
|
19
|
-
import { registerCommandCenterTools } from "./tools/command-center.js";
|
|
20
|
-
import { registerMemoryQualityFeedbackTools } from "./tools/memory-quality-feedback.js";
|
|
21
|
-
import { registerOperatingRulesTools } from "./tools/operating-rules.js";
|
|
22
|
-
import { registerProviderEvidenceTools } from "./tools/provider-evidence.js";
|
|
23
|
-
import { registerPrBacklogTools } from "./tools/pr-backlog.js";
|
|
24
|
-
import { registerTaskBoardWatchdogTools } from "./tools/task-board-watchdog.js";
|
|
25
|
-
import { registerPlanAuditRollupTools } from "./tools/plan-audit-rollup.js";
|
|
26
|
-
import { registerMeshLivenessTools } from "./tools/mesh-liveness.js";
|
|
27
|
-
import { registerDiagnosticsTools } from "./tools/diagnostics.js";
|
|
28
|
-
import { registerSkillsTools } from "./tools/skills.js";
|
|
29
|
-
import { registerMemoryLedgerTools } from "./tools/memory-ledger.js";
|
|
30
|
-
import { registerMemoryVaultTools } from "./tools/memory-vault.js";
|
|
31
|
-
import { registerMonitorTools } from "./tools/monitor.js";
|
|
32
|
-
import { registerMacroControlsTools } from "./tools/macro-controls.js";
|
|
33
|
-
import { registerKariAdMarketingLoopTools } from "./tools/kariad-marketing-loop.js";
|
|
34
|
-
import { registerKariAdOutcomeImportTools } from "./tools/kariad-outcome-import.js";
|
|
35
|
-
import { registerCmoControlTools } from "./tools/cmo-control.js";
|
|
36
|
-
import { registerCurrentFocusTools } from "./tools/current-focus.js";
|
|
37
|
-
import { registerContextExpandTools } from "./tools/context-expand.js";
|
|
38
|
-
import { registerContextPreviewTools } from "./tools/context-preview.js";
|
|
39
|
-
import { registerTaskflowTools } from "./tools/taskflow.js";
|
|
40
|
-
import { readOwnPackageVersion } from "./lib/package-version.js";
|
|
41
|
-
const PACKAGE_VERSION = readOwnPackageVersion(import.meta.url);
|
|
42
|
-
function jsonResult(data) {
|
|
43
|
-
return {
|
|
44
|
-
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
45
|
-
structuredContent: data,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function compact(source) {
|
|
49
|
-
const out = {};
|
|
50
|
-
for (const [key, value] of Object.entries(source)) {
|
|
51
|
-
if (value !== undefined)
|
|
52
|
-
out[key] = value;
|
|
53
|
-
}
|
|
54
|
-
return out;
|
|
55
|
-
}
|
|
56
|
-
const MCP_LEGACY_SLUG_FALLBACK = "ghost";
|
|
57
|
-
export function resolveAgentContext(explicitAgentContext) {
|
|
58
|
-
const explicit = explicitAgentContext?.trim();
|
|
59
|
-
if (explicit)
|
|
60
|
-
return explicit;
|
|
61
|
-
const fromEnv = process.env.KYNVER_AGENT_CONTEXT?.trim() || process.env.KYNVER_AGENT_OS_CONTEXT?.trim() || "";
|
|
62
|
-
return fromEnv || undefined;
|
|
63
|
-
}
|
|
64
|
-
export function createAgentOsServer() {
|
|
65
|
-
const server = new McpServer({ name: "kynver-mcp-agent-os", version: PACKAGE_VERSION }, { capabilities: { tools: {} } });
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
-
function register(name, description, inputSchema, cb) {
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
-
server.registerTool(name, { description, inputSchema }, cb);
|
|
70
|
-
}
|
|
71
|
-
let cachedResolvedPrimarySlug = null;
|
|
72
|
-
async function resolveToolSlug(explicitSlug) {
|
|
73
|
-
const trimmed = explicitSlug?.trim();
|
|
74
|
-
if (trimmed)
|
|
75
|
-
return trimmed;
|
|
76
|
-
const fromEnv = process.env.KYNVER_AGENT_OS_SLUG?.trim();
|
|
77
|
-
if (fromEnv)
|
|
78
|
-
return fromEnv;
|
|
79
|
-
if (cachedResolvedPrimarySlug)
|
|
80
|
-
return cachedResolvedPrimarySlug;
|
|
81
|
-
try {
|
|
82
|
-
const body = await get("/agent-os");
|
|
83
|
-
const primary = typeof body.primarySlug === "string" ? body.primarySlug.trim() : "";
|
|
84
|
-
if (primary) {
|
|
85
|
-
cachedResolvedPrimarySlug = primary;
|
|
86
|
-
return primary;
|
|
87
|
-
}
|
|
88
|
-
const first = Array.isArray(body.items) ? body.items[0]?.slug : undefined;
|
|
89
|
-
if (typeof first === "string") {
|
|
90
|
-
const t = first.trim();
|
|
91
|
-
if (t) {
|
|
92
|
-
cachedResolvedPrimarySlug = t;
|
|
93
|
-
return t;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
catch {
|
|
98
|
-
// fall through
|
|
99
|
-
}
|
|
100
|
-
return MCP_LEGACY_SLUG_FALLBACK;
|
|
101
|
-
}
|
|
102
|
-
const slugField = z.string().optional().describe("AgentOS slug within your account. Omit to use env or server-discovered primary (GET /api/agent-os). Legacy: `ghost`.");
|
|
103
|
-
const memorySurfaceField = z
|
|
104
|
-
.enum(["operator", "customer"])
|
|
105
|
-
.optional()
|
|
106
|
-
.describe("Response shape for memory reads. Owners/env admins may pass operator for full diagnostics or customer to preview grantee-safe JSON. Grantees always receive customer-safe fields regardless of this flag.");
|
|
107
|
-
const contextProjectionField = z
|
|
108
|
-
.enum(["brief", "full"])
|
|
109
|
-
.optional()
|
|
110
|
-
.describe("Response shape. Default brief returns compact identity/current-work context with follow-up hints. full returns the legacy broad stats payload and can be large/truncation-prone.");
|
|
111
|
-
const agentContextField = z
|
|
112
|
-
.string()
|
|
113
|
-
.optional()
|
|
114
|
-
.describe("Active agent/runtime/persona context within the shared AgentOS workspace, e.g. ghost, forge, or hermes-forge. Do not use slug for this; slug selects the workspace.");
|
|
115
|
-
const sourceRefSchema = z
|
|
116
|
-
.object({
|
|
117
|
-
type: z
|
|
118
|
-
.enum(["repo", "commit", "branch", "pr", "map", "session", "tool", "url", "manual", "unknown"])
|
|
119
|
-
.describe("What kind of source backs this memory."),
|
|
120
|
-
label: z.string().optional(),
|
|
121
|
-
repo: z.string().optional(),
|
|
122
|
-
path: z.string().optional(),
|
|
123
|
-
commit: z.string().optional(),
|
|
124
|
-
branch: z.string().optional(),
|
|
125
|
-
pr: z.union([z.number(), z.string()]).optional(),
|
|
126
|
-
url: z.string().optional(),
|
|
127
|
-
sessionId: z.string().optional(),
|
|
128
|
-
toolName: z.string().optional(),
|
|
129
|
-
note: z.string().optional(),
|
|
130
|
-
})
|
|
131
|
-
.passthrough();
|
|
132
|
-
const memoryTypeSchema = z
|
|
133
|
-
.enum(["decision", "lesson", "fact", "preference", "project_update", "runbook", "source_map", "correction", "active_state", "note"])
|
|
134
|
-
.describe("What kind of durable memory this is. Use note only when a more specific type does not fit.");
|
|
135
|
-
const confidenceSchema = z
|
|
136
|
-
.enum(["low", "medium", "high"])
|
|
137
|
-
.describe("How reliable this memory is based on available evidence.");
|
|
138
|
-
const reviewStatusSchema = z
|
|
139
|
-
.enum(["none", "needs_review", "reviewed", "stale", "rejected"])
|
|
140
|
-
.describe("Set needs_review for important, uncertain, stale-looking, or user-correctable memories.");
|
|
141
|
-
const activeStateEntityTypeSchema = z
|
|
142
|
-
.enum(["pr_watch", "branch", "deployment"])
|
|
143
|
-
.describe("Tracked entity kind. pr_watch: a live PR. branch: local-vs-remote branch state. deployment: a live release.");
|
|
144
|
-
const skillCategorySchema = z.enum(["engineering", "productivity", "agent_ops", "domain", "personal", "misc"]);
|
|
145
|
-
const skillStatusSchema = z.enum(["draft", "active", "deprecated", "archived"]);
|
|
146
|
-
const skillDraftSchema = z.object({
|
|
147
|
-
slug: z.string().optional().describe("Stable skill slug. Required for JSON skill imports and skill creation."),
|
|
148
|
-
name: z.string().optional(),
|
|
149
|
-
description: z.string().nullable().optional(),
|
|
150
|
-
category: skillCategorySchema.optional(),
|
|
151
|
-
status: skillStatusSchema.optional().describe("Imports default to draft regardless of this value."),
|
|
152
|
-
triggerRules: z.string().nullable().optional(),
|
|
153
|
-
instructions: z.string().optional(),
|
|
154
|
-
sourceRefs: z.array(sourceRefSchema).optional(),
|
|
155
|
-
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
156
|
-
});
|
|
157
|
-
const sessionEventSchema = z
|
|
158
|
-
.object({
|
|
159
|
-
type: z.enum(["topic", "decision", "action", "file", "commit", "pr", "tool", "follow_up", "blocker", "note"]).optional(),
|
|
160
|
-
summary: z.string().describe("Short factual event summary."),
|
|
161
|
-
timestamp: z.string().optional(),
|
|
162
|
-
details: z.record(z.string(), z.unknown()).optional(),
|
|
163
|
-
sourceRefs: z.array(sourceRefSchema).optional(),
|
|
164
|
-
})
|
|
165
|
-
.passthrough();
|
|
166
|
-
register("agent_os_get_context", "Get compact startup context: identity/Soul-equivalent, key preferences, current-work pointers, memory stats, and follow-up instructions. Default brief stays small; projection=full returns the legacy broad stats payload. Pass agentContext for persona-specific context inside a shared workspace.", { slug: slugField, projection: contextProjectionField, agentContext: agentContextField }, async (args) => {
|
|
167
|
-
const s = await resolveToolSlug(args.slug);
|
|
168
|
-
const params = new URLSearchParams();
|
|
169
|
-
params.set("projection", args.projection === "full" ? "full" : "brief");
|
|
170
|
-
const agentContext = resolveAgentContext(args.agentContext);
|
|
171
|
-
if (agentContext) {
|
|
172
|
-
params.set("agentContext", agentContext);
|
|
173
|
-
}
|
|
174
|
-
return jsonResult(await get(`/agent-os/${s}/stats?${params}`));
|
|
175
|
-
});
|
|
176
|
-
register("agent_os_context_envelope", "Build a compact context envelope for one anchor (plan | task | goal | project | session). Returns the resolved anchor, its goal + plan (with current version body) + most-relevant task + recent session + top related memories with deduplicated source refs. Use this instead of reading giant docs when picking up an in-flight piece of work — one round trip, scoped to your workspace.", {
|
|
177
|
-
anchorType: z.enum(["plan", "task", "goal", "project", "session"]).describe("Kind of anchor to load context around."),
|
|
178
|
-
anchorId: z.string().describe("Id of the anchor row within this workspace."),
|
|
179
|
-
memoryQuery: z.string().optional().describe("Override the memory search query. Defaults to a query derived from the anchor's title/summary."),
|
|
180
|
-
memoryLimit: z.number().optional().describe("Max memory hits (default 5, max 20). Set 0 to skip memory recall."),
|
|
181
|
-
sessionLimit: z.number().optional().describe("Max recent sessions (default 1, max 5). Set 0 to skip."),
|
|
182
|
-
resolveCurrentFocus: z.boolean().optional().describe("M2: when true and anchorType=session, resolve the most-recently-active non-terminal task as current focus. Read-only — never mutates task status. Use for agents (e.g. Hermes chat) that do not start from an explicit task anchor."),
|
|
183
|
-
surface: memorySurfaceField,
|
|
184
|
-
slug: slugField,
|
|
185
|
-
}, async (args) => {
|
|
186
|
-
const s = await resolveToolSlug(args.slug);
|
|
187
|
-
const params = new URLSearchParams();
|
|
188
|
-
params.set("anchorType", args.anchorType);
|
|
189
|
-
params.set("anchorId", args.anchorId);
|
|
190
|
-
if (args.memoryQuery)
|
|
191
|
-
params.set("memoryQuery", args.memoryQuery);
|
|
192
|
-
if (args.memoryLimit !== undefined)
|
|
193
|
-
params.set("memoryLimit", String(args.memoryLimit));
|
|
194
|
-
if (args.sessionLimit !== undefined)
|
|
195
|
-
params.set("sessionLimit", String(args.sessionLimit));
|
|
196
|
-
if (args.resolveCurrentFocus)
|
|
197
|
-
params.set("resolveCurrentFocus", "true");
|
|
198
|
-
if (args.surface)
|
|
199
|
-
params.set("surface", args.surface);
|
|
200
|
-
return jsonResult(await get(`/agent-os/${s}/context-envelope?${params}`));
|
|
201
|
-
});
|
|
202
|
-
register("agent_os_open_session", "Call this at the START of every session. Records channel, model, and opens a session record for continuity. Ghost calls this immediately after agent_os_get_context on startup.", {
|
|
203
|
-
channel: z.string().describe("Runtime channel: 'webchat' | 'telegram' | 'discord' | …"),
|
|
204
|
-
model: z.string().optional().describe("Model used for the session (default 'claude-sonnet-4-6')."),
|
|
205
|
-
slug: slugField,
|
|
206
|
-
}, async (args) => {
|
|
207
|
-
const { slug, ...body } = args;
|
|
208
|
-
const s = await resolveToolSlug(slug);
|
|
209
|
-
return jsonResult(await post(`/agent-os/${s}/sessions`, body));
|
|
210
|
-
});
|
|
211
|
-
register("agent_os_close_session", "Call this at the END of every session with a summary of what was accomplished and key decisions made. This is how Ghost maintains cross-session continuity — without it, the next session has no record of what happened.", {
|
|
212
|
-
sessionId: z.string(),
|
|
213
|
-
summary: z.string().optional(),
|
|
214
|
-
topicsWorked: z.array(z.string()).optional(),
|
|
215
|
-
decisionsLog: z.unknown().optional(),
|
|
216
|
-
events: z.array(sessionEventSchema).optional().describe("Structured events to merge into the session trace before close-summary synthesis."),
|
|
217
|
-
goalIds: z.array(z.string()).optional(),
|
|
218
|
-
projectIds: z.array(z.string()).optional(),
|
|
219
|
-
slug: slugField,
|
|
220
|
-
}, async (args) => {
|
|
221
|
-
const { slug, sessionId, ...body } = args;
|
|
222
|
-
const s = await resolveToolSlug(slug);
|
|
223
|
-
return jsonResult(await patch(`/agent-os/${s}/sessions/${sessionId}`, body));
|
|
224
|
-
});
|
|
225
|
-
register("agent_os_log_session_event", "Append a structured event to an open AgentOS session. Use for topics, decisions, actions, touched files, commits/PRs, blockers, and follow-ups so close summaries can be synthesized from real session traces.", {
|
|
226
|
-
sessionId: z.string().describe("Open AgentOS session id."),
|
|
227
|
-
type: z.enum(["topic", "decision", "action", "file", "commit", "pr", "tool", "follow_up", "blocker", "note"]).optional(),
|
|
228
|
-
summary: z.string().describe("Short factual event summary."),
|
|
229
|
-
timestamp: z.string().optional(),
|
|
230
|
-
details: z.record(z.string(), z.unknown()).optional(),
|
|
231
|
-
sourceRefs: z.array(sourceRefSchema).optional(),
|
|
232
|
-
slug: slugField,
|
|
233
|
-
}, async (args) => {
|
|
234
|
-
const { slug, sessionId, ...event } = args;
|
|
235
|
-
const s = await resolveToolSlug(slug);
|
|
236
|
-
return jsonResult(await post(`/agent-os/${s}/sessions/${sessionId}/events`, { event }));
|
|
237
|
-
});
|
|
238
|
-
register("agent_os_log_session", "Append a structured session-log entry to the agent's daily log. Call at session end or mid-session checkpoints. Replaces writing to memory/YYYY-MM-DD.md. Entries accumulate across sessions; consolidation distils them into long-term memory.", {
|
|
239
|
-
summary: z.string().describe("2-4 sentence summary of what was worked on."),
|
|
240
|
-
topicsWorked: z.array(z.string()).optional().describe("Topics covered this session."),
|
|
241
|
-
keyDecisions: z.array(z.string()).optional().describe("Important decisions made."),
|
|
242
|
-
date: z.string().optional().describe("Date to log against (YYYY-MM-DD, defaults to today UTC)."),
|
|
243
|
-
slug: slugField,
|
|
244
|
-
}, async (args) => {
|
|
245
|
-
const lines = [args.summary];
|
|
246
|
-
if (args.topicsWorked?.length)
|
|
247
|
-
lines.push(`Topics: ${args.topicsWorked.join(", ")}`);
|
|
248
|
-
if (args.keyDecisions?.length) {
|
|
249
|
-
lines.push("Key decisions:");
|
|
250
|
-
args.keyDecisions.forEach((d) => lines.push(`- ${d}`));
|
|
251
|
-
}
|
|
252
|
-
const entry = lines.join("\n");
|
|
253
|
-
const s = await resolveToolSlug(args.slug);
|
|
254
|
-
return jsonResult(await post(`/agent-os/${s}/daily-log`, {
|
|
255
|
-
entry,
|
|
256
|
-
...(args.date ? { date: args.date } : {}),
|
|
257
|
-
}));
|
|
258
|
-
});
|
|
259
|
-
register("agent_os_list_goals", "List the agent's goals, optionally filtered by status or project. Replaces reading the pending sections of MEMORY.md.", {
|
|
260
|
-
status: z
|
|
261
|
-
.enum(["open", "in_progress", "blocked", "complete", "cancelled"])
|
|
262
|
-
.optional()
|
|
263
|
-
.describe("Filter by status. Omit to get all goals."),
|
|
264
|
-
projectId: z.string().optional().describe("Filter by project DB ID."),
|
|
265
|
-
slug: slugField,
|
|
266
|
-
}, async (args) => {
|
|
267
|
-
const params = new URLSearchParams();
|
|
268
|
-
if (args.status)
|
|
269
|
-
params.set("status", args.status);
|
|
270
|
-
if (args.projectId)
|
|
271
|
-
params.set("projectId", args.projectId);
|
|
272
|
-
const qs = params.toString();
|
|
273
|
-
const s = await resolveToolSlug(args.slug);
|
|
274
|
-
return jsonResult(await get(`/agent-os/${s}/goals${qs ? `?${qs}` : ""}`));
|
|
275
|
-
});
|
|
276
|
-
register("agent_os_update_goal", "Create a new goal or update an existing one. Pass goalId to update; omit to create (title is then required). Set status=complete with an outcome to close a goal (stamps closedAt). projectId is the project DB ID from agent_os_get_projects.", {
|
|
277
|
-
title: z.string().optional().describe("Goal title. Required when creating."),
|
|
278
|
-
description: z.string().optional(),
|
|
279
|
-
status: z.enum(["open", "in_progress", "blocked", "complete", "cancelled"]).optional(),
|
|
280
|
-
priority: z.enum(["low", "normal", "high", "critical"]).optional(),
|
|
281
|
-
projectId: z.string().optional().describe("Project DB ID to associate."),
|
|
282
|
-
analystHypothesisId: z.string().optional().describe("Optional analyst hypothesis to link (create-only)."),
|
|
283
|
-
outcome: z.string().optional().describe("Outcome — include when closing a goal."),
|
|
284
|
-
goalId: z.string().optional().describe("ID of existing goal to update. Omit to create."),
|
|
285
|
-
slug: slugField,
|
|
286
|
-
}, async (args) => {
|
|
287
|
-
const { goalId, slug, ...body } = args;
|
|
288
|
-
const s = await resolveToolSlug(slug);
|
|
289
|
-
if (goalId) {
|
|
290
|
-
return jsonResult(await patch(`/agent-os/${s}/goals/${goalId}`, body));
|
|
291
|
-
}
|
|
292
|
-
if (!body.title) {
|
|
293
|
-
return jsonResult({ error: "title is required when creating a goal" });
|
|
294
|
-
}
|
|
295
|
-
return jsonResult(await post(`/agent-os/${s}/goals`, body));
|
|
296
|
-
});
|
|
297
|
-
register("agent_os_get_projects", "Get all projects the agent is tracking with current focus, next actions, blockers, and status. Replaces reading project sections of MEMORY.md.", {
|
|
298
|
-
status: z
|
|
299
|
-
.enum(["active", "on_hold", "shipped", "archived"])
|
|
300
|
-
.optional()
|
|
301
|
-
.describe("Filter by project status. Omit to get all."),
|
|
302
|
-
slug: slugField,
|
|
303
|
-
}, async (args) => {
|
|
304
|
-
const params = new URLSearchParams();
|
|
305
|
-
if (args.status)
|
|
306
|
-
params.set("status", args.status);
|
|
307
|
-
const qs = params.toString();
|
|
308
|
-
const s = await resolveToolSlug(args.slug);
|
|
309
|
-
return jsonResult(await get(`/agent-os/${s}/projects${qs ? `?${qs}` : ""}`));
|
|
310
|
-
});
|
|
311
|
-
register("agent_os_update_project", "Update a project's current focus, next-actions queue, blockers list, status, or repo/deploy URLs. The projectId is the DB ID from agent_os_get_projects.", {
|
|
312
|
-
projectId: z.string().describe("Project DB ID (from agent_os_get_projects)."),
|
|
313
|
-
name: z.string().optional(),
|
|
314
|
-
description: z.string().optional(),
|
|
315
|
-
status: z.enum(["active", "on_hold", "shipped", "archived"]).optional(),
|
|
316
|
-
currentFocus: z.string().optional().describe("What's being worked on right now."),
|
|
317
|
-
nextActions: z.array(z.string()).optional().describe("Ordered list of next steps."),
|
|
318
|
-
blockers: z.array(z.string()).optional().describe("Current blockers."),
|
|
319
|
-
repoUrl: z.string().optional(),
|
|
320
|
-
deployUrl: z.string().optional(),
|
|
321
|
-
slug: slugField,
|
|
322
|
-
}, async (args) => {
|
|
323
|
-
const { projectId, slug, ...body } = args;
|
|
324
|
-
const s = await resolveToolSlug(slug);
|
|
325
|
-
return jsonResult(await patch(`/agent-os/${s}/projects/${projectId}`, body));
|
|
326
|
-
});
|
|
327
|
-
register("agent_os_search_memory", "Search the agent's long-term memory (ownerType=agent). Use to recall specific decisions, project details, or lessons without loading full context. Replaces grep/reading MEMORY.md. Optionally restrict to one source namespace via sourceId, or several via sourceIds (sourceId takes precedence when both are set). Workspace owners and env admins receive additional operator diagnostics unless surface=customer; grantees always receive grantee-safe hits (content, trust, evidence links only).", {
|
|
328
|
-
query: z.string().describe("Natural language query to search memory."),
|
|
329
|
-
k: z.number().optional().describe("Number of results (default 5, max 50)."),
|
|
330
|
-
sourceId: z
|
|
331
|
-
.string()
|
|
332
|
-
.optional()
|
|
333
|
-
.describe("Restrict search to a single memory source namespace (e.g. agent:session). Takes precedence over sourceIds when both are set."),
|
|
334
|
-
sourceIds: z
|
|
335
|
-
.array(z.string())
|
|
336
|
-
.optional()
|
|
337
|
-
.describe("Restrict search to any of these source namespaces. Ignored when sourceId is also set."),
|
|
338
|
-
ticker: z.string().optional().describe("Trading desk: filter hits to this ticker symbol."),
|
|
339
|
-
debatePersona: z.enum(["bull", "bear"]).optional().describe("Trading desk: filter to bull or bear advocate memories."),
|
|
340
|
-
personaSlug: z.string().optional().describe("Layer in this persona's operating rules alongside global rules."),
|
|
341
|
-
surface: memorySurfaceField,
|
|
342
|
-
slug: slugField,
|
|
343
|
-
}, async (args) => {
|
|
344
|
-
const params = new URLSearchParams({ q: args.query });
|
|
345
|
-
if (args.k)
|
|
346
|
-
params.set("k", String(args.k));
|
|
347
|
-
if (args.sourceId)
|
|
348
|
-
params.set("sourceId", args.sourceId);
|
|
349
|
-
if (args.sourceIds?.length) {
|
|
350
|
-
for (const id of args.sourceIds)
|
|
351
|
-
params.append("sourceIds", id);
|
|
352
|
-
}
|
|
353
|
-
if (args.ticker)
|
|
354
|
-
params.set("ticker", args.ticker);
|
|
355
|
-
if (args.debatePersona)
|
|
356
|
-
params.set("debatePersona", args.debatePersona);
|
|
357
|
-
if (args.personaSlug)
|
|
358
|
-
params.set("personaSlug", args.personaSlug);
|
|
359
|
-
if (args.surface)
|
|
360
|
-
params.set("surface", args.surface);
|
|
361
|
-
const s = await resolveToolSlug(args.slug);
|
|
362
|
-
return jsonResult(await get(`/agent-os/${s}/memory?${params}`));
|
|
363
|
-
});
|
|
364
|
-
register("agent_os_get_desk_debate_context", "Fetch trading-desk debate context for a ticker: latest canonical DeskAnalysisReport debate fields plus bull/bear MARM snippets scoped by ticker and debatePersona.", {
|
|
365
|
-
ticker: z.string().describe("Equity ticker symbol, e.g. NVDA."),
|
|
366
|
-
reportId: z.string().optional().describe("Optional DeskAnalysisReport id; defaults to latest canonical report for the ticker."),
|
|
367
|
-
slug: slugField,
|
|
368
|
-
}, async (args) => {
|
|
369
|
-
const params = new URLSearchParams({ ticker: args.ticker });
|
|
370
|
-
if (args.reportId)
|
|
371
|
-
params.set("reportId", args.reportId);
|
|
372
|
-
const s = await resolveToolSlug(args.slug);
|
|
373
|
-
return jsonResult(await get(`/agent-os/${s}/desk-debate-context?${params}`));
|
|
374
|
-
});
|
|
375
|
-
register("agent_os_list_skills", "List AgentOS skills available to this workspace, including Kynver built-ins, user-authored skills, and per-AgentOS binding state. Pass view=\"manifest\" for the runtime read path: only enabled, runtime-eligible skills (enabled binding plus, for user skills, status=active) with metadata only — no instructions. Skill instructions are fetched on demand with agent_os_get_skill; do not inject every skill into every model context.", {
|
|
376
|
-
view: z
|
|
377
|
-
.enum(["full", "manifest"])
|
|
378
|
-
.optional()
|
|
379
|
-
.describe("\"manifest\" returns only enabled, runtime-eligible skills with metadata (slug, name, description, triggerRules, priority, autoInvoke) and no instructions; \"full\" (default) returns every skill with binding state."),
|
|
380
|
-
slug: slugField,
|
|
381
|
-
}, async (args) => {
|
|
382
|
-
const s = await resolveToolSlug(args.slug);
|
|
383
|
-
const qs = args.view === "manifest" ? "?view=manifest" : "";
|
|
384
|
-
return jsonResult(await get("/agent-os/" + s + "/skills" + qs));
|
|
385
|
-
});
|
|
386
|
-
register("agent_os_create_skill", "Create a user-authored AgentOS skill. Skill instructions are user content fetched on demand, not system instructions. Created skills are not enabled until bound with agent_os_bind_skill.", {
|
|
387
|
-
skillSlug: z.string().describe("Stable skill slug."),
|
|
388
|
-
name: z.string(),
|
|
389
|
-
description: z.string().nullable().optional(),
|
|
390
|
-
category: skillCategorySchema.optional(),
|
|
391
|
-
status: skillStatusSchema.optional().describe("Defaults to draft server-side."),
|
|
392
|
-
triggerRules: z.string().nullable().optional(),
|
|
393
|
-
instructions: z.string(),
|
|
394
|
-
sourceRefs: z.array(sourceRefSchema).optional(),
|
|
395
|
-
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
396
|
-
slug: slugField,
|
|
397
|
-
}, async (args) => {
|
|
398
|
-
const { slug, skillSlug, ...body } = args;
|
|
399
|
-
const s = await resolveToolSlug(slug);
|
|
400
|
-
return jsonResult(await post("/agent-os/" + s + "/skills", { ...body, slug: skillSlug }));
|
|
401
|
-
});
|
|
402
|
-
register("agent_os_update_skill", "Update a user-authored AgentOS skill. Built-in skills are read-only; imported skills should be user-authored rows so users and agents can edit them.", {
|
|
403
|
-
skillSlug: z.string().describe("Existing user-authored skill slug."),
|
|
404
|
-
name: z.string().optional(),
|
|
405
|
-
description: z.string().nullable().optional(),
|
|
406
|
-
category: skillCategorySchema.optional(),
|
|
407
|
-
status: skillStatusSchema.optional(),
|
|
408
|
-
triggerRules: z.string().nullable().optional(),
|
|
409
|
-
instructions: z.string().optional(),
|
|
410
|
-
sourceRefs: z.array(sourceRefSchema).optional(),
|
|
411
|
-
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
412
|
-
slug: slugField,
|
|
413
|
-
}, async (args) => {
|
|
414
|
-
const { slug, skillSlug, ...body } = args;
|
|
415
|
-
const s = await resolveToolSlug(slug);
|
|
416
|
-
return jsonResult(await patch("/agent-os/" + s + "/skills/" + encodeURIComponent(skillSlug), body));
|
|
417
|
-
});
|
|
418
|
-
register("agent_os_import_skills", "Import external skill markdown or JSON as user-authored draft skills. Imported skills are not enabled or bound automatically; list/get them, suggest choices to the user, then bind only selected skills.", {
|
|
419
|
-
markdown: z.string().optional().describe("One or more markdown skills with frontmatter, or a JSON string/object encoded as text."),
|
|
420
|
-
skills: z.array(skillDraftSchema).optional().describe("JSON skill definitions to import."),
|
|
421
|
-
sourceLabel: z.string().optional(),
|
|
422
|
-
overwrite: z.boolean().optional().describe("Update existing user skills with matching slugs instead of skipping them."),
|
|
423
|
-
slug: slugField,
|
|
424
|
-
}, async (args) => {
|
|
425
|
-
const { slug, ...body } = args;
|
|
426
|
-
const s = await resolveToolSlug(slug);
|
|
427
|
-
return jsonResult(await post("/agent-os/" + s + "/skills/import", body));
|
|
428
|
-
});
|
|
429
|
-
register("agent_os_bind_skill", "Enable or update a skill binding for this AgentOS workspace. Built-in skills use skillSource=builtin and skillSlug; user-authored skills use skillSource=user and skillSlug.", {
|
|
430
|
-
skillSlug: z.string().describe("Skill slug to bind, for example diagnose or a user-authored slug."),
|
|
431
|
-
skillSource: z.enum(["builtin", "user"]).describe("Whether the skill is a file-backed built-in or a user-authored AgentSkill."),
|
|
432
|
-
enabled: z.boolean().optional().describe("Whether the binding is enabled. Defaults to true server-side."),
|
|
433
|
-
priority: z.number().optional().describe("Higher priority skills can be preferred by clients when multiple skills match."),
|
|
434
|
-
autoInvoke: z.boolean().optional().describe("Whether clients may auto-invoke this skill when trigger rules match."),
|
|
435
|
-
notes: z.string().optional().describe("Operator notes about why this skill is bound or how it should be used."),
|
|
436
|
-
config: z.record(z.string(), z.unknown()).optional().describe("Per-binding configuration for future clients."),
|
|
437
|
-
slug: slugField,
|
|
438
|
-
}, async (args) => {
|
|
439
|
-
const { slug, skillSlug, ...body } = args;
|
|
440
|
-
const s = await resolveToolSlug(slug);
|
|
441
|
-
return jsonResult(await post("/agent-os/" + s + "/skills/" + encodeURIComponent(skillSlug) + "/bind", body));
|
|
442
|
-
});
|
|
443
|
-
register("agent_os_write_memory", "Write a durable memory entry to AgentOS MARM. Use for facts, decisions, lessons, preferences, source maps, and runbooks that should survive sessions. For ordinary progress during a live session, prefer agent_os_log_session_event or agent_os_log_session. Include sourceRefs whenever possible, set memoryType/confidence, and mark important or uncertain memories reviewStatus='needs_review'.", {
|
|
444
|
-
content: z.string().describe("The memory content to store."),
|
|
445
|
-
key: z.string().optional().describe("Unique slug identifier for this memory (e.g. 'kynver-arch-decision-2026-05'). Defaults to a timestamped note slug."),
|
|
446
|
-
category: z
|
|
447
|
-
.enum(["long_term", "project", "contact", "tool_config"])
|
|
448
|
-
.optional()
|
|
449
|
-
.describe("Memory category. Mapped to sourceId: long_term/contact/tool_config -> 'agent:long-term', project -> 'agent:project'. Ignored if sourceId is set."),
|
|
450
|
-
sourceId: z.string().optional().describe("Advanced: override the sourceId tag directly. If set, category is ignored."),
|
|
451
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
452
|
-
sourceRefs: z.array(sourceRefSchema).optional().describe("Structured provenance references for this memory, such as repo/path/commit/PR/map/session."),
|
|
453
|
-
memoryType: memoryTypeSchema.optional(),
|
|
454
|
-
confidence: confidenceSchema.optional(),
|
|
455
|
-
reviewStatus: reviewStatusSchema.optional(),
|
|
456
|
-
projectId: z.string().optional().describe("AgentOS project id this memory belongs to, when known."),
|
|
457
|
-
goalId: z.string().optional().describe("AgentOS goal id this memory supports, when known."),
|
|
458
|
-
contactId: z.string().optional().describe("AgentOS contact id this memory concerns, when known."),
|
|
459
|
-
skillId: z.string().optional().describe("Skill identifier this memory belongs to. Built-ins use skill slug; user-authored skills use AgentSkill.id."),
|
|
460
|
-
correctionReason: z
|
|
461
|
-
.string()
|
|
462
|
-
.optional()
|
|
463
|
-
.describe("When this write encodes a user/operator correction (e.g. Telegram preference fix), explain why — triggers memory-quality negative feedback."),
|
|
464
|
-
correctionSource: z
|
|
465
|
-
.enum(["telegram", "manual", "api", "session"])
|
|
466
|
-
.optional()
|
|
467
|
-
.describe("Channel that supplied the correction; stored in metadata for audit, not memory body."),
|
|
468
|
-
slug: slugField,
|
|
469
|
-
}, async (args) => {
|
|
470
|
-
const categoryToSourceId = {
|
|
471
|
-
long_term: "agent:long-term",
|
|
472
|
-
project: "agent:project",
|
|
473
|
-
contact: "agent:long-term",
|
|
474
|
-
tool_config: "agent:long-term",
|
|
475
|
-
};
|
|
476
|
-
const sourceId = args.sourceId ?? (args.category ? categoryToSourceId[args.category] : undefined);
|
|
477
|
-
const body = { content: args.content };
|
|
478
|
-
if (args.key)
|
|
479
|
-
body.slug = args.key;
|
|
480
|
-
if (sourceId)
|
|
481
|
-
body.sourceId = sourceId;
|
|
482
|
-
if (args.metadata)
|
|
483
|
-
body.metadata = args.metadata;
|
|
484
|
-
if (args.sourceRefs)
|
|
485
|
-
body.sourceRefs = args.sourceRefs;
|
|
486
|
-
if (args.memoryType)
|
|
487
|
-
body.memoryType = args.memoryType;
|
|
488
|
-
if (args.confidence)
|
|
489
|
-
body.confidence = args.confidence;
|
|
490
|
-
if (args.reviewStatus)
|
|
491
|
-
body.reviewStatus = args.reviewStatus;
|
|
492
|
-
if (args.projectId)
|
|
493
|
-
body.projectId = args.projectId;
|
|
494
|
-
if (args.goalId)
|
|
495
|
-
body.goalId = args.goalId;
|
|
496
|
-
if (args.contactId)
|
|
497
|
-
body.contactId = args.contactId;
|
|
498
|
-
if (args.skillId)
|
|
499
|
-
body.skillId = args.skillId;
|
|
500
|
-
if (args.correctionReason)
|
|
501
|
-
body.correctionReason = args.correctionReason;
|
|
502
|
-
if (args.correctionSource)
|
|
503
|
-
body.correctionSource = args.correctionSource;
|
|
504
|
-
const s = await resolveToolSlug(args.slug);
|
|
505
|
-
return jsonResult(await post(`/agent-os/${s}/memory`, body));
|
|
506
|
-
});
|
|
507
|
-
register("agent_os_write_skill_memory", "Write a durable AgentOS memory tagged to a skill. Use this for lessons, runbooks, and decisions learned while applying a skill. Built-in skills use skillId=skill slug; user-authored skills use skillId=AgentSkill.id.", {
|
|
508
|
-
skillId: z.string().describe("Skill identifier: built-in skill slug or user-authored AgentSkill.id."),
|
|
509
|
-
content: z.string().describe("The memory content to store."),
|
|
510
|
-
key: z.string().optional().describe("Unique slug identifier for this memory. Defaults to a timestamped note slug."),
|
|
511
|
-
sourceId: z.string().optional().describe("Advanced: override sourceId. Defaults to agent:long-term."),
|
|
512
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
513
|
-
sourceRefs: z.array(sourceRefSchema).optional().describe("Structured provenance references for this skill memory."),
|
|
514
|
-
memoryType: memoryTypeSchema.optional(),
|
|
515
|
-
confidence: confidenceSchema.optional(),
|
|
516
|
-
reviewStatus: reviewStatusSchema.optional(),
|
|
517
|
-
projectId: z.string().optional(),
|
|
518
|
-
goalId: z.string().optional(),
|
|
519
|
-
contactId: z.string().optional(),
|
|
520
|
-
slug: slugField,
|
|
521
|
-
}, async (args) => {
|
|
522
|
-
const s = await resolveToolSlug(args.slug);
|
|
523
|
-
const body = compact({
|
|
524
|
-
content: args.content,
|
|
525
|
-
slug: args.key,
|
|
526
|
-
sourceId: args.sourceId ?? "agent:long-term",
|
|
527
|
-
metadata: args.metadata,
|
|
528
|
-
sourceRefs: args.sourceRefs,
|
|
529
|
-
memoryType: args.memoryType ?? "lesson",
|
|
530
|
-
confidence: args.confidence,
|
|
531
|
-
reviewStatus: args.reviewStatus,
|
|
532
|
-
projectId: args.projectId,
|
|
533
|
-
goalId: args.goalId,
|
|
534
|
-
contactId: args.contactId,
|
|
535
|
-
skillId: args.skillId,
|
|
536
|
-
});
|
|
537
|
-
return jsonResult(await post("/agent-os/" + s + "/memory", body));
|
|
538
|
-
});
|
|
539
|
-
register("agent_os_get_contacts", "Get all people the agent knows: their relationship, context, preferences, and notes. Replaces reading USER.md and contact sections of MEMORY.md.", { slug: slugField }, async (args) => {
|
|
540
|
-
const s = await resolveToolSlug(args.slug);
|
|
541
|
-
return jsonResult(await get(`/agent-os/${s}/contacts`));
|
|
542
|
-
});
|
|
543
|
-
register("agent_os_consolidate_memory", "Trigger a memory consolidation pass: LLM reviews recent daily logs and distils key decisions, lessons, and facts into long-term MARM memory. Use during heartbeat maintenance instead of manually rewriting MEMORY.md. Rate-limited to 2 runs per agent per day.", { slug: slugField }, async (args) => {
|
|
544
|
-
const s = await resolveToolSlug(args.slug);
|
|
545
|
-
return jsonResult(await post(`/agent-os/${s}/consolidate`, {}));
|
|
546
|
-
});
|
|
547
|
-
register("agent_os_create_project", "Create a new project in the agent OS. Use this to add a newly started project to tracking. Returns the created project with its DB id.", {
|
|
548
|
-
name: z.string().describe("Project name (required)."),
|
|
549
|
-
description: z.string().optional(),
|
|
550
|
-
status: z.enum(["active", "on_hold", "shipped", "archived"]).optional().default("active"),
|
|
551
|
-
currentFocus: z.string().optional().describe("What is being worked on right now."),
|
|
552
|
-
nextActions: z.array(z.string()).optional().describe("Ordered list of next steps."),
|
|
553
|
-
blockers: z.array(z.string()).optional(),
|
|
554
|
-
repoUrl: z.string().optional(),
|
|
555
|
-
deployUrl: z.string().optional(),
|
|
556
|
-
slug: slugField,
|
|
557
|
-
}, async (args) => {
|
|
558
|
-
const { slug, ...body } = args;
|
|
559
|
-
const s = await resolveToolSlug(slug);
|
|
560
|
-
return jsonResult(await post(`/agent-os/${s}/projects`, body));
|
|
561
|
-
});
|
|
562
|
-
register("agent_os_create_contact", "Add a new contact (or upsert by name) to the agent OS. Use when you meet someone new or want to record info about a person.", {
|
|
563
|
-
name: z.string().describe("Contact name (required)."),
|
|
564
|
-
relationship: z.string().optional().describe("e.g. owner, collaborator, client, stakeholder"),
|
|
565
|
-
context: z.string().optional().describe("Background on who they are and what they do."),
|
|
566
|
-
preferences: z.record(z.string(), z.unknown()).optional().describe("Communication preferences, timezone, style notes, etc."),
|
|
567
|
-
notes: z.string().optional(),
|
|
568
|
-
slug: slugField,
|
|
569
|
-
}, async (args) => {
|
|
570
|
-
const { slug, ...body } = args;
|
|
571
|
-
const s = await resolveToolSlug(slug);
|
|
572
|
-
return jsonResult(await post(`/agent-os/${s}/contacts`, body));
|
|
573
|
-
});
|
|
574
|
-
register("agent_os_update_contact", "Update an existing contact by their DB id. Use agent_os_get_contacts to get the id first.", {
|
|
575
|
-
contactId: z.string().describe("DB id of the contact to update (from agent_os_get_contacts)."),
|
|
576
|
-
name: z.string().optional(),
|
|
577
|
-
relationship: z.string().optional(),
|
|
578
|
-
context: z.string().optional(),
|
|
579
|
-
preferences: z.record(z.string(), z.unknown()).optional(),
|
|
580
|
-
notes: z.string().optional(),
|
|
581
|
-
slug: slugField,
|
|
582
|
-
}, async (args) => {
|
|
583
|
-
const { contactId, slug, ...body } = args;
|
|
584
|
-
const s = await resolveToolSlug(slug);
|
|
585
|
-
return jsonResult(await patch(`/agent-os/${s}/contacts/${contactId}`, body));
|
|
586
|
-
});
|
|
587
|
-
register("agent_os_update_memory", "Update an existing durable memory entry by its key/slug. Use to correct, replace, review, stale, or reclassify a previously written memory. Preserve or improve sourceRefs and writer-contract fields so future agents and the dashboard can audit it.", {
|
|
588
|
-
key: z.string().describe("The slug/key of the memory to update (from the original agent_os_write_memory call)."),
|
|
589
|
-
content: z.string().describe("New content to replace the existing memory with."),
|
|
590
|
-
sourceId: z.string().optional().describe("Override the sourceId tag if needed."),
|
|
591
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
592
|
-
sourceRefs: z.array(sourceRefSchema).optional().describe("Structured provenance references for this replacement memory."),
|
|
593
|
-
memoryType: memoryTypeSchema.optional(),
|
|
594
|
-
confidence: confidenceSchema.optional(),
|
|
595
|
-
reviewStatus: reviewStatusSchema.optional(),
|
|
596
|
-
projectId: z.string().optional(),
|
|
597
|
-
goalId: z.string().optional(),
|
|
598
|
-
contactId: z.string().optional(),
|
|
599
|
-
skillId: z.string().optional().describe("Skill identifier this memory belongs to. Built-ins use skill slug; user-authored skills use AgentSkill.id."),
|
|
600
|
-
correctionReason: z
|
|
601
|
-
.string()
|
|
602
|
-
.optional()
|
|
603
|
-
.describe("Why this update corrects prior memory — triggers memory-quality negative feedback when set."),
|
|
604
|
-
correctionSource: z
|
|
605
|
-
.enum(["telegram", "manual", "api", "session"])
|
|
606
|
-
.optional()
|
|
607
|
-
.describe("Channel that supplied the correction."),
|
|
608
|
-
slug: slugField,
|
|
609
|
-
}, async (args) => {
|
|
610
|
-
const { key, slug, content, sourceId, metadata, sourceRefs, memoryType, confidence, reviewStatus, projectId, goalId, contactId, skillId, correctionReason, correctionSource } = args;
|
|
611
|
-
const body = { content, slug: key };
|
|
612
|
-
if (sourceId)
|
|
613
|
-
body.sourceId = sourceId;
|
|
614
|
-
if (metadata)
|
|
615
|
-
body.metadata = metadata;
|
|
616
|
-
if (sourceRefs)
|
|
617
|
-
body.sourceRefs = sourceRefs;
|
|
618
|
-
if (memoryType)
|
|
619
|
-
body.memoryType = memoryType;
|
|
620
|
-
if (confidence)
|
|
621
|
-
body.confidence = confidence;
|
|
622
|
-
if (reviewStatus)
|
|
623
|
-
body.reviewStatus = reviewStatus;
|
|
624
|
-
if (projectId)
|
|
625
|
-
body.projectId = projectId;
|
|
626
|
-
if (goalId)
|
|
627
|
-
body.goalId = goalId;
|
|
628
|
-
if (contactId)
|
|
629
|
-
body.contactId = contactId;
|
|
630
|
-
if (skillId)
|
|
631
|
-
body.skillId = skillId;
|
|
632
|
-
if (correctionReason)
|
|
633
|
-
body.correctionReason = correctionReason;
|
|
634
|
-
if (correctionSource)
|
|
635
|
-
body.correctionSource = correctionSource;
|
|
636
|
-
const s = await resolveToolSlug(slug);
|
|
637
|
-
return jsonResult(await post(`/agent-os/${s}/memory`, body));
|
|
638
|
-
});
|
|
639
|
-
register("agent_os_correct_memory", "Write an auditable correction memory that supersedes a stale or wrong memory by slug. Use when fixing an incorrect remembered claim rather than silently editing history.", {
|
|
640
|
-
targetSlug: z.string().describe("Slug/key of the memory being corrected."),
|
|
641
|
-
content: z.string().describe("Correct replacement content to remember."),
|
|
642
|
-
reason: z.string().describe("Why the target is wrong; recorded on the superseded target."),
|
|
643
|
-
key: z.string().optional().describe("Slug for the new correction memory. Defaults to <targetSlug>-correction."),
|
|
644
|
-
alsoInvalidates: z.array(z.string()).optional().describe("Additional memory slugs/ids to supersede alongside targetSlug."),
|
|
645
|
-
assertedBySessionId: z.string().optional(),
|
|
646
|
-
sourceId: z.string().optional(),
|
|
647
|
-
sourceRefs: z.array(sourceRefSchema).optional(),
|
|
648
|
-
memoryType: memoryTypeSchema.optional(),
|
|
649
|
-
confidence: confidenceSchema.optional(),
|
|
650
|
-
reviewStatus: reviewStatusSchema.optional(),
|
|
651
|
-
projectId: z.string().optional(),
|
|
652
|
-
goalId: z.string().optional(),
|
|
653
|
-
contactId: z.string().optional(),
|
|
654
|
-
skillId: z.string().optional(),
|
|
655
|
-
correctionSource: z.enum(["telegram", "manual", "api", "session"]).optional(),
|
|
656
|
-
slug: slugField,
|
|
657
|
-
}, async (args) => {
|
|
658
|
-
const { slug, ...body } = args;
|
|
659
|
-
const s = await resolveToolSlug(slug);
|
|
660
|
-
return jsonResult(await post("/agent-os/" + s + "/memory/correct", body));
|
|
661
|
-
});
|
|
662
|
-
register("agent_os_record_state", "Record current active state for a live mutable entity such as a PR, branch, or deployment. Server derives the canonical entityKey from fields and upserts one active_state row per entity.", {
|
|
663
|
-
entityType: activeStateEntityTypeSchema,
|
|
664
|
-
fields: z.record(z.string(), z.unknown()).describe("Entity-specific current truth. pr_watch requires repo, pr, author, headOwner, headBranch, state. branch requires repo, branch, aheadBy, behindBy, lastCommit. deployment requires target, env, state, url, and version or sha."),
|
|
665
|
-
observedAt: z.string().optional().describe("ISO timestamp the state was observed. Defaults to now."),
|
|
666
|
-
content: z.string().optional().describe("Optional human summary; one is generated otherwise."),
|
|
667
|
-
sourceRefs: z.array(sourceRefSchema).optional(),
|
|
668
|
-
projectId: z.string().optional(),
|
|
669
|
-
confidence: confidenceSchema.optional(),
|
|
670
|
-
reviewStatus: reviewStatusSchema.optional(),
|
|
671
|
-
sourceId: z.string().optional(),
|
|
672
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
673
|
-
slug: slugField,
|
|
674
|
-
}, async (args) => {
|
|
675
|
-
const { slug, ...body } = args;
|
|
676
|
-
const s = await resolveToolSlug(slug);
|
|
677
|
-
return jsonResult(await post("/agent-os/" + s + "/memory/state", body));
|
|
678
|
-
});
|
|
679
|
-
register("agent_os_get_state", "Get current active state records. Pass entityKey for one record, or entityType/projectId/limit to list active PR, branch, or deployment state.", {
|
|
680
|
-
entityKey: z.string().optional().describe("Canonical key of a single record, e.g. pr:openclaw/openclaw#83529. Omit to list records."),
|
|
681
|
-
entityType: activeStateEntityTypeSchema.optional(),
|
|
682
|
-
projectId: z.string().optional(),
|
|
683
|
-
limit: z.number().optional(),
|
|
684
|
-
surface: memorySurfaceField,
|
|
685
|
-
slug: slugField,
|
|
686
|
-
}, async (args) => {
|
|
687
|
-
const { slug, entityKey, entityType, projectId, limit, surface } = args;
|
|
688
|
-
const s = await resolveToolSlug(slug);
|
|
689
|
-
const qs = new URLSearchParams();
|
|
690
|
-
if (entityKey)
|
|
691
|
-
qs.set("entityKey", entityKey);
|
|
692
|
-
if (entityType)
|
|
693
|
-
qs.set("entityType", entityType);
|
|
694
|
-
if (projectId)
|
|
695
|
-
qs.set("projectId", projectId);
|
|
696
|
-
if (limit !== undefined)
|
|
697
|
-
qs.set("limit", String(limit));
|
|
698
|
-
if (surface)
|
|
699
|
-
qs.set("surface", surface);
|
|
700
|
-
const suffix = qs.toString() ? "?" + qs.toString() : "";
|
|
701
|
-
return jsonResult(await get("/agent-os/" + s + "/memory/state" + suffix));
|
|
702
|
-
});
|
|
703
|
-
// AgentTask board — batch 1 (CRUD) + batch 1.5 (steering / lease) tools.
|
|
704
|
-
registerTaskTools({ register, resolveToolSlug, jsonResult, compact });
|
|
705
|
-
// First-class AgentOS plans (Phase 5A): versioned operational artifacts.
|
|
706
|
-
registerPlanTools({ register, resolveToolSlug, jsonResult, compact });
|
|
707
|
-
registerPlanProgressTools({ register, resolveToolSlug, jsonResult, compact });
|
|
708
|
-
registerPlanToFactoryTools({ register, resolveToolSlug, jsonResult, compact });
|
|
709
|
-
// Action Required inbox: agent_os_ask_human + agent_os_await_action (slice 1).
|
|
710
|
-
registerActionRequiredTools({ register, jsonResult, compact });
|
|
711
|
-
// Operational graph insights — Agent SEE (agent_os_graph_query).
|
|
712
|
-
registerGraphTools({ register, resolveToolSlug, jsonResult });
|
|
713
|
-
// Workbench view control — steer whole Command Center (agent_os_workbench_*).
|
|
714
|
-
registerWorkbenchTools({ register, resolveToolSlug, jsonResult });
|
|
715
|
-
// Command Center rollup (by-id route; includes packageVersionHealth).
|
|
716
|
-
registerCommandCenterTools({ register, resolveToolSlug, jsonResult });
|
|
717
|
-
// Memory quality feedback (M2): record events + query status.
|
|
718
|
-
registerMemoryQualityFeedbackTools({ register, resolveToolSlug, jsonResult, compact });
|
|
719
|
-
// Operating-rules instruction policy.
|
|
720
|
-
registerOperatingRulesTools({ register, resolveToolSlug, jsonResult, compact });
|
|
721
|
-
// Daemon-mediated provider evidence (read-only verification surface).
|
|
722
|
-
registerProviderEvidenceTools({ register, resolveToolSlug, jsonResult });
|
|
723
|
-
// PR backlog drain (read-only routing-funnel surface).
|
|
724
|
-
registerPrBacklogTools({ register, resolveToolSlug, jsonResult });
|
|
725
|
-
// Kynver-native task board watchdog (read + tick for verify_live).
|
|
726
|
-
registerTaskBoardWatchdogTools({ register, resolveToolSlug, jsonResult });
|
|
727
|
-
// Taskflow list/get/mutate (factory task board).
|
|
728
|
-
registerTaskflowTools({ register, resolveToolSlug, jsonResult });
|
|
729
|
-
// Compact active-plan audit rollup (broad completion audits).
|
|
730
|
-
registerPlanAuditRollupTools({ register, resolveToolSlug, jsonResult });
|
|
731
|
-
// Connected-box mesh liveness (heartbeats, cron lease, peer rescues).
|
|
732
|
-
registerMeshLivenessTools({ register, resolveToolSlug, jsonResult });
|
|
733
|
-
// Visible Diagnostics report (dispatch-funnel, closed-loop, verify-live health …).
|
|
734
|
-
registerDiagnosticsTools({ register, resolveToolSlug, jsonResult });
|
|
735
|
-
// PR6 dark preview shadow comparison (operator verification).
|
|
736
|
-
registerContextPreviewTools({ register, jsonResult });
|
|
737
|
-
// Skill library: query-first discovery + on-demand recipe fetch (bounded, metadata-first).
|
|
738
|
-
registerSkillsTools({ register, resolveToolSlug, jsonResult });
|
|
739
|
-
registerMemoryLedgerTools({ register, resolveToolSlug, jsonResult });
|
|
740
|
-
registerMemoryVaultTools({ register, resolveToolSlug, jsonResult });
|
|
741
|
-
registerContextExpandTools({ register, resolveToolSlug, jsonResult });
|
|
742
|
-
registerMonitorTools({ register, resolveToolSlug, jsonResult });
|
|
743
|
-
registerMacroControlsTools({ register, resolveToolSlug, jsonResult });
|
|
744
|
-
registerKariAdMarketingLoopTools({ register, resolveToolSlug, jsonResult });
|
|
745
|
-
// KariAd marketing loop — M6 outcome import (analytics feedback + memory learning).
|
|
746
|
-
registerKariAdOutcomeImportTools({ register, resolveToolSlug, jsonResult });
|
|
747
|
-
registerCmoControlTools({ register, resolveToolSlug, jsonResult });
|
|
748
|
-
// M5: Kynver current-focus / todo adapter (agent-loop focus ≠ executor lease).
|
|
749
|
-
registerCurrentFocusTools({ register, resolveToolSlug, jsonResult, compact });
|
|
750
|
-
return server;
|
|
751
|
-
}
|