@4djs/assistant 0.1.0 → 0.1.2
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 +138 -3
- package/dist/core/chat-activity.d.ts +2 -1
- package/dist/core/chat-activity.d.ts.map +1 -1
- package/dist/core/chat-commands.d.ts +6 -4
- package/dist/core/chat-commands.d.ts.map +1 -1
- package/dist/core/chat-history.d.ts.map +1 -1
- package/dist/core/chat-reply-suggestions-parse.d.ts.map +1 -1
- package/dist/core/create-assistant-store.d.ts +1 -0
- package/dist/core/create-assistant-store.d.ts.map +1 -1
- package/dist/core/fetch-suggested-prompts.d.ts.map +1 -1
- package/dist/core/index.d.ts +10 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2148 -838
- package/dist/core/interactive-tools/choices.d.ts.map +1 -1
- package/dist/core/interactive-tools/confirmation.d.ts.map +1 -1
- package/dist/core/interactive-tools/execute.d.ts.map +1 -1
- package/dist/core/interactive-tools/gate.d.ts +14 -0
- package/dist/core/interactive-tools/gate.d.ts.map +1 -0
- package/dist/core/interactive-tools/index.d.ts +1 -0
- package/dist/core/interactive-tools/index.d.ts.map +1 -1
- package/dist/core/interactive-tools/suggestions.d.ts.map +1 -1
- package/dist/core/interactive-tools/waiters.d.ts.map +1 -1
- package/dist/core/llm-chat.d.ts.map +1 -1
- package/dist/core/llm-config.d.ts.map +1 -1
- package/dist/core/llm-models.d.ts.map +1 -1
- package/dist/core/llm-provider.d.ts.map +1 -1
- package/dist/core/llm-settings-storage.d.ts.map +1 -1
- package/dist/core/llm-sse.d.ts.map +1 -1
- package/dist/core/llm-types.d.ts.map +1 -1
- package/dist/core/markdown-utils.d.ts +1 -2
- package/dist/core/markdown-utils.d.ts.map +1 -1
- package/dist/core/system-prompt.d.ts +3 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/tool-names.d.ts +5 -0
- package/dist/core/tool-names.d.ts.map +1 -0
- package/dist/core/tool-registry.d.ts +28 -0
- package/dist/core/tool-registry.d.ts.map +1 -0
- package/dist/core/types.d.ts +5 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.js +875 -4161
- package/dist/labels.d.ts +136 -0
- package/dist/labels.d.ts.map +1 -0
- package/dist/react/Assistant.d.ts.map +1 -1
- package/dist/react/components/HighlightedJsonCode.d.ts.map +1 -1
- package/dist/react/components/MarkdownContent.d.ts.map +1 -1
- package/dist/react/components/MarkdownEditor.d.ts.map +1 -1
- package/dist/react/components/MermaidDiagram.d.ts.map +1 -1
- package/dist/react/components/ModelSelector.d.ts.map +1 -1
- package/dist/react/components/chat/AssistantErrorCallout.d.ts +3 -1
- package/dist/react/components/chat/AssistantErrorCallout.d.ts.map +1 -1
- package/dist/react/components/chat/ChatActivity.d.ts.map +1 -1
- package/dist/react/components/chat/ChatComposer.d.ts +3 -1
- package/dist/react/components/chat/ChatComposer.d.ts.map +1 -1
- package/dist/react/components/chat/ChatEmptyState.d.ts.map +1 -1
- package/dist/react/components/chat/ChatInteractivePrompt/choices-prompt.d.ts.map +1 -1
- package/dist/react/components/chat/ChatInteractivePrompt/confirmation-prompt.d.ts.map +1 -1
- package/dist/react/components/chat/ChatInteractivePrompt/index.d.ts.map +1 -1
- package/dist/react/components/chat/ChatInteractivePrompt/shell.d.ts.map +1 -1
- package/dist/react/components/chat/ChatMessage.d.ts.map +1 -1
- package/dist/react/components/chat/ChatMessageScroll.d.ts.map +1 -1
- package/dist/react/components/chat/ChatReplySuggestions.d.ts.map +1 -1
- package/dist/react/components/chat/ComposerCommandMenu.d.ts.map +1 -1
- package/dist/react/components/chat/LlmSettingsStrip.d.ts.map +1 -1
- package/dist/react/components/chat/LlmSetupPrompt.d.ts.map +1 -1
- package/dist/react/components/chat/LlmUnavailableBanner.d.ts.map +1 -1
- package/dist/react/components/chat/SuggestedPromptsList.d.ts.map +1 -1
- package/dist/react/components/chat/SuggestedPromptsStrip.d.ts.map +1 -1
- package/dist/react/components/chat/SystemPromptField.d.ts.map +1 -1
- package/dist/react/components/highlighted-code.d.ts.map +1 -1
- package/dist/react/context.d.ts +4 -2
- package/dist/react/context.d.ts.map +1 -1
- package/dist/react/hooks/use-composer-commands.d.ts +4 -2
- package/dist/react/hooks/use-composer-commands.d.ts.map +1 -1
- package/dist/react/hooks/use-suggested-prompts.d.ts +2 -1
- package/dist/react/hooks/use-suggested-prompts.d.ts.map +1 -1
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/lib/parse-assistant-error.d.ts +2 -1
- package/dist/react/lib/parse-assistant-error.d.ts.map +1 -1
- package/dist/react/lib/prompt-icons.d.ts.map +1 -1
- package/dist/react/types.d.ts +7 -2
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/utils/cn.d.ts.map +1 -1
- package/dist/styles.css +1886 -1806
- package/dist/tools/datastore.d.ts +28 -0
- package/dist/tools/datastore.d.ts.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +249 -0
- package/package.json +55 -50
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install @4djs/assistant
|
|
|
10
10
|
bun add @4djs/assistant
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Peer dependencies: `react` and `react-dom` (^19).
|
|
13
|
+
Peer dependencies: `react` and `react-dom` (^18 or ^19). React is not bundled — your app supplies it.
|
|
14
14
|
|
|
15
15
|
Import styles once in your app entry (required for the UI):
|
|
16
16
|
|
|
@@ -64,12 +64,45 @@ When no LLM is configured, chat input is disabled and the UI prompts users to op
|
|
|
64
64
|
|
|
65
65
|
### Required store hooks
|
|
66
66
|
|
|
67
|
+
Provide **`toolRegistry`** (recommended) or both **`listTools`** and **`invokeTool`**:
|
|
68
|
+
|
|
67
69
|
| Option | Description |
|
|
68
70
|
| --- | --- |
|
|
69
71
|
| `welcomeMessage(ctx)` | Returns the initial assistant message. Called again when LLM status or model changes. |
|
|
72
|
+
| `toolRegistry` | `AssistantToolRegistry` from `createAssistantToolRegistry()` — register, deactivate, and invoke tools in one place. |
|
|
70
73
|
| `listTools()` | Returns OpenAI-style tool definitions (`name`, `description`, `inputSchema`). |
|
|
71
74
|
| `invokeTool(name, args)` | Executes a tool and returns `{ content, isError?, structuredContent? }`. |
|
|
72
75
|
|
|
76
|
+
### Tool registry (`@4djs/assistant/core` and `@4djs/assistant/tools`)
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import {
|
|
80
|
+
connectExternalTools,
|
|
81
|
+
createAssistantToolRegistry,
|
|
82
|
+
} from "@4djs/assistant/tools";
|
|
83
|
+
import { registerDatastoreTools } from "@4djs/assistant/tools";
|
|
84
|
+
|
|
85
|
+
const registry = createAssistantToolRegistry();
|
|
86
|
+
registerDatastoreTools(registry, myDatastoreAdapter);
|
|
87
|
+
|
|
88
|
+
// Extend at runtime
|
|
89
|
+
registry.register({
|
|
90
|
+
definition: { name: "my_tool", description: "…", inputSchema: { type: "object", properties: {} } },
|
|
91
|
+
invoke: async (args) => ({ content: [{ type: "text", text: "ok" }] }),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
registry.deactivate("my_tool"); // hide from LLM without unregistering
|
|
95
|
+
registry.activate("my_tool");
|
|
96
|
+
|
|
97
|
+
// Bridge @4d/tools or any external registry
|
|
98
|
+
connectExternalTools(registry, externalRegistry);
|
|
99
|
+
|
|
100
|
+
const config: AssistantConfig = {
|
|
101
|
+
toolRegistry: registry,
|
|
102
|
+
// …
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
73
106
|
### Optional store hooks
|
|
74
107
|
|
|
75
108
|
| Option | Description |
|
|
@@ -79,6 +112,7 @@ When no LLM is configured, chat input is disabled and the UI prompts users to op
|
|
|
79
112
|
| `onToolInvoked` | Side-effect hook after each tool completes (e.g. refresh app state). |
|
|
80
113
|
| `fetchSuggestedPrompts` | Async hook to generate contextual starter prompts via LLM. |
|
|
81
114
|
| `autoLoadLlmStatus` | Fetch LLM config on mount (default: `true`). |
|
|
115
|
+
| `labels` | Partial UI copy overrides for translation or branding (see below). |
|
|
82
116
|
|
|
83
117
|
### UI options
|
|
84
118
|
|
|
@@ -110,6 +144,106 @@ When no LLM is configured, chat input is disabled and the UI prompts users to op
|
|
|
110
144
|
|
|
111
145
|
Per-instance overrides are supported via `Assistant` / `AssistantRoot` props: `header`, `emptyState`, `ui`.
|
|
112
146
|
|
|
147
|
+
### Labels and i18n
|
|
148
|
+
|
|
149
|
+
All built-in UI strings (buttons, placeholders, error titles, trace labels, aria text, etc.) live in a flat dictionary keyed by dot notation, e.g. `composer.placeholder`, `commands.clear.description`, `errors.network.title`.
|
|
150
|
+
|
|
151
|
+
Pass partial overrides on `AssistantConfig.labels`. Only the keys you set are replaced; everything else keeps the English default:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import {
|
|
155
|
+
AssistantRoot,
|
|
156
|
+
DEFAULT_ASSISTANT_LABELS,
|
|
157
|
+
type AssistantConfig,
|
|
158
|
+
} from "@4djs/assistant";
|
|
159
|
+
|
|
160
|
+
const config: AssistantConfig = {
|
|
161
|
+
// …store hooks
|
|
162
|
+
labels: {
|
|
163
|
+
"header.title": "Assistant",
|
|
164
|
+
"composer.placeholder": "Posez une question…",
|
|
165
|
+
"composer.placeholderDisabled":
|
|
166
|
+
"LLM non configuré — le chat est désactivé",
|
|
167
|
+
"common.save": "Enregistrer",
|
|
168
|
+
"common.cancel": "Annuler",
|
|
169
|
+
"llmSettings.title": "Paramètres LLM",
|
|
170
|
+
"errors.network.title": "Connexion perdue",
|
|
171
|
+
"commands.clear.description": "Effacer la conversation",
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
For a full locale file, spread it in:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
import { frLabels } from "./locales/fr";
|
|
180
|
+
|
|
181
|
+
labels: { ...frLabels, "header.title": "Mon assistant" },
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Some keys support placeholders — use `{name}` or `{model}` in the string; the package substitutes them at runtime:
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
labels: {
|
|
188
|
+
"activity.steps.running": "Exécution de {name}…",
|
|
189
|
+
"llmSettings.connected": "Connecté · {model}",
|
|
190
|
+
"commands.unknown": "Commande inconnue : /{name}",
|
|
191
|
+
},
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Use `formatLabel` from `@4djs/assistant` (or `@4djs/assistant/core`) if you need the same substitution in host code.
|
|
195
|
+
|
|
196
|
+
#### Key groups
|
|
197
|
+
|
|
198
|
+
| Prefix | Examples |
|
|
199
|
+
| --- | --- |
|
|
200
|
+
| `common.*` | `save`, `cancel`, `loading`, `tryAgain` |
|
|
201
|
+
| `composer.*` | `placeholder`, `send`, `stop`, `hint` |
|
|
202
|
+
| `llmSettings.*` | Form labels, placeholders, `connected` |
|
|
203
|
+
| `llmSetup.*` | “Connect an LLM” banner copy |
|
|
204
|
+
| `suggestions.*` / `emptyState.*` | Prompt strips and welcome CTA |
|
|
205
|
+
| `activity.*` | Trace panel and tool step labels |
|
|
206
|
+
| `interactive.*` | Confirmation / choice prompts |
|
|
207
|
+
| `errors.*` | Parsed error titles and hints |
|
|
208
|
+
| `commands.*` | `/clear` description and errors |
|
|
209
|
+
|
|
210
|
+
The full list of keys is `ASSISTANT_LABEL_KEYS`, or inspect `DEFAULT_ASSISTANT_LABELS`.
|
|
211
|
+
|
|
212
|
+
#### Legacy shortcuts
|
|
213
|
+
|
|
214
|
+
These older options still work and are merged into labels automatically:
|
|
215
|
+
|
|
216
|
+
- `header.title` → `labels["header.title"]`
|
|
217
|
+
- `ui.composerPlaceholder` → `labels["composer.placeholder"]`
|
|
218
|
+
|
|
219
|
+
Prefer `labels` for new work so all copy stays in one place.
|
|
220
|
+
|
|
221
|
+
#### Custom components
|
|
222
|
+
|
|
223
|
+
Inside `AssistantProvider`, read the resolved dictionary with `useAssistantLabels()`:
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import { useAssistantLabels } from "@4djs/assistant";
|
|
227
|
+
|
|
228
|
+
function MyPanel() {
|
|
229
|
+
const labels = useAssistantLabels();
|
|
230
|
+
return <p>{labels["common.loading"]}</p>;
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Outside the provider, components fall back to `DEFAULT_ASSISTANT_LABELS`.
|
|
235
|
+
|
|
236
|
+
Headless helpers (also exported from `@4djs/assistant/core`):
|
|
237
|
+
|
|
238
|
+
| Export | Use |
|
|
239
|
+
| --- | --- |
|
|
240
|
+
| `DEFAULT_ASSISTANT_LABELS` | English defaults |
|
|
241
|
+
| `ASSISTANT_LABEL_KEYS` | All valid keys |
|
|
242
|
+
| `resolveAssistantLabels(overrides?)` | Merge overrides onto defaults |
|
|
243
|
+
| `formatLabel(template, values)` | Replace `{placeholders}` |
|
|
244
|
+
|
|
245
|
+
**Not covered by `labels`:** `welcomeMessage` content, `emptyState.title` / `description`, and static or dynamic `suggestedPrompts` (`label`, `hint`, `prompt`) — those remain app-defined on `AssistantConfig`.
|
|
246
|
+
|
|
113
247
|
## LLM provider
|
|
114
248
|
|
|
115
249
|
The assistant calls an **OpenAI-compatible** chat completions API directly from the browser (or your host runtime). No proxy `/api/chat` routes are required.
|
|
@@ -284,8 +418,8 @@ Useful for server routes, tests, or a fully custom UI.
|
|
|
284
418
|
|
|
285
419
|
| Import | Contents |
|
|
286
420
|
| --- | --- |
|
|
287
|
-
| `@4djs/assistant` | React components, hooks, types |
|
|
288
|
-
| `@4djs/assistant/core` | Store, LLM client, commands, interactive tools |
|
|
421
|
+
| `@4djs/assistant` | React components, hooks, types, labels |
|
|
422
|
+
| `@4djs/assistant/core` | Store, LLM client, commands, interactive tools, labels |
|
|
289
423
|
| `@4djs/assistant/styles.css` | Component styles |
|
|
290
424
|
|
|
291
425
|
The published package ships compiled JavaScript and TypeScript declarations from `dist/`. Source is not included in the tarball.
|
|
@@ -298,6 +432,7 @@ The published package ships compiled JavaScript and TypeScript declarations from
|
|
|
298
432
|
- Model selector with searchable dropdown
|
|
299
433
|
- In-app LLM settings (cloud or local OpenAI-compatible endpoints)
|
|
300
434
|
- Persistent chat history and model preference (`localStorage`)
|
|
435
|
+
- Configurable UI labels for translation and branding
|
|
301
436
|
- Welcome screen with static or LLM-generated starter prompts
|
|
302
437
|
- Composer footer toolbar: model selector, generate suggestions, clear chat
|
|
303
438
|
- Structured error states with retry actions
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AssistantLabels } from "../labels.js";
|
|
1
2
|
export type ChatActivityStatus = "active" | "done" | "error";
|
|
2
3
|
export interface ChatActivityStep {
|
|
3
4
|
id: string;
|
|
@@ -10,7 +11,7 @@ export interface ChatActivityStep {
|
|
|
10
11
|
error?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare function summarizeActivityResult(result: unknown): unknown;
|
|
13
|
-
export declare function chatActivityStepLabel(step: ChatActivityStep): string;
|
|
14
|
+
export declare function chatActivityStepLabel(step: ChatActivityStep, labels?: AssistantLabels): string;
|
|
14
15
|
export declare function formatJsonIfLarge(raw: string): string;
|
|
15
16
|
export declare function formatActivityJson(raw?: string): string | null;
|
|
16
17
|
export declare function formatActivityJsonValue(value: unknown): string | null;
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"chat-activity.d.ts","sourceRoot":"","sources":["../../src/core/chat-activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,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;CAChB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAYhE;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,MAAM,GAAE,eAA0C,GACjD,MAAM,CAmBR;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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AssistantLabels } from "../labels.js";
|
|
1
2
|
export type ChatCommandSurface = "assistant";
|
|
2
3
|
export type ChatCommandRunResult = {
|
|
3
4
|
handled: boolean;
|
|
@@ -8,18 +9,19 @@ export type AssistantCommandDeps = {
|
|
|
8
9
|
clearMessages: () => void;
|
|
9
10
|
setError: (error: string | null) => void;
|
|
10
11
|
streaming: boolean;
|
|
12
|
+
labels?: AssistantLabels;
|
|
11
13
|
};
|
|
12
14
|
export type ChatCommandSuggestion = {
|
|
13
15
|
name: string;
|
|
14
16
|
description: string;
|
|
15
17
|
usage: string;
|
|
16
18
|
};
|
|
17
|
-
export declare function getChatCommandSuggestions(surface: ChatCommandSurface): ChatCommandSuggestion[];
|
|
19
|
+
export declare function getChatCommandSuggestions(surface: ChatCommandSurface, labels?: AssistantLabels): ChatCommandSuggestion[];
|
|
18
20
|
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 filterChatCommands(value: string, surface: ChatCommandSurface, labels?: AssistantLabels): ChatCommandSuggestion[];
|
|
22
|
+
export declare function shouldShowChatCommandMenu(value: string, surface: ChatCommandSurface, labels?: AssistantLabels): boolean;
|
|
21
23
|
export declare function completionForChatCommand(command: ChatCommandSuggestion): string;
|
|
22
|
-
export declare function listChatCommands(surface?: ChatCommandSurface): Array<{
|
|
24
|
+
export declare function listChatCommands(surface?: ChatCommandSurface, labels?: AssistantLabels): Array<{
|
|
23
25
|
name: string;
|
|
24
26
|
description: string;
|
|
25
27
|
}>;
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"chat-commands.d.ts","sourceRoot":"","sources":["../../src/core/chat-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,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C,CAO/B;AAED,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD"}
|
|
@@ -1 +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;
|
|
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;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,CAAC,GAAG,EAAE,uBAAuB,KAAK,gBAAgB,CAAC;CACpE;AAyDD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB;qBAI5C,gBAAgB,EAAE,GAAG,IAAI;wBAapB,gBAAgB,EAAE;;uBAYnB,uBAAuB,KAAG,gBAAgB,EAAE;EAYvE;AAED,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +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;
|
|
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;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IACE,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;CACb,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAcrC,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAoClE;AA4CD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAUvD"}
|
|
@@ -28,6 +28,7 @@ export interface AssistantState {
|
|
|
28
28
|
submitInteractiveToolResult: (callId: string, result: unknown) => void;
|
|
29
29
|
cancelInteractiveToolResult: (callId: string) => void;
|
|
30
30
|
}
|
|
31
|
+
export declare function resolveAssistantStoreDependencies(deps: AssistantStoreDependencies): Required<Pick<AssistantStoreDependencies, "listTools" | "invokeTool">> & AssistantStoreDependencies;
|
|
31
32
|
export declare function createAssistantStore(deps: AssistantStoreDependencies): import("zustand").UseBoundStore<import("zustand").StoreApi<AssistantState>>;
|
|
32
33
|
export type AssistantStore = ReturnType<typeof createAssistantStore>;
|
|
33
34
|
//# sourceMappingURL=create-assistant-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-assistant-store.d.ts","sourceRoot":"","sources":["../../src/core/create-assistant-store.ts"],"names":[],"mappings":"AAyBA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-assistant-store.d.ts","sourceRoot":"","sources":["../../src/core/create-assistant-store.ts"],"names":[],"mappings":"AAyBA,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAS3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAEV,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEp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8HD,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,0BAA0B,GAC/B,QAAQ,CACT,IAAI,CAAC,0BAA0B,EAAE,WAAW,GAAG,YAAY,CAAC,CAC7D,GACC,0BAA0B,CAiB3B;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,+EAubpE;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-suggested-prompts.d.ts","sourceRoot":"","sources":["../../src/core/fetch-suggested-prompts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;
|
|
1
|
+
{"version":3,"file":"fetch-suggested-prompts.d.ts","sourceRoot":"","sources":["../../src/core/fetch-suggested-prompts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,KAAK,CAAC;QACb,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;KACf,CAAC,CAAC;CACJ;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,OAAO,GACZ,wBAAwB,CAAC,SAAS,CAAC,CAwCrC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
export type { AssistantLabelKey, AssistantLabelOverrides, AssistantLabels, } from "../labels.js";
|
|
2
|
+
export { ASSISTANT_LABEL_KEYS, DEFAULT_ASSISTANT_LABELS, formatLabel, resolveAssistantLabels, } from "../labels.js";
|
|
1
3
|
export type { ChatActivityStep } from "./chat-activity.js";
|
|
2
4
|
export { chatActivityStepLabel, formatJsonIfLarge, summarizeActivityResult, } from "./chat-activity.js";
|
|
3
5
|
export type { AssistantCommandDeps, ChatCommandRunResult, ChatCommandSuggestion, ChatCommandSurface, } from "./chat-commands.js";
|
|
4
|
-
export { filterChatCommands, getChatCommandSuggestions, isChatCommandInput, listChatCommands, parseChatCommand, runAssistantChatCommand, shouldShowChatCommandMenu, } from "./chat-commands.js";
|
|
6
|
+
export { completionForChatCommand, filterChatCommands, getChatCommandSuggestions, isChatCommandInput, listChatCommands, parseChatCommand, runAssistantChatCommand, shouldShowChatCommandMenu, } from "./chat-commands.js";
|
|
5
7
|
export { createChatHistoryHelpers } from "./chat-history.js";
|
|
6
|
-
export {
|
|
8
|
+
export { highlightCode, normalizeCodeLineEndings } from "./code-highlight.js";
|
|
9
|
+
export { type AssistantState, type AssistantStore, createAssistantStore, resolveAssistantStoreDependencies, } from "./create-assistant-store.js";
|
|
7
10
|
export { parseSuggestedPromptsResponse, type SuggestedPromptsResponse, } from "./fetch-suggested-prompts.js";
|
|
8
11
|
export { CHOICES_TOOL, type ChoiceOption, type ChoicesToolArgs, CONFIRMATION_TOOL, type ConfirmationToolArgs, type ReplySuggestions, rejectAllInteractiveToolWaiters, resolveInteractiveToolResult, SUGGEST_REPLIES_TOOL, } from "./interactive-tools/index.js";
|
|
9
12
|
export type { AgentStepResult, LlmChatStatus, StreamHandlers, ToolHandlers, } from "./llm-chat.js";
|
|
13
|
+
export { buildSystemPromptWithTools } from "./system-prompt.js";
|
|
10
14
|
export { buildLlmHistory, ChatAbortedError, fetchLlmStatus, LlmNotConfiguredError, LlmUpstreamError, requestLlmCompletion, runLlmAgent, sanitizeLlmMessages, } from "./llm-chat.js";
|
|
11
15
|
export { buildCompletionsUrl, buildLlmRequestHeaders, buildModelsUrl, DEFAULT_LLM_BASE_URL, DEFAULT_LLM_MODEL, getFallbackModels, isLlmConfigured, isLlmUnavailableMessage, isLocalLlmBaseUrl, LLM_UNAVAILABLE_MESSAGE, } from "./llm-config.js";
|
|
12
16
|
export { clearProviderModelCache, fetchProviderModels, } from "./llm-models.js";
|
|
@@ -15,5 +19,9 @@ export type { LlmSettingsFormState, LlmSettingsFormValues, StoredLlmUserSettings
|
|
|
15
19
|
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
20
|
export type { ClientToolDefinition, LlmChatMessage, OpenAiToolCall, } from "./llm-types.js";
|
|
17
21
|
export { childrenToText } from "./markdown-utils.js";
|
|
22
|
+
export { prepareMarkdown } from "./prepare-markdown.js";
|
|
23
|
+
export { fromLlmToolName, toLlmToolName } from "./tool-names.js";
|
|
24
|
+
export type { AssistantToolHandler, AssistantToolRegistry, ExternalToolSource, } from "./tool-registry.js";
|
|
25
|
+
export { connectExternalTools, createAssistantToolRegistry, resolveAssistantToolHooks, toolResultErr, toolResultOk, } from "./tool-registry.js";
|
|
18
26
|
export type { AssistantLlmConfig, AssistantLlmSettings, AssistantMessage, AssistantStorageKeys, AssistantStoreDependencies, AssistantSuggestedPrompt, AssistantToolContent, AssistantToolDefinition, AssistantToolResult, AssistantWelcomeContext, JsonSchema, } from "./types.js";
|
|
19
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO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