@ouro.bot/cli 0.1.0-alpha.1292 → 0.1.0-alpha.1294
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,19 @@
|
|
|
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.1294",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The CLI's flag gate and the shell's approval check now find an ouro command by its words wherever its flags sit, so putting --agent before a subcommand no longer skips --why or approval."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.1293",
|
|
12
|
+
"changes": [
|
|
13
|
+
"The replay eval has a fake household: calibre-web, libgen mirrors and an SMTP sink that record every request, a hand-written books command that talks to them, and deterministic synthetic fixture editions, so the book cases can run with no real library, mirror or mail server.",
|
|
14
|
+
"Update the Ouro UI files to Ouro UI v1.3.417."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
4
17
|
{
|
|
5
18
|
"version": "0.1.0-alpha.1292",
|
|
6
19
|
"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.1294</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PARSER_FLAGS = void 0;
|
|
4
|
+
exports.commandWordIndexes = commandWordIndexes;
|
|
5
|
+
exports.commandWords = commandWords;
|
|
4
6
|
exports.gateCommandArgs = gateCommandArgs;
|
|
5
7
|
const runtime_1 = require("../../nerves/runtime");
|
|
6
8
|
const cli_parse_1 = require("./cli-parse");
|
|
@@ -80,9 +82,34 @@ function editDistance(a, b) {
|
|
|
80
82
|
}
|
|
81
83
|
return row[b.length];
|
|
82
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Where a command line's words sit: every token that isn't a flag, skipping the value after a global flag such as
|
|
87
|
+
* --agent. Parsers strip those flags wherever they appear, so `a2a --agent x message` names `a2a message`.
|
|
88
|
+
*/
|
|
89
|
+
function commandWordIndexes(args) {
|
|
90
|
+
const indexes = [];
|
|
91
|
+
for (let index = 0; index < args.length; index++) {
|
|
92
|
+
const token = args[index];
|
|
93
|
+
if (GLOBAL_VALUE_FLAGS.includes(token))
|
|
94
|
+
index++;
|
|
95
|
+
else if (!token.startsWith("-"))
|
|
96
|
+
indexes.push(index);
|
|
97
|
+
}
|
|
98
|
+
return indexes;
|
|
99
|
+
}
|
|
100
|
+
/** The words of a command line, without its flags and global flag values (see commandWordIndexes). */
|
|
101
|
+
function commandWords(args) {
|
|
102
|
+
return commandWordIndexes(args).map((index) => args[index]);
|
|
103
|
+
}
|
|
83
104
|
function matchCommand(args) {
|
|
84
|
-
const
|
|
85
|
-
|
|
105
|
+
const indexes = commandWordIndexes(args);
|
|
106
|
+
const words = indexes.map((index) => args[index]);
|
|
107
|
+
const found = SHAPES.filter((shape) => shape.words.every((word, index) => words[index] === word)).sort((a, b) => b.words.length - a.words.length);
|
|
108
|
+
if (found.length === 0)
|
|
109
|
+
return null;
|
|
110
|
+
const shape = found[0];
|
|
111
|
+
const matched = new Set(indexes.slice(0, shape.words.length));
|
|
112
|
+
return { shape, rest: args.filter((_, index) => !matched.has(index)) };
|
|
86
113
|
}
|
|
87
114
|
function refuse(name, code, message) {
|
|
88
115
|
(0, runtime_1.emitNervesEvent)({
|
|
@@ -96,14 +123,14 @@ function refuse(name, code, message) {
|
|
|
96
123
|
}
|
|
97
124
|
/** Checks a command line against its declaration; a pass returns the words the legacy dispatcher should read. */
|
|
98
125
|
function gateCommandArgs(args) {
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
126
|
+
const match = matchCommand(args);
|
|
127
|
+
if (!match)
|
|
101
128
|
return { kind: "pass", args };
|
|
102
|
-
const {
|
|
129
|
+
const { shape, rest } = match;
|
|
130
|
+
const { declaration, flags } = shape;
|
|
103
131
|
const name = declaration.name;
|
|
104
132
|
const others = declaration.effect === "others";
|
|
105
133
|
const known = [...new Set([...exports.PARSER_FLAGS, ...GLOBAL_FLAGS, ...flags.keys()])];
|
|
106
|
-
const rest = args.slice(words.length);
|
|
107
134
|
if (others && rest.includes("--help")) {
|
|
108
135
|
const text = [
|
|
109
136
|
"Usage:",
|
package/dist/repertoire/tools.js
CHANGED
|
@@ -47,6 +47,7 @@ const tool_approval_1 = require("../heart/tool-approval");
|
|
|
47
47
|
const tools_voice_local_1 = require("./tools-voice-local");
|
|
48
48
|
const tools_sanctuary_host_1 = require("./tools-sanctuary-host");
|
|
49
49
|
const cli_manifest_1 = require("../heart/daemon/cli-manifest");
|
|
50
|
+
const cli_gate_1 = require("../heart/daemon/cli-gate");
|
|
50
51
|
function safeGetAgentRoot() {
|
|
51
52
|
try {
|
|
52
53
|
return (0, identity_1.getAgentRoot)();
|
|
@@ -306,18 +307,21 @@ function shellTokens(command) {
|
|
|
306
307
|
return command.trim().split(/\s+/).filter(Boolean);
|
|
307
308
|
}
|
|
308
309
|
/**
|
|
309
|
-
* The declared command a shell line names: the longest declaration
|
|
310
|
-
*
|
|
311
|
-
*
|
|
310
|
+
* The declared command a shell line names: the longest declaration its words start with, read past flags as the
|
|
311
|
+
* CLI's gate reads them (see commandWords), so `ouro a2a --agent x message` names `a2a message`. A group's
|
|
312
|
+
* declaration (one with longer declarations under it) followed by any other word names no command, since that word
|
|
313
|
+
* is an undeclared one under the group.
|
|
312
314
|
*/
|
|
313
|
-
function declaredOuroCommand(
|
|
315
|
+
function declaredOuroCommand(args) {
|
|
316
|
+
if (args.length > 0 && OURO_INFO_FLAGS.includes(args[0]))
|
|
317
|
+
return args[0];
|
|
318
|
+
const words = (0, cli_gate_1.commandWords)(args);
|
|
314
319
|
for (let length = words.length; length > 0; length--) {
|
|
315
320
|
const name = words.slice(0, length).join(" ");
|
|
316
|
-
if (!DECLARED_OURO_COMMANDS.includes(name)
|
|
321
|
+
if (!DECLARED_OURO_COMMANDS.includes(name))
|
|
317
322
|
continue;
|
|
318
|
-
const next = words[length];
|
|
319
323
|
const isGroup = DECLARED_OURO_COMMANDS.some((other) => other.startsWith(`${name} `));
|
|
320
|
-
return
|
|
324
|
+
return length < words.length && isGroup ? null : name;
|
|
321
325
|
}
|
|
322
326
|
return null;
|
|
323
327
|
}
|
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.1294",
|
|
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.1294",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|