@ouro.bot/cli 0.1.0-alpha.1289 → 0.1.0-alpha.1290
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/senses/cli/bracketed-paste.js +7 -7
- package/dist/senses/cli/input-keys.js +35 -0
- package/dist/senses/cli/ouro-tui.js +28 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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.1290",
|
|
6
|
+
"changes": [
|
|
7
|
+
"ouro chat keeps a bracketed paste: a prompt pasted by a terminal or a host such as Orca now lands in the composer as plain text instead of vanishing, and a line break inside it no longer sends it early."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1289",
|
|
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.1290</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,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BracketedPasteHandler = void 0;
|
|
3
|
+
exports.BracketedPasteHandler = exports.PASTE_END = exports.PASTE_START = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Bracketed paste mode handler for the TUI.
|
|
6
6
|
*
|
|
@@ -12,8 +12,8 @@ exports.BracketedPasteHandler = void 0;
|
|
|
12
12
|
*/
|
|
13
13
|
const events_1 = require("events");
|
|
14
14
|
const runtime_1 = require("../../nerves/runtime");
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
exports.PASTE_START = "\x1b[200~";
|
|
16
|
+
exports.PASTE_END = "\x1b[201~";
|
|
17
17
|
class BracketedPasteHandler extends events_1.EventEmitter {
|
|
18
18
|
stdin;
|
|
19
19
|
stdout;
|
|
@@ -37,7 +37,7 @@ class BracketedPasteHandler extends events_1.EventEmitter {
|
|
|
37
37
|
if (this.pasting) {
|
|
38
38
|
// Look for end marker in buffer + remaining
|
|
39
39
|
const combined = this.buffer + remaining;
|
|
40
|
-
const endIdx = combined.indexOf(PASTE_END);
|
|
40
|
+
const endIdx = combined.indexOf(exports.PASTE_END);
|
|
41
41
|
if (endIdx !== -1) {
|
|
42
42
|
// Found end marker -- emit paste content
|
|
43
43
|
const pasteContent = combined.slice(0, endIdx);
|
|
@@ -46,7 +46,7 @@ class BracketedPasteHandler extends events_1.EventEmitter {
|
|
|
46
46
|
this.buffer = "";
|
|
47
47
|
this.pasting = false;
|
|
48
48
|
// Process remaining data after end marker
|
|
49
|
-
remaining = combined.slice(endIdx + PASTE_END.length);
|
|
49
|
+
remaining = combined.slice(endIdx + exports.PASTE_END.length);
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
52
|
// No end marker yet -- buffer everything so far
|
|
@@ -54,7 +54,7 @@ class BracketedPasteHandler extends events_1.EventEmitter {
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
// Not pasting -- look for start marker
|
|
57
|
-
const startIdx = remaining.indexOf(PASTE_START);
|
|
57
|
+
const startIdx = remaining.indexOf(exports.PASTE_START);
|
|
58
58
|
if (startIdx !== -1) {
|
|
59
59
|
// Emit any data before the start marker
|
|
60
60
|
const before = remaining.slice(0, startIdx);
|
|
@@ -64,7 +64,7 @@ class BracketedPasteHandler extends events_1.EventEmitter {
|
|
|
64
64
|
// Enter paste mode
|
|
65
65
|
this.pasting = true;
|
|
66
66
|
this.buffer = "";
|
|
67
|
-
remaining = remaining.slice(startIdx + PASTE_START.length);
|
|
67
|
+
remaining = remaining.slice(startIdx + exports.PASTE_START.length);
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
70
|
// No start marker -- emit as regular data
|
|
@@ -11,9 +11,13 @@ exports.handleForwardDelete = handleForwardDelete;
|
|
|
11
11
|
exports.handleHome = handleHome;
|
|
12
12
|
exports.handleEnd = handleEnd;
|
|
13
13
|
exports.classifyEscapeSequence = classifyEscapeSequence;
|
|
14
|
+
exports.bracketedPasteText = bracketedPasteText;
|
|
15
|
+
exports.plainInputText = plainInputText;
|
|
16
|
+
exports.pasteOpenAfter = pasteOpenAfter;
|
|
14
17
|
exports.handleYankPop = handleYankPop;
|
|
15
18
|
exports.handleEmptyPaste = handleEmptyPaste;
|
|
16
19
|
const runtime_1 = require("../../nerves/runtime");
|
|
20
|
+
const bracketed_paste_1 = require("./bracketed-paste");
|
|
17
21
|
/**
|
|
18
22
|
* Ctrl+K: kill from cursor to end of line.
|
|
19
23
|
* Pushes killed text to ring with "append" direction.
|
|
@@ -133,6 +137,37 @@ function classifyEscapeSequence(inputChar) {
|
|
|
133
137
|
return "ignore";
|
|
134
138
|
return null;
|
|
135
139
|
}
|
|
140
|
+
// Escape sequences (CSI, OSC, other two-byte ESC forms) and C0/C1 control bytes other than \n and \t.
|
|
141
|
+
// eslint-disable-next-line no-control-regex -- matching the control bytes a paste must not carry into the composer
|
|
142
|
+
const PASTED_CONTROLS = /\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?|\x1b[@-_]?|[\x00-\x08\x0b-\x1f\x7f-\x9f]/g;
|
|
143
|
+
/**
|
|
144
|
+
* The text of a bracketed paste chunk, or null when `raw` holds no paste marker.
|
|
145
|
+
* Terminals and hosts such as Orca paste a prompt between \x1b[200~ and \x1b[201~, and Ink hands a chunk that
|
|
146
|
+
* starts with a marker over as an escape sequence, so without this the paste is dropped.
|
|
147
|
+
* `raw` must keep its leading \x1b (Ink strips it and sets meta). Line endings become \n, and escape sequences
|
|
148
|
+
* and other control bytes are removed.
|
|
149
|
+
* Only the chunks that carry a marker come through here; a paste's middle chunks arrive as ordinary input, which
|
|
150
|
+
* the composer cleans with `plainInputText` too.
|
|
151
|
+
*/
|
|
152
|
+
function bracketedPasteText(raw) {
|
|
153
|
+
if (!raw.includes(bracketed_paste_1.PASTE_START) && !raw.includes(bracketed_paste_1.PASTE_END))
|
|
154
|
+
return null;
|
|
155
|
+
const text = plainInputText(raw.split(bracketed_paste_1.PASTE_START).join("").split(bracketed_paste_1.PASTE_END).join(""));
|
|
156
|
+
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.input_paste", message: "bracketed paste chunk reached the composer", meta: { length: text.length } });
|
|
157
|
+
return text;
|
|
158
|
+
}
|
|
159
|
+
/** Input as plain text for the composer: line endings become \n, and escape sequences and other control bytes go. */
|
|
160
|
+
function plainInputText(raw) {
|
|
161
|
+
return raw.replace(/\r\n?/g, "\n").replace(PASTED_CONTROLS, "");
|
|
162
|
+
}
|
|
163
|
+
/** Whether a paste is still open after `raw`, given whether one was open before it. */
|
|
164
|
+
function pasteOpenAfter(raw, openBefore) {
|
|
165
|
+
const start = raw.lastIndexOf(bracketed_paste_1.PASTE_START);
|
|
166
|
+
const end = raw.lastIndexOf(bracketed_paste_1.PASTE_END);
|
|
167
|
+
if (start === -1 && end === -1)
|
|
168
|
+
return openBefore;
|
|
169
|
+
return start > end;
|
|
170
|
+
}
|
|
136
171
|
/**
|
|
137
172
|
* Alt+Y: yank-pop -- replace previously yanked text with next ring entry.
|
|
138
173
|
* Returns null if not in yanking state or ring is empty.
|
|
@@ -160,6 +160,8 @@ function QueuedMessages({ items }) {
|
|
|
160
160
|
}
|
|
161
161
|
// ─── Kill Ring (session-scoped) ─────────────────────────────────────
|
|
162
162
|
const killRing = new kill_ring_1.KillRing();
|
|
163
|
+
// How long an unfinished bracketed paste waits for its next chunk.
|
|
164
|
+
const PASTE_CHUNK_GAP_MS = 200;
|
|
163
165
|
// ─── Input ──────────────────────────────────────────────────────────
|
|
164
166
|
function InputArea({ onSubmit, onCtrlC, history, queuedInputs, onPopQueue, agentName, model, onImageMap, onHistoryAdd }) {
|
|
165
167
|
const [input, setInput] = (0, react_1.useState)("");
|
|
@@ -175,6 +177,8 @@ function InputArea({ onSubmit, onCtrlC, history, queuedInputs, onPopQueue, agent
|
|
|
175
177
|
// another key arrives in that window, it was an escape sequence, not standalone ESC.
|
|
176
178
|
const escTimerRef = (0, react_1.useRef)(null);
|
|
177
179
|
const lastEscTime = (0, react_1.useRef)(0);
|
|
180
|
+
// Until when a bracketed paste counts as still arriving.
|
|
181
|
+
const pasteOpenUntilRef = (0, react_1.useRef)(0);
|
|
178
182
|
const tooltipTimerRef = (0, react_1.useRef)(null);
|
|
179
183
|
(0, react_1.useEffect)(() => () => {
|
|
180
184
|
if (tooltipTimerRef.current)
|
|
@@ -252,6 +256,28 @@ function InputArea({ onSubmit, onCtrlC, history, queuedInputs, onPopQueue, agent
|
|
|
252
256
|
clearTimeout(escTimerRef.current);
|
|
253
257
|
escTimerRef.current = null;
|
|
254
258
|
}
|
|
259
|
+
// A bracketed paste (how Orca sends a launch prompt) arrives as an escape-prefixed chunk, which every
|
|
260
|
+
// path below would drop. Ink strips the \x1b and sets meta, so put it back before looking.
|
|
261
|
+
const rawChunk = key.meta && inputChar.startsWith("[") ? "\x1b" + inputChar : inputChar;
|
|
262
|
+
// A lone \r inside an open paste is a line of the paste, not Enter. A paste's chunks arrive back to back, so an
|
|
263
|
+
// open paste lapses after a short gap: an end marker Ink swallowed can never leave Enter unable to send.
|
|
264
|
+
const now = Date.now();
|
|
265
|
+
const pasteOpen = now < pasteOpenUntilRef.current;
|
|
266
|
+
const pasted = pasteOpen && key.return && inputChar === "\r" ? "\n" : (0, input_keys_1.bracketedPasteText)(rawChunk);
|
|
267
|
+
// Single keys never extend it, so typing after a lost end marker cannot hold it open.
|
|
268
|
+
const extend = rawChunk.length > 1 || !pasteOpen;
|
|
269
|
+
pasteOpenUntilRef.current = (0, input_keys_1.pasteOpenAfter)(rawChunk, pasteOpen) ? (extend ? now + PASTE_CHUNK_GAP_MS : pasteOpenUntilRef.current) : 0;
|
|
270
|
+
if (pasted !== null) {
|
|
271
|
+
killRing.resetAccumulation();
|
|
272
|
+
killRing.resetYankState();
|
|
273
|
+
if (pasted) {
|
|
274
|
+
const before = inputRef.current.slice(0, cursorRef.current);
|
|
275
|
+
const after = inputRef.current.slice(cursorRef.current);
|
|
276
|
+
updateInput(before + pasted + after, cursorRef.current + pasted.length);
|
|
277
|
+
historyIdx.current = -1;
|
|
278
|
+
}
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
255
281
|
// PageUp/PageDown: suppress (no text insertion, no action)
|
|
256
282
|
if (key.pageUp || key.pageDown)
|
|
257
283
|
return;
|
|
@@ -570,8 +596,8 @@ function InputArea({ onSubmit, onCtrlC, history, queuedInputs, onPopQueue, agent
|
|
|
570
596
|
return;
|
|
571
597
|
// Regular character: insert at cursor position
|
|
572
598
|
if (!key.ctrl && !key.meta && inputChar) {
|
|
573
|
-
//
|
|
574
|
-
const cleaned =
|
|
599
|
+
// Plain text only: escape sequences and control bytes go, \r becomes \n (SSH/paste compat)
|
|
600
|
+
const cleaned = (0, input_keys_1.plainInputText)(inputChar);
|
|
575
601
|
if (!cleaned)
|
|
576
602
|
return;
|
|
577
603
|
const before = inputRef.current.slice(0, cursorRef.current);
|
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.1290",
|
|
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.1290",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|