@rind-ai/cli 0.4.1 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bin/rind.js +5 -5
  2. package/lib/assistant-renderer.js +179 -265
  3. package/lib/choice-menu-state.js +46 -46
  4. package/lib/cli-input-actions.js +548 -0
  5. package/lib/cli-output-controller.js +460 -0
  6. package/lib/cli-runtime-controller.js +350 -0
  7. package/lib/cli-state-store.js +32 -0
  8. package/lib/cli-state.js +41 -0
  9. package/lib/command-controller.js +159 -126
  10. package/lib/compact-context-state.js +22 -22
  11. package/lib/components/assistant-message.js +169 -0
  12. package/lib/components/composer-area.js +25 -0
  13. package/lib/components/dynamic-block.js +20 -0
  14. package/lib/components/monitor-stack.js +35 -0
  15. package/lib/components/text-block.js +47 -0
  16. package/lib/components/tool-block.js +122 -0
  17. package/lib/composer-terminal.js +224 -203
  18. package/lib/event-controller.js +243 -242
  19. package/lib/frontend-cli-implementation.js +656 -1111
  20. package/lib/input-controller.js +75 -94
  21. package/lib/input-errors.js +3 -3
  22. package/lib/interrupt-state.js +9 -9
  23. package/lib/line-editor.js +541 -541
  24. package/lib/local-slash-commands.js +217 -0
  25. package/lib/markdown-lines.js +103 -0
  26. package/lib/model-menu-state.js +50 -50
  27. package/lib/one-shot-progress.js +145 -0
  28. package/lib/one-shot.js +228 -0
  29. package/lib/question-menu-state.js +61 -0
  30. package/lib/rendering.js +1295 -1037
  31. package/lib/runtime-client.js +241 -193
  32. package/lib/runtime-env.js +21 -21
  33. package/lib/runtime-protocol.js +122 -15
  34. package/lib/slash-command-mode.js +16 -27
  35. package/lib/slash-menu-state.js +59 -59
  36. package/lib/{background-controller.js → task-monitor-controller.js} +411 -289
  37. package/lib/terminal-key.js +97 -97
  38. package/lib/text-width.js +335 -151
  39. package/lib/theme-menu-state.js +31 -0
  40. package/lib/theme.js +134 -0
  41. package/lib/tool-display.js +680 -0
  42. package/lib/tui/component.js +55 -0
  43. package/lib/tui/cursor.js +29 -0
  44. package/lib/tui/input-buffer.js +172 -0
  45. package/lib/tui/tui.js +591 -0
  46. package/lib/turn-controller.js +68 -78
  47. package/package.json +28 -28
  48. package/lib/assistant-stream-buffer.js +0 -25
  49. package/lib/terminal-ui.js +0 -581
@@ -1,59 +1,59 @@
1
- export function createSlashMenuState(commands) {
2
- let text = "";
3
- let selected = 0;
4
- let dismissed = false;
5
- return {
6
- input() {
7
- return text;
8
- },
9
- matches() {
10
- return dismissed ? [] : matchingCommands(commands, text);
11
- },
12
- selectedIndex() {
13
- return selected;
14
- },
15
- selectedCommand() {
16
- return this.matches()[selected] || null;
17
- },
18
- handleKey(chunk, key = {}) {
19
- if (key.name === "escape") {
20
- dismissed = true;
21
- selected = 0;
22
- return true;
23
- }
24
- const matches = this.matches();
25
- if (matches.length && key.name === "up") {
26
- selected = selected <= 0 ? matches.length - 1 : selected - 1;
27
- return true;
28
- }
29
- if (matches.length && key.name === "down") {
30
- selected = selected >= matches.length - 1 ? 0 : selected + 1;
31
- return true;
32
- }
33
- if (chunk && !key.ctrl && !key.meta && String(chunk) >= " ") {
34
- text += String(chunk);
35
- selected = 0;
36
- dismissed = false;
37
- return true;
38
- }
39
- return false;
40
- },
41
- setInput(value) {
42
- const nextText = String(value || "");
43
- if (nextText !== text) {
44
- selected = 0;
45
- dismissed = false;
46
- }
47
- text = nextText;
48
- },
49
- };
50
- }
51
-
52
- function matchingCommands(commands, line) {
53
- const text = String(line || "");
54
- if (!text.startsWith("/") || /\s/.test(text)) {
55
- return [];
56
- }
57
- const token = text.slice(1).toLowerCase();
58
- return commands.filter((command) => command.name.startsWith(token));
59
- }
1
+ export function createSlashMenuState(commands) {
2
+ let text = "";
3
+ let selected = 0;
4
+ let dismissed = false;
5
+ return {
6
+ input() {
7
+ return text;
8
+ },
9
+ matches() {
10
+ return dismissed ? [] : matchingCommands(commands, text);
11
+ },
12
+ selectedIndex() {
13
+ return selected;
14
+ },
15
+ selectedCommand() {
16
+ return this.matches()[selected] || null;
17
+ },
18
+ handleKey(chunk, key = {}) {
19
+ if (key.name === "escape") {
20
+ dismissed = true;
21
+ selected = 0;
22
+ return true;
23
+ }
24
+ const matches = this.matches();
25
+ if (matches.length && key.name === "up") {
26
+ selected = selected <= 0 ? matches.length - 1 : selected - 1;
27
+ return true;
28
+ }
29
+ if (matches.length && key.name === "down") {
30
+ selected = selected >= matches.length - 1 ? 0 : selected + 1;
31
+ return true;
32
+ }
33
+ if (chunk && !key.ctrl && !key.meta && String(chunk) >= " ") {
34
+ text += String(chunk);
35
+ selected = 0;
36
+ dismissed = false;
37
+ return true;
38
+ }
39
+ return false;
40
+ },
41
+ setInput(value) {
42
+ const nextText = String(value || "");
43
+ if (nextText !== text) {
44
+ selected = 0;
45
+ dismissed = false;
46
+ }
47
+ text = nextText;
48
+ },
49
+ };
50
+ }
51
+
52
+ function matchingCommands(commands, line) {
53
+ const text = String(line || "");
54
+ if (!text.startsWith("/") || /\s/.test(text)) {
55
+ return [];
56
+ }
57
+ const token = text.slice(1).toLowerCase();
58
+ return commands.filter((command) => command.name.startsWith(token));
59
+ }