@thoth-agents/pi-thoth-theme 0.4.0 → 0.5.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 (3) hide show
  1. package/README.md +20 -0
  2. package/dist/index.ts +34 -2
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -27,6 +27,26 @@ from the repository root. Restart Pi after installation.
27
27
  Select the `thoth` theme in Pi's theme settings. Theme selection is independent
28
28
  of the module toggles below.
29
29
 
30
+ ## User messages
31
+
32
+ The `thoth` theme renders user messages in `#E8DCB5` on `#120E0A`.
33
+ The extension surrounds the original Markdown with a top `╭── <icon> user ─…╮`
34
+ and bottom `╰─…╯` frame, separated from the content by blank lines. Both borders
35
+ fill the content width after Pi's horizontal padding and adapt on terminal resize.
36
+ Framing is skipped when the width is missing, invalid, or too narrow to fit the
37
+ title, one fill cell and the closing corner (13 columns with the current icons).
38
+ This is display-only: stored messages, assistant replies and thinking are unchanged.
39
+ Blank content and already-framed messages are left alone. The frame is independent
40
+ of the optional modules below.
41
+
42
+ The frame reuses `icons`: `"nerd"` (the existing default) selects nf-fa-user
43
+ (U+F007), `"unicode"` selects `●` (U+25CF), and `"ascii"` selects `@`.
44
+ Set `"icons": "nerd"` in the package configuration and use a Nerd Font in your
45
+ terminal for the Nerd glyph; use `"icons": "unicode"` for its Unicode fallback.
46
+
47
+ Markdown accents and syntax colors remain shared with assistant messages; only
48
+ ordinary user text and the frame use `userMessageText` (`#E8DCB5`).
49
+
30
50
  ## Modules
31
51
 
32
52
  - **Status line**: a responsive footer below the input showing cumulative
package/dist/index.ts CHANGED
@@ -139,6 +139,9 @@ var init_render_kit = __esm({
139
139
  completed: "\u2713",
140
140
  deleted: "\u2713",
141
141
  failed: "\u2717",
142
+ timedOut: "\u25F7",
143
+ resolved: "\u21BB",
144
+ expectedExit: "\u2713",
142
145
  cancelled: "\u2717",
143
146
  interrupted: "\u2717",
144
147
  blocked: "\u2717"
@@ -159,6 +162,9 @@ var init_panel_frame = __esm({
159
162
  }
160
163
  });
161
164
 
165
+ // src/index.ts
166
+ import { visibleWidth as visibleWidth8 } from "@earendil-works/pi-tui";
167
+
162
168
  // ../pi-core/src/validation.ts
163
169
  function isRecord(value) {
164
170
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -521,6 +527,7 @@ function cachedComponent(renderFn) {
521
527
 
522
528
  // src/shared/icons.ts
523
529
  var ICONS = {
530
+ user: { nerd: "\uF007", unicode: "\u25CF", ascii: "@" },
524
531
  branch: { nerd: "\uE0A0", unicode: "\u2442", ascii: "git" },
525
532
  folder: { nerd: "\uF07C", unicode: "dir", ascii: "dir" },
526
533
  model: { nerd: "\u{F06A9}", unicode: "\u25CF", ascii: "*" },
@@ -592,7 +599,10 @@ var STATUS_ICONS = {
592
599
  running: { nerd: "\u25D0", unicode: "\u25D0", ascii: "*" },
593
600
  completed: { nerd: "\uF00C", unicode: "\u2713", ascii: "+" },
594
601
  failed: { nerd: "\uF00D", unicode: "\u2717", ascii: "x" },
595
- cancelled: STOP,
602
+ timedOut: { nerd: "\uF017", unicode: "\u25F7", ascii: "T" },
603
+ resolved: { nerd: "\uF021", unicode: "\u21BB", ascii: "~" },
604
+ expectedExit: { nerd: "\uF00C", unicode: "\u2713", ascii: "+" },
605
+ cancelled: { ...STOP, ascii: "#" },
596
606
  interrupted: STOP,
597
607
  stopping: STOP,
598
608
  deleted: BLOCKED,
@@ -967,6 +977,9 @@ var STATUS_ROLE = {
967
977
  running: "accent",
968
978
  completed: "success",
969
979
  failed: "error",
980
+ timedOut: "warning",
981
+ resolved: "muted",
982
+ expectedExit: "dim",
970
983
  cancelled: "muted",
971
984
  interrupted: "warning",
972
985
  stopping: "warning",
@@ -978,13 +991,16 @@ var TOOL_FOOTER_STATUS = {
978
991
  completed: "completed",
979
992
  deleted: "completed",
980
993
  failed: "failed",
994
+ timedOut: "timedOut",
995
+ resolved: "resolved",
996
+ expectedExit: "expectedExit",
981
997
  cancelled: "failed",
982
998
  interrupted: "failed",
983
999
  blocked: "failed"
984
1000
  };
985
1001
  function startsWithFooterGlyph(footer, mode) {
986
1002
  const plain = stripTerminalSequences(footer);
987
- return ["completed", "failed"].some((status) => {
1003
+ return ["completed", "failed", "timedOut", "resolved", "expectedExit"].some((status) => {
988
1004
  const glyph = statusIcon(status, mode);
989
1005
  return plain.startsWith(glyph) && (plain.length === glyph.length || /^\s/u.test(plain.slice(glyph.length)));
990
1006
  });
@@ -4115,6 +4131,22 @@ function registerWelcome(pi, ctx, config, options) {
4115
4131
  // src/index.ts
4116
4132
  function thothTheme(pi) {
4117
4133
  const config = loadConfig();
4134
+ pi.registerMarkdownTransformer((markdown, context) => {
4135
+ if (context.messageType !== "user" || !markdown.trim()) return markdown;
4136
+ if (/^╭── [\uF007●@] user ─+╮\r?\n\r?\n[\s\S]*\r?\n\r?\n╰─+╯$/.test(markdown))
4137
+ return markdown;
4138
+ const width = context.availableWidth;
4139
+ const title = `\u256D\u2500\u2500 ${icon("user", config.icons)} user `;
4140
+ const titleWidth = visibleWidth8(title);
4141
+ if (!Number.isInteger(width) || width < titleWidth + 2) return markdown;
4142
+ const top = `${title}${"\u2500".repeat(width - titleWidth - 1)}\u256E`;
4143
+ const bottom = `\u2570${"\u2500".repeat(width - 2)}\u256F`;
4144
+ return `${top}
4145
+
4146
+ ${markdown}
4147
+
4148
+ ${bottom}`;
4149
+ });
4118
4150
  const owner = {};
4119
4151
  const cwd = process.cwd();
4120
4152
  const resolveToolRenderers = config.tools.enabled ? createToolRendererResolver(pi, config, cwd) : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoth-agents/pi-thoth-theme",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Modular Thoth theme, status line, tool styling, and welcome header for Pi.",
6
6
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  "@earendil-works/pi-tui": "1.0.2",
51
51
  "@earendil-works/pi-ai": "1.0.2",
52
52
  "@rolldown/binding-wasm32-wasi": "^1.2.4",
53
- "@thoth-agents/pi-core": "^0.3.0"
53
+ "@thoth-agents/pi-core": "^0.4.0"
54
54
  },
55
55
  "upstream": {
56
56
  "repository": "https://github.com/QuangThai/pi-omp-theme",