@ouro.bot/cli 0.1.0-alpha.75 → 0.1.0-alpha.76
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 +9 -0
- package/dist/heart/daemon/daemon-cli.js +37 -0
- package/dist/senses/cli-layout.js +100 -0
- package/dist/senses/cli.js +22 -5
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
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.76",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Fix: CLI chat terminal logging now filters to warn/error only — info-level nerves logs go to ndjson file only, keeping the interactive TUI clean.",
|
|
8
|
+
"Fix: Streamed model output now wraps at word boundaries instead of mid-word. A new StreamingWordWrapper buffers partial lines and breaks at spaces when approaching terminal width.",
|
|
9
|
+
"New: `ouro up` now prints 'ouro updated to <version> (was <previous>)' when npx downloads a newer CLI binary, separate from the agent bundle update message.",
|
|
10
|
+
"Fix: Spinner/log interleave verified — terminal sink reads pause/resume hooks at call time, not creation time, so the filterSink wrapper in CLI logging does not break spinner coordination."
|
|
11
|
+
]
|
|
12
|
+
},
|
|
4
13
|
{
|
|
5
14
|
"version": "0.1.0-alpha.75",
|
|
6
15
|
"changes": [
|
|
@@ -37,6 +37,7 @@ exports.ensureDaemonRunning = ensureDaemonRunning;
|
|
|
37
37
|
exports.listGithubCopilotModels = listGithubCopilotModels;
|
|
38
38
|
exports.pingGithubCopilotModel = pingGithubCopilotModel;
|
|
39
39
|
exports.parseOuroCommand = parseOuroCommand;
|
|
40
|
+
exports.readFirstBundleMetaVersion = readFirstBundleMetaVersion;
|
|
40
41
|
exports.discoverExistingCredentials = discoverExistingCredentials;
|
|
41
42
|
exports.createDefaultOuroCliDeps = createDefaultOuroCliDeps;
|
|
42
43
|
exports.runOuroCli = runOuroCli;
|
|
@@ -971,6 +972,33 @@ function defaultWriteStdout(text) {
|
|
|
971
972
|
// eslint-disable-next-line no-console -- terminal UX: CLI command output
|
|
972
973
|
console.log(text);
|
|
973
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* Read the runtimeVersion from the first .ouro bundle's bundle-meta.json.
|
|
977
|
+
* Returns undefined if none found or unreadable.
|
|
978
|
+
*/
|
|
979
|
+
function readFirstBundleMetaVersion(bundlesRoot) {
|
|
980
|
+
try {
|
|
981
|
+
if (!fs.existsSync(bundlesRoot))
|
|
982
|
+
return undefined;
|
|
983
|
+
const entries = fs.readdirSync(bundlesRoot, { withFileTypes: true });
|
|
984
|
+
for (const entry of entries) {
|
|
985
|
+
/* v8 ignore next -- skip non-.ouro dirs: tested via version-detect tests @preserve */
|
|
986
|
+
if (!entry.isDirectory() || !entry.name.endsWith(".ouro"))
|
|
987
|
+
continue;
|
|
988
|
+
const metaPath = path.join(bundlesRoot, entry.name, "bundle-meta.json");
|
|
989
|
+
if (!fs.existsSync(metaPath))
|
|
990
|
+
continue;
|
|
991
|
+
const raw = fs.readFileSync(metaPath, "utf-8");
|
|
992
|
+
const meta = JSON.parse(raw);
|
|
993
|
+
if (meta.runtimeVersion)
|
|
994
|
+
return meta.runtimeVersion;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
catch {
|
|
998
|
+
// Best effort — return undefined on any error
|
|
999
|
+
}
|
|
1000
|
+
return undefined;
|
|
1001
|
+
}
|
|
974
1002
|
function defaultCleanupStaleSocket(socketPath) {
|
|
975
1003
|
if (fs.existsSync(socketPath)) {
|
|
976
1004
|
fs.unlinkSync(socketPath);
|
|
@@ -1743,7 +1771,16 @@ async function runOuroCli(args, deps = createDefaultOuroCliDeps()) {
|
|
|
1743
1771
|
(0, update_hooks_1.registerUpdateHook)(bundle_meta_1.bundleMetaHook);
|
|
1744
1772
|
const bundlesRoot = (0, identity_1.getAgentBundlesRoot)();
|
|
1745
1773
|
const currentVersion = (0, bundle_manifest_1.getPackageVersion)();
|
|
1774
|
+
// Snapshot the previous CLI version from the first bundle-meta before
|
|
1775
|
+
// hooks overwrite it. This detects when npx downloaded a newer CLI.
|
|
1776
|
+
const previousCliVersion = readFirstBundleMetaVersion(bundlesRoot);
|
|
1746
1777
|
const updateSummary = await (0, update_hooks_1.applyPendingUpdates)(bundlesRoot, currentVersion);
|
|
1778
|
+
// Notify about CLI binary update (npx downloaded a new version)
|
|
1779
|
+
/* v8 ignore start -- CLI update detection: tested via daemon-cli-version-detect.test.ts @preserve */
|
|
1780
|
+
if (previousCliVersion && previousCliVersion !== currentVersion) {
|
|
1781
|
+
deps.writeStdout(`ouro updated to ${currentVersion} (was ${previousCliVersion})`);
|
|
1782
|
+
}
|
|
1783
|
+
/* v8 ignore stop */
|
|
1747
1784
|
if (updateSummary.updated.length > 0) {
|
|
1748
1785
|
const agents = updateSummary.updated.map((e) => e.agent);
|
|
1749
1786
|
const from = updateSummary.updated[0].from;
|
|
@@ -1,8 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamingWordWrapper = void 0;
|
|
3
4
|
exports.wrapCliText = wrapCliText;
|
|
4
5
|
exports.formatEchoedInputSummary = formatEchoedInputSummary;
|
|
5
6
|
const runtime_1 = require("../nerves/runtime");
|
|
7
|
+
// Strip ANSI escape sequences to measure visible text width.
|
|
8
|
+
const ANSI_RE = /\x1b\[[0-9;]*[A-Za-z]/g;
|
|
9
|
+
function visibleLength(text) {
|
|
10
|
+
return text.replace(ANSI_RE, "").length;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Streaming word wrapper for terminal output.
|
|
14
|
+
*
|
|
15
|
+
* Text arrives in small chunks (sometimes single characters). This class
|
|
16
|
+
* buffers a partial line and emits complete wrapped lines at word boundaries
|
|
17
|
+
* when the visible width approaches the terminal column limit.
|
|
18
|
+
*
|
|
19
|
+
* ANSI escape sequences are treated as zero-width so colours and styles
|
|
20
|
+
* pass through without affecting line-break decisions.
|
|
21
|
+
*/
|
|
22
|
+
class StreamingWordWrapper {
|
|
23
|
+
col = 0; // visible columns consumed on the current line
|
|
24
|
+
buf = ""; // buffered text for the current line (not yet emitted)
|
|
25
|
+
width; // terminal column count
|
|
26
|
+
constructor(cols) {
|
|
27
|
+
this.width = Math.max(cols ?? (process.stdout.columns || 80), 1);
|
|
28
|
+
}
|
|
29
|
+
/** Accept a chunk of already-rendered text and return text ready for stdout. */
|
|
30
|
+
push(text) {
|
|
31
|
+
let out = "";
|
|
32
|
+
for (let i = 0; i < text.length; i++) {
|
|
33
|
+
const ch = text[i];
|
|
34
|
+
// Pass through ANSI escape sequences without counting width
|
|
35
|
+
/* v8 ignore start -- ANSI handling: tested via StreamingWordWrapper ANSI test @preserve */
|
|
36
|
+
if (ch === "\x1b") {
|
|
37
|
+
const rest = text.slice(i);
|
|
38
|
+
const m = rest.match(/^\x1b\[[0-9;]*[A-Za-z]/);
|
|
39
|
+
if (m) {
|
|
40
|
+
this.buf += m[0];
|
|
41
|
+
i += m[0].length - 1;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/* v8 ignore stop */
|
|
46
|
+
// Explicit newline: flush current line and reset
|
|
47
|
+
if (ch === "\n") {
|
|
48
|
+
out += this.buf + "\n";
|
|
49
|
+
this.buf = "";
|
|
50
|
+
this.col = 0;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
// Space: if the current line is already at or past width, wrap now.
|
|
54
|
+
// Otherwise just append.
|
|
55
|
+
if (ch === " ") {
|
|
56
|
+
/* v8 ignore start -- wrap-at-space: tested via StreamingWordWrapper unit tests @preserve */
|
|
57
|
+
if (this.col >= this.width) {
|
|
58
|
+
out += this.buf + "\n";
|
|
59
|
+
this.buf = "";
|
|
60
|
+
this.col = 0;
|
|
61
|
+
// Drop the space at the wrap point
|
|
62
|
+
continue;
|
|
63
|
+
/* v8 ignore stop */
|
|
64
|
+
}
|
|
65
|
+
this.buf += ch;
|
|
66
|
+
this.col++;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
// Non-space character
|
|
70
|
+
this.col++;
|
|
71
|
+
if (this.col > this.width) {
|
|
72
|
+
// We've exceeded the width. Try to break at the last space.
|
|
73
|
+
const lastSpace = this.buf.lastIndexOf(" ");
|
|
74
|
+
if (lastSpace !== -1) {
|
|
75
|
+
out += this.buf.slice(0, lastSpace) + "\n";
|
|
76
|
+
// Keep the remainder (after space) plus current char
|
|
77
|
+
this.buf = this.buf.slice(lastSpace + 1) + ch;
|
|
78
|
+
this.col = visibleLength(this.buf);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// No space to break at — hard wrap
|
|
82
|
+
out += this.buf + "\n";
|
|
83
|
+
this.buf = ch;
|
|
84
|
+
this.col = 1;
|
|
85
|
+
}
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
this.buf += ch;
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
/** Flush any remaining buffered text (call at end of response). */
|
|
93
|
+
flush() {
|
|
94
|
+
const remainder = this.buf;
|
|
95
|
+
this.buf = "";
|
|
96
|
+
this.col = 0;
|
|
97
|
+
return remainder;
|
|
98
|
+
}
|
|
99
|
+
/** Reset wrapper state (call at start of new model turn). */
|
|
100
|
+
reset() {
|
|
101
|
+
this.buf = "";
|
|
102
|
+
this.col = 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.StreamingWordWrapper = StreamingWordWrapper;
|
|
6
106
|
function splitLongWord(word, width) {
|
|
7
107
|
const chunks = [];
|
|
8
108
|
for (let index = 0; index < word.length; index += width) {
|
package/dist/senses/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.MarkdownStreamer = exports.InputController = exports.Spinner = exports.wrapCliText = exports.formatEchoedInputSummary = void 0;
|
|
36
|
+
exports.MarkdownStreamer = exports.InputController = exports.Spinner = exports.StreamingWordWrapper = exports.wrapCliText = exports.formatEchoedInputSummary = void 0;
|
|
37
37
|
exports.formatPendingPrefix = formatPendingPrefix;
|
|
38
38
|
exports.getCliContinuityIngressTexts = getCliContinuityIngressTexts;
|
|
39
39
|
exports.pauseActiveSpinner = pauseActiveSpinner;
|
|
@@ -76,6 +76,7 @@ const cli_layout_1 = require("./cli-layout");
|
|
|
76
76
|
var cli_layout_2 = require("./cli-layout");
|
|
77
77
|
Object.defineProperty(exports, "formatEchoedInputSummary", { enumerable: true, get: function () { return cli_layout_2.formatEchoedInputSummary; } });
|
|
78
78
|
Object.defineProperty(exports, "wrapCliText", { enumerable: true, get: function () { return cli_layout_2.wrapCliText; } });
|
|
79
|
+
Object.defineProperty(exports, "StreamingWordWrapper", { enumerable: true, get: function () { return cli_layout_2.StreamingWordWrapper; } });
|
|
79
80
|
/**
|
|
80
81
|
* Format pending messages as content-prefix strings for injection into
|
|
81
82
|
* the next user message. Self-messages (from === agentName) become
|
|
@@ -349,6 +350,7 @@ function createCliCallbacks() {
|
|
|
349
350
|
let hadToolRun = false;
|
|
350
351
|
let textDirty = false; // true when text/reasoning was written without a trailing newline
|
|
351
352
|
const streamer = new MarkdownStreamer();
|
|
353
|
+
const wrapper = new cli_layout_1.StreamingWordWrapper();
|
|
352
354
|
return {
|
|
353
355
|
onModelStart: () => {
|
|
354
356
|
currentSpinner?.stop();
|
|
@@ -356,6 +358,7 @@ function createCliCallbacks() {
|
|
|
356
358
|
hadReasoning = false;
|
|
357
359
|
textDirty = false;
|
|
358
360
|
streamer.reset();
|
|
361
|
+
wrapper.reset();
|
|
359
362
|
const phrases = (0, phrases_1.getPhrases)();
|
|
360
363
|
const pool = hadToolRun ? phrases.followup : phrases.thinking;
|
|
361
364
|
const first = (0, phrases_1.pickPhrase)(pool);
|
|
@@ -369,6 +372,7 @@ function createCliCallbacks() {
|
|
|
369
372
|
},
|
|
370
373
|
onClearText: () => {
|
|
371
374
|
streamer.reset();
|
|
375
|
+
wrapper.reset();
|
|
372
376
|
},
|
|
373
377
|
onTextChunk: (text) => {
|
|
374
378
|
// Stop spinner if still running — final_answer streaming and Anthropic
|
|
@@ -385,8 +389,13 @@ function createCliCallbacks() {
|
|
|
385
389
|
hadReasoning = false;
|
|
386
390
|
}
|
|
387
391
|
const rendered = streamer.push(text);
|
|
388
|
-
|
|
389
|
-
|
|
392
|
+
/* v8 ignore start -- wrapper integration: tested via cli.test.ts onTextChunk tests @preserve */
|
|
393
|
+
if (rendered) {
|
|
394
|
+
const wrapped = wrapper.push(rendered);
|
|
395
|
+
if (wrapped)
|
|
396
|
+
process.stdout.write(wrapped);
|
|
397
|
+
}
|
|
398
|
+
/* v8 ignore stop */
|
|
390
399
|
textDirty = text.length > 0 && !text.endsWith("\n");
|
|
391
400
|
},
|
|
392
401
|
onReasoningChunk: (text) => {
|
|
@@ -445,9 +454,17 @@ function createCliCallbacks() {
|
|
|
445
454
|
flushMarkdown: () => {
|
|
446
455
|
currentSpinner?.stop();
|
|
447
456
|
setSpinner(null);
|
|
457
|
+
/* v8 ignore start -- wrapper flush: tested via cli.test.ts flushMarkdown tests @preserve */
|
|
448
458
|
const remaining = streamer.flush();
|
|
449
|
-
if (remaining)
|
|
450
|
-
|
|
459
|
+
if (remaining) {
|
|
460
|
+
const wrapped = wrapper.push(remaining);
|
|
461
|
+
if (wrapped)
|
|
462
|
+
process.stdout.write(wrapped);
|
|
463
|
+
}
|
|
464
|
+
const tail = wrapper.flush();
|
|
465
|
+
if (tail)
|
|
466
|
+
process.stdout.write(tail);
|
|
467
|
+
/* v8 ignore stop */
|
|
451
468
|
},
|
|
452
469
|
};
|
|
453
470
|
}
|