@sagmans/dsh-tui 0.1.1 → 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 (94) hide show
  1. package/README.md +84 -10
  2. package/cordis.patch.yml +4 -2
  3. package/lib/agent/host.d.ts +14 -0
  4. package/lib/agent/host.d.ts.map +1 -1
  5. package/lib/agent/host.js +20 -4
  6. package/lib/agent/host.js.map +1 -1
  7. package/lib/agent/model.d.ts +24 -0
  8. package/lib/agent/model.d.ts.map +1 -1
  9. package/lib/agent/model.js +46 -1
  10. package/lib/agent/model.js.map +1 -1
  11. package/lib/agent/present.d.ts +7 -1
  12. package/lib/agent/present.d.ts.map +1 -1
  13. package/lib/agent/present.js +33 -4
  14. package/lib/agent/present.js.map +1 -1
  15. package/lib/agent/presets.d.ts +7 -1
  16. package/lib/agent/presets.d.ts.map +1 -1
  17. package/lib/agent/presets.js +7 -3
  18. package/lib/agent/presets.js.map +1 -1
  19. package/lib/cards.d.ts +127 -7
  20. package/lib/cards.d.ts.map +1 -1
  21. package/lib/cards.js +380 -52
  22. package/lib/cards.js.map +1 -1
  23. package/lib/export.d.ts +5 -4
  24. package/lib/export.d.ts.map +1 -1
  25. package/lib/export.js +62 -13
  26. package/lib/export.js.map +1 -1
  27. package/lib/fold-cursor.d.ts +23 -0
  28. package/lib/fold-cursor.d.ts.map +1 -0
  29. package/lib/fold-cursor.js +31 -0
  30. package/lib/fold-cursor.js.map +1 -0
  31. package/lib/index.d.ts +7 -1
  32. package/lib/index.d.ts.map +1 -1
  33. package/lib/index.js +310 -32
  34. package/lib/index.js.map +1 -1
  35. package/lib/input/submission.d.ts +3 -1
  36. package/lib/input/submission.d.ts.map +1 -1
  37. package/lib/input/submission.js +5 -2
  38. package/lib/input/submission.js.map +1 -1
  39. package/lib/terminal/warning-screen.d.ts +8 -0
  40. package/lib/terminal/warning-screen.d.ts.map +1 -0
  41. package/lib/terminal/warning-screen.js +66 -0
  42. package/lib/terminal/warning-screen.js.map +1 -0
  43. package/lib/theme-capability.d.ts +36 -0
  44. package/lib/theme-capability.d.ts.map +1 -0
  45. package/lib/theme-capability.js +190 -0
  46. package/lib/theme-capability.js.map +1 -0
  47. package/lib/theme-command.d.ts +10 -0
  48. package/lib/theme-command.d.ts.map +1 -0
  49. package/lib/theme-command.js +61 -0
  50. package/lib/theme-command.js.map +1 -0
  51. package/lib/theme-settings.d.ts +161 -0
  52. package/lib/theme-settings.d.ts.map +1 -0
  53. package/lib/theme-settings.js +166 -0
  54. package/lib/theme-settings.js.map +1 -0
  55. package/lib/theme-tokens.d.ts +110 -0
  56. package/lib/theme-tokens.d.ts.map +1 -0
  57. package/lib/theme-tokens.js +401 -0
  58. package/lib/theme-tokens.js.map +1 -0
  59. package/lib/theme.d.ts +32 -35
  60. package/lib/theme.d.ts.map +1 -1
  61. package/lib/theme.js +112 -63
  62. package/lib/theme.js.map +1 -1
  63. package/lib/tokens.d.ts +15 -0
  64. package/lib/tokens.d.ts.map +1 -0
  65. package/lib/tokens.js +29 -0
  66. package/lib/tokens.js.map +1 -0
  67. package/lib/transcript.d.ts +26 -1
  68. package/lib/transcript.d.ts.map +1 -1
  69. package/lib/transcript.js +153 -25
  70. package/lib/transcript.js.map +1 -1
  71. package/lib/ui/dock.d.ts.map +1 -1
  72. package/lib/ui/dock.js +67 -28
  73. package/lib/ui/dock.js.map +1 -1
  74. package/lib/ui/editor.d.ts +34 -0
  75. package/lib/ui/editor.d.ts.map +1 -0
  76. package/lib/ui/editor.js +98 -0
  77. package/lib/ui/editor.js.map +1 -0
  78. package/lib/ui/markdown.d.ts +8 -0
  79. package/lib/ui/markdown.d.ts.map +1 -1
  80. package/lib/ui/markdown.js +12 -0
  81. package/lib/ui/markdown.js.map +1 -1
  82. package/lib/ui/picker.d.ts +37 -0
  83. package/lib/ui/picker.d.ts.map +1 -1
  84. package/lib/ui/picker.js +53 -0
  85. package/lib/ui/picker.js.map +1 -1
  86. package/lib/ui/status.d.ts +3 -1
  87. package/lib/ui/status.d.ts.map +1 -1
  88. package/lib/ui/status.js +76 -24
  89. package/lib/ui/status.js.map +1 -1
  90. package/lib/ui/view.d.ts +43 -0
  91. package/lib/ui/view.d.ts.map +1 -1
  92. package/lib/ui/view.js +254 -54
  93. package/lib/ui/view.js.map +1 -1
  94. package/package.json +3 -1
