@causyne/agent 1.17.0 → 1.19.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/package.json +1 -1
- package/src/agentLoop.js +2348 -2518
- package/src/agentLoop.ts +2865 -0
- package/src/checkpoints.d.ts +4 -0
- package/src/cliMode.js +10 -3
- package/src/commands.js +274 -25
- package/src/config.js +22 -0
- package/src/contextManager.d.ts +10 -0
- package/src/continuum/adapters/antigravity.js +193 -0
- package/src/continuum/adapters/antigravity.ts +204 -0
- package/src/continuum/adapters/base.js +48 -0
- package/src/continuum/adapters/base.ts +57 -0
- package/src/continuum/adapters/causyne.js +66 -0
- package/src/continuum/adapters/causyne.ts +72 -0
- package/src/continuum/adapters/claudeCode.js +171 -0
- package/src/continuum/adapters/claudeCode.ts +179 -0
- package/src/continuum/adapters/codex.js +181 -0
- package/src/continuum/adapters/codex.ts +193 -0
- package/src/continuum/adapters/opencode.js +134 -0
- package/src/continuum/adapters/opencode.ts +153 -0
- package/src/continuum/compactor.js +54 -0
- package/src/continuum/compactor.ts +83 -0
- package/src/continuum/index.js +8 -0
- package/src/continuum/index.ts +9 -0
- package/src/continuum/ingest.js +63 -0
- package/src/continuum/ingest.ts +89 -0
- package/src/continuum/sanitizer.js +55 -0
- package/src/continuum/sanitizer.ts +59 -0
- package/src/continuum/scanner.js +86 -0
- package/src/continuum/scanner.ts +106 -0
- package/src/continuum/types.js +3 -0
- package/src/continuum/types.ts +51 -0
- package/src/continuum/ui/continuumPicker.js +111 -0
- package/src/continuum/ui/continuumPicker.ts +145 -0
- package/src/cortex/autoCondenser.d.ts +2 -0
- package/src/cortex/vectorDb.d.ts +1 -0
- package/src/designPalettes.d.ts +2 -0
- package/src/devMode.d.ts +1 -0
- package/src/dynamicCatalogue.js +140 -1
- package/src/dynamicCatalogue.ts +179 -1
- package/src/embodimentSession.d.ts +2 -0
- package/src/entrypoint.js +12 -0
- package/src/memory.d.ts +1 -0
- package/src/memoryManager.d.ts +1 -0
- package/src/modelIds.d.ts +2 -0
- package/src/outputStore.d.ts +4 -0
- package/src/providers/acp.js +321 -267
- package/src/providers/acp.ts +360 -0
- package/src/providers/antigravity.js +389 -239
- package/src/providers/antigravity.ts +450 -0
- package/src/providers/base.d.ts +68 -0
- package/src/providers/factory.d.ts +1 -0
- package/src/provisioning/capabilityProvisioner.d.ts +2 -0
- package/src/sandbox.d.ts +1 -0
- package/src/skillsManager.d.ts +3 -0
- package/src/slopDetector.d.ts +3 -0
- package/src/taskBuffer.d.ts +1 -0
- package/src/tokenTracker.d.ts +1 -0
- package/src/toolPacks.d.ts +8 -0
- package/src/tools/registry.d.ts +4 -0
- package/src/tui/chatRenderer.js +71 -12
- package/src/tui/clipboardSync.js +36 -0
- package/src/tui/clipboardSync.ts +36 -0
- package/src/tui/dialogs.js +15 -2
- package/src/tui/home.js +27 -25
- package/src/tui/modelPicker.js +221 -0
- package/src/tui/modelPicker.ts +290 -0
- package/src/tui/prompt.js +17 -6
- package/src/tui/selectList.js +20 -0
- package/src/tui/theme.js +4 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
// Sovereign Interactive Model Picker — modal dialog for ACP & BYOK models.
|
|
2
|
+
//
|
|
3
|
+
// Pure Node over ./dialogs.js, ../dynamicCatalogue.js, and ../config.js.
|
|
4
|
+
// No shell, zero malware, source-available under BUSL-1.1.
|
|
5
|
+
|
|
6
|
+
// @ts-expect-error untyped local TUI dialogs
|
|
7
|
+
import { SelectLayer, InputLayer } from './dialogs.js';
|
|
8
|
+
import { loadConfig, saveConfig } from '../config.js';
|
|
9
|
+
import { getAvailableProvidersOverview, type ProviderOverview } from '../dynamicCatalogue.js';
|
|
10
|
+
|
|
11
|
+
export interface ModelPickerItemValue {
|
|
12
|
+
type: 'acp' | 'byok';
|
|
13
|
+
providerId: string;
|
|
14
|
+
modelId: string;
|
|
15
|
+
providerLabel: string;
|
|
16
|
+
installed: boolean;
|
|
17
|
+
isCurrent: boolean;
|
|
18
|
+
isConfigured: boolean;
|
|
19
|
+
envVar?: string | undefined;
|
|
20
|
+
setupInstruction?: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ModelPickerItem {
|
|
24
|
+
id: string;
|
|
25
|
+
label: string;
|
|
26
|
+
category: string;
|
|
27
|
+
description: string;
|
|
28
|
+
value: ModelPickerItemValue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ConfigStore {
|
|
32
|
+
loadConfig(): Record<string, any>;
|
|
33
|
+
saveConfig(config: Record<string, any>): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface PromptHost {
|
|
37
|
+
openLayer(layer: unknown): void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface InteractiveModelPickerOptions {
|
|
41
|
+
loop?: {
|
|
42
|
+
config?: Record<string, any>;
|
|
43
|
+
updateTierLimits?: () => void;
|
|
44
|
+
initializeProvider?: () => any;
|
|
45
|
+
llm?: any;
|
|
46
|
+
_utilityLlm?: any;
|
|
47
|
+
} | undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function showConfiguringAnimation(providerLabel: string): Promise<void> {
|
|
51
|
+
if (!process.stdout.isTTY) return;
|
|
52
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
53
|
+
const text = `Configuring ${providerLabel} in secure local vault…`;
|
|
54
|
+
for (let i = 0; i < 5; i++) {
|
|
55
|
+
const f = frames[i % frames.length];
|
|
56
|
+
process.stdout.write(`\r \x1b[36m${f}\x1b[0m ${text}`);
|
|
57
|
+
await new Promise(r => setTimeout(r, 60));
|
|
58
|
+
}
|
|
59
|
+
process.stdout.write(`\r\x1b[K \x1b[32m✓\x1b[0m ${providerLabel} credentials saved.\n`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Build items for SelectLayer categorized by ACP peers and BYOK providers.
|
|
64
|
+
*/
|
|
65
|
+
export function buildModelPickerItems(
|
|
66
|
+
config: { provider?: string; model?: string; apiKey?: string; providerKeys?: Record<string, string> },
|
|
67
|
+
overview: ProviderOverview
|
|
68
|
+
): ModelPickerItem[] {
|
|
69
|
+
const items: ModelPickerItem[] = [];
|
|
70
|
+
const activeProvider = config.provider || '';
|
|
71
|
+
const activeModel = config.model || '';
|
|
72
|
+
|
|
73
|
+
// 1. ACP Peer Agents & Sovereign Local Engines
|
|
74
|
+
for (const peer of overview.acp) {
|
|
75
|
+
const isCurrentProvider = activeProvider === peer.providerKey;
|
|
76
|
+
const catTitle = peer.installed
|
|
77
|
+
? `ACP · ${peer.label} (ready)`
|
|
78
|
+
: `ACP · ${peer.label} (not installed)`;
|
|
79
|
+
|
|
80
|
+
if (peer.installed && Array.isArray(peer.models) && peer.models.length > 0) {
|
|
81
|
+
for (const m of peer.models) {
|
|
82
|
+
const isCurrent = isCurrentProvider && activeModel === m;
|
|
83
|
+
items.push({
|
|
84
|
+
id: `${peer.providerKey}/${m}`,
|
|
85
|
+
label: m,
|
|
86
|
+
category: catTitle,
|
|
87
|
+
description: isCurrent ? '● active' : 'ready',
|
|
88
|
+
value: {
|
|
89
|
+
type: 'acp',
|
|
90
|
+
providerId: peer.providerKey,
|
|
91
|
+
modelId: m,
|
|
92
|
+
providerLabel: peer.label,
|
|
93
|
+
installed: true,
|
|
94
|
+
isCurrent,
|
|
95
|
+
isConfigured: true,
|
|
96
|
+
setupInstruction: peer.setupInstruction
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
// Uninstalled ACP agent: show entry so user can see it's supported
|
|
102
|
+
items.push({
|
|
103
|
+
id: `${peer.providerKey}:uninstalled`,
|
|
104
|
+
label: peer.label,
|
|
105
|
+
category: catTitle,
|
|
106
|
+
description: 'not installed — setup needed',
|
|
107
|
+
value: {
|
|
108
|
+
type: 'acp',
|
|
109
|
+
providerId: peer.providerKey,
|
|
110
|
+
modelId: peer.models[0] || peer.id,
|
|
111
|
+
providerLabel: peer.label,
|
|
112
|
+
installed: false,
|
|
113
|
+
isCurrent: false,
|
|
114
|
+
isConfigured: false,
|
|
115
|
+
setupInstruction: peer.setupInstruction
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 2. BYOK Providers (Cloud & Local APIs)
|
|
122
|
+
for (const p of overview.byok) {
|
|
123
|
+
const isCurrentProvider = activeProvider === p.id || (p.id === 'qwen' && activeProvider === 'dashscope-byok');
|
|
124
|
+
const catTitle = p.id === 'ollama'
|
|
125
|
+
? `BYOK · ${p.label}`
|
|
126
|
+
: `BYOK · ${p.label} ${p.isConfigured ? '(configured)' : '(needs key)'}`;
|
|
127
|
+
|
|
128
|
+
const models = Array.isArray(p.models) && p.models.length > 0 ? p.models : [p.defaultModel];
|
|
129
|
+
for (const m of models) {
|
|
130
|
+
const isCurrent = isCurrentProvider && activeModel === m;
|
|
131
|
+
const desc = isCurrent ? '● active' : (p.id === 'ollama' ? 'local' : (p.isConfigured ? 'configured' : 'needs API key'));
|
|
132
|
+
items.push({
|
|
133
|
+
id: `${p.id}/${m}`,
|
|
134
|
+
label: m,
|
|
135
|
+
category: catTitle,
|
|
136
|
+
description: desc,
|
|
137
|
+
value: {
|
|
138
|
+
type: 'byok',
|
|
139
|
+
providerId: p.id,
|
|
140
|
+
modelId: m,
|
|
141
|
+
providerLabel: p.label,
|
|
142
|
+
installed: true,
|
|
143
|
+
isCurrent,
|
|
144
|
+
isConfigured: p.isConfigured,
|
|
145
|
+
envVar: p.envVar
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return items;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Run interactive model picker in the provided TUI prompt.
|
|
156
|
+
*
|
|
157
|
+
* Automatically handles:
|
|
158
|
+
* - Direct selection of ACP models without prompting for an API key.
|
|
159
|
+
* - Direct selection of configured BYOK models without prompting for an API key.
|
|
160
|
+
* - InputLayer modal prompt for API key when selecting an unconfigured BYOK model,
|
|
161
|
+
* safely encrypting it into ~/.causyne/config.json.
|
|
162
|
+
* - Synchronous runtime loop re-initialization so the live session switches immediately.
|
|
163
|
+
*/
|
|
164
|
+
export async function runInteractiveModelPicker(
|
|
165
|
+
prompt: PromptHost,
|
|
166
|
+
store: ConfigStore = { loadConfig, saveConfig },
|
|
167
|
+
options: InteractiveModelPickerOptions = {}
|
|
168
|
+
): Promise<string> {
|
|
169
|
+
if (!prompt || typeof prompt.openLayer !== 'function') {
|
|
170
|
+
return 'Run causyne in an interactive terminal to use the model picker.';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const config = store.loadConfig();
|
|
174
|
+
const overview = getAvailableProvidersOverview(config);
|
|
175
|
+
const items = buildModelPickerItems(config, overview);
|
|
176
|
+
|
|
177
|
+
const picked = await new Promise<ModelPickerItem | null>((resolve) => {
|
|
178
|
+
const layer = new SelectLayer({
|
|
179
|
+
title: 'Select Model',
|
|
180
|
+
placeholder: 'type to filter (e.g. gemini, sonnet, opencode)…',
|
|
181
|
+
emptyText: 'No models matched your search',
|
|
182
|
+
items,
|
|
183
|
+
width: 76,
|
|
184
|
+
height: 20,
|
|
185
|
+
onPick: resolve
|
|
186
|
+
});
|
|
187
|
+
prompt.openLayer(layer);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
if (!picked || !picked.value) {
|
|
191
|
+
return 'Cancelled. Model was not changed.';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const target = picked.value;
|
|
195
|
+
|
|
196
|
+
// Case 1: ACP Peer Agent or Antigravity
|
|
197
|
+
if (target.type === 'acp') {
|
|
198
|
+
if (!target.installed) {
|
|
199
|
+
return (
|
|
200
|
+
`⚠️ Notice: "${target.providerLabel}" is not installed on this machine.\n` +
|
|
201
|
+
`Setup: ${target.setupInstruction || 'Install the CLI binary.'}\n\n` +
|
|
202
|
+
`Model was not changed.`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
config['provider'] = target.providerId;
|
|
207
|
+
config['model'] = target.modelId;
|
|
208
|
+
config['apiKey'] = '';
|
|
209
|
+
delete config['baseUrl'];
|
|
210
|
+
store.saveConfig(config);
|
|
211
|
+
|
|
212
|
+
if (options.loop) {
|
|
213
|
+
options.loop.config = config;
|
|
214
|
+
if (typeof options.loop.updateTierLimits === 'function') {
|
|
215
|
+
options.loop.updateTierLimits();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return `Now using ${target.providerLabel} / ${target.modelId}.`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Case 2: BYOK Provider (Cloud or Local API)
|
|
222
|
+
let existingKey = '';
|
|
223
|
+
const providerKeys: Record<string, string> = (config['providerKeys'] && typeof config['providerKeys'] === 'object') ? config['providerKeys'] : {};
|
|
224
|
+
if (config['provider'] === target.providerId && typeof config['apiKey'] === 'string' && config['apiKey']) {
|
|
225
|
+
existingKey = config['apiKey'];
|
|
226
|
+
} else if (providerKeys[target.providerId] || (target.providerId === 'qwen' && providerKeys['dashscope-byok'])) {
|
|
227
|
+
existingKey = providerKeys[target.providerId] || providerKeys['dashscope-byok'] || '';
|
|
228
|
+
} else if (target.envVar && process.env[target.envVar]) {
|
|
229
|
+
existingKey = process.env[target.envVar] || '';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// If provider is Ollama (needs no key) or key is already present
|
|
233
|
+
if (target.providerId === 'ollama' || existingKey) {
|
|
234
|
+
config['provider'] = target.providerId;
|
|
235
|
+
config['model'] = target.modelId;
|
|
236
|
+
if (existingKey) {
|
|
237
|
+
config['apiKey'] = existingKey;
|
|
238
|
+
config['providerKeys'] = providerKeys;
|
|
239
|
+
config['providerKeys'][target.providerId] = existingKey;
|
|
240
|
+
}
|
|
241
|
+
store.saveConfig(config);
|
|
242
|
+
|
|
243
|
+
if (options.loop) {
|
|
244
|
+
options.loop.config = config;
|
|
245
|
+
if (typeof options.loop.updateTierLimits === 'function') {
|
|
246
|
+
options.loop.updateTierLimits();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return `Now using ${target.providerLabel} / ${target.modelId}.`;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Key is required: open modal input dialog (InputLayer)
|
|
253
|
+
const enteredKey = await new Promise<string | null>((resolve) => {
|
|
254
|
+
const layer = new InputLayer({
|
|
255
|
+
title: `Set API Key · ${target.providerLabel}`,
|
|
256
|
+
lines: [
|
|
257
|
+
`Enter your ${target.providerLabel} API key to use ${target.modelId}.`,
|
|
258
|
+
'Stored encrypted in your local vault (~/.causyne/config.json).'
|
|
259
|
+
],
|
|
260
|
+
mask: true,
|
|
261
|
+
placeholder: 'paste API key (Esc to cancel)',
|
|
262
|
+
onSubmit: resolve,
|
|
263
|
+
onCancel: () => resolve(null)
|
|
264
|
+
});
|
|
265
|
+
prompt.openLayer(layer);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
if (!enteredKey || !enteredKey.trim()) {
|
|
269
|
+
return `Cancelled. An API key is required to use ${target.providerLabel} / ${target.modelId}. Model was not changed.`;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const cleanKey = enteredKey.trim();
|
|
273
|
+
await showConfiguringAnimation(target.providerLabel);
|
|
274
|
+
|
|
275
|
+
config['provider'] = target.providerId;
|
|
276
|
+
config['model'] = target.modelId;
|
|
277
|
+
config['apiKey'] = cleanKey;
|
|
278
|
+
config['providerKeys'] = providerKeys;
|
|
279
|
+
config['providerKeys'][target.providerId] = cleanKey;
|
|
280
|
+
store.saveConfig(config);
|
|
281
|
+
|
|
282
|
+
if (options.loop) {
|
|
283
|
+
options.loop.config = config;
|
|
284
|
+
if (typeof options.loop.updateTierLimits === 'function') {
|
|
285
|
+
options.loop.updateTierLimits();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return `Saved API key. Now using ${target.providerLabel} / ${target.modelId}.`;
|
|
290
|
+
}
|
package/src/tui/prompt.js
CHANGED
|
@@ -28,6 +28,7 @@ import { pickExample, fitHints } from './banner.js';
|
|
|
28
28
|
import { panelRows } from './overlay.js';
|
|
29
29
|
import { commandPalette, skillPicker, ApprovalLayer, DecisionLayer, ConfirmLayer, HomeLayer, TextLayer } from './dialogs.js';
|
|
30
30
|
import { describeTool } from './toolDisplay.js';
|
|
31
|
+
import { readClipboardSync } from './clipboardSync.js';
|
|
31
32
|
|
|
32
33
|
const CTRL_C_WINDOW_MS = 2000;
|
|
33
34
|
|
|
@@ -638,12 +639,6 @@ export class ChatPrompt {
|
|
|
638
639
|
if (this.surface.captureMouse() && this.notice.startsWith('top of this view')) this.notice = '';
|
|
639
640
|
}
|
|
640
641
|
|
|
641
|
-
if (key.name === 'paste') {
|
|
642
|
-
this.editor.insert(key.text);
|
|
643
|
-
this.refreshCompletion();
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
642
|
if (key.ctrl && key.name === 'c') {
|
|
648
643
|
// A modal owns the screen, so ctrl+c must dismiss THAT before it touches
|
|
649
644
|
// the turn behind it. closeLayer() answers false, which is what makes
|
|
@@ -662,6 +657,8 @@ export class ChatPrompt {
|
|
|
662
657
|
|
|
663
658
|
// A dialog owns the keyboard while it is up — the editor must not also see
|
|
664
659
|
// the keystroke, or typing a filter would edit the message behind it.
|
|
660
|
+
// This MUST route before any default key handling (like paste) so modal
|
|
661
|
+
// dialogs (e.g. InputLayer for API keys) receive bracketed paste events.
|
|
665
662
|
if (this.layer) {
|
|
666
663
|
const action = this.layer.key(key);
|
|
667
664
|
if (action === 'close') { this.closeLayer(); return; }
|
|
@@ -676,6 +673,12 @@ export class ChatPrompt {
|
|
|
676
673
|
else if (action !== 'passthrough') return;
|
|
677
674
|
}
|
|
678
675
|
|
|
676
|
+
if (key.name === 'paste') {
|
|
677
|
+
this.editor.insert(key.text);
|
|
678
|
+
this.refreshCompletion();
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
|
|
679
682
|
if (this.completion && this.handleCompletionKey(key)) return;
|
|
680
683
|
if (this.handleScrollKey(key)) return;
|
|
681
684
|
|
|
@@ -712,6 +715,14 @@ export class ChatPrompt {
|
|
|
712
715
|
case 'p': return this.openPalette();
|
|
713
716
|
case 'l': return this.clearScreen();
|
|
714
717
|
case 'o': return this.expand();
|
|
718
|
+
case 'v': {
|
|
719
|
+
const text = readClipboardSync();
|
|
720
|
+
if (text) {
|
|
721
|
+
this.editor.insert(text);
|
|
722
|
+
this.refreshCompletion();
|
|
723
|
+
}
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
715
726
|
default: break;
|
|
716
727
|
}
|
|
717
728
|
}
|
package/src/tui/selectList.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { paint, bold, dim, GLYPHS } from './theme.js';
|
|
18
18
|
import { truncate, visibleWidth, safeDisplay } from './text.js';
|
|
19
|
+
import { readClipboardSync } from './clipboardSync.js';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Score `query` against `text` as a fuzzy subsequence.
|
|
@@ -223,6 +224,14 @@ export class SelectList {
|
|
|
223
224
|
return 'handled';
|
|
224
225
|
}
|
|
225
226
|
return 'cancel';
|
|
227
|
+
case 'paste': {
|
|
228
|
+
const clean = String(key.text || '').replace(/[\r\n]+/g, ' ').trim();
|
|
229
|
+
if (clean) {
|
|
230
|
+
this.query += clean;
|
|
231
|
+
this.refilter();
|
|
232
|
+
}
|
|
233
|
+
return 'handled';
|
|
234
|
+
}
|
|
226
235
|
default: break;
|
|
227
236
|
}
|
|
228
237
|
|
|
@@ -231,6 +240,17 @@ export class SelectList {
|
|
|
231
240
|
if (key.name === 'p') { this.move(-1, rows); return 'handled'; }
|
|
232
241
|
if (key.name === 'n') { this.move(1, rows); return 'handled'; }
|
|
233
242
|
if (key.name === 'u') { this.query = ''; this.refilter(); return 'handled'; }
|
|
243
|
+
if (key.name === 'v') {
|
|
244
|
+
const text = readClipboardSync();
|
|
245
|
+
if (text) {
|
|
246
|
+
const clean = String(text).replace(/[\r\n]+/g, ' ').trim();
|
|
247
|
+
if (clean) {
|
|
248
|
+
this.query += clean;
|
|
249
|
+
this.refilter();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return 'handled';
|
|
253
|
+
}
|
|
234
254
|
return null;
|
|
235
255
|
}
|
|
236
256
|
|
package/src/tui/theme.js
CHANGED
|
@@ -347,6 +347,10 @@ export function safeLink(text, url) {
|
|
|
347
347
|
} catch (e) {
|
|
348
348
|
return String(text);
|
|
349
349
|
}
|
|
350
|
+
if (parsed.protocol === 'file:') {
|
|
351
|
+
const safeUrl = encodeURI(parsed.href).replace(/[\x00-\x1f\x7f]/g, '');
|
|
352
|
+
return `\x1b]8;;${safeUrl}\x1b\\${text}\x1b]8;;\x1b\\`;
|
|
353
|
+
}
|
|
350
354
|
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return String(text);
|
|
351
355
|
if (!parsed.hostname) return String(text);
|
|
352
356
|
|