@hncode/hncode 0.1.3 → 0.1.4

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 CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "@hncode/hncode",
3
- "version": "0.1.3",
4
- "description": "hncode — A cyan-blue TUI AI coding agent with zero runtime dependencies.",
5
- "type": "module",
6
- "main": "src/index.js",
7
- "bin": {
8
- "hncode": "bin/hncode"
9
- },
10
- "files": [
11
- "bin/",
12
- "src/",
13
- "LICENSE",
14
- "README.md",
15
- "README_CN.md",
16
- "package.json"
17
- ],
18
- "scripts": {
19
- "preinstall": "node bin/preinstall.js",
20
- "install": "node bin/install.js"
21
- },
22
- "engines": {
23
- "node": ">=20"
24
- },
25
- "license": "GPL-3.0-only",
26
- "author": "NiceHello666",
27
- "keywords": [
28
- "cli",
29
- "agent",
30
- "coding",
31
- "ai",
32
- "tui"
33
- ],
34
- "dependencies": {}
35
- }
1
+ {
2
+ "name": "@hncode/hncode",
3
+ "version": "0.1.4",
4
+ "description": "hncode — A cyan-blue TUI AI coding agent with zero runtime dependencies.",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "bin": {
8
+ "hncode": "bin/hncode"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "src/",
13
+ "LICENSE",
14
+ "README.md",
15
+ "README_CN.md",
16
+ "package.json"
17
+ ],
18
+ "scripts": {
19
+ "preinstall": "node bin/preinstall.js",
20
+ "install": "node bin/install.js"
21
+ },
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
25
+ "license": "GPL-3.0-only",
26
+ "author": "NiceHello666",
27
+ "keywords": [
28
+ "cli",
29
+ "agent",
30
+ "coding",
31
+ "ai",
32
+ "tui"
33
+ ],
34
+ "dependencies": {}
35
+ }
package/src/tui.js CHANGED
@@ -4262,7 +4262,7 @@ export async function startTUI(opts) {
4262
4262
  }
4263
4263
  // Async so the notice can be painted BEFORE the clipboard read: a cold
4264
4264
  // PowerShell took ~3s, which read as "the shortcut does nothing".
4265
- async function pasteFromClipboard() {
4265
+ async function pasteFromClipboard(fastPathOnly = false) {
4266
4266
  notice('Pasting…', 'info');
4267
4267
  const imgBase64 = readImage();
4268
4268
  if (imgBase64) {
@@ -4272,10 +4272,26 @@ export async function startTUI(opts) {
4272
4272
  renderFrame();
4273
4273
  return;
4274
4274
  }
4275
- const { text, via } = await readText();
4275
+
4276
+ let text = '';
4277
+ let via = 'none';
4278
+
4279
+ // Try fast path first (oneshot)
4280
+ try {
4281
+ ({ text, via } = { text: readOnce(), via: 'oneshot' });
4282
+ } catch {}
4283
+
4284
+ // If fast path failed and we need to try slow path
4285
+ if (!text && !fastPathOnly) {
4286
+ const result = await readText();
4287
+ text = result.text;
4288
+ via = result.via;
4289
+ }
4290
+
4276
4291
  if (!text) { notice('Clipboard empty or unavailable', 'error'); renderFrame(); return; }
4277
4292
  insertComposerPaste(text);
4278
- if (via === 'oneshot') notice(`Pasted (slow path: ${via}); retry for instant paste`, 'info');
4293
+ if (via === 'helper') notice(`Pasted via helper (${via})`, 'info');
4294
+ else if (via === 'oneshot') notice('Pasted instantly!', 'info');
4279
4295
  renderFrame();
4280
4296
  }
4281
4297
  // Ctrl-S: inject the queued messages (plus the current draft) into the RUNNING