@kolisachint/hoocode-agent 0.5.55 → 0.5.57

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 (80) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/core/keybindings.d.ts +12 -12
  3. package/dist/core/keybindings.d.ts.map +1 -1
  4. package/dist/core/keybindings.js +17 -16
  5. package/dist/core/keybindings.js.map +1 -1
  6. package/dist/core/session-identity.d.ts +11 -0
  7. package/dist/core/session-identity.d.ts.map +1 -1
  8. package/dist/core/session-identity.js +16 -0
  9. package/dist/core/session-identity.js.map +1 -1
  10. package/dist/core/settings-defaults.d.ts +1 -1
  11. package/dist/core/settings-defaults.d.ts.map +1 -1
  12. package/dist/core/settings-defaults.js +1 -1
  13. package/dist/core/settings-defaults.js.map +1 -1
  14. package/dist/core/settings-manager.d.ts +1 -1
  15. package/dist/core/settings-manager.d.ts.map +1 -1
  16. package/dist/core/settings-manager.js +1 -1
  17. package/dist/core/settings-manager.js.map +1 -1
  18. package/dist/core/settings-types.d.ts +1 -1
  19. package/dist/core/settings-types.d.ts.map +1 -1
  20. package/dist/core/settings-types.js.map +1 -1
  21. package/dist/core/tool-output-view.d.ts +28 -10
  22. package/dist/core/tool-output-view.d.ts.map +1 -1
  23. package/dist/core/tool-output-view.js +24 -9
  24. package/dist/core/tool-output-view.js.map +1 -1
  25. package/dist/core/tools/bash.d.ts.map +1 -1
  26. package/dist/core/tools/bash.js +2 -2
  27. package/dist/core/tools/bash.js.map +1 -1
  28. package/dist/core/tools/plugins.d.ts.map +1 -1
  29. package/dist/core/tools/plugins.js +2 -1
  30. package/dist/core/tools/plugins.js.map +1 -1
  31. package/dist/core/tools/read.d.ts.map +1 -1
  32. package/dist/core/tools/read.js +2 -1
  33. package/dist/core/tools/read.js.map +1 -1
  34. package/dist/core/tools/search.d.ts.map +1 -1
  35. package/dist/core/tools/search.js +2 -1
  36. package/dist/core/tools/search.js.map +1 -1
  37. package/dist/core/tools/webfetch.d.ts.map +1 -1
  38. package/dist/core/tools/webfetch.js +2 -1
  39. package/dist/core/tools/webfetch.js.map +1 -1
  40. package/dist/core/tools/websearch.d.ts.map +1 -1
  41. package/dist/core/tools/websearch.js +2 -1
  42. package/dist/core/tools/websearch.js.map +1 -1
  43. package/dist/core/tools/write.d.ts.map +1 -1
  44. package/dist/core/tools/write.js +2 -1
  45. package/dist/core/tools/write.js.map +1 -1
  46. package/dist/modes/interactive/command-executor.d.ts.map +1 -1
  47. package/dist/modes/interactive/command-executor.js +5 -5
  48. package/dist/modes/interactive/command-executor.js.map +1 -1
  49. package/dist/modes/interactive/components/footer.d.ts +1 -1
  50. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  51. package/dist/modes/interactive/components/footer.js +3 -2
  52. package/dist/modes/interactive/components/footer.js.map +1 -1
  53. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  54. package/dist/modes/interactive/components/settings-selector.js +1 -1
  55. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  56. package/dist/modes/interactive/components/tool-chain-summary.d.ts +2 -1
  57. package/dist/modes/interactive/components/tool-chain-summary.d.ts.map +1 -1
  58. package/dist/modes/interactive/components/tool-chain-summary.js +2 -1
  59. package/dist/modes/interactive/components/tool-chain-summary.js.map +1 -1
  60. package/dist/modes/interactive/components/tool-chain.d.ts +2 -9
  61. package/dist/modes/interactive/components/tool-chain.d.ts.map +1 -1
  62. package/dist/modes/interactive/components/tool-chain.js +3 -20
  63. package/dist/modes/interactive/components/tool-chain.js.map +1 -1
  64. package/dist/modes/interactive/components/tool-execution.d.ts +16 -20
  65. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  66. package/dist/modes/interactive/components/tool-execution.js +38 -37
  67. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  68. package/dist/modes/interactive/components/tool-signal.d.ts.map +1 -1
  69. package/dist/modes/interactive/components/tool-signal.js +1 -1
  70. package/dist/modes/interactive/components/tool-signal.js.map +1 -1
  71. package/dist/modes/interactive/interactive-mode.d.ts +39 -20
  72. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  73. package/dist/modes/interactive/interactive-mode.js +77 -69
  74. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  75. package/docs/keybindings.md +5 -1
  76. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  77. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  78. package/examples/extensions/sandbox/package.json +1 -1
  79. package/examples/extensions/with-deps/package.json +1 -1
  80. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.57] - 2026-09-04
4
+
5
+ ### Changed
6
+
7
+ - **The tool output dial is three stops and two keys, and `full` finally means
8
+ full.** It had grown into three separate ideas: a dial (`alt+o`) with a
9
+ `radar` / `glance` / `full` scale, an all-or-nothing expand (`ctrl+o`), and a
10
+ one-at-a-time unfold (`alt+u` / `shift+alt+u`) that peeled backwards from the
11
+ newest block and meant something different in each view. Three states to hold,
12
+ and a `full` stop that was not full — `ctrl+o` was what made it full.
13
+
14
+ Now there is one value. The dial reads **radar → peek → full**: one line per
15
+ run of calls, the call line with the first few lines of its result, the same
16
+ with nothing trimmed. `glance` is gone as a stop — a handful of result lines
17
+ answers "did this find anything" better than a folded body did, so `peek`
18
+ replaces it as the default, and `PEEK_LINES` is the single knob every renderer
19
+ trims to (including tools with no renderer of their own, which used to print
20
+ their whole result whatever the dial said).
21
+
22
+ `ctrl+o` still exists and is still the reflex key: from any stop it jumps
23
+ straight to `full`, and pressing it again returns to the stop it came from.
24
+ The header, compaction and branch summaries and skill blocks follow it, since
25
+ `full` means nothing is held back. The two keys differ in what they remember:
26
+ `alt+o` saves where it lands, `ctrl+o` does not.
27
+
28
+ `alt+u` and `shift+alt+u` are gone, and with them the per-chain opened state,
29
+ the per-block revealed flag and the "a revealed block leaves radar while it is
30
+ open" special case. A run of calls is a summary line in radar and its own calls
31
+ at every other stop; nothing opens one chain or one block on its own any more.
32
+ Old `toolOutputView` settings still load: `glance` becomes `peek`, `collapsed`
33
+ becomes `radar`, `standard` becomes `full`, and a config that still says `peek`
34
+ needs no migration at all — it names a live stop again.
35
+
36
+ ## [0.5.56] - 2026-09-04
37
+
38
+ ### Added
39
+
40
+ - **The session chip's color cycles from the keyboard.** `Alt+C` steps it to the
41
+ next slot and `Shift+Alt+C` back, wrapping at both ends, with no picker in the
42
+ way — telling two terminals apart is a matter of pressing until the two chips
43
+ stop looking alike, not of choosing a color. `/color` still opens the swatches
44
+ and still takes a name, and both bindings are rebindable as
45
+ `app.session.color.cycleForward` / `app.session.color.cycleBackward`.
46
+
3
47
  ## [0.5.55] - 2026-09-04
4
48
 
5
49
  ### Fixed
