@narumitw/pi-notes 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/note-picker.ts +14 -37
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-notes",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Pi extension for managing global Markdown notes with an isolated embedded agent.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  "typecheck": "tsc --noEmit"
30
30
  },
31
31
  "dependencies": {
32
- "@narumitw/pi-tui-kit": "^0.65.1"
32
+ "@narumitw/pi-tui-kit": "^0.66.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@earendil-works/pi-ai": "*",
@@ -37,9 +37,9 @@
37
37
  "@earendil-works/pi-tui": "*"
38
38
  },
39
39
  "devDependencies": {
40
- "@earendil-works/pi-ai": "0.86.0",
41
- "@earendil-works/pi-coding-agent": "0.86.0",
42
- "@earendil-works/pi-tui": "0.86.0",
40
+ "@earendil-works/pi-ai": "1.3.0",
41
+ "@earendil-works/pi-coding-agent": "1.3.0",
42
+ "@earendil-works/pi-tui": "1.3.0",
43
43
  "typescript": "7.0.2"
44
44
  },
45
45
  "repository": {
@@ -16,7 +16,13 @@ import {
16
16
  visibleWidth,
17
17
  wrapTextWithAnsi,
18
18
  } from "@earendil-works/pi-tui";
19
- import { formatInteractionHints, HorizontalRule, renderBoundedFrame, sanitizeTerminalText } from "@narumitw/pi-tui-kit";
19
+ import {
20
+ canonicalizeConfiguredKey,
21
+ formatInteractionHints,
22
+ HorizontalRule,
23
+ renderBoundedFrame,
24
+ sanitizeTerminalText,
25
+ } from "@narumitw/pi-tui-kit";
20
26
  import type { MarkdownEntry } from "./storage.js";
21
27
 
22
28
  const BRACKETED_PASTE_START = "\u001b[200~";
@@ -64,25 +70,6 @@ const SEARCH_INPUT_BINDINGS = [
64
70
  ] as const;
65
71
 
66
72
  const MODIFIERS = ["shift", "alt", "ctrl", "super"] as const;
67
- const SYMBOLS = "`-=[]\\;',./!@#$%^&*()_|~{}:<>?";
68
- const SPECIAL_KEYS = new Set([
69
- "escape",
70
- "enter",
71
- "tab",
72
- "space",
73
- "backspace",
74
- "insert",
75
- "delete",
76
- "clear",
77
- "home",
78
- "end",
79
- "pageup",
80
- "pagedown",
81
- "left",
82
- "right",
83
- "up",
84
- "down",
85
- ]);
86
73
  const FUNCTION_INPUTS = ["OP", "OQ", "OR", "OS", "[15~", "[17~", "[18~", "[19~", "[20~", "[21~", "[23~", "[24~"];
87
74
  const LEGACY_INPUTS = [
88
75
  ...Array.from({ length: 128 }, (_, code) => String.fromCharCode(code)),
@@ -670,23 +657,13 @@ export function resolveNoteDeleteKey(
670
657
  }
671
658
 
672
659
  function normalizeKey(value: unknown): string | undefined {
673
- if (typeof value !== "string" || value.length > 80 || /[\s\p{Cc}]/u.test(value)) return undefined;
674
- const parts = value.toLowerCase().split("+");
675
- let base = parts.pop();
676
- if (!base) return undefined;
677
- if (base === "esc") base = "escape";
678
- if (base === "return") base = "enter";
679
- if (new Set(parts).size !== parts.length || parts.some((part) => !MODIFIERS.includes(part as never)))
680
- return undefined;
681
- if (
682
- !SPECIAL_KEYS.has(base) &&
683
- !/^f(?:[1-9]|1[0-2])$/u.test(base) &&
684
- !(base.length === 1 && (/^[a-z0-9]$/u.test(base) || SYMBOLS.includes(base)))
685
- )
686
- return undefined;
687
- if ((base === "escape" || /^f(?:[1-9]|1[0-2])$/u.test(base)) && parts.length > 0) return undefined;
688
- if (base === "clear" && (parts.length > 1 || (parts.length === 1 && !["ctrl", "shift"].includes(parts[0] ?? ""))))
689
- return undefined;
660
+ // Retain the picker's existing admission and protocol-lookup spelling. Kit
661
+ // also accepts literal '+', which this picker has never admitted.
662
+ if (typeof value !== "string" || value.length > 80 || value.endsWith("+")) return undefined;
663
+ const canonical = canonicalizeConfiguredKey(value);
664
+ if (!canonical) return undefined;
665
+ const parts = canonical.toLowerCase().split("+");
666
+ const base = parts.pop();
690
667
  return [...MODIFIERS.filter((modifier) => parts.includes(modifier)), base].join("+");
691
668
  }
692
669