@ouro.bot/cli 0.1.0-alpha.14 → 0.1.0-alpha.141
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/AdoptionSpecialist.ouro/psyche/SOUL.md +2 -2
- package/AdoptionSpecialist.ouro/psyche/identities/monty.md +2 -2
- package/README.md +151 -205
- package/changelog.json +913 -0
- package/dist/heart/active-work.js +633 -0
- package/dist/heart/bridges/manager.js +358 -0
- package/dist/heart/bridges/state-machine.js +135 -0
- package/dist/heart/bridges/store.js +123 -0
- package/dist/heart/commitments.js +105 -0
- package/dist/heart/config.js +66 -21
- package/dist/heart/core.js +645 -112
- package/dist/heart/cross-chat-delivery.js +146 -0
- package/dist/heart/daemon/agent-discovery.js +81 -0
- package/dist/heart/daemon/agent-service.js +467 -0
- package/dist/heart/daemon/auth-flow.js +457 -0
- package/dist/heart/daemon/daemon-cli.js +1840 -196
- package/dist/heart/daemon/daemon-entry.js +80 -3
- package/dist/heart/daemon/daemon-runtime-sync.js +212 -0
- package/dist/heart/daemon/daemon.js +301 -1
- package/dist/heart/daemon/hatch-animation.js +10 -3
- package/dist/heart/daemon/hatch-flow.js +15 -80
- package/dist/heart/daemon/heartbeat-timer.js +131 -0
- package/dist/heart/daemon/hooks/bundle-meta.js +92 -0
- package/dist/heart/daemon/launchd.js +159 -0
- package/dist/heart/daemon/log-tailer.js +4 -3
- package/dist/heart/daemon/mcp-server.js +464 -0
- package/dist/heart/daemon/message-router.js +17 -8
- package/dist/heart/daemon/ouro-bot-global-installer.js +128 -0
- package/dist/heart/daemon/ouro-path-installer.js +67 -34
- package/dist/heart/daemon/ouro-version-manager.js +171 -0
- package/dist/heart/daemon/process-manager.js +13 -0
- package/dist/heart/daemon/run-hooks.js +37 -0
- package/dist/heart/daemon/runtime-logging.js +58 -15
- package/dist/heart/daemon/runtime-metadata.js +219 -0
- package/dist/heart/daemon/runtime-mode.js +67 -0
- package/dist/heart/daemon/sense-manager.js +50 -2
- package/dist/heart/daemon/skill-management-installer.js +94 -0
- package/dist/heart/daemon/socket-client.js +202 -0
- package/dist/heart/daemon/specialist-orchestrator.js +2 -2
- package/dist/heart/daemon/specialist-prompt.js +10 -7
- package/dist/heart/daemon/specialist-tools.js +52 -3
- package/dist/heart/daemon/staged-restart.js +114 -0
- package/dist/heart/daemon/thoughts.js +507 -0
- package/dist/heart/daemon/update-checker.js +111 -0
- package/dist/heart/daemon/update-hooks.js +138 -0
- package/dist/heart/daemon/wrapper-publish-guard.js +86 -0
- package/dist/heart/delegation.js +62 -0
- package/dist/heart/identity.js +64 -21
- package/dist/heart/kicks.js +2 -20
- package/dist/heart/model-capabilities.js +48 -0
- package/dist/heart/obligations.js +197 -0
- package/dist/heart/progress-story.js +42 -0
- package/dist/heart/provider-failover.js +88 -0
- package/dist/heart/provider-ping.js +159 -0
- package/dist/heart/providers/anthropic-token.js +163 -0
- package/dist/heart/providers/anthropic.js +195 -34
- package/dist/heart/providers/azure.js +115 -9
- package/dist/heart/providers/github-copilot.js +157 -0
- package/dist/heart/providers/minimax.js +33 -3
- package/dist/heart/providers/openai-codex.js +49 -14
- package/dist/heart/session-activity.js +173 -0
- package/dist/heart/session-recall.js +216 -0
- package/dist/heart/streaming.js +117 -33
- package/dist/heart/target-resolution.js +123 -0
- package/dist/heart/tool-loop.js +200 -0
- package/dist/heart/turn-coordinator.js +28 -0
- package/dist/mind/associative-recall.js +122 -32
- package/dist/mind/bundle-manifest.js +14 -0
- package/dist/mind/context.js +125 -14
- package/dist/mind/{memory.js → diary.js} +70 -56
- package/dist/mind/first-impressions.js +16 -2
- package/dist/mind/friends/channel.js +35 -0
- package/dist/mind/friends/group-context.js +144 -0
- package/dist/mind/friends/store-file.js +19 -0
- package/dist/mind/friends/trust-explanation.js +74 -0
- package/dist/mind/friends/types.js +8 -0
- package/dist/mind/journal-index.js +161 -0
- package/dist/mind/obligation-steering.js +221 -0
- package/dist/mind/obligations.js +134 -0
- package/dist/mind/pending.js +76 -9
- package/dist/mind/phrases.js +1 -0
- package/dist/mind/prompt.js +554 -88
- package/dist/mind/token-estimate.js +8 -12
- package/dist/nerves/cli-logging.js +15 -2
- package/dist/nerves/coverage/run-artifacts.js +1 -1
- package/dist/nerves/index.js +12 -0
- package/dist/nerves/runtime.js +5 -1
- package/dist/repertoire/ado-client.js +4 -2
- package/dist/repertoire/ado-semantic.js +6 -0
- package/dist/repertoire/coding/codex-jsonl.js +64 -0
- package/dist/repertoire/coding/context-pack.js +254 -0
- package/dist/repertoire/coding/feedback.js +301 -0
- package/dist/repertoire/coding/index.js +4 -1
- package/dist/repertoire/coding/manager.js +210 -4
- package/dist/repertoire/coding/spawner.js +59 -12
- package/dist/repertoire/coding/tools.js +176 -4
- package/dist/repertoire/data/ado-endpoints.json +188 -0
- package/dist/repertoire/guardrails.js +290 -0
- package/dist/repertoire/mcp-client.js +254 -0
- package/dist/repertoire/mcp-manager.js +198 -0
- package/dist/repertoire/skills.js +14 -23
- package/dist/repertoire/tasks/board.js +12 -0
- package/dist/repertoire/tasks/index.js +23 -9
- package/dist/repertoire/tasks/transitions.js +1 -2
- package/dist/repertoire/tools-base.js +980 -271
- package/dist/repertoire/tools-bluebubbles.js +94 -0
- package/dist/repertoire/tools-github.js +1 -6
- package/dist/repertoire/tools-teams.js +65 -59
- package/dist/repertoire/tools.js +266 -91
- package/dist/senses/attention-queue.js +97 -0
- package/dist/senses/bluebubbles-client.js +210 -5
- package/dist/senses/bluebubbles-entry.js +2 -0
- package/dist/senses/bluebubbles-inbound-log.js +109 -0
- package/dist/senses/bluebubbles-media.js +339 -0
- package/dist/senses/bluebubbles-model.js +12 -4
- package/dist/senses/bluebubbles-mutation-log.js +45 -5
- package/dist/senses/bluebubbles-runtime-state.js +109 -0
- package/dist/senses/bluebubbles-session-cleanup.js +72 -0
- package/dist/senses/bluebubbles.js +944 -45
- package/dist/senses/cli-entry.js +1 -1
- package/dist/senses/cli-layout.js +187 -0
- package/dist/senses/cli.js +374 -131
- package/dist/senses/contextual-heartbeat.js +102 -0
- package/dist/senses/continuity.js +94 -0
- package/dist/senses/debug-activity.js +154 -0
- package/dist/senses/inner-dialog-worker.js +47 -18
- package/dist/senses/inner-dialog.js +500 -84
- package/dist/senses/pipeline.js +454 -0
- package/dist/senses/surface-tool.js +82 -0
- package/dist/senses/teams.js +607 -129
- package/dist/senses/trust-gate.js +112 -2
- package/package.json +12 -4
- package/skills/configure-dev-tools.md +109 -0
- package/subagents/README.md +4 -70
- package/dist/heart/daemon/subagent-installer.js +0 -134
- package/subagents/work-doer.md +0 -233
- package/subagents/work-merger.md +0 -624
- package/subagents/work-planner.md +0 -373
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createMcpServer = createMcpServer;
|
|
37
|
+
exports.getToolSchemas = getToolSchemas;
|
|
38
|
+
const socket_client_1 = require("./socket-client");
|
|
39
|
+
const agentService = __importStar(require("./agent-service"));
|
|
40
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
41
|
+
/**
|
|
42
|
+
* Maps MCP tool names to daemon command kinds.
|
|
43
|
+
*/
|
|
44
|
+
const TOOL_TO_COMMAND = {
|
|
45
|
+
ask: "agent.ask",
|
|
46
|
+
status: "agent.status",
|
|
47
|
+
catchup: "agent.catchup",
|
|
48
|
+
delegate: "agent.delegate",
|
|
49
|
+
get_context: "agent.getContext",
|
|
50
|
+
search_memory: "agent.searchMemory",
|
|
51
|
+
get_task: "agent.getTask",
|
|
52
|
+
check_scope: "agent.checkScope",
|
|
53
|
+
request_decision: "agent.requestDecision",
|
|
54
|
+
check_guidance: "agent.checkGuidance",
|
|
55
|
+
report_progress: "agent.reportProgress",
|
|
56
|
+
report_blocker: "agent.reportBlocker",
|
|
57
|
+
report_complete: "agent.reportComplete",
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Create an MCP server that speaks JSON-RPC 2.0 over stdio.
|
|
61
|
+
* Handles initialize, initialized, tools/list, and tools/call.
|
|
62
|
+
* Forwards tool calls to the daemon via Unix socket.
|
|
63
|
+
*/
|
|
64
|
+
function createMcpServer(options) {
|
|
65
|
+
const { agent, friendId, socketPath, stdin, stdout } = options;
|
|
66
|
+
let buffer = "";
|
|
67
|
+
let running = false;
|
|
68
|
+
let useContentLengthFraming = true; // default to Content-Length, auto-detect from first message
|
|
69
|
+
function writeResponse(response) {
|
|
70
|
+
const body = JSON.stringify(response);
|
|
71
|
+
if (useContentLengthFraming) {
|
|
72
|
+
const header = `Content-Length: ${Buffer.byteLength(body)}\r\n\r\n`;
|
|
73
|
+
stdout.write(header + body);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
stdout.write(body + "\n");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function tryParseContentLength() {
|
|
80
|
+
const headerEnd = buffer.indexOf("\r\n\r\n");
|
|
81
|
+
/* v8 ignore start -- partial header delivery only in real I/O */
|
|
82
|
+
if (headerEnd === -1)
|
|
83
|
+
return false;
|
|
84
|
+
/* v8 ignore stop */
|
|
85
|
+
const headerSection = buffer.slice(0, headerEnd);
|
|
86
|
+
const contentLengthMatch = headerSection.match(/Content-Length:\s*(\d+)/i);
|
|
87
|
+
if (!contentLengthMatch) {
|
|
88
|
+
buffer = buffer.slice(headerEnd + 4);
|
|
89
|
+
return true; // consumed invalid header, try again
|
|
90
|
+
}
|
|
91
|
+
const contentLength = parseInt(contentLengthMatch[1], 10);
|
|
92
|
+
const bodyStart = headerEnd + 4;
|
|
93
|
+
/* v8 ignore start -- partial body delivery only in real I/O */
|
|
94
|
+
if (buffer.length < bodyStart + contentLength)
|
|
95
|
+
return false;
|
|
96
|
+
/* v8 ignore stop */
|
|
97
|
+
const body = buffer.slice(bodyStart, bodyStart + contentLength);
|
|
98
|
+
buffer = buffer.slice(bodyStart + contentLength);
|
|
99
|
+
parseAndDispatch(body);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
function tryParseNewlineDelimited() {
|
|
103
|
+
const newlineIdx = buffer.indexOf("\n");
|
|
104
|
+
/* v8 ignore start -- partial line delivery only in real I/O */
|
|
105
|
+
if (newlineIdx === -1)
|
|
106
|
+
return false;
|
|
107
|
+
/* v8 ignore stop */
|
|
108
|
+
const line = buffer.slice(0, newlineIdx).trim();
|
|
109
|
+
buffer = buffer.slice(newlineIdx + 1);
|
|
110
|
+
if (line.length === 0)
|
|
111
|
+
return true; // skip blank lines
|
|
112
|
+
parseAndDispatch(line);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
function parseAndDispatch(body) {
|
|
116
|
+
let request;
|
|
117
|
+
try {
|
|
118
|
+
request = JSON.parse(body);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
writeResponse({
|
|
122
|
+
jsonrpc: "2.0",
|
|
123
|
+
id: null,
|
|
124
|
+
error: { code: -32700, message: "Parse error" },
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
void handleRequest(request);
|
|
129
|
+
}
|
|
130
|
+
let framingDetected = false;
|
|
131
|
+
function handleData(chunk) {
|
|
132
|
+
buffer += chunk.toString("utf-8");
|
|
133
|
+
// Auto-detect framing from first message and mirror it in responses
|
|
134
|
+
if (!framingDetected && buffer.length > 0) {
|
|
135
|
+
useContentLengthFraming = buffer.startsWith("Content-Length:");
|
|
136
|
+
framingDetected = true;
|
|
137
|
+
}
|
|
138
|
+
// Support both Content-Length framing (Claude Code) and newline-delimited JSON (Codex)
|
|
139
|
+
while (buffer.length > 0) {
|
|
140
|
+
const hasContentLength = buffer.startsWith("Content-Length:");
|
|
141
|
+
const parsed = hasContentLength ? tryParseContentLength() : tryParseNewlineDelimited();
|
|
142
|
+
/* v8 ignore start -- break on partial message only in real I/O */
|
|
143
|
+
if (!parsed)
|
|
144
|
+
break;
|
|
145
|
+
/* v8 ignore stop */
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function handleRequest(request) {
|
|
149
|
+
(0, runtime_1.emitNervesEvent)({
|
|
150
|
+
component: "daemon",
|
|
151
|
+
event: "daemon.mcp_request_start",
|
|
152
|
+
message: "handling MCP request",
|
|
153
|
+
meta: { method: request.method, agent },
|
|
154
|
+
});
|
|
155
|
+
// Notifications (no id) don't get responses
|
|
156
|
+
if (request.id === undefined) {
|
|
157
|
+
(0, runtime_1.emitNervesEvent)({
|
|
158
|
+
component: "daemon",
|
|
159
|
+
event: "daemon.mcp_request_end",
|
|
160
|
+
message: "handled MCP notification",
|
|
161
|
+
meta: { method: request.method, agent },
|
|
162
|
+
});
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
switch (request.method) {
|
|
166
|
+
case "initialize":
|
|
167
|
+
await handleInitialize(request);
|
|
168
|
+
break;
|
|
169
|
+
case "tools/list":
|
|
170
|
+
handleToolsList(request);
|
|
171
|
+
break;
|
|
172
|
+
case "tools/call":
|
|
173
|
+
await handleToolsCall(request);
|
|
174
|
+
break;
|
|
175
|
+
default:
|
|
176
|
+
writeResponse({
|
|
177
|
+
jsonrpc: "2.0",
|
|
178
|
+
id: request.id,
|
|
179
|
+
error: {
|
|
180
|
+
code: -32601,
|
|
181
|
+
message: `Method not found: ${request.method}`,
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
(0, runtime_1.emitNervesEvent)({
|
|
187
|
+
component: "daemon",
|
|
188
|
+
event: "daemon.mcp_request_end",
|
|
189
|
+
message: "completed MCP request",
|
|
190
|
+
meta: { method: request.method, agent },
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
async function handleInitialize(request) {
|
|
194
|
+
// MCP server works standalone (agent-service reads filesystem directly)
|
|
195
|
+
// Daemon is optional — only needed for commands without a direct service handler
|
|
196
|
+
writeResponse({
|
|
197
|
+
jsonrpc: "2.0",
|
|
198
|
+
id: request.id,
|
|
199
|
+
result: {
|
|
200
|
+
protocolVersion: "2024-11-05",
|
|
201
|
+
serverInfo: {
|
|
202
|
+
name: "ouro-mcp-server",
|
|
203
|
+
version: "0.1.0",
|
|
204
|
+
},
|
|
205
|
+
capabilities: {
|
|
206
|
+
tools: { listChanged: false },
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function handleToolsList(request) {
|
|
212
|
+
const tools = getToolSchemas();
|
|
213
|
+
writeResponse({
|
|
214
|
+
jsonrpc: "2.0",
|
|
215
|
+
id: request.id,
|
|
216
|
+
result: { tools },
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/** Map tool name → agent-service handler function name */
|
|
220
|
+
const TOOL_TO_SERVICE = {
|
|
221
|
+
ask: "handleAgentAsk",
|
|
222
|
+
status: "handleAgentStatus",
|
|
223
|
+
catchup: "handleAgentCatchup",
|
|
224
|
+
delegate: "handleAgentDelegate",
|
|
225
|
+
get_context: "handleAgentGetContext",
|
|
226
|
+
search_memory: "handleAgentSearchMemory",
|
|
227
|
+
get_task: "handleAgentGetTask",
|
|
228
|
+
check_scope: "handleAgentCheckScope",
|
|
229
|
+
request_decision: "handleAgentRequestDecision",
|
|
230
|
+
check_guidance: "handleAgentCheckGuidance",
|
|
231
|
+
report_progress: "handleAgentReportProgress",
|
|
232
|
+
report_blocker: "handleAgentReportBlocker",
|
|
233
|
+
report_complete: "handleAgentReportComplete",
|
|
234
|
+
};
|
|
235
|
+
async function handleToolsCall(request) {
|
|
236
|
+
/* v8 ignore start — ?? fallbacks are defensive; MCP clients always send params */
|
|
237
|
+
const params = request.params ?? {};
|
|
238
|
+
const toolName = params.name;
|
|
239
|
+
const toolArgs = (params.arguments ?? {});
|
|
240
|
+
/* v8 ignore stop */
|
|
241
|
+
const commandKind = TOOL_TO_COMMAND[toolName];
|
|
242
|
+
if (!commandKind) {
|
|
243
|
+
writeResponse({
|
|
244
|
+
jsonrpc: "2.0",
|
|
245
|
+
id: request.id,
|
|
246
|
+
result: {
|
|
247
|
+
content: [{ type: "text", text: `Unknown tool: ${toolName}` }],
|
|
248
|
+
isError: true,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
// Call agent-service directly (no daemon roundtrip needed for read-only ops)
|
|
254
|
+
const serviceHandler = TOOL_TO_SERVICE[toolName];
|
|
255
|
+
let response;
|
|
256
|
+
/* v8 ignore start — typeof guard always true; instanceof check defensive; else branch unreachable for known tools */
|
|
257
|
+
if (serviceHandler && typeof agentService[serviceHandler] === "function") {
|
|
258
|
+
const handlerFn = agentService[serviceHandler];
|
|
259
|
+
try {
|
|
260
|
+
response = await handlerFn({ agent, friendId, ...toolArgs });
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
264
|
+
response = { ok: false, error: `Service error: ${errorMessage}` };
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
try {
|
|
269
|
+
response = await (0, socket_client_1.sendDaemonCommand)(socketPath, {
|
|
270
|
+
kind: commandKind, agent, friendId, ...toolArgs,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
275
|
+
response = { ok: false, error: `Daemon error: ${errorMessage}` };
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/* v8 ignore stop */
|
|
279
|
+
const text = response.message
|
|
280
|
+
?? response.summary
|
|
281
|
+
?? JSON.stringify(response.data ?? { ok: response.ok });
|
|
282
|
+
writeResponse({
|
|
283
|
+
jsonrpc: "2.0",
|
|
284
|
+
id: request.id,
|
|
285
|
+
result: {
|
|
286
|
+
content: [{ type: "text", text }],
|
|
287
|
+
isError: !response.ok,
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function onData(chunk) {
|
|
292
|
+
handleData(chunk);
|
|
293
|
+
}
|
|
294
|
+
return {
|
|
295
|
+
agent,
|
|
296
|
+
friendId,
|
|
297
|
+
start() {
|
|
298
|
+
if (running)
|
|
299
|
+
return;
|
|
300
|
+
running = true;
|
|
301
|
+
stdin.on("data", onData);
|
|
302
|
+
(0, runtime_1.emitNervesEvent)({
|
|
303
|
+
component: "daemon",
|
|
304
|
+
event: "daemon.mcp_server_start",
|
|
305
|
+
message: "MCP server started",
|
|
306
|
+
meta: { agent, friendId, socketPath },
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
stop() {
|
|
310
|
+
if (!running)
|
|
311
|
+
return;
|
|
312
|
+
running = false;
|
|
313
|
+
stdin.removeListener("data", onData);
|
|
314
|
+
(0, runtime_1.emitNervesEvent)({
|
|
315
|
+
component: "daemon",
|
|
316
|
+
event: "daemon.mcp_server_stop",
|
|
317
|
+
message: "MCP server stopped",
|
|
318
|
+
meta: { agent, friendId },
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Returns the list of MCP tool schemas for all 13 agent tools.
|
|
325
|
+
* Each schema follows JSON Schema for inputSchema as required by MCP.
|
|
326
|
+
*/
|
|
327
|
+
function getToolSchemas() {
|
|
328
|
+
return [
|
|
329
|
+
{
|
|
330
|
+
name: "ask",
|
|
331
|
+
description: "Ask the agent a question. The agent uses its memory and recent session context to provide a useful answer.",
|
|
332
|
+
inputSchema: {
|
|
333
|
+
type: "object",
|
|
334
|
+
properties: {
|
|
335
|
+
question: { type: "string", description: "The question to ask the agent" },
|
|
336
|
+
},
|
|
337
|
+
required: ["question"],
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "status",
|
|
342
|
+
description: "Get the agent's current status including active sessions, memory state, and activity level.",
|
|
343
|
+
inputSchema: {
|
|
344
|
+
type: "object",
|
|
345
|
+
properties: {},
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
name: "catchup",
|
|
350
|
+
description: "Get a summary of the agent's recent activity including recent sessions and what it has been working on.",
|
|
351
|
+
inputSchema: {
|
|
352
|
+
type: "object",
|
|
353
|
+
properties: {},
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
name: "delegate",
|
|
358
|
+
description: "Request the agent to handle a task. The agent queues the task and will work on it when available.",
|
|
359
|
+
inputSchema: {
|
|
360
|
+
type: "object",
|
|
361
|
+
properties: {
|
|
362
|
+
task: { type: "string", description: "Description of the task to delegate" },
|
|
363
|
+
context: { type: "string", description: "Additional context about the task" },
|
|
364
|
+
},
|
|
365
|
+
required: ["task"],
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: "get_context",
|
|
370
|
+
description: "Get the agent's current working context including memory summary, active tasks, and relevant state.",
|
|
371
|
+
inputSchema: {
|
|
372
|
+
type: "object",
|
|
373
|
+
properties: {},
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: "search_memory",
|
|
378
|
+
description: "Search the agent's memory for information about a specific topic. Returns matching lines from the agent's memory file.",
|
|
379
|
+
inputSchema: {
|
|
380
|
+
type: "object",
|
|
381
|
+
properties: {
|
|
382
|
+
query: { type: "string", description: "Search term to look for in agent memory" },
|
|
383
|
+
},
|
|
384
|
+
required: ["query"],
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
name: "get_task",
|
|
389
|
+
description: "Get details about the agent's current task or list of active tasks.",
|
|
390
|
+
inputSchema: {
|
|
391
|
+
type: "object",
|
|
392
|
+
properties: {},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
name: "check_scope",
|
|
397
|
+
description: "Check whether a proposed item or change is in scope for the agent's current work.",
|
|
398
|
+
inputSchema: {
|
|
399
|
+
type: "object",
|
|
400
|
+
properties: {
|
|
401
|
+
item: { type: "string", description: "The item or change to check scope for" },
|
|
402
|
+
},
|
|
403
|
+
required: ["item"],
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "request_decision",
|
|
408
|
+
description: "Ask the agent to make a decision about a topic. Optionally provide a list of options to choose from.",
|
|
409
|
+
inputSchema: {
|
|
410
|
+
type: "object",
|
|
411
|
+
properties: {
|
|
412
|
+
topic: { type: "string", description: "The topic requiring a decision" },
|
|
413
|
+
options: { type: "string", description: "Comma-separated list of options to consider" },
|
|
414
|
+
},
|
|
415
|
+
required: ["topic"],
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
name: "check_guidance",
|
|
420
|
+
description: "Get guidance from the agent on how to approach a topic. The agent searches its memory for relevant guidance.",
|
|
421
|
+
inputSchema: {
|
|
422
|
+
type: "object",
|
|
423
|
+
properties: {
|
|
424
|
+
topic: { type: "string", description: "The topic to get guidance on" },
|
|
425
|
+
},
|
|
426
|
+
required: ["topic"],
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "report_progress",
|
|
431
|
+
description: "Report progress on delegated work back to the agent. The agent records the update.",
|
|
432
|
+
inputSchema: {
|
|
433
|
+
type: "object",
|
|
434
|
+
properties: {
|
|
435
|
+
summary: { type: "string", description: "Summary of progress made" },
|
|
436
|
+
},
|
|
437
|
+
required: ["summary"],
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
name: "report_blocker",
|
|
442
|
+
description: "Report a blocker on delegated work to the agent. The agent records the blocker for review.",
|
|
443
|
+
inputSchema: {
|
|
444
|
+
type: "object",
|
|
445
|
+
properties: {
|
|
446
|
+
blocker: { type: "string", description: "Description of the blocker" },
|
|
447
|
+
},
|
|
448
|
+
required: ["blocker"],
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: "report_complete",
|
|
453
|
+
description: "Report completion of delegated work to the agent. The agent records the completion.",
|
|
454
|
+
inputSchema: {
|
|
455
|
+
type: "object",
|
|
456
|
+
properties: {
|
|
457
|
+
summary: { type: "string", description: "Summary of what was completed" },
|
|
458
|
+
},
|
|
459
|
+
required: ["summary"],
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
];
|
|
463
|
+
}
|
|
464
|
+
// MCP server v0.1.0-alpha.140
|
|
@@ -35,9 +35,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.FileMessageRouter = void 0;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
|
-
const os = __importStar(require("os"));
|
|
39
38
|
const path = __importStar(require("path"));
|
|
40
39
|
const runtime_1 = require("../../nerves/runtime");
|
|
40
|
+
const identity_1 = require("../identity");
|
|
41
41
|
function messageId(nowIso) {
|
|
42
42
|
return `msg-${nowIso.replace(/[^0-9]/g, "")}`;
|
|
43
43
|
}
|
|
@@ -45,7 +45,7 @@ class FileMessageRouter {
|
|
|
45
45
|
baseDir;
|
|
46
46
|
now;
|
|
47
47
|
constructor(options = {}) {
|
|
48
|
-
this.baseDir = options.baseDir ??
|
|
48
|
+
this.baseDir = options.baseDir ?? (0, identity_1.getAgentMessagesRoot)();
|
|
49
49
|
this.now = options.now ?? (() => new Date().toISOString());
|
|
50
50
|
fs.mkdirSync(this.baseDir, { recursive: true });
|
|
51
51
|
}
|
|
@@ -77,12 +77,21 @@ class FileMessageRouter {
|
|
|
77
77
|
if (!fs.existsSync(inboxPath))
|
|
78
78
|
return [];
|
|
79
79
|
const raw = fs.readFileSync(inboxPath, "utf-8");
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const messages = [];
|
|
81
|
+
const unparsed = [];
|
|
82
|
+
for (const line of raw.split("\n")) {
|
|
83
|
+
const trimmed = line.trim();
|
|
84
|
+
if (!trimmed)
|
|
85
|
+
continue;
|
|
86
|
+
try {
|
|
87
|
+
messages.push(JSON.parse(trimmed));
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
unparsed.push(trimmed);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Only clear inbox after parsing; preserve lines that failed to parse.
|
|
94
|
+
fs.writeFileSync(inboxPath, unparsed.length > 0 ? unparsed.map((l) => `${l}\n`).join("") : "", "utf-8");
|
|
86
95
|
(0, runtime_1.emitNervesEvent)({
|
|
87
96
|
component: "daemon",
|
|
88
97
|
event: "daemon.message_polled",
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.syncGlobalOuroBotWrapper = syncGlobalOuroBotWrapper;
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
41
|
+
const runtime_metadata_1 = require("./runtime-metadata");
|
|
42
|
+
function normalizeOutput(output) {
|
|
43
|
+
return (typeof output === "string" ? output : output.toString("utf-8")).trim();
|
|
44
|
+
}
|
|
45
|
+
function resolveGlobalPrefix(execFileSyncImpl) {
|
|
46
|
+
return normalizeOutput(execFileSyncImpl("npm", ["prefix", "-g"], { encoding: "utf-8" }));
|
|
47
|
+
}
|
|
48
|
+
function resolveGlobalRoot(execFileSyncImpl) {
|
|
49
|
+
return normalizeOutput(execFileSyncImpl("npm", ["root", "-g"], { encoding: "utf-8" }));
|
|
50
|
+
}
|
|
51
|
+
function readInstalledWrapperVersion(globalRoot, existsSyncImpl, readFileSyncImpl) {
|
|
52
|
+
const packageJsonPath = path.join(globalRoot, "ouro.bot", "package.json");
|
|
53
|
+
if (!existsSyncImpl(packageJsonPath))
|
|
54
|
+
return null;
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(readFileSyncImpl(packageJsonPath, "utf-8"));
|
|
57
|
+
return typeof parsed.version === "string" && parsed.version.trim().length > 0 ? parsed.version.trim() : null;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function resolveExecutableOwner(globalPrefix, platform, existsSyncImpl, realpathSyncImpl) {
|
|
64
|
+
const binName = platform === "win32" ? "ouro.bot.cmd" : "ouro.bot";
|
|
65
|
+
const binPath = platform === "win32"
|
|
66
|
+
? path.join(globalPrefix, binName)
|
|
67
|
+
: path.join(globalPrefix, "bin", binName);
|
|
68
|
+
if (!existsSyncImpl(binPath))
|
|
69
|
+
return null;
|
|
70
|
+
try {
|
|
71
|
+
const resolved = realpathSyncImpl(binPath);
|
|
72
|
+
if (resolved.includes(`${path.sep}node_modules${path.sep}ouro.bot${path.sep}`))
|
|
73
|
+
return "wrapper";
|
|
74
|
+
if (resolved.includes(`${path.sep}node_modules${path.sep}@ouro.bot${path.sep}cli${path.sep}`))
|
|
75
|
+
return "cli";
|
|
76
|
+
return "other";
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return "unknown";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function syncGlobalOuroBotWrapper(deps = {}) {
|
|
83
|
+
/* v8 ignore start -- dependency-injection defaults are only exercised in the live runtime */
|
|
84
|
+
const execFileSyncImpl = deps.execFileSync ?? child_process_1.execFileSync;
|
|
85
|
+
const existsSyncImpl = deps.existsSync ?? fs.existsSync;
|
|
86
|
+
const readFileSyncImpl = deps.readFileSync ?? fs.readFileSync;
|
|
87
|
+
const realpathSyncImpl = deps.realpathSync ?? fs.realpathSync;
|
|
88
|
+
const runtimeVersion = deps.runtimeVersion ?? (0, runtime_metadata_1.getRuntimeMetadata)().version;
|
|
89
|
+
const platform = deps.platform ?? process.platform;
|
|
90
|
+
/* v8 ignore stop */
|
|
91
|
+
(0, runtime_1.emitNervesEvent)({
|
|
92
|
+
component: "daemon",
|
|
93
|
+
event: "daemon.ouro_bot_global_sync_start",
|
|
94
|
+
message: "checking global ouro.bot wrapper",
|
|
95
|
+
meta: { version: runtimeVersion },
|
|
96
|
+
});
|
|
97
|
+
const globalPrefix = resolveGlobalPrefix(execFileSyncImpl);
|
|
98
|
+
const globalRoot = resolveGlobalRoot(execFileSyncImpl);
|
|
99
|
+
const installedVersion = readInstalledWrapperVersion(globalRoot, existsSyncImpl, readFileSyncImpl);
|
|
100
|
+
const executableOwner = resolveExecutableOwner(globalPrefix, platform, existsSyncImpl, realpathSyncImpl);
|
|
101
|
+
if (executableOwner === "wrapper") {
|
|
102
|
+
(0, runtime_1.emitNervesEvent)({
|
|
103
|
+
component: "daemon",
|
|
104
|
+
event: "daemon.ouro_bot_global_sync_end",
|
|
105
|
+
message: "global ouro.bot wrapper already current",
|
|
106
|
+
meta: { version: runtimeVersion, installedVersion, executableOwner, installed: false },
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
installed: false,
|
|
110
|
+
version: runtimeVersion,
|
|
111
|
+
installedVersion,
|
|
112
|
+
executableOwner,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
execFileSyncImpl("npm", ["install", "-g", "--force", "ouro.bot@latest"], { stdio: "pipe", encoding: "utf-8" });
|
|
116
|
+
(0, runtime_1.emitNervesEvent)({
|
|
117
|
+
component: "daemon",
|
|
118
|
+
event: "daemon.ouro_bot_global_sync_end",
|
|
119
|
+
message: "global ouro.bot wrapper synced",
|
|
120
|
+
meta: { version: runtimeVersion, installedVersion, executableOwner, installed: true },
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
installed: true,
|
|
124
|
+
version: runtimeVersion,
|
|
125
|
+
installedVersion,
|
|
126
|
+
executableOwner,
|
|
127
|
+
};
|
|
128
|
+
}
|