@hasna/terminal 4.3.1 → 4.3.3
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/dist/App.js +404 -0
- package/dist/Browse.js +79 -0
- package/dist/FuzzyPicker.js +47 -0
- package/dist/Onboarding.js +51 -0
- package/dist/Spinner.js +12 -0
- package/dist/StatusBar.js +49 -0
- package/dist/ai.js +316 -0
- package/dist/cache.js +42 -0
- package/dist/cli.js +778 -0
- package/dist/command-rewriter.js +64 -0
- package/dist/command-validator.js +86 -0
- package/dist/compression.js +91 -0
- package/dist/context-hints.js +285 -0
- package/dist/db/pg-migrations.js +70 -0
- package/dist/diff-cache.js +107 -0
- package/dist/discover.js +212 -0
- package/dist/economy.js +155 -0
- package/dist/expand-store.js +44 -0
- package/dist/file-cache.js +72 -0
- package/dist/file-index.js +62 -0
- package/dist/history.js +62 -0
- package/dist/lazy-executor.js +54 -0
- package/dist/line-dedup.js +59 -0
- package/dist/loop-detector.js +75 -0
- package/dist/mcp/install.js +189 -0
- package/dist/mcp/server.js +90 -0
- package/dist/mcp/tools/batch.js +111 -0
- package/dist/mcp/tools/execute.js +194 -0
- package/dist/mcp/tools/files.js +290 -0
- package/dist/mcp/tools/git.js +233 -0
- package/dist/mcp/tools/helpers.js +63 -0
- package/dist/mcp/tools/memory.js +151 -0
- package/dist/mcp/tools/meta.js +138 -0
- package/dist/mcp/tools/process.js +50 -0
- package/dist/mcp/tools/project.js +251 -0
- package/dist/mcp/tools/search.js +86 -0
- package/dist/noise-filter.js +94 -0
- package/dist/output-processor.js +233 -0
- package/dist/output-store.js +112 -0
- package/dist/paths.js +28 -0
- package/dist/providers/anthropic.js +43 -0
- package/dist/providers/base.js +4 -0
- package/dist/providers/cerebras.js +8 -0
- package/dist/providers/groq.js +8 -0
- package/dist/providers/index.js +142 -0
- package/dist/providers/openai-compat.js +93 -0
- package/dist/providers/xai.js +8 -0
- package/dist/recipes/model.js +20 -0
- package/dist/recipes/storage.js +153 -0
- package/dist/search/content-search.js +70 -0
- package/dist/search/file-search.js +61 -0
- package/dist/search/filters.js +34 -0
- package/dist/search/index.js +5 -0
- package/dist/search/semantic.js +346 -0
- package/dist/session-boot.js +59 -0
- package/dist/session-context.js +55 -0
- package/dist/sessions-db.js +240 -0
- package/dist/smart-display.js +286 -0
- package/dist/snapshots.js +51 -0
- package/dist/supervisor.js +112 -0
- package/dist/test-watchlist.js +131 -0
- package/dist/tokens.js +17 -0
- package/dist/tool-profiles.js +130 -0
- package/dist/tree.js +94 -0
- package/dist/usage-cache.js +65 -0
- package/package.json +2 -1
- package/src/Onboarding.tsx +1 -1
- package/src/ai.ts +5 -4
- package/src/cache.ts +2 -2
- package/src/db/pg-migrations.ts +77 -0
- package/src/economy.ts +3 -3
- package/src/history.ts +2 -2
- package/src/mcp/server.ts +55 -0
- package/src/mcp/tools/memory.ts +4 -2
- package/src/output-store.ts +2 -1
- package/src/paths.ts +32 -0
- package/src/recipes/storage.ts +3 -3
- package/src/session-context.ts +2 -2
- package/src/sessions-db.ts +15 -4
- package/src/tool-profiles.ts +4 -3
- package/src/usage-cache.ts +2 -2
package/dist/App.js
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useRef } from "react";
|
|
3
|
+
import { Box, Text, useInput, useApp } from "ink";
|
|
4
|
+
import { spawn } from "child_process";
|
|
5
|
+
import { translateToCommand, explainCommand, fixCommand, checkPermissions, isIrreversible } from "./ai.js";
|
|
6
|
+
import { loadHistory, appendHistory, loadConfig, saveConfig } from "./history.js";
|
|
7
|
+
import { loadCache } from "./cache.js";
|
|
8
|
+
import Onboarding from "./Onboarding.js";
|
|
9
|
+
import StatusBar from "./StatusBar.js";
|
|
10
|
+
import Spinner from "./Spinner.js";
|
|
11
|
+
import Browse from "./Browse.js";
|
|
12
|
+
import FuzzyPicker from "./FuzzyPicker.js";
|
|
13
|
+
import { createSession, logInteraction, updateInteraction } from "./sessions-db.js";
|
|
14
|
+
import { smartDisplay } from "./smart-display.js";
|
|
15
|
+
import { processOutput, shouldProcess } from "./output-processor.js";
|
|
16
|
+
loadCache();
|
|
17
|
+
const MAX_LINES = 20;
|
|
18
|
+
// ── helpers ───────────────────────────────────────────────────────────────────
|
|
19
|
+
function insertAt(s, pos, ch) { return s.slice(0, pos) + ch + s.slice(pos); }
|
|
20
|
+
function deleteAt(s, pos) { return pos <= 0 ? s : s.slice(0, pos - 1) + s.slice(pos); }
|
|
21
|
+
/** Detect if output lines look like file paths */
|
|
22
|
+
function extractFilePaths(lines) {
|
|
23
|
+
return lines.filter(l => /^\.?\//.test(l.trim()) || /\.(ts|tsx|js|json|md|py|sh|go|rs|txt|yaml|yml|env)$/.test(l.trim()));
|
|
24
|
+
}
|
|
25
|
+
/** Ghost text: find the best NL match that starts with the current input */
|
|
26
|
+
function ghostText(input, history) {
|
|
27
|
+
if (!input.trim())
|
|
28
|
+
return "";
|
|
29
|
+
const lower = input.toLowerCase();
|
|
30
|
+
const match = [...history].reverse().find(h => h.toLowerCase().startsWith(lower) && h.length > input.length);
|
|
31
|
+
return match ? match.slice(input.length) : "";
|
|
32
|
+
}
|
|
33
|
+
/** Detect cd and change process cwd */
|
|
34
|
+
function maybeCd(command) {
|
|
35
|
+
const m = command.match(/^\s*cd\s+(.+)\s*$/);
|
|
36
|
+
if (!m)
|
|
37
|
+
return null;
|
|
38
|
+
let target = m[1].trim().replace(/^['"]|['"]$/g, "");
|
|
39
|
+
if (target.startsWith("~"))
|
|
40
|
+
target = target.replace("~", process.env.HOME ?? "");
|
|
41
|
+
return target;
|
|
42
|
+
}
|
|
43
|
+
function newTab(id, cwd) {
|
|
44
|
+
return {
|
|
45
|
+
id, cwd,
|
|
46
|
+
scroll: [], sessionEntries: [], sessionNl: [],
|
|
47
|
+
phase: { type: "input", value: "", cursor: 0, histIdx: -1, raw: false },
|
|
48
|
+
streamLines: [],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function runCommand(command, cwd, onLine, onDone, signal) {
|
|
52
|
+
const proc = spawn("/bin/zsh", ["-c", command], { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
53
|
+
const handle = (d) => d.toString().split("\n").forEach(l => { if (l)
|
|
54
|
+
onLine(l); });
|
|
55
|
+
proc.stdout?.on("data", handle);
|
|
56
|
+
proc.stderr?.on("data", handle);
|
|
57
|
+
proc.on("close", code => onDone(code ?? 0));
|
|
58
|
+
signal.addEventListener("abort", () => { try {
|
|
59
|
+
proc.kill("SIGTERM");
|
|
60
|
+
}
|
|
61
|
+
catch { } });
|
|
62
|
+
}
|
|
63
|
+
// ── App ───────────────────────────────────────────────────────────────────────
|
|
64
|
+
export default function App() {
|
|
65
|
+
const { exit } = useApp();
|
|
66
|
+
const [config, setConfig] = useState(() => loadConfig());
|
|
67
|
+
const [nlHistory] = useState(() => loadHistory().map(h => h.nl).filter(Boolean));
|
|
68
|
+
const [tabs, setTabs] = useState([newTab(1, process.cwd())]);
|
|
69
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
70
|
+
const abortRef = useRef(null);
|
|
71
|
+
let nextTabId = useRef(2);
|
|
72
|
+
const sessionIdRef = useRef("");
|
|
73
|
+
const interactionIdRef = useRef(0);
|
|
74
|
+
const tab = tabs[activeTab];
|
|
75
|
+
const allNl = [...nlHistory, ...tab.sessionNl];
|
|
76
|
+
// ── tab helpers ─────────────────────────────────────────────────────────────
|
|
77
|
+
const updateTab = (updater) => setTabs(ts => ts.map((t, i) => i === activeTab ? updater(t) : t));
|
|
78
|
+
const setPhase = (phase) => updateTab(t => ({ ...t, phase }));
|
|
79
|
+
const setStreamLines = (lines) => updateTab(t => ({ ...t, streamLines: lines }));
|
|
80
|
+
const inputPhase = (overrides = {}) => {
|
|
81
|
+
updateTab(t => ({
|
|
82
|
+
...t,
|
|
83
|
+
streamLines: [],
|
|
84
|
+
phase: { type: "input", value: "", cursor: 0, histIdx: -1, raw: false, ...overrides },
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
const pushScroll = (entry) => updateTab(t => ({ ...t, scroll: [...t.scroll, { ...entry, expanded: false }] }));
|
|
88
|
+
const commitStream = async (nl, cmd, lines, error) => {
|
|
89
|
+
const filePaths = !error ? extractFilePaths(lines) : [];
|
|
90
|
+
// Smart display: first try pattern-based compression, then AI if still large
|
|
91
|
+
let displayLines = !error && lines.length > 5 ? smartDisplay(lines) : lines;
|
|
92
|
+
// AI-powered processing for large outputs (no hardcoded patterns)
|
|
93
|
+
if (!error && shouldProcess(lines.join("\n"))) {
|
|
94
|
+
try {
|
|
95
|
+
const processed = await processOutput(cmd, lines.join("\n"));
|
|
96
|
+
if (processed.aiProcessed && processed.tokensSaved > 50) {
|
|
97
|
+
displayLines = processed.summary.split("\n");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch { /* fallback to smartDisplay result */ }
|
|
101
|
+
}
|
|
102
|
+
const truncated = displayLines.length > MAX_LINES;
|
|
103
|
+
// Build short output summary for session context (first 10 lines of ORIGINAL output)
|
|
104
|
+
const shortOutput = lines.slice(0, 10).join("\n") + (lines.length > 10 ? `\n... (${lines.length} lines total)` : "");
|
|
105
|
+
const entry = { nl, cmd, output: shortOutput, error: error || undefined };
|
|
106
|
+
updateTab(t => ({
|
|
107
|
+
...t,
|
|
108
|
+
streamLines: [],
|
|
109
|
+
sessionEntries: [...t.sessionEntries.slice(-9), entry],
|
|
110
|
+
scroll: [...t.scroll, {
|
|
111
|
+
nl, cmd,
|
|
112
|
+
lines: truncated ? displayLines.slice(0, MAX_LINES) : displayLines,
|
|
113
|
+
truncated, expanded: false,
|
|
114
|
+
error: error || undefined,
|
|
115
|
+
filePaths: filePaths.length ? filePaths : undefined,
|
|
116
|
+
}],
|
|
117
|
+
}));
|
|
118
|
+
appendHistory({ nl, cmd, output: lines.join("\n"), ts: Date.now(), error });
|
|
119
|
+
// Log to SQLite session
|
|
120
|
+
if (interactionIdRef.current) {
|
|
121
|
+
updateInteraction(interactionIdRef.current, { output: shortOutput, exitCode: error ? 1 : 0 });
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
// ── run command ─────────────────────────────────────────────────────────────
|
|
125
|
+
const runPhase = async (nl, command, raw) => {
|
|
126
|
+
setPhase({ type: "running", nl, command });
|
|
127
|
+
updateTab(t => ({ ...t, streamLines: [] }));
|
|
128
|
+
const abort = new AbortController();
|
|
129
|
+
abortRef.current = abort;
|
|
130
|
+
const lines = [];
|
|
131
|
+
const cwd = tabs[activeTab].cwd;
|
|
132
|
+
await new Promise(resolve => {
|
|
133
|
+
runCommand(command, cwd, line => { lines.push(line); setStreamLines([...lines]); }, code => {
|
|
134
|
+
// handle cd — update tab cwd
|
|
135
|
+
const cdTarget = maybeCd(command);
|
|
136
|
+
if (cdTarget) {
|
|
137
|
+
try {
|
|
138
|
+
const { resolve: resolvePath } = require("path");
|
|
139
|
+
const newCwd = require("path").resolve(cwd, cdTarget);
|
|
140
|
+
process.chdir(newCwd);
|
|
141
|
+
updateTab(t => ({ ...t, cwd: newCwd }));
|
|
142
|
+
}
|
|
143
|
+
catch { }
|
|
144
|
+
}
|
|
145
|
+
commitStream(nl, command, lines, code !== 0).then(() => {
|
|
146
|
+
abortRef.current = null;
|
|
147
|
+
if (code !== 0 && !raw) {
|
|
148
|
+
setPhase({ type: "autofix", nl, command, errorOutput: lines.join("\n") });
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
inputPhase({ raw });
|
|
152
|
+
}
|
|
153
|
+
resolve();
|
|
154
|
+
});
|
|
155
|
+
}, abort.signal);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
// ── translate + run ─────────────────────────────────────────────────────────
|
|
159
|
+
const translateAndRun = async (nl, raw) => {
|
|
160
|
+
updateTab(t => ({ ...t, sessionNl: [...t.sessionNl, nl] }));
|
|
161
|
+
// Lazy session creation — only when user actually types something
|
|
162
|
+
if (!sessionIdRef.current) {
|
|
163
|
+
sessionIdRef.current = createSession(process.cwd());
|
|
164
|
+
}
|
|
165
|
+
// Log interaction start
|
|
166
|
+
const startTime = Date.now();
|
|
167
|
+
interactionIdRef.current = logInteraction(sessionIdRef.current, { nl });
|
|
168
|
+
if (raw) {
|
|
169
|
+
await runPhase(nl, nl, true);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const sessionEntries = tabs[activeTab].sessionEntries;
|
|
173
|
+
setPhase({ type: "thinking", nl, partial: "" });
|
|
174
|
+
try {
|
|
175
|
+
const command = await translateToCommand(nl, config.permissions, sessionEntries, partial => setPhase({ type: "thinking", nl, partial }));
|
|
176
|
+
// Update interaction with generated command
|
|
177
|
+
updateInteraction(interactionIdRef.current, { command });
|
|
178
|
+
const blocked = checkPermissions(command, config.permissions);
|
|
179
|
+
if (blocked) {
|
|
180
|
+
pushScroll({ nl, cmd: command, lines: [`blocked: ${blocked}`], truncated: false, error: true });
|
|
181
|
+
inputPhase();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const danger = isIrreversible(command);
|
|
185
|
+
if (!config.confirm && !danger) {
|
|
186
|
+
await runPhase(nl, command, false);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
setPhase({ type: "confirm", nl, command, danger });
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
setPhase({ type: "error", message: e.message });
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
// ── input handler ───────────────────────────────────────────────────────────
|
|
196
|
+
useInput(useCallback(async (input, key) => {
|
|
197
|
+
const phase = tabs[activeTab].phase;
|
|
198
|
+
// ── global: ctrl+c always exits ─────────────────────────────────────────
|
|
199
|
+
if (key.ctrl && input === "c" && phase.type !== "running") {
|
|
200
|
+
exit();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
// ── running: ctrl+c cancels ──────────────────────────────────────────────
|
|
204
|
+
if (phase.type === "running") {
|
|
205
|
+
if (key.ctrl && input === "c") {
|
|
206
|
+
abortRef.current?.abort();
|
|
207
|
+
inputPhase();
|
|
208
|
+
}
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
// ── browse ───────────────────────────────────────────────────────────────
|
|
212
|
+
if (phase.type === "browse")
|
|
213
|
+
return; // handled by Browse component
|
|
214
|
+
// ── fuzzy ────────────────────────────────────────────────────────────────
|
|
215
|
+
if (phase.type === "fuzzy")
|
|
216
|
+
return; // handled by FuzzyPicker component
|
|
217
|
+
// ── input ────────────────────────────────────────────────────────────────
|
|
218
|
+
if (phase.type === "input") {
|
|
219
|
+
// global shortcuts
|
|
220
|
+
if (key.ctrl && input === "l") {
|
|
221
|
+
updateTab(t => ({ ...t, scroll: [] }));
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (key.ctrl && input === "b") {
|
|
225
|
+
setPhase({ type: "browse", cwd: tab.cwd });
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (key.ctrl && input === "r") {
|
|
229
|
+
setPhase({ type: "fuzzy" });
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// tab management
|
|
233
|
+
if (key.ctrl && input === "t") {
|
|
234
|
+
const id = nextTabId.current++;
|
|
235
|
+
setTabs(ts => [...ts, newTab(id, tab.cwd)]);
|
|
236
|
+
setActiveTab(tabs.length); // new tab index
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (key.ctrl && input === "w") {
|
|
240
|
+
if (tabs.length > 1) {
|
|
241
|
+
setTabs(ts => ts.filter((_, i) => i !== activeTab));
|
|
242
|
+
setActiveTab(i => Math.min(i, tabs.length - 2));
|
|
243
|
+
}
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (key.tab) {
|
|
247
|
+
setActiveTab(i => (i + 1) % tabs.length);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// history nav
|
|
251
|
+
if (key.upArrow) {
|
|
252
|
+
const idx = Math.min(phase.histIdx + 1, allNl.length - 1);
|
|
253
|
+
const val = allNl[allNl.length - 1 - idx] ?? "";
|
|
254
|
+
setPhase({ ...phase, value: val, cursor: val.length, histIdx: idx });
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (key.downArrow) {
|
|
258
|
+
const idx = Math.max(phase.histIdx - 1, -1);
|
|
259
|
+
const val = idx === -1 ? "" : allNl[allNl.length - 1 - idx] ?? "";
|
|
260
|
+
setPhase({ ...phase, value: val, cursor: val.length, histIdx: idx });
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// cursor movement
|
|
264
|
+
if (key.leftArrow) {
|
|
265
|
+
setPhase({ ...phase, cursor: Math.max(0, phase.cursor - 1) });
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (key.rightArrow) {
|
|
269
|
+
// right arrow at end → accept ghost text
|
|
270
|
+
const ghost = ghostText(phase.value, allNl);
|
|
271
|
+
if (phase.cursor === phase.value.length && ghost) {
|
|
272
|
+
const full = phase.value + ghost;
|
|
273
|
+
setPhase({ ...phase, value: full, cursor: full.length });
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
setPhase({ ...phase, cursor: Math.min(phase.value.length, phase.cursor + 1) });
|
|
277
|
+
}
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (key.tab) {
|
|
281
|
+
// tab → accept ghost text
|
|
282
|
+
const ghost = ghostText(phase.value, allNl);
|
|
283
|
+
if (ghost) {
|
|
284
|
+
const full = phase.value + ghost;
|
|
285
|
+
setPhase({ ...phase, value: full, cursor: full.length });
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (key.return) {
|
|
290
|
+
const nl = phase.value.trim();
|
|
291
|
+
if (!nl)
|
|
292
|
+
return;
|
|
293
|
+
await translateAndRun(nl, phase.raw);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (key.backspace || key.delete) {
|
|
297
|
+
const val = deleteAt(phase.value, phase.cursor);
|
|
298
|
+
setPhase({ ...phase, value: val, cursor: Math.max(0, phase.cursor - 1), histIdx: -1 });
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (input && !key.ctrl && !key.meta) {
|
|
302
|
+
const val = insertAt(phase.value, phase.cursor, input);
|
|
303
|
+
setPhase({ ...phase, value: val, cursor: phase.cursor + 1, histIdx: -1 });
|
|
304
|
+
}
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
// ── confirm ──────────────────────────────────────────────────────────────
|
|
308
|
+
if (phase.type === "confirm") {
|
|
309
|
+
if (input === "?") {
|
|
310
|
+
const { nl, command } = phase;
|
|
311
|
+
setPhase({ type: "thinking", nl, partial: "" });
|
|
312
|
+
try {
|
|
313
|
+
const explanation = await explainCommand(command);
|
|
314
|
+
setPhase({ type: "explain", nl, command, explanation });
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
setPhase({ type: "confirm", nl, command, danger: phase.danger });
|
|
318
|
+
}
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (input === "y" || input === "Y" || key.return) {
|
|
322
|
+
await runPhase(phase.nl, phase.command, false);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (input === "n" || input === "N" || key.escape) {
|
|
326
|
+
inputPhase();
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (input === "e" || input === "E") {
|
|
330
|
+
setPhase({ type: "input", value: phase.command, cursor: phase.command.length, histIdx: -1, raw: false });
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
// ── explain ──────────────────────────────────────────────────────────────
|
|
336
|
+
if (phase.type === "explain") {
|
|
337
|
+
setPhase({ type: "confirm", nl: phase.nl, command: phase.command, danger: isIrreversible(phase.command) });
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
// ── autofix ──────────────────────────────────────────────────────────────
|
|
341
|
+
if (phase.type === "autofix") {
|
|
342
|
+
if (input === "y" || input === "Y" || key.return) {
|
|
343
|
+
const { nl, command, errorOutput } = phase;
|
|
344
|
+
setPhase({ type: "thinking", nl, partial: "" });
|
|
345
|
+
try {
|
|
346
|
+
const fixed = await fixCommand(nl, command, errorOutput, config.permissions, tab.sessionEntries);
|
|
347
|
+
const danger = isIrreversible(fixed);
|
|
348
|
+
if (!config.confirm && !danger) {
|
|
349
|
+
await runPhase(nl, fixed, false);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
setPhase({ type: "confirm", nl, command: fixed, danger });
|
|
353
|
+
}
|
|
354
|
+
catch (e) {
|
|
355
|
+
setPhase({ type: "error", message: e.message });
|
|
356
|
+
}
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
inputPhase();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
// ── error ────────────────────────────────────────────────────────────────
|
|
363
|
+
if (phase.type === "error") {
|
|
364
|
+
inputPhase();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
}, [tabs, activeTab, allNl, config, exit]));
|
|
368
|
+
// ── onboarding ───────────────────────────────────────────────────────────────
|
|
369
|
+
if (!config.onboarded) {
|
|
370
|
+
return _jsx(Onboarding, { onDone: (perms) => {
|
|
371
|
+
const next = { onboarded: true, confirm: false, permissions: perms };
|
|
372
|
+
setConfig(next);
|
|
373
|
+
saveConfig(next);
|
|
374
|
+
} });
|
|
375
|
+
}
|
|
376
|
+
const phase = tab.phase;
|
|
377
|
+
const isRaw = phase.type === "input" && phase.raw;
|
|
378
|
+
const ghost = phase.type === "input" ? ghostText(phase.value, allNl) : "";
|
|
379
|
+
// ── browse overlay ────────────────────────────────────────────────────────
|
|
380
|
+
if (phase.type === "browse") {
|
|
381
|
+
return (_jsxs(Box, { flexDirection: "column", children: [tabs.length > 1 && _jsx(TabBar, { tabs: tabs, active: activeTab }), _jsx(Browse, { cwd: phase.cwd, onCd: path => setPhase({ type: "browse", cwd: path }), onSelect: path => {
|
|
382
|
+
// fill input with the path
|
|
383
|
+
setPhase({ type: "input", value: path, cursor: path.length, histIdx: -1, raw: false });
|
|
384
|
+
}, onExit: () => inputPhase() }), _jsx(StatusBar, { permissions: config.permissions })] }));
|
|
385
|
+
}
|
|
386
|
+
// ── fuzzy overlay ──────────────────────────────────────────────────────────
|
|
387
|
+
if (phase.type === "fuzzy") {
|
|
388
|
+
return (_jsxs(Box, { flexDirection: "column", children: [tabs.length > 1 && _jsx(TabBar, { tabs: tabs, active: activeTab }), _jsx(FuzzyPicker, { history: allNl, onSelect: nl => {
|
|
389
|
+
setPhase({ type: "input", value: nl, cursor: nl.length, histIdx: -1, raw: false });
|
|
390
|
+
}, onExit: () => inputPhase() }), _jsx(StatusBar, { permissions: config.permissions })] }));
|
|
391
|
+
}
|
|
392
|
+
// ── main render ───────────────────────────────────────────────────────────
|
|
393
|
+
return (_jsxs(Box, { flexDirection: "column", children: [tabs.length > 1 && _jsx(TabBar, { tabs: tabs, active: activeTab }), tab.scroll.map((entry, i) => (_jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, children: [_jsxs(Box, { gap: 2, children: [_jsx(Text, { dimColor: true, children: "\u203A" }), _jsx(Text, { dimColor: true, children: entry.nl })] }), entry.nl !== entry.cmd && (_jsxs(Box, { gap: 2, paddingLeft: 2, children: [_jsx(Text, { dimColor: true, children: "$" }), _jsx(Text, { dimColor: true, children: entry.cmd })] })), entry.lines.length > 0 && (_jsxs(Box, { flexDirection: "column", paddingLeft: 4, children: [(entry.expanded ? entry.lines : entry.lines).map((line, j) => (_jsx(Text, { color: entry.error ? "red" : undefined, children: line }, j))), entry.truncated && !entry.expanded && (_jsx(Text, { dimColor: true, children: " \u2026 more lines" }))] }))] }, i))), phase.type === "confirm" && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, children: [_jsxs(Box, { gap: 2, children: [_jsx(Text, { dimColor: true, children: "\u203A" }), _jsx(Text, { dimColor: true, children: phase.nl })] }), _jsxs(Box, { gap: 2, paddingLeft: 2, children: [_jsx(Text, { dimColor: true, children: "$" }), _jsx(Text, { children: phase.command }), phase.danger && _jsx(Text, { color: "red", children: " \u26A0 irreversible" })] }), _jsx(Box, { paddingLeft: 4, children: _jsx(Text, { dimColor: true, children: "enter n e ?" }) })] })), phase.type === "explain" && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, children: [_jsxs(Box, { gap: 2, paddingLeft: 2, children: [_jsx(Text, { dimColor: true, children: "$" }), _jsx(Text, { children: phase.command })] }), _jsx(Box, { paddingLeft: 4, children: _jsx(Text, { dimColor: true, children: phase.explanation }) }), _jsx(Box, { paddingLeft: 4, children: _jsx(Text, { dimColor: true, children: "any key \u2192" }) })] })), phase.type === "autofix" && (_jsx(Box, { paddingLeft: 2, children: _jsx(Text, { dimColor: true, children: "failed \u2014 retry with fix? [enter / n]" }) })), phase.type === "thinking" && (phase.partial ? (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [_jsxs(Box, { gap: 2, children: [_jsx(Text, { dimColor: true, children: "\u203A" }), _jsx(Text, { dimColor: true, children: phase.nl })] }), _jsxs(Box, { gap: 2, paddingLeft: 2, children: [_jsx(Text, { dimColor: true, children: "$" }), _jsx(Text, { dimColor: true, children: phase.partial })] })] })) : _jsx(Spinner, { label: "translating" })), phase.type === "running" && (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [_jsxs(Box, { gap: 2, children: [_jsx(Text, { dimColor: true, children: "$" }), _jsx(Text, { dimColor: true, children: phase.command })] }), _jsx(Box, { flexDirection: "column", paddingLeft: 2, children: tab.streamLines.slice(-MAX_LINES).map((l, i) => _jsx(Text, { children: l }, i)) }), _jsx(Spinner, { label: "ctrl+c to cancel" })] })), phase.type === "error" && (_jsx(Box, { paddingLeft: 2, children: _jsx(Text, { color: "red", children: phase.message }) })), phase.type === "input" && (_jsxs(Box, { gap: 2, paddingLeft: 2, children: [_jsx(Text, { dimColor: true, children: isRaw ? "$" : "›" }), _jsxs(Box, { children: [_jsx(Text, { children: phase.value.slice(0, phase.cursor) }), _jsx(Text, { inverse: true, children: phase.value[phase.cursor] ?? " " }), _jsx(Text, { children: phase.value.slice(phase.cursor + 1) }), ghost && phase.cursor === phase.value.length && (_jsx(Text, { dimColor: true, children: ghost }))] })] })), _jsx(StatusBar, { permissions: config.permissions, cwd: tab.cwd })] }));
|
|
394
|
+
}
|
|
395
|
+
// ── TabBar ────────────────────────────────────────────────────────────────────
|
|
396
|
+
function TabBar({ tabs, active }) {
|
|
397
|
+
return (_jsxs(Box, { gap: 1, paddingLeft: 2, marginBottom: 1, children: [tabs.map((t, i) => {
|
|
398
|
+
const label = ` ${i + 1} `;
|
|
399
|
+
const cwd = t.cwd.split("/").pop() || t.cwd;
|
|
400
|
+
return (_jsx(Box, { children: i === active
|
|
401
|
+
? _jsxs(Text, { inverse: true, children: [label, cwd] })
|
|
402
|
+
: _jsxs(Text, { dimColor: true, children: [label, cwd] }) }, t.id));
|
|
403
|
+
}), _jsx(Text, { dimColor: true, children: " ctrl+t new tab switch ctrl+w close" })] }));
|
|
404
|
+
}
|
package/dist/Browse.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import { readdirSync, statSync } from "fs";
|
|
5
|
+
import { join, dirname } from "path";
|
|
6
|
+
function readDir(dir) {
|
|
7
|
+
try {
|
|
8
|
+
const names = readdirSync(dir);
|
|
9
|
+
const entries = [];
|
|
10
|
+
for (const name of names) {
|
|
11
|
+
try {
|
|
12
|
+
const stat = statSync(join(dir, name));
|
|
13
|
+
entries.push({ name, isDir: stat.isDirectory() });
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
entries.push({ name, isDir: false });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
entries.sort((a, b) => {
|
|
20
|
+
if (a.isDir !== b.isDir)
|
|
21
|
+
return a.isDir ? -1 : 1;
|
|
22
|
+
return a.name.localeCompare(b.name);
|
|
23
|
+
});
|
|
24
|
+
return entries;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const PAGE = 20;
|
|
31
|
+
export default function Browse({ cwd, onCd, onSelect, onExit }) {
|
|
32
|
+
const [cursor, setCursor] = useState(0);
|
|
33
|
+
const entries = readDir(cwd);
|
|
34
|
+
const total = entries.length;
|
|
35
|
+
const safeIndex = Math.min(cursor, Math.max(0, total - 1));
|
|
36
|
+
const start = Math.max(0, Math.min(safeIndex - Math.floor(PAGE / 2), total - PAGE));
|
|
37
|
+
const slice = entries.slice(Math.max(0, start), Math.max(0, start) + PAGE);
|
|
38
|
+
useInput(useCallback((_input, key) => {
|
|
39
|
+
if (key.upArrow) {
|
|
40
|
+
setCursor(c => (c <= 0 ? Math.max(0, total - 1) : c - 1));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (key.downArrow) {
|
|
44
|
+
setCursor(c => (total === 0 ? 0 : (c >= total - 1 ? 0 : c + 1)));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (key.return) {
|
|
48
|
+
if (total === 0)
|
|
49
|
+
return;
|
|
50
|
+
const entry = entries[safeIndex];
|
|
51
|
+
if (!entry)
|
|
52
|
+
return;
|
|
53
|
+
const full = join(cwd, entry.name);
|
|
54
|
+
if (entry.isDir) {
|
|
55
|
+
setCursor(0);
|
|
56
|
+
onCd(full);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
onSelect(full);
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (key.backspace || key.delete || key.leftArrow) {
|
|
64
|
+
setCursor(0);
|
|
65
|
+
onCd(dirname(cwd));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (key.escape) {
|
|
69
|
+
onExit();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}, [cwd, entries, safeIndex, total, onCd, onSelect, onExit]));
|
|
73
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: cwd }), total === 0 && _jsx(Text, { dimColor: true, children: " (empty)" }), slice.map((entry, i) => {
|
|
74
|
+
const absIdx = Math.max(0, start) + i;
|
|
75
|
+
const selected = absIdx === safeIndex;
|
|
76
|
+
const icon = entry.isDir ? "▸" : "·";
|
|
77
|
+
return (_jsx(Box, { children: _jsx(Text, { inverse: selected, children: ` ${icon} ${entry.name}${entry.isDir ? "/" : ""} ` }) }, entry.name));
|
|
78
|
+
}), _jsx(Text, { dimColor: true, children: " enter backspace esc" })] }));
|
|
79
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
const MAX_MATCHES = 10;
|
|
5
|
+
export default function FuzzyPicker({ history, onSelect, onExit }) {
|
|
6
|
+
const [query, setQuery] = useState("");
|
|
7
|
+
const [cursor, setCursor] = useState(0);
|
|
8
|
+
const matches = query === ""
|
|
9
|
+
? history.slice().reverse().slice(0, MAX_MATCHES)
|
|
10
|
+
: history.slice().reverse().filter(h => h.toLowerCase().includes(query.toLowerCase())).slice(0, MAX_MATCHES);
|
|
11
|
+
const safeCursor = Math.min(cursor, Math.max(0, matches.length - 1));
|
|
12
|
+
useInput(useCallback((_input, key) => {
|
|
13
|
+
if (key.escape || key.ctrl && _input === "c") {
|
|
14
|
+
onExit();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (key.return) {
|
|
18
|
+
if (matches.length > 0) {
|
|
19
|
+
onSelect(matches[safeCursor]);
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (key.upArrow) {
|
|
24
|
+
setCursor(c => Math.max(0, c - 1));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (key.downArrow) {
|
|
28
|
+
setCursor(c => Math.min(matches.length - 1, c + 1));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (key.backspace || key.delete) {
|
|
32
|
+
setQuery(q => q.slice(0, -1));
|
|
33
|
+
setCursor(0);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!key.ctrl && !key.meta && _input && _input.length === 1) {
|
|
37
|
+
setQuery(q => q + _input);
|
|
38
|
+
setCursor(0);
|
|
39
|
+
}
|
|
40
|
+
}, [matches, safeCursor, onSelect, onExit]));
|
|
41
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: ` / ${query}_` }), matches.length === 0
|
|
42
|
+
? _jsx(Text, { dimColor: true, children: " no matches" })
|
|
43
|
+
: matches.map((m, i) => {
|
|
44
|
+
const selected = i === safeCursor;
|
|
45
|
+
return (_jsx(Box, { children: _jsx(Text, { inverse: selected, dimColor: !selected, children: ` ${m} ` }) }, i));
|
|
46
|
+
}), _jsx(Text, { dimColor: true, children: " enter esc" })] }));
|
|
47
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import { DEFAULT_PERMISSIONS } from "./history.js";
|
|
5
|
+
const PERM_KEYS = [
|
|
6
|
+
{ key: "destructive", label: "destructive", hint: "rm, delete, drop…" },
|
|
7
|
+
{ key: "network", label: "network", hint: "curl, wget, ssh…" },
|
|
8
|
+
{ key: "sudo", label: "sudo", hint: "root-level commands" },
|
|
9
|
+
{ key: "install", label: "install", hint: "brew, npm -g, pip…" },
|
|
10
|
+
{ key: "write_outside_cwd", label: "write outside", hint: "files outside current dir" },
|
|
11
|
+
];
|
|
12
|
+
export default function Onboarding({ onDone }) {
|
|
13
|
+
const [step, setStep] = useState("welcome");
|
|
14
|
+
const [cursor, setCursor] = useState(0);
|
|
15
|
+
const [perms, setPerms] = useState({ ...DEFAULT_PERMISSIONS });
|
|
16
|
+
useInput((input, key) => {
|
|
17
|
+
if (key.ctrl && input === "c")
|
|
18
|
+
process.exit(0);
|
|
19
|
+
if (step === "welcome") {
|
|
20
|
+
setStep("permissions");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (step === "permissions") {
|
|
24
|
+
if (key.upArrow) {
|
|
25
|
+
setCursor((c) => Math.max(0, c - 1));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (key.downArrow) {
|
|
29
|
+
setCursor((c) => Math.min(PERM_KEYS.length - 1, c + 1));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (input === " ") {
|
|
33
|
+
const k = PERM_KEYS[cursor].key;
|
|
34
|
+
setPerms((p) => ({ ...p, [k]: !p[k] }));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (key.return) {
|
|
38
|
+
onDone(perms);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (step === "welcome") {
|
|
44
|
+
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, gap: 1, paddingTop: 1, children: [_jsx(Text, { children: "terminal" }), _jsx(Text, { dimColor: true, children: "speak plain english, run commands" }), _jsxs(Box, { flexDirection: "column", marginTop: 1, gap: 0, children: [_jsx(Text, { dimColor: true, children: "\u203A type what you want" }), _jsx(Text, { dimColor: true, children: "$ see the command before it runs" }), _jsx(Text, { dimColor: true, children: "\u2191\u2193 browse history" }), _jsx(Text, { dimColor: true, children: "? explain a command before running" }), _jsx(Text, { dimColor: true, children: "ctrl+r toggle raw shell mode" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "any key to set permissions \u2192" }) })] }));
|
|
45
|
+
}
|
|
46
|
+
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, gap: 1, paddingTop: 1, children: [_jsx(Text, { dimColor: true, children: "what can the AI run?" }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: PERM_KEYS.map((p, i) => {
|
|
47
|
+
const active = cursor === i;
|
|
48
|
+
const on = perms[p.key];
|
|
49
|
+
return (_jsxs(Box, { gap: 2, children: [_jsx(Text, { dimColor: true, children: active ? "›" : " " }), _jsx(Text, { color: on ? undefined : "red", children: on ? "✓" : "✗" }), _jsx(Text, { bold: active, children: p.label }), _jsx(Text, { dimColor: true, children: p.hint })] }, p.key));
|
|
50
|
+
}) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "space toggle \u00B7 enter confirm" }) }), _jsx(Text, { dimColor: true, children: "edit later: ~/.hasna/terminal/config.json" })] }));
|
|
51
|
+
}
|
package/dist/Spinner.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { Text } from "ink";
|
|
4
|
+
const FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
5
|
+
export default function Spinner({ label }) {
|
|
6
|
+
const [frame, setFrame] = useState(0);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const t = setInterval(() => setFrame((f) => (f + 1) % FRAMES.length), 80);
|
|
9
|
+
return () => clearInterval(t);
|
|
10
|
+
}, []);
|
|
11
|
+
return (_jsxs(Text, { dimColor: true, children: [" ", FRAMES[frame], " ", label] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { homedir } from "os";
|
|
5
|
+
function formatCwd(cwd) {
|
|
6
|
+
const home = homedir();
|
|
7
|
+
return cwd.startsWith(home) ? "~" + cwd.slice(home.length) : cwd;
|
|
8
|
+
}
|
|
9
|
+
function getGitBranch(cwd) {
|
|
10
|
+
try {
|
|
11
|
+
return execSync("git branch --show-current 2>/dev/null", {
|
|
12
|
+
cwd,
|
|
13
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
14
|
+
}).toString().trim() || null;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getGitDirty(cwd) {
|
|
21
|
+
try {
|
|
22
|
+
return execSync("git status --porcelain 2>/dev/null", {
|
|
23
|
+
cwd,
|
|
24
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
25
|
+
}).toString().trim().length > 0;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function activePerms(perms) {
|
|
32
|
+
const labels = [
|
|
33
|
+
["destructive", "del"],
|
|
34
|
+
["network", "net"],
|
|
35
|
+
["sudo", "sudo"],
|
|
36
|
+
["install", "pkg"],
|
|
37
|
+
["write_outside_cwd", "write"],
|
|
38
|
+
];
|
|
39
|
+
// only show disabled ones — full access is the default so no need to clutter
|
|
40
|
+
const disabled = labels.filter(([k]) => !perms[k]).map(([, l]) => `no-${l}`);
|
|
41
|
+
return disabled;
|
|
42
|
+
}
|
|
43
|
+
export default function StatusBar({ permissions, cwd: cwdProp }) {
|
|
44
|
+
const cwd = cwdProp ?? process.cwd();
|
|
45
|
+
const branch = getGitBranch(cwd);
|
|
46
|
+
const dirty = branch ? getGitDirty(cwd) : false;
|
|
47
|
+
const restricted = activePerms(permissions);
|
|
48
|
+
return (_jsxs(Box, { gap: 2, paddingLeft: 2, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: formatCwd(cwd) }), branch && _jsxs(Text, { dimColor: true, children: [branch, dirty ? " ●" : ""] }), restricted.length > 0 && _jsx(Text, { dimColor: true, children: restricted.join(" · ") })] }));
|
|
49
|
+
}
|