@hyperspaceng/neural-web-ui 0.64.1 → 0.65.3
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.
- package/CHANGELOG.md +6 -0
- package/README.md +8 -8
- package/example/package.json +1 -1
- package/package.json +3 -3
- package/src/ChatPanel.ts +1 -1
- package/src/components/AgentInterface.ts +4 -2
- package/src/components/MessageList.ts +1 -1
- package/src/components/Messages.ts +1 -1
- package/src/components/StreamingMessageContainer.ts +1 -1
- package/src/components/sandbox/ArtifactsRuntimeProvider.ts +4 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -202,10 +202,10 @@ await agent.prompt({ role: 'user-with-attachments', content: 'Check this', attac
|
|
|
202
202
|
|
|
203
203
|
// Control
|
|
204
204
|
agent.abort();
|
|
205
|
-
agent.
|
|
206
|
-
agent.
|
|
207
|
-
agent.
|
|
208
|
-
agent.
|
|
205
|
+
agent.state.model = newModel;
|
|
206
|
+
agent.state.thinkingLevel = 'medium';
|
|
207
|
+
agent.state.tools = [...];
|
|
208
|
+
agent.followUp(customMessage);
|
|
209
209
|
```
|
|
210
210
|
|
|
211
211
|
## Message Types
|
|
@@ -312,7 +312,7 @@ replTool.runtimeProvidersFactory = () => [
|
|
|
312
312
|
new ArtifactsRuntimeProvider(artifactsPanel, agent, true), // read-write
|
|
313
313
|
];
|
|
314
314
|
|
|
315
|
-
agent.
|
|
315
|
+
agent.state.tools = [replTool];
|
|
316
316
|
```
|
|
317
317
|
|
|
318
318
|
### Extract Document
|
|
@@ -325,7 +325,7 @@ import { createExtractDocumentTool } from '@mariozechner/pi-web-ui';
|
|
|
325
325
|
const extractTool = createExtractDocumentTool();
|
|
326
326
|
extractTool.corsProxyUrl = 'https://corsproxy.io/?';
|
|
327
327
|
|
|
328
|
-
agent.
|
|
328
|
+
agent.state.tools = [extractTool];
|
|
329
329
|
```
|
|
330
330
|
|
|
331
331
|
### Artifacts Tool
|
|
@@ -337,7 +337,7 @@ const artifactsPanel = new ArtifactsPanel();
|
|
|
337
337
|
artifactsPanel.agent = agent;
|
|
338
338
|
|
|
339
339
|
// The tool is available as artifactsPanel.tool
|
|
340
|
-
agent.
|
|
340
|
+
agent.state.tools = [artifactsPanel.tool];
|
|
341
341
|
```
|
|
342
342
|
|
|
343
343
|
### Custom Tool Renderers
|
|
@@ -551,7 +551,7 @@ const success = await ApiKeyPromptDialog.prompt('anthropic');
|
|
|
551
551
|
import { ModelSelector } from '@mariozechner/pi-web-ui';
|
|
552
552
|
|
|
553
553
|
ModelSelector.open(currentModel, (selectedModel) => {
|
|
554
|
-
agent.
|
|
554
|
+
agent.state.model = selectedModel;
|
|
555
555
|
});
|
|
556
556
|
```
|
|
557
557
|
|
package/example/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperspaceng/neural-web-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.3",
|
|
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",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lmstudio/sdk": "^1.5.0",
|
|
21
|
-
"@hyperspaceng/neural-ai": "^0.
|
|
22
|
-
"@hyperspaceng/neural-tui": "^0.
|
|
21
|
+
"@hyperspaceng/neural-ai": "^0.65.3",
|
|
22
|
+
"@hyperspaceng/neural-tui": "^0.65.3",
|
|
23
23
|
"docx-preview": "^0.3.7",
|
|
24
24
|
"jszip": "^3.10.1",
|
|
25
25
|
"lucide": "^0.544.0",
|
package/src/ChatPanel.ts
CHANGED
|
@@ -141,7 +141,7 @@ export class ChatPanel extends LitElement {
|
|
|
141
141
|
const additionalTools =
|
|
142
142
|
config?.toolsFactory?.(agent, this.agentInterface, this.artifactsPanel, runtimeProvidersFactory) || [];
|
|
143
143
|
const tools = [this.artifactsPanel.tool, ...additionalTools];
|
|
144
|
-
this.agent.
|
|
144
|
+
this.agent.state.tools = tools;
|
|
145
145
|
|
|
146
146
|
// Reconstruct artifacts from existing messages
|
|
147
147
|
// Temporarily disable the onArtifactsChange callback to prevent auto-opening on load
|
|
@@ -376,13 +376,15 @@ export class AgentInterface extends LitElement {
|
|
|
376
376
|
if (this.onModelSelect) {
|
|
377
377
|
this.onModelSelect();
|
|
378
378
|
} else {
|
|
379
|
-
ModelSelector.open(state.model, (model) =>
|
|
379
|
+
ModelSelector.open(state.model, (model) => {
|
|
380
|
+
session.state.model = model;
|
|
381
|
+
});
|
|
380
382
|
}
|
|
381
383
|
}}
|
|
382
384
|
.onThinkingChange=${
|
|
383
385
|
this.enableThinkingSelector
|
|
384
386
|
? (level: "off" | "minimal" | "low" | "medium" | "high") => {
|
|
385
|
-
session.
|
|
387
|
+
session.state.thinkingLevel = level;
|
|
386
388
|
}
|
|
387
389
|
: undefined
|
|
388
390
|
}
|
|
@@ -11,7 +11,7 @@ import { renderMessage } from "./message-renderer-registry.js";
|
|
|
11
11
|
export class MessageList extends LitElement {
|
|
12
12
|
@property({ type: Array }) messages: AgentMessage[] = [];
|
|
13
13
|
@property({ type: Array }) tools: AgentTool[] = [];
|
|
14
|
-
@property({ type: Object }) pendingToolCalls?:
|
|
14
|
+
@property({ type: Object }) pendingToolCalls?: ReadonlySet<string>;
|
|
15
15
|
@property({ type: Boolean }) isStreaming: boolean = false;
|
|
16
16
|
@property({ attribute: false }) onCostClick?: () => void;
|
|
17
17
|
|
|
@@ -85,7 +85,7 @@ export class UserMessage extends LitElement {
|
|
|
85
85
|
export class AssistantMessage extends LitElement {
|
|
86
86
|
@property({ type: Object }) message!: AssistantMessageType;
|
|
87
87
|
@property({ type: Array }) tools?: AgentTool<any>[];
|
|
88
|
-
@property({ type: Object }) pendingToolCalls?:
|
|
88
|
+
@property({ type: Object }) pendingToolCalls?: ReadonlySet<string>;
|
|
89
89
|
@property({ type: Boolean }) hideToolCalls = false;
|
|
90
90
|
@property({ type: Object }) toolResultsById?: Map<string, ToolResultMessageType>;
|
|
91
91
|
@property({ type: Boolean }) isStreaming: boolean = false;
|
|
@@ -6,7 +6,7 @@ import { property, state } from "lit/decorators.js";
|
|
|
6
6
|
export class StreamingMessageContainer extends LitElement {
|
|
7
7
|
@property({ type: Array }) tools: AgentTool[] = [];
|
|
8
8
|
@property({ type: Boolean }) isStreaming = false;
|
|
9
|
-
@property({ type: Object }) pendingToolCalls?:
|
|
9
|
+
@property({ type: Object }) pendingToolCalls?: ReadonlySet<string>;
|
|
10
10
|
@property({ type: Object }) toolResultsById?: Map<string, ToolResultMessage>;
|
|
11
11
|
@property({ attribute: false }) onCostClick?: () => void;
|
|
12
12
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
|
1
2
|
import {
|
|
2
3
|
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO,
|
|
3
4
|
ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW,
|
|
@@ -13,7 +14,7 @@ interface ArtifactsPanelLike {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
interface AgentLike {
|
|
16
|
-
|
|
17
|
+
state: { messages: AgentMessage[] };
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -171,7 +172,7 @@ export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
|
|
171
172
|
filename,
|
|
172
173
|
content,
|
|
173
174
|
});
|
|
174
|
-
this.agent?.
|
|
175
|
+
this.agent?.state.messages.push({
|
|
175
176
|
role: "artifact",
|
|
176
177
|
action,
|
|
177
178
|
filename,
|
|
@@ -192,7 +193,7 @@ export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
|
|
192
193
|
command: "delete",
|
|
193
194
|
filename,
|
|
194
195
|
});
|
|
195
|
-
this.agent?.
|
|
196
|
+
this.agent?.state.messages.push({
|
|
196
197
|
role: "artifact",
|
|
197
198
|
action: "delete",
|
|
198
199
|
filename,
|