@ouro.bot/cli 0.1.0-alpha.1496 → 0.1.0-alpha.1497
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 +6 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/actions/generated/mailbox/actions.json +41 -0
- package/dist/actions/generated/mailbox/commands.json +15 -0
- package/dist/actions/generated/mailbox/mcp.json +46 -0
- package/dist/actions/generated/mailbox-tools/tools.json +35 -0
- package/dist/heart/daemon/cli-exec.js +8 -0
- package/dist/heart/daemon/cli-help.js +4 -0
- package/dist/heart/daemon/cli-manifest.js +3 -0
- package/dist/heart/daemon/cli-parse.js +26 -0
- package/dist/heart/letters/doors-tools.js +31 -0
- package/dist/heart/letters/doors.js +226 -0
- package/dist/heart/mcp/mcp-server.js +22 -1
- package/dist/repertoire/tools.js +5 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1497",
|
|
6
|
+
"changes": [
|
|
7
|
+
"New `ouro mailbox list` command, with the same action as the `mailbox_list` tool over MCP and inside a turn. It lists the letters an agent has filed for its person that still wait for an answer. Nothing can file a letter yet, so it always reports that none are waiting. All three doors are generated by ouro-actions from one declaration, `actions/mailbox.actions.mts`. The in-turn tool is registered but not yet offered to the model."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1496",
|
|
6
12
|
"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.1497</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generator": "ouro-actions 1.12.0",
|
|
3
|
+
"set": "mailbox",
|
|
4
|
+
"tool": "ouro",
|
|
5
|
+
"actions": [
|
|
6
|
+
{
|
|
7
|
+
"id": "mailbox_list",
|
|
8
|
+
"consent": "read",
|
|
9
|
+
"label": "Letters",
|
|
10
|
+
"description": "List the letters waiting for you.",
|
|
11
|
+
"agent": "List the letters this agent has filed for its person that are still waiting for an answer, oldest first. Read only.",
|
|
12
|
+
"when": "Pick this to see which letters still wait for the person's answer before filing another; it only reads.",
|
|
13
|
+
"errors": [
|
|
14
|
+
{
|
|
15
|
+
"code": "unknown-input",
|
|
16
|
+
"means": "The call passed an input mailbox_list doesn't take; the text names it.",
|
|
17
|
+
"fix": "Call it again with no input; it takes none."
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"input": {},
|
|
21
|
+
"output": {
|
|
22
|
+
"outcome": {
|
|
23
|
+
"label": "Outcome",
|
|
24
|
+
"description": "done, when the pile was read.",
|
|
25
|
+
"kind": "string"
|
|
26
|
+
},
|
|
27
|
+
"count": {
|
|
28
|
+
"label": "Waiting",
|
|
29
|
+
"description": "How many letters wait for an answer.",
|
|
30
|
+
"kind": "integer"
|
|
31
|
+
},
|
|
32
|
+
"listing": {
|
|
33
|
+
"label": "Letters",
|
|
34
|
+
"description": "One waiting letter per line, oldest first: code, state, age and subject; empty when none wait.",
|
|
35
|
+
"kind": "string"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"cli": "mailbox list"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generator": "ouro-actions 1.12.0",
|
|
3
|
+
"set": "mailbox",
|
|
4
|
+
"tool": "ouro",
|
|
5
|
+
"commands": [
|
|
6
|
+
{
|
|
7
|
+
"name": "mailbox list",
|
|
8
|
+
"summary": "List the letters this agent has filed for its person that are still waiting for an answer, oldest first. Read only.",
|
|
9
|
+
"effect": "private",
|
|
10
|
+
"readOnly": true,
|
|
11
|
+
"output": "{ outcome, count, listing }"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"personOnly": {}
|
|
15
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generator": "ouro-actions 1.12.0",
|
|
3
|
+
"set": "mailbox",
|
|
4
|
+
"tools": [
|
|
5
|
+
{
|
|
6
|
+
"name": "mailbox_list",
|
|
7
|
+
"title": "Letters",
|
|
8
|
+
"description": "List the letters this agent has filed for its person that are still waiting for an answer, oldest first. Read only.",
|
|
9
|
+
"inputSchema": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {},
|
|
12
|
+
"required": [],
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
},
|
|
15
|
+
"annotations": {
|
|
16
|
+
"readOnlyHint": true,
|
|
17
|
+
"destructiveHint": false,
|
|
18
|
+
"openWorldHint": false
|
|
19
|
+
},
|
|
20
|
+
"outputSchema": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"outcome": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "done, when the pile was read."
|
|
26
|
+
},
|
|
27
|
+
"count": {
|
|
28
|
+
"type": "integer",
|
|
29
|
+
"description": "How many letters wait for an answer."
|
|
30
|
+
},
|
|
31
|
+
"listing": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "One waiting letter per line, oldest first: code, state, age and subject; empty when none wait."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"required": [
|
|
37
|
+
"outcome",
|
|
38
|
+
"count",
|
|
39
|
+
"listing"
|
|
40
|
+
],
|
|
41
|
+
"additionalProperties": false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"refusals": {}
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generator": "ouro-actions-tools 1.12.0",
|
|
3
|
+
"set": "mailbox",
|
|
4
|
+
"tools": [
|
|
5
|
+
{
|
|
6
|
+
"type": "function",
|
|
7
|
+
"function": {
|
|
8
|
+
"name": "mailbox_list",
|
|
9
|
+
"description": "List the letters this agent has filed for its person that are still waiting for an answer, oldest first. Read only.",
|
|
10
|
+
"parameters": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {},
|
|
13
|
+
"required": [],
|
|
14
|
+
"additionalProperties": false
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"ax": {
|
|
18
|
+
"id": "tool:mailbox_list",
|
|
19
|
+
"group": "mailbox",
|
|
20
|
+
"when": "Pick this to see which letters still wait for the person's answer before filing another; it only reads.",
|
|
21
|
+
"effect": "read",
|
|
22
|
+
"errors": [
|
|
23
|
+
{
|
|
24
|
+
"code": "unknown-input",
|
|
25
|
+
"means": "The call passed an input mailbox_list doesn't take; the text names it.",
|
|
26
|
+
"fix": "Call it again with no input; it takes none."
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"idempotent": true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"errors": [],
|
|
34
|
+
"refusals": {}
|
|
35
|
+
}
|
|
@@ -112,6 +112,7 @@ const cli_parse_1 = require("./cli-parse");
|
|
|
112
112
|
const cli_parse_2 = require("./cli-parse");
|
|
113
113
|
const cli_help_1 = require("./cli-help");
|
|
114
114
|
const cli_manifest_1 = require("./cli-manifest");
|
|
115
|
+
const doors_1 = require("../letters/doors");
|
|
115
116
|
const plugin_cli_1 = require("./plugin-cli");
|
|
116
117
|
const cli_desk_1 = require("./cli-desk");
|
|
117
118
|
const desk_admin_1 = require("./desk-admin");
|
|
@@ -8978,6 +8979,13 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
|
|
|
8978
8979
|
return message;
|
|
8979
8980
|
}
|
|
8980
8981
|
}
|
|
8982
|
+
// ── mailbox (local: each command runs the action ouro-actions generated it from) ──
|
|
8983
|
+
if (command.kind === "mailbox.action") {
|
|
8984
|
+
const result = (0, doors_1.runMailboxAction)(command.action, {});
|
|
8985
|
+
const message = command.json ? JSON.stringify(result) : result.count === 0 ? "No letters are waiting." : result.listing;
|
|
8986
|
+
deps.writeStdout(message);
|
|
8987
|
+
return message;
|
|
8988
|
+
}
|
|
8981
8989
|
// ── changelog (local, no daemon socket needed) ──
|
|
8982
8990
|
if (command.kind === "changelog") {
|
|
8983
8991
|
try {
|
|
@@ -11,8 +11,11 @@ exports.suggestCommand = suggestCommand;
|
|
|
11
11
|
exports.getGroupedHelp = getGroupedHelp;
|
|
12
12
|
exports.getCommandHelp = getCommandHelp;
|
|
13
13
|
const core_1 = require("../../nerves/review/core");
|
|
14
|
+
const doors_1 = require("../letters/doors");
|
|
14
15
|
// ── Registry ──
|
|
15
16
|
exports.COMMAND_REGISTRY = {
|
|
17
|
+
// Generated by ouro-actions from actions/mailbox.actions.mts.
|
|
18
|
+
mailbox: { category: "Agents", ...(0, doors_1.mailboxHelp)().group },
|
|
16
19
|
up: {
|
|
17
20
|
category: "Lifecycle",
|
|
18
21
|
description: "Start and check Ouro: bring up the background runtime, refresh what this machine needs, and show anything that still needs attention. A pinned rollback stays pinned during ordinary starts; use `--latest` to preflight and explicitly return to the latest release. In a human TTY, bare `ouro` opens the home screen instead; noninteractive shells still route bare `ouro` to `ouro up`.",
|
|
@@ -436,6 +439,7 @@ exports.COMMAND_REGISTRY = {
|
|
|
436
439
|
},
|
|
437
440
|
};
|
|
438
441
|
const SUBCOMMAND_HELP = {
|
|
442
|
+
...(0, doors_1.mailboxHelp)().commands,
|
|
439
443
|
"git status": {
|
|
440
444
|
description: "Show which git sync and clone use, and where it was found",
|
|
441
445
|
usage: "ouro git status",
|
|
@@ -22,6 +22,7 @@ const shepherd_1 = require("./cli-commands/shepherd");
|
|
|
22
22
|
const rsvp_1 = require("./cli-commands/rsvp");
|
|
23
23
|
const dns_1 = require("./cli-commands/dns");
|
|
24
24
|
const entry_points_1 = require("./cli-commands/entry-points");
|
|
25
|
+
const doors_1 = require("../letters/doors");
|
|
25
26
|
/** The CLI-level card: what words no command has answer. */
|
|
26
27
|
exports.serverErrors = [
|
|
27
28
|
{ code: "unknown-door", means: "No ouro command starts with those words; the error suggests the nearest one.", fix: "Run the suggested command if it is the one you meant; otherwise run ouro help --json and pick by summary." },
|
|
@@ -41,6 +42,8 @@ exports.CLI_COMMANDS = [
|
|
|
41
42
|
...shepherd_1.SHEPHERD_COMMANDS,
|
|
42
43
|
...rsvp_1.RSVP_COMMANDS,
|
|
43
44
|
...dns_1.DNS_COMMANDS,
|
|
45
|
+
// Generated by ouro-actions from actions/mailbox.actions.mts, not declared by hand.
|
|
46
|
+
...(0, doors_1.mailboxCliDeclarations)(),
|
|
44
47
|
];
|
|
45
48
|
/**
|
|
46
49
|
* Programs an agent's shell can start as `node <path>` beside the ouro command, such as the daemon and the senses.
|
|
@@ -39,6 +39,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.MAILBOX_CLI_WORDS = void 0;
|
|
42
43
|
exports.extractAgentFlag = extractAgentFlag;
|
|
43
44
|
exports.extractFacingFlag = extractFacingFlag;
|
|
44
45
|
exports.facingToProviderLane = facingToProviderLane;
|
|
@@ -465,6 +466,7 @@ function usage() {
|
|
|
465
466
|
" ouro shepherd reconcile --agent <name> --expected-revision <n> --request-id <id> --id <id> --resolution retired|delivered [--json]",
|
|
466
467
|
" ouro shepherd maintenance --agent <name> --expected-revision <n> --request-id <id> --destination <path> [--json]",
|
|
467
468
|
" ouro session list [--agent <name>]",
|
|
469
|
+
" ouro mailbox list [--json]",
|
|
468
470
|
" ouro mcp list",
|
|
469
471
|
" ouro mcp call <server> <tool> [--args '{...}']",
|
|
470
472
|
" ouro mcp doctor --agent <name> [--json]",
|
|
@@ -670,6 +672,28 @@ function parsePokeCommand(args) {
|
|
|
670
672
|
throw new Error(`Usage\n${usage()}`);
|
|
671
673
|
return { kind: "task.poke", agent, taskId };
|
|
672
674
|
}
|
|
675
|
+
/**
|
|
676
|
+
* The words of the mailbox group (`ouro mailbox <word>`), each the generated action it runs. They are written out here because the AX census
|
|
677
|
+
* reads a parser's words from its own syntax; doors.test.ts holds them equal to actions/generated/mailbox.
|
|
678
|
+
*/
|
|
679
|
+
exports.MAILBOX_CLI_WORDS = { list: "mailbox_list" };
|
|
680
|
+
const MAILBOX_USAGE_WORDS = Object.keys(exports.MAILBOX_CLI_WORDS).join("|");
|
|
681
|
+
/**
|
|
682
|
+
* `ouro mailbox <word>`: each word is a command ouro-actions generated for the mailbox group
|
|
683
|
+
* (actions/generated/mailbox/commands.json), and runs that command's action (src/heart/letters/doors.ts).
|
|
684
|
+
*/
|
|
685
|
+
function parseMailboxCommand(args) {
|
|
686
|
+
const { rest } = extractAgentFlag(args);
|
|
687
|
+
const sub = rest[0];
|
|
688
|
+
if (sub === undefined || !Object.hasOwn(exports.MAILBOX_CLI_WORDS, sub)) {
|
|
689
|
+
throw new Error(`Usage: ouro mailbox ${MAILBOX_USAGE_WORDS} [--json]`);
|
|
690
|
+
}
|
|
691
|
+
const extra = rest.slice(1).filter((token) => token !== "--json");
|
|
692
|
+
if (extra.length > 0)
|
|
693
|
+
throw new Error(`ouro mailbox ${sub} takes no words after it: ${extra.join(" ")}`);
|
|
694
|
+
const action = exports.MAILBOX_CLI_WORDS[sub];
|
|
695
|
+
return { kind: "mailbox.action", action, ...(rest.includes("--json") ? { json: true } : {}) };
|
|
696
|
+
}
|
|
673
697
|
function parseHabitCommand(args) {
|
|
674
698
|
const { agent, rest } = extractAgentFlag(args);
|
|
675
699
|
const sub = rest[0];
|
|
@@ -3455,6 +3479,8 @@ function parseOuroCommand(args) {
|
|
|
3455
3479
|
return parseVaultCommand(args.slice(1));
|
|
3456
3480
|
if (head === "habit")
|
|
3457
3481
|
return parseHabitCommand(args.slice(1));
|
|
3482
|
+
if (head === "mailbox")
|
|
3483
|
+
return parseMailboxCommand(args.slice(1));
|
|
3458
3484
|
if (head === "desk")
|
|
3459
3485
|
return (0, cli_desk_1.parseDeskCommand)(args.slice(1));
|
|
3460
3486
|
if (head === "task")
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.declaredToolSchema = declaredToolSchema;
|
|
4
|
+
exports.mailboxToolDefinitions = mailboxToolDefinitions;
|
|
5
|
+
// The mailbox's in-turn tools, from the generated actions/generated/mailbox-tools/tools.json. They live apart from
|
|
6
|
+
// doors.ts because they need the MCP tool code, and the CLI loads doors.ts on every start: `ouro --version` must not
|
|
7
|
+
// load that code (the edge benchmark counts its modules). Only the tool registry (src/repertoire/tools.ts) loads this.
|
|
8
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
9
|
+
const mcp_declared_tools_1 = require("../../repertoire/mcp-declared-tools");
|
|
10
|
+
const mcp_tools_1 = require("../../repertoire/mcp-tools");
|
|
11
|
+
const doors_1 = require("./doors");
|
|
12
|
+
/** The server name the census's declared-tools source gives these tools (ax/census.config.json). */
|
|
13
|
+
const MAILBOX_SERVER = "mailbox";
|
|
14
|
+
/**
|
|
15
|
+
* A declared tool's schema, built the way the harness builds a bundle's declared MCP tools (mcp-tools.ts's
|
|
16
|
+
* mcpToolSchema, a census passthrough) from only what tools.json declares. The census counts it from tools.json.
|
|
17
|
+
*/
|
|
18
|
+
function declaredToolSchema(server, name, declared) {
|
|
19
|
+
return (0, mcp_tools_1.mcpToolSchema)({ server }, { name, description: declared.description, inputSchema: declared.parameters });
|
|
20
|
+
}
|
|
21
|
+
/** The in-turn registry's definitions: the declared tools, each running its action and answering its result as JSON. */
|
|
22
|
+
function mailboxToolDefinitions() {
|
|
23
|
+
const definitions = [...(0, doors_1.readMailboxDoors)().tools].map(([name, declared]) => ({
|
|
24
|
+
tool: declaredToolSchema(MAILBOX_SERVER, name, { description: declared.description, parameters: declared.parameters }),
|
|
25
|
+
ax: declared.ax,
|
|
26
|
+
riskProfile: (0, mcp_declared_tools_1.declaredRiskProfile)(declared.ax.effect),
|
|
27
|
+
handler: (args) => JSON.stringify((0, doors_1.runMailboxAction)(name, args)),
|
|
28
|
+
}));
|
|
29
|
+
(0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "mailbox.tools_registered", message: "mailbox in-turn tools registered", meta: { tools: definitions.length } });
|
|
30
|
+
return definitions;
|
|
31
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
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.MailboxDoorError = void 0;
|
|
37
|
+
exports.resetMailboxDoorsForTest = resetMailboxDoorsForTest;
|
|
38
|
+
exports.doorsRoot = doorsRoot;
|
|
39
|
+
exports.readMailboxDoors = readMailboxDoors;
|
|
40
|
+
exports.runMailboxAction = runMailboxAction;
|
|
41
|
+
exports.mailboxCliDeclarations = mailboxCliDeclarations;
|
|
42
|
+
exports.mailboxHelp = mailboxHelp;
|
|
43
|
+
exports.mailboxMcpSchemas = mailboxMcpSchemas;
|
|
44
|
+
exports.mailboxMcpSchema = mailboxMcpSchema;
|
|
45
|
+
exports.getToolSchemas = getToolSchemas;
|
|
46
|
+
exports.listTools = listTools;
|
|
47
|
+
// The Mailbox's doors, dispatched from what ouro-actions generated from actions/mailbox.actions.mts: the CLI's commands
|
|
48
|
+
// (actions/generated/mailbox/commands.json), the MCP tools (mcp.json) and the in-turn tools
|
|
49
|
+
// (actions/generated/mailbox-tools/tools.json). Each surface reads its descriptions, schemas and Ouro AX cards from
|
|
50
|
+
// those files, so a door is declared once and never copied by hand. Only the handlers live here; the in-turn tools'
|
|
51
|
+
// definitions are in doors-tools.ts, because the CLI loads this module on every start and must not load the MCP tool
|
|
52
|
+
// code they need (the edge benchmark counts the modules `ouro --version` loads).
|
|
53
|
+
const module_1 = require("module");
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
56
|
+
const cards_1 = require("../daemon/cli-commands/cards");
|
|
57
|
+
const mcp_declared_tools_1 = require("../../repertoire/mcp-declared-tools");
|
|
58
|
+
/** An action refused by its card's error code. */
|
|
59
|
+
class MailboxDoorError extends Error {
|
|
60
|
+
code;
|
|
61
|
+
constructor(code, message) {
|
|
62
|
+
super(message);
|
|
63
|
+
this.code = code;
|
|
64
|
+
this.name = "MailboxDoorError";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.MailboxDoorError = MailboxDoorError;
|
|
68
|
+
let loaded = null;
|
|
69
|
+
/** For tests: forget the doors read so far. */
|
|
70
|
+
function resetMailboxDoorsForTest() {
|
|
71
|
+
loaded = null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Node's own `fs`, through Node's loader rather than an import: the CLI's declarations are read when cli-manifest
|
|
75
|
+
* loads, and the many tests that mock `fs` must still see the real generated files. The files are read, not
|
|
76
|
+
* required, so `ouro --version` loads no extra modules for them (the edge benchmark counts its modules).
|
|
77
|
+
*/
|
|
78
|
+
const realFs = (0, module_1.createRequire)(__filename)("fs");
|
|
79
|
+
function readGenerated(root, file) {
|
|
80
|
+
const full = path.join(root, "actions", "generated", file);
|
|
81
|
+
const where = `actions/generated/${file}`;
|
|
82
|
+
let json;
|
|
83
|
+
try {
|
|
84
|
+
json = JSON.parse(realFs.readFileSync(full, "utf8"));
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
throw new Error(`${where} can't be read: ${error.message}. Fix: run ouro-actions generate for actions/mailbox.actions.mts.`);
|
|
88
|
+
}
|
|
89
|
+
return json;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Where the generated doors are, from this module's own folder, not identity's getRepoRoot (many tests point that at
|
|
93
|
+
* a fake root). In a checkout it is the package root, where ouro-actions writes them, so a dev build made with `tsc`
|
|
94
|
+
* alone never reads a stale or missing copy. An installed package or an image has no actions/ folder there; it reads
|
|
95
|
+
* the copies the build put in dist/ (scripts/copy-action-doors.cjs), because every runtime ships dist/.
|
|
96
|
+
*/
|
|
97
|
+
function doorsRoot(moduleDir, exists = (file) => realFs.existsSync(file)) {
|
|
98
|
+
const top = path.resolve(moduleDir, "../..");
|
|
99
|
+
const packageRoot = path.dirname(top);
|
|
100
|
+
return exists(path.join(packageRoot, "actions", "generated", "mailbox", "commands.json")) ? packageRoot : top;
|
|
101
|
+
}
|
|
102
|
+
const PACKAGE_ROOT = doorsRoot(__dirname);
|
|
103
|
+
/**
|
|
104
|
+
* Reads the generated doors once; later calls return the first read, whatever root they pass (tests read fake doors
|
|
105
|
+
* this way, then reset). A missing or malformed file fails loudly: a door with no declaration never runs.
|
|
106
|
+
*/
|
|
107
|
+
function readMailboxDoors(root = PACKAGE_ROOT) {
|
|
108
|
+
if (loaded)
|
|
109
|
+
return loaded;
|
|
110
|
+
const commands = readGenerated(root, "mailbox/commands.json");
|
|
111
|
+
const mcp = readGenerated(root, "mailbox/mcp.json");
|
|
112
|
+
const toolsJson = readGenerated(root, "mailbox-tools/tools.json");
|
|
113
|
+
if (!Array.isArray(commands.commands))
|
|
114
|
+
throw new Error("actions/generated/mailbox/commands.json has no commands list. Fix: run ouro-actions generate.");
|
|
115
|
+
if (!Array.isArray(mcp.tools))
|
|
116
|
+
throw new Error("actions/generated/mailbox/mcp.json has no tools list. Fix: run ouro-actions generate.");
|
|
117
|
+
const { tools, problems } = (0, mcp_declared_tools_1.parseDeclaredTools)(toolsJson);
|
|
118
|
+
if (problems.length > 0)
|
|
119
|
+
throw new Error(`actions/generated/mailbox-tools/tools.json: ${problems.join("; ")}. Fix: run ouro-actions-tools generate.`);
|
|
120
|
+
const actions = readGenerated(root, "mailbox/actions.json");
|
|
121
|
+
if (!Array.isArray(actions.actions))
|
|
122
|
+
throw new Error("actions/generated/mailbox/actions.json has no actions list. Fix: run ouro-actions generate.");
|
|
123
|
+
const doors = { actions: actions.actions, commands: commands.commands, mcpTools: mcp.tools, tools };
|
|
124
|
+
loaded = doors;
|
|
125
|
+
(0, runtime_1.emitNervesEvent)({
|
|
126
|
+
component: "daemon",
|
|
127
|
+
event: "mailbox.doors_loaded",
|
|
128
|
+
message: "mailbox doors read from the generated files",
|
|
129
|
+
meta: { commands: doors.commands.length, mcp: doors.mcpTools.length, tools: doors.tools.size },
|
|
130
|
+
});
|
|
131
|
+
return doors;
|
|
132
|
+
}
|
|
133
|
+
function listMailbox() {
|
|
134
|
+
// Until the letters store lands (S3), no letter can be filed, so the pile is always empty.
|
|
135
|
+
return { outcome: "done", count: 0, listing: "" };
|
|
136
|
+
}
|
|
137
|
+
const HANDLERS = {
|
|
138
|
+
mailbox_list: listMailbox,
|
|
139
|
+
};
|
|
140
|
+
/** Runs one mailbox action with its input, checked against the generated schema; refusals carry the card's code. */
|
|
141
|
+
function runMailboxAction(action, input) {
|
|
142
|
+
const handler = Object.hasOwn(HANDLERS, action) ? HANDLERS[action] : undefined;
|
|
143
|
+
const tool = readMailboxDoors().mcpTools.find((t) => t.name === action);
|
|
144
|
+
if (!handler || !tool)
|
|
145
|
+
throw new MailboxDoorError("unknown-door", `The mailbox has no action ${action}.`);
|
|
146
|
+
const extra = Object.keys(input).filter((key) => !Object.hasOwn(tool.inputSchema.properties, key));
|
|
147
|
+
if (extra.length > 0)
|
|
148
|
+
throw new MailboxDoorError("unknown-input", `${action} doesn't take ${extra.join(", ")}.`);
|
|
149
|
+
const result = handler(input);
|
|
150
|
+
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "mailbox.action_run", message: "mailbox action ran", meta: { action, outcome: result.outcome } });
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
function cardFor(name) {
|
|
154
|
+
return readMailboxDoors().tools.get(name).ax;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The census reads two doors with the same `when` as one door described twice, so the CLI and MCP doors say where
|
|
158
|
+
* they are called from; the in-turn tool keeps the generated line as tools.json declares it.
|
|
159
|
+
*/
|
|
160
|
+
function whenFrom(where, when) {
|
|
161
|
+
return `${where}, ${when.charAt(0).toLowerCase()}${when.slice(1)}`;
|
|
162
|
+
}
|
|
163
|
+
/** The CLI's declarations: one per generated command, each carded from its action, then the group's own words. */
|
|
164
|
+
function mailboxCliDeclarations() {
|
|
165
|
+
const doors = readMailboxDoors();
|
|
166
|
+
const commands = doors.commands.map((command) => {
|
|
167
|
+
const action = doors.actions.find((a) => a.cli === command.name);
|
|
168
|
+
if (!action)
|
|
169
|
+
throw new Error(`actions/generated/mailbox/commands.json lists ${command.name}, but no action in actions.json names it as its cli. Fix: run ouro-actions generate.`);
|
|
170
|
+
const card = cardFor(action.id);
|
|
171
|
+
const ax = {
|
|
172
|
+
id: `cli:${command.name}`, group: card.group, when: whenFrom("From a shell", card.when), effect: card.effect, errors: [(0, cards_1.unknownFlag)(command.name)],
|
|
173
|
+
...(card.idempotent ? { idempotent: true } : {}),
|
|
174
|
+
};
|
|
175
|
+
return { name: command.name, effect: command.effect, ...(command.readOnly ? { readOnly: true } : {}), summary: command.summary, example: `${command.name} --json`, ax };
|
|
176
|
+
});
|
|
177
|
+
const words = doors.commands.map((command) => command.name.replace(/^mailbox /, "")).join(", ");
|
|
178
|
+
return [
|
|
179
|
+
...commands,
|
|
180
|
+
{
|
|
181
|
+
name: "mailbox", effect: "private", readOnly: true, summary: "The commands for the letters an agent files for its person.",
|
|
182
|
+
ax: { id: "cli:mailbox", group: "mailbox", effect: "read", when: "Names the ways to see the letters an agent has filed for its person and what they wait on.", errors: [(0, cards_1.needsSubcommand)("mailbox", words), (0, cards_1.unknownFlag)("mailbox")] },
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
/** `ouro help` for the group and each generated command, from the generated summaries. */
|
|
187
|
+
function mailboxHelp() {
|
|
188
|
+
const commands = readMailboxDoors().commands;
|
|
189
|
+
const subcommands = commands.map((command) => command.name.replace(/^mailbox /, ""));
|
|
190
|
+
return {
|
|
191
|
+
group: {
|
|
192
|
+
description: "See the letters an agent has filed for you",
|
|
193
|
+
usage: `ouro ${commands[0].name.split(" ")[0]} <${subcommands.join("|")}> [--json]`,
|
|
194
|
+
example: `ouro ${commands[0].name}`,
|
|
195
|
+
subcommands,
|
|
196
|
+
},
|
|
197
|
+
commands: Object.fromEntries(commands.map((command) => [command.name, { description: command.summary, usage: `ouro ${command.name} [--json]`, example: `ouro ${command.name} --json` }])),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/** The MCP server's schemas: the generated tools, each carded from its action as an `mcp:` door. */
|
|
201
|
+
function mailboxMcpSchemas() {
|
|
202
|
+
return readMailboxDoors().mcpTools.map((tool) => {
|
|
203
|
+
const card = cardFor(tool.name);
|
|
204
|
+
return { name: tool.name, description: tool.description, inputSchema: tool.inputSchema, ax: { ...card, id: `mcp:${tool.name}`, when: whenFrom("From a coding tool", card.when) } };
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* One generated MCP tool by name. mcp-server.ts names each tool it serves, because the census places an MCP door by
|
|
209
|
+
* its literal name in that file; a name mcp.json doesn't list fails loudly here.
|
|
210
|
+
*/
|
|
211
|
+
function mailboxMcpSchema(name) {
|
|
212
|
+
const schema = mailboxMcpSchemas().find((s) => s.name === name);
|
|
213
|
+
if (!schema)
|
|
214
|
+
throw new Error(`actions/generated/mailbox/mcp.json has no tool ${name}. Fix: declare it in actions/mailbox.actions.mts and run ouro-actions generate.`);
|
|
215
|
+
return schema;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The declared tools as a server lists them, for the AX census's declared-tools walker
|
|
219
|
+
* (ax/census.config.json), which holds them to tools.json.
|
|
220
|
+
*/
|
|
221
|
+
function getToolSchemas() {
|
|
222
|
+
return readMailboxDoors().mcpTools.map(({ name, description, inputSchema, annotations }) => ({ name, description, inputSchema, annotations }));
|
|
223
|
+
}
|
|
224
|
+
function listTools() {
|
|
225
|
+
return getToolSchemas();
|
|
226
|
+
}
|
|
@@ -52,6 +52,7 @@ const pending_1 = require("../../mind/pending");
|
|
|
52
52
|
const feedback_source_1 = require("../../senses/shepherd/feedback-source");
|
|
53
53
|
const redact_1 = require("../../senses/shepherd/redact");
|
|
54
54
|
const tool_candidates_1 = require("../../repertoire/tool-candidates");
|
|
55
|
+
const doors_1 = require("../letters/doors");
|
|
55
56
|
exports.SENSE_TURN_MAX_RETRIES = 3;
|
|
56
57
|
exports.SENSE_TURN_RETRY_DELAYS_MS = [1000, 2000, 4000];
|
|
57
58
|
exports.SENSE_TURN_COMMAND_TIMEOUT_MS = 10 * 60 * 1000;
|
|
@@ -502,6 +503,22 @@ function createMcpServer(options) {
|
|
|
502
503
|
await runFeedbackTool(request, toolName, toolArgs);
|
|
503
504
|
return;
|
|
504
505
|
}
|
|
506
|
+
// ── Mailbox tools: generated doors, run here without the daemon ──
|
|
507
|
+
if ((0, doors_1.mailboxMcpSchemas)().some((schema) => schema.name === toolName)) {
|
|
508
|
+
try {
|
|
509
|
+
const result = (0, doors_1.runMailboxAction)(toolName, toolArgs);
|
|
510
|
+
writeResponse({ jsonrpc: "2.0", id: request.id, result: { content: [{ type: "text", text: JSON.stringify(result) }], structuredContent: result, isError: false } });
|
|
511
|
+
}
|
|
512
|
+
catch (error) {
|
|
513
|
+
// A listed tool's action exists, so its one refusal is unknown-input. Anything else is a failure, not bad
|
|
514
|
+
// input: it is answered as a JSON-RPC internal error, since nothing above handleRequest catches a throw.
|
|
515
|
+
if (error instanceof doors_1.MailboxDoorError)
|
|
516
|
+
writeToolError(request, toolName, "unknown-input", error.message);
|
|
517
|
+
else
|
|
518
|
+
writeResponse({ jsonrpc: "2.0", id: request.id, error: { code: -32603, message: `${toolName} failed: ${error.message}` } });
|
|
519
|
+
}
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
505
522
|
// ── Conversation tools: these run a real agent turn ──
|
|
506
523
|
const conversationMessage = buildConversationMessage(toolName, toolArgs);
|
|
507
524
|
if (conversationMessage !== null) {
|
|
@@ -665,10 +682,11 @@ function readErrors(tool, what) {
|
|
|
665
682
|
];
|
|
666
683
|
}
|
|
667
684
|
/**
|
|
668
|
-
* Returns the list of MCP tool schemas for all
|
|
685
|
+
* Returns the list of MCP tool schemas for all 18 agent tools (17 written here, the mailbox group generated), each with its Ouro AX card (`ax`).
|
|
669
686
|
* Each schema follows JSON Schema for inputSchema as required by MCP.
|
|
670
687
|
*/
|
|
671
688
|
function getToolSchemas() {
|
|
689
|
+
const mailboxList = (0, doors_1.mailboxMcpSchema)("mailbox_list");
|
|
672
690
|
return [
|
|
673
691
|
{
|
|
674
692
|
name: "shepherd_feedback",
|
|
@@ -867,6 +885,9 @@ function getToolSchemas() {
|
|
|
867
885
|
properties: {},
|
|
868
886
|
},
|
|
869
887
|
},
|
|
888
|
+
// The mailbox group's tools, generated by ouro-actions from actions/mailbox.actions.mts. Each is named here, where
|
|
889
|
+
// the census places MCP doors; mailboxMcpSchema reads the rest from mcp.json and fails on a name it doesn't list.
|
|
890
|
+
{ ...mailboxList, name: "mailbox_list", inputSchema: mailboxList.inputSchema },
|
|
870
891
|
];
|
|
871
892
|
}
|
|
872
893
|
// MCP server v0.1.0-alpha.140
|
package/dist/repertoire/tools.js
CHANGED
|
@@ -44,6 +44,7 @@ const tools_steward_policy_1 = require("./tools-steward-policy");
|
|
|
44
44
|
const tools_house_care_1 = require("./tools-house-care");
|
|
45
45
|
const tools_shepherd_1 = require("./tools-shepherd");
|
|
46
46
|
const tools_mail_1 = require("./tools-mail");
|
|
47
|
+
const doors_tools_1 = require("../heart/letters/doors-tools");
|
|
47
48
|
const tools_app_sessions_1 = require("./tools-app-sessions");
|
|
48
49
|
const steward_policy_1 = require("../heart/steward-policy");
|
|
49
50
|
const relationship_authorization_1 = require("./relationship-authorization");
|
|
@@ -125,7 +126,10 @@ function withCheckBack(tool) {
|
|
|
125
126
|
var tools_surface_2 = require("./tools-surface");
|
|
126
127
|
Object.defineProperty(exports, "surfaceToolDef", { enumerable: true, get: function () { return tools_surface_2.surfaceToolDef; } });
|
|
127
128
|
// All tool definitions in a single registry
|
|
128
|
-
const additionalDefinitions = [...tools_chat_1.chatToolDefinitions, ...tools_teams_1.teamsToolDefinitions, ...ado_semantic_1.adoSemanticToolDefinitions, ...tools_github_1.githubToolDefinitions, ...tools_bundle_1.bundleToolDefinitions, ...tools_voice_1.voiceToolDefinitions, ...tools_unraid_1.unraidToolDefinitions, tools_steward_policy_1.stewardPolicyToolDefinition, ...tools_house_care_1.houseCareToolDefinitions, tools_surface_1.surfaceToolDefinition, ...tools_shepherd_1.shepherdToolDefinitions, ...tools_app_sessions_1.appSessionsToolDefinitions, ...tools_mail_1.mailToolDefinitions
|
|
129
|
+
const additionalDefinitions = [...tools_chat_1.chatToolDefinitions, ...tools_teams_1.teamsToolDefinitions, ...ado_semantic_1.adoSemanticToolDefinitions, ...tools_github_1.githubToolDefinitions, ...tools_bundle_1.bundleToolDefinitions, ...tools_voice_1.voiceToolDefinitions, ...tools_unraid_1.unraidToolDefinitions, tools_steward_policy_1.stewardPolicyToolDefinition, ...tools_house_care_1.houseCareToolDefinitions, tools_surface_1.surfaceToolDefinition, ...tools_shepherd_1.shepherdToolDefinitions, ...tools_app_sessions_1.appSessionsToolDefinitions, ...tools_mail_1.mailToolDefinitions,
|
|
130
|
+
// The mailbox group, generated by ouro-actions-tools (actions/generated/mailbox-tools/tools.json). Registered, so the
|
|
131
|
+
// dispatcher and the X-ray know it, and offered in no turn until the letters store exists.
|
|
132
|
+
...(0, doors_tools_1.mailboxToolDefinitions)()];
|
|
129
133
|
const COMMERCE_AUTHORITY_TOOLS = new Set(["stripe_create_card", "flight_hold", "flight_book"]);
|
|
130
134
|
class ToolSelectionError extends Error {
|
|
131
135
|
}
|
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.1497",
|
|
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.1497",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1497",
|
|
4
4
|
"description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
|
|
5
5
|
"homepage": "https://ouroboros.bot/",
|
|
6
6
|
"engines": {
|