@mariozechner/pi-web-ui 0.27.9 → 0.28.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-web-ui-example",
3
- "version": "1.15.9",
3
+ "version": "1.16.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,8 +1,8 @@
1
+ import { Alert } from "@mariozechner/mini-lit/dist/Alert.js";
1
2
  import type { Message } from "@mariozechner/pi-ai";
2
- import { html } from "lit";
3
- import { registerMessageRenderer } from "@mariozechner/pi-web-ui";
4
3
  import type { AppMessage, MessageRenderer } from "@mariozechner/pi-web-ui";
5
- import { Alert } from "@mariozechner/mini-lit/dist/Alert.js";
4
+ import { registerMessageRenderer } from "@mariozechner/pi-web-ui";
5
+ import { html } from "lit";
6
6
 
7
7
  // ============================================================================
8
8
  // 1. EXTEND AppMessage TYPE VIA DECLARATION MERGING
@@ -85,10 +85,7 @@ export function customMessageTransformer(messages: AppMessage[]): Message[] {
85
85
 
86
86
  // Keep LLM-compatible messages + custom messages
87
87
  return (
88
- m.role === "user" ||
89
- m.role === "assistant" ||
90
- m.role === "toolResult" ||
91
- m.role === "system-notification"
88
+ m.role === "user" || m.role === "assistant" || m.role === "toolResult" || m.role === "system-notification"
92
89
  );
93
90
  })
94
91
  .map((m) => {
@@ -103,7 +100,7 @@ export function customMessageTransformer(messages: AppMessage[]): Message[] {
103
100
 
104
101
  // Strip attachments from user messages
105
102
  if (m.role === "user") {
106
- const { attachments, ...rest } = m as any;
103
+ const { attachments: _, ...rest } = m as any;
107
104
  return rest as Message;
108
105
  }
109
106
 
@@ -7,27 +7,31 @@ import {
7
7
  type AppMessage,
8
8
  AppStorage,
9
9
  ChatPanel,
10
- createJavaScriptReplTool,
11
10
  CustomProvidersStore,
11
+ createJavaScriptReplTool,
12
12
  IndexedDBStorageBackend,
13
13
  // PersistentStorageDialog, // TODO: Fix - currently broken
14
14
  ProviderKeysStore,
15
- ProviderTransport,
16
15
  ProvidersModelsTab,
16
+ ProviderTransport,
17
17
  ProxyTab,
18
18
  SessionListDialog,
19
19
  SessionsStore,
20
- setAppStorage,
21
20
  SettingsDialog,
22
21
  SettingsStore,
22
+ setAppStorage,
23
23
  } from "@mariozechner/pi-web-ui";
24
24
  import { html, render } from "lit";
25
25
  import { Bell, History, Plus, Settings } from "lucide";
26
26
  import "./app.css";
27
- import { createSystemNotification, customMessageTransformer, registerCustomMessageRenderers } from "./custom-messages.js";
28
- import { Button } from "@mariozechner/mini-lit/dist/Button.js";
29
27
  import { icon } from "@mariozechner/mini-lit";
28
+ import { Button } from "@mariozechner/mini-lit/dist/Button.js";
30
29
  import { Input } from "@mariozechner/mini-lit/dist/Input.js";
30
+ import {
31
+ createSystemNotification,
32
+ customMessageTransformer,
33
+ registerCustomMessageRenderers,
34
+ } from "./custom-messages.js";
31
35
 
32
36
  // Register custom message renderers
33
37
  registerCustomMessageRenderers();
@@ -92,7 +96,7 @@ const generateTitle = (messages: AppMessage[]): string => {
92
96
  if (sentenceEnd > 0 && sentenceEnd <= 50) {
93
97
  return text.substring(0, sentenceEnd + 1);
94
98
  }
95
- return text.length <= 50 ? text : text.substring(0, 47) + "...";
99
+ return text.length <= 50 ? text : `${text.substring(0, 47)}...`;
96
100
  };
97
101
 
98
102
  const shouldSaveSession = (messages: AppMessage[]): boolean => {
@@ -211,12 +215,12 @@ Feel free to use these tools when needed to provide accurate and helpful respons
211
215
  onApiKeyRequired: async (provider: string) => {
212
216
  return await ApiKeyPromptDialog.prompt(provider);
213
217
  },
214
- toolsFactory: (agent, agentInterface, artifactsPanel, runtimeProvidersFactory) => {
218
+ toolsFactory: (_agent, _agentInterface, _artifactsPanel, runtimeProvidersFactory) => {
215
219
  // Create javascript_repl tool with access to attachments + artifacts
216
220
  const replTool = createJavaScriptReplTool();
217
221
  replTool.runtimeProvidersFactory = runtimeProvidersFactory;
218
222
  return [replTool];
219
- }
223
+ },
220
224
  });
221
225
  };
222
226
 
@@ -290,9 +294,10 @@ const renderApp = () => {
290
294
  title: "New Session",
291
295
  })}
