@corenel/term 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/chunk-2D7G4YW2.js +97 -0
  2. package/dist/chunk-CB5RFNB4.js +33 -0
  3. package/dist/chunk-F4ENQXQQ.js +909 -0
  4. package/dist/chunk-I44FC7PE.js +142 -0
  5. package/dist/chunk-IK4ZANNW.js +95 -0
  6. package/dist/chunk-M44CET5L.js +40 -0
  7. package/dist/chunk-OSJFMQCW.js +44 -0
  8. package/dist/{chunk-R6AXTD55.js → chunk-VTJEWHM3.js} +19 -1
  9. package/dist/commands.d.ts +14 -0
  10. package/dist/commands.d.ts.map +1 -1
  11. package/dist/commands.js +1 -1
  12. package/dist/describe.d.ts +23 -0
  13. package/dist/describe.d.ts.map +1 -1
  14. package/dist/describe.js +6 -1
  15. package/dist/diff.d.ts +100 -0
  16. package/dist/diff.d.ts.map +1 -0
  17. package/dist/diff.js +18 -0
  18. package/dist/ink/App.d.ts +12 -0
  19. package/dist/ink/App.d.ts.map +1 -1
  20. package/dist/ink/Modal.d.ts.map +1 -1
  21. package/dist/ink/TodoBlock.d.ts +10 -0
  22. package/dist/ink/TodoBlock.d.ts.map +1 -0
  23. package/dist/ink/banner.d.ts +36 -0
  24. package/dist/ink/banner.d.ts.map +1 -0
  25. package/dist/ink/index.d.ts.map +1 -1
  26. package/dist/ink/index.js +300 -140
  27. package/dist/ink/items.d.ts.map +1 -1
  28. package/dist/ink/scroll.d.ts +14 -2
  29. package/dist/ink/scroll.d.ts.map +1 -1
  30. package/dist/ink/status.d.ts.map +1 -1
  31. package/dist/ink/theme.d.ts +9 -0
  32. package/dist/ink/theme.d.ts.map +1 -1
  33. package/dist/ink/todos.d.ts +20 -0
  34. package/dist/ink/todos.d.ts.map +1 -0
  35. package/dist/markdown.d.ts.map +1 -1
  36. package/dist/persist.d.ts +27 -4
  37. package/dist/persist.d.ts.map +1 -1
  38. package/dist/persist.js +3 -1
  39. package/dist/policySource.d.ts +26 -0
  40. package/dist/policySource.d.ts.map +1 -0
  41. package/dist/policySource.js +8 -0
  42. package/dist/session.d.ts +199 -13
  43. package/dist/session.d.ts.map +1 -1
  44. package/dist/session.js +10 -5
  45. package/dist/state.d.ts +84 -0
  46. package/dist/state.d.ts.map +1 -1
  47. package/dist/state.js +5 -3
  48. package/dist/writePreview.d.ts +58 -0
  49. package/dist/writePreview.d.ts.map +1 -0
  50. package/dist/writePreview.js +9 -0
  51. package/package.json +19 -6
  52. package/dist/chunk-47IH6X5H.js +0 -20
  53. package/dist/chunk-HAQGHLW6.js +0 -235
  54. package/dist/chunk-HYWLODZT.js +0 -1230
  55. package/dist/chunk-TCVDVYMF.js +0 -40
@@ -1,40 +0,0 @@
1
- // src/describe.ts
2
- var PREVIEW_LINES = 6;
3
- var PREVIEW_LINES_ERROR = 12;
4
- var SUBJECT_WIDTH = 68;
5
- function describeToolCall(_name, args) {
6
- const a = args ?? {};
7
- const raw = a.path ?? a.file ?? a.command ?? a.cmd ?? a.query ?? a.url;
8
- const pattern = typeof a.pattern === "string" ? `/${a.pattern}/` : "";
9
- const text = typeof raw === "string" ? raw : pattern;
10
- if (!text) return "";
11
- const one = text.replace(/\s+/g, " ").trim();
12
- return one.length > SUBJECT_WIDTH ? `${one.slice(0, SUBJECT_WIDTH - 1)}\u2026` : one;
13
- }
14
- function capPreview(result, isError) {
15
- const lines = result.split("\n").map((l) => l.replace(/\s+$/, ""));
16
- while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
17
- while (lines.length && !lines[0].trim()) lines.shift();
18
- if (!lines.length) return [];
19
- const cap = isError ? PREVIEW_LINES_ERROR : PREVIEW_LINES;
20
- if (lines.length <= cap) return lines;
21
- const dropped = lines.length - cap;
22
- return [...lines.slice(0, cap), `\u2026 ${dropped} more line${dropped === 1 ? "" : "s"}`];
23
- }
24
- function formatTools(tools) {
25
- if (!tools.length) return "No tools are available.";
26
- const w = Math.max(...tools.map((t) => t.name.length));
27
- const line = (t) => ` ${t.name.padEnd(w)} ${t.mutates ? "*" : " "} ${t.means ?? t.description.split(". ")[0]}`;
28
- return [
29
- `${tools.length} tools available (* = can change things, and will ask first):`,
30
- ...[...tools].sort((a, b) => a.name.localeCompare(b.name)).map(line)
31
- ].join("\n");
32
- }
33
-
34
- export {
35
- PREVIEW_LINES,
36
- PREVIEW_LINES_ERROR,
37
- describeToolCall,
38
- capPreview,
39
- formatTools
40
- };