package/lib/export.js CHANGED
@@ -1,19 +1,45 @@
1
+ import { rowText } from "./cards.js";
1
2
  import { displayText } from "./text.js";
2
3
  /** Directory-relative default the reader can find without being told. */
3
4
  export const DEFAULT_EXPORT_PREFIX = 'dsh-session';
5
+ /** How the dump marks a nested call that returned an error, which the screen carried as colour. */
6
+ const SUBCALL_FAILED_SUFFIX = ' (failed)';
4
7
  /** Id characters kept in a file name, so a session id cannot escape the directory. */
5
8
  const UNSAFE_NAME = /[^A-Za-z0-9._-]/gu;
9
+ /** The shortest code fence; a longer backtick run in the body needs a longer one. */
10
+ const MIN_FENCE = 3;
11
+ const BACKTICK_RUN = /`+/gu;
12
+ /** A comment body must not close the comment that carries it. */
13
+ const COMMENT_CLOSE = '-->';
14
+ const COMMENT_CLOSE_DEFUSED = '-->';
6
15
  /** Default file for a dump: the session's own name, in the working directory. */
7
16
  export function defaultExportFile(sessionId) {
8
17
  return `${DEFAULT_EXPORT_PREFIX}-${sessionId.replace(UNSAFE_NAME, '_')}.md`;
9
18
  }
19
+ /**
20
+ * A fence the body cannot close early.
21
+ *
22
+ * Tool output and thinking are arbitrary text, and a run of three backticks in
23
+ * either would end the block and spill the rest into the document as prose.
24
+ */
25
+ function fenceFor(text) {
26
+ let longest = 0;
27
+ for (const run of text.match(BACKTICK_RUN) ?? [])
28
+ longest = Math.max(longest, run.length);
29
+ return '`'.repeat(Math.max(MIN_FENCE, longest + 1));
30
+ }
31
+ /** Comment text with any closing marker defused, so the comment stays one. */
32
+ function commentBody(text) {
33
+ return displayText(text).replaceAll(COMMENT_CLOSE, COMMENT_CLOSE_DEFUSED);
34
+ }
10
35
  /**
11
36
  * Render the visible transcript as markdown.
12
37
  *
13
- * The surface's own glyphs are kept so a pasted dump reads like the screen it
14
- * came from, and every fragment is escaped for display for the same reason a
15
- * rendered row is: the file may be opened in a terminal, and it is full of
16
- * model and tool output.
38
+ * The dump outlives the screen it came from, so each row is given the markdown
39
+ * construct that carries its meaning rather than whichever mark the surface
40
+ * happened to draw, and every fragment is escaped for display for the same
41
+ * reason a rendered row is: the file may be opened in a terminal, and it is
42
+ * full of model and tool output.
17
43
  */