@@ -11,8 +11,6 @@ interface AppKeybindings {
11
11
  "app.tools.expand": true;
12
12
  "app.view.cycleForward": true;
13
13
  "app.view.cycleBackward": true;
14
- "app.tools.unfoldOne": true;
15
- "app.tools.foldOne": true;
16
14
  "app.thinking.toggle": true;
17
15
  "app.tasks.cycleView": true;
18
16
  "app.team.focus": true;
@@ -29,6 +27,8 @@ interface AppKeybindings {
29
27
  "app.session.fork": true;
30
28
  "app.session.resume": true;
31
29
  "app.session.changeDirectory": true;
30
+ "app.session.color.cycleForward": true;
31
+ "app.session.color.cycleBackward": true;
32
32
  "app.settings.open": true;
33
33
  "app.hotkeys.open": true;
34
34
  "app.mode.cycle": true;
@@ -251,24 +251,16 @@ export declare const KEYBINDINGS: {
251
251
  };
252
252
  readonly "app.tools.expand": {
253
253
  readonly defaultKeys: "ctrl+o";
254
- readonly description: "Expand or collapse what is in front of you (tool bodies, header, summaries)";
254
+ readonly description: "Jump to the full view from wherever you are, and back again";
255
255
  };
256
256
  readonly "app.view.cycleForward": {
257
257
  readonly defaultKeys: "alt+o";
258
- readonly description: "Cycle tool output view (radar → glance → full)";
258
+ readonly description: "Cycle tool output view (radar → peek → full)";
259
259
  };
260
260
  readonly "app.view.cycleBackward": {
261
261
  readonly defaultKeys: "shift+alt+o";
262
262
  readonly description: "Cycle tool output view backward";
263
263
  };
264
- readonly "app.tools.unfoldOne": {
265
- readonly defaultKeys: "alt+u";
266
- readonly description: "Open the newest folded thing — a chain in radar, a tool body otherwise";
267
- };
268
- readonly "app.tools.foldOne": {
269
- readonly defaultKeys: "shift+alt+u";
270
- readonly description: "Re-fold the most recently opened chain or tool block";
271
- };
272
264
  readonly "app.thinking.toggle": {
273
265
  readonly defaultKeys: "ctrl+t";
274
266
  readonly description: "Toggle thinking blocks";
@@ -329,6 +321,14 @@ export declare const KEYBINDINGS: {
329
321
  readonly defaultKeys: "alt+w";
330
322
  readonly description: "Change working directory (move to another repo without quitting)";
331
323
  };
324
+ readonly "app.session.color.cycleForward": {
325
+ readonly defaultKeys: "alt+c";
326
+ readonly description: "Cycle the session chip's color";
327
+ };
328
+ readonly "app.session.color.cycleBackward": {
329
+ readonly defaultKeys: "shift+alt+c";
330
+ readonly description: "Cycle the session chip's color backward";
331
+ };
332
332
  readonly "app.settings.open": {
333
333
  readonly defaultKeys: "alt+s";
334
334
  readonly description: "Open settings";
@@ -1 +1 @@
1
- {"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../../src/core/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,KAAK,EAEV,kBAAkB,IAAI,qBAAqB,EAC3C,MAAM,0BAA0B,CAAC;AAKlC,UAAU,cAAc;IACvB,eAAe,EAAE,IAAI,CAAC;IACtB,WAAW,EAAE,IAAI,CAAC;IAClB,UAAU,EAAE,IAAI,CAAC;IACjB,aAAa,EAAE,IAAI,CAAC;IACpB,oBAAoB,EAAE,IAAI,CAAC;IAC3B,wBAAwB,EAAE,IAAI,CAAC;IAC/B,yBAAyB,EAAE,IAAI,CAAC;IAChC,kBAAkB,EAAE,IAAI,CAAC;IACzB,kBAAkB,EAAE,IAAI,CAAC;IACzB,uBAAuB,EAAE,IAAI,CAAC;IAC9B,w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AE,MAAsB,GAAG,kBAAkB,CAIlE;IAED,MAAM,IAAI,IAAI,CAGb;IAED,kBAAkB,IAAI,iBAAiB,CAEtC;IAED,OAAO,CAAC,MAAM,CAAC,YAAY;CAK3B;AAED,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import {\n\ttype Keybinding,\n\ttype KeybindingDefinitions,\n\ttype KeybindingsConfig,\n\ttype KeyId,\n\tTUI_KEYBINDINGS,\n\tKeybindingsManager as TuiKeybindingsManager,\n} from \"@kolisachint/hoocode-tui\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getAgentDir } from \"../config.js\";\n\ninterface AppKeybindings {\n\t\"app.interrupt\": true;\n\t\"app.clear\": true;\n\t\"app.exit\": true;\n\t\"app.suspend\": true;\n\t\"app.thinking.cycle\": true;\n\t\"app.model.cycleForward\": true;\n\t\"app.model.cycleBackward\": true;\n\t\"app.model.select\": true;\n\t\"app.tools.expand\": true;\n\t\"app.view.cycleForward\": true;\n\t\"app.view.cycleBackward\": true;\n\t\"app.tools.unfoldOne\": true;\n\t\"app.tools.foldOne\": true;\n\t\"app.thinking.toggle\": true;\n\t\"app.tasks.cycleView\": true;\n\t\"app.team.focus\": true;\n\t\"app.team.nudge\": true;\n\t\"app.team.attach\": true;\n\t\"app.session.toggleNamedFilter\": true;\n\t\"app.editor.external\": true;\n\t\"app.message.followUp\": true;\n\t\"app.message.dequeue\": true;\n\t\"app.clipboard.pasteImage\": true;\n\t\"app.input.voiceTranscribe\": true;\n\t\"app.session.new\": true;\n\t\"app.session.tree\": true;\n\t\"app.session.fork\": true;\n\t\"app.session.resume\": true;\n\t\"app.session.changeDirectory\": true;\n\t\"app.settings.open\": true;\n\t\"app.hotkeys.open\": true;\n\t\"app.mode.cycle\": true;\n\t\"app.tree.foldOrUp\": true;\n\t\"app.tree.unfoldOrDown\": true;\n\t\"app.tree.editLabel\": true;\n\t\"app.tree.toggleLabelTimestamp\": true;\n\t\"app.session.togglePath\": true;\n\t\"app.session.toggleSort\": true;\n\t\"app.session.rename\": true;\n\t\"app.session.delete\": true;\n\t\"app.session.deleteNoninvasive\": true;\n\t\"app.models.save\": true;\n\t\"app.models.enableAll\": true;\n\t\"app.models.clearAll\": true;\n\t\"app.models.toggleProvider\": true;\n\t\"app.models.reorderUp\": true;\n\t\"app.models.reorderDown\": true;\n\t\"app.tree.filter.default\": true;\n\t\"app.tree.filter.noTools\": true;\n\t\"app.tree.filter.userOnly\": true;\n\t\"app.tree.filter.labeledOnly\": true;\n\t\"app.tree.filter.all\": true;\n\t\"app.tree.filter.cycleForward\": true;\n\t\"app.tree.filter.cycleBackward\": true;\n}\n\nexport type AppKeybinding = keyof AppKeybindings;\n\ndeclare module \"@kolisachint/hoocode-tui\" {\n\tinterface Keybindings extends AppKeybindings {}\n}\n\n/**\n * The cockpit layout.\n *\n * Three rings, and which ring a key belongs to is decided by its modifier:\n *\n * - **ctrl — the view.** What is on screen right now: expand, thinking blocks,\n * task panel, model cycling. Pressed many times a minute, so they sit under\n * the hand and never require a second modifier.\n * - **alt — the cockpit.** What the agent *is* and where it works: model,\n * mode, working directory, settings, sessions. Pressed a few times a session.\n * - **overlays.** Inside a picker, the query line is a text field, so every\n * `ctrl+<letter>` there belongs to the *text* (ctrl+a start of line, ctrl+u\n * kill line, ctrl+w kill word). A picker's own verbs are therefore all on\n * `alt+<letter>`, mnemonic to that picker; the picker captures keys while it\n * is open, so reusing a global letter there is unambiguous.\n *\n * Two rules keep the set learnable: shift reverses whatever the unshifted key\n * does, and no binding takes a key the editor or the terminal already owns\n * (ctrl+a/e/b/f/k/u/w/y/d/l/r/g, ctrl+s XOFF, ctrl+m == enter, ctrl+i == tab).\n *\n * Two constraints from the key parser shape which alt keys are usable at all,\n * and `test/keybinding-layout.test.ts` holds both:\n *\n * - Only `alt+<letter>` and `alt+<digit>` survive a terminal without the Kitty\n * keyboard protocol. `alt+[` and `alt+]` arrive as the CSI and OSC\n * introducers and are not parsed as keys; nor is any shift-modified key, so a\n * `shift+…` default is a Kitty-only convenience on top of an unshifted key\n * that works everywhere (as `shift+ctrl+p` has always been).\n * - Legacy `alt+p` and `alt+n` are also accepted as `alt+up` and `alt+down`\n * (the emacs previous/next aliases), so no scope may bind both halves of\n * either pair.\n */\nexport const KEYBINDINGS = {\n\t...TUI_KEYBINDINGS,\n\t\"app.interrupt\": { defaultKeys: \"escape\", description: \"Cancel or abort\" },\n\t\"app.clear\": { defaultKeys: \"ctrl+c\", description: \"Clear editor\" },\n\t\"app.exit\": { defaultKeys: \"ctrl+d\", description: \"Exit when editor is empty\" },\n\t\"app.suspend\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? [] : \"ctrl+z\",\n\t\tdescription: \"Suspend to background\",\n\t},\n\t\"app.thinking.cycle\": {\n\t\tdefaultKeys: \"shift+tab\",\n\t\tdescription: \"Cycle thinking level\",\n\t},\n\t\"app.model.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Cycle to next model\",\n\t},\n\t\"app.model.cycleBackward\": {\n\t\tdefaultKeys: \"shift+ctrl+p\",\n\t\tdescription: \"Cycle to previous model\",\n\t},\n\t// alt+m, not ctrl+l: ctrl+l is \"clear the screen\" in every shell and every\n\t// full-screen terminal app, and users press it reflexively to tidy up. It\n\t// opening a model dialog is the single most surprising key in the old set.\n\t\"app.model.select\": { defaultKeys: \"alt+m\", description: \"Open model selector\" },\n\t\"app.tools.expand\": {\n\t\tdefaultKeys: \"ctrl+o\",\n\t\tdescription: \"Expand or collapse what is in front of you (tool bodies, header, summaries)\",\n\t},\n\t// The view dial pairs with ctrl+o on purpose: same letter, different ring.\n\t// ctrl+o opens what is already there; alt+o decides how much is ever there.\n\t\"app.view.cycleForward\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Cycle tool output view (radar → glance → full)\",\n\t},\n\t\"app.view.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+o\",\n\t\tdescription: \"Cycle tool output view backward\",\n\t},\n\t// The one-at-a-time counterpart to ctrl+o's all-or-nothing. The transcript is\n\t// bottom-anchored with no app-level scrolling — anything far enough up is in\n\t// the terminal's own scrollback, which this process cannot address — so \"open\n\t// one\" can only ever mean \"open one at the tail\". Repeating the key peels\n\t// backwards from there.\n\t\"app.tools.unfoldOne\": {\n\t\tdefaultKeys: \"alt+u\",\n\t\tdescription: \"Open the newest folded thing — a chain in radar, a tool body otherwise\",\n\t},\n\t\"app.tools.foldOne\": {\n\t\tdefaultKeys: \"shift+alt+u\",\n\t\tdescription: \"Re-fold the most recently opened chain or tool block\",\n\t},\n\t\"app.thinking.toggle\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Toggle thinking blocks\",\n\t},\n\t\"app.tasks.cycleView\": {\n\t\t// ctrl+n is free in the main editor (no emacs next-line binding here).\n\t\tdefaultKeys: \"ctrl+n\",\n\t\tdescription: \"Cycle task panel view (tasks → subagents → teams, skips empty lenses)\",\n\t},\n\t\"app.team.focus\": {\n\t\t// Pairs with ctrl+n (cycle task panel view): alt+n steps INTO the teams\n\t\t// lens and focuses the role roster (--team only). Not shift+ctrl+n —\n\t\t// Windows Terminal intercepts that as its \"new window\" shortcut, the\n\t\t// same trap that moved app.tasks.cycleView off ctrl+shift+t.\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Focus the team roster (navigate roles, n nudge, a attach)\",\n\t},\n\t\"app.team.nudge\": {\n\t\t// Plain letters are safe here: these fire only while the task panel holds\n\t\t// focus (team-focus mode), never while typing in the editor.\n\t\tdefaultKeys: \"n\",\n\t\tdescription: \"Nudge the selected team role (team focus mode)\",\n\t},\n\t\"app.team.attach\": {\n\t\tdefaultKeys: \"a\",\n\t\tdescription: \"Attach to the selected team role (team focus mode)\",\n\t},\n\t// alt+e, not ctrl+g: ctrl+g is emacs/readline \"abort\" — the key you hit to\n\t// get out of something. Having it launch $EDITOR inverts that reflex.\n\t\"app.editor.external\": {\n\t\tdefaultKeys: \"alt+e\",\n\t\tdescription: \"Open external editor\",\n\t},\n\t\"app.message.followUp\": {\n\t\tdefaultKeys: \"alt+enter\",\n\t\tdescription: \"Queue follow-up message\",\n\t},\n\t\"app.message.dequeue\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Restore queued messages\",\n\t},\n\t\"app.clipboard.pasteImage\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? \"alt+v\" : \"ctrl+v\",\n\t\tdescription: \"Paste image from clipboard\",\n\t},\n\t// alt+r, not ctrl+r: ctrl+r is reverse history search in every shell, and it\n\t// was also the session picker's rename key — one chord, two meanings.\n\t\"app.input.voiceTranscribe\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Record voice and transcribe into the editor\",\n\t},\n\t// The two destructive-ish session moves stay unbound by default. /new\n\t// replaces the transcript and /fork needs a message picked out of it, so\n\t// neither wants to be one stray chord away; both remain bindable by hand.\n\t\"app.session.new\": { defaultKeys: [], description: \"Start a new session\" },\n\t\"app.session.fork\": { defaultKeys: [], description: \"Fork current session\" },\n\t// Navigation is non-destructive, so it gets keys: t for tree, h for history.\n\t\"app.session.tree\": { defaultKeys: \"alt+t\", description: \"Open session tree\" },\n\t\"app.session.resume\": { defaultKeys: \"alt+h\", description: \"Resume a session from history\" },\n\t\"app.session.changeDirectory\": {\n\t\tdefaultKeys: \"alt+w\",\n\t\tdescription: \"Change working directory (move to another repo without quitting)\",\n\t},\n\t\"app.settings.open\": { defaultKeys: \"alt+s\", description: \"Open settings\" },\n\t\"app.hotkeys.open\": { defaultKeys: \"alt+k\", description: \"Show keyboard shortcuts\" },\n\t\"app.mode.cycle\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Cycle agent mode (ask → plan → build → debug)\",\n\t},\n\t\"app.tree.foldOrUp\": {\n\t\tdefaultKeys: [\"ctrl+left\", \"alt+left\"],\n\t\tdescription: \"Fold tree branch or move up\",\n\t},\n\t\"app.tree.unfoldOrDown\": {\n\t\tdefaultKeys: [\"ctrl+right\", \"alt+right\"],\n\t\tdescription: \"Unfold tree branch or move down\",\n\t},\n\t\"app.tree.editLabel\": {\n\t\tdefaultKeys: \"shift+l\",\n\t\tdescription: \"Edit tree label\",\n\t},\n\t\"app.tree.toggleLabelTimestamp\": {\n\t\tdefaultKeys: \"shift+t\",\n\t\tdescription: \"Toggle tree label timestamps\",\n\t},\n\t// Session picker verbs. All on alt so the picker's query line keeps the\n\t// emacs editing keys it used to lose: ctrl+a jumped to the start of the\n\t// query *and* enabled every model, ctrl+d deleted a character *and* deleted\n\t// the highlighted session.\n\t\"app.session.togglePath\": {\n\t\tdefaultKeys: \"alt+p\",\n\t\tdescription: \"Toggle session path display\",\n\t},\n\t\"app.session.toggleSort\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Toggle session sort order\",\n\t},\n\t\"app.session.rename\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Rename session\",\n\t},\n\t\"app.session.toggleNamedFilter\": {\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Toggle named session filter\",\n\t},\n\t\"app.session.delete\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Delete session\",\n\t},\n\t\"app.session.deleteNoninvasive\": {\n\t\tdefaultKeys: \"ctrl+backspace\",\n\t\tdescription: \"Delete session when query is empty\",\n\t},\n\t// Model picker verbs, same rule. ctrl+s in particular was XOFF: on a terminal\n\t// with flow control still on, \"save\" froze the session instead.\n\t\"app.models.save\": {\n\t\tdefaultKeys: \"alt+s\",\n\t\tdescription: \"Save model selection\",\n\t},\n\t\"app.models.enableAll\": {\n\t\tdefaultKeys: \"alt+a\",\n\t\tdescription: \"Enable all models\",\n\t},\n\t\"app.models.clearAll\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Clear all models\",\n\t},\n\t// alt+g (\"group\"), not alt+p: on a terminal without the Kitty protocol, alt+p\n\t// arrives as ESC-p, which the key parser also accepts as alt+up — and alt+up\n\t// is this same picker's reorder key.\n\t\"app.models.toggleProvider\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Toggle all models for provider\",\n\t},\n\t\"app.models.reorderUp\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Move model up in order\",\n\t},\n\t\"app.models.reorderDown\": {\n\t\tdefaultKeys: \"alt+down\",\n\t\tdescription: \"Move model down in order\",\n\t},\n\t\"app.options.next\": { defaultKeys: \"right\", description: \"Confirm and advance to the next question\" },\n\t\"app.options.back\": { defaultKeys: \"left\", description: \"Go back to the previous question\" },\n\t// Five lenses in a fixed order, so they are numbered rather than lettered:\n\t// alt+1..alt+5 needs no mnemonic and collides with nothing. The old set\n\t// (ctrl+d/t/u/l/a) collided with delete-char, thinking, kill-to-start,\n\t// clear-screen and start-of-line respectively.\n\t\"app.tree.filter.default\": {\n\t\tdefaultKeys: \"alt+1\",\n\t\tdescription: \"Tree filter: default view\",\n\t},\n\t\"app.tree.filter.noTools\": {\n\t\tdefaultKeys: \"alt+2\",\n\t\tdescription: \"Tree filter: hide tool results\",\n\t},\n\t\"app.tree.filter.userOnly\": {\n\t\tdefaultKeys: \"alt+3\",\n\t\tdescription: \"Tree filter: user messages only\",\n\t},\n\t\"app.tree.filter.labeledOnly\": {\n\t\tdefaultKeys: \"alt+4\",\n\t\tdescription: \"Tree filter: labeled entries only\",\n\t},\n\t\"app.tree.filter.all\": {\n\t\tdefaultKeys: \"alt+5\",\n\t\tdescription: \"Tree filter: show all entries\",\n\t},\n\t// alt+c for \"cycle\". Not a bracket pair, tempting as `alt+[` / `alt+]` are:\n\t// without the Kitty protocol those arrive as ESC-[ and ESC-], which are the\n\t// CSI and OSC introducers and so are not parsed as keys at all. The backward\n\t// half needs Kitty, like every other shift-modified default here.\n\t\"app.tree.filter.cycleForward\": {\n\t\tdefaultKeys: \"alt+c\",\n\t\tdescription: \"Tree filter: cycle forward\",\n\t},\n\t\"app.tree.filter.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+c\",\n\t\tdescription: \"Tree filter: cycle backward\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nconst KEYBINDING_NAME_MIGRATIONS = {\n\tcursorUp: \"tui.editor.cursorUp\",\n\tcursorDown: \"tui.editor.cursorDown\",\n\tcursorLeft: \"tui.editor.cursorLeft\",\n\tcursorRight: \"tui.editor.cursorRight\",\n\tcursorWordLeft: \"tui.editor.cursorWordLeft\",\n\tcursorWordRight: \"tui.editor.cursorWordRight\",\n\tcursorLineStart: \"tui.editor.cursorLineStart\",\n\tcursorLineEnd: \"tui.editor.cursorLineEnd\",\n\tjumpForward: \"tui.editor.jumpForward\",\n\tjumpBackward: \"tui.editor.jumpBackward\",\n\tpageUp: \"tui.editor.pageUp\",\n\tpageDown: \"tui.editor.pageDown\",\n\tdeleteCharBackward: \"tui.editor.deleteCharBackward\",\n\tdeleteCharForward: \"tui.editor.deleteCharForward\",\n\tdeleteWordBackward: \"tui.editor.deleteWordBackward\",\n\tdeleteWordForward: \"tui.editor.deleteWordForward\",\n\tdeleteToLineStart: \"tui.editor.deleteToLineStart\",\n\tdeleteToLineEnd: \"tui.editor.deleteToLineEnd\",\n\tyank: \"tui.editor.yank\",\n\tyankPop: \"tui.editor.yankPop\",\n\tundo: \"tui.editor.undo\",\n\tnewLine: \"tui.input.newLine\",\n\tsubmit: \"tui.input.submit\",\n\ttab: \"tui.input.tab\",\n\tcopy: \"tui.input.copy\",\n\tselectUp: \"tui.select.up\",\n\tselectDown: \"tui.select.down\",\n\tselectPageUp: \"tui.select.pageUp\",\n\tselectPageDown: \"tui.select.pageDown\",\n\tselectConfirm: \"tui.select.confirm\",\n\tselectCancel: \"tui.select.cancel\",\n\tinterrupt: \"app.interrupt\",\n\tclear: \"app.clear\",\n\texit: \"app.exit\",\n\tsuspend: \"app.suspend\",\n\tcycleThinkingLevel: \"app.thinking.cycle\",\n\tcycleModelForward: \"app.model.cycleForward\",\n\tcycleModelBackward: \"app.model.cycleBackward\",\n\tselectModel: \"app.model.select\",\n\texpandTools: \"app.tools.expand\",\n\ttoggleThinking: \"app.thinking.toggle\",\n\ttoggleSessionNamedFilter: \"app.session.toggleNamedFilter\",\n\texternalEditor: \"app.editor.external\",\n\tfollowUp: \"app.message.followUp\",\n\tdequeue: \"app.message.dequeue\",\n\tpasteImage: \"app.clipboard.pasteImage\",\n\tnewSession: \"app.session.new\",\n\ttree: \"app.session.tree\",\n\tfork: \"app.session.fork\",\n\tresume: \"app.session.resume\",\n\ttreeFoldOrUp: \"app.tree.foldOrUp\",\n\ttreeUnfoldOrDown: \"app.tree.unfoldOrDown\",\n\ttreeEditLabel: \"app.tree.editLabel\",\n\ttreeToggleLabelTimestamp: \"app.tree.toggleLabelTimestamp\",\n\ttoggleSessionPath: \"app.session.togglePath\",\n\ttoggleSessionSort: \"app.session.toggleSort\",\n\trenameSession: \"app.session.rename\",\n\tdeleteSession: \"app.session.delete\",\n\tdeleteSessionNoninvasive: \"app.session.deleteNoninvasive\",\n} as const satisfies Record<string, Keybinding>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLegacyKeybindingName(key: string): key is keyof typeof KEYBINDING_NAME_MIGRATIONS {\n\treturn key in KEYBINDING_NAME_MIGRATIONS;\n}\n\nfunction toKeybindingsConfig(value: unknown): KeybindingsConfig {\n\tif (!isRecord(value)) return {};\n\n\tconst config: KeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (typeof binding === \"string\") {\n\t\t\tconfig[key] = binding as KeyId;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as KeyId[];\n\t\t}\n\t}\n\treturn config;\n}\n\nexport function migrateKeybindingsConfig(rawConfig: Record<string, unknown>): {\n\tconfig: Record<string, unknown>;\n\tmigrated: boolean;\n} {\n\tconst config: Record<string, unknown> = {};\n\tlet migrated = false;\n\n\tfor (const [key, value] of Object.entries(rawConfig)) {\n\t\tconst nextKey = isLegacyKeybindingName(key) ? KEYBINDING_NAME_MIGRATIONS[key] : key;\n\t\tif (nextKey !== key) {\n\t\t\tmigrated = true;\n\t\t}\n\t\tif (key !== nextKey && Object.hasOwn(rawConfig, nextKey)) {\n\t\t\tmigrated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconfig[nextKey] = value;\n\t}\n\n\treturn { config: orderKeybindingsConfig(config), migrated };\n}\n\nfunction orderKeybindingsConfig(config: Record<string, unknown>): Record<string, unknown> {\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const keybinding of Object.keys(KEYBINDINGS)) {\n\t\tif (Object.hasOwn(config, keybinding)) {\n\t\t\tordered[keybinding] = config[keybinding];\n\t\t}\n\t}\n\n\tconst extras = Object.keys(config)\n\t\t.filter((key) => !Object.hasOwn(ordered, key))\n\t\t.sort();\n\tfor (const key of extras) {\n\t\tordered[key] = config[key];\n\t}\n\n\treturn ordered;\n}\n\nfunction loadRawConfig(path: string): Record<string, unknown> | undefined {\n\tif (!existsSync(path)) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(path, \"utf-8\")) as unknown;\n\t\treturn isRecord(parsed) ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport class KeybindingsManager extends TuiKeybindingsManager {\n\tprivate configPath: string | undefined;\n\n\tconstructor(userBindings: KeybindingsConfig = {}, configPath?: string) {\n\t\tsuper(KEYBINDINGS, userBindings);\n\t\tthis.configPath = configPath;\n\t}\n\n\tstatic create(agentDir: string = getAgentDir()): KeybindingsManager {\n\t\tconst configPath = join(agentDir, \"keybindings.json\");\n\t\tconst userBindings = KeybindingsManager.loadFromFile(configPath);\n\t\treturn new KeybindingsManager(userBindings, configPath);\n\t}\n\n\treload(): void {\n\t\tif (!this.configPath) return;\n\t\tthis.setUserBindings(KeybindingsManager.loadFromFile(this.configPath));\n\t}\n\n\tgetEffectiveConfig(): KeybindingsConfig {\n\t\treturn this.getResolvedBindings();\n\t}\n\n\tprivate static loadFromFile(path: string): KeybindingsConfig {\n\t\tconst rawConfig = loadRawConfig(path);\n\t\tif (!rawConfig) return {};\n\t\treturn toKeybindingsConfig(migrateKeybindingsConfig(rawConfig).config);\n\t}\n}\n\nexport type { KeyId, KeybindingsConfig };\n"]}
1
+ {"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../../src/core/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,KAAK,EAEV,kBAAkB,IAAI,qBAAqB,EAC3C,MAAM,0BAA0B,CAAC;AAKlC,UAAU,cAAc;IACvB,eAAe,EAAE,IAAI,CAAC;IACtB,WAAW,EAAE,IAAI,CAAC;IAClB,UAAU,EAAE,IAAI,CAAC;IACjB,aAAa,EAAE,IAAI,CAAC;IACpB,oBAAoB,EAAE,IAAI,CAAC;IAC3B,wBAAwB,EAAE,IAAI,CAAC;IAC/B,yBAAyB,EAAE,IAAI,CAAC;IAChC,kBAAkB,EAAE,IAAI,CAAC;IACzB,kBAAkB,EAAE,IAAI,CAAC;IACzB,uBAAuB,EAAE,IAAI,CAAC;IAC9B,wBAAwB,EAAE,IAAI,CAAC;IAC/B,qBAAqB,EAAE,IAAI,CAAC;IAC5B,qBAAqB,EAAE,IAAI,CAAC;IAC5B,gBAAgB,EAAE,IAAI,CAAC;IACvB,gBAAgB,EAAE,IAAI,CAAC;IACvB,iBAAiB,EAAE,IAAI,CAAC;IACxB,+BAA+B,EAAE,IAAI,CAAC;IACtC,qBAAqB,EAAE,IAAI,CAAC;IAC5B,sBAAsB,EAAE,IAAI,CAAC;IAC7B,qBAAqB,EAAE,IAAI,CAAC;IAC5B,0BAA0B,EAAE,IAAI,CAAC;IACjC,2BAA2B,EAAE,IAAI,CAAC;IAClC,iBAAiB,EAAE,IAAI,CAAC;IACxB,kBAAkB,EAAE,IAAI,CAAC;IACzB,kBAAkB,EAAE,IAAI,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyOkB,CAAC;AAwF3C,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC7E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;CAClB,CAiBA;AA8BD,qBAAa,kBAAmB,SAAQ,qBAAqB;IAC5D,OAAO,CAAC,UAAU,CAAqB;IAEvC,YAAY,YAAY,GAAE,iBAAsB,EAAE,UAAU,CAAC,EAAE,MAAM,EAGpE;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAE,MAAsB,GAAG,kBAAkB,CAIlE;IAED,MAAM,IAAI,IAAI,CAGb;IAED,kBAAkB,IAAI,iBAAiB,CAEtC;IAED,OAAO,CAAC,MAAM,CAAC,YAAY;CAK3B;AAED,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import {\n\ttype Keybinding,\n\ttype KeybindingDefinitions,\n\ttype KeybindingsConfig,\n\ttype KeyId,\n\tTUI_KEYBINDINGS,\n\tKeybindingsManager as TuiKeybindingsManager,\n} from \"@kolisachint/hoocode-tui\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getAgentDir } from \"../config.js\";\n\ninterface AppKeybindings {\n\t\"app.interrupt\": true;\n\t\"app.clear\": true;\n\t\"app.exit\": true;\n\t\"app.suspend\": true;\n\t\"app.thinking.cycle\": true;\n\t\"app.model.cycleForward\": true;\n\t\"app.model.cycleBackward\": true;\n\t\"app.model.select\": true;\n\t\"app.tools.expand\": true;\n\t\"app.view.cycleForward\": true;\n\t\"app.view.cycleBackward\": true;\n\t\"app.thinking.toggle\": true;\n\t\"app.tasks.cycleView\": true;\n\t\"app.team.focus\": true;\n\t\"app.team.nudge\": true;\n\t\"app.team.attach\": true;\n\t\"app.session.toggleNamedFilter\": true;\n\t\"app.editor.external\": true;\n\t\"app.message.followUp\": true;\n\t\"app.message.dequeue\": true;\n\t\"app.clipboard.pasteImage\": true;\n\t\"app.input.voiceTranscribe\": true;\n\t\"app.session.new\": true;\n\t\"app.session.tree\": true;\n\t\"app.session.fork\": true;\n\t\"app.session.resume\": true;\n\t\"app.session.changeDirectory\": true;\n\t\"app.session.color.cycleForward\": true;\n\t\"app.session.color.cycleBackward\": true;\n\t\"app.settings.open\": true;\n\t\"app.hotkeys.open\": true;\n\t\"app.mode.cycle\": true;\n\t\"app.tree.foldOrUp\": true;\n\t\"app.tree.unfoldOrDown\": true;\n\t\"app.tree.editLabel\": true;\n\t\"app.tree.toggleLabelTimestamp\": true;\n\t\"app.session.togglePath\": true;\n\t\"app.session.toggleSort\": true;\n\t\"app.session.rename\": true;\n\t\"app.session.delete\": true;\n\t\"app.session.deleteNoninvasive\": true;\n\t\"app.models.save\": true;\n\t\"app.models.enableAll\": true;\n\t\"app.models.clearAll\": true;\n\t\"app.models.toggleProvider\": true;\n\t\"app.models.reorderUp\": true;\n\t\"app.models.reorderDown\": true;\n\t\"app.tree.filter.default\": true;\n\t\"app.tree.filter.noTools\": true;\n\t\"app.tree.filter.userOnly\": true;\n\t\"app.tree.filter.labeledOnly\": true;\n\t\"app.tree.filter.all\": true;\n\t\"app.tree.filter.cycleForward\": true;\n\t\"app.tree.filter.cycleBackward\": true;\n}\n\nexport type AppKeybinding = keyof AppKeybindings;\n\ndeclare module \"@kolisachint/hoocode-tui\" {\n\tinterface Keybindings extends AppKeybindings {}\n}\n\n/**\n * The cockpit layout.\n *\n * Three rings, and which ring a key belongs to is decided by its modifier:\n *\n * - **ctrl — the view.** What is on screen right now: expand, thinking blocks,\n * task panel, model cycling. Pressed many times a minute, so they sit under\n * the hand and never require a second modifier.\n * - **alt — the cockpit.** What the agent *is* and where it works: model,\n * mode, working directory, settings, sessions. Pressed a few times a session.\n * - **overlays.** Inside a picker, the query line is a text field, so every\n * `ctrl+<letter>` there belongs to the *text* (ctrl+a start of line, ctrl+u\n * kill line, ctrl+w kill word). A picker's own verbs are therefore all on\n * `alt+<letter>`, mnemonic to that picker; the picker captures keys while it\n * is open, so reusing a global letter there is unambiguous.\n *\n * Two rules keep the set learnable: shift reverses whatever the unshifted key\n * does, and no binding takes a key the editor or the terminal already owns\n * (ctrl+a/e/b/f/k/u/w/y/d/l/r/g, ctrl+s XOFF, ctrl+m == enter, ctrl+i == tab).\n *\n * Two constraints from the key parser shape which alt keys are usable at all,\n * and `test/keybinding-layout.test.ts` holds both:\n *\n * - Only `alt+<letter>` and `alt+<digit>` survive a terminal without the Kitty\n * keyboard protocol. `alt+[` and `alt+]` arrive as the CSI and OSC\n * introducers and are not parsed as keys; nor is any shift-modified key, so a\n * `shift+…` default is a Kitty-only convenience on top of an unshifted key\n * that works everywhere (as `shift+ctrl+p` has always been).\n * - Legacy `alt+p` and `alt+n` are also accepted as `alt+up` and `alt+down`\n * (the emacs previous/next aliases), so no scope may bind both halves of\n * either pair.\n */\nexport const KEYBINDINGS = {\n\t...TUI_KEYBINDINGS,\n\t\"app.interrupt\": { defaultKeys: \"escape\", description: \"Cancel or abort\" },\n\t\"app.clear\": { defaultKeys: \"ctrl+c\", description: \"Clear editor\" },\n\t\"app.exit\": { defaultKeys: \"ctrl+d\", description: \"Exit when editor is empty\" },\n\t\"app.suspend\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? [] : \"ctrl+z\",\n\t\tdescription: \"Suspend to background\",\n\t},\n\t\"app.thinking.cycle\": {\n\t\tdefaultKeys: \"shift+tab\",\n\t\tdescription: \"Cycle thinking level\",\n\t},\n\t\"app.model.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Cycle to next model\",\n\t},\n\t\"app.model.cycleBackward\": {\n\t\tdefaultKeys: \"shift+ctrl+p\",\n\t\tdescription: \"Cycle to previous model\",\n\t},\n\t// alt+m, not ctrl+l: ctrl+l is \"clear the screen\" in every shell and every\n\t// full-screen terminal app, and users press it reflexively to tidy up. It\n\t// opening a model dialog is the single most surprising key in the old set.\n\t\"app.model.select\": { defaultKeys: \"alt+m\", description: \"Open model selector\" },\n\t\"app.tools.expand\": {\n\t\tdefaultKeys: \"ctrl+o\",\n\t\tdescription: \"Jump to the full view from wherever you are, and back again\",\n\t},\n\t// The view dial pairs with ctrl+o on purpose: same letter, different ring.\n\t// alt+o walks the dial a stop at a time and saves where it lands; ctrl+o\n\t// jumps to the far end and back without moving your home stop. One value\n\t// between them, so there is no second \"expanded\" state to keep in sync.\n\t\"app.view.cycleForward\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Cycle tool output view (radar → peek → full)\",\n\t},\n\t\"app.view.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+o\",\n\t\tdescription: \"Cycle tool output view backward\",\n\t},\n\t\"app.thinking.toggle\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Toggle thinking blocks\",\n\t},\n\t\"app.tasks.cycleView\": {\n\t\t// ctrl+n is free in the main editor (no emacs next-line binding here).\n\t\tdefaultKeys: \"ctrl+n\",\n\t\tdescription: \"Cycle task panel view (tasks → subagents → teams, skips empty lenses)\",\n\t},\n\t\"app.team.focus\": {\n\t\t// Pairs with ctrl+n (cycle task panel view): alt+n steps INTO the teams\n\t\t// lens and focuses the role roster (--team only). Not shift+ctrl+n —\n\t\t// Windows Terminal intercepts that as its \"new window\" shortcut, the\n\t\t// same trap that moved app.tasks.cycleView off ctrl+shift+t.\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Focus the team roster (navigate roles, n nudge, a attach)\",\n\t},\n\t\"app.team.nudge\": {\n\t\t// Plain letters are safe here: these fire only while the task panel holds\n\t\t// focus (team-focus mode), never while typing in the editor.\n\t\tdefaultKeys: \"n\",\n\t\tdescription: \"Nudge the selected team role (team focus mode)\",\n\t},\n\t\"app.team.attach\": {\n\t\tdefaultKeys: \"a\",\n\t\tdescription: \"Attach to the selected team role (team focus mode)\",\n\t},\n\t// alt+e, not ctrl+g: ctrl+g is emacs/readline \"abort\" — the key you hit to\n\t// get out of something. Having it launch $EDITOR inverts that reflex.\n\t\"app.editor.external\": {\n\t\tdefaultKeys: \"alt+e\",\n\t\tdescription: \"Open external editor\",\n\t},\n\t\"app.message.followUp\": {\n\t\tdefaultKeys: \"alt+enter\",\n\t\tdescription: \"Queue follow-up message\",\n\t},\n\t\"app.message.dequeue\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Restore queued messages\",\n\t},\n\t\"app.clipboard.pasteImage\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? \"alt+v\" : \"ctrl+v\",\n\t\tdescription: \"Paste image from clipboard\",\n\t},\n\t// alt+r, not ctrl+r: ctrl+r is reverse history search in every shell, and it\n\t// was also the session picker's rename key — one chord, two meanings.\n\t\"app.input.voiceTranscribe\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Record voice and transcribe into the editor\",\n\t},\n\t// The two destructive-ish session moves stay unbound by default. /new\n\t// replaces the transcript and /fork needs a message picked out of it, so\n\t// neither wants to be one stray chord away; both remain bindable by hand.\n\t\"app.session.new\": { defaultKeys: [], description: \"Start a new session\" },\n\t\"app.session.fork\": { defaultKeys: [], description: \"Fork current session\" },\n\t// Navigation is non-destructive, so it gets keys: t for tree, h for history.\n\t\"app.session.tree\": { defaultKeys: \"alt+t\", description: \"Open session tree\" },\n\t\"app.session.resume\": { defaultKeys: \"alt+h\", description: \"Resume a session from history\" },\n\t\"app.session.changeDirectory\": {\n\t\tdefaultKeys: \"alt+w\",\n\t\tdescription: \"Change working directory (move to another repo without quitting)\",\n\t},\n\t// alt+c (\"colour\"), and the tree's filter cycle has the same letter on\n\t// purpose: the tree captures keys while it is open, so the two are never live\n\t// at once, and both mean \"step to the next one\" wherever you press them. The\n\t// backward half needs Kitty, like every other shift-modified default here.\n\t\"app.session.color.cycleForward\": {\n\t\tdefaultKeys: \"alt+c\",\n\t\tdescription: \"Cycle the session chip's color\",\n\t},\n\t\"app.session.color.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+c\",\n\t\tdescription: \"Cycle the session chip's color backward\",\n\t},\n\t\"app.settings.open\": { defaultKeys: \"alt+s\", description: \"Open settings\" },\n\t\"app.hotkeys.open\": { defaultKeys: \"alt+k\", description: \"Show keyboard shortcuts\" },\n\t\"app.mode.cycle\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Cycle agent mode (ask → plan → build → debug)\",\n\t},\n\t\"app.tree.foldOrUp\": {\n\t\tdefaultKeys: [\"ctrl+left\", \"alt+left\"],\n\t\tdescription: \"Fold tree branch or move up\",\n\t},\n\t\"app.tree.unfoldOrDown\": {\n\t\tdefaultKeys: [\"ctrl+right\", \"alt+right\"],\n\t\tdescription: \"Unfold tree branch or move down\",\n\t},\n\t\"app.tree.editLabel\": {\n\t\tdefaultKeys: \"shift+l\",\n\t\tdescription: \"Edit tree label\",\n\t},\n\t\"app.tree.toggleLabelTimestamp\": {\n\t\tdefaultKeys: \"shift+t\",\n\t\tdescription: \"Toggle tree label timestamps\",\n\t},\n\t// Session picker verbs. All on alt so the picker's query line keeps the\n\t// emacs editing keys it used to lose: ctrl+a jumped to the start of the\n\t// query *and* enabled every model, ctrl+d deleted a character *and* deleted\n\t// the highlighted session.\n\t\"app.session.togglePath\": {\n\t\tdefaultKeys: \"alt+p\",\n\t\tdescription: \"Toggle session path display\",\n\t},\n\t\"app.session.toggleSort\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Toggle session sort order\",\n\t},\n\t\"app.session.rename\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Rename session\",\n\t},\n\t\"app.session.toggleNamedFilter\": {\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Toggle named session filter\",\n\t},\n\t\"app.session.delete\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Delete session\",\n\t},\n\t\"app.session.deleteNoninvasive\": {\n\t\tdefaultKeys: \"ctrl+backspace\",\n\t\tdescription: \"Delete session when query is empty\",\n\t},\n\t// Model picker verbs, same rule. ctrl+s in particular was XOFF: on a terminal\n\t// with flow control still on, \"save\" froze the session instead.\n\t\"app.models.save\": {\n\t\tdefaultKeys: \"alt+s\",\n\t\tdescription: \"Save model selection\",\n\t},\n\t\"app.models.enableAll\": {\n\t\tdefaultKeys: \"alt+a\",\n\t\tdescription: \"Enable all models\",\n\t},\n\t\"app.models.clearAll\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Clear all models\",\n\t},\n\t// alt+g (\"group\"), not alt+p: on a terminal without the Kitty protocol, alt+p\n\t// arrives as ESC-p, which the key parser also accepts as alt+up — and alt+up\n\t// is this same picker's reorder key.\n\t\"app.models.toggleProvider\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Toggle all models for provider\",\n\t},\n\t\"app.models.reorderUp\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Move model up in order\",\n\t},\n\t\"app.models.reorderDown\": {\n\t\tdefaultKeys: \"alt+down\",\n\t\tdescription: \"Move model down in order\",\n\t},\n\t\"app.options.next\": { defaultKeys: \"right\", description: \"Confirm and advance to the next question\" },\n\t\"app.options.back\": { defaultKeys: \"left\", description: \"Go back to the previous question\" },\n\t// Five lenses in a fixed order, so they are numbered rather than lettered:\n\t// alt+1..alt+5 needs no mnemonic and collides with nothing. The old set\n\t// (ctrl+d/t/u/l/a) collided with delete-char, thinking, kill-to-start,\n\t// clear-screen and start-of-line respectively.\n\t\"app.tree.filter.default\": {\n\t\tdefaultKeys: \"alt+1\",\n\t\tdescription: \"Tree filter: default view\",\n\t},\n\t\"app.tree.filter.noTools\": {\n\t\tdefaultKeys: \"alt+2\",\n\t\tdescription: \"Tree filter: hide tool results\",\n\t},\n\t\"app.tree.filter.userOnly\": {\n\t\tdefaultKeys: \"alt+3\",\n\t\tdescription: \"Tree filter: user messages only\",\n\t},\n\t\"app.tree.filter.labeledOnly\": {\n\t\tdefaultKeys: \"alt+4\",\n\t\tdescription: \"Tree filter: labeled entries only\",\n\t},\n\t\"app.tree.filter.all\": {\n\t\tdefaultKeys: \"alt+5\",\n\t\tdescription: \"Tree filter: show all entries\",\n\t},\n\t// alt+c for \"cycle\". Not a bracket pair, tempting as `alt+[` / `alt+]` are:\n\t// without the Kitty protocol those arrive as ESC-[ and ESC-], which are the\n\t// CSI and OSC introducers and so are not parsed as keys at all. The backward\n\t// half needs Kitty, like every other shift-modified default here.\n\t\"app.tree.filter.cycleForward\": {\n\t\tdefaultKeys: \"alt+c\",\n\t\tdescription: \"Tree filter: cycle forward\",\n\t},\n\t\"app.tree.filter.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+c\",\n\t\tdescription: \"Tree filter: cycle backward\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nconst KEYBINDING_NAME_MIGRATIONS = {\n\tcursorUp: \"tui.editor.cursorUp\",\n\tcursorDown: \"tui.editor.cursorDown\",\n\tcursorLeft: \"tui.editor.cursorLeft\",\n\tcursorRight: \"tui.editor.cursorRight\",\n\tcursorWordLeft: \"tui.editor.cursorWordLeft\",\n\tcursorWordRight: \"tui.editor.cursorWordRight\",\n\tcursorLineStart: \"tui.editor.cursorLineStart\",\n\tcursorLineEnd: \"tui.editor.cursorLineEnd\",\n\tjumpForward: \"tui.editor.jumpForward\",\n\tjumpBackward: \"tui.editor.jumpBackward\",\n\tpageUp: \"tui.editor.pageUp\",\n\tpageDown: \"tui.editor.pageDown\",\n\tdeleteCharBackward: \"tui.editor.deleteCharBackward\",\n\tdeleteCharForward: \"tui.editor.deleteCharForward\",\n\tdeleteWordBackward: \"tui.editor.deleteWordBackward\",\n\tdeleteWordForward: \"tui.editor.deleteWordForward\",\n\tdeleteToLineStart: \"tui.editor.deleteToLineStart\",\n\tdeleteToLineEnd: \"tui.editor.deleteToLineEnd\",\n\tyank: \"tui.editor.yank\",\n\tyankPop: \"tui.editor.yankPop\",\n\tundo: \"tui.editor.undo\",\n\tnewLine: \"tui.input.newLine\",\n\tsubmit: \"tui.input.submit\",\n\ttab: \"tui.input.tab\",\n\tcopy: \"tui.input.copy\",\n\tselectUp: \"tui.select.up\",\n\tselectDown: \"tui.select.down\",\n\tselectPageUp: \"tui.select.pageUp\",\n\tselectPageDown: \"tui.select.pageDown\",\n\tselectConfirm: \"tui.select.confirm\",\n\tselectCancel: \"tui.select.cancel\",\n\tinterrupt: \"app.interrupt\",\n\tclear: \"app.clear\",\n\texit: \"app.exit\",\n\tsuspend: \"app.suspend\",\n\tcycleThinkingLevel: \"app.thinking.cycle\",\n\tcycleModelForward: \"app.model.cycleForward\",\n\tcycleModelBackward: \"app.model.cycleBackward\",\n\tselectModel: \"app.model.select\",\n\texpandTools: \"app.tools.expand\",\n\ttoggleThinking: \"app.thinking.toggle\",\n\ttoggleSessionNamedFilter: \"app.session.toggleNamedFilter\",\n\texternalEditor: \"app.editor.external\",\n\tfollowUp: \"app.message.followUp\",\n\tdequeue: \"app.message.dequeue\",\n\tpasteImage: \"app.clipboard.pasteImage\",\n\tnewSession: \"app.session.new\",\n\ttree: \"app.session.tree\",\n\tfork: \"app.session.fork\",\n\tresume: \"app.session.resume\",\n\ttreeFoldOrUp: \"app.tree.foldOrUp\",\n\ttreeUnfoldOrDown: \"app.tree.unfoldOrDown\",\n\ttreeEditLabel: \"app.tree.editLabel\",\n\ttreeToggleLabelTimestamp: \"app.tree.toggleLabelTimestamp\",\n\ttoggleSessionPath: \"app.session.togglePath\",\n\ttoggleSessionSort: \"app.session.toggleSort\",\n\trenameSession: \"app.session.rename\",\n\tdeleteSession: \"app.session.delete\",\n\tdeleteSessionNoninvasive: \"app.session.deleteNoninvasive\",\n} as const satisfies Record<string, Keybinding>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLegacyKeybindingName(key: string): key is keyof typeof KEYBINDING_NAME_MIGRATIONS {\n\treturn key in KEYBINDING_NAME_MIGRATIONS;\n}\n\nfunction toKeybindingsConfig(value: unknown): KeybindingsConfig {\n\tif (!isRecord(value)) return {};\n\n\tconst config: KeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (typeof binding === \"string\") {\n\t\t\tconfig[key] = binding as KeyId;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as KeyId[];\n\t\t}\n\t}\n\treturn config;\n}\n\nexport function migrateKeybindingsConfig(rawConfig: Record<string, unknown>): {\n\tconfig: Record<string, unknown>;\n\tmigrated: boolean;\n} {\n\tconst config: Record<string, unknown> = {};\n\tlet migrated = false;\n\n\tfor (const [key, value] of Object.entries(rawConfig)) {\n\t\tconst nextKey = isLegacyKeybindingName(key) ? KEYBINDING_NAME_MIGRATIONS[key] : key;\n\t\tif (nextKey !== key) {\n\t\t\tmigrated = true;\n\t\t}\n\t\tif (key !== nextKey && Object.hasOwn(rawConfig, nextKey)) {\n\t\t\tmigrated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconfig[nextKey] = value;\n\t}\n\n\treturn { config: orderKeybindingsConfig(config), migrated };\n}\n\nfunction orderKeybindingsConfig(config: Record<string, unknown>): Record<string, unknown> {\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const keybinding of Object.keys(KEYBINDINGS)) {\n\t\tif (Object.hasOwn(config, keybinding)) {\n\t\t\tordered[keybinding] = config[keybinding];\n\t\t}\n\t}\n\n\tconst extras = Object.keys(config)\n\t\t.filter((key) => !Object.hasOwn(ordered, key))\n\t\t.sort();\n\tfor (const key of extras) {\n\t\tordered[key] = config[key];\n\t}\n\n\treturn ordered;\n}\n\nfunction loadRawConfig(path: string): Record<string, unknown> | undefined {\n\tif (!existsSync(path)) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(path, \"utf-8\")) as unknown;\n\t\treturn isRecord(parsed) ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport class KeybindingsManager extends TuiKeybindingsManager {\n\tprivate configPath: string | undefined;\n\n\tconstructor(userBindings: KeybindingsConfig = {}, configPath?: string) {\n\t\tsuper(KEYBINDINGS, userBindings);\n\t\tthis.configPath = configPath;\n\t}\n\n\tstatic create(agentDir: string = getAgentDir()): KeybindingsManager {\n\t\tconst configPath = join(agentDir, \"keybindings.json\");\n\t\tconst userBindings = KeybindingsManager.loadFromFile(configPath);\n\t\treturn new KeybindingsManager(userBindings, configPath);\n\t}\n\n\treload(): void {\n\t\tif (!this.configPath) return;\n\t\tthis.setUserBindings(KeybindingsManager.loadFromFile(this.configPath));\n\t}\n\n\tgetEffectiveConfig(): KeybindingsConfig {\n\t\treturn this.getResolvedBindings();\n\t}\n\n\tprivate static loadFromFile(path: string): KeybindingsConfig {\n\t\tconst rawConfig = loadRawConfig(path);\n\t\tif (!rawConfig) return {};\n\t\treturn toKeybindingsConfig(migrateKeybindingsConfig(rawConfig).config);\n\t}\n}\n\nexport type { KeyId, KeybindingsConfig };\n"]}
@@ -61,31 +61,20 @@ export const KEYBINDINGS = {
61
61
  "app.model.select": { defaultKeys: "alt+m", description: "Open model selector" },
62
62
  "app.tools.expand": {
63
63
  defaultKeys: "ctrl+o",
64
- description: "Expand or collapse what is in front of you (tool bodies, header, summaries)",
64
+ description: "Jump to the full view from wherever you are, and back again",
65
65
  },
66
66
  // The view dial pairs with ctrl+o on purpose: same letter, different ring.
67
- // ctrl+o opens what is already there; alt+o decides how much is ever there.
67
+ // alt+o walks the dial a stop at a time and saves where it lands; ctrl+o
68
+ // jumps to the far end and back without moving your home stop. One value
69
+ // between them, so there is no second "expanded" state to keep in sync.
68
70
  "app.view.cycleForward": {
69
71
  defaultKeys: "alt+o",
70
- description: "Cycle tool output view (radar → glance → full)",
72
+ description: "Cycle tool output view (radar → peek → full)",
71
73
  },
72
74
  "app.view.cycleBackward": {
73
75
  defaultKeys: "shift+alt+o",
74
76
  description: "Cycle tool output view backward",
75
77
  },
76
- // The one-at-a-time counterpart to ctrl+o's all-or-nothing. The transcript is
77
- // bottom-anchored with no app-level scrolling — anything far enough up is in
78
- // the terminal's own scrollback, which this process cannot address — so "open
79
- // one" can only ever mean "open one at the tail". Repeating the key peels
80
- // backwards from there.
81
- "app.tools.unfoldOne": {
82
- defaultKeys: "alt+u",
83
- description: "Open the newest folded thing — a chain in radar, a tool body otherwise",
84
- },
85
- "app.tools.foldOne": {
86
- defaultKeys: "shift+alt+u",
87
- description: "Re-fold the most recently opened chain or tool block",
88
- },
89
78
  "app.thinking.toggle": {
90
79
  defaultKeys: "ctrl+t",
91
80
  description: "Toggle thinking blocks",
@@ -149,6 +138,18 @@ export const KEYBINDINGS = {
149
138
  defaultKeys: "alt+w",
150
139
  description: "Change working directory (move to another repo without quitting)",
151
140
  },
141
+ // alt+c ("colour"), and the tree's filter cycle has the same letter on
142
+ // purpose: the tree captures keys while it is open, so the two are never live
143
+ // at once, and both mean "step to the next one" wherever you press them. The
144
+ // backward half needs Kitty, like every other shift-modified default here.
145
+ "app.session.color.cycleForward": {
146
+ defaultKeys: "alt+c",
147
+ description: "Cycle the session chip's color",
148
+ },
149
+ "app.session.color.cycleBackward": {
150
+ defaultKeys: "shift+alt+c",
151
+ description: "Cycle the session chip's color backward",
152
+ },
152
153
  "app.settings.open": { defaultKeys: "alt+s", description: "Open settings" },
153
154
  "app.hotkeys.open": { defaultKeys: "alt+k", description: "Show keyboard shortcuts" },
154
155
  "app.m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,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AAAA,CACD;AAED,MAAM,OAAO,kBAAmB,SAAQ,qBAAqB;IACpD,UAAU,CAAqB;IAEvC,YAAY,YAAY,GAAsB,EAAE,EAAE,UAAmB,EAAE;QACtE,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAAA,CAC7B;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAW,WAAW,EAAE,EAAsB;QACnE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QACtD,MAAM,YAAY,GAAG,kBAAkB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACjE,OAAO,IAAI,kBAAkB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAAA,CACxD;IAED,MAAM,GAAS;QACd,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7B,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAAA,CACvE;IAED,kBAAkB,GAAsB;QACvC,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAAA,CAClC;IAEO,MAAM,CAAC,YAAY,CAAC,IAAY,EAAqB;QAC5D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS;YAAE,OAAO,EAAE,CAAC;QAC1B,OAAO,mBAAmB,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IAAA,CACvE;CACD","sourcesContent":["import {\n\ttype Keybinding,\n\ttype KeybindingDefinitions,\n\ttype KeybindingsConfig,\n\ttype KeyId,\n\tTUI_KEYBINDINGS,\n\tKeybindingsManager as TuiKeybindingsManager,\n} from \"@kolisachint/hoocode-tui\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getAgentDir } from \"../config.js\";\n\ninterface AppKeybindings {\n\t\"app.interrupt\": true;\n\t\"app.clear\": true;\n\t\"app.exit\": true;\n\t\"app.suspend\": true;\n\t\"app.thinking.cycle\": true;\n\t\"app.model.cycleForward\": true;\n\t\"app.model.cycleBackward\": true;\n\t\"app.model.select\": true;\n\t\"app.tools.expand\": true;\n\t\"app.view.cycleForward\": true;\n\t\"app.view.cycleBackward\": true;\n\t\"app.tools.unfoldOne\": true;\n\t\"app.tools.foldOne\": true;\n\t\"app.thinking.toggle\": true;\n\t\"app.tasks.cycleView\": true;\n\t\"app.team.focus\": true;\n\t\"app.team.nudge\": true;\n\t\"app.team.attach\": true;\n\t\"app.session.toggleNamedFilter\": true;\n\t\"app.editor.external\": true;\n\t\"app.message.followUp\": true;\n\t\"app.message.dequeue\": true;\n\t\"app.clipboard.pasteImage\": true;\n\t\"app.input.voiceTranscribe\": true;\n\t\"app.session.new\": true;\n\t\"app.session.tree\": true;\n\t\"app.session.fork\": true;\n\t\"app.session.resume\": true;\n\t\"app.session.changeDirectory\": true;\n\t\"app.settings.open\": true;\n\t\"app.hotkeys.open\": true;\n\t\"app.mode.cycle\": true;\n\t\"app.tree.foldOrUp\": true;\n\t\"app.tree.unfoldOrDown\": true;\n\t\"app.tree.editLabel\": true;\n\t\"app.tree.toggleLabelTimestamp\": true;\n\t\"app.session.togglePath\": true;\n\t\"app.session.toggleSort\": true;\n\t\"app.session.rename\": true;\n\t\"app.session.delete\": true;\n\t\"app.session.deleteNoninvasive\": true;\n\t\"app.models.save\": true;\n\t\"app.models.enableAll\": true;\n\t\"app.models.clearAll\": true;\n\t\"app.models.toggleProvider\": true;\n\t\"app.models.reorderUp\": true;\n\t\"app.models.reorderDown\": true;\n\t\"app.tree.filter.default\": true;\n\t\"app.tree.filter.noTools\": true;\n\t\"app.tree.filter.userOnly\": true;\n\t\"app.tree.filter.labeledOnly\": true;\n\t\"app.tree.filter.all\": true;\n\t\"app.tree.filter.cycleForward\": true;\n\t\"app.tree.filter.cycleBackward\": true;\n}\n\nexport type AppKeybinding = keyof AppKeybindings;\n\ndeclare module \"@kolisachint/hoocode-tui\" {\n\tinterface Keybindings extends AppKeybindings {}\n}\n\n/**\n * The cockpit layout.\n *\n * Three rings, and which ring a key belongs to is decided by its modifier:\n *\n * - **ctrl — the view.** What is on screen right now: expand, thinking blocks,\n * task panel, model cycling. Pressed many times a minute, so they sit under\n * the hand and never require a second modifier.\n * - **alt — the cockpit.** What the agent *is* and where it works: model,\n * mode, working directory, settings, sessions. Pressed a few times a session.\n * - **overlays.** Inside a picker, the query line is a text field, so every\n * `ctrl+<letter>` there belongs to the *text* (ctrl+a start of line, ctrl+u\n * kill line, ctrl+w kill word). A picker's own verbs are therefore all on\n * `alt+<letter>`, mnemonic to that picker; the picker captures keys while it\n * is open, so reusing a global letter there is unambiguous.\n *\n * Two rules keep the set learnable: shift reverses whatever the unshifted key\n * does, and no binding takes a key the editor or the terminal already owns\n * (ctrl+a/e/b/f/k/u/w/y/d/l/r/g, ctrl+s XOFF, ctrl+m == enter, ctrl+i == tab).\n *\n * Two constraints from the key parser shape which alt keys are usable at all,\n * and `test/keybinding-layout.test.ts` holds both:\n *\n * - Only `alt+<letter>` and `alt+<digit>` survive a terminal without the Kitty\n * keyboard protocol. `alt+[` and `alt+]` arrive as the CSI and OSC\n * introducers and are not parsed as keys; nor is any shift-modified key, so a\n * `shift+…` default is a Kitty-only convenience on top of an unshifted key\n * that works everywhere (as `shift+ctrl+p` has always been).\n * - Legacy `alt+p` and `alt+n` are also accepted as `alt+up` and `alt+down`\n * (the emacs previous/next aliases), so no scope may bind both halves of\n * either pair.\n */\nexport const KEYBINDINGS = {\n\t...TUI_KEYBINDINGS,\n\t\"app.interrupt\": { defaultKeys: \"escape\", description: \"Cancel or abort\" },\n\t\"app.clear\": { defaultKeys: \"ctrl+c\", description: \"Clear editor\" },\n\t\"app.exit\": { defaultKeys: \"ctrl+d\", description: \"Exit when editor is empty\" },\n\t\"app.suspend\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? [] : \"ctrl+z\",\n\t\tdescription: \"Suspend to background\",\n\t},\n\t\"app.thinking.cycle\": {\n\t\tdefaultKeys: \"shift+tab\",\n\t\tdescription: \"Cycle thinking level\",\n\t},\n\t\"app.model.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Cycle to next model\",\n\t},\n\t\"app.model.cycleBackward\": {\n\t\tdefaultKeys: \"shift+ctrl+p\",\n\t\tdescription: \"Cycle to previous model\",\n\t},\n\t// alt+m, not ctrl+l: ctrl+l is \"clear the screen\" in every shell and every\n\t// full-screen terminal app, and users press it reflexively to tidy up. It\n\t// opening a model dialog is the single most surprising key in the old set.\n\t\"app.model.select\": { defaultKeys: \"alt+m\", description: \"Open model selector\" },\n\t\"app.tools.expand\": {\n\t\tdefaultKeys: \"ctrl+o\",\n\t\tdescription: \"Expand or collapse what is in front of you (tool bodies, header, summaries)\",\n\t},\n\t// The view dial pairs with ctrl+o on purpose: same letter, different ring.\n\t// ctrl+o opens what is already there; alt+o decides how much is ever there.\n\t\"app.view.cycleForward\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Cycle tool output view (radar → glance → full)\",\n\t},\n\t\"app.view.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+o\",\n\t\tdescription: \"Cycle tool output view backward\",\n\t},\n\t// The one-at-a-time counterpart to ctrl+o's all-or-nothing. The transcript is\n\t// bottom-anchored with no app-level scrolling — anything far enough up is in\n\t// the terminal's own scrollback, which this process cannot address — so \"open\n\t// one\" can only ever mean \"open one at the tail\". Repeating the key peels\n\t// backwards from there.\n\t\"app.tools.unfoldOne\": {\n\t\tdefaultKeys: \"alt+u\",\n\t\tdescription: \"Open the newest folded thing — a chain in radar, a tool body otherwise\",\n\t},\n\t\"app.tools.foldOne\": {\n\t\tdefaultKeys: \"shift+alt+u\",\n\t\tdescription: \"Re-fold the most recently opened chain or tool block\",\n\t},\n\t\"app.thinking.toggle\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Toggle thinking blocks\",\n\t},\n\t\"app.tasks.cycleView\": {\n\t\t// ctrl+n is free in the main editor (no emacs next-line binding here).\n\t\tdefaultKeys: \"ctrl+n\",\n\t\tdescription: \"Cycle task panel view (tasks → subagents → teams, skips empty lenses)\",\n\t},\n\t\"app.team.focus\": {\n\t\t// Pairs with ctrl+n (cycle task panel view): alt+n steps INTO the teams\n\t\t// lens and focuses the role roster (--team only). Not shift+ctrl+n —\n\t\t// Windows Terminal intercepts that as its \"new window\" shortcut, the\n\t\t// same trap that moved app.tasks.cycleView off ctrl+shift+t.\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Focus the team roster (navigate roles, n nudge, a attach)\",\n\t},\n\t\"app.team.nudge\": {\n\t\t// Plain letters are safe here: these fire only while the task panel holds\n\t\t// focus (team-focus mode), never while typing in the editor.\n\t\tdefaultKeys: \"n\",\n\t\tdescription: \"Nudge the selected team role (team focus mode)\",\n\t},\n\t\"app.team.attach\": {\n\t\tdefaultKeys: \"a\",\n\t\tdescription: \"Attach to the selected team role (team focus mode)\",\n\t},\n\t// alt+e, not ctrl+g: ctrl+g is emacs/readline \"abort\" — the key you hit to\n\t// get out of something. Having it launch $EDITOR inverts that reflex.\n\t\"app.editor.external\": {\n\t\tdefaultKeys: \"alt+e\",\n\t\tdescription: \"Open external editor\",\n\t},\n\t\"app.message.followUp\": {\n\t\tdefaultKeys: \"alt+enter\",\n\t\tdescription: \"Queue follow-up message\",\n\t},\n\t\"app.message.dequeue\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Restore queued messages\",\n\t},\n\t\"app.clipboard.pasteImage\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? \"alt+v\" : \"ctrl+v\",\n\t\tdescription: \"Paste image from clipboard\",\n\t},\n\t// alt+r, not ctrl+r: ctrl+r is reverse history search in every shell, and it\n\t// was also the session picker's rename key — one chord, two meanings.\n\t\"app.input.voiceTranscribe\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Record voice and transcribe into the editor\",\n\t},\n\t// The two destructive-ish session moves stay unbound by default. /new\n\t// replaces the transcript and /fork needs a message picked out of it, so\n\t// neither wants to be one stray chord away; both remain bindable by hand.\n\t\"app.session.new\": { defaultKeys: [], description: \"Start a new session\" },\n\t\"app.session.fork\": { defaultKeys: [], description: \"Fork current session\" },\n\t// Navigation is non-destructive, so it gets keys: t for tree, h for history.\n\t\"app.session.tree\": { defaultKeys: \"alt+t\", description: \"Open session tree\" },\n\t\"app.session.resume\": { defaultKeys: \"alt+h\", description: \"Resume a session from history\" },\n\t\"app.session.changeDirectory\": {\n\t\tdefaultKeys: \"alt+w\",\n\t\tdescription: \"Change working directory (move to another repo without quitting)\",\n\t},\n\t\"app.settings.open\": { defaultKeys: \"alt+s\", description: \"Open settings\" },\n\t\"app.hotkeys.open\": { defaultKeys: \"alt+k\", description: \"Show keyboard shortcuts\" },\n\t\"app.mode.cycle\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Cycle agent mode (ask → plan → build → debug)\",\n\t},\n\t\"app.tree.foldOrUp\": {\n\t\tdefaultKeys: [\"ctrl+left\", \"alt+left\"],\n\t\tdescription: \"Fold tree branch or move up\",\n\t},\n\t\"app.tree.unfoldOrDown\": {\n\t\tdefaultKeys: [\"ctrl+right\", \"alt+right\"],\n\t\tdescription: \"Unfold tree branch or move down\",\n\t},\n\t\"app.tree.editLabel\": {\n\t\tdefaultKeys: \"shift+l\",\n\t\tdescription: \"Edit tree label\",\n\t},\n\t\"app.tree.toggleLabelTimestamp\": {\n\t\tdefaultKeys: \"shift+t\",\n\t\tdescription: \"Toggle tree label timestamps\",\n\t},\n\t// Session picker verbs. All on alt so the picker's query line keeps the\n\t// emacs editing keys it used to lose: ctrl+a jumped to the start of the\n\t// query *and* enabled every model, ctrl+d deleted a character *and* deleted\n\t// the highlighted session.\n\t\"app.session.togglePath\": {\n\t\tdefaultKeys: \"alt+p\",\n\t\tdescription: \"Toggle session path display\",\n\t},\n\t\"app.session.toggleSort\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Toggle session sort order\",\n\t},\n\t\"app.session.rename\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Rename session\",\n\t},\n\t\"app.session.toggleNamedFilter\": {\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Toggle named session filter\",\n\t},\n\t\"app.session.delete\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Delete session\",\n\t},\n\t\"app.session.deleteNoninvasive\": {\n\t\tdefaultKeys: \"ctrl+backspace\",\n\t\tdescription: \"Delete session when query is empty\",\n\t},\n\t// Model picker verbs, same rule. ctrl+s in particular was XOFF: on a terminal\n\t// with flow control still on, \"save\" froze the session instead.\n\t\"app.models.save\": {\n\t\tdefaultKeys: \"alt+s\",\n\t\tdescription: \"Save model selection\",\n\t},\n\t\"app.models.enableAll\": {\n\t\tdefaultKeys: \"alt+a\",\n\t\tdescription: \"Enable all models\",\n\t},\n\t\"app.models.clearAll\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Clear all models\",\n\t},\n\t// alt+g (\"group\"), not alt+p: on a terminal without the Kitty protocol, alt+p\n\t// arrives as ESC-p, which the key parser also accepts as alt+up — and alt+up\n\t// is this same picker's reorder key.\n\t\"app.models.toggleProvider\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Toggle all models for provider\",\n\t},\n\t\"app.models.reorderUp\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Move model up in order\",\n\t},\n\t\"app.models.reorderDown\": {\n\t\tdefaultKeys: \"alt+down\",\n\t\tdescription: \"Move model down in order\",\n\t},\n\t\"app.options.next\": { defaultKeys: \"right\", description: \"Confirm and advance to the next question\" },\n\t\"app.options.back\": { defaultKeys: \"left\", description: \"Go back to the previous question\" },\n\t// Five lenses in a fixed order, so they are numbered rather than lettered:\n\t// alt+1..alt+5 needs no mnemonic and collides with nothing. The old set\n\t// (ctrl+d/t/u/l/a) collided with delete-char, thinking, kill-to-start,\n\t// clear-screen and start-of-line respectively.\n\t\"app.tree.filter.default\": {\n\t\tdefaultKeys: \"alt+1\",\n\t\tdescription: \"Tree filter: default view\",\n\t},\n\t\"app.tree.filter.noTools\": {\n\t\tdefaultKeys: \"alt+2\",\n\t\tdescription: \"Tree filter: hide tool results\",\n\t},\n\t\"app.tree.filter.userOnly\": {\n\t\tdefaultKeys: \"alt+3\",\n\t\tdescription: \"Tree filter: user messages only\",\n\t},\n\t\"app.tree.filter.labeledOnly\": {\n\t\tdefaultKeys: \"alt+4\",\n\t\tdescription: \"Tree filter: labeled entries only\",\n\t},\n\t\"app.tree.filter.all\": {\n\t\tdefaultKeys: \"alt+5\",\n\t\tdescription: \"Tree filter: show all entries\",\n\t},\n\t// alt+c for \"cycle\". Not a bracket pair, tempting as `alt+[` / `alt+]` are:\n\t// without the Kitty protocol those arrive as ESC-[ and ESC-], which are the\n\t// CSI and OSC introducers and so are not parsed as keys at all. The backward\n\t// half needs Kitty, like every other shift-modified default here.\n\t\"app.tree.filter.cycleForward\": {\n\t\tdefaultKeys: \"alt+c\",\n\t\tdescription: \"Tree filter: cycle forward\",\n\t},\n\t\"app.tree.filter.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+c\",\n\t\tdescription: \"Tree filter: cycle backward\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nconst KEYBINDING_NAME_MIGRATIONS = {\n\tcursorUp: \"tui.editor.cursorUp\",\n\tcursorDown: \"tui.editor.cursorDown\",\n\tcursorLeft: \"tui.editor.cursorLeft\",\n\tcursorRight: \"tui.editor.cursorRight\",\n\tcursorWordLeft: \"tui.editor.cursorWordLeft\",\n\tcursorWordRight: \"tui.editor.cursorWordRight\",\n\tcursorLineStart: \"tui.editor.cursorLineStart\",\n\tcursorLineEnd: \"tui.editor.cursorLineEnd\",\n\tjumpForward: \"tui.editor.jumpForward\",\n\tjumpBackward: \"tui.editor.jumpBackward\",\n\tpageUp: \"tui.editor.pageUp\",\n\tpageDown: \"tui.editor.pageDown\",\n\tdeleteCharBackward: \"tui.editor.deleteCharBackward\",\n\tdeleteCharForward: \"tui.editor.deleteCharForward\",\n\tdeleteWordBackward: \"tui.editor.deleteWordBackward\",\n\tdeleteWordForward: \"tui.editor.deleteWordForward\",\n\tdeleteToLineStart: \"tui.editor.deleteToLineStart\",\n\tdeleteToLineEnd: \"tui.editor.deleteToLineEnd\",\n\tyank: \"tui.editor.yank\",\n\tyankPop: \"tui.editor.yankPop\",\n\tundo: \"tui.editor.undo\",\n\tnewLine: \"tui.input.newLine\",\n\tsubmit: \"tui.input.submit\",\n\ttab: \"tui.input.tab\",\n\tcopy: \"tui.input.copy\",\n\tselectUp: \"tui.select.up\",\n\tselectDown: \"tui.select.down\",\n\tselectPageUp: \"tui.select.pageUp\",\n\tselectPageDown: \"tui.select.pageDown\",\n\tselectConfirm: \"tui.select.confirm\",\n\tselectCancel: \"tui.select.cancel\",\n\tinterrupt: \"app.interrupt\",\n\tclear: \"app.clear\",\n\texit: \"app.exit\",\n\tsuspend: \"app.suspend\",\n\tcycleThinkingLevel: \"app.thinking.cycle\",\n\tcycleModelForward: \"app.model.cycleForward\",\n\tcycleModelBackward: \"app.model.cycleBackward\",\n\tselectModel: \"app.model.select\",\n\texpandTools: \"app.tools.expand\",\n\ttoggleThinking: \"app.thinking.toggle\",\n\ttoggleSessionNamedFilter: \"app.session.toggleNamedFilter\",\n\texternalEditor: \"app.editor.external\",\n\tfollowUp: \"app.message.followUp\",\n\tdequeue: \"app.message.dequeue\",\n\tpasteImage: \"app.clipboard.pasteImage\",\n\tnewSession: \"app.session.new\",\n\ttree: \"app.session.tree\",\n\tfork: \"app.session.fork\",\n\tresume: \"app.session.resume\",\n\ttreeFoldOrUp: \"app.tree.foldOrUp\",\n\ttreeUnfoldOrDown: \"app.tree.unfoldOrDown\",\n\ttreeEditLabel: \"app.tree.editLabel\",\n\ttreeToggleLabelTimestamp: \"app.tree.toggleLabelTimestamp\",\n\ttoggleSessionPath: \"app.session.togglePath\",\n\ttoggleSessionSort: \"app.session.toggleSort\",\n\trenameSession: \"app.session.rename\",\n\tdeleteSession: \"app.session.delete\",\n\tdeleteSessionNoninvasive: \"app.session.deleteNoninvasive\",\n} as const satisfies Record<string, Keybinding>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLegacyKeybindingName(key: string): key is keyof typeof KEYBINDING_NAME_MIGRATIONS {\n\treturn key in KEYBINDING_NAME_MIGRATIONS;\n}\n\nfunction toKeybindingsConfig(value: unknown): KeybindingsConfig {\n\tif (!isRecord(value)) return {};\n\n\tconst config: KeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (typeof binding === \"string\") {\n\t\t\tconfig[key] = binding as KeyId;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as KeyId[];\n\t\t}\n\t}\n\treturn config;\n}\n\nexport function migrateKeybindingsConfig(rawConfig: Record<string, unknown>): {\n\tconfig: Record<string, unknown>;\n\tmigrated: boolean;\n} {\n\tconst config: Record<string, unknown> = {};\n\tlet migrated = false;\n\n\tfor (const [key, value] of Object.entries(rawConfig)) {\n\t\tconst nextKey = isLegacyKeybindingName(key) ? KEYBINDING_NAME_MIGRATIONS[key] : key;\n\t\tif (nextKey !== key) {\n\t\t\tmigrated = true;\n\t\t}\n\t\tif (key !== nextKey && Object.hasOwn(rawConfig, nextKey)) {\n\t\t\tmigrated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconfig[nextKey] = value;\n\t}\n\n\treturn { config: orderKeybindingsConfig(config), migrated };\n}\n\nfunction orderKeybindingsConfig(config: Record<string, unknown>): Record<string, unknown> {\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const keybinding of Object.keys(KEYBINDINGS)) {\n\t\tif (Object.hasOwn(config, keybinding)) {\n\t\t\tordered[keybinding] = config[keybinding];\n\t\t}\n\t}\n\n\tconst extras = Object.keys(config)\n\t\t.filter((key) => !Object.hasOwn(ordered, key))\n\t\t.sort();\n\tfor (const key of extras) {\n\t\tordered[key] = config[key];\n\t}\n\n\treturn ordered;\n}\n\nfunction loadRawConfig(path: string): Record<string, unknown> | undefined {\n\tif (!existsSync(path)) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(path, \"utf-8\")) as unknown;\n\t\treturn isRecord(parsed) ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport class KeybindingsManager extends TuiKeybindingsManager {\n\tprivate configPath: string | undefined;\n\n\tconstructor(userBindings: KeybindingsConfig = {}, configPath?: string) {\n\t\tsuper(KEYBINDINGS, userBindings);\n\t\tthis.configPath = configPath;\n\t}\n\n\tstatic create(agentDir: string = getAgentDir()): KeybindingsManager {\n\t\tconst configPath = join(agentDir, \"keybindings.json\");\n\t\tconst userBindings = KeybindingsManager.loadFromFile(configPath);\n\t\treturn new KeybindingsManager(userBindings, configPath);\n\t}\n\n\treload(): void {\n\t\tif (!this.configPath) return;\n\t\tthis.setUserBindings(KeybindingsManager.loadFromFile(this.configPath));\n\t}\n\n\tgetEffectiveConfig(): KeybindingsConfig {\n\t\treturn this.getResolvedBindings();\n\t}\n\n\tprivate static loadFromFile(path: string): KeybindingsConfig {\n\t\tconst rawConfig = loadRawConfig(path);\n\t\tif (!rawConfig) return {};\n\t\treturn toKeybindingsConfig(migrateKeybindingsConfig(rawConfig).config);\n\t}\n}\n\nexport type { KeyId, KeybindingsConfig };\n"]}
1
+ {"version":3,"file":"keybindings.js","sourceRoot":"","sources":["../../src/core/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,eAAe,EACf,kBAAkB,IAAI,qBAAqB,GAC3C,MAAM,0BAA0B,CAAC;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E,EAAE,UAAmB,EAAE;QACtE,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAAA,CAC7B;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAW,WAAW,EAAE,EAAsB;QACnE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QACtD,MAAM,YAAY,GAAG,kBAAkB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACjE,OAAO,IAAI,kBAAkB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAAA,CACxD;IAED,MAAM,GAAS;QACd,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7B,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAAA,CACvE;IAED,kBAAkB,GAAsB;QACvC,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAAA,CAClC;IAEO,MAAM,CAAC,YAAY,CAAC,IAAY,EAAqB;QAC5D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS;YAAE,OAAO,EAAE,CAAC;QAC1B,OAAO,mBAAmB,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IAAA,CACvE;CACD","sourcesContent":["import {\n\ttype Keybinding,\n\ttype KeybindingDefinitions,\n\ttype KeybindingsConfig,\n\ttype KeyId,\n\tTUI_KEYBINDINGS,\n\tKeybindingsManager as TuiKeybindingsManager,\n} from \"@kolisachint/hoocode-tui\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getAgentDir } from \"../config.js\";\n\ninterface AppKeybindings {\n\t\"app.interrupt\": true;\n\t\"app.clear\": true;\n\t\"app.exit\": true;\n\t\"app.suspend\": true;\n\t\"app.thinking.cycle\": true;\n\t\"app.model.cycleForward\": true;\n\t\"app.model.cycleBackward\": true;\n\t\"app.model.select\": true;\n\t\"app.tools.expand\": true;\n\t\"app.view.cycleForward\": true;\n\t\"app.view.cycleBackward\": true;\n\t\"app.thinking.toggle\": true;\n\t\"app.tasks.cycleView\": true;\n\t\"app.team.focus\": true;\n\t\"app.team.nudge\": true;\n\t\"app.team.attach\": true;\n\t\"app.session.toggleNamedFilter\": true;\n\t\"app.editor.external\": true;\n\t\"app.message.followUp\": true;\n\t\"app.message.dequeue\": true;\n\t\"app.clipboard.pasteImage\": true;\n\t\"app.input.voiceTranscribe\": true;\n\t\"app.session.new\": true;\n\t\"app.session.tree\": true;\n\t\"app.session.fork\": true;\n\t\"app.session.resume\": true;\n\t\"app.session.changeDirectory\": true;\n\t\"app.session.color.cycleForward\": true;\n\t\"app.session.color.cycleBackward\": true;\n\t\"app.settings.open\": true;\n\t\"app.hotkeys.open\": true;\n\t\"app.mode.cycle\": true;\n\t\"app.tree.foldOrUp\": true;\n\t\"app.tree.unfoldOrDown\": true;\n\t\"app.tree.editLabel\": true;\n\t\"app.tree.toggleLabelTimestamp\": true;\n\t\"app.session.togglePath\": true;\n\t\"app.session.toggleSort\": true;\n\t\"app.session.rename\": true;\n\t\"app.session.delete\": true;\n\t\"app.session.deleteNoninvasive\": true;\n\t\"app.models.save\": true;\n\t\"app.models.enableAll\": true;\n\t\"app.models.clearAll\": true;\n\t\"app.models.toggleProvider\": true;\n\t\"app.models.reorderUp\": true;\n\t\"app.models.reorderDown\": true;\n\t\"app.tree.filter.default\": true;\n\t\"app.tree.filter.noTools\": true;\n\t\"app.tree.filter.userOnly\": true;\n\t\"app.tree.filter.labeledOnly\": true;\n\t\"app.tree.filter.all\": true;\n\t\"app.tree.filter.cycleForward\": true;\n\t\"app.tree.filter.cycleBackward\": true;\n}\n\nexport type AppKeybinding = keyof AppKeybindings;\n\ndeclare module \"@kolisachint/hoocode-tui\" {\n\tinterface Keybindings extends AppKeybindings {}\n}\n\n/**\n * The cockpit layout.\n *\n * Three rings, and which ring a key belongs to is decided by its modifier:\n *\n * - **ctrl — the view.** What is on screen right now: expand, thinking blocks,\n * task panel, model cycling. Pressed many times a minute, so they sit under\n * the hand and never require a second modifier.\n * - **alt — the cockpit.** What the agent *is* and where it works: model,\n * mode, working directory, settings, sessions. Pressed a few times a session.\n * - **overlays.** Inside a picker, the query line is a text field, so every\n * `ctrl+<letter>` there belongs to the *text* (ctrl+a start of line, ctrl+u\n * kill line, ctrl+w kill word). A picker's own verbs are therefore all on\n * `alt+<letter>`, mnemonic to that picker; the picker captures keys while it\n * is open, so reusing a global letter there is unambiguous.\n *\n * Two rules keep the set learnable: shift reverses whatever the unshifted key\n * does, and no binding takes a key the editor or the terminal already owns\n * (ctrl+a/e/b/f/k/u/w/y/d/l/r/g, ctrl+s XOFF, ctrl+m == enter, ctrl+i == tab).\n *\n * Two constraints from the key parser shape which alt keys are usable at all,\n * and `test/keybinding-layout.test.ts` holds both:\n *\n * - Only `alt+<letter>` and `alt+<digit>` survive a terminal without the Kitty\n * keyboard protocol. `alt+[` and `alt+]` arrive as the CSI and OSC\n * introducers and are not parsed as keys; nor is any shift-modified key, so a\n * `shift+…` default is a Kitty-only convenience on top of an unshifted key\n * that works everywhere (as `shift+ctrl+p` has always been).\n * - Legacy `alt+p` and `alt+n` are also accepted as `alt+up` and `alt+down`\n * (the emacs previous/next aliases), so no scope may bind both halves of\n * either pair.\n */\nexport const KEYBINDINGS = {\n\t...TUI_KEYBINDINGS,\n\t\"app.interrupt\": { defaultKeys: \"escape\", description: \"Cancel or abort\" },\n\t\"app.clear\": { defaultKeys: \"ctrl+c\", description: \"Clear editor\" },\n\t\"app.exit\": { defaultKeys: \"ctrl+d\", description: \"Exit when editor is empty\" },\n\t\"app.suspend\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? [] : \"ctrl+z\",\n\t\tdescription: \"Suspend to background\",\n\t},\n\t\"app.thinking.cycle\": {\n\t\tdefaultKeys: \"shift+tab\",\n\t\tdescription: \"Cycle thinking level\",\n\t},\n\t\"app.model.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Cycle to next model\",\n\t},\n\t\"app.model.cycleBackward\": {\n\t\tdefaultKeys: \"shift+ctrl+p\",\n\t\tdescription: \"Cycle to previous model\",\n\t},\n\t// alt+m, not ctrl+l: ctrl+l is \"clear the screen\" in every shell and every\n\t// full-screen terminal app, and users press it reflexively to tidy up. It\n\t// opening a model dialog is the single most surprising key in the old set.\n\t\"app.model.select\": { defaultKeys: \"alt+m\", description: \"Open model selector\" },\n\t\"app.tools.expand\": {\n\t\tdefaultKeys: \"ctrl+o\",\n\t\tdescription: \"Jump to the full view from wherever you are, and back again\",\n\t},\n\t// The view dial pairs with ctrl+o on purpose: same letter, different ring.\n\t// alt+o walks the dial a stop at a time and saves where it lands; ctrl+o\n\t// jumps to the far end and back without moving your home stop. One value\n\t// between them, so there is no second \"expanded\" state to keep in sync.\n\t\"app.view.cycleForward\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Cycle tool output view (radar → peek → full)\",\n\t},\n\t\"app.view.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+o\",\n\t\tdescription: \"Cycle tool output view backward\",\n\t},\n\t\"app.thinking.toggle\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Toggle thinking blocks\",\n\t},\n\t\"app.tasks.cycleView\": {\n\t\t// ctrl+n is free in the main editor (no emacs next-line binding here).\n\t\tdefaultKeys: \"ctrl+n\",\n\t\tdescription: \"Cycle task panel view (tasks → subagents → teams, skips empty lenses)\",\n\t},\n\t\"app.team.focus\": {\n\t\t// Pairs with ctrl+n (cycle task panel view): alt+n steps INTO the teams\n\t\t// lens and focuses the role roster (--team only). Not shift+ctrl+n —\n\t\t// Windows Terminal intercepts that as its \"new window\" shortcut, the\n\t\t// same trap that moved app.tasks.cycleView off ctrl+shift+t.\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Focus the team roster (navigate roles, n nudge, a attach)\",\n\t},\n\t\"app.team.nudge\": {\n\t\t// Plain letters are safe here: these fire only while the task panel holds\n\t\t// focus (team-focus mode), never while typing in the editor.\n\t\tdefaultKeys: \"n\",\n\t\tdescription: \"Nudge the selected team role (team focus mode)\",\n\t},\n\t\"app.team.attach\": {\n\t\tdefaultKeys: \"a\",\n\t\tdescription: \"Attach to the selected team role (team focus mode)\",\n\t},\n\t// alt+e, not ctrl+g: ctrl+g is emacs/readline \"abort\" — the key you hit to\n\t// get out of something. Having it launch $EDITOR inverts that reflex.\n\t\"app.editor.external\": {\n\t\tdefaultKeys: \"alt+e\",\n\t\tdescription: \"Open external editor\",\n\t},\n\t\"app.message.followUp\": {\n\t\tdefaultKeys: \"alt+enter\",\n\t\tdescription: \"Queue follow-up message\",\n\t},\n\t\"app.message.dequeue\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Restore queued messages\",\n\t},\n\t\"app.clipboard.pasteImage\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? \"alt+v\" : \"ctrl+v\",\n\t\tdescription: \"Paste image from clipboard\",\n\t},\n\t// alt+r, not ctrl+r: ctrl+r is reverse history search in every shell, and it\n\t// was also the session picker's rename key — one chord, two meanings.\n\t\"app.input.voiceTranscribe\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Record voice and transcribe into the editor\",\n\t},\n\t// The two destructive-ish session moves stay unbound by default. /new\n\t// replaces the transcript and /fork needs a message picked out of it, so\n\t// neither wants to be one stray chord away; both remain bindable by hand.\n\t\"app.session.new\": { defaultKeys: [], description: \"Start a new session\" },\n\t\"app.session.fork\": { defaultKeys: [], description: \"Fork current session\" },\n\t// Navigation is non-destructive, so it gets keys: t for tree, h for history.\n\t\"app.session.tree\": { defaultKeys: \"alt+t\", description: \"Open session tree\" },\n\t\"app.session.resume\": { defaultKeys: \"alt+h\", description: \"Resume a session from history\" },\n\t\"app.session.changeDirectory\": {\n\t\tdefaultKeys: \"alt+w\",\n\t\tdescription: \"Change working directory (move to another repo without quitting)\",\n\t},\n\t// alt+c (\"colour\"), and the tree's filter cycle has the same letter on\n\t// purpose: the tree captures keys while it is open, so the two are never live\n\t// at once, and both mean \"step to the next one\" wherever you press them. The\n\t// backward half needs Kitty, like every other shift-modified default here.\n\t\"app.session.color.cycleForward\": {\n\t\tdefaultKeys: \"alt+c\",\n\t\tdescription: \"Cycle the session chip's color\",\n\t},\n\t\"app.session.color.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+c\",\n\t\tdescription: \"Cycle the session chip's color backward\",\n\t},\n\t\"app.settings.open\": { defaultKeys: \"alt+s\", description: \"Open settings\" },\n\t\"app.hotkeys.open\": { defaultKeys: \"alt+k\", description: \"Show keyboard shortcuts\" },\n\t\"app.mode.cycle\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Cycle agent mode (ask → plan → build → debug)\",\n\t},\n\t\"app.tree.foldOrUp\": {\n\t\tdefaultKeys: [\"ctrl+left\", \"alt+left\"],\n\t\tdescription: \"Fold tree branch or move up\",\n\t},\n\t\"app.tree.unfoldOrDown\": {\n\t\tdefaultKeys: [\"ctrl+right\", \"alt+right\"],\n\t\tdescription: \"Unfold tree branch or move down\",\n\t},\n\t\"app.tree.editLabel\": {\n\t\tdefaultKeys: \"shift+l\",\n\t\tdescription: \"Edit tree label\",\n\t},\n\t\"app.tree.toggleLabelTimestamp\": {\n\t\tdefaultKeys: \"shift+t\",\n\t\tdescription: \"Toggle tree label timestamps\",\n\t},\n\t// Session picker verbs. All on alt so the picker's query line keeps the\n\t// emacs editing keys it used to lose: ctrl+a jumped to the start of the\n\t// query *and* enabled every model, ctrl+d deleted a character *and* deleted\n\t// the highlighted session.\n\t\"app.session.togglePath\": {\n\t\tdefaultKeys: \"alt+p\",\n\t\tdescription: \"Toggle session path display\",\n\t},\n\t\"app.session.toggleSort\": {\n\t\tdefaultKeys: \"alt+o\",\n\t\tdescription: \"Toggle session sort order\",\n\t},\n\t\"app.session.rename\": {\n\t\tdefaultKeys: \"alt+r\",\n\t\tdescription: \"Rename session\",\n\t},\n\t\"app.session.toggleNamedFilter\": {\n\t\tdefaultKeys: \"alt+n\",\n\t\tdescription: \"Toggle named session filter\",\n\t},\n\t\"app.session.delete\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Delete session\",\n\t},\n\t\"app.session.deleteNoninvasive\": {\n\t\tdefaultKeys: \"ctrl+backspace\",\n\t\tdescription: \"Delete session when query is empty\",\n\t},\n\t// Model picker verbs, same rule. ctrl+s in particular was XOFF: on a terminal\n\t// with flow control still on, \"save\" froze the session instead.\n\t\"app.models.save\": {\n\t\tdefaultKeys: \"alt+s\",\n\t\tdescription: \"Save model selection\",\n\t},\n\t\"app.models.enableAll\": {\n\t\tdefaultKeys: \"alt+a\",\n\t\tdescription: \"Enable all models\",\n\t},\n\t\"app.models.clearAll\": {\n\t\tdefaultKeys: \"alt+x\",\n\t\tdescription: \"Clear all models\",\n\t},\n\t// alt+g (\"group\"), not alt+p: on a terminal without the Kitty protocol, alt+p\n\t// arrives as ESC-p, which the key parser also accepts as alt+up — and alt+up\n\t// is this same picker's reorder key.\n\t\"app.models.toggleProvider\": {\n\t\tdefaultKeys: \"alt+g\",\n\t\tdescription: \"Toggle all models for provider\",\n\t},\n\t\"app.models.reorderUp\": {\n\t\tdefaultKeys: \"alt+up\",\n\t\tdescription: \"Move model up in order\",\n\t},\n\t\"app.models.reorderDown\": {\n\t\tdefaultKeys: \"alt+down\",\n\t\tdescription: \"Move model down in order\",\n\t},\n\t\"app.options.next\": { defaultKeys: \"right\", description: \"Confirm and advance to the next question\" },\n\t\"app.options.back\": { defaultKeys: \"left\", description: \"Go back to the previous question\" },\n\t// Five lenses in a fixed order, so they are numbered rather than lettered:\n\t// alt+1..alt+5 needs no mnemonic and collides with nothing. The old set\n\t// (ctrl+d/t/u/l/a) collided with delete-char, thinking, kill-to-start,\n\t// clear-screen and start-of-line respectively.\n\t\"app.tree.filter.default\": {\n\t\tdefaultKeys: \"alt+1\",\n\t\tdescription: \"Tree filter: default view\",\n\t},\n\t\"app.tree.filter.noTools\": {\n\t\tdefaultKeys: \"alt+2\",\n\t\tdescription: \"Tree filter: hide tool results\",\n\t},\n\t\"app.tree.filter.userOnly\": {\n\t\tdefaultKeys: \"alt+3\",\n\t\tdescription: \"Tree filter: user messages only\",\n\t},\n\t\"app.tree.filter.labeledOnly\": {\n\t\tdefaultKeys: \"alt+4\",\n\t\tdescription: \"Tree filter: labeled entries only\",\n\t},\n\t\"app.tree.filter.all\": {\n\t\tdefaultKeys: \"alt+5\",\n\t\tdescription: \"Tree filter: show all entries\",\n\t},\n\t// alt+c for \"cycle\". Not a bracket pair, tempting as `alt+[` / `alt+]` are:\n\t// without the Kitty protocol those arrive as ESC-[ and ESC-], which are the\n\t// CSI and OSC introducers and so are not parsed as keys at all. The backward\n\t// half needs Kitty, like every other shift-modified default here.\n\t\"app.tree.filter.cycleForward\": {\n\t\tdefaultKeys: \"alt+c\",\n\t\tdescription: \"Tree filter: cycle forward\",\n\t},\n\t\"app.tree.filter.cycleBackward\": {\n\t\tdefaultKeys: \"shift+alt+c\",\n\t\tdescription: \"Tree filter: cycle backward\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nconst KEYBINDING_NAME_MIGRATIONS = {\n\tcursorUp: \"tui.editor.cursorUp\",\n\tcursorDown: \"tui.editor.cursorDown\",\n\tcursorLeft: \"tui.editor.cursorLeft\",\n\tcursorRight: \"tui.editor.cursorRight\",\n\tcursorWordLeft: \"tui.editor.cursorWordLeft\",\n\tcursorWordRight: \"tui.editor.cursorWordRight\",\n\tcursorLineStart: \"tui.editor.cursorLineStart\",\n\tcursorLineEnd: \"tui.editor.cursorLineEnd\",\n\tjumpForward: \"tui.editor.jumpForward\",\n\tjumpBackward: \"tui.editor.jumpBackward\",\n\tpageUp: \"tui.editor.pageUp\",\n\tpageDown: \"tui.editor.pageDown\",\n\tdeleteCharBackward: \"tui.editor.deleteCharBackward\",\n\tdeleteCharForward: \"tui.editor.deleteCharForward\",\n\tdeleteWordBackward: \"tui.editor.deleteWordBackward\",\n\tdeleteWordForward: \"tui.editor.deleteWordForward\",\n\tdeleteToLineStart: \"tui.editor.deleteToLineStart\",\n\tdeleteToLineEnd: \"tui.editor.deleteToLineEnd\",\n\tyank: \"tui.editor.yank\",\n\tyankPop: \"tui.editor.yankPop\",\n\tundo: \"tui.editor.undo\",\n\tnewLine: \"tui.input.newLine\",\n\tsubmit: \"tui.input.submit\",\n\ttab: \"tui.input.tab\",\n\tcopy: \"tui.input.copy\",\n\tselectUp: \"tui.select.up\",\n\tselectDown: \"tui.select.down\",\n\tselectPageUp: \"tui.select.pageUp\",\n\tselectPageDown: \"tui.select.pageDown\",\n\tselectConfirm: \"tui.select.confirm\",\n\tselectCancel: \"tui.select.cancel\",\n\tinterrupt: \"app.interrupt\",\n\tclear: \"app.clear\",\n\texit: \"app.exit\",\n\tsuspend: \"app.suspend\",\n\tcycleThinkingLevel: \"app.thinking.cycle\",\n\tcycleModelForward: \"app.model.cycleForward\",\n\tcycleModelBackward: \"app.model.cycleBackward\",\n\tselectModel: \"app.model.select\",\n\texpandTools: \"app.tools.expand\",\n\ttoggleThinking: \"app.thinking.toggle\",\n\ttoggleSessionNamedFilter: \"app.session.toggleNamedFilter\",\n\texternalEditor: \"app.editor.external\",\n\tfollowUp: \"app.message.followUp\",\n\tdequeue: \"app.message.dequeue\",\n\tpasteImage: \"app.clipboard.pasteImage\",\n\tnewSession: \"app.session.new\",\n\ttree: \"app.session.tree\",\n\tfork: \"app.session.fork\",\n\tresume: \"app.session.resume\",\n\ttreeFoldOrUp: \"app.tree.foldOrUp\",\n\ttreeUnfoldOrDown: \"app.tree.unfoldOrDown\",\n\ttreeEditLabel: \"app.tree.editLabel\",\n\ttreeToggleLabelTimestamp: \"app.tree.toggleLabelTimestamp\",\n\ttoggleSessionPath: \"app.session.togglePath\",\n\ttoggleSessionSort: \"app.session.toggleSort\",\n\trenameSession: \"app.session.rename\",\n\tdeleteSession: \"app.session.delete\",\n\tdeleteSessionNoninvasive: \"app.session.deleteNoninvasive\",\n} as const satisfies Record<string, Keybinding>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLegacyKeybindingName(key: string): key is keyof typeof KEYBINDING_NAME_MIGRATIONS {\n\treturn key in KEYBINDING_NAME_MIGRATIONS;\n}\n\nfunction toKeybindingsConfig(value: unknown): KeybindingsConfig {\n\tif (!isRecord(value)) return {};\n\n\tconst config: KeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (typeof binding === \"string\") {\n\t\t\tconfig[key] = binding as KeyId;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as KeyId[];\n\t\t}\n\t}\n\treturn config;\n}\n\nexport function migrateKeybindingsConfig(rawConfig: Record<string, unknown>): {\n\tconfig: Record<string, unknown>;\n\tmigrated: boolean;\n} {\n\tconst config: Record<string, unknown> = {};\n\tlet migrated = false;\n\n\tfor (const [key, value] of Object.entries(rawConfig)) {\n\t\tconst nextKey = isLegacyKeybindingName(key) ? KEYBINDING_NAME_MIGRATIONS[key] : key;\n\t\tif (nextKey !== key) {\n\t\t\tmigrated = true;\n\t\t}\n\t\tif (key !== nextKey && Object.hasOwn(rawConfig, nextKey)) {\n\t\t\tmigrated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconfig[nextKey] = value;\n\t}\n\n\treturn { config: orderKeybindingsConfig(config), migrated };\n}\n\nfunction orderKeybindingsConfig(config: Record<string, unknown>): Record<string, unknown> {\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const keybinding of Object.keys(KEYBINDINGS)) {\n\t\tif (Object.hasOwn(config, keybinding)) {\n\t\t\tordered[keybinding] = config[keybinding];\n\t\t}\n\t}\n\n\tconst extras = Object.keys(config)\n\t\t.filter((key) => !Object.hasOwn(ordered, key))\n\t\t.sort();\n\tfor (const key of extras) {\n\t\tordered[key] = config[key];\n\t}\n\n\treturn ordered;\n}\n\nfunction loadRawConfig(path: string): Record<string, unknown> | undefined {\n\tif (!existsSync(path)) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(path, \"utf-8\")) as unknown;\n\t\treturn isRecord(parsed) ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport class KeybindingsManager extends TuiKeybindingsManager {\n\tprivate configPath: string | undefined;\n\n\tconstructor(userBindings: KeybindingsConfig = {}, configPath?: string) {\n\t\tsuper(KEYBINDINGS, userBindings);\n\t\tthis.configPath = configPath;\n\t}\n\n\tstatic create(agentDir: string = getAgentDir()): KeybindingsManager {\n\t\tconst configPath = join(agentDir, \"keybindings.json\");\n\t\tconst userBindings = KeybindingsManager.loadFromFile(configPath);\n\t\treturn new KeybindingsManager(userBindings, configPath);\n\t}\n\n\treload(): void {\n\t\tif (!this.configPath) return;\n\t\tthis.setUserBindings(KeybindingsManager.loadFromFile(this.configPath));\n\t}\n\n\tgetEffectiveConfig(): KeybindingsConfig {\n\t\treturn this.getResolvedBindings();\n\t}\n\n\tprivate static loadFromFile(path: string): KeybindingsConfig {\n\t\tconst rawConfig = loadRawConfig(path);\n\t\tif (!rawConfig) return {};\n\t\treturn toKeybindingsConfig(migrateKeybindingsConfig(rawConfig).config);\n\t}\n}\n\nexport type { KeyId, KeybindingsConfig };\n"]}
@@ -32,4 +32,15 @@ export declare function sessionColorName(slot: number): string | undefined;
32
32
  * Undefined when it names no slot at all.
33
33
  */
34
34
  export declare function parseSessionColorSlot(input: string): number | undefined;
35
+ /**
36
+ * The slot one step away from `current`, wrapping at both ends.
37
+ *
38
+ * The keyboard cycle needs this rather than a picker because picking a colour is
39
+ * usually a two-second decision made while looking at four terminals: step until
40
+ * the chip stops looking like its neighbour's, then stop. Wrapping means the
41
+ * cycle has no dead end to back out of, and a session sitting on a slot no theme
42
+ * defines — or on nothing at all — starts from the first one rather than
43
+ * refusing to move.
44
+ */
45
+ export declare function cycleSessionColorSlot(current: number, direction: "forward" | "backward"): number;
35
46
  //# sourceMappingURL=session-identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-identity.d.ts","sourceRoot":"","sources":["../../src/core/session-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,IAAI,CAAC;AA8GrC,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED,iFAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAiCD,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAAmD,CAAC;AAEzG,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvE","sourcesContent":["/**\n * A session's visual identity: the name it carries before anyone names it, and\n * the palette slot its chip is filled with.\n *\n * Both are pure functions of the session id, which means they need no storage of\n * their own: the id is already in the session header, so a resumed session comes\n * back wearing the same slug and the same colour, and a fork — which mints a new\n * id — gets its own identity instead of quietly wearing its parent's. What *is*\n * stored is an override: `/name` and `/color` write to the session's\n * `session_info` entry, and those win over everything here (see\n * SessionManager.getDisplayName / getSessionColorSlot).\n *\n * This module is deliberately theme-free. It deals in slot *numbers*; mapping a\n * slot onto a colour token is the theme's job, so `core/` never has to reach into\n * a mode's rendering code.\n */\n\n/** Number of colour slots a session can land in. Matches the theme's identity palette. */\nexport const SESSION_COLOR_SLOTS = 6;\n\n/**\n * The slug vocabulary. Chosen for the terminal, not for poetry: every word is\n * short (so a two-word slug stays well inside the chip's 20-column cap), lower\n * case, unambiguous when read at a glance from across a desk, and free of the\n * near-homographs that make two sessions hard to tell apart (no \"lake\"/\"lane\").\n * 32 × 32 gives 1024 combinations, which is far more than the number of sessions\n * anyone has open at once — the point is recognition, not uniqueness.\n */\nconst ADJECTIVES = [\n\t\"amber\",\n\t\"ash\",\n\t\"azure\",\n\t\"brisk\",\n\t\"bronze\",\n\t\"calm\",\n\t\"clay\",\n\t\"coral\",\n\t\"crisp\",\n\t\"dusk\",\n\t\"ember\",\n\t\"fern\",\n\t\"flint\",\n\t\"frost\",\n\t\"gold\",\n\t\"ivory\",\n\t\"jade\",\n\t\"lunar\",\n\t\"mellow\",\n\t\"mint\",\n\t\"olive\",\n\t\"onyx\",\n\t\"plum\",\n\t\"quiet\",\n\t\"rust\",\n\t\"sable\",\n\t\"sage\",\n\t\"slate\",\n\t\"solar\",\n\t\"swift\",\n\t\"teal\",\n\t\"velvet\",\n] as const;\n\nconst NOUNS = [\n\t\"anchor\",\n\t\"arbor\",\n\t\"basin\",\n\t\"beacon\",\n\t\"birch\",\n\t\"canyon\",\n\t\"cedar\",\n\t\"cinder\",\n\t\"cove\",\n\t\"delta\",\n\t\"drift\",\n\t\"ferry\",\n\t\"forge\",\n\t\"harbor\",\n\t\"hollow\",\n\t\"lantern\",\n\t\"meadow\",\n\t\"mesa\",\n\t\"orchard\",\n\t\"pier\",\n\t\"prairie\",\n\t\"quarry\",\n\t\"ridge\",\n\t\"summit\",\n\t\"thicket\",\n\t\"tide\",\n\t\"trellis\",\n\t\"vale\",\n\t\"willow\",\n\t\"windmill\",\n\t\"yarrow\",\n\t\"zenith\",\n] as const;\n\n/**\n * djb2 over the whole string. The same hash the agent palette uses — tiny,\n * stable across runs and machines, and good spread for identifier-like input.\n *\n * Hashing the *whole* id matters here. Session ids are uuidv7, which is\n * time-ordered: two sessions started in the same minute share their leading\n * characters, so a hash over a prefix would drop them into the same slug and the\n * same colour — exactly the sessions a person most needs to tell apart.\n */\nfunction djb2(value: string): number {\n\tlet hash = 5381;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = ((hash << 5) + hash + value.charCodeAt(i)) >>> 0;\n\t}\n\treturn hash;\n}\n\n/**\n * A second hash over the same string, seeded differently (sdbm). The slug needs\n * two independent indices; running djb2 twice would tie the noun to the\n * adjective and collapse the vocabulary from 1024 pairs to 32.\n */\nfunction sdbm(value: string): number {\n\tlet hash = 0;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = (value.charCodeAt(i) + (hash << 6) + (hash << 16) - hash) >>> 0;\n\t}\n\treturn hash;\n}\n\n/** The auto-assigned name for a session: a memorable two-word slug, e.g. `amber-harbor`. */\nexport function sessionSlugFor(sessionId: string): string {\n\tconst adjective = ADJECTIVES[djb2(sessionId) % ADJECTIVES.length];\n\tconst noun = NOUNS[sdbm(sessionId) % NOUNS.length];\n\treturn `${adjective}-${noun}`;\n}\n\n/** The auto-assigned colour slot for a session, in `1…SESSION_COLOR_SLOTS`. */\nexport function sessionColorSlotFor(sessionId: string): number {\n\treturn (djb2(sessionId) % SESSION_COLOR_SLOTS) + 1;\n}\n\n/** Whether `slot` is one a session can actually be assigned. */\nexport function isSessionColorSlot(slot: number): boolean {\n\treturn Number.isInteger(slot) && slot >= 1 && slot <= SESSION_COLOR_SLOTS;\n}\n\n/**\n * The name each slot answers to, and the other spellings that reach it.\n *\n * A slot is a palette position, not a fixed hue — every theme fills\n * `agent1…agent6` with its own colours — but across the built-in themes each\n * position keeps a recognisable family, and that is what these names describe:\n * slot 3 is the warm yellow/amber one wherever you are, slot 6 the blue. That\n * is enough for the thing names are for, which is typing `/color green`\n * instead of remembering that green is the fifth swatch.\n *\n * The aliases are deliberately generous, because a name only helps if the\n * obvious spelling of it works. Each name's initial stands for it, and the\n * hues that sit between slots (`orange`, `red`) resolve to the nearest slot\n * rather than being rejected — the palette has six entries, not a full colour\n * wheel, and refusing `/color red` because the swatch is officially magenta\n * would be pedantry. A theme whose palette drifts from these names is still\n * addressable by number, which is why the numbers never go away.\n */\nconst SESSION_COLOR_NAMES: ReadonlyArray<{\n\treadonly slot: number;\n\treadonly name: string;\n\treadonly aliases: readonly string[];\n}> = [\n\t{ slot: 1, name: \"cyan\", aliases: [\"c\", \"teal\", \"aqua\"] },\n\t{ slot: 2, name: \"purple\", aliases: [\"p\", \"violet\"] },\n\t{ slot: 3, name: \"yellow\", aliases: [\"y\", \"amber\", \"gold\", \"orange\", \"o\"] },\n\t{ slot: 4, name: \"magenta\", aliases: [\"m\", \"pink\", \"rose\", \"red\", \"r\"] },\n\t{ slot: 5, name: \"green\", aliases: [\"g\"] },\n\t{ slot: 6, name: \"blue\", aliases: [\"b\"] },\n];\n\n/** The canonical slot names, in slot order. For usage lines and pickers. */\nexport const SESSION_COLOR_NAME_LIST: readonly string[] = SESSION_COLOR_NAMES.map((entry) => entry.name);\n\n/** What to call `slot` when reporting it back, or undefined if it is not a slot. */\nexport function sessionColorName(slot: number): string | undefined {\n\treturn SESSION_COLOR_NAMES.find((entry) => entry.slot === slot)?.name;\n}\n\n/**\n * The slot an argument to `/color` asks for: a number (`4`), a name\n * (`magenta`), or an initial (`m`). Case and surrounding space do not matter.\n * Undefined when it names no slot at all.\n */\nexport function parseSessionColorSlot(input: string): number | undefined {\n\tconst normalized = input.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (/^\\d+$/.test(normalized)) {\n\t\tconst slot = Number(normalized);\n\t\treturn isSessionColorSlot(slot) ? slot : undefined;\n\t}\n\tconst match = SESSION_COLOR_NAMES.find((entry) => entry.name === normalized || entry.aliases.includes(normalized));\n\treturn match?.slot;\n}\n"]}
1
+ {"version":3,"file":"session-identity.d.ts","sourceRoot":"","sources":["../../src/core/session-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,IAAI,CAAC;AA8GrC,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED,iFAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAiCD,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAAmD,CAAC;AAEzG,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,CAIhG","sourcesContent":["/**\n * A session's visual identity: the name it carries before anyone names it, and\n * the palette slot its chip is filled with.\n *\n * Both are pure functions of the session id, which means they need no storage of\n * their own: the id is already in the session header, so a resumed session comes\n * back wearing the same slug and the same colour, and a fork — which mints a new\n * id — gets its own identity instead of quietly wearing its parent's. What *is*\n * stored is an override: `/name` and `/color` write to the session's\n * `session_info` entry, and those win over everything here (see\n * SessionManager.getDisplayName / getSessionColorSlot).\n *\n * This module is deliberately theme-free. It deals in slot *numbers*; mapping a\n * slot onto a colour token is the theme's job, so `core/` never has to reach into\n * a mode's rendering code.\n */\n\n/** Number of colour slots a session can land in. Matches the theme's identity palette. */\nexport const SESSION_COLOR_SLOTS = 6;\n\n/**\n * The slug vocabulary. Chosen for the terminal, not for poetry: every word is\n * short (so a two-word slug stays well inside the chip's 20-column cap), lower\n * case, unambiguous when read at a glance from across a desk, and free of the\n * near-homographs that make two sessions hard to tell apart (no \"lake\"/\"lane\").\n * 32 × 32 gives 1024 combinations, which is far more than the number of sessions\n * anyone has open at once — the point is recognition, not uniqueness.\n */\nconst ADJECTIVES = [\n\t\"amber\",\n\t\"ash\",\n\t\"azure\",\n\t\"brisk\",\n\t\"bronze\",\n\t\"calm\",\n\t\"clay\",\n\t\"coral\",\n\t\"crisp\",\n\t\"dusk\",\n\t\"ember\",\n\t\"fern\",\n\t\"flint\",\n\t\"frost\",\n\t\"gold\",\n\t\"ivory\",\n\t\"jade\",\n\t\"lunar\",\n\t\"mellow\",\n\t\"mint\",\n\t\"olive\",\n\t\"onyx\",\n\t\"plum\",\n\t\"quiet\",\n\t\"rust\",\n\t\"sable\",\n\t\"sage\",\n\t\"slate\",\n\t\"solar\",\n\t\"swift\",\n\t\"teal\",\n\t\"velvet\",\n] as const;\n\nconst NOUNS = [\n\t\"anchor\",\n\t\"arbor\",\n\t\"basin\",\n\t\"beacon\",\n\t\"birch\",\n\t\"canyon\",\n\t\"cedar\",\n\t\"cinder\",\n\t\"cove\",\n\t\"delta\",\n\t\"drift\",\n\t\"ferry\",\n\t\"forge\",\n\t\"harbor\",\n\t\"hollow\",\n\t\"lantern\",\n\t\"meadow\",\n\t\"mesa\",\n\t\"orchard\",\n\t\"pier\",\n\t\"prairie\",\n\t\"quarry\",\n\t\"ridge\",\n\t\"summit\",\n\t\"thicket\",\n\t\"tide\",\n\t\"trellis\",\n\t\"vale\",\n\t\"willow\",\n\t\"windmill\",\n\t\"yarrow\",\n\t\"zenith\",\n] as const;\n\n/**\n * djb2 over the whole string. The same hash the agent palette uses — tiny,\n * stable across runs and machines, and good spread for identifier-like input.\n *\n * Hashing the *whole* id matters here. Session ids are uuidv7, which is\n * time-ordered: two sessions started in the same minute share their leading\n * characters, so a hash over a prefix would drop them into the same slug and the\n * same colour — exactly the sessions a person most needs to tell apart.\n */\nfunction djb2(value: string): number {\n\tlet hash = 5381;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = ((hash << 5) + hash + value.charCodeAt(i)) >>> 0;\n\t}\n\treturn hash;\n}\n\n/**\n * A second hash over the same string, seeded differently (sdbm). The slug needs\n * two independent indices; running djb2 twice would tie the noun to the\n * adjective and collapse the vocabulary from 1024 pairs to 32.\n */\nfunction sdbm(value: string): number {\n\tlet hash = 0;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = (value.charCodeAt(i) + (hash << 6) + (hash << 16) - hash) >>> 0;\n\t}\n\treturn hash;\n}\n\n/** The auto-assigned name for a session: a memorable two-word slug, e.g. `amber-harbor`. */\nexport function sessionSlugFor(sessionId: string): string {\n\tconst adjective = ADJECTIVES[djb2(sessionId) % ADJECTIVES.length];\n\tconst noun = NOUNS[sdbm(sessionId) % NOUNS.length];\n\treturn `${adjective}-${noun}`;\n}\n\n/** The auto-assigned colour slot for a session, in `1…SESSION_COLOR_SLOTS`. */\nexport function sessionColorSlotFor(sessionId: string): number {\n\treturn (djb2(sessionId) % SESSION_COLOR_SLOTS) + 1;\n}\n\n/** Whether `slot` is one a session can actually be assigned. */\nexport function isSessionColorSlot(slot: number): boolean {\n\treturn Number.isInteger(slot) && slot >= 1 && slot <= SESSION_COLOR_SLOTS;\n}\n\n/**\n * The name each slot answers to, and the other spellings that reach it.\n *\n * A slot is a palette position, not a fixed hue — every theme fills\n * `agent1…agent6` with its own colours — but across the built-in themes each\n * position keeps a recognisable family, and that is what these names describe:\n * slot 3 is the warm yellow/amber one wherever you are, slot 6 the blue. That\n * is enough for the thing names are for, which is typing `/color green`\n * instead of remembering that green is the fifth swatch.\n *\n * The aliases are deliberately generous, because a name only helps if the\n * obvious spelling of it works. Each name's initial stands for it, and the\n * hues that sit between slots (`orange`, `red`) resolve to the nearest slot\n * rather than being rejected — the palette has six entries, not a full colour\n * wheel, and refusing `/color red` because the swatch is officially magenta\n * would be pedantry. A theme whose palette drifts from these names is still\n * addressable by number, which is why the numbers never go away.\n */\nconst SESSION_COLOR_NAMES: ReadonlyArray<{\n\treadonly slot: number;\n\treadonly name: string;\n\treadonly aliases: readonly string[];\n}> = [\n\t{ slot: 1, name: \"cyan\", aliases: [\"c\", \"teal\", \"aqua\"] },\n\t{ slot: 2, name: \"purple\", aliases: [\"p\", \"violet\"] },\n\t{ slot: 3, name: \"yellow\", aliases: [\"y\", \"amber\", \"gold\", \"orange\", \"o\"] },\n\t{ slot: 4, name: \"magenta\", aliases: [\"m\", \"pink\", \"rose\", \"red\", \"r\"] },\n\t{ slot: 5, name: \"green\", aliases: [\"g\"] },\n\t{ slot: 6, name: \"blue\", aliases: [\"b\"] },\n];\n\n/** The canonical slot names, in slot order. For usage lines and pickers. */\nexport const SESSION_COLOR_NAME_LIST: readonly string[] = SESSION_COLOR_NAMES.map((entry) => entry.name);\n\n/** What to call `slot` when reporting it back, or undefined if it is not a slot. */\nexport function sessionColorName(slot: number): string | undefined {\n\treturn SESSION_COLOR_NAMES.find((entry) => entry.slot === slot)?.name;\n}\n\n/**\n * The slot an argument to `/color` asks for: a number (`4`), a name\n * (`magenta`), or an initial (`m`). Case and surrounding space do not matter.\n * Undefined when it names no slot at all.\n */\nexport function parseSessionColorSlot(input: string): number | undefined {\n\tconst normalized = input.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (/^\\d+$/.test(normalized)) {\n\t\tconst slot = Number(normalized);\n\t\treturn isSessionColorSlot(slot) ? slot : undefined;\n\t}\n\tconst match = SESSION_COLOR_NAMES.find((entry) => entry.name === normalized || entry.aliases.includes(normalized));\n\treturn match?.slot;\n}\n\n/**\n * The slot one step away from `current`, wrapping at both ends.\n *\n * The keyboard cycle needs this rather than a picker because picking a colour is\n * usually a two-second decision made while looking at four terminals: step until\n * the chip stops looking like its neighbour's, then stop. Wrapping means the\n * cycle has no dead end to back out of, and a session sitting on a slot no theme\n * defines — or on nothing at all — starts from the first one rather than\n * refusing to move.\n */\nexport function cycleSessionColorSlot(current: number, direction: \"forward\" | \"backward\"): number {\n\tif (!isSessionColorSlot(current)) return 1;\n\tconst step = direction === \"forward\" ? 1 : SESSION_COLOR_SLOTS - 1;\n\treturn ((current - 1 + step) % SESSION_COLOR_SLOTS) + 1;\n}\n"]}
@@ -182,4 +182,20 @@ export function parseSessionColorSlot(input) {
182
182
  const match = SESSION_COLOR_NAMES.find((entry) => entry.name === normalized || entry.aliases.includes(normalized));
183
183
  return match?.slot;
184
184
  }
185
+ /**
186
+ * The slot one step away from `current`, wrapping at both ends.
187
+ *
188
+ * The keyboard cycle needs this rather than a picker because picking a colour is
189
+ * usually a two-second decision made while looking at four terminals: step until
190
+ * the chip stops looking like its neighbour's, then stop. Wrapping means the
191
+ * cycle has no dead end to back out of, and a session sitting on a slot no theme
192
+ * defines — or on nothing at all — starts from the first one rather than
193
+ * refusing to move.
194
+ */
195
+ export function cycleSessionColorSlot(current, direction) {
196
+ if (!isSessionColorSlot(current))
197
+ return 1;
198
+ const step = direction === "forward" ? 1 : SESSION_COLOR_SLOTS - 1;
199
+ return ((current - 1 + step) % SESSION_COLOR_SLOTS) + 1;
200
+ }
185
201
  //# sourceMappingURL=session-identity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-identity.js","sourceRoot":"","sources":["../../src/core/session-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG;IAClB,OAAO;IACP,KAAK;IACL,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;CACC,CAAC;AAEX,MAAM,KAAK,GAAG;IACb,QAAQ;IACR,OAAO;IAC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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE;CACzC,CAAC;AAEF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAsB,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAEzG,oFAAoF;AACpF,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAsB;IAClE,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,CACtE;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAa,EAAsB;IACxE,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IACD,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACnH,OAAO,KAAK,EAAE,IAAI,CAAC;AAAA,CACnB","sourcesContent":["/**\n * A session's visual identity: the name it carries before anyone names it, and\n * the palette slot its chip is filled with.\n *\n * Both are pure functions of the session id, which means they need no storage of\n * their own: the id is already in the session header, so a resumed session comes\n * back wearing the same slug and the same colour, and a fork — which mints a new\n * id — gets its own identity instead of quietly wearing its parent's. What *is*\n * stored is an override: `/name` and `/color` write to the session's\n * `session_info` entry, and those win over everything here (see\n * SessionManager.getDisplayName / getSessionColorSlot).\n *\n * This module is deliberately theme-free. It deals in slot *numbers*; mapping a\n * slot onto a colour token is the theme's job, so `core/` never has to reach into\n * a mode's rendering code.\n */\n\n/** Number of colour slots a session can land in. Matches the theme's identity palette. */\nexport const SESSION_COLOR_SLOTS = 6;\n\n/**\n * The slug vocabulary. Chosen for the terminal, not for poetry: every word is\n * short (so a two-word slug stays well inside the chip's 20-column cap), lower\n * case, unambiguous when read at a glance from across a desk, and free of the\n * near-homographs that make two sessions hard to tell apart (no \"lake\"/\"lane\").\n * 32 × 32 gives 1024 combinations, which is far more than the number of sessions\n * anyone has open at once — the point is recognition, not uniqueness.\n */\nconst ADJECTIVES = [\n\t\"amber\",\n\t\"ash\",\n\t\"azure\",\n\t\"brisk\",\n\t\"bronze\",\n\t\"calm\",\n\t\"clay\",\n\t\"coral\",\n\t\"crisp\",\n\t\"dusk\",\n\t\"ember\",\n\t\"fern\",\n\t\"flint\",\n\t\"frost\",\n\t\"gold\",\n\t\"ivory\",\n\t\"jade\",\n\t\"lunar\",\n\t\"mellow\",\n\t\"mint\",\n\t\"olive\",\n\t\"onyx\",\n\t\"plum\",\n\t\"quiet\",\n\t\"rust\",\n\t\"sable\",\n\t\"sage\",\n\t\"slate\",\n\t\"solar\",\n\t\"swift\",\n\t\"teal\",\n\t\"velvet\",\n] as const;\n\nconst NOUNS = [\n\t\"anchor\",\n\t\"arbor\",\n\t\"basin\",\n\t\"beacon\",\n\t\"birch\",\n\t\"canyon\",\n\t\"cedar\",\n\t\"cinder\",\n\t\"cove\",\n\t\"delta\",\n\t\"drift\",\n\t\"ferry\",\n\t\"forge\",\n\t\"harbor\",\n\t\"hollow\",\n\t\"lantern\",\n\t\"meadow\",\n\t\"mesa\",\n\t\"orchard\",\n\t\"pier\",\n\t\"prairie\",\n\t\"quarry\",\n\t\"ridge\",\n\t\"summit\",\n\t\"thicket\",\n\t\"tide\",\n\t\"trellis\",\n\t\"vale\",\n\t\"willow\",\n\t\"windmill\",\n\t\"yarrow\",\n\t\"zenith\",\n] as const;\n\n/**\n * djb2 over the whole string. The same hash the agent palette uses — tiny,\n * stable across runs and machines, and good spread for identifier-like input.\n *\n * Hashing the *whole* id matters here. Session ids are uuidv7, which is\n * time-ordered: two sessions started in the same minute share their leading\n * characters, so a hash over a prefix would drop them into the same slug and the\n * same colour — exactly the sessions a person most needs to tell apart.\n */\nfunction djb2(value: string): number {\n\tlet hash = 5381;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = ((hash << 5) + hash + value.charCodeAt(i)) >>> 0;\n\t}\n\treturn hash;\n}\n\n/**\n * A second hash over the same string, seeded differently (sdbm). The slug needs\n * two independent indices; running djb2 twice would tie the noun to the\n * adjective and collapse the vocabulary from 1024 pairs to 32.\n */\nfunction sdbm(value: string): number {\n\tlet hash = 0;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = (value.charCodeAt(i) + (hash << 6) + (hash << 16) - hash) >>> 0;\n\t}\n\treturn hash;\n}\n\n/** The auto-assigned name for a session: a memorable two-word slug, e.g. `amber-harbor`. */\nexport function sessionSlugFor(sessionId: string): string {\n\tconst adjective = ADJECTIVES[djb2(sessionId) % ADJECTIVES.length];\n\tconst noun = NOUNS[sdbm(sessionId) % NOUNS.length];\n\treturn `${adjective}-${noun}`;\n}\n\n/** The auto-assigned colour slot for a session, in `1…SESSION_COLOR_SLOTS`. */\nexport function sessionColorSlotFor(sessionId: string): number {\n\treturn (djb2(sessionId) % SESSION_COLOR_SLOTS) + 1;\n}\n\n/** Whether `slot` is one a session can actually be assigned. */\nexport function isSessionColorSlot(slot: number): boolean {\n\treturn Number.isInteger(slot) && slot >= 1 && slot <= SESSION_COLOR_SLOTS;\n}\n\n/**\n * The name each slot answers to, and the other spellings that reach it.\n *\n * A slot is a palette position, not a fixed hue — every theme fills\n * `agent1…agent6` with its own colours — but across the built-in themes each\n * position keeps a recognisable family, and that is what these names describe:\n * slot 3 is the warm yellow/amber one wherever you are, slot 6 the blue. That\n * is enough for the thing names are for, which is typing `/color green`\n * instead of remembering that green is the fifth swatch.\n *\n * The aliases are deliberately generous, because a name only helps if the\n * obvious spelling of it works. Each name's initial stands for it, and the\n * hues that sit between slots (`orange`, `red`) resolve to the nearest slot\n * rather than being rejected — the palette has six entries, not a full colour\n * wheel, and refusing `/color red` because the swatch is officially magenta\n * would be pedantry. A theme whose palette drifts from these names is still\n * addressable by number, which is why the numbers never go away.\n */\nconst SESSION_COLOR_NAMES: ReadonlyArray<{\n\treadonly slot: number;\n\treadonly name: string;\n\treadonly aliases: readonly string[];\n}> = [\n\t{ slot: 1, name: \"cyan\", aliases: [\"c\", \"teal\", \"aqua\"] },\n\t{ slot: 2, name: \"purple\", aliases: [\"p\", \"violet\"] },\n\t{ slot: 3, name: \"yellow\", aliases: [\"y\", \"amber\", \"gold\", \"orange\", \"o\"] },\n\t{ slot: 4, name: \"magenta\", aliases: [\"m\", \"pink\", \"rose\", \"red\", \"r\"] },\n\t{ slot: 5, name: \"green\", aliases: [\"g\"] },\n\t{ slot: 6, name: \"blue\", aliases: [\"b\"] },\n];\n\n/** The canonical slot names, in slot order. For usage lines and pickers. */\nexport const SESSION_COLOR_NAME_LIST: readonly string[] = SESSION_COLOR_NAMES.map((entry) => entry.name);\n\n/** What to call `slot` when reporting it back, or undefined if it is not a slot. */\nexport function sessionColorName(slot: number): string | undefined {\n\treturn SESSION_COLOR_NAMES.find((entry) => entry.slot === slot)?.name;\n}\n\n/**\n * The slot an argument to `/color` asks for: a number (`4`), a name\n * (`magenta`), or an initial (`m`). Case and surrounding space do not matter.\n * Undefined when it names no slot at all.\n */\nexport function parseSessionColorSlot(input: string): number | undefined {\n\tconst normalized = input.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (/^\\d+$/.test(normalized)) {\n\t\tconst slot = Number(normalized);\n\t\treturn isSessionColorSlot(slot) ? slot : undefined;\n\t}\n\tconst match = SESSION_COLOR_NAMES.find((entry) => entry.name === normalized || entry.aliases.includes(normalized));\n\treturn match?.slot;\n}\n"]}
1
+ {"version":3,"file":"session-identity.js","sourceRoot":"","sources":["../../src/core/session-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG;IAClB,OAAO;IACP,KAAK;IACL,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;CACC,CAAC;AAEX,MAAM,KAAK,GAAG;IACb,QAAQ;IACR,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;IACN,SAAS;IACT,MAAM;IACN,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,SAAS;IACT,MAAM;IACN,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,QAAQ;CACC,CAAC;AAEX;;;;;;;;GAQG;AACH,SAAS,IAAI,CAAC,KAAa,EAAU;IACpC,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,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C,WAAW,EAAE,CAAC;IAC9C,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IACD,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACnH,OAAO,KAAK,EAAE,IAAI,CAAC;AAAA,CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,SAAiC,EAAU;IACjG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;QAAE,OAAO,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC;IACnE,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAAA,CACxD","sourcesContent":["/**\n * A session's visual identity: the name it carries before anyone names it, and\n * the palette slot its chip is filled with.\n *\n * Both are pure functions of the session id, which means they need no storage of\n * their own: the id is already in the session header, so a resumed session comes\n * back wearing the same slug and the same colour, and a fork — which mints a new\n * id — gets its own identity instead of quietly wearing its parent's. What *is*\n * stored is an override: `/name` and `/color` write to the session's\n * `session_info` entry, and those win over everything here (see\n * SessionManager.getDisplayName / getSessionColorSlot).\n *\n * This module is deliberately theme-free. It deals in slot *numbers*; mapping a\n * slot onto a colour token is the theme's job, so `core/` never has to reach into\n * a mode's rendering code.\n */\n\n/** Number of colour slots a session can land in. Matches the theme's identity palette. */\nexport const SESSION_COLOR_SLOTS = 6;\n\n/**\n * The slug vocabulary. Chosen for the terminal, not for poetry: every word is\n * short (so a two-word slug stays well inside the chip's 20-column cap), lower\n * case, unambiguous when read at a glance from across a desk, and free of the\n * near-homographs that make two sessions hard to tell apart (no \"lake\"/\"lane\").\n * 32 × 32 gives 1024 combinations, which is far more than the number of sessions\n * anyone has open at once — the point is recognition, not uniqueness.\n */\nconst ADJECTIVES = [\n\t\"amber\",\n\t\"ash\",\n\t\"azure\",\n\t\"brisk\",\n\t\"bronze\",\n\t\"calm\",\n\t\"clay\",\n\t\"coral\",\n\t\"crisp\",\n\t\"dusk\",\n\t\"ember\",\n\t\"fern\",\n\t\"flint\",\n\t\"frost\",\n\t\"gold\",\n\t\"ivory\",\n\t\"jade\",\n\t\"lunar\",\n\t\"mellow\",\n\t\"mint\",\n\t\"olive\",\n\t\"onyx\",\n\t\"plum\",\n\t\"quiet\",\n\t\"rust\",\n\t\"sable\",\n\t\"sage\",\n\t\"slate\",\n\t\"solar\",\n\t\"swift\",\n\t\"teal\",\n\t\"velvet\",\n] as const;\n\nconst NOUNS = [\n\t\"anchor\",\n\t\"arbor\",\n\t\"basin\",\n\t\"beacon\",\n\t\"birch\",\n\t\"canyon\",\n\t\"cedar\",\n\t\"cinder\",\n\t\"cove\",\n\t\"delta\",\n\t\"drift\",\n\t\"ferry\",\n\t\"forge\",\n\t\"harbor\",\n\t\"hollow\",\n\t\"lantern\",\n\t\"meadow\",\n\t\"mesa\",\n\t\"orchard\",\n\t\"pier\",\n\t\"prairie\",\n\t\"quarry\",\n\t\"ridge\",\n\t\"summit\",\n\t\"thicket\",\n\t\"tide\",\n\t\"trellis\",\n\t\"vale\",\n\t\"willow\",\n\t\"windmill\",\n\t\"yarrow\",\n\t\"zenith\",\n] as const;\n\n/**\n * djb2 over the whole string. The same hash the agent palette uses — tiny,\n * stable across runs and machines, and good spread for identifier-like input.\n *\n * Hashing the *whole* id matters here. Session ids are uuidv7, which is\n * time-ordered: two sessions started in the same minute share their leading\n * characters, so a hash over a prefix would drop them into the same slug and the\n * same colour — exactly the sessions a person most needs to tell apart.\n */\nfunction djb2(value: string): number {\n\tlet hash = 5381;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = ((hash << 5) + hash + value.charCodeAt(i)) >>> 0;\n\t}\n\treturn hash;\n}\n\n/**\n * A second hash over the same string, seeded differently (sdbm). The slug needs\n * two independent indices; running djb2 twice would tie the noun to the\n * adjective and collapse the vocabulary from 1024 pairs to 32.\n */\nfunction sdbm(value: string): number {\n\tlet hash = 0;\n\tfor (let i = 0; i < value.length; i++) {\n\t\thash = (value.charCodeAt(i) + (hash << 6) + (hash << 16) - hash) >>> 0;\n\t}\n\treturn hash;\n}\n\n/** The auto-assigned name for a session: a memorable two-word slug, e.g. `amber-harbor`. */\nexport function sessionSlugFor(sessionId: string): string {\n\tconst adjective = ADJECTIVES[djb2(sessionId) % ADJECTIVES.length];\n\tconst noun = NOUNS[sdbm(sessionId) % NOUNS.length];\n\treturn `${adjective}-${noun}`;\n}\n\n/** The auto-assigned colour slot for a session, in `1…SESSION_COLOR_SLOTS`. */\nexport function sessionColorSlotFor(sessionId: string): number {\n\treturn (djb2(sessionId) % SESSION_COLOR_SLOTS) + 1;\n}\n\n/** Whether `slot` is one a session can actually be assigned. */\nexport function isSessionColorSlot(slot: number): boolean {\n\treturn Number.isInteger(slot) && slot >= 1 && slot <= SESSION_COLOR_SLOTS;\n}\n\n/**\n * The name each slot answers to, and the other spellings that reach it.\n *\n * A slot is a palette position, not a fixed hue — every theme fills\n * `agent1…agent6` with its own colours — but across the built-in themes each\n * position keeps a recognisable family, and that is what these names describe:\n * slot 3 is the warm yellow/amber one wherever you are, slot 6 the blue. That\n * is enough for the thing names are for, which is typing `/color green`\n * instead of remembering that green is the fifth swatch.\n *\n * The aliases are deliberately generous, because a name only helps if the\n * obvious spelling of it works. Each name's initial stands for it, and the\n * hues that sit between slots (`orange`, `red`) resolve to the nearest slot\n * rather than being rejected — the palette has six entries, not a full colour\n * wheel, and refusing `/color red` because the swatch is officially magenta\n * would be pedantry. A theme whose palette drifts from these names is still\n * addressable by number, which is why the numbers never go away.\n */\nconst SESSION_COLOR_NAMES: ReadonlyArray<{\n\treadonly slot: number;\n\treadonly name: string;\n\treadonly aliases: readonly string[];\n}> = [\n\t{ slot: 1, name: \"cyan\", aliases: [\"c\", \"teal\", \"aqua\"] },\n\t{ slot: 2, name: \"purple\", aliases: [\"p\", \"violet\"] },\n\t{ slot: 3, name: \"yellow\", aliases: [\"y\", \"amber\", \"gold\", \"orange\", \"o\"] },\n\t{ slot: 4, name: \"magenta\", aliases: [\"m\", \"pink\", \"rose\", \"red\", \"r\"] },\n\t{ slot: 5, name: \"green\", aliases: [\"g\"] },\n\t{ slot: 6, name: \"blue\", aliases: [\"b\"] },\n];\n\n/** The canonical slot names, in slot order. For usage lines and pickers. */\nexport const SESSION_COLOR_NAME_LIST: readonly string[] = SESSION_COLOR_NAMES.map((entry) => entry.name);\n\n/** What to call `slot` when reporting it back, or undefined if it is not a slot. */\nexport function sessionColorName(slot: number): string | undefined {\n\treturn SESSION_COLOR_NAMES.find((entry) => entry.slot === slot)?.name;\n}\n\n/**\n * The slot an argument to `/color` asks for: a number (`4`), a name\n * (`magenta`), or an initial (`m`). Case and surrounding space do not matter.\n * Undefined when it names no slot at all.\n */\nexport function parseSessionColorSlot(input: string): number | undefined {\n\tconst normalized = input.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (/^\\d+$/.test(normalized)) {\n\t\tconst slot = Number(normalized);\n\t\treturn isSessionColorSlot(slot) ? slot : undefined;\n\t}\n\tconst match = SESSION_COLOR_NAMES.find((entry) => entry.name === normalized || entry.aliases.includes(normalized));\n\treturn match?.slot;\n}\n\n/**\n * The slot one step away from `current`, wrapping at both ends.\n *\n * The keyboard cycle needs this rather than a picker because picking a colour is\n * usually a two-second decision made while looking at four terminals: step until\n * the chip stops looking like its neighbour's, then stop. Wrapping means the\n * cycle has no dead end to back out of, and a session sitting on a slot no theme\n * defines — or on nothing at all — starts from the first one rather than\n * refusing to move.\n */\nexport function cycleSessionColorSlot(current: number, direction: \"forward\" | \"backward\"): number {\n\tif (!isSessionColorSlot(current)) return 1;\n\tconst step = direction === \"forward\" ? 1 : SESSION_COLOR_SLOTS - 1;\n\treturn ((current - 1 + step) % SESSION_COLOR_SLOTS) + 1;\n}\n"]}
@@ -22,7 +22,7 @@ export declare const DEFAULT_SETTINGS: {
22
22
  timeoutSecs: number;
23
23
  };
24
24
  disabledTools: never[];
25
- toolOutputView: "glance";
25
+ toolOutputView: "peek";
26
26
  branchSummary: {
27
27
  reserveTokens: number;
28
28
  skipPrompt: false;