@4djs/assistant 0.0.0 → 0.1.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.
- package/README.md +49 -68
- package/dist/core/chat-activity.d.ts +19 -0
- package/dist/core/chat-activity.d.ts.map +1 -0
- package/dist/core/chat-commands.d.ts +33 -0
- package/dist/core/chat-commands.d.ts.map +1 -0
- package/dist/core/chat-history.d.ts +14 -0
- package/dist/core/chat-history.d.ts.map +1 -0
- package/dist/core/chat-reply-suggestions-parse.d.ts +20 -0
- package/dist/core/chat-reply-suggestions-parse.d.ts.map +1 -0
- package/dist/core/code-highlight.d.ts +3 -0
- package/dist/core/code-highlight.d.ts.map +1 -0
- package/dist/core/create-assistant-store.d.ts +33 -0
- package/dist/core/create-assistant-store.d.ts.map +1 -0
- package/dist/core/fetch-suggested-prompts.d.ts +11 -0
- package/dist/core/fetch-suggested-prompts.d.ts.map +1 -0
- package/dist/core/index.d.ts +19 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +2876 -0
- package/dist/core/interactive-tools/choices.d.ts +22 -0
- package/dist/core/interactive-tools/choices.d.ts.map +1 -0
- package/dist/core/interactive-tools/confirmation.d.ts +15 -0
- package/dist/core/interactive-tools/confirmation.d.ts.map +1 -0
- package/dist/core/interactive-tools/constants.d.ts +6 -0
- package/dist/core/interactive-tools/constants.d.ts.map +1 -0
- package/dist/core/interactive-tools/execute.d.ts +11 -0
- package/dist/core/interactive-tools/execute.d.ts.map +1 -0
- package/dist/core/interactive-tools/index.d.ts +7 -0
- package/dist/core/interactive-tools/index.d.ts.map +1 -0
- package/dist/core/interactive-tools/suggestions.d.ts +13 -0
- package/dist/core/interactive-tools/suggestions.d.ts.map +1 -0
- package/dist/core/interactive-tools/waiters.d.ts +4 -0
- package/dist/core/interactive-tools/waiters.d.ts.map +1 -0
- package/dist/core/llm-chat.d.ts +96 -0
- package/dist/core/llm-chat.d.ts.map +1 -0
- package/dist/core/llm-config.d.ts +24 -0
- package/dist/core/llm-config.d.ts.map +1 -0
- package/dist/core/llm-models.d.ts +14 -0
- package/dist/core/llm-models.d.ts.map +1 -0
- package/dist/core/llm-provider.d.ts +13 -0
- package/dist/core/llm-provider.d.ts.map +1 -0
- package/dist/core/llm-settings-storage.d.ts +47 -0
- package/dist/core/llm-settings-storage.d.ts.map +1 -0
- package/dist/core/llm-sse.d.ts +13 -0
- package/dist/core/llm-sse.d.ts.map +1 -0
- package/dist/core/llm-types.d.ts +49 -0
- package/dist/core/llm-types.d.ts.map +1 -0
- package/dist/core/markdown-utils.d.ts +3 -0
- package/dist/core/markdown-utils.d.ts.map +1 -0
- package/dist/core/prepare-markdown.d.ts +7 -0
- package/dist/core/prepare-markdown.d.ts.map +1 -0
- package/dist/core/types.d.ts +74 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/index.css +1195 -0
- package/dist/index.js +184948 -0
- package/dist/react/Assistant.d.ts +10 -0
- package/dist/react/Assistant.d.ts.map +1 -0
- package/dist/react/components/HighlightedJsonCode.d.ts +6 -0
- package/dist/react/components/HighlightedJsonCode.d.ts.map +1 -0
- package/dist/react/components/MarkdownContent.d.ts +10 -0
- package/dist/react/components/MarkdownContent.d.ts.map +1 -0
- package/dist/react/components/MarkdownEditor.d.ts +11 -0
- package/dist/react/components/MarkdownEditor.d.ts.map +1 -0
- package/dist/react/components/MermaidDiagram.d.ts +8 -0
- package/dist/react/components/MermaidDiagram.d.ts.map +1 -0
- package/dist/react/components/ModelSelector.d.ts +8 -0
- package/dist/react/components/ModelSelector.d.ts.map +1 -0
- package/dist/react/components/chat/AssistantErrorCallout.d.ts +11 -0
- package/dist/react/components/chat/AssistantErrorCallout.d.ts.map +1 -0
- package/dist/react/components/chat/ChatActivity.d.ts +8 -0
- package/dist/react/components/chat/ChatActivity.d.ts.map +1 -0
- package/dist/react/components/chat/ChatComposer.d.ts +36 -0
- package/dist/react/components/chat/ChatComposer.d.ts.map +1 -0
- package/dist/react/components/chat/ChatEmptyState.d.ts +10 -0
- package/dist/react/components/chat/ChatEmptyState.d.ts.map +1 -0
- package/dist/react/components/chat/ChatInteractivePrompt/choices-prompt.d.ts +7 -0
- package/dist/react/components/chat/ChatInteractivePrompt/choices-prompt.d.ts.map +1 -0
- package/dist/react/components/chat/ChatInteractivePrompt/confirmation-prompt.d.ts +7 -0
- package/dist/react/components/chat/ChatInteractivePrompt/confirmation-prompt.d.ts.map +1 -0
- package/dist/react/components/chat/ChatInteractivePrompt/index.d.ts +7 -0
- package/dist/react/components/chat/ChatInteractivePrompt/index.d.ts.map +1 -0
- package/dist/react/components/chat/ChatInteractivePrompt/shell.d.ts +13 -0
- package/dist/react/components/chat/ChatInteractivePrompt/shell.d.ts.map +1 -0
- package/dist/react/components/chat/ChatInteractivePrompt/utils.d.ts +4 -0
- package/dist/react/components/chat/ChatInteractivePrompt/utils.d.ts.map +1 -0
- package/dist/react/components/chat/ChatMessage.d.ts +11 -0
- package/dist/react/components/chat/ChatMessage.d.ts.map +1 -0
- package/dist/react/components/chat/ChatMessageScroll.d.ts +8 -0
- package/dist/react/components/chat/ChatMessageScroll.d.ts.map +1 -0
- package/dist/react/components/chat/ChatReplySuggestions.d.ts +9 -0
- package/dist/react/components/chat/ChatReplySuggestions.d.ts.map +1 -0
- package/dist/react/components/chat/ComposerCommandMenu.d.ts +10 -0
- package/dist/react/components/chat/ComposerCommandMenu.d.ts.map +1 -0
- package/dist/react/components/chat/LlmSettingsStrip.d.ts +7 -0
- package/dist/react/components/chat/LlmSettingsStrip.d.ts.map +1 -0
- package/dist/react/components/chat/LlmSetupPrompt.d.ts +7 -0
- package/dist/react/components/chat/LlmSetupPrompt.d.ts.map +1 -0
- package/dist/react/components/chat/LlmUnavailableBanner.d.ts +6 -0
- package/dist/react/components/chat/LlmUnavailableBanner.d.ts.map +1 -0
- package/dist/react/components/chat/SuggestedPromptsList.d.ts +14 -0
- package/dist/react/components/chat/SuggestedPromptsList.d.ts.map +1 -0
- package/dist/react/components/chat/SuggestedPromptsStrip.d.ts +11 -0
- package/dist/react/components/chat/SuggestedPromptsStrip.d.ts.map +1 -0
- package/dist/react/components/chat/SystemPromptField.d.ts +10 -0
- package/dist/react/components/chat/SystemPromptField.d.ts.map +1 -0
- package/dist/react/components/highlighted-code.d.ts +8 -0
- package/dist/react/components/highlighted-code.d.ts.map +1 -0
- package/dist/react/context.d.ts +11 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/hooks/use-composer-commands.d.ts +21 -0
- package/dist/react/hooks/use-composer-commands.d.ts.map +1 -0
- package/dist/react/hooks/use-suggested-prompts.d.ts +29 -0
- package/dist/react/hooks/use-suggested-prompts.d.ts.map +1 -0
- package/dist/react/index.d.ts +17 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/lib/parse-assistant-error.d.ts +9 -0
- package/dist/react/lib/parse-assistant-error.d.ts.map +1 -0
- package/dist/react/lib/prompt-icons.d.ts +5 -0
- package/dist/react/lib/prompt-icons.d.ts.map +1 -0
- package/dist/react/types.d.ts +69 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react/utils/cn.d.ts +2 -0
- package/dist/react/utils/cn.d.ts.map +1 -0
- package/package.json +16 -5
- package/src/core/chat-activity.ts +0 -107
- package/src/core/chat-commands.ts +0 -173
- package/src/core/chat-history.ts +0 -113
- package/src/core/chat-reply-suggestions-parse.ts +0 -119
- package/src/core/code-highlight.ts +0 -20
- package/src/core/create-assistant-store.ts +0 -639
- package/src/core/fetch-suggested-prompts.ts +0 -53
- package/src/core/index.ts +0 -125
- package/src/core/interactive-tools/choices.ts +0 -155
- package/src/core/interactive-tools/confirmation.ts +0 -63
- package/src/core/interactive-tools/constants.ts +0 -22
- package/src/core/interactive-tools/execute.ts +0 -70
- package/src/core/interactive-tools/index.ts +0 -41
- package/src/core/interactive-tools/suggestions.ts +0 -87
- package/src/core/interactive-tools/waiters.ts +0 -55
- package/src/core/llm-chat.ts +0 -686
- package/src/core/llm-config.ts +0 -101
- package/src/core/llm-models.ts +0 -96
- package/src/core/llm-provider.ts +0 -99
- package/src/core/llm-settings-storage.ts +0 -331
- package/src/core/llm-sse.ts +0 -166
- package/src/core/llm-types.ts +0 -52
- package/src/core/markdown-utils.ts +0 -11
- package/src/core/prepare-markdown.ts +0 -38
- package/src/core/types.ts +0 -86
- package/src/css.d.ts +0 -1
- package/src/react/Assistant.tsx +0 -358
- package/src/react/components/HighlightedJsonCode.tsx +0 -24
- package/src/react/components/MarkdownContent.tsx +0 -98
- package/src/react/components/MarkdownEditor.tsx +0 -60
- package/src/react/components/MermaidDiagram.tsx +0 -139
- package/src/react/components/ModelSelector.tsx +0 -243
- package/src/react/components/chat/AssistantErrorCallout.tsx +0 -79
- package/src/react/components/chat/ChatActivity.tsx +0 -274
- package/src/react/components/chat/ChatComposer.tsx +0 -189
- package/src/react/components/chat/ChatEmptyState.tsx +0 -145
- package/src/react/components/chat/ChatInteractivePrompt/choices-prompt.tsx +0 -262
- package/src/react/components/chat/ChatInteractivePrompt/confirmation-prompt.tsx +0 -97
- package/src/react/components/chat/ChatInteractivePrompt/index.tsx +0 -60
- package/src/react/components/chat/ChatInteractivePrompt/shell.tsx +0 -60
- package/src/react/components/chat/ChatInteractivePrompt/utils.ts +0 -14
- package/src/react/components/chat/ChatMessage.tsx +0 -150
- package/src/react/components/chat/ChatMessageScroll.tsx +0 -116
- package/src/react/components/chat/ChatReplySuggestions.tsx +0 -231
- package/src/react/components/chat/ComposerCommandMenu.tsx +0 -69
- package/src/react/components/chat/LlmSettingsStrip.tsx +0 -348
- package/src/react/components/chat/LlmSetupPrompt.tsx +0 -58
- package/src/react/components/chat/LlmUnavailableBanner.tsx +0 -11
- package/src/react/components/chat/SuggestedPromptsList.tsx +0 -121
- package/src/react/components/chat/SuggestedPromptsStrip.tsx +0 -72
- package/src/react/components/chat/SystemPromptField.tsx +0 -107
- package/src/react/components/highlighted-code.tsx +0 -107
- package/src/react/context.tsx +0 -72
- package/src/react/hooks/use-composer-commands.ts +0 -129
- package/src/react/hooks/use-suggested-prompts.ts +0 -128
- package/src/react/index.ts +0 -39
- package/src/react/lib/parse-assistant-error.ts +0 -96
- package/src/react/lib/prompt-icons.ts +0 -40
- package/src/react/types.ts +0 -83
- package/src/react/utils/cn.ts +0 -5
- package/test/buildLlmHistory.test.ts +0 -95
- package/test/llm-config.test.ts +0 -72
- package/test/llmSettingsStorage.test.ts +0 -121
- package/test/parse-assistant-error.test.ts +0 -24
- package/tsconfig.json +0 -8
- /package/{src/styles/assistant.css → dist/styles.css} +0 -0
package/README.md
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @4djs/assistant
|
|
2
2
|
|
|
3
|
-
Embeddable React chat assistant with LLM tool-calling, streaming, markdown rendering, and
|
|
3
|
+
Embeddable React chat assistant with LLM tool-calling, streaming, markdown rendering, and an in-app LLM settings panel. Connect any OpenAI-compatible provider — cloud APIs or a local server such as Ollama or LM Studio.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@4d/assistant": "workspace:*"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
```bash
|
|
8
|
+
npm install @4djs/assistant
|
|
9
|
+
# or
|
|
10
|
+
bun add @4djs/assistant
|
|
15
11
|
```
|
|
16
12
|
|
|
17
13
|
Peer dependencies: `react` and `react-dom` (^19).
|
|
@@ -19,7 +15,7 @@ Peer dependencies: `react` and `react-dom` (^19).
|
|
|
19
15
|
Import styles once in your app entry (required for the UI):
|
|
20
16
|
|
|
21
17
|
```ts
|
|
22
|
-
import "@
|
|
18
|
+
import "@4djs/assistant/styles.css";
|
|
23
19
|
```
|
|
24
20
|
|
|
25
21
|
The stylesheet uses CSS variables from your host app (`--brand`, `--surface-panel`, `--text-heading`, etc.). Define those tokens in your global CSS so the assistant matches your design system.
|
|
@@ -29,15 +25,15 @@ The stylesheet uses CSS variables from your host app (`--brand`, `--surface-pane
|
|
|
29
25
|
The simplest integration is `AssistantRoot`, which wires the provider, store bootstrap, and default panel UI:
|
|
30
26
|
|
|
31
27
|
```tsx
|
|
32
|
-
import { AssistantRoot, type AssistantConfig } from "@
|
|
28
|
+
import { AssistantRoot, type AssistantConfig } from "@4djs/assistant";
|
|
33
29
|
|
|
34
30
|
const config: AssistantConfig = {
|
|
35
31
|
llm: {
|
|
36
|
-
enabled:
|
|
37
|
-
baseUrl: import.meta.env.
|
|
38
|
-
apiKey: import.meta.env.
|
|
39
|
-
model: import.meta.env.
|
|
40
|
-
systemPrompt: "You are a helpful assistant
|
|
32
|
+
enabled: true,
|
|
33
|
+
baseUrl: import.meta.env.VITE_LLM_BASE_URL ?? "https://api.openai.com/v1",
|
|
34
|
+
apiKey: import.meta.env.VITE_LLM_KEY ?? null,
|
|
35
|
+
model: import.meta.env.VITE_LLM_MODEL ?? "gpt-4o-mini",
|
|
36
|
+
systemPrompt: "You are a helpful assistant with access to tools.",
|
|
41
37
|
},
|
|
42
38
|
storageKeys: {
|
|
43
39
|
history: "my-app-chat-history",
|
|
@@ -47,8 +43,8 @@ const config: AssistantConfig = {
|
|
|
47
43
|
id: "welcome",
|
|
48
44
|
role: "assistant",
|
|
49
45
|
content: llmEnabled
|
|
50
|
-
? `Hello! Using **${model ?? "LLM"}
|
|
51
|
-
: "Hello!
|
|
46
|
+
? `Hello! Using **${model ?? "LLM"}**. Ask me anything.`
|
|
47
|
+
: "Hello! Connect an LLM in **LLM settings** to start chatting.",
|
|
52
48
|
timestamp: Date.now(),
|
|
53
49
|
}),
|
|
54
50
|
listTools: async () => myTools,
|
|
@@ -60,7 +56,7 @@ export function MyAssistant() {
|
|
|
60
56
|
}
|
|
61
57
|
```
|
|
62
58
|
|
|
63
|
-
|
|
59
|
+
When no LLM is configured, chat input is disabled and the UI prompts users to open **LLM settings**. Settings and clear-chat remain available without a provider.
|
|
64
60
|
|
|
65
61
|
## Configuration
|
|
66
62
|
|
|
@@ -80,7 +76,6 @@ See [`apps/web/src/assistant/config.ts`](../../apps/web/src/assistant/config.ts)
|
|
|
80
76
|
| --- | --- |
|
|
81
77
|
| `llm` | OpenAI-compatible provider settings (see below). |
|
|
82
78
|
| `storageKeys` | `localStorage` keys for chat history and LLM settings (including selected model). |
|
|
83
|
-
| `fallbackHandler` | Called when LLM is disabled. Return an `AssistantMessage` or `null`. |
|
|
84
79
|
| `onToolInvoked` | Side-effect hook after each tool completes (e.g. refresh app state). |
|
|
85
80
|
| `fetchSuggestedPrompts` | Async hook to generate contextual starter prompts via LLM. |
|
|
86
81
|
| `autoLoadLlmStatus` | Fetch LLM config on mount (default: `true`). |
|
|
@@ -91,9 +86,9 @@ See [`apps/web/src/assistant/config.ts`](../../apps/web/src/assistant/config.ts)
|
|
|
91
86
|
{
|
|
92
87
|
header: {
|
|
93
88
|
title: "Assistant",
|
|
94
|
-
subtitle: "Query and explore your
|
|
95
|
-
icon: Sparkles,
|
|
96
|
-
showClearButton: true,
|
|
89
|
+
subtitle: "Query and explore your data",
|
|
90
|
+
icon: Sparkles, // lucide-react icon
|
|
91
|
+
showClearButton: true, // footer toolbar (default: true)
|
|
97
92
|
showSuggestionsButton: true, // footer toolbar when fetchSuggestedPrompts is set
|
|
98
93
|
},
|
|
99
94
|
emptyState: {
|
|
@@ -108,7 +103,7 @@ See [`apps/web/src/assistant/config.ts`](../../apps/web/src/assistant/config.ts)
|
|
|
108
103
|
composerPlaceholder: "Ask the assistant…",
|
|
109
104
|
showModelSelector: true,
|
|
110
105
|
maxWidth: "56rem",
|
|
111
|
-
className: "panel",
|
|
106
|
+
className: "panel", // extra class on the root panel
|
|
112
107
|
},
|
|
113
108
|
}
|
|
114
109
|
```
|
|
@@ -122,12 +117,12 @@ The assistant calls an **OpenAI-compatible** chat completions API directly from
|
|
|
122
117
|
Pass `llm` on `AssistantConfig`:
|
|
123
118
|
|
|
124
119
|
```ts
|
|
125
|
-
import type { AssistantLlmSettings } from "@
|
|
120
|
+
import type { AssistantLlmSettings } from "@4djs/assistant/core";
|
|
126
121
|
|
|
127
122
|
const llm: AssistantLlmSettings = {
|
|
128
123
|
enabled: true,
|
|
129
124
|
baseUrl: "https://api.openai.com/v1",
|
|
130
|
-
apiKey:
|
|
125
|
+
apiKey: process.env.LLM_KEY ?? null,
|
|
131
126
|
model: "gpt-4o-mini",
|
|
132
127
|
systemPrompt: "You are a helpful assistant with access to tools.",
|
|
133
128
|
models: ["gpt-4o-mini", "gpt-4o"], // optional static list
|
|
@@ -136,9 +131,9 @@ const llm: AssistantLlmSettings = {
|
|
|
136
131
|
|
|
137
132
|
| Field | Description |
|
|
138
133
|
| --- | --- |
|
|
139
|
-
| `enabled` | When `false`,
|
|
140
|
-
| `baseUrl` | Provider base URL (e.g. `https://api.openai.com/v1`). |
|
|
141
|
-
| `apiKey` | Bearer token for
|
|
134
|
+
| `enabled` | When `false`, chat is disabled until the user configures a provider. |
|
|
135
|
+
| `baseUrl` | Provider base URL (e.g. `https://api.openai.com/v1` or `http://127.0.0.1:11434/v1`). |
|
|
136
|
+
| `apiKey` | Bearer token for remote providers. Optional for local servers on `localhost`, `127.0.0.1`, or `*.local`. |
|
|
142
137
|
| `model` | Default model when the user has not picked one. |
|
|
143
138
|
| `models` | Optional static model list. When omitted, models are fetched from `{baseUrl}/models`. |
|
|
144
139
|
| `systemPrompt` | Prepended system message for each completion. |
|
|
@@ -157,30 +152,32 @@ llm: async () => ({
|
|
|
157
152
|
Configure globally outside React:
|
|
158
153
|
|
|
159
154
|
```ts
|
|
160
|
-
import { configureAssistantLlm } from "@
|
|
155
|
+
import { configureAssistantLlm } from "@4djs/assistant/core";
|
|
161
156
|
|
|
162
157
|
configureAssistantLlm({ enabled: true, baseUrl: "…", apiKey: "…", model: "…" });
|
|
163
158
|
```
|
|
164
159
|
|
|
165
|
-
|
|
160
|
+
Users can override provider settings in the built-in **LLM settings** panel. Values are persisted under `storageKeys.llmSettings` (default: `assistant-llm-settings`).
|
|
166
161
|
|
|
167
|
-
|
|
162
|
+
### Environment variables
|
|
163
|
+
|
|
164
|
+
A typical Vite or Next.js app might expose provider defaults like this:
|
|
168
165
|
|
|
169
166
|
| Variable | Description |
|
|
170
167
|
| --- | --- |
|
|
171
|
-
| `LLM_KEY` | API key
|
|
172
|
-
| `LLM_BASE_URL` | Provider URL (default: OpenAI) |
|
|
173
|
-
| `LLM_MODEL` | Default model |
|
|
174
|
-
| `LLM_MODELS` | Comma-separated extra models for the selector |
|
|
168
|
+
| `VITE_LLM_KEY` / `LLM_KEY` | API key for remote providers |
|
|
169
|
+
| `VITE_LLM_BASE_URL` / `LLM_BASE_URL` | Provider URL (default: OpenAI) |
|
|
170
|
+
| `VITE_LLM_MODEL` / `LLM_MODEL` | Default model |
|
|
171
|
+
| `VITE_LLM_MODELS` / `LLM_MODELS` | Comma-separated extra models for the selector |
|
|
175
172
|
|
|
176
|
-
**
|
|
173
|
+
**Security:** Calls are made directly to the provider from the client. Any API key in your bundle is visible to users. Use scoped keys for public apps, or proxy requests through your backend for production.
|
|
177
174
|
|
|
178
175
|
## Wiring tools
|
|
179
176
|
|
|
180
177
|
Tools must match the shape expected by the LLM agent:
|
|
181
178
|
|
|
182
179
|
```ts
|
|
183
|
-
import type { AssistantToolDefinition, AssistantToolResult } from "@
|
|
180
|
+
import type { AssistantToolDefinition, AssistantToolResult } from "@4djs/assistant";
|
|
184
181
|
|
|
185
182
|
const tools: AssistantToolDefinition[] = [
|
|
186
183
|
{
|
|
@@ -201,7 +198,6 @@ async function invokeTool(
|
|
|
201
198
|
name: string,
|
|
202
199
|
args: Record<string, unknown>,
|
|
203
200
|
): Promise<AssistantToolResult> {
|
|
204
|
-
// run tool, return text content for the model
|
|
205
201
|
return {
|
|
206
202
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
207
203
|
};
|
|
@@ -229,27 +225,7 @@ Array<{
|
|
|
229
225
|
}>
|
|
230
226
|
```
|
|
231
227
|
|
|
232
|
-
Use `parseSuggestedPromptsResponse` from `@
|
|
233
|
-
|
|
234
|
-
## Fallback mode (no LLM)
|
|
235
|
-
|
|
236
|
-
When `configUrl` reports `enabled: false`, the assistant skips the LLM and calls `fallbackHandler` instead:
|
|
237
|
-
|
|
238
|
-
```ts
|
|
239
|
-
fallbackHandler: async ({ message, tools }) => {
|
|
240
|
-
if (message === "catalog") {
|
|
241
|
-
return {
|
|
242
|
-
id: crypto.randomUUID(),
|
|
243
|
-
role: "assistant",
|
|
244
|
-
content: "Here is your catalog…",
|
|
245
|
-
timestamp: Date.now(),
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
return null;
|
|
249
|
-
},
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Return `null` to show a generic “LLM disabled” message.
|
|
228
|
+
Use `parseSuggestedPromptsResponse` from `@4djs/assistant/core` to validate LLM JSON output.
|
|
253
229
|
|
|
254
230
|
## Custom composition
|
|
255
231
|
|
|
@@ -262,7 +238,7 @@ import {
|
|
|
262
238
|
Assistant,
|
|
263
239
|
useAssistant,
|
|
264
240
|
useAssistantActions,
|
|
265
|
-
} from "@
|
|
241
|
+
} from "@4djs/assistant";
|
|
266
242
|
|
|
267
243
|
function CustomShell() {
|
|
268
244
|
const messages = useAssistant((s) => s.messages);
|
|
@@ -275,7 +251,7 @@ export function App() {
|
|
|
275
251
|
<AssistantProvider config={config}>
|
|
276
252
|
<AssistantBootstrap>
|
|
277
253
|
<CustomShell />
|
|
278
|
-
</
|
|
254
|
+
</AssistantBootstrap>
|
|
279
255
|
</AssistantProvider>
|
|
280
256
|
);
|
|
281
257
|
}
|
|
@@ -285,7 +261,7 @@ Exported building blocks include `ChatComposer`, `ChatMessageView`, `ChatEmptySt
|
|
|
285
261
|
|
|
286
262
|
## Composer commands
|
|
287
263
|
|
|
288
|
-
The input supports slash commands (e.g. `/clear`). Extend commands
|
|
264
|
+
The input supports slash commands (e.g. `/clear`). Extend commands via `runAssistantChatCommand` and related helpers from `@4djs/assistant/core`, or handle custom logic before `sendChat` in your host app.
|
|
289
265
|
|
|
290
266
|
## Core package
|
|
291
267
|
|
|
@@ -298,7 +274,8 @@ import {
|
|
|
298
274
|
buildLlmHistory,
|
|
299
275
|
fetchLlmStatus,
|
|
300
276
|
runAssistantChatCommand,
|
|
301
|
-
|
|
277
|
+
isLlmConfigured,
|
|
278
|
+
} from "@4djs/assistant/core";
|
|
302
279
|
```
|
|
303
280
|
|
|
304
281
|
Useful for server routes, tests, or a fully custom UI.
|
|
@@ -307,9 +284,11 @@ Useful for server routes, tests, or a fully custom UI.
|
|
|
307
284
|
|
|
308
285
|
| Import | Contents |
|
|
309
286
|
| --- | --- |
|
|
310
|
-
| `@
|
|
311
|
-
| `@
|
|
312
|
-
| `@
|
|
287
|
+
| `@4djs/assistant` | React components, hooks, types |
|
|
288
|
+
| `@4djs/assistant/core` | Store, LLM client, commands, interactive tools |
|
|
289
|
+
| `@4djs/assistant/styles.css` | Component styles |
|
|
290
|
+
|
|
291
|
+
The published package ships compiled JavaScript and TypeScript declarations from `dist/`. Source is not included in the tarball.
|
|
313
292
|
|
|
314
293
|
## Features
|
|
315
294
|
|
|
@@ -317,6 +296,8 @@ Useful for server routes, tests, or a fully custom UI.
|
|
|
317
296
|
- Interactive tool UI (confirmations, choices, reply suggestions)
|
|
318
297
|
- Markdown + GFM + math (KaTeX) + Mermaid diagrams
|
|
319
298
|
- Model selector with searchable dropdown
|
|
299
|
+
- In-app LLM settings (cloud or local OpenAI-compatible endpoints)
|
|
320
300
|
- Persistent chat history and model preference (`localStorage`)
|
|
321
301
|
- Welcome screen with static or LLM-generated starter prompts
|
|
322
302
|
- Composer footer toolbar: model selector, generate suggestions, clear chat
|
|
303
|
+
- Structured error states with retry actions
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ChatActivityStatus = "active" | "done" | "error";
|
|
2
|
+
export interface ChatActivityStep {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: "tool";
|
|
5
|
+
name: string;
|
|
6
|
+
args: Record<string, unknown>;
|
|
7
|
+
callId?: string;
|
|
8
|
+
status: ChatActivityStatus;
|
|
9
|
+
result?: unknown;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function summarizeActivityResult(result: unknown): unknown;
|
|
13
|
+
export declare function chatActivityStepLabel(step: ChatActivityStep): string;
|
|
14
|
+
export declare function formatJsonIfLarge(raw: string): string;
|
|
15
|
+
export declare function formatActivityJson(raw?: string): string | null;
|
|
16
|
+
export declare function formatActivityJsonValue(value: unknown): string | null;
|
|
17
|
+
export declare function isEmptyActivityJson(value: unknown): boolean;
|
|
18
|
+
export declare function stepHasDetails(step: ChatActivityStep): boolean;
|
|
19
|
+
//# sourceMappingURL=chat-activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-activity.d.ts","sourceRoot":"","sources":["../../src/core/chat-activity.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAYhE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAapE;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAarD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ9D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAuB3D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAI9D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type ChatCommandSurface = "assistant";
|
|
2
|
+
export type ChatCommandRunResult = {
|
|
3
|
+
handled: boolean;
|
|
4
|
+
clearInput?: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
};
|
|
7
|
+
export type AssistantCommandDeps = {
|
|
8
|
+
clearMessages: () => void;
|
|
9
|
+
setError: (error: string | null) => void;
|
|
10
|
+
streaming: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ChatCommandSuggestion = {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
usage: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function getChatCommandSuggestions(surface: ChatCommandSurface): ChatCommandSuggestion[];
|
|
18
|
+
export declare function isChatCommandInput(value: string): boolean;
|
|
19
|
+
export declare function filterChatCommands(value: string, surface: ChatCommandSurface): ChatCommandSuggestion[];
|
|
20
|
+
export declare function shouldShowChatCommandMenu(value: string, surface: ChatCommandSurface): boolean;
|
|
21
|
+
export declare function completionForChatCommand(command: ChatCommandSuggestion): string;
|
|
22
|
+
export declare function listChatCommands(surface?: ChatCommandSurface): Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function parseChatCommand(input: string): {
|
|
27
|
+
name: string;
|
|
28
|
+
args: string;
|
|
29
|
+
} | null;
|
|
30
|
+
export declare function runAssistantChatCommand(input: string, deps: AssistantCommandDeps): Promise<ChatCommandRunResult>;
|
|
31
|
+
/** @deprecated Use runAssistantChatCommand instead */
|
|
32
|
+
export declare function isClearCommand(text: string): boolean;
|
|
33
|
+
//# sourceMappingURL=chat-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-commands.d.ts","sourceRoot":"","sources":["../../src/core/chat-commands.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AAyBF,MAAM,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,kBAAkB,GACzB,qBAAqB,EAAE,CAQzB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,kBAAkB,GACzB,qBAAqB,EAAE,CAiBzB;AAED,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,kBAAkB,GACzB,OAAO,CAWT;AAED,wBAAgB,wBAAwB,CACvC,OAAO,EAAE,qBAAqB,GAC5B,MAAM,CAER;AAED,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,KAAK,CAAC;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC,CAID;AAED,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgBvC;AA2BD,wBAAsB,uBAAuB,CAC5C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,GACxB,OAAO,CAAC,oBAAoB,CAAC,CAO/B;AAED,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AssistantMessage, AssistantWelcomeContext } from "./types.js";
|
|
2
|
+
export interface ChatHistoryOptions {
|
|
3
|
+
storageKey?: string;
|
|
4
|
+
maxStored?: number;
|
|
5
|
+
welcomeMessage: (ctx: AssistantWelcomeContext) => AssistantMessage;
|
|
6
|
+
}
|
|
7
|
+
export declare function createChatHistoryHelpers(options: ChatHistoryOptions): {
|
|
8
|
+
getStored: () => AssistantMessage[] | null;
|
|
9
|
+
persist: (messages: AssistantMessage[]) => void;
|
|
10
|
+
clear: () => void;
|
|
11
|
+
loadInitial: (ctx: AssistantWelcomeContext) => AssistantMessage[];
|
|
12
|
+
};
|
|
13
|
+
export type { AssistantMessage };
|
|
14
|
+
//# sourceMappingURL=chat-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-history.d.ts","sourceRoot":"","sources":["../../src/core/chat-history.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAK5E,MAAM,WAAW,kBAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,CAAC,GAAG,EAAE,uBAAuB,KAAK,gBAAgB,CAAC;CACnE;AAyDD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB;qBAI7C,gBAAgB,EAAE,GAAG,IAAI;wBAapB,gBAAgB,EAAE;;uBAYnB,uBAAuB,KAAG,gBAAgB,EAAE;EAYtE;AAED,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type SuggestionField = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export type ParsedSuggestion = {
|
|
6
|
+
kind: "compact";
|
|
7
|
+
text: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "structured";
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
fields: SuggestionField[];
|
|
13
|
+
raw: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "custom";
|
|
16
|
+
text: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function parseSuggestionText(text: string): ParsedSuggestion;
|
|
19
|
+
export declare function splitToolValues(value: string): string[];
|
|
20
|
+
//# sourceMappingURL=chat-reply-suggestions-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-reply-suggestions-parse.d.ts","sourceRoot":"","sources":["../../src/core/chat-reply-suggestions-parse.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACzB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IACA,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACX,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAcpC,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAoClE;AA4CD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAUvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-highlight.d.ts","sourceRoot":"","sources":["../../src/core/code-highlight.ts"],"names":[],"mappings":"AAOA,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAQ3E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type LlmSettingsFormState, type LlmSettingsFormValues } from "./llm-settings-storage.js";
|
|
2
|
+
import type { AssistantMessage, AssistantStoreDependencies } from "./types.js";
|
|
3
|
+
export interface AssistantState {
|
|
4
|
+
messages: AssistantMessage[];
|
|
5
|
+
chatLoading: boolean;
|
|
6
|
+
llmEnabled: boolean;
|
|
7
|
+
llmModel: string | null;
|
|
8
|
+
llmModels: string[];
|
|
9
|
+
llmModelsLoading: boolean;
|
|
10
|
+
selectedModel: string | null;
|
|
11
|
+
loadLlmStatus: () => Promise<void>;
|
|
12
|
+
getLlmSettingsForm: () => Promise<LlmSettingsFormState>;
|
|
13
|
+
saveLlmSettings: (values: LlmSettingsFormValues) => Promise<void>;
|
|
14
|
+
clearLlmSettings: () => Promise<void>;
|
|
15
|
+
testLlmSettings: (values: LlmSettingsFormValues) => Promise<{
|
|
16
|
+
ok: true;
|
|
17
|
+
model: string;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
error: string;
|
|
21
|
+
}>;
|
|
22
|
+
llmSettingsHasOverrides: () => Promise<boolean>;
|
|
23
|
+
setSelectedModel: (model: string) => void;
|
|
24
|
+
sendChat: (message: string) => Promise<void>;
|
|
25
|
+
retryLastChat: () => Promise<void>;
|
|
26
|
+
clearChatHistory: () => void;
|
|
27
|
+
stopChat: () => void;
|
|
28
|
+
submitInteractiveToolResult: (callId: string, result: unknown) => void;
|
|
29
|
+
cancelInteractiveToolResult: (callId: string) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createAssistantStore(deps: AssistantStoreDependencies): import("zustand").UseBoundStore<import("zustand").StoreApi<AssistantState>>;
|
|
32
|
+
export type AssistantStore = ReturnType<typeof createAssistantStore>;
|
|
33
|
+
//# sourceMappingURL=create-assistant-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-assistant-store.d.ts","sourceRoot":"","sources":["../../src/core/create-assistant-store.ts"],"names":[],"mappings":"AAyBA,OAAO,EAMN,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAS1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAEX,gBAAgB,EAChB,0BAA0B,EAC1B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,kBAAkB,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACxD,eAAe,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,eAAe,EAAE,CAChB,MAAM,EAAE,qBAAqB,KACzB,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzE,uBAAuB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,2BAA2B,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACvE,2BAA2B,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AA8HD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,+EAsbpE;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SuggestedPromptsResponse {
|
|
2
|
+
prompts: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
prompt: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseSuggestedPromptsResponse(data: unknown): SuggestedPromptsResponse["prompts"];
|
|
11
|
+
//# sourceMappingURL=fetch-suggested-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-suggested-prompts.d.ts","sourceRoot":"","sources":["../../src/core/fetch-suggested-prompts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACxC,OAAO,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACH;AAED,wBAAgB,6BAA6B,CAC5C,IAAI,EAAE,OAAO,GACX,wBAAwB,CAAC,SAAS,CAAC,CAwCrC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type { ChatActivityStep } from "./chat-activity.js";
|
|
2
|
+
export { chatActivityStepLabel, formatJsonIfLarge, summarizeActivityResult, } from "./chat-activity.js";
|
|
3
|
+
export type { AssistantCommandDeps, ChatCommandRunResult, ChatCommandSuggestion, ChatCommandSurface, } from "./chat-commands.js";
|
|
4
|
+
export { filterChatCommands, getChatCommandSuggestions, isChatCommandInput, listChatCommands, parseChatCommand, runAssistantChatCommand, shouldShowChatCommandMenu, } from "./chat-commands.js";
|
|
5
|
+
export { createChatHistoryHelpers } from "./chat-history.js";
|
|
6
|
+
export { type AssistantState, createAssistantStore, } from "./create-assistant-store.js";
|
|
7
|
+
export { parseSuggestedPromptsResponse, type SuggestedPromptsResponse, } from "./fetch-suggested-prompts.js";
|
|
8
|
+
export { CHOICES_TOOL, type ChoiceOption, type ChoicesToolArgs, CONFIRMATION_TOOL, type ConfirmationToolArgs, type ReplySuggestions, rejectAllInteractiveToolWaiters, resolveInteractiveToolResult, SUGGEST_REPLIES_TOOL, } from "./interactive-tools/index.js";
|
|
9
|
+
export type { AgentStepResult, LlmChatStatus, StreamHandlers, ToolHandlers, } from "./llm-chat.js";
|
|
10
|
+
export { buildLlmHistory, ChatAbortedError, fetchLlmStatus, LlmNotConfiguredError, LlmUpstreamError, requestLlmCompletion, runLlmAgent, sanitizeLlmMessages, } from "./llm-chat.js";
|
|
11
|
+
export { buildCompletionsUrl, buildLlmRequestHeaders, buildModelsUrl, DEFAULT_LLM_BASE_URL, DEFAULT_LLM_MODEL, getFallbackModels, isLlmConfigured, isLlmUnavailableMessage, isLocalLlmBaseUrl, LLM_UNAVAILABLE_MESSAGE, } from "./llm-config.js";
|
|
12
|
+
export { clearProviderModelCache, fetchProviderModels, } from "./llm-models.js";
|
|
13
|
+
export { configureAssistantLlm, resetAssistantLlm, resolveAssistantLlmSettings, testLlmConnection, } from "./llm-provider.js";
|
|
14
|
+
export type { LlmSettingsFormState, LlmSettingsFormValues, StoredLlmUserSettings, } from "./llm-settings-storage.js";
|
|
15
|
+
export { assistantToStored, buildDefaultLlmSettings, createDefaultStoredSettings, createLlmSettingsFormState, createLlmSettingsFormStateFromStored, createLlmSettingsStorage, DEFAULT_LLM_SETTINGS_STORAGE_KEY, formatModelsText, isLlmSettingsFormDirty, mergeLlmSettings, migrateLegacyModelStorage, normalizeStoredSettings, normalizeStoredSystemPrompt, parseModelsText, peekStoredModel, persistStoredModelSelection, resolveSelectedModel, storedSettingsHaveOverrides, storedToAssistant, toStoredSettings, } from "./llm-settings-storage.js";
|
|
16
|
+
export type { ClientToolDefinition, LlmChatMessage, OpenAiToolCall, } from "./llm-types.js";
|
|
17
|
+
export { childrenToText } from "./markdown-utils.js";
|
|
18
|
+
export type { AssistantLlmConfig, AssistantLlmSettings, AssistantMessage, AssistantStorageKeys, AssistantStoreDependencies, AssistantSuggestedPrompt, AssistantToolContent, AssistantToolDefinition, AssistantToolResult, AssistantWelcomeContext, JsonSchema, } from "./types.js";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACN,KAAK,cAAc,EACnB,oBAAoB,GACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,6BAA6B,EAC7B,KAAK,wBAAwB,GAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,+BAA+B,EAC/B,4BAA4B,EAC5B,oBAAoB,GACpB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,uBAAuB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACX,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,oCAAoC,EACpC,wBAAwB,EACxB,gCAAgC,EAChC,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACX,oBAAoB,EACpB,cAAc,EACd,cAAc,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EACX,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,GACV,MAAM,YAAY,CAAC"}
|