18
44
  export function transcriptToText(entries) {
19
45
  const lines = [];
@@ -26,23 +52,46 @@ export function transcriptToText(entries) {
26
52
  lines.push('', displayText(entry.text));
27
53
  break;
28
54
  case 'notice':
29
- lines.push('', `<!-- ${displayText(entry.text)} -->`);
55
+ lines.push('', `<!-- ${commentBody(entry.text)} -->`);
30
56
  break;
31
57
  case 'marker':
32
58
  lines.push('', `--- ${displayText(entry.text)} ---`);
33
59
  break;
34
- case 'reasoning':
35
- lines.push('', `<!-- ${displayText(entry.summary)} -->`);
60
+ case 'reasoning': {
61
+ // The thought is on screen now, so it belongs in the dump; only the
62
+ // count is metadata, and the body is the part a reader came for.
63
+ const body = entry.body.split('\n').map(displayText);
64
+ const fence = fenceFor(body.join('\n'));
65
+ lines.push('', `<!-- ${commentBody(entry.summary)} -->`, `${fence}reasoning`);
66
+ lines.push(...body);
67
+ lines.push(fence);
36
68
  break;
69
+ }
37
70
  case 'tool': {
38
71
  const mark = entry.card.failed ? 'ERROR' : 'tool';
39
- lines.push('', `### ${mark}: ${displayText(entry.card.title)}`, '', '```');
40
- for (const row of entry.card.detail)
41
- lines.push(displayText(row));
42
- if (entry.card.totalLines > entry.card.detail.length) {
43
- lines.push(`… ${entry.card.totalLines - entry.card.detail.length} more lines`);
72
+ // The dump is the words, not the screen: row classes exist so the
73
+ // surface can style a line, and a file has no use for them.
74
+ const rows = entry.card.detail.map(row => displayText(rowText(row)));
75
+ const more = entry.card.totalLines > entry.card.detail.length
76
+ ? `… ${entry.card.totalLines - entry.card.detail.length} more lines`
77
+ : undefined;
78
+ const fence = fenceFor([displayText(entry.card.title), ...rows, more ?? ''].join('\n'));
79
+ lines.push('', `### ${mark}: ${displayText(entry.card.title)}`);
80
+ // The calls are what the reader saw under the card, so a dump that
81
+ // dropped them would lose the only record of what the program reached.
82
+ const subCalls = entry.card.subCalls ?? [];
83
+ for (const call of subCalls) {
84
+ const text = call.argument === undefined ? call.title : `${call.title} ${call.argument}`;
85
+ lines.push(`- ${displayText(text)}${call.failed ? SUBCALL_FAILED_SUFFIX : ''}`);
44
86
  }
45
- lines.push('```');
87
+ const dropped = (entry.card.subCallsTotal ?? subCalls.length) - subCalls.length;
88
+ if (dropped > 0)
89
+ lines.push(`- … ${dropped} more calls`);
90
+ lines.push('', fence);
91
+ lines.push(...rows);
92
+ if (more !== undefined)
93
+ lines.push(more);
94
+ lines.push(fence);
46
95
  break;
47
96
  }
48
97
  }
package/lib/export.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"export.js","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAGvC,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAA;AAElD,sFAAsF;AACtF,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,OAAO,GAAG,qBAAqB,IAAI,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,KAAK,CAAA;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAmC;IAClE,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,MAAM;gBACT,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,WA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C,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;gBAC1C,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;oBAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAA;oBACxF,KAAK,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;gBACjF,CAAC;gBACD,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAA;gBAC/E,IAAI,OAAO,GAAG,CAAC;oBAAE,KAAK,CAAC,IAAI,CAAC,OAAO,OAAO,aAAa,CAAC,CAAA;gBACxD,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;gBACrB,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;gBACnB,IAAI,IAAI,KAAK,SAAS;oBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACxC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACjB,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAA;AACrD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ForkEvent } from './agent/fork.ts';
2
+ /**
3
+ * The fold's place in a session's durable event sequence.
4
+ *
5
+ * A resumed session is folded while its agent's loop is already live, so the
6
+ * same event reaches the surface twice: once on the stream, once from the log
7
+ * the fold is reading. Every durable event carries a monotonic sequence number,
8
+ * which is what tells a row that has already been drawn from one that has not.
9
+ */
10
+ /** Consumes durable events in sequence order, each exactly once. */
11
+ export declare class FoldCursor {
12
+ private through;
13
+ /**
14
+ * Start a fresh transcript.
15
+ *
16
+ * Sequence numbers are per session, so a fold that begins a new transcript
17
+ * must not measure its events against the previous session's numbering.
18
+ */
19
+ reset(): void;
20
+ /** Whether an event still has to be folded, and record it when it does. */
21
+ accept(event: ForkEvent): boolean;
22
+ }
23
+ //# sourceMappingURL=fold-cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fold-cursor.d.ts","sourceRoot":"","sources":["../src/fold-cursor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;;;;;GAOG;AAEH,oEAAoE;AACpE,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAoB;IAEnC;;;;;OAKG;IACH,KAAK,IAAI,IAAI;IAIb,2EAA2E;IAC3E,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;CAOlC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The fold's place in a session's durable event sequence.
3
+ *
4
+ * A resumed session is folded while its agent's loop is already live, so the
5
+ * same event reaches the surface twice: once on the stream, once from the log
6
+ * the fold is reading. Every durable event carries a monotonic sequence number,
7
+ * which is what tells a row that has already been drawn from one that has not.
8
+ */
9
+ /** Consumes durable events in sequence order, each exactly once. */
10
+ export class FoldCursor {
11
+ through;
12
+ /**
13
+ * Start a fresh transcript.
14
+ *
15
+ * Sequence numbers are per session, so a fold that begins a new transcript
16
+ * must not measure its events against the previous session's numbering.
17
+ */
18
+ reset() {
19
+ this.through = undefined;
20
+ }
21
+ /** Whether an event still has to be folded, and record it when it does. */
22
+ accept(event) {
23
+ if (typeof event.seq === 'number') {
24
+ if (this.through !== undefined && event.seq <= this.through)
25
+ return false;
26
+ this.through = event.seq;
27
+ }
28
+ return true;
29
+ }
30
+ }
31
+ //# sourceMappingURL=fold-cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fold-cursor.js","sourceRoot":"","sources":["../src/fold-cursor.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,oEAAoE;AACpE,MAAM,OAAO,UAAU;IACb,OAAO,CAAoB;IAEnC;;;;;OAKG;IACH,KAAK;QACH,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA;IAC1B,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,KAAgB;QACrB,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAO,KAAK,CAAA;YACzE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAA;QAC1B,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
package/lib/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  export declare const name = "tui";
3
- /** `agents` is the only service the surface cannot run without. */
3
+ /**
4
+ * Services the surface cannot run without.
5
+ *
6
+ * `tools` is what lets a card read its tool's own render intent; a context that
7
+ * has not injected it throws on the property read, which silently degraded
8
+ * every card to a bare generic row.
9
+ */
4
10
  export declare const inject: string[];
5
11
  /**
6
12
  * Refuse to run without a real terminal.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAkDlD,eAAO,MAAM,IAAI,QAAQ,CAAA;AAEzB,mEAAmE;AACnE,eAAO,MAAM,MAAM,UAAa,CAAA;AAgChC;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,GAAE;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAC1B,GAAG,IAAI,CAMZ;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAioCzD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAiElD,eAAO,MAAM,IAAI,QAAQ,CAAA;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,UAAsB,CAAA;AAgCzC;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,GAAE;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAC1B,GAAG,IAAI,CAMZ;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CA04CzD"}