@ouro.bot/cli 0.1.0-alpha.1268 → 0.1.0-alpha.1269
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/changelog.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1269",
|
|
6
|
+
"changes": [
|
|
7
|
+
"ouro mcp-serve now tells a coding tool when to pick each of its 17 tools (the line leads each description) and serves MCP annotations (read-only, destructive, idempotent, open-world) for each.",
|
|
8
|
+
"An unknown tool name in ouro mcp-serve is now a JSON-RPC -32602 error that names the real tools it could mean, or says none is close, instead of a tool result.",
|
|
9
|
+
"Each ouro mcp-serve error says what went wrong and how to fix it, and a missing required argument is refused before any agent turn runs."
|
|
10
|
+
]
|
|
11
|
+
},
|
|
4
12
|
{
|
|
5
13
|
"version": "0.1.0-alpha.1268",
|
|
6
14
|
"changes": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0"?>
|
|
2
2
|
<Container version="2">
|
|
3
3
|
<Name>ouro-butler</Name>
|
|
4
|
-
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1269</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -33,9 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports._senseTurnCommandTimeoutMs = exports._senseTurnRetryDelays = exports.SENSE_TURN_COMMAND_TIMEOUT_MS = exports.SENSE_TURN_RETRY_DELAYS_MS = exports.SENSE_TURN_MAX_RETRIES = void 0;
|
|
36
|
+
exports.serverErrors = exports._senseTurnCommandTimeoutMs = exports._senseTurnRetryDelays = exports.SENSE_TURN_COMMAND_TIMEOUT_MS = exports.SENSE_TURN_RETRY_DELAYS_MS = exports.SENSE_TURN_MAX_RETRIES = void 0;
|
|
37
37
|
exports._setSenseTurnRetryDelays = _setSenseTurnRetryDelays;
|
|
38
38
|
exports._setSenseTurnCommandTimeoutMs = _setSenseTurnCommandTimeoutMs;
|
|
39
|
+
exports.mcpAnnotationsOf = mcpAnnotationsOf;
|
|
40
|
+
exports.toListedTool = toListedTool;
|
|
41
|
+
exports.listTools = listTools;
|
|
42
|
+
exports.toolCandidates = toolCandidates;
|
|
39
43
|
exports.createMcpServer = createMcpServer;
|
|
40
44
|
exports.getToolSchemas = getToolSchemas;
|
|
41
45
|
const fs = __importStar(require("fs"));
|
|
@@ -63,7 +67,7 @@ async function withSenseTurnTimeout(promise, timeoutMs, command) {
|
|
|
63
67
|
promise,
|
|
64
68
|
new Promise((_, reject) => {
|
|
65
69
|
timer = setTimeout(() => {
|
|
66
|
-
const error = new
|
|
70
|
+
const error = new SenseTurnTimeout(`MCP conversation turn for ${command.agent} timed out after ${timeoutMs}ms waiting for daemon response; command status is unknown.`);
|
|
67
71
|
(0, runtime_1.emitNervesEvent)({
|
|
68
72
|
level: "error",
|
|
69
73
|
component: "daemon",
|
|
@@ -119,15 +123,102 @@ async function sendSenseTurnWithRetry(socketPath, command) {
|
|
|
119
123
|
/* v8 ignore stop */
|
|
120
124
|
}
|
|
121
125
|
/**
|
|
122
|
-
*
|
|
126
|
+
* ouro-actions' `annotationsOf` (`tools/ouro-actions/ouro-actions.mts`) over a card: only a consequential door reaches
|
|
127
|
+
* other people, so only it is open-world and destructive by default. One addition: a card marked `openWorld` (a tool
|
|
128
|
+
* that runs a full agent turn, which can use the agent's own tools) is open-world too. The vendored kit is an ES module
|
|
129
|
+
* outside `src`, so this mirrors it, and a test holds the two equal for every card apart from that addition.
|
|
123
130
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
function mcpAnnotationsOf(card) {
|
|
132
|
+
const others = card.effect === "consequential";
|
|
133
|
+
// A person-only card would need ouro-actions' `reaches`; mcp-serve has none, so the card type doesn't model it.
|
|
134
|
+
const out = { readOnlyHint: card.effect === "read", destructiveHint: others || card.destructive === true, openWorldHint: others || card.openWorld === true };
|
|
135
|
+
if (card.idempotent)
|
|
136
|
+
out.idempotentHint = true;
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
/** The served tool: the `when` line leads the description, so an agent choosing from the list reads it first. */
|
|
140
|
+
function toListedTool(schema) {
|
|
141
|
+
return { name: schema.name, description: `${schema.ax.when} ${schema.description}`, inputSchema: schema.inputSchema, annotations: mcpAnnotationsOf(schema.ax) };
|
|
142
|
+
}
|
|
143
|
+
/** The tools as `tools/list` serves them; the census reads its read-only evidence from these served annotations. */
|
|
144
|
+
function listTools() {
|
|
145
|
+
return getToolSchemas().map(toListedTool);
|
|
146
|
+
}
|
|
147
|
+
/** The server-level card: what a tool name this server doesn't have answers (a JSON-RPC -32602 error). */
|
|
148
|
+
exports.serverErrors = [
|
|
149
|
+
{ code: "unknown-door", means: "This server has no tool by that name.", fix: "If a suggested tool is the one you meant, call it; otherwise call tools/list and pick by description." },
|
|
150
|
+
];
|
|
151
|
+
/** A name as compared: a host's `mcp__<server>__` prefix dropped, lowercase, letters and digits only. */
|
|
152
|
+
function comparable(name) {
|
|
153
|
+
const bare = name.includes("__") ? name.slice(name.lastIndexOf("__") + 2) : name;
|
|
154
|
+
return bare.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
155
|
+
}
|
|
156
|
+
/** Edit distance between two comparable names. */
|
|
157
|
+
function nameDistance(x, y) {
|
|
158
|
+
let previous = Array.from({ length: y.length + 1 }, (_, j) => j);
|
|
159
|
+
for (let i = 1; i <= x.length; i++) {
|
|
160
|
+
const current = [i];
|
|
161
|
+
for (let j = 1; j <= y.length; j++) {
|
|
162
|
+
current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (x[i - 1] === y[j - 1] ? 0 : 1));
|
|
163
|
+
}
|
|
164
|
+
previous = current;
|
|
165
|
+
}
|
|
166
|
+
return previous[y.length];
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The real tools a mistyped name could mean: the ones whose name contains it or that it contains (`report` gives the
|
|
170
|
+
* three report tools), else the one within a few edits of it, else none. Never a guess: a wrong suggestion would send
|
|
171
|
+
* the agent to a tool that does something else.
|
|
172
|
+
*/
|
|
173
|
+
function toolCandidates(name, names) {
|
|
174
|
+
const wanted = comparable(name);
|
|
175
|
+
const exact = names.filter((candidate) => comparable(candidate) === wanted);
|
|
176
|
+
if (exact.length > 0)
|
|
177
|
+
return exact;
|
|
178
|
+
if (wanted.length >= 3) {
|
|
179
|
+
const containing = names.filter((candidate) => comparable(candidate).includes(wanted));
|
|
180
|
+
if (containing.length > 0)
|
|
181
|
+
return containing;
|
|
182
|
+
}
|
|
183
|
+
const limit = Math.max(1, Math.floor(wanted.length / 3));
|
|
184
|
+
const near = names.map((candidate) => ({ candidate, distance: nameDistance(wanted, comparable(candidate)) })).filter((n) => n.distance <= limit);
|
|
185
|
+
if (near.length > 0) {
|
|
186
|
+
const best = Math.min(...near.map((n) => n.distance));
|
|
187
|
+
return near.filter((n) => n.distance === best).map((n) => n.candidate);
|
|
188
|
+
}
|
|
189
|
+
// A longer name that holds a tool's whole name, such as `send_message_now`: the longest such tool.
|
|
190
|
+
const inside = names.filter((candidate) => comparable(candidate).length >= 4 && wanted.includes(comparable(candidate)));
|
|
191
|
+
if (inside.length === 0)
|
|
192
|
+
return [];
|
|
193
|
+
const longest = Math.max(...inside.map((candidate) => comparable(candidate).length));
|
|
194
|
+
return inside.filter((candidate) => comparable(candidate).length === longest);
|
|
195
|
+
}
|
|
196
|
+
/** The required text argument each tool refuses to run without, and the error code it answers. */
|
|
197
|
+
const REQUIRED_TEXT = {
|
|
198
|
+
send_message: { arg: "message", code: "missing-message" },
|
|
199
|
+
ask: { arg: "question", code: "missing-question" },
|
|
200
|
+
delegate: { arg: "task", code: "missing-task" },
|
|
201
|
+
check_scope: { arg: "item", code: "missing-item" },
|
|
202
|
+
request_decision: { arg: "topic", code: "missing-topic" },
|
|
203
|
+
check_guidance: { arg: "topic", code: "missing-topic" },
|
|
204
|
+
report_progress: { arg: "summary", code: "missing-summary" },
|
|
205
|
+
report_blocker: { arg: "blocker", code: "missing-blocker" },
|
|
206
|
+
report_complete: { arg: "summary", code: "missing-summary" },
|
|
207
|
+
search_facts: { arg: "query", code: "missing-query" },
|
|
130
208
|
};
|
|
209
|
+
/** The protocol revisions this server speaks, newest first. All of them define tool annotations except 2024-11-05. */
|
|
210
|
+
const PROTOCOL_VERSIONS = ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"];
|
|
211
|
+
/** A senseTurn that ran past its timeout: the turn may still be running. */
|
|
212
|
+
class SenseTurnTimeout extends Error {
|
|
213
|
+
}
|
|
214
|
+
/** An error a tool raises by its card's code. */
|
|
215
|
+
class ToolCardError extends Error {
|
|
216
|
+
code;
|
|
217
|
+
constructor(code, message) {
|
|
218
|
+
super(message);
|
|
219
|
+
this.code = code;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
131
222
|
const UUID_PREFIX_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-/i;
|
|
132
223
|
function canonicalizeMcpFriendId(agent, rawFriendId) {
|
|
133
224
|
if (UUID_PREFIX_RE.test(rawFriendId))
|
|
@@ -305,7 +396,7 @@ function createMcpServer(options) {
|
|
|
305
396
|
jsonrpc: "2.0",
|
|
306
397
|
id: request.id,
|
|
307
398
|
result: {
|
|
308
|
-
protocolVersion:
|
|
399
|
+
protocolVersion: negotiatedVersion(request.params?.protocolVersion),
|
|
309
400
|
serverInfo: {
|
|
310
401
|
name: "ouro-mcp-server",
|
|
311
402
|
version: "0.1.0",
|
|
@@ -316,8 +407,12 @@ function createMcpServer(options) {
|
|
|
316
407
|
},
|
|
317
408
|
});
|
|
318
409
|
}
|
|
410
|
+
/** The client's revision when this server speaks it, else the newest this server speaks. */
|
|
411
|
+
function negotiatedVersion(requested) {
|
|
412
|
+
return typeof requested === "string" && PROTOCOL_VERSIONS.includes(requested) ? requested : PROTOCOL_VERSIONS[0];
|
|
413
|
+
}
|
|
319
414
|
function handleToolsList(request) {
|
|
320
|
-
const tools =
|
|
415
|
+
const tools = listTools();
|
|
321
416
|
writeResponse({
|
|
322
417
|
jsonrpc: "2.0",
|
|
323
418
|
id: request.id,
|
|
@@ -336,6 +431,15 @@ function createMcpServer(options) {
|
|
|
336
431
|
const value = args[key];
|
|
337
432
|
return typeof value === "string" ? value : "";
|
|
338
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* An `isError` result in the tool's own card's words: `[code] means`, the detail when there is one, then `Fix: fix`.
|
|
436
|
+
* Every code a call path raises is on that tool's card; the census checks each card code is raised in this file.
|
|
437
|
+
*/
|
|
438
|
+
function writeToolError(request, toolName, code, detail) {
|
|
439
|
+
const card = getToolSchemas().find((schema) => schema.name === toolName).ax.errors.find((error) => error.code === code);
|
|
440
|
+
const text = [`[${code}] ${card.means}`, ...(detail ? [detail] : []), `Fix: ${card.fix}`].join("\n");
|
|
441
|
+
writeResponse({ jsonrpc: "2.0", id: request.id, result: { content: [{ type: "text", text }], isError: true } });
|
|
442
|
+
}
|
|
339
443
|
/* v8 ignore start -- MCP conversation-message shaping is covered by individual tool routing tests; sparse option variants are defensive copy formatting @preserve */
|
|
340
444
|
function buildConversationMessage(toolName, toolArgs) {
|
|
341
445
|
switch (toolName) {
|
|
@@ -368,7 +472,7 @@ function createMcpServer(options) {
|
|
|
368
472
|
}
|
|
369
473
|
}
|
|
370
474
|
/* v8 ignore stop */
|
|
371
|
-
async function runConversationTool(request, message) {
|
|
475
|
+
async function runConversationTool(request, toolName, message) {
|
|
372
476
|
try {
|
|
373
477
|
const response = await sendSenseTurnWithRetry(socketPath, {
|
|
374
478
|
kind: "agent.senseTurn",
|
|
@@ -383,12 +487,16 @@ function createMcpServer(options) {
|
|
|
383
487
|
});
|
|
384
488
|
/* v8 ignore next -- branch: ?? fallback for empty daemon response @preserve */
|
|
385
489
|
const text = response.message ?? "(empty response)";
|
|
490
|
+
if (!response.ok) {
|
|
491
|
+
writeToolError(request, toolName, "turn-failed", text);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
386
494
|
writeResponse({
|
|
387
495
|
jsonrpc: "2.0",
|
|
388
496
|
id: request.id,
|
|
389
497
|
result: {
|
|
390
498
|
content: [{ type: "text", text }],
|
|
391
|
-
isError:
|
|
499
|
+
isError: false,
|
|
392
500
|
},
|
|
393
501
|
});
|
|
394
502
|
}
|
|
@@ -396,20 +504,12 @@ function createMcpServer(options) {
|
|
|
396
504
|
/* v8 ignore start — instanceof guard defensive; thrown errors are always Error */
|
|
397
505
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
398
506
|
/* v8 ignore stop */
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
writeResponse({
|
|
406
|
-
jsonrpc: "2.0",
|
|
407
|
-
id: request.id,
|
|
408
|
-
result: {
|
|
409
|
-
content: [{ type: "text", text: userMessage }],
|
|
410
|
-
isError: true,
|
|
411
|
-
},
|
|
412
|
-
});
|
|
507
|
+
if (error instanceof SenseTurnTimeout)
|
|
508
|
+
writeToolError(request, toolName, "turn-timed-out", errorMessage);
|
|
509
|
+
else if (errorMessage.includes("ECONNREFUSED") || errorMessage.includes("ENOENT"))
|
|
510
|
+
writeToolError(request, toolName, "daemon-not-running");
|
|
511
|
+
else
|
|
512
|
+
writeToolError(request, toolName, "turn-failed", errorMessage);
|
|
413
513
|
}
|
|
414
514
|
}
|
|
415
515
|
async function handleToolsCall(request) {
|
|
@@ -418,6 +518,31 @@ function createMcpServer(options) {
|
|
|
418
518
|
const toolName = params.name;
|
|
419
519
|
const toolArgs = (params.arguments ?? {});
|
|
420
520
|
/* v8 ignore stop */
|
|
521
|
+
// An error in finding the tool is a protocol error, not a tool result (MCP 2025-11-25, CallToolResult.isError).
|
|
522
|
+
const names = getToolSchemas().map((schema) => schema.name);
|
|
523
|
+
if (typeof toolName !== "string" || !names.includes(toolName)) {
|
|
524
|
+
const unknown = exports.serverErrors.find((card) => card.code === "unknown-door");
|
|
525
|
+
const named = typeof toolName === "string" && toolName.length > 0;
|
|
526
|
+
const candidates = named ? toolCandidates(toolName, names) : [];
|
|
527
|
+
const nearest = candidates.length === 1 ? candidates[0] : null;
|
|
528
|
+
const quoted = candidates.map((candidate) => `"${candidate}"`).join(", ");
|
|
529
|
+
const message = !named
|
|
530
|
+
? `tools/call needs params.name, the tool to call. tools/list has all ${names.length}.`
|
|
531
|
+
: candidates.length === 0
|
|
532
|
+
? `Unknown tool "${toolName}". No tool has a name close to it; tools/list has all ${names.length}.`
|
|
533
|
+
: `Unknown tool "${toolName}". Did you mean ${nearest ? quoted : `one of ${quoted}`}? tools/list has all ${names.length}.`;
|
|
534
|
+
writeResponse({
|
|
535
|
+
jsonrpc: "2.0",
|
|
536
|
+
id: request.id,
|
|
537
|
+
error: { code: -32602, message, data: { code: unknown.code, tool: typeof toolName === "string" ? toolName : null, nearest, candidates, means: unknown.means, fix: unknown.fix } },
|
|
538
|
+
});
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
const required = REQUIRED_TEXT[toolName];
|
|
542
|
+
if (required && !stringArg(toolArgs, required.arg).trim()) {
|
|
543
|
+
writeToolError(request, toolName, required.code);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
421
546
|
if (toolName === "shepherd_feedback" || toolName === "shepherd_feedback_status") {
|
|
422
547
|
await runFeedbackTool(request, toolName, toolArgs);
|
|
423
548
|
return;
|
|
@@ -425,7 +550,7 @@ function createMcpServer(options) {
|
|
|
425
550
|
// ── Conversation tools: these run a real agent turn ──
|
|
426
551
|
const conversationMessage = buildConversationMessage(toolName, toolArgs);
|
|
427
552
|
if (conversationMessage !== null) {
|
|
428
|
-
await runConversationTool(request, conversationMessage);
|
|
553
|
+
await runConversationTool(request, toolName, conversationMessage);
|
|
429
554
|
return;
|
|
430
555
|
}
|
|
431
556
|
async function runFeedbackTool(request, toolName, args) {
|
|
@@ -434,12 +559,15 @@ function createMcpServer(options) {
|
|
|
434
559
|
try {
|
|
435
560
|
const submitting = toolName === "shepherd_feedback";
|
|
436
561
|
const allowed = submitting ? ["request_id", "feedback", "context"] : ["request_id"];
|
|
437
|
-
if (!validRequestId || Object.keys(args).some(key => !allowed.includes(key)))
|
|
438
|
-
throw
|
|
562
|
+
if (!validRequestId || Object.keys(args).some(key => !allowed.includes(key))) {
|
|
563
|
+
throw submitting
|
|
564
|
+
? new ToolCardError("invalid-feedback-request", "Invalid feedback request identity or routing arguments")
|
|
565
|
+
: new ToolCardError("invalid-status-request", "Invalid feedback request identity or routing arguments");
|
|
566
|
+
}
|
|
439
567
|
const feedback = stringArg(args, "feedback");
|
|
440
568
|
if (submitting && (!feedback.trim() || feedback.length > 2000 ||
|
|
441
569
|
args.context !== undefined && (typeof args.context !== "string" || Buffer.byteLength(JSON.stringify(args.context)) > 8192))) {
|
|
442
|
-
throw new
|
|
570
|
+
throw new ToolCardError("feedback-size", "Feedback must be 1–2000 characters with at most 8 KiB of context");
|
|
443
571
|
}
|
|
444
572
|
const command = submitting
|
|
445
573
|
? { kind: "agent.shepherdFeedback", agent, friendId, origin: await (0, feedback_source_1.resolveFeedbackOrigin)(),
|
|
@@ -466,13 +594,21 @@ function createMcpServer(options) {
|
|
|
466
594
|
catch (error) {
|
|
467
595
|
(0, runtime_1.emitNervesEvent)({ level: "warn", component: "daemon", event: "daemon.mcp_feedback_error",
|
|
468
596
|
message: "native feedback request has no confirmed result", meta: { operation: toolName } });
|
|
469
|
-
|
|
470
|
-
|
|
597
|
+
const code = error instanceof ToolCardError ? error.code : toolName === "shepherd_feedback" ? "feedback-unconfirmed" : "status-unconfirmed";
|
|
598
|
+
writeToolError(request, toolName, code, (0, redact_1.redactSecrets)(`${error instanceof Error ? error.message : String(error)}. Original request: ${validRequestId ? requestId : "(invalid)"}.`));
|
|
471
599
|
}
|
|
472
600
|
}
|
|
473
601
|
if (toolName === "check_response") {
|
|
474
602
|
const pendingDir = (0, pending_1.getPendingDir)(agent, friendId, "mcp", sessionId);
|
|
475
|
-
|
|
603
|
+
let pending;
|
|
604
|
+
try {
|
|
605
|
+
pending = (0, pending_1.drainPending)(pendingDir);
|
|
606
|
+
}
|
|
607
|
+
catch (error) {
|
|
608
|
+
/* v8 ignore next — instanceof guard defensive; thrown errors are always Error */
|
|
609
|
+
writeToolError(request, toolName, "pending-unreadable", error instanceof Error ? error.message : String(error));
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
476
612
|
if (pending.length === 0) {
|
|
477
613
|
writeResponse({
|
|
478
614
|
jsonrpc: "2.0",
|
|
@@ -496,45 +632,22 @@ function createMcpServer(options) {
|
|
|
496
632
|
}
|
|
497
633
|
return;
|
|
498
634
|
}
|
|
499
|
-
// ──
|
|
500
|
-
const
|
|
501
|
-
if (!commandKind) {
|
|
502
|
-
writeResponse({
|
|
503
|
-
jsonrpc: "2.0",
|
|
504
|
-
id: request.id,
|
|
505
|
-
result: {
|
|
506
|
-
content: [{ type: "text", text: `Unknown tool: ${toolName}` }],
|
|
507
|
-
isError: true,
|
|
508
|
-
},
|
|
509
|
-
});
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
// Call agent-service directly (no daemon roundtrip needed for read-only ops)
|
|
513
|
-
const serviceHandler = TOOL_TO_SERVICE[toolName];
|
|
635
|
+
// ── Read tools: agent-service reads the bundle directly, with no daemon roundtrip ──
|
|
636
|
+
const handlerFn = agentService[TOOL_TO_SERVICE[toolName]];
|
|
514
637
|
let response;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const handlerFn = agentService[serviceHandler];
|
|
518
|
-
try {
|
|
519
|
-
response = await handlerFn({ agent, friendId, socketPath, ...toolArgs });
|
|
520
|
-
}
|
|
521
|
-
catch (error) {
|
|
522
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
523
|
-
response = { ok: false, error: `Service error: ${errorMessage}` };
|
|
524
|
-
}
|
|
638
|
+
try {
|
|
639
|
+
response = await handlerFn({ agent, friendId, socketPath, ...toolArgs });
|
|
525
640
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
/* v8 ignore next — instanceof guard defensive; thrown errors are always Error */
|
|
643
|
+
writeToolError(request, toolName, "agent-unreadable", error instanceof Error ? error.message : String(error));
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (!response.ok) {
|
|
647
|
+
/* v8 ignore next — the agent service always names its error */
|
|
648
|
+
writeToolError(request, toolName, "agent-unreadable", response.error ?? response.message ?? "");
|
|
649
|
+
return;
|
|
536
650
|
}
|
|
537
|
-
/* v8 ignore stop */
|
|
538
651
|
const text = response.message
|
|
539
652
|
?? response.summary
|
|
540
653
|
?? JSON.stringify(response.data ?? { ok: response.ok });
|
|
@@ -543,7 +656,7 @@ function createMcpServer(options) {
|
|
|
543
656
|
id: request.id,
|
|
544
657
|
result: {
|
|
545
658
|
content: [{ type: "text", text }],
|
|
546
|
-
isError:
|
|
659
|
+
isError: false,
|
|
547
660
|
},
|
|
548
661
|
});
|
|
549
662
|
}
|
|
@@ -581,8 +694,23 @@ function createMcpServer(options) {
|
|
|
581
694
|
},
|
|
582
695
|
};
|
|
583
696
|
}
|
|
697
|
+
/** The errors of a tool that runs a full agent turn, in that tool's words. */
|
|
698
|
+
function turnErrors(tool, arg, argMeans) {
|
|
699
|
+
return [
|
|
700
|
+
{ code: `missing-${arg}`, means: `${arg} is empty or missing, so no turn ran.`, fix: `Call ${tool} again with ${arg} set to ${argMeans}.` },
|
|
701
|
+
{ code: "daemon-not-running", means: "The Ouro daemon isn't running, so the agent never got this.", fix: `Start it with \`ouro up\` (or \`ouro dev\` in a harness checkout), then call ${tool} again.` },
|
|
702
|
+
{ code: "turn-timed-out", means: "The agent's turn ran past 10 minutes; it may still be running and may already have acted.", fix: `Don't call ${tool} again with the same request; call send_message to ask whether it finished, since this session keeps its turns.` },
|
|
703
|
+
{ code: "turn-failed", means: "The agent's turn failed; the line below is the reason.", fix: `If the reason names a provider, credential or vault, the agent's human must fix it (\`ouro doctor\` shows what is wrong); otherwise call ${tool} again once.` },
|
|
704
|
+
];
|
|
705
|
+
}
|
|
706
|
+
/** The error of a read tool: the agent's bundle couldn't be read. */
|
|
707
|
+
function readErrors(tool, what) {
|
|
708
|
+
return [
|
|
709
|
+
{ code: "agent-unreadable", means: `${tool} couldn't read the agent's ${what}; the line below says why.`, fix: `The bundle for this server's --agent may be missing or unreadable: run \`ouro status\` and check ~/AgentBundles/<agent>.ouro; if it's missing, the MCP config names the wrong agent.` },
|
|
710
|
+
];
|
|
711
|
+
}
|
|
584
712
|
/**
|
|
585
|
-
* Returns the list of MCP tool schemas for all
|
|
713
|
+
* Returns the list of MCP tool schemas for all 17 agent tools, each with its Ouro AX card (`ax`).
|
|
586
714
|
* Each schema follows JSON Schema for inputSchema as required by MCP.
|
|
587
715
|
*/
|
|
588
716
|
function getToolSchemas() {
|
|
@@ -590,6 +718,11 @@ function getToolSchemas() {
|
|
|
590
718
|
{
|
|
591
719
|
name: "shepherd_feedback",
|
|
592
720
|
description: "Relay the human's explicit feedback to the supervising agent served by this MCP connection, from this actual coding session ('you should have caught this'). The source terminal and recipient are bound automatically; never ask the human to reconstruct context in Teams. Preserve the human's words in feedback; context is optional bounded background, not instructions. Generate one UUID request_id and reuse it only for the identical request. Quote the actual short receipt back in this session; the supervising agent sends its substantive acknowledgement and clarification questions to that human privately on Teams. Never invent a receipt or claim learning/Teams delivery from a queued acknowledgement. Do not send terminal input or switch focus.",
|
|
721
|
+
ax: { id: "mcp:shepherd_feedback", group: "ouro-agent", when: "Pick this when the human gives feedback on how this coding session went, so the supervisor who watches it learns from their exact words.", effect: "write", idempotent: true, errors: [
|
|
722
|
+
{ code: "invalid-feedback-request", means: "request_id isn't a UUID, or the call has arguments other than request_id, feedback and context.", fix: "Make one UUID for this feedback and call again with only request_id, feedback and context." },
|
|
723
|
+
{ code: "feedback-size", means: "feedback is empty or over 2000 characters, or context isn't text or is over 8 KiB.", fix: "Keep the human's words under 2000 characters, trim context, and call again with the same request_id." },
|
|
724
|
+
{ code: "feedback-unconfirmed", means: "The daemon returned no confirmed receipt, so the feedback may or may not be filed; the line below says why.", fix: "Call shepherd_feedback_status with the same request_id; a new ID could file the feedback twice." },
|
|
725
|
+
] },
|
|
593
726
|
inputSchema: { type: "object", properties: {
|
|
594
727
|
request_id: { type: "string", description: "Fresh UUID for this feedback; reuse only for its identical retry, never ask the human to enter it." },
|
|
595
728
|
feedback: { type: "string", description: "The human's actual feedback, at most 2000 characters." },
|
|
@@ -599,13 +732,18 @@ function getToolSchemas() {
|
|
|
599
732
|
{
|
|
600
733
|
name: "shepherd_feedback_status",
|
|
601
734
|
description: "Reconcile this human's original feedback request after a lost receipt or to inspect review/Teams delivery state. Does not create another request, repeat model work, or require the source terminal still to exist.",
|
|
735
|
+
ax: { id: "mcp:shepherd_feedback_status", group: "ouro-agent", when: "Pick this after shepherd_feedback lost its receipt or left you unsure, to learn whether that feedback was filed and delivered.", effect: "read", errors: [
|
|
736
|
+
{ code: "invalid-status-request", means: "request_id isn't a UUID, or the call has arguments other than request_id.", fix: "Call again with only request_id, set to the UUID you gave shepherd_feedback." },
|
|
737
|
+
{ code: "status-unconfirmed", means: "The daemon couldn't confirm what happened to that feedback; the line below says why.", fix: "Call shepherd_feedback_status again later with the same request_id; never resend the feedback under a new ID." },
|
|
738
|
+
] },
|
|
602
739
|
inputSchema: { type: "object", properties: {
|
|
603
740
|
request_id: { type: "string", description: "The original feedback UUID." },
|
|
604
741
|
}, required: ["request_id"], additionalProperties: false },
|
|
605
742
|
},
|
|
606
743
|
{
|
|
607
744
|
name: "ask",
|
|
608
|
-
description: "Ask the agent a question through a full conversation turn. This has the same identity, tools, and session continuity as send_message; use search_facts
|
|
745
|
+
description: "Ask the agent a question through a full conversation turn. This has the same identity, tools, and session continuity as send_message; use search_facts for a read-only lookup of what it has written down.",
|
|
746
|
+
ax: { id: "mcp:ask", group: "ouro-agent", when: "Pick this for one question the agent should answer, maybe using its own tools; for a lookup of its notes, search_facts is faster.", effect: "write", openWorld: true, errors: turnErrors("ask", "question", "the question as text") },
|
|
609
747
|
inputSchema: {
|
|
610
748
|
type: "object",
|
|
611
749
|
properties: {
|
|
@@ -617,6 +755,7 @@ function getToolSchemas() {
|
|
|
617
755
|
{
|
|
618
756
|
name: "status",
|
|
619
757
|
description: "Get the agent's current status including active sessions, Desk record state, and activity level.",
|
|
758
|
+
ax: { id: "mcp:status", group: "ouro-agent", when: "Pick this first to see whether the agent and its daemon are up, which version runs, and how busy it is.", effect: "read", errors: readErrors("status", "bundle or runtime state") },
|
|
620
759
|
inputSchema: {
|
|
621
760
|
type: "object",
|
|
622
761
|
properties: {},
|
|
@@ -625,6 +764,7 @@ function getToolSchemas() {
|
|
|
625
764
|
{
|
|
626
765
|
name: "catchup",
|
|
627
766
|
description: "Get a summary of the agent's recent activity including recent sessions and what it has been working on.",
|
|
767
|
+
ax: { id: "mcp:catchup", group: "ouro-agent", when: "Pick this to learn what the agent did lately: its five latest sessions and whether its background work is running, so you can pick up its thread.", effect: "read", errors: readErrors("catchup", "sessions") },
|
|
628
768
|
inputSchema: {
|
|
629
769
|
type: "object",
|
|
630
770
|
properties: {},
|
|
@@ -633,6 +773,7 @@ function getToolSchemas() {
|
|
|
633
773
|
{
|
|
634
774
|
name: "delegate",
|
|
635
775
|
description: "Ask the agent to handle a task through a full conversation turn. The agent decides whether to act, queue, ask, or respond using its normal tools and identity.",
|
|
776
|
+
ax: { id: "mcp:delegate", group: "ouro-agent", when: "Pick this to hand the agent work it should own and carry out itself; it replies whether it acted, queued it or needs more.", effect: "write", openWorld: true, errors: turnErrors("delegate", "task", "what you want done") },
|
|
636
777
|
inputSchema: {
|
|
637
778
|
type: "object",
|
|
638
779
|
properties: {
|
|
@@ -645,6 +786,7 @@ function getToolSchemas() {
|
|
|
645
786
|
{
|
|
646
787
|
name: "get_context",
|
|
647
788
|
description: "Get the agent's current working context including Desk record summary, active tasks, and relevant state.",
|
|
789
|
+
ax: { id: "mcp:get_context", group: "ouro-agent", when: "Pick this to orient before working with the agent: its newest diary lines plus task and session counts, in one snapshot.", effect: "read", errors: readErrors("get_context", "diary, tasks or sessions") },
|
|
648
790
|
inputSchema: {
|
|
649
791
|
type: "object",
|
|
650
792
|
properties: {},
|
|
@@ -653,6 +795,10 @@ function getToolSchemas() {
|
|
|
653
795
|
{
|
|
654
796
|
name: "search_facts",
|
|
655
797
|
description: "Read-only fact search. Returns matching Desk record diary lines without running an agent turn or treating missing matches as absence of agent belief.",
|
|
798
|
+
ax: { id: "mcp:search_facts", group: "ouro-agent", when: "Pick this to look up what the agent wrote down about a term; an empty result means nothing written, not that it doesn't know.", effect: "read", errors: [
|
|
799
|
+
{ code: "missing-query", means: "query is empty or missing, so nothing was searched.", fix: "Call search_facts again with query set to a word or phrase to find." },
|
|
800
|
+
...readErrors("search_facts", "diary"),
|
|
801
|
+
] },
|
|
656
802
|
inputSchema: {
|
|
657
803
|
type: "object",
|
|
658
804
|
properties: {
|
|
@@ -664,6 +810,7 @@ function getToolSchemas() {
|
|
|
664
810
|
{
|
|
665
811
|
name: "get_task",
|
|
666
812
|
description: "Get details about the agent's current task or list of active tasks.",
|
|
813
|
+
ax: { id: "mcp:get_task", group: "ouro-agent", when: "Pick this to list the agent's task files by name, in-progress ones when there are any, to see what work it owns now.", effect: "read", errors: readErrors("get_task", "tasks folder") },
|
|
667
814
|
inputSchema: {
|
|
668
815
|
type: "object",
|
|
669
816
|
properties: {},
|
|
@@ -672,6 +819,7 @@ function getToolSchemas() {
|
|
|
672
819
|
{
|
|
673
820
|
name: "check_scope",
|
|
674
821
|
description: "Ask the agent whether a proposed item or change is in scope through a full conversation turn.",
|
|
822
|
+
ax: { id: "mcp:check_scope", group: "ouro-agent", when: "Pick this before starting a change, to ask whether that item belongs in the current work, so nothing out of scope gets built.", effect: "write", openWorld: true, errors: turnErrors("check_scope", "item", "the change you're considering") },
|
|
675
823
|
inputSchema: {
|
|
676
824
|
type: "object",
|
|
677
825
|
properties: {
|
|
@@ -683,6 +831,7 @@ function getToolSchemas() {
|
|
|
683
831
|
{
|
|
684
832
|
name: "request_decision",
|
|
685
833
|
description: "Ask the agent to make a decision through a full conversation turn. Optionally provide a list of options to consider.",
|
|
834
|
+
ax: { id: "mcp:request_decision", group: "ouro-agent", when: "Pick this when you need a choice made that is the agent's or its human's to make, listing the options; for stuck work, use report_blocker.", effect: "write", openWorld: true, errors: turnErrors("request_decision", "topic", "the choice to be made") },
|
|
686
835
|
inputSchema: {
|
|
687
836
|
type: "object",
|
|
688
837
|
properties: {
|
|
@@ -695,6 +844,7 @@ function getToolSchemas() {
|
|
|
695
844
|
{
|
|
696
845
|
name: "check_guidance",
|
|
697
846
|
description: "Ask the agent for guidance through a full conversation turn, using the same identity, tools, and session continuity as send_message.",
|
|
847
|
+
ax: { id: "mcp:check_guidance", group: "ouro-agent", when: "Pick this to learn the agent's conventions or preferences on a subject before you act on it, rather than guessing.", effect: "write", openWorld: true, errors: turnErrors("check_guidance", "topic", "the subject you need direction on") },
|
|
698
848
|
inputSchema: {
|
|
699
849
|
type: "object",
|
|
700
850
|
properties: {
|
|
@@ -706,6 +856,7 @@ function getToolSchemas() {
|
|
|
706
856
|
{
|
|
707
857
|
name: "report_progress",
|
|
708
858
|
description: "Tell the agent about delegated-work progress through a full conversation turn so it can respond, record, or act normally.",
|
|
859
|
+
ax: { id: "mcp:report_progress", group: "ouro-agent", when: "Pick this midway through work the agent handed you, to say how far it has got so it can track or redirect it.", effect: "write", openWorld: true, errors: turnErrors("report_progress", "summary", "what is done so far") },
|
|
709
860
|
inputSchema: {
|
|
710
861
|
type: "object",
|
|
711
862
|
properties: {
|
|
@@ -717,6 +868,7 @@ function getToolSchemas() {
|
|
|
717
868
|
{
|
|
718
869
|
name: "report_blocker",
|
|
719
870
|
description: "Tell the agent about a delegated-work blocker through a full conversation turn so it can respond, record, or act normally.",
|
|
871
|
+
ax: { id: "mcp:report_blocker", group: "ouro-agent", when: "Pick this when work the agent handed you is stuck, to say what stops it so the agent can unblock, decide or escalate.", effect: "write", openWorld: true, errors: turnErrors("report_blocker", "blocker", "what is stopping the work") },
|
|
720
872
|
inputSchema: {
|
|
721
873
|
type: "object",
|
|
722
874
|
properties: {
|
|
@@ -728,6 +880,7 @@ function getToolSchemas() {
|
|
|
728
880
|
{
|
|
729
881
|
name: "report_complete",
|
|
730
882
|
description: "Tell the agent delegated work is complete through a full conversation turn so it can respond, record, or act normally.",
|
|
883
|
+
ax: { id: "mcp:report_complete", group: "ouro-agent", when: "Pick this when work the agent handed you is finished, with a summary, so it can check, record and close it.", effect: "write", openWorld: true, errors: turnErrors("report_complete", "summary", "what was finished") },
|
|
731
884
|
inputSchema: {
|
|
732
885
|
type: "object",
|
|
733
886
|
properties: {
|
|
@@ -739,6 +892,7 @@ function getToolSchemas() {
|
|
|
739
892
|
{
|
|
740
893
|
name: "send_message",
|
|
741
894
|
description: "Send a message to the agent and get a synchronous response. This runs a full agent turn — the agent can use tools, think, and respond. For multi-turn conversations, call repeatedly — the agent keeps prior turns in this session.",
|
|
895
|
+
ax: { id: "mcp:send_message", group: "ouro-agent", when: "Pick this for open conversation with the agent over several turns; the more specific tools fit asking, handing off and reporting.", effect: "write", openWorld: true, errors: turnErrors("send_message", "message", "what you want to say") },
|
|
742
896
|
inputSchema: {
|
|
743
897
|
type: "object",
|
|
744
898
|
properties: {
|
|
@@ -750,6 +904,9 @@ function getToolSchemas() {
|
|
|
750
904
|
{
|
|
751
905
|
name: "check_response",
|
|
752
906
|
description: "Check for pending messages from the agent. Use this after send_message returns a ponder deferral, or to pick up proactive messages the agent has surfaced to you.",
|
|
907
|
+
ax: { id: "mcp:check_response", group: "ouro-agent", when: "Pick this to collect replies the agent left for you, after send_message says it will answer later or when it wrote unprompted; each comes back once.", effect: "write", errors: [
|
|
908
|
+
{ code: "pending-unreadable", means: "The agent's pending-message folder for this session couldn't be read; the line below says why.", fix: "Call check_response again in a moment; if it keeps failing, call status to check the agent's bundle." },
|
|
909
|
+
] },
|
|
753
910
|
inputSchema: {
|
|
754
911
|
type: "object",
|
|
755
912
|
properties: {},
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1269",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@ouro.bot/cli",
|
|
9
|
-
"version": "0.1.0-alpha.
|
|
9
|
+
"version": "0.1.0-alpha.1269",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|