@everywheredev/cli 0.0.5 → 0.0.7
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/README.md +1 -1
- package/dist/index.js +274 -59
- package/package.json +3 -2
- package/scripts/build.mjs +68 -0
- package/dist/agent/agent-loop.d.ts +0 -40
- package/dist/agent/agent-loop.d.ts.map +0 -1
- package/dist/agent/agent-loop.js +0 -162
- package/dist/agent/agent-loop.js.map +0 -1
- package/dist/agent/approval.d.ts +0 -38
- package/dist/agent/approval.d.ts.map +0 -1
- package/dist/agent/approval.js +0 -55
- package/dist/agent/approval.js.map +0 -1
- package/dist/agent/run-tracker.d.ts +0 -26
- package/dist/agent/run-tracker.d.ts.map +0 -1
- package/dist/agent/run-tracker.js +0 -43
- package/dist/agent/run-tracker.js.map +0 -1
- package/dist/auth/device-flow.d.ts +0 -61
- package/dist/auth/device-flow.d.ts.map +0 -1
- package/dist/auth/device-flow.js +0 -141
- package/dist/auth/device-flow.js.map +0 -1
- package/dist/auth/hydra-oauth-auth-provider.d.ts +0 -35
- package/dist/auth/hydra-oauth-auth-provider.d.ts.map +0 -1
- package/dist/auth/hydra-oauth-auth-provider.js +0 -153
- package/dist/auth/hydra-oauth-auth-provider.js.map +0 -1
- package/dist/auth/keychain.d.ts +0 -42
- package/dist/auth/keychain.d.ts.map +0 -1
- package/dist/auth/keychain.js +0 -138
- package/dist/auth/keychain.js.map +0 -1
- package/dist/auth/pkce.d.ts +0 -20
- package/dist/auth/pkce.d.ts.map +0 -1
- package/dist/auth/pkce.js +0 -44
- package/dist/auth/pkce.js.map +0 -1
- package/dist/auth/ports.d.ts +0 -25
- package/dist/auth/ports.d.ts.map +0 -1
- package/dist/auth/ports.js +0 -8
- package/dist/auth/ports.js.map +0 -1
- package/dist/commands/activity.d.ts +0 -17
- package/dist/commands/activity.d.ts.map +0 -1
- package/dist/commands/activity.js +0 -54
- package/dist/commands/activity.js.map +0 -1
- package/dist/commands/agent.d.ts +0 -25
- package/dist/commands/agent.d.ts.map +0 -1
- package/dist/commands/agent.js +0 -80
- package/dist/commands/agent.js.map +0 -1
- package/dist/commands/agents.d.ts +0 -9
- package/dist/commands/agents.d.ts.map +0 -1
- package/dist/commands/agents.js +0 -28
- package/dist/commands/agents.js.map +0 -1
- package/dist/commands/commits.d.ts +0 -16
- package/dist/commands/commits.d.ts.map +0 -1
- package/dist/commands/commits.js +0 -39
- package/dist/commands/commits.js.map +0 -1
- package/dist/commands/diff.d.ts +0 -15
- package/dist/commands/diff.d.ts.map +0 -1
- package/dist/commands/diff.js +0 -27
- package/dist/commands/diff.js.map +0 -1
- package/dist/commands/expose.d.ts +0 -15
- package/dist/commands/expose.d.ts.map +0 -1
- package/dist/commands/expose.js +0 -39
- package/dist/commands/expose.js.map +0 -1
- package/dist/commands/index.d.ts +0 -7
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -12
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/login.d.ts +0 -9
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -27
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -9
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -24
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/me.d.ts +0 -10
- package/dist/commands/me.d.ts.map +0 -1
- package/dist/commands/me.js +0 -25
- package/dist/commands/me.js.map +0 -1
- package/dist/commands/open.d.ts +0 -16
- package/dist/commands/open.d.ts.map +0 -1
- package/dist/commands/open.js +0 -34
- package/dist/commands/open.js.map +0 -1
- package/dist/commands/ports.d.ts +0 -75
- package/dist/commands/ports.d.ts.map +0 -1
- package/dist/commands/ports.js +0 -78
- package/dist/commands/ports.js.map +0 -1
- package/dist/commands/profile.d.ts +0 -21
- package/dist/commands/profile.d.ts.map +0 -1
- package/dist/commands/profile.js +0 -93
- package/dist/commands/profile.js.map +0 -1
- package/dist/commands/push.d.ts +0 -18
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -116
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/registry.d.ts +0 -15
- package/dist/commands/registry.d.ts.map +0 -1
- package/dist/commands/registry.js +0 -45
- package/dist/commands/registry.js.map +0 -1
- package/dist/commands/request.d.ts +0 -25
- package/dist/commands/request.d.ts.map +0 -1
- package/dist/commands/request.js +0 -58
- package/dist/commands/request.js.map +0 -1
- package/dist/commands/resume.d.ts +0 -22
- package/dist/commands/resume.d.ts.map +0 -1
- package/dist/commands/resume.js +0 -69
- package/dist/commands/resume.js.map +0 -1
- package/dist/commands/save.d.ts +0 -34
- package/dist/commands/save.d.ts.map +0 -1
- package/dist/commands/save.js +0 -141
- package/dist/commands/save.js.map +0 -1
- package/dist/commands/session.d.ts +0 -9
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -282
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/skills/markdown-loader.d.ts +0 -19
- package/dist/commands/skills/markdown-loader.d.ts.map +0 -1
- package/dist/commands/skills/markdown-loader.js +0 -108
- package/dist/commands/skills/markdown-loader.js.map +0 -1
- package/dist/commands/skills/registry.d.ts +0 -23
- package/dist/commands/skills/registry.d.ts.map +0 -1
- package/dist/commands/skills/registry.js +0 -45
- package/dist/commands/skills/registry.js.map +0 -1
- package/dist/commands/terminal.d.ts +0 -19
- package/dist/commands/terminal.d.ts.map +0 -1
- package/dist/commands/terminal.js +0 -39
- package/dist/commands/terminal.js.map +0 -1
- package/dist/commands/tree.d.ts +0 -16
- package/dist/commands/tree.d.ts.map +0 -1
- package/dist/commands/tree.js +0 -44
- package/dist/commands/tree.js.map +0 -1
- package/dist/commands/undo.d.ts +0 -18
- package/dist/commands/undo.d.ts.map +0 -1
- package/dist/commands/undo.js +0 -46
- package/dist/commands/undo.js.map +0 -1
- package/dist/config/config-store.d.ts +0 -19
- package/dist/config/config-store.d.ts.map +0 -1
- package/dist/config/config-store.js +0 -199
- package/dist/config/config-store.js.map +0 -1
- package/dist/config/defaults.d.ts +0 -22
- package/dist/config/defaults.d.ts.map +0 -1
- package/dist/config/defaults.js +0 -38
- package/dist/config/defaults.js.map +0 -1
- package/dist/config/ports.d.ts +0 -60
- package/dist/config/ports.d.ts.map +0 -1
- package/dist/config/ports.js +0 -8
- package/dist/config/ports.js.map +0 -1
- package/dist/config/profile-constants.d.ts +0 -4
- package/dist/config/profile-constants.d.ts.map +0 -1
- package/dist/config/profile-constants.js +0 -10
- package/dist/config/profile-constants.js.map +0 -1
- package/dist/config/profile.d.ts +0 -84
- package/dist/config/profile.d.ts.map +0 -1
- package/dist/config/profile.js +0 -66
- package/dist/config/profile.js.map +0 -1
- package/dist/contract/index.d.ts +0 -193
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/contract/index.js +0 -14
- package/dist/contract/index.js.map +0 -1
- package/dist/core/app.d.ts +0 -35
- package/dist/core/app.d.ts.map +0 -1
- package/dist/core/app.js +0 -86
- package/dist/core/app.js.map +0 -1
- package/dist/core/command-router.d.ts +0 -29
- package/dist/core/command-router.d.ts.map +0 -1
- package/dist/core/command-router.js +0 -61
- package/dist/core/command-router.js.map +0 -1
- package/dist/core/errors.d.ts +0 -39
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -106
- package/dist/core/errors.js.map +0 -1
- package/dist/core/preflight.d.ts +0 -16
- package/dist/core/preflight.d.ts.map +0 -1
- package/dist/core/preflight.js +0 -38
- package/dist/core/preflight.js.map +0 -1
- package/dist/core/repl.d.ts +0 -18
- package/dist/core/repl.d.ts.map +0 -1
- package/dist/core/repl.js +0 -128
- package/dist/core/repl.js.map +0 -1
- package/dist/di/container.d.ts +0 -13
- package/dist/di/container.d.ts.map +0 -1
- package/dist/di/container.js +0 -160
- package/dist/di/container.js.map +0 -1
- package/dist/di/tokens.d.ts +0 -20
- package/dist/di/tokens.d.ts.map +0 -1
- package/dist/di/tokens.js +0 -22
- package/dist/di/tokens.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/render/ink-renderer.d.ts +0 -28
- package/dist/render/ink-renderer.d.ts.map +0 -1
- package/dist/render/ink-renderer.js +0 -174
- package/dist/render/ink-renderer.js.map +0 -1
- package/dist/render/plain-renderer.d.ts +0 -16
- package/dist/render/plain-renderer.d.ts.map +0 -1
- package/dist/render/plain-renderer.js +0 -38
- package/dist/render/plain-renderer.js.map +0 -1
- package/dist/render/ports.d.ts +0 -12
- package/dist/render/ports.d.ts.map +0 -1
- package/dist/render/ports.js +0 -10
- package/dist/render/ports.js.map +0 -1
- package/dist/render/raw-renderer.d.ts +0 -11
- package/dist/render/raw-renderer.d.ts.map +0 -1
- package/dist/render/raw-renderer.js +0 -68
- package/dist/render/raw-renderer.js.map +0 -1
- package/dist/render/repl-input.d.ts +0 -15
- package/dist/render/repl-input.d.ts.map +0 -1
- package/dist/render/repl-input.js +0 -102
- package/dist/render/repl-input.js.map +0 -1
- package/dist/session/file-session-store.d.ts +0 -26
- package/dist/session/file-session-store.d.ts.map +0 -1
- package/dist/session/file-session-store.js +0 -174
- package/dist/session/file-session-store.js.map +0 -1
- package/dist/session/ports.d.ts +0 -50
- package/dist/session/ports.d.ts.map +0 -1
- package/dist/session/ports.js +0 -6
- package/dist/session/ports.js.map +0 -1
- package/dist/sync/git-sync.d.ts +0 -16
- package/dist/sync/git-sync.d.ts.map +0 -1
- package/dist/sync/git-sync.js +0 -28
- package/dist/sync/git-sync.js.map +0 -1
- package/dist/sync/git.d.ts +0 -12
- package/dist/sync/git.d.ts.map +0 -1
- package/dist/sync/git.js +0 -100
- package/dist/sync/git.js.map +0 -1
- package/dist/sync/reconciler.d.ts +0 -36
- package/dist/sync/reconciler.d.ts.map +0 -1
- package/dist/sync/reconciler.js +0 -143
- package/dist/sync/reconciler.js.map +0 -1
- package/dist/sync/walk.d.ts +0 -23
- package/dist/sync/walk.d.ts.map +0 -1
- package/dist/sync/walk.js +0 -81
- package/dist/sync/walk.js.map +0 -1
- package/dist/sync/watch.d.ts +0 -13
- package/dist/sync/watch.d.ts.map +0 -1
- package/dist/sync/watch.js +0 -75
- package/dist/sync/watch.js.map +0 -1
- package/dist/tools/git-diff.d.ts +0 -16
- package/dist/tools/git-diff.d.ts.map +0 -1
- package/dist/tools/git-diff.js +0 -25
- package/dist/tools/git-diff.js.map +0 -1
- package/dist/tools/http-request.d.ts +0 -25
- package/dist/tools/http-request.d.ts.map +0 -1
- package/dist/tools/http-request.js +0 -41
- package/dist/tools/http-request.js.map +0 -1
- package/dist/tools/index.d.ts +0 -7
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -22
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/ports.d.ts +0 -58
- package/dist/tools/ports.d.ts.map +0 -1
- package/dist/tools/ports.js +0 -17
- package/dist/tools/ports.js.map +0 -1
- package/dist/tools/read-file.d.ts +0 -16
- package/dist/tools/read-file.d.ts.map +0 -1
- package/dist/tools/read-file.js +0 -24
- package/dist/tools/read-file.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -10
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js +0 -28
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/run-command.d.ts +0 -20
- package/dist/tools/run-command.d.ts.map +0 -1
- package/dist/tools/run-command.js +0 -65
- package/dist/tools/run-command.js.map +0 -1
- package/dist/tools/write-file.d.ts +0 -24
- package/dist/tools/write-file.d.ts.map +0 -1
- package/dist/tools/write-file.js +0 -60
- package/dist/tools/write-file.js.map +0 -1
- package/dist/transport/composite-transport.d.ts +0 -30
- package/dist/transport/composite-transport.d.ts.map +0 -1
- package/dist/transport/composite-transport.js +0 -71
- package/dist/transport/composite-transport.js.map +0 -1
- package/dist/transport/device-browser.d.ts +0 -19
- package/dist/transport/device-browser.d.ts.map +0 -1
- package/dist/transport/device-browser.js +0 -243
- package/dist/transport/device-browser.js.map +0 -1
- package/dist/transport/device-git.d.ts +0 -14
- package/dist/transport/device-git.d.ts.map +0 -1
- package/dist/transport/device-git.js +0 -107
- package/dist/transport/device-git.js.map +0 -1
- package/dist/transport/device-http.d.ts +0 -10
- package/dist/transport/device-http.d.ts.map +0 -1
- package/dist/transport/device-http.js +0 -96
- package/dist/transport/device-http.js.map +0 -1
- package/dist/transport/device-terminal.d.ts +0 -44
- package/dist/transport/device-terminal.d.ts.map +0 -1
- package/dist/transport/device-terminal.js +0 -140
- package/dist/transport/device-terminal.js.map +0 -1
- package/dist/transport/http-transport.d.ts +0 -26
- package/dist/transport/http-transport.d.ts.map +0 -1
- package/dist/transport/http-transport.js +0 -125
- package/dist/transport/http-transport.js.map +0 -1
- package/dist/transport/ports.d.ts +0 -67
- package/dist/transport/ports.d.ts.map +0 -1
- package/dist/transport/ports.js +0 -11
- package/dist/transport/ports.js.map +0 -1
- package/dist/transport/reconnect.d.ts +0 -44
- package/dist/transport/reconnect.d.ts.map +0 -1
- package/dist/transport/reconnect.js +0 -69
- package/dist/transport/reconnect.js.map +0 -1
- package/dist/transport/terminal-transport.d.ts +0 -28
- package/dist/transport/terminal-transport.d.ts.map +0 -1
- package/dist/transport/terminal-transport.js +0 -63
- package/dist/transport/terminal-transport.js.map +0 -1
- package/dist/transport/ws-stream-transport.d.ts +0 -66
- package/dist/transport/ws-stream-transport.d.ts.map +0 -1
- package/dist/transport/ws-stream-transport.js +0 -246
- package/dist/transport/ws-stream-transport.js.map +0 -1
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// src/render/ink-renderer.tsx — interactive REPL renderer (React/Ink).
|
|
3
|
-
//
|
|
4
|
-
// SRP: render streaming agent output, approval prompts, diff views, and errors in a TTY. It
|
|
5
|
-
// implements the `Renderer` port and keeps a small in-memory transcript of rendered lines.
|
|
6
|
-
//
|
|
7
|
-
// IMPORTANT: this is for prose/UI only. Raw PTY bytes must NEVER be routed here — that is the
|
|
8
|
-
// RawRenderer's job (cli.md §13). The two are deliberately separate concretes.
|
|
9
|
-
import { useEffect, useState } from "react";
|
|
10
|
-
import { Box, Static, Text, render, useApp, useInput } from "ink";
|
|
11
|
-
import { ReplInput } from "./repl-input.js";
|
|
12
|
-
class RenderStore {
|
|
13
|
-
lines = [];
|
|
14
|
-
listeners = new Set();
|
|
15
|
-
/** Live (non-Static) streaming buffer for the current in-progress chunk run. */
|
|
16
|
-
live = "";
|
|
17
|
-
subscribe(fn) {
|
|
18
|
-
this.listeners.add(fn);
|
|
19
|
-
return () => this.listeners.delete(fn);
|
|
20
|
-
}
|
|
21
|
-
snapshot() {
|
|
22
|
-
return this.lines;
|
|
23
|
-
}
|
|
24
|
-
emit() {
|
|
25
|
-
for (const fn of this.listeners)
|
|
26
|
-
fn();
|
|
27
|
-
}
|
|
28
|
-
pushText(text) {
|
|
29
|
-
this.live += text;
|
|
30
|
-
// Flush complete lines into Static history; keep the trailing partial line live.
|
|
31
|
-
const nl = this.live.lastIndexOf("\n");
|
|
32
|
-
if (nl >= 0) {
|
|
33
|
-
const complete = this.live.slice(0, nl);
|
|
34
|
-
this.live = this.live.slice(nl + 1);
|
|
35
|
-
for (const t of complete.split("\n"))
|
|
36
|
-
this.lines = [...this.lines, { kind: "text", text: t }];
|
|
37
|
-
}
|
|
38
|
-
this.emit();
|
|
39
|
-
}
|
|
40
|
-
pushError(message, hint) {
|
|
41
|
-
this.lines = [...this.lines, { kind: "error", message, hint }];
|
|
42
|
-
this.emit();
|
|
43
|
-
}
|
|
44
|
-
pushDiff(path, ranges) {
|
|
45
|
-
this.lines = [...this.lines, { kind: "diff", path, ranges }];
|
|
46
|
-
this.emit();
|
|
47
|
-
}
|
|
48
|
-
clear() {
|
|
49
|
-
this.lines = [];
|
|
50
|
-
this.live = "";
|
|
51
|
-
this.emit();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// ── Components ────────────────────────────────────────────────────────────────
|
|
55
|
-
function useStore(store) {
|
|
56
|
-
const [, setTick] = useState(0);
|
|
57
|
-
useEffect(() => store.subscribe(() => setTick((t) => t + 1)), [store]);
|
|
58
|
-
return store.snapshot();
|
|
59
|
-
}
|
|
60
|
-
function diffColor(t) {
|
|
61
|
-
return t === "added" ? "green" : t === "removed" ? "red" : "yellow";
|
|
62
|
-
}
|
|
63
|
-
function LineView({ line }) {
|
|
64
|
-
if (line.kind === "text")
|
|
65
|
-
return _jsx(Text, { children: line.text });
|
|
66
|
-
if (line.kind === "error") {
|
|
67
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: "red", children: ["error: ", line.message] }), line.hint ? _jsxs(Text, { color: "gray", children: ["hint: ", line.hint] }) : null] }));
|
|
68
|
-
}
|
|
69
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { bold: true, children: ["diff ", line.path] }), line.ranges.map((r, i) => (_jsxs(Text, { color: diffColor(r.type), children: [r.type === "added" ? "+" : r.type === "removed" ? "-" : "~", " ", r.type, " L", r.start, "-", r.end] }, i)))] }));
|
|
70
|
-
}
|
|
71
|
-
function Transcript({ store }) {
|
|
72
|
-
const lines = useStore(store);
|
|
73
|
-
return (_jsx(Static, { items: lines, children: (line, i) => _jsx(LineView, { line: line }, i) }));
|
|
74
|
-
}
|
|
75
|
-
/** A blocking single-select prompt; resolves `onChoose` with the selected value. */
|
|
76
|
-
function Prompt(props) {
|
|
77
|
-
const [index, setIndex] = useState(0);
|
|
78
|
-
useInput((input, key) => {
|
|
79
|
-
if (key.leftArrow || input === "k" || key.upArrow)
|
|
80
|
-
setIndex((i) => (i + props.choices.length - 1) % props.choices.length);
|
|
81
|
-
else if (key.rightArrow || input === "j" || key.downArrow)
|
|
82
|
-
setIndex((i) => (i + 1) % props.choices.length);
|
|
83
|
-
else if (key.return)
|
|
84
|
-
props.onChoose(props.choices[index]);
|
|
85
|
-
else {
|
|
86
|
-
const direct = props.choices.findIndex((c) => c[0]?.toLowerCase() === input.toLowerCase());
|
|
87
|
-
if (direct >= 0)
|
|
88
|
-
props.onChoose(props.choices[direct]);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: props.question }), _jsx(Box, { children: props.choices.map((c, i) => (_jsxs(Text, { color: i === index ? "cyan" : undefined, inverse: i === index, children: [" ", c, " "] }, c))) })] }));
|
|
92
|
-
}
|
|
93
|
-
// ── The Renderer concrete ─────────────────────────────────────────────────────
|
|
94
|
-
export class InkRenderer {
|
|
95
|
-
store = new RenderStore();
|
|
96
|
-
instance;
|
|
97
|
-
/** A pending prompt resolver; only one prompt is shown at a time. */
|
|
98
|
-
pendingPrompt;
|
|
99
|
-
/** The interactive REPL input slot (set by the Repl controller); rendered at the bottom of Root. */
|
|
100
|
-
replSlot;
|
|
101
|
-
mount() {
|
|
102
|
-
if (this.instance)
|
|
103
|
-
return;
|
|
104
|
-
this.instance = render(_jsx(Root, { renderer: this, store: this.store }), { exitOnCtrlC: false });
|
|
105
|
-
}
|
|
106
|
-
/** Mount (if needed) and show the REPL input. Re-call to update `busy`/handlers. */
|
|
107
|
-
setRepl(slot) {
|
|
108
|
-
this.replSlot = slot;
|
|
109
|
-
this.mount();
|
|
110
|
-
this.refresh();
|
|
111
|
-
}
|
|
112
|
-
get currentRepl() {
|
|
113
|
-
return this.replSlot;
|
|
114
|
-
}
|
|
115
|
-
/** Reset the transcript (the `/clear` REPL verb). */
|
|
116
|
-
clear() {
|
|
117
|
-
this.store.clear();
|
|
118
|
-
this.refresh();
|
|
119
|
-
}
|
|
120
|
-
stream(chunk) {
|
|
121
|
-
this.mount();
|
|
122
|
-
this.store.pushText(chunk);
|
|
123
|
-
}
|
|
124
|
-
error(message, hint) {
|
|
125
|
-
this.mount();
|
|
126
|
-
this.store.pushError(message, hint);
|
|
127
|
-
}
|
|
128
|
-
diff(ranges, path) {
|
|
129
|
-
this.mount();
|
|
130
|
-
this.store.pushDiff(path, ranges);
|
|
131
|
-
}
|
|
132
|
-
prompt(question, choices) {
|
|
133
|
-
this.mount();
|
|
134
|
-
return new Promise((resolve) => {
|
|
135
|
-
this.pendingPrompt = {
|
|
136
|
-
question,
|
|
137
|
-
choices,
|
|
138
|
-
resolve: (v) => {
|
|
139
|
-
this.pendingPrompt = undefined;
|
|
140
|
-
this.refresh();
|
|
141
|
-
resolve(v);
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
this.refresh();
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/** Internal: re-render the root (Root reads `currentPrompt`). */
|
|
148
|
-
refresh() {
|
|
149
|
-
this.instance?.rerender(_jsx(Root, { renderer: this, store: this.store }));
|
|
150
|
-
}
|
|
151
|
-
/** Exposed to Root so it can render the active prompt. */
|
|
152
|
-
get currentPrompt() {
|
|
153
|
-
return this.pendingPrompt;
|
|
154
|
-
}
|
|
155
|
-
/** Tear down the Ink app (called on REPL exit). */
|
|
156
|
-
async dispose() {
|
|
157
|
-
this.instance?.unmount();
|
|
158
|
-
await this.instance?.waitUntilExit().catch(() => undefined);
|
|
159
|
-
this.instance = undefined;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function Root({ renderer, store }) {
|
|
163
|
-
const { exit } = useApp();
|
|
164
|
-
const prompt = renderer.currentPrompt;
|
|
165
|
-
const repl = renderer.currentRepl;
|
|
166
|
-
useEffect(() => () => exit(), [exit]);
|
|
167
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Transcript, { store: store }), _jsx(LiveLine, { store: store }), prompt ? (_jsx(Prompt, { question: prompt.question, choices: prompt.choices, onChoose: prompt.resolve })) : repl ? (_jsx(ReplInput, { commands: repl.commands, busy: repl.busy, onSubmit: repl.onSubmit, onExit: repl.onExit })) : null] }));
|
|
168
|
-
}
|
|
169
|
-
/** The trailing partial line currently being streamed (outside the Static history). */
|
|
170
|
-
function LiveLine({ store }) {
|
|
171
|
-
useStore(store);
|
|
172
|
-
return store.live ? _jsx(Text, { children: store.live }) : null;
|
|
173
|
-
}
|
|
174
|
-
//# sourceMappingURL=ink-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ink-renderer.js","sourceRoot":"","sources":["../../src/render/ink-renderer.tsx"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,EAAE;AACF,4FAA4F;AAC5F,2FAA2F;AAC3F,EAAE;AACF,8FAA8F;AAC9F,+EAA+E;AAE/E,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAiB,MAAM,KAAK,CAAC;AAIjF,OAAO,EAAE,SAAS,EAAuB,MAAM,iBAAiB,CAAC;AASjE,MAAM,WAAW;IACP,KAAK,GAAW,EAAE,CAAC;IACnB,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IAC1C,gFAAgF;IAChF,IAAI,GAAG,EAAE,CAAC;IAEV,SAAS,CAAC,EAAc;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACO,IAAI;QACV,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,SAAS;YAAE,EAAE,EAAE,CAAC;IACxC,CAAC;IACD,QAAQ,CAAC,IAAY;QACnB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;QAClB,iFAAiF;QACjF,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;YACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAA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;AACJ,CAAC;AAED,uFAAuF;AACvF,SAAS,QAAQ,CAAC,EAAE,KAAK,EAA0B;IACjD,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,cAAE,KAAK,CAAC,IAAI,GAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { DiffRange } from "../contract/index.js";
|
|
2
|
-
import type { Renderer } from "./ports.js";
|
|
3
|
-
export declare class PlainRenderer implements Renderer {
|
|
4
|
-
private readonly out;
|
|
5
|
-
private readonly err;
|
|
6
|
-
/** What `prompt` resolves to without a TTY (defaults to the first choice). */
|
|
7
|
-
private readonly defaultChoice?;
|
|
8
|
-
constructor(out?: NodeJS.WritableStream, err?: NodeJS.WritableStream,
|
|
9
|
-
/** What `prompt` resolves to without a TTY (defaults to the first choice). */
|
|
10
|
-
defaultChoice?: string | undefined);
|
|
11
|
-
stream(chunk: string): void;
|
|
12
|
-
prompt(_question: string, choices: readonly string[]): Promise<string>;
|
|
13
|
-
diff(ranges: readonly DiffRange[], path: string): void;
|
|
14
|
-
error(message: string, hint?: string): void;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=plain-renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plain-renderer.d.ts","sourceRoot":"","sources":["../../src/render/plain-renderer.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,qBAAa,aAAc,YAAW,QAAQ;IAE1C,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,8EAA8E;IAC9E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;gBAHd,GAAG,GAAE,MAAM,CAAC,cAA+B,EAC3C,GAAG,GAAE,MAAM,CAAC,cAA+B;IAC5D,8EAA8E;IAC7D,aAAa,CAAC,EAAE,MAAM,YAAA;IAGzC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI3B,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAKtE,IAAI,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQtD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;CAI5C"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// src/render/plain-renderer.ts — non-TTY / pipe / --print renderer (no ANSI).
|
|
2
|
-
//
|
|
3
|
-
// SRP: deterministic, ANSI-free output for CI and piping. `prompt` is non-interactive: it
|
|
4
|
-
// resolves to a configurable default (the first choice) since there is no TTY to ask. This
|
|
5
|
-
// keeps scripted runs from hanging on an approval prompt — pair with an auto-allow/deny
|
|
6
|
-
// PermissionPolicy when running headless.
|
|
7
|
-
export class PlainRenderer {
|
|
8
|
-
out;
|
|
9
|
-
err;
|
|
10
|
-
defaultChoice;
|
|
11
|
-
constructor(out = process.stdout, err = process.stderr,
|
|
12
|
-
/** What `prompt` resolves to without a TTY (defaults to the first choice). */
|
|
13
|
-
defaultChoice) {
|
|
14
|
-
this.out = out;
|
|
15
|
-
this.err = err;
|
|
16
|
-
this.defaultChoice = defaultChoice;
|
|
17
|
-
}
|
|
18
|
-
stream(chunk) {
|
|
19
|
-
this.out.write(chunk);
|
|
20
|
-
}
|
|
21
|
-
prompt(_question, choices) {
|
|
22
|
-
// No interactivity in a pipe: pick the configured default or the first choice.
|
|
23
|
-
return Promise.resolve(this.defaultChoice ?? choices[0] ?? "");
|
|
24
|
-
}
|
|
25
|
-
diff(ranges, path) {
|
|
26
|
-
this.out.write(`diff ${path}\n`);
|
|
27
|
-
for (const r of ranges) {
|
|
28
|
-
const sign = r.type === "added" ? "+" : r.type === "removed" ? "-" : "~";
|
|
29
|
-
this.out.write(`${sign} ${r.type} L${r.start}-${r.end}\n`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
error(message, hint) {
|
|
33
|
-
this.err.write(`error: ${message}\n`);
|
|
34
|
-
if (hint)
|
|
35
|
-
this.err.write(`hint: ${hint}\n`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=plain-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plain-renderer.js","sourceRoot":"","sources":["../../src/render/plain-renderer.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,0FAA0F;AAC1F,2FAA2F;AAC3F,wFAAwF;AACxF,0CAA0C;AAK1C,MAAM,OAAO,aAAa;IAEL;IACA;IAEA;IAJnB,YACmB,MAA6B,OAAO,CAAC,MAAM,EAC3C,MAA6B,OAAO,CAAC,MAAM;IAC5D,8EAA8E;IAC7D,aAAsB;QAHtB,QAAG,GAAH,GAAG,CAAwC;QAC3C,QAAG,GAAH,GAAG,CAAwC;QAE3C,kBAAa,GAAb,aAAa,CAAS;IACtC,CAAC;IAEJ,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,SAAiB,EAAE,OAA0B;QAClD,+EAA+E;QAC/E,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,CAAC,MAA4B,EAAE,IAAY;QAC7C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC;QACjC,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACzE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,IAAa;QAClC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,OAAO,IAAI,CAAC,CAAC;QACtC,IAAI,IAAI;YAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/dist/render/ports.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DiffRange } from "../contract/index.js";
|
|
2
|
-
export interface Renderer {
|
|
3
|
-
/** Emit a chunk of output (agent prose, command results). No trailing newline added. */
|
|
4
|
-
stream(chunk: string): void;
|
|
5
|
-
/** Ask the user to choose among `choices`; resolves with the chosen value. */
|
|
6
|
-
prompt(question: string, choices: readonly string[]): Promise<string>;
|
|
7
|
-
/** Render git diff ranges for a file (added/modified/removed spans). */
|
|
8
|
-
diff(ranges: readonly DiffRange[], path: string): void;
|
|
9
|
-
/** Report an error with an optional one-line remediation hint. */
|
|
10
|
-
error(message: string, hint?: string): void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/render/ports.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,QAAQ;IACvB,wFAAwF;IACxF,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtE,wEAAwE;IACxE,IAAI,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACvD,kEAAkE;IAClE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C"}
|
package/dist/render/ports.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// src/render/ports.ts — Renderer port (cli.md §4/§13).
|
|
2
|
-
//
|
|
3
|
-
// Three concretes implement this behind the port, selected by context at the DI root:
|
|
4
|
-
// InkRenderer — interactive REPL TUI (React/Ink)
|
|
5
|
-
// PlainRenderer — non-TTY / pipe / --print (no ANSI)
|
|
6
|
-
// (RawRenderer is NOT a Renderer — raw PTY passthrough is kept strictly separate.)
|
|
7
|
-
//
|
|
8
|
-
// DIP: commands/tools/agent-loop depend on `Renderer`, never on a TTY library directly.
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=ports.js.map
|
package/dist/render/ports.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/render/ports.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,sFAAsF;AACtF,qDAAqD;AACrD,uDAAuD;AACvD,qFAAqF;AACrF,EAAE;AACF,wFAAwF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TerminalPort } from "../transport/ports.js";
|
|
2
|
-
export declare class RawRenderer {
|
|
3
|
-
private readonly stdin;
|
|
4
|
-
private readonly stdout;
|
|
5
|
-
/**
|
|
6
|
-
* Bridge the local terminal to the host PTY. Resolves with the PTY exit code once it exits
|
|
7
|
-
* (or -1 on abort). The caller is responsible for having already called `terminal.create`.
|
|
8
|
-
*/
|
|
9
|
-
attach(terminal: TerminalPort, signal: AbortSignal): Promise<number>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=raw-renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw-renderer.d.ts","sourceRoot":"","sources":["../../src/render/raw-renderer.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAC;AAEvE,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;CAsDrE"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// src/render/raw-renderer.ts — raw PTY passthrough. NEVER goes through Ink (cli.md §13).
|
|
2
|
-
//
|
|
3
|
-
// CRITICAL SEPARATION: the raw PTY byte stream must not flow through the React/Ink render
|
|
4
|
-
// tree, or interactive TUIs (vim, htop) and xterm control sequences corrupt. This class is
|
|
5
|
-
// deliberately NOT a `Renderer`; it is a standalone bridge between the local terminal and a
|
|
6
|
-
// host PTY exposed via `TerminalPort`.
|
|
7
|
-
//
|
|
8
|
-
// On attach it: enters raw mode, pipes stdin → terminal:input, terminal:data → stdout,
|
|
9
|
-
// sends terminal:resize on SIGWINCH, and restores cooked mode on terminal:exit (or abort).
|
|
10
|
-
export class RawRenderer {
|
|
11
|
-
stdin = process.stdin;
|
|
12
|
-
stdout = process.stdout;
|
|
13
|
-
/**
|
|
14
|
-
* Bridge the local terminal to the host PTY. Resolves with the PTY exit code once it exits
|
|
15
|
-
* (or -1 on abort). The caller is responsible for having already called `terminal.create`.
|
|
16
|
-
*/
|
|
17
|
-
attach(terminal, signal) {
|
|
18
|
-
return new Promise((resolve) => {
|
|
19
|
-
let settled = false;
|
|
20
|
-
const subs = [];
|
|
21
|
-
const wasRaw = this.stdin.isRaw ?? false;
|
|
22
|
-
const enterRaw = () => {
|
|
23
|
-
if (this.stdin.isTTY)
|
|
24
|
-
this.stdin.setRawMode?.(true);
|
|
25
|
-
this.stdin.resume();
|
|
26
|
-
this.stdin.setEncoding("utf8");
|
|
27
|
-
};
|
|
28
|
-
const restore = () => {
|
|
29
|
-
if (this.stdin.isTTY)
|
|
30
|
-
this.stdin.setRawMode?.(wasRaw);
|
|
31
|
-
this.stdin.pause();
|
|
32
|
-
this.stdin.off("data", onStdin);
|
|
33
|
-
process.off("SIGWINCH", onResize);
|
|
34
|
-
for (const off of subs)
|
|
35
|
-
off();
|
|
36
|
-
signal.removeEventListener("abort", onAbort);
|
|
37
|
-
};
|
|
38
|
-
// stdin → host PTY.
|
|
39
|
-
const onStdin = (data) => {
|
|
40
|
-
terminal.input(typeof data === "string" ? data : data.toString("utf8"));
|
|
41
|
-
};
|
|
42
|
-
// local viewport change → host PTY resize.
|
|
43
|
-
const onResize = () => {
|
|
44
|
-
const cols = this.stdout.columns || 80;
|
|
45
|
-
const rows = this.stdout.rows || 24;
|
|
46
|
-
terminal.resize(cols, rows);
|
|
47
|
-
};
|
|
48
|
-
const onAbort = () => finish(-1);
|
|
49
|
-
const finish = (code) => {
|
|
50
|
-
if (settled)
|
|
51
|
-
return;
|
|
52
|
-
settled = true;
|
|
53
|
-
restore();
|
|
54
|
-
resolve(code);
|
|
55
|
-
};
|
|
56
|
-
// host PTY → stdout (raw bytes, sequences preserved).
|
|
57
|
-
subs.push(terminal.onData((chunk) => this.stdout.write(chunk)));
|
|
58
|
-
subs.push(terminal.onExit((code) => finish(code)));
|
|
59
|
-
enterRaw();
|
|
60
|
-
this.stdin.on("data", onStdin);
|
|
61
|
-
process.on("SIGWINCH", onResize);
|
|
62
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
63
|
-
// Push the current size immediately so the PTY matches the local viewport.
|
|
64
|
-
onResize();
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=raw-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw-renderer.js","sourceRoot":"","sources":["../../src/render/raw-renderer.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,EAAE;AACF,0FAA0F;AAC1F,2FAA2F;AAC3F,4FAA4F;AAC5F,uCAAuC;AACvC,EAAE;AACF,uFAAuF;AACvF,2FAA2F;AAI3F,MAAM,OAAO,WAAW;IACL,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IACtB,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAEzC;;;OAGG;IACH,MAAM,CAAC,QAAsB,EAAE,MAAmB;QAChD,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,OAAO,GAAG,KAAK,CAAC;YACpB,MAAM,IAAI,GAAkB,EAAE,CAAC;YAE/B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;YACzC,MAAM,QAAQ,GAAG,GAAG,EAAE;gBACpB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;oBAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC;gBACpD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBACpB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACjC,CAAC,CAAC;YACF,MAAM,OAAO,GAAG,GAAG,EAAE;gBACnB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;oBAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;gBACtD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBACnB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,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAEnD,QAAQ,EAAE,CAAC;YACX,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC/B,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACjC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAE1D,2EAA2E;YAC3E,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
/** The metadata each suggestion needs (a subset of the registry's RoutableCommand). */
|
|
3
|
-
export interface ReplCommandMeta {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly summary: string;
|
|
6
|
-
}
|
|
7
|
-
export interface ReplInputProps {
|
|
8
|
-
readonly commands: readonly ReplCommandMeta[];
|
|
9
|
-
/** True while a command is running — the menu hides and Enter is ignored (one command at a time). */
|
|
10
|
-
readonly busy: boolean;
|
|
11
|
-
readonly onSubmit: (line: string) => void;
|
|
12
|
-
readonly onExit: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare function ReplInput(props: ReplInputProps): React.ReactElement;
|
|
15
|
-
//# sourceMappingURL=repl-input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repl-input.d.ts","sourceRoot":"","sources":["../../src/render/repl-input.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,qGAAqG;IACrG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;CAC7B;AAYD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,CAAC,YAAY,CAiGnE"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// src/render/repl-input.tsx — the interactive REPL prompt: a free-text input with a Claude-style slash
|
|
3
|
-
// command menu. Built directly on Ink's `useInput` (no extra dep). It owns only INPUT; command output
|
|
4
|
-
// flows through the InkRenderer transcript that sits above it (ink-renderer.tsx Root).
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import { Box, Text, useInput } from "ink";
|
|
7
|
-
const MAX_SUGGESTIONS = 8;
|
|
8
|
-
function filterCommands(commands, value) {
|
|
9
|
-
const p = value.replace(/^\//, "").toLowerCase();
|
|
10
|
-
return commands
|
|
11
|
-
.filter((c) => c.name.startsWith(p))
|
|
12
|
-
.sort((a, b) => a.name.localeCompare(b.name))
|
|
13
|
-
.slice(0, MAX_SUGGESTIONS);
|
|
14
|
-
}
|
|
15
|
-
export function ReplInput(props) {
|
|
16
|
-
const [value, setValue] = useState("");
|
|
17
|
-
const [sel, setSel] = useState(0);
|
|
18
|
-
const [dismissed, setDismissed] = useState(false);
|
|
19
|
-
const [history, setHistory] = useState([]);
|
|
20
|
-
const [histIdx, setHistIdx] = useState(-1); // -1 = editing a fresh line
|
|
21
|
-
const showMenu = value.startsWith("/") && !value.includes(" ") && !dismissed;
|
|
22
|
-
const matches = showMenu ? filterCommands(props.commands, value) : [];
|
|
23
|
-
const selClamped = matches.length ? Math.min(sel, matches.length - 1) : 0;
|
|
24
|
-
const submit = (line) => {
|
|
25
|
-
const trimmed = line.trim();
|
|
26
|
-
if (trimmed)
|
|
27
|
-
setHistory((h) => [...h, trimmed]);
|
|
28
|
-
setValue("");
|
|
29
|
-
setSel(0);
|
|
30
|
-
setDismissed(false);
|
|
31
|
-
setHistIdx(-1);
|
|
32
|
-
props.onSubmit(line);
|
|
33
|
-
};
|
|
34
|
-
useInput((input, key) => {
|
|
35
|
-
// Ctrl-C always exits; Ctrl-D on an empty line exits.
|
|
36
|
-
if (key.ctrl && input === "c")
|
|
37
|
-
return props.onExit();
|
|
38
|
-
if (key.ctrl && input === "d" && value === "")
|
|
39
|
-
return props.onExit();
|
|
40
|
-
if (props.busy)
|
|
41
|
-
return; // swallow edits while a command runs
|
|
42
|
-
if (key.return) {
|
|
43
|
-
const picked = matches[selClamped];
|
|
44
|
-
if (showMenu && picked)
|
|
45
|
-
submit("/" + picked.name);
|
|
46
|
-
else
|
|
47
|
-
submit(value);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (key.tab) {
|
|
51
|
-
const picked = matches[selClamped];
|
|
52
|
-
if (showMenu && picked) {
|
|
53
|
-
setValue("/" + picked.name + " ");
|
|
54
|
-
setSel(0);
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (key.escape) {
|
|
59
|
-
setDismissed(true);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (key.upArrow) {
|
|
63
|
-
if (showMenu && matches.length)
|
|
64
|
-
setSel((s) => (s - 1 + matches.length) % matches.length);
|
|
65
|
-
else
|
|
66
|
-
navHistory(-1);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (key.downArrow) {
|
|
70
|
-
if (showMenu && matches.length)
|
|
71
|
-
setSel((s) => (s + 1) % matches.length);
|
|
72
|
-
else
|
|
73
|
-
navHistory(1);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (key.backspace || key.delete) {
|
|
77
|
-
setValue((v) => v.slice(0, -1));
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
// Printable input (ignore control/meta chords).
|
|
81
|
-
if (input && !key.ctrl && !key.meta) {
|
|
82
|
-
setValue((v) => v + input);
|
|
83
|
-
setDismissed(false);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
function navHistory(dir) {
|
|
87
|
-
if (!history.length)
|
|
88
|
-
return;
|
|
89
|
-
let idx = histIdx < 0 ? (dir === -1 ? history.length - 1 : -1) : histIdx + dir;
|
|
90
|
-
if (idx >= history.length) {
|
|
91
|
-
setHistIdx(-1);
|
|
92
|
-
setValue("");
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (idx < 0)
|
|
96
|
-
idx = 0;
|
|
97
|
-
setHistIdx(idx);
|
|
98
|
-
setValue(history[idx]);
|
|
99
|
-
}
|
|
100
|
-
return (_jsxs(Box, { flexDirection: "column", children: [showMenu && matches.length ? (_jsx(Box, { flexDirection: "column", children: matches.map((c, i) => (_jsx(Text, { color: i === selClamped ? "cyan" : "gray", inverse: i === selClamped, children: (i === selClamped ? "› " : " ") + "/" + c.name.padEnd(10) + " " + c.summary }, c.name))) })) : null, _jsxs(Box, { children: [_jsx(Text, { color: "green", children: "\u276F " }), _jsx(Text, { children: value }), _jsx(Text, { color: "gray", children: props.busy ? " (running…)" : "▌" })] })] }));
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=repl-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repl-input.js","sourceRoot":"","sources":["../../src/render/repl-input.tsx"],"names":[],"mappings":";AAAA,uGAAuG;AACvG,sGAAsG;AACtG,uFAAuF;AAEvF,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAgB1C,MAAM,eAAe,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C,CAAC,OAAO,IADpE,CAAC,CAAC,IAAI,CAEV,CACR,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,EACR,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,wBAAU,EAC7B,KAAC,IAAI,cAAE,KAAK,GAAQ,EACpB,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,YAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAQ,IACzD,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ConfigStore } from "../config/ports.js";
|
|
2
|
-
import type { HttpPort } from "../transport/ports.js";
|
|
3
|
-
import type { SessionMeta, SessionStore, Transcript, Turn } from "./ports.js";
|
|
4
|
-
export declare class FileSessionStore implements SessionStore {
|
|
5
|
-
private readonly config;
|
|
6
|
-
private readonly http;
|
|
7
|
-
private readonly dir;
|
|
8
|
-
constructor(config: ConfigStore, http: HttpPort);
|
|
9
|
-
list(): Promise<SessionMeta[]>;
|
|
10
|
-
create(meta: Omit<SessionMeta, "updatedAt">): Promise<Transcript>;
|
|
11
|
-
resume(id: string): Promise<Transcript>;
|
|
12
|
-
append(id: string, turn: Turn): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Reconcile local transcripts with the host. The host persists an opaque `sessions[]` array, so we
|
|
15
|
-
* push a compacted view (id/title/updatedAt + turn count summary) and adopt any server sessions we
|
|
16
|
-
* do not have locally as headers (their full transcript is fetched lazily on resume).
|
|
17
|
-
*/
|
|
18
|
-
sync(): Promise<void>;
|
|
19
|
-
private pathFor;
|
|
20
|
-
private ensureDir;
|
|
21
|
-
private subject;
|
|
22
|
-
private readHeader;
|
|
23
|
-
private readTranscript;
|
|
24
|
-
private lastTurnAt;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=file-session-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-session-store.d.ts","sourceRoot":"","sources":["../../src/session/file-session-store.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE9E,qBAAa,gBAAiB,YAAW,YAAY;IAIjD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAGV,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,QAAQ;IAK3B,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAW9B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAcjE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQvC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnD;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqC3B,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,UAAU;CAQnB"}
|