@nio-cli/cli 0.4.0 → 0.7.0
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/.env.example +24 -9
- package/README.md +186 -78
- package/dist/adapters/pg/client.js +2 -0
- package/dist/adapters/pg/client.js.map +1 -1
- package/dist/adapters/pg/login-challenge-repository.js.map +1 -1
- package/dist/adapters/sms/whatsapp.js +83 -0
- package/dist/adapters/sms/whatsapp.js.map +1 -0
- package/dist/app/ai-client.js +2 -2
- package/dist/app/ai-client.js.map +1 -1
- package/dist/cli/commands/ai.js +2 -2
- package/dist/cli/commands/ai.js.map +1 -1
- package/dist/cli/commands/auth.js +5 -5
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/config.js +17 -7
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/docs/content.js +80 -11
- package/dist/cli/commands/docs/content.js.map +1 -1
- package/dist/cli/commands/exec.js +1 -12
- package/dist/cli/commands/exec.js.map +1 -1
- package/dist/cli/commands/init/index.js +1 -2
- package/dist/cli/commands/init/index.js.map +1 -1
- package/dist/cli/commands/init/provision-step.js +2 -20
- package/dist/cli/commands/init/provision-step.js.map +1 -1
- package/dist/cli/commands/plan.js +1 -12
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/security.js +15 -15
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/cli/commands/sync.js +4 -18
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/commands/validate-plan.js +1 -10
- package/dist/cli/commands/validate-plan.js.map +1 -1
- package/dist/cli/copy/flows.json +1 -2
- package/dist/cli/copy.js.map +1 -1
- package/dist/cli/flows/dependencies.js +0 -4
- package/dist/cli/flows/dependencies.js.map +1 -1
- package/dist/cli/help-guide.js +69 -0
- package/dist/cli/help-guide.js.map +1 -0
- package/dist/cli/program.js +3 -3
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/ui/render.js +0 -27
- package/dist/cli/ui/render.js.map +1 -1
- package/dist/cli.js +10 -2
- package/dist/cli.js.map +1 -1
- package/dist/gateway/services/login.js +6 -7
- package/dist/gateway/services/login.js.map +1 -1
- package/dist/gateway/services/security.js +6 -6
- package/dist/gateway/services/security.js.map +1 -1
- package/dist/lib/auth/gateway-token.js +3 -0
- package/dist/lib/auth/gateway-token.js.map +1 -1
- package/dist/lib/auth/nio-config.js +28 -0
- package/dist/lib/auth/nio-config.js.map +1 -1
- package/dist/lib/clients/client-configs.js +81 -86
- package/dist/lib/clients/client-configs.js.map +1 -1
- package/dist/lib/deps/dependencies.js +0 -25
- package/dist/lib/deps/dependencies.js.map +1 -1
- package/dist/lib/deps/dependency-install.js +3 -23
- package/dist/lib/deps/dependency-install.js.map +1 -1
- package/dist/lib/exec/exec-delegate.js +69 -48
- package/dist/lib/exec/exec-delegate.js.map +1 -1
- package/dist/lib/exec/plan-delegate.js +25 -34
- package/dist/lib/exec/plan-delegate.js.map +1 -1
- package/dist/lib/exec/qwen-client.js +74 -0
- package/dist/lib/exec/qwen-client.js.map +1 -0
- package/dist/lib/exec/validate-plan-delegate.js +13 -30
- package/dist/lib/exec/validate-plan-delegate.js.map +1 -1
- package/dist/lib/provision/provision.js +2 -2
- package/dist/lib/provision/provision.js.map +1 -1
- package/dist/lib/skills/patterns.js +15 -24
- package/dist/lib/skills/patterns.js.map +1 -1
- package/dist/lib/skills/skill-serve.js +46 -13
- package/dist/lib/skills/skill-serve.js.map +1 -1
- package/dist/lib/skills/skills.js +1 -1
- package/dist/lib/skills/skills.js.map +1 -1
- package/dist/mcp-server.js +0 -15
- package/dist/mcp-server.js.map +1 -1
- package/dist/profiles/bi.js +2 -1
- package/dist/profiles/bi.js.map +1 -1
- package/dist/profiles/dba.js +2 -11
- package/dist/profiles/dba.js.map +1 -1
- package/dist/profiles/toolchains.js +49 -2
- package/dist/profiles/toolchains.js.map +1 -1
- package/dist/tools/delegate-exec.js +3 -10
- package/dist/tools/delegate-exec.js.map +1 -1
- package/dist/tools/plan.js +6 -13
- package/dist/tools/plan.js.map +1 -1
- package/dist/tools/validate-plan.js +6 -14
- package/dist/tools/validate-plan.js.map +1 -1
- package/dist/tui/app.js +102 -18
- package/dist/tui/app.js.map +1 -1
- package/dist/tui/components.js +161 -88
- package/dist/tui/components.js.map +1 -1
- package/dist/tui/launch.js.map +1 -1
- package/dist/tui/opencode.js +27 -0
- package/dist/tui/opencode.js.map +1 -1
- package/dist/tui/palette.js +12 -5
- package/dist/tui/palette.js.map +1 -1
- package/dist/tui/prompt-input.js +168 -0
- package/dist/tui/prompt-input.js.map +1 -0
- package/dist/tui/state.js +252 -20
- package/dist/tui/state.js.map +1 -1
- package/dist/tui/test-utils.js +24 -0
- package/dist/tui/test-utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/adapters/sms/http-generic.js +0 -71
- package/dist/adapters/sms/http-generic.js.map +0 -1
- package/dist/cli/commands/clean.js +0 -108
- package/dist/cli/commands/clean.js.map +0 -1
- package/dist/lib/clients/hooks.js +0 -191
- package/dist/lib/clients/hooks.js.map +0 -1
- package/dist/lib/exec/exec-engines.js +0 -63
- package/dist/lib/exec/exec-engines.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-plan.js","sourceRoot":"","sources":["../../src/tools/validate-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"validate-plan.js","sourceRoot":"","sources":["../../src/tools/validate-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,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,CAAC;IAClD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,0BAA0B,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,UAAU,CAAC;QAChB,EAAE,EAAE,IAAI;QACR,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/tui/app.js
CHANGED
|
@@ -4,11 +4,11 @@ import { Box, Text, Static, useInput, useStdout } from 'ink';
|
|
|
4
4
|
import { renderMatrixLogo } from '../matrix-logo.js';
|
|
5
5
|
import { tlog } from './debug.js';
|
|
6
6
|
import { theme } from './theme.js';
|
|
7
|
-
import {
|
|
7
|
+
import { Footer, MessageView, LiveMessage, StatusLine, InputBox, Toasts, ErrorBlock, DiffSummary, } from './components.js';
|
|
8
8
|
import { InfoPanel, CommandRunner, PermissionModal } from './palette.js';
|
|
9
9
|
import { buildPalette } from './palette-source.js';
|
|
10
|
-
import { applyEvent, pushUserMessage, syncMessages, emptyChat } from './state.js';
|
|
11
|
-
import { subscribeEvents } from './opencode.js';
|
|
10
|
+
import { applyEvent, messageUsage, pendingQuestion, questionOptions, pushUserMessage, syncMessages, reconcilePendingPermissions, emptyChat, } from './state.js';
|
|
11
|
+
import { listPrimaryAgents, subscribeEvents, fetchPendingPermissions, } from './opencode.js';
|
|
12
12
|
function useTerminalSize() {
|
|
13
13
|
const { stdout } = useStdout();
|
|
14
14
|
const [size, setSize] = useState({ rows: stdout?.rows ?? 24, columns: stdout?.columns ?? 80 });
|
|
@@ -27,12 +27,16 @@ export function App({ handle, program, cwd, session, splashMs = 1200, model }) {
|
|
|
27
27
|
const { rows, columns } = useTerminalSize();
|
|
28
28
|
const [chat, setChat] = useState(emptyChat);
|
|
29
29
|
const [overlay, setOverlay] = useState({ kind: 'none' });
|
|
30
|
-
const [
|
|
30
|
+
const [draft, setDraft] = useState('');
|
|
31
|
+
const [showReasoning, setShowReasoning] = useState(false);
|
|
32
|
+
const [modes, setModes] = useState(['build', 'plan']);
|
|
33
|
+
const [mode, setMode] = useState('build');
|
|
31
34
|
const [ready, setReady] = useState(false);
|
|
32
35
|
const [frame, setFrame] = useState(0);
|
|
33
36
|
const sessionId = useRef('');
|
|
34
37
|
const abortRef = useRef(new AbortController());
|
|
35
38
|
const busyStartedAt = useRef(0);
|
|
39
|
+
const tuiCommandRef = useRef(() => { });
|
|
36
40
|
const [splash, setSplash] = useState(splashMs > 0);
|
|
37
41
|
useEffect(() => {
|
|
38
42
|
if (splashMs <= 0)
|
|
@@ -52,14 +56,15 @@ export function App({ handle, program, cwd, session, splashMs = 1200, model }) {
|
|
|
52
56
|
if (!id)
|
|
53
57
|
return;
|
|
54
58
|
try {
|
|
55
|
-
const [st, msgs] = await Promise.all([
|
|
59
|
+
const [st, msgs, perms] = await Promise.all([
|
|
56
60
|
handle.client.session.status(),
|
|
57
61
|
handle.client.session.messages({ path: { id } }),
|
|
62
|
+
fetchPendingPermissions(handle.url),
|
|
58
63
|
]);
|
|
59
64
|
const status = st.data?.[id]?.type;
|
|
60
65
|
const busy = status === 'busy' || status === 'retry';
|
|
61
66
|
const raw = (msgs.data ?? []);
|
|
62
|
-
setChat((prev) => syncMessages(prev, raw, busy));
|
|
67
|
+
setChat((prev) => reconcilePendingPermissions(syncMessages(prev, raw, busy), perms));
|
|
63
68
|
}
|
|
64
69
|
catch (err) {
|
|
65
70
|
tlog('resync falhou', err.message);
|
|
@@ -74,8 +79,9 @@ export function App({ handle, program, cwd, session, splashMs = 1200, model }) {
|
|
|
74
79
|
try {
|
|
75
80
|
const created = await handle.client.session.create({ body: { title: cwd.split('/').pop() ?? 'nio' } });
|
|
76
81
|
sessionId.current = created.data?.id ?? '';
|
|
77
|
-
const
|
|
78
|
-
|
|
82
|
+
const agents = await listPrimaryAgents(handle.client);
|
|
83
|
+
setModes(agents);
|
|
84
|
+
setMode((cur) => (agents.includes(cur) ? cur : agents[0] ?? 'build'));
|
|
79
85
|
}
|
|
80
86
|
catch (err) {
|
|
81
87
|
tlog('falha ao criar sessão', err.message);
|
|
@@ -88,8 +94,20 @@ export function App({ handle, program, cwd, session, splashMs = 1200, model }) {
|
|
|
88
94
|
void resync();
|
|
89
95
|
continue;
|
|
90
96
|
}
|
|
91
|
-
|
|
97
|
+
const et = evt.type;
|
|
98
|
+
if (et === 'message.part.delta')
|
|
92
99
|
continue;
|
|
100
|
+
if (et === 'tui.prompt.append') {
|
|
101
|
+
const text = evt.properties?.text ?? '';
|
|
102
|
+
if (text)
|
|
103
|
+
setDraft((d) => (d ? `${d} ${text}` : text));
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (et === 'tui.command.execute') {
|
|
107
|
+
const cmd = evt.properties?.command ?? '';
|
|
108
|
+
tuiCommandRef.current(cmd);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
93
111
|
setChat((prev) => applyEvent(prev, evt));
|
|
94
112
|
}
|
|
95
113
|
})();
|
|
@@ -104,34 +122,87 @@ export function App({ handle, program, cwd, session, splashMs = 1200, model }) {
|
|
|
104
122
|
const t = setInterval(resync, 4000);
|
|
105
123
|
return () => clearInterval(t);
|
|
106
124
|
}, [chat.busy, resync]);
|
|
107
|
-
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (chat.toasts.length === 0)
|
|
127
|
+
return;
|
|
128
|
+
const iv = setInterval(() => {
|
|
129
|
+
setChat((prev) => {
|
|
130
|
+
const now = Date.now();
|
|
131
|
+
const kept = prev.toasts.filter((x) => x.until > now);
|
|
132
|
+
return kept.length === prev.toasts.length ? prev : { ...prev, toasts: kept };
|
|
133
|
+
});
|
|
134
|
+
}, 700);
|
|
135
|
+
return () => clearInterval(iv);
|
|
136
|
+
}, [chat.toasts.length]);
|
|
137
|
+
useInput((input, key) => {
|
|
138
|
+
if (key.ctrl && input === 'r')
|
|
139
|
+
return setShowReasoning((v) => !v);
|
|
108
140
|
if (key.escape && chat.busy && sessionId.current) {
|
|
109
141
|
handle.client.session.abort({ path: { id: sessionId.current } }).catch(() => { });
|
|
110
142
|
setChat((prev) => ({ ...prev, busy: false }));
|
|
111
143
|
}
|
|
112
|
-
});
|
|
144
|
+
}, { isActive: overlay.kind === 'none' && chat.permissions.length === 0 });
|
|
113
145
|
useEffect(() => () => handle.close(), [handle]);
|
|
114
146
|
const send = (text) => {
|
|
115
147
|
if (!sessionId.current)
|
|
116
148
|
return;
|
|
149
|
+
setDraft('');
|
|
117
150
|
setChat((prev) => pushUserMessage(prev, text));
|
|
118
151
|
handle.client.session
|
|
119
|
-
.prompt({ path: { id: sessionId.current }, body: { model, parts: [{ type: 'text', text }] } })
|
|
152
|
+
.prompt({ path: { id: sessionId.current }, body: { model, agent: mode, parts: [{ type: 'text', text }] } })
|
|
120
153
|
.catch((err) => tlog('prompt falhou', err.message));
|
|
121
154
|
};
|
|
155
|
+
const cycleMode = (reverse) => {
|
|
156
|
+
setMode((cur) => {
|
|
157
|
+
const n = modes.length;
|
|
158
|
+
if (n === 0)
|
|
159
|
+
return cur;
|
|
160
|
+
const i = Math.max(0, modes.indexOf(cur));
|
|
161
|
+
return modes[(i + (reverse ? -1 : 1) + n) % n] ?? cur;
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
const toast = (message, variant = 'info') => setChat((prev) => ({
|
|
165
|
+
...prev,
|
|
166
|
+
toasts: [
|
|
167
|
+
...prev.toasts.slice(-4),
|
|
168
|
+
{ id: `toast-${Date.now()}`, message, variant, until: Date.now() + 3000 },
|
|
169
|
+
],
|
|
170
|
+
}));
|
|
171
|
+
tuiCommandRef.current = (cmd) => {
|
|
172
|
+
switch (cmd) {
|
|
173
|
+
case 'prompt.clear':
|
|
174
|
+
return setDraft('');
|
|
175
|
+
case 'prompt.submit':
|
|
176
|
+
return send(draft);
|
|
177
|
+
case 'agent.cycle':
|
|
178
|
+
return cycleMode(false);
|
|
179
|
+
case 'session.interrupt':
|
|
180
|
+
if (sessionId.current)
|
|
181
|
+
handle.client.session.abort({ path: { id: sessionId.current } }).catch(() => { });
|
|
182
|
+
return setChat((prev) => ({ ...prev, busy: false }));
|
|
183
|
+
case 'session.compact':
|
|
184
|
+
if (sessionId.current)
|
|
185
|
+
handle.client.session.summarize({ path: { id: sessionId.current } }).catch(() => { });
|
|
186
|
+
return toast('compactando o contexto…');
|
|
187
|
+
default:
|
|
188
|
+
return toast(`comando do motor ignorado: ${cmd}`);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
122
191
|
const palette = useMemo(() => buildPalette(program), [program]);
|
|
123
192
|
const onDispatch = (item, action) => {
|
|
193
|
+
setDraft('');
|
|
124
194
|
if (action === 'prompt' && item.kind === 'capability')
|
|
125
195
|
return send(item.prompt);
|
|
126
196
|
if (action === 'run' && item.kind === 'command')
|
|
127
197
|
return setOverlay({ kind: 'run', item });
|
|
128
198
|
setOverlay({ kind: 'info', item });
|
|
129
199
|
};
|
|
200
|
+
const closeOverlay = () => setOverlay({ kind: 'none' });
|
|
130
201
|
const respondPermission = (r) => {
|
|
131
|
-
const perm = chat.
|
|
202
|
+
const perm = chat.permissions[0];
|
|
132
203
|
if (!perm)
|
|
133
204
|
return;
|
|
134
|
-
setChat((prev) => ({ ...prev,
|
|
205
|
+
setChat((prev) => ({ ...prev, permissions: prev.permissions.slice(1) }));
|
|
135
206
|
handle.client
|
|
136
207
|
.postSessionIdPermissionsPermissionId({ path: { id: perm.sessionId, permissionID: perm.id }, body: { response: r } })
|
|
137
208
|
.catch((err) => tlog('permission respond falhou', err.message))
|
|
@@ -148,10 +219,12 @@ export function App({ handle, program, cwd, session, splashMs = 1200, model }) {
|
|
|
148
219
|
};
|
|
149
220
|
}, [chat.messages, chat.busy]);
|
|
150
221
|
const phase = useMemo(() => {
|
|
222
|
+
if (chat.retry)
|
|
223
|
+
return `tentando de novo (${chat.retry.attempt})`;
|
|
151
224
|
const parts = live?.parts ?? [];
|
|
152
225
|
const tool = parts.find((p) => p.kind === 'tool' && (p.tool?.status === 'running' || p.tool?.status === 'pending'));
|
|
153
226
|
if (tool)
|
|
154
|
-
return `executando ${tool.text}`;
|
|
227
|
+
return `executando ${tool.tool?.name ?? tool.text}`;
|
|
155
228
|
const hasText = parts.some((p) => p.kind === 'text' && p.text.trim());
|
|
156
229
|
const hasReasoning = parts.some((p) => p.kind === 'reasoning' && p.text.trim());
|
|
157
230
|
if (hasText)
|
|
@@ -159,13 +232,24 @@ export function App({ handle, program, cwd, session, splashMs = 1200, model }) {
|
|
|
159
232
|
if (hasReasoning)
|
|
160
233
|
return 'raciocinando';
|
|
161
234
|
return 'pensando';
|
|
162
|
-
}, [live]);
|
|
235
|
+
}, [live, chat.retry]);
|
|
163
236
|
const elapsed = chat.busy ? Math.max(0, Math.floor((Date.now() - busyStartedAt.current) / 1000)) : 0;
|
|
237
|
+
const question = useMemo(() => pendingQuestion(chat), [chat]);
|
|
238
|
+
const options = useMemo(() => questionOptions(chat), [chat]);
|
|
164
239
|
if (splash) {
|
|
165
240
|
return (_jsxs(Box, { flexDirection: "column", alignItems: "center", paddingY: 1, children: [_jsx(Text, { children: renderMatrixLogo({ width: Math.min(70, columns), height: 16 }) }), _jsx(Text, { color: theme.accent, children: "operador NIO \u00B7 opencode/big-pickle" })] }));
|
|
166
241
|
}
|
|
167
|
-
const liveMax = Math.max(4, Math.floor(rows * 0.4));
|
|
168
242
|
const disabled = chat.busy || !ready;
|
|
169
|
-
|
|
243
|
+
const pendingPerm = chat.permissions[0] ?? null;
|
|
244
|
+
const overlayUp = overlay.kind !== 'none' || !!pendingPerm;
|
|
245
|
+
const paletteOpen = draft.startsWith('/') && !overlayUp;
|
|
246
|
+
const paletteMaxItems = Math.max(3, Math.min(6, rows - 16));
|
|
247
|
+
const liveMax = Math.max(3, Math.floor(rows * 0.45) - (paletteOpen ? paletteMaxItems + 3 : 0));
|
|
248
|
+
const inputActive = !overlayUp;
|
|
249
|
+
const sessionTokens = chat.messages.reduce((n, m) => {
|
|
250
|
+
const u = messageUsage(m);
|
|
251
|
+
return n + (u ? u.tokensIn + u.tokensOut : 0);
|
|
252
|
+
}, 0);
|
|
253
|
+
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsx(Static, { items: finished, children: (m) => _jsx(MessageView, { message: m }, m.id) }), live && (_jsx(LiveMessage, { message: live, maxLines: liveMax, todos: chat.todos, files: chat.files, retry: chat.retry, expandReasoning: showReasoning })), _jsx(DiffSummary, { changes: chat.diff }), _jsx(StatusLine, { busy: chat.busy, frame: frame, seconds: elapsed, label: phase }), chat.error && _jsx(ErrorBlock, { error: chat.error }), _jsx(Toasts, { toasts: chat.toasts }), question && !overlayUp && (_jsx(Box, { paddingX: 1, children: _jsxs(Text, { color: theme.accentBright, wrap: "truncate-end", children: ['↳ o nio perguntou: ', _jsx(Text, { color: theme.text, children: question.length > columns - 24 ? question.slice(0, columns - 27) + '…' : question })] }) })), _jsx(InputBox, { value: draft, onChange: setDraft, disabled: disabled, active: inputActive, palette: palette, onSubmit: send, onDispatch: onDispatch, onCycleMode: cycleMode, options: overlayUp ? [] : options, width: Math.max(24, columns - 6), maxItems: paletteMaxItems }), pendingPerm ? (_jsx(PermissionModal, { req: pendingPerm, queued: chat.permissions.length, onRespond: respondPermission })) : overlay.kind === 'info' ? (_jsx(InfoPanel, { item: overlay.item, onClose: closeOverlay })) : overlay.kind === 'run' ? (_jsx(CommandRunner, { item: overlay.item, cwd: cwd, onClose: closeOverlay })) : null, _jsx(Footer, { model: "big-pickle", cwd: cwd, session: session, mode: mode, sessionTokens: sessionTokens })] }));
|
|
170
254
|
}
|
|
171
255
|
//# sourceMappingURL=app.js.map
|
package/dist/tui/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/tui/app.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,EAAE,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AAC,EAChC,QAAQ,EAAE,eAAe,GACzB,EAGD,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,eAAe,IAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAI,CACrG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAC5B,KAAC,SAAS,IAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,GAAI,CACzD,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAC3B,KAAC,aAAa,IAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,GAAI,CACvE,CAAC,CAAC,CAAC,IAAI,EAER,KAAC,MAAM,IACL,KAAK,EAAC,YAAY,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,GAC5B,IACE,CACP,CAAC;AACJ,CAAC"}
|
package/dist/tui/components.js
CHANGED
|
@@ -1,58 +1,138 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Box, Text
|
|
3
|
+
import { Box, Text } from 'ink';
|
|
4
4
|
import { theme, sym } from './theme.js';
|
|
5
5
|
import { Markdown } from './markdown.js';
|
|
6
|
+
import { PromptInput } from './prompt-input.js';
|
|
6
7
|
import { filterPalette } from './palette-source.js';
|
|
7
|
-
|
|
8
|
-
const splitOnEnter = (s) => s.split(/\r|\n/);
|
|
8
|
+
import { messageUsage, summarizeToolInput, } from './state.js';
|
|
9
9
|
const KIND_LABEL = {
|
|
10
10
|
command: 'cmd',
|
|
11
11
|
capability: 'agente',
|
|
12
12
|
help: 'ajuda',
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const clip = (s, n) => (s.length > n ? s.slice(0, n - 1) + '…' : s);
|
|
15
|
+
const kfmt = (n) => (n >= 1000 ? `${(n / 1000).toFixed(1)}k` : String(n));
|
|
16
|
+
const TOAST_STYLE = {
|
|
17
|
+
info: { color: theme.dim, icon: sym.bullet },
|
|
18
|
+
success: { color: theme.accent, icon: sym.ok },
|
|
19
|
+
warning: { color: theme.warn, icon: sym.warn },
|
|
20
|
+
error: { color: theme.err, icon: sym.err },
|
|
21
|
+
};
|
|
22
|
+
export function DiffSummary({ changes, }) {
|
|
23
|
+
if (changes.length === 0)
|
|
24
|
+
return null;
|
|
25
|
+
const parts = changes.slice(0, 4).map((c) => {
|
|
26
|
+
const name = c.file.split('/').pop() || c.file;
|
|
27
|
+
const a = c.added ? `+${c.added}` : '';
|
|
28
|
+
const r = c.removed ? `−${c.removed}` : '';
|
|
29
|
+
return `${name} ${[a, r].filter(Boolean).join(' ')}`.trim();
|
|
30
|
+
});
|
|
31
|
+
const more = changes.length - parts.length;
|
|
32
|
+
return (_jsx(Box, { paddingX: 1, children: _jsxs(Text, { color: theme.accent, wrap: "truncate-end", children: ['✎ ', changes.length, " arquivo(s): ", _jsxs(Text, { color: theme.dim, children: [parts.join(' · '), more > 0 ? ` · +${more}` : ''] })] }) }));
|
|
33
|
+
}
|
|
34
|
+
export function QuestionPicker({ options, sel, }) {
|
|
35
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.accentBright, paddingX: 1, children: [options.map((o, i) => (_jsxs(Text, { inverse: i === sel, color: i === sel ? theme.accentBright : undefined, wrap: "truncate-end", children: [' ', i + 1, ". ", o] }, i))), _jsx(Text, { color: theme.dim, children: "\u2191\u2193 escolher \u00B7 \u21B5 responder \u00B7 ou digite a sua" })] }));
|
|
16
36
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
37
|
+
export function ErrorBlock({ error, }) {
|
|
38
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.err, paddingX: 1, children: [_jsxs(Text, { color: theme.err, children: [sym.err, " ", error.name] }), _jsxs(Text, { wrap: "truncate-end", children: [' ', error.message] }), error.retryable && (_jsx(Text, { color: theme.dim, children: ' reenvie o prompt pra tentar de novo' }))] }));
|
|
39
|
+
}
|
|
40
|
+
export function Toasts({ toasts }) {
|
|
41
|
+
if (toasts.length === 0)
|
|
42
|
+
return null;
|
|
43
|
+
return (_jsx(Box, { flexDirection: "column", paddingX: 1, children: toasts.map((t) => {
|
|
44
|
+
const s = TOAST_STYLE[t.variant];
|
|
45
|
+
return (_jsxs(Text, { color: s.color, wrap: "truncate-end", children: [s.icon, " ", t.message] }, t.id));
|
|
46
|
+
}) }));
|
|
47
|
+
}
|
|
48
|
+
export function Footer({ model, cwd, session, mode, sessionTokens = 0, }) {
|
|
49
|
+
const folder = cwd.replace(/\/+$/, '').split('/').pop() || cwd;
|
|
50
|
+
const bits = [`⏵ ${model}`, folder];
|
|
51
|
+
if (session)
|
|
52
|
+
bits.push(`${session.name} · ${session.profile}`);
|
|
53
|
+
if (sessionTokens > 0)
|
|
54
|
+
bits.push(`${kfmt(sessionTokens)} tok`);
|
|
55
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: theme.dim, children: bits.join(' · ') }), mode ? _jsx(Text, { color: theme.accentBright, children: ` [${mode}]` }) : null] }), _jsxs(Text, { color: theme.dim, children: [_jsx(Text, { color: theme.accent, children: "/" }), " paleta", ' ', _jsx(Text, { color: theme.accent, children: "^R" }), " racioc\u00EDnio", ' ', _jsx(Text, { color: theme.accent, children: "Tab" }), " modo", ' ', _jsx(Text, { color: theme.accent, children: "Esc" }), " abortar", ' ', _jsx(Text, { color: theme.accent, children: "^C" }), " sair"] })] }));
|
|
56
|
+
}
|
|
57
|
+
function ToolBlock({ part }) {
|
|
58
|
+
const t = part.tool;
|
|
59
|
+
const running = t?.status === 'running' || t?.status === 'pending';
|
|
60
|
+
const badge = running ? theme.warn : t?.status === 'error' ? theme.err : theme.dim;
|
|
61
|
+
const arg = clip(summarizeToolInput(t?.input), 48);
|
|
62
|
+
const outLine = (t?.output ?? '').split('\n').find((l) => l.trim()) ?? '';
|
|
63
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { color: theme.accent, children: [sym.dot, " "] }), _jsx(Text, { color: theme.text, children: t?.name ?? part.text }), arg ? _jsxs(Text, { color: theme.dim, children: ["(", arg, ")"] }) : null, ' ', _jsx(Text, { color: badge, children: t?.status ?? '' })] }), outLine && !running && (_jsxs(Text, { color: theme.dim, wrap: "truncate-end", children: [' ⎿ ', clip(outLine, 66)] }))] }));
|
|
64
|
+
}
|
|
65
|
+
const TODO_MARK = {
|
|
66
|
+
completed: '☑',
|
|
67
|
+
in_progress: '◐',
|
|
68
|
+
cancelled: '⊘',
|
|
69
|
+
pending: '☐',
|
|
70
|
+
};
|
|
71
|
+
function TodoList({ todos }) {
|
|
72
|
+
if (todos.length === 0)
|
|
73
|
+
return null;
|
|
74
|
+
return (_jsx(Box, { flexDirection: "column", children: todos.slice(0, 8).map((t, i) => (_jsxs(Text, { wrap: "truncate-end", color: t.status === 'completed'
|
|
75
|
+
? theme.dim
|
|
76
|
+
: t.status === 'in_progress'
|
|
77
|
+
? theme.warn
|
|
78
|
+
: t.status === 'cancelled'
|
|
79
|
+
? theme.dim
|
|
80
|
+
: theme.text, children: [' ', TODO_MARK[t.status] ?? '☐', " ", t.content] }, i))) }));
|
|
19
81
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
82
|
+
function UsageFooter({ usage, files = 0, }) {
|
|
83
|
+
const bits = [];
|
|
84
|
+
if (usage && (usage.tokensIn || usage.tokensOut))
|
|
85
|
+
bits.push(`↑${kfmt(usage.tokensIn)} ↓${kfmt(usage.tokensOut)}`);
|
|
86
|
+
if (usage && usage.cost > 0)
|
|
87
|
+
bits.push(`$${usage.cost.toFixed(3)}`);
|
|
88
|
+
if (files > 0)
|
|
89
|
+
bits.push(`${files} arquivo(s)`);
|
|
90
|
+
if (bits.length === 0)
|
|
91
|
+
return null;
|
|
92
|
+
return (_jsxs(Text, { color: theme.dim, wrap: "truncate-end", children: [' ', bits.join(' · ')] }));
|
|
27
93
|
}
|
|
28
94
|
function Author({ role }) {
|
|
29
|
-
return (_jsx(Text, { bold: true, color: role === 'user' ? theme.user : theme.accentBright, children: role === 'user' ?
|
|
95
|
+
return (_jsx(Text, { bold: true, color: role === 'user' ? theme.user : theme.accentBright, children: role === 'user' ? '> você' : '⏺ nio' }));
|
|
96
|
+
}
|
|
97
|
+
function ReasoningSummary({ text }) {
|
|
98
|
+
const lines = text.split('\n').map((l) => l.trim()).filter(Boolean);
|
|
99
|
+
if (lines.length === 0)
|
|
100
|
+
return null;
|
|
101
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: theme.dim, children: [' ✻ raciocínio', lines.length > 2 ? ` · ${lines.length} linhas` : ''] }), lines.slice(0, 2).map((l, i) => (_jsxs(Text, { color: theme.dim, wrap: "truncate-end", children: [' ', l] }, i)))] }));
|
|
30
102
|
}
|
|
31
103
|
function Part({ part }) {
|
|
104
|
+
if (part.kind === 'step')
|
|
105
|
+
return null;
|
|
32
106
|
if (part.kind === 'tool')
|
|
33
|
-
return _jsx(
|
|
34
|
-
if (part.kind === 'reasoning')
|
|
35
|
-
|
|
36
|
-
return t ? _jsxs(Text, { color: theme.dim, wrap: "truncate-end", children: [' ', sym.bullet, " ", t] }) : null;
|
|
37
|
-
}
|
|
107
|
+
return _jsx(ToolBlock, { part: part });
|
|
108
|
+
if (part.kind === 'reasoning')
|
|
109
|
+
return _jsx(ReasoningSummary, { text: part.text });
|
|
38
110
|
return part.text.trim() ? _jsx(Markdown, { text: part.text }) : null;
|
|
39
111
|
}
|
|
40
112
|
export function MessageView({ message }) {
|
|
41
|
-
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingX: 1, children: [_jsx(Author, { role: message.role }), message.parts.map((p) => (_jsx(Part, { part: p }, p.id)))] }));
|
|
113
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingX: 1, children: [_jsx(Author, { role: message.role }), message.parts.map((p) => (_jsx(Part, { part: p }, p.id))), message.role === 'assistant' && _jsx(UsageFooter, { usage: messageUsage(message) })] }));
|
|
42
114
|
}
|
|
43
|
-
export function LiveMessage({ message, maxLines, }) {
|
|
115
|
+
export function LiveMessage({ message, maxLines, todos = [], files = [], retry = null, expandReasoning = false, }) {
|
|
44
116
|
const text = message.parts.filter((p) => p.kind === 'text').map((p) => p.text).join('');
|
|
45
|
-
const
|
|
117
|
+
const reasoningRaw = message.parts
|
|
46
118
|
.filter((p) => p.kind === 'reasoning')
|
|
47
119
|
.map((p) => p.text)
|
|
48
|
-
.join('
|
|
49
|
-
.replace(/\s+/g, ' ')
|
|
120
|
+
.join('\n')
|
|
50
121
|
.trim();
|
|
51
|
-
const
|
|
122
|
+
const reasoningFlat = reasoningRaw.replace(/\s+/g, ' ');
|
|
123
|
+
const reasoningLines = reasoningRaw.split('\n').filter((l) => l.trim());
|
|
124
|
+
const allTools = message.parts.filter((p) => p.kind === 'tool');
|
|
125
|
+
const tools = allTools.slice(-4);
|
|
126
|
+
const toolsHidden = allTools.length - tools.length;
|
|
127
|
+
const reasoningShown = expandReasoning && reasoningLines.length
|
|
128
|
+
? reasoningLines.slice(-Math.min(10, Math.max(3, maxLines - 6)))
|
|
129
|
+
: [];
|
|
130
|
+
const chrome = Math.min(6, todos.length) + tools.length * 2 + (retry ? 1 : 0) + reasoningShown.length + 2;
|
|
131
|
+
const textBudget = Math.max(2, maxLines - chrome);
|
|
52
132
|
const lines = text.split('\n');
|
|
53
|
-
const shown = lines.slice(-
|
|
133
|
+
const shown = lines.slice(-textBudget);
|
|
54
134
|
const clipped = lines.length > shown.length;
|
|
55
|
-
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Author, { role: message.role }),
|
|
135
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Author, { role: message.role }), retry && (_jsxs(Text, { color: theme.warn, wrap: "truncate-end", children: [' ↻ tentativa ', retry.attempt, ' — ', retry.note] })), _jsx(TodoList, { todos: todos }), toolsHidden > 0 && (_jsx(Text, { color: theme.dim, children: ` · +${toolsHidden} ferramenta(s) acima` })), tools.map((t) => (_jsx(ToolBlock, { part: t }, t.id))), reasoningRaw && !expandReasoning && (_jsxs(Text, { color: theme.dim, wrap: "truncate-end", children: [' ✻ raciocínio ', _jsx(Text, { color: theme.accent, children: "Ctrl-R" }), ' ', reasoningFlat.slice(-120)] })), reasoningRaw && expandReasoning && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: theme.accent, children: [' ✻ raciocínio', reasoningLines.length > reasoningShown.length ? ` · ${reasoningLines.length} linhas` : ''] }), reasoningShown.map((l, i) => (_jsxs(Text, { color: theme.dim, wrap: "truncate-end", children: [' ', l] }, i)))] })), clipped && _jsx(Text, { color: theme.dim, children: " \u2026 (rolagem acima)" }), shown.map((l, i) => (_jsx(Text, { wrap: "truncate-end", children: l || ' ' }, i))), _jsx(UsageFooter, { usage: messageUsage(message), files: files.length })] }));
|
|
56
136
|
}
|
|
57
137
|
const FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
58
138
|
export function StatusLine({ busy, frame, seconds = 0, label = 'processando', }) {
|
|
@@ -62,76 +142,69 @@ export function StatusLine({ busy, frame, seconds = 0, label = 'processando', })
|
|
|
62
142
|
}
|
|
63
143
|
function SlashList({ items, sel }) {
|
|
64
144
|
const cur = items[sel];
|
|
65
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [items.length === 0 && _jsx(Text, { color: theme.dim, children: "nenhum comando casa" }), items.map((it, n) => (_jsxs(Text, { inverse: n === sel, color: n === sel ? theme.accentBright : undefined, wrap: "truncate-end", children: [' ', _jsxs(Text, { color: theme.dim, children: ["[", KIND_LABEL[it.kind], "]"] }), " ", it.name, " ", _jsx(Text, { color: theme.dim, children: it.desc })] }, `${it.kind}:${it.name}`))), _jsxs(Text, { color: theme.dim, children: ["\u2191\u2193 \u00B7 Enter
|
|
145
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [items.length === 0 && _jsx(Text, { color: theme.dim, children: "nenhum comando casa" }), items.map((it, n) => (_jsxs(Text, { inverse: n === sel, color: n === sel ? theme.accentBright : undefined, wrap: "truncate-end", children: [' ', _jsxs(Text, { color: theme.dim, children: ["[", KIND_LABEL[it.kind], "]"] }), " ", it.name, " ", _jsx(Text, { color: theme.dim, children: it.desc })] }, `${it.kind}:${it.name}`))), _jsxs(Text, { color: theme.dim, children: ["\u2191\u2193 \u00B7 Enter", ' ', cur?.kind === 'capability' ? 'manda pro agente' : cur?.kind === 'command' ? 'roda' : 'abre', " \u00B7 Esc sai"] })] }));
|
|
66
146
|
}
|
|
67
|
-
export function
|
|
68
|
-
|
|
69
|
-
|
|
147
|
+
export function defaultPaletteAction(kind) {
|
|
148
|
+
return kind === 'capability' ? 'prompt' : kind === 'command' ? 'run' : 'info';
|
|
149
|
+
}
|
|
150
|
+
export function InputBox({ value, onChange, disabled, active = true, palette, onSubmit, onDispatch, onCycleMode, options = [], width = 80, maxItems = 6, }) {
|
|
70
151
|
const [sel, setSel] = React.useState(0);
|
|
71
|
-
const
|
|
72
|
-
valueRef.current = fn(valueRef.current);
|
|
73
|
-
setValue(valueRef.current);
|
|
74
|
-
};
|
|
152
|
+
const [optSel, setOptSel] = React.useState(0);
|
|
75
153
|
const inPalette = value.startsWith('/');
|
|
76
|
-
const
|
|
154
|
+
const picking = active && options.length > 0 && value === '' && !inPalette;
|
|
155
|
+
const optSelC = Math.min(optSel, Math.max(0, options.length - 1));
|
|
156
|
+
const optsKey = options.join('|');
|
|
157
|
+
React.useEffect(() => {
|
|
158
|
+
setOptSel(0);
|
|
159
|
+
}, [optsKey]);
|
|
160
|
+
const matches = React.useMemo(() => (inPalette ? filterPalette(palette, value.slice(1)).slice(0, Math.max(1, maxItems)) : []), [inPalette, value, palette, maxItems]);
|
|
77
161
|
const selC = Math.min(sel, Math.max(0, matches.length - 1));
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const v = valueRef.current.trim();
|
|
82
|
-
set(() => '');
|
|
83
|
-
setSel(0);
|
|
84
|
-
if (v)
|
|
85
|
-
onSubmit(v);
|
|
86
|
-
};
|
|
87
|
-
const dispatch = (action) => {
|
|
88
|
-
const it = matches[selC];
|
|
89
|
-
if (!it)
|
|
90
|
-
return;
|
|
91
|
-
set(() => '');
|
|
162
|
+
const handleSubmit = (v) => {
|
|
163
|
+
const t = v.trim();
|
|
164
|
+
onChange('');
|
|
92
165
|
setSel(0);
|
|
93
|
-
|
|
166
|
+
if (t)
|
|
167
|
+
onSubmit(t);
|
|
94
168
|
};
|
|
95
|
-
|
|
96
|
-
if (
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
169
|
+
const handleNav = (dir) => {
|
|
170
|
+
if (picking) {
|
|
171
|
+
if (dir === 'up')
|
|
172
|
+
return setOptSel((n) => Math.max(0, n - 1));
|
|
173
|
+
if (dir === 'down')
|
|
174
|
+
return setOptSel((n) => Math.min(options.length - 1, n + 1));
|
|
175
|
+
if (dir === 'cancel')
|
|
176
|
+
return;
|
|
177
|
+
const chosen = options[optSelC];
|
|
178
|
+
if (chosen) {
|
|
179
|
+
setOptSel(0);
|
|
180
|
+
onSubmit(chosen);
|
|
107
181
|
}
|
|
108
182
|
return;
|
|
109
183
|
}
|
|
110
|
-
if (
|
|
184
|
+
if (dir === 'up')
|
|
111
185
|
return setSel((n) => Math.max(0, n - 1));
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (key.return) {
|
|
118
|
-
if (inPalette)
|
|
119
|
-
return dispatch(matches[selC]?.kind === 'capability' ? 'prompt' : 'info');
|
|
120
|
-
return submit();
|
|
186
|
+
if (dir === 'down')
|
|
187
|
+
return setSel((n) => Math.min(matches.length - 1, n + 1));
|
|
188
|
+
if (dir === 'cancel') {
|
|
189
|
+
onChange('');
|
|
190
|
+
return setSel(0);
|
|
121
191
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
192
|
+
const it = matches[selC];
|
|
193
|
+
if (!it)
|
|
194
|
+
return;
|
|
195
|
+
onChange('');
|
|
196
|
+
setSel(0);
|
|
197
|
+
onDispatch(it, defaultPaletteAction(it.kind));
|
|
198
|
+
};
|
|
199
|
+
const handleChange = (v) => {
|
|
200
|
+
onChange(v);
|
|
201
|
+
if (v.startsWith('/'))
|
|
129
202
|
setSel(0);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
203
|
+
};
|
|
204
|
+
return (_jsxs(Box, { flexDirection: "column", children: [picking && _jsx(QuestionPicker, { options: options, sel: optSelC }), _jsx(PromptInput, { value: value, onChange: handleChange, onSubmit: handleSubmit, navCapture: (inPalette || picking) && active, onNav: handleNav, onTab: onCycleMode, disabled: disabled, active: active, width: width, placeholder: disabled
|
|
205
|
+
? '(pode digitar; envia quando a resposta terminar)'
|
|
206
|
+
: picking
|
|
207
|
+
? '↑↓ pra escolher, ou digite'
|
|
208
|
+
: '', borderColor: disabled ? theme.dim : inPalette || picking ? theme.accentBright : theme.accent }), inPalette && active && _jsx(SlashList, { items: matches, sel: selC })] }));
|
|
136
209
|
}
|
|
137
210
|
//# sourceMappingURL=components.js.map
|