292
296
 
293
- ${currentTitle
294
- ? isEditingTitle
295
- ? html`<div class="flex items-center gap-2">
297
+ ${
298
+ currentTitle
299
+ ? isEditingTitle
300
+ ? html`<div class="flex items-center gap-2">
296
301
  ${Input({
297
302
  type: "text",
298
303
  value: currentTitle,
@@ -322,7 +327,7 @@ const renderApp = () => {
322
327
  },
323
328
  })}
324
329
  </div>`
325
- : html`<button
330
+ : html`<button
326
331
  class="px-2 py-1 text-sm text-foreground hover:bg-secondary rounded transition-colors"
327
332
  @click=${() => {
328
333
  isEditingTitle = true;
@@ -339,7 +344,8 @@ const renderApp = () => {
339
344
  >
340
345
  ${currentTitle}
341
346
  </button>`
342
- : html`<span class="text-base font-semibold text-foreground">Pi Web UI Example</span>`}
347
+ : html`<span class="text-base font-semibold text-foreground">Pi Web UI Example</span>`
348
+ }
343
349
  </div>
344
350
  <div class="flex items-center gap-1 px-2">
345
351
  ${Button({
@@ -350,7 +356,9 @@ const renderApp = () => {
350
356
  // Demo: Inject custom message
351
357
  if (agent) {
352
358
  agent.appendMessage(
353
- createSystemNotification("This is a custom message! It appears in the UI but is never sent to the LLM."),
359
+ createSystemNotification(
360
+ "This is a custom message! It appears in the UI but is never sent to the LLM.",
361
+ ),
354
362
  );
355
363
  }
356
364
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mariozechner/pi-web-ui",
3
- "version": "0.27.9",
3
+ "version": "0.28.0",
4
4
  "description": "Reusable web UI components for AI chat interfaces powered by @mariozechner/pi-ai",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,12 +14,12 @@
14
14
  "build": "tsc -p tsconfig.build.json && tailwindcss -i ./src/app.css -o ./dist/app.css --minify",
15
15
  "dev": "concurrently --names \"build,example\" --prefix-colors \"cyan,green\" \"tsc -p tsconfig.build.json --watch --preserveWatchOutput\" \"tailwindcss -i ./src/app.css -o ./dist/app.css --watch\" \"npm run dev --prefix example\"",
16
16
  "dev:tsc": "concurrently --names \"build\" --prefix-colors \"cyan\" \"tsc -p tsconfig.build.json --watch --preserveWatchOutput\" \"tailwindcss -i ./src/app.css -o ./dist/app.css --watch\"",
17
- "check": "tsgo --noEmit && cd example && tsgo --noEmit"
17
+ "check": "biome check --write . && tsc --noEmit && cd example && biome check --write . && tsc --noEmit"
18
18
  },
19
19
  "dependencies": {
20
20
  "@lmstudio/sdk": "^1.5.0",
21
- "@mariozechner/pi-ai": "^0.27.9",
22
- "@mariozechner/pi-tui": "^0.27.9",
21
+ "@mariozechner/pi-ai": "^0.28.0",
22
+ "@mariozechner/pi-tui": "^0.28.0",
23
23
  "docx-preview": "^0.3.7",
24
24
  "jszip": "^3.10.1",
25
25
  "lucide": "^0.544.0",