@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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AssistantToolRegistry } from "../core/tool-registry.js";
|
|
2
|
+
export interface DatastoreQueryInput {
|
|
3
|
+
dataClass: string;
|
|
4
|
+
filter?: string;
|
|
5
|
+
filterParams?: Array<{
|
|
6
|
+
type: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}>;
|
|
9
|
+
sort?: string;
|
|
10
|
+
order?: "asc" | "desc";
|
|
11
|
+
limit?: number;
|
|
12
|
+
page?: number;
|
|
13
|
+
select?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface DatastoreToolsAdapter {
|
|
16
|
+
getCatalog(): Promise<unknown>;
|
|
17
|
+
getServerInfo(): Promise<unknown>;
|
|
18
|
+
queryEntities(input: DatastoreQueryInput): Promise<unknown>;
|
|
19
|
+
getEntity(dataClass: string, key: string): Promise<unknown>;
|
|
20
|
+
createEntity(dataClass: string, data: Record<string, unknown>): Promise<unknown>;
|
|
21
|
+
updateEntity(dataClass: string, key: string, data: Record<string, unknown>): Promise<unknown>;
|
|
22
|
+
deleteEntity(dataClass: string, key: string): Promise<unknown>;
|
|
23
|
+
/** Return an error message when writes are blocked; null when allowed */
|
|
24
|
+
assertWritable?(): string | null;
|
|
25
|
+
}
|
|
26
|
+
/** Register the standard 4D datastore REST tools on a registry. */
|
|
27
|
+
export declare function registerDatastoreTools(registry: AssistantToolRegistry, adapter: DatastoreToolsAdapter): AssistantToolRegistry;
|
|
28
|
+
//# sourceMappingURL=datastore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastore.d.ts","sourceRoot":"","sources":["../../src/tools/datastore.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,aAAa,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjF,YAAY,CACV,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,yEAAyE;IACzE,cAAc,CAAC,IAAI,MAAM,GAAG,IAAI,CAAC;CAClC;AA6LD,mEAAmE;AACnE,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAKvB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { DatastoreQueryInput, DatastoreToolsAdapter, } from "./datastore.js";
|
|
2
|
+
export { registerDatastoreTools } from "./datastore.js";
|
|
3
|
+
export { connectExternalTools, createAssistantToolRegistry, resolveAssistantToolHooks, type AssistantToolHandler, type AssistantToolRegistry, } from "../core/tool-registry.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// src/core/tool-registry.ts
|
|
2
|
+
function toolResultOk(data) {
|
|
3
|
+
return {
|
|
4
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
5
|
+
structuredContent: data
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function toolResultErr(message) {
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: "text", text: message }],
|
|
11
|
+
isError: true
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class AssistantToolRegistryImpl {
|
|
16
|
+
entries = new Map;
|
|
17
|
+
register(handler) {
|
|
18
|
+
const name = handler.definition.name;
|
|
19
|
+
if (!name.trim()) {
|
|
20
|
+
throw new Error("Tool definition.name is required");
|
|
21
|
+
}
|
|
22
|
+
this.entries.set(name, { handler, active: true });
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
deactivate(name) {
|
|
26
|
+
const entry = this.entries.get(name);
|
|
27
|
+
if (!entry)
|
|
28
|
+
return false;
|
|
29
|
+
entry.active = false;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
activate(name) {
|
|
33
|
+
const entry = this.entries.get(name);
|
|
34
|
+
if (!entry)
|
|
35
|
+
return false;
|
|
36
|
+
entry.active = true;
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
isActive(name) {
|
|
40
|
+
const entry = this.entries.get(name);
|
|
41
|
+
return entry?.active ?? false;
|
|
42
|
+
}
|
|
43
|
+
has(name) {
|
|
44
|
+
return this.entries.has(name);
|
|
45
|
+
}
|
|
46
|
+
async listTools() {
|
|
47
|
+
return [...this.entries.values()].filter((entry) => entry.active).map((entry) => entry.handler.definition);
|
|
48
|
+
}
|
|
49
|
+
async invokeTool(name, args) {
|
|
50
|
+
const entry = this.entries.get(name);
|
|
51
|
+
if (!entry?.active) {
|
|
52
|
+
return toolResultErr(`Unknown tool: ${name}`);
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
return await entry.handler.invoke(args);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return toolResultErr(error instanceof Error ? error.message : String(error));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function createAssistantToolRegistry() {
|
|
62
|
+
return new AssistantToolRegistryImpl;
|
|
63
|
+
}
|
|
64
|
+
function resolveAssistantToolHooks(registry) {
|
|
65
|
+
return {
|
|
66
|
+
listTools: () => registry.listTools(),
|
|
67
|
+
invokeTool: (name, args) => registry.invokeTool(name, args)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function connectExternalTools(registry, external) {
|
|
71
|
+
const names = external.listTools().map((definition) => {
|
|
72
|
+
registry.register({
|
|
73
|
+
definition,
|
|
74
|
+
invoke: (args) => external.invokeTool(definition.name, args)
|
|
75
|
+
});
|
|
76
|
+
return definition.name;
|
|
77
|
+
});
|
|
78
|
+
return () => {
|
|
79
|
+
for (const name of names) {
|
|
80
|
+
registry.deactivate(name);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/tools/datastore.ts
|
|
86
|
+
function parseQueryArgs(args) {
|
|
87
|
+
const filterParams = Array.isArray(args.filterParams) ? args.filterParams.map((value) => ({
|
|
88
|
+
type: typeof value === "number" ? "number" : typeof value === "boolean" ? "boolean" : "string",
|
|
89
|
+
value: String(value)
|
|
90
|
+
})) : undefined;
|
|
91
|
+
return {
|
|
92
|
+
dataClass: String(args.dataClass ?? ""),
|
|
93
|
+
filter: typeof args.filter === "string" ? args.filter : undefined,
|
|
94
|
+
filterParams,
|
|
95
|
+
sort: typeof args.sort === "string" ? args.sort : undefined,
|
|
96
|
+
order: args.order === "asc" ? "asc" : "desc",
|
|
97
|
+
limit: typeof args.limit === "number" ? args.limit : undefined,
|
|
98
|
+
page: typeof args.page === "number" ? args.page : undefined,
|
|
99
|
+
select: Array.isArray(args.select) ? args.select.map(String) : undefined
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function buildDatastoreToolHandlers(adapter) {
|
|
103
|
+
return [
|
|
104
|
+
{
|
|
105
|
+
definition: {
|
|
106
|
+
name: "get_catalog",
|
|
107
|
+
description: "Return the 4D REST catalog: dataclasses, attributes, methods, and entity counts.",
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: {},
|
|
111
|
+
additionalProperties: false
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
invoke: async () => toolResultOk(await adapter.getCatalog())
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
definition: {
|
|
118
|
+
name: "get_server_info",
|
|
119
|
+
description: "Return server info: cache, entity sets, sessions, and privileges.",
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: "object",
|
|
122
|
+
properties: {},
|
|
123
|
+
additionalProperties: false
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
invoke: async () => toolResultOk(await adapter.getServerInfo())
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
definition: {
|
|
130
|
+
name: "query_entities",
|
|
131
|
+
description: "Query entities from a dataclass with optional filter, sort, and pagination.",
|
|
132
|
+
inputSchema: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
dataClass: { type: "string", description: "Dataclass name" },
|
|
136
|
+
filter: { type: "string", description: "4D filter expression" },
|
|
137
|
+
filterParams: {
|
|
138
|
+
type: "array",
|
|
139
|
+
items: {},
|
|
140
|
+
description: "Values for :1, :2, … placeholders in the filter"
|
|
141
|
+
},
|
|
142
|
+
sort: { type: "string", description: "Attribute to sort by" },
|
|
143
|
+
order: { type: "string", enum: ["asc", "desc"] },
|
|
144
|
+
limit: { type: "number", description: "Page size (default 20)" },
|
|
145
|
+
page: { type: "number", description: "Page number (default 1)" },
|
|
146
|
+
select: {
|
|
147
|
+
type: "array",
|
|
148
|
+
items: { type: "string" },
|
|
149
|
+
description: "Attributes to return"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
required: ["dataClass"]
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
invoke: async (args) => toolResultOk(await adapter.queryEntities(parseQueryArgs(args)))
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
definition: {
|
|
159
|
+
name: "get_entity",
|
|
160
|
+
description: "Get a single entity by primary key.",
|
|
161
|
+
inputSchema: {
|
|
162
|
+
type: "object",
|
|
163
|
+
properties: {
|
|
164
|
+
dataClass: { type: "string" },
|
|
165
|
+
key: { type: "string", description: "Entity primary key" }
|
|
166
|
+
},
|
|
167
|
+
required: ["dataClass", "key"]
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
invoke: async (args) => toolResultOk(await adapter.getEntity(String(args.dataClass ?? ""), String(args.key ?? "")))
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
definition: {
|
|
174
|
+
name: "create_entity",
|
|
175
|
+
description: "Create a new entity in a dataclass.",
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: "object",
|
|
178
|
+
properties: {
|
|
179
|
+
dataClass: { type: "string" },
|
|
180
|
+
data: {
|
|
181
|
+
type: "object",
|
|
182
|
+
description: "Attribute values for the new entity"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
required: ["dataClass", "data"]
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
invoke: async (args) => {
|
|
189
|
+
const writeError = adapter.assertWritable?.() ?? null;
|
|
190
|
+
if (writeError)
|
|
191
|
+
return toolResultErr(writeError);
|
|
192
|
+
return toolResultOk(await adapter.createEntity(String(args.dataClass ?? ""), args.data ?? {}));
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
definition: {
|
|
197
|
+
name: "update_entity",
|
|
198
|
+
description: "Update an existing entity.",
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: "object",
|
|
201
|
+
properties: {
|
|
202
|
+
dataClass: { type: "string" },
|
|
203
|
+
key: { type: "string" },
|
|
204
|
+
data: { type: "object", description: "Fields to update" }
|
|
205
|
+
},
|
|
206
|
+
required: ["dataClass", "key", "data"]
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
invoke: async (args) => {
|
|
210
|
+
const writeError = adapter.assertWritable?.() ?? null;
|
|
211
|
+
if (writeError)
|
|
212
|
+
return toolResultErr(writeError);
|
|
213
|
+
return toolResultOk(await adapter.updateEntity(String(args.dataClass ?? ""), String(args.key ?? ""), args.data ?? {}));
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
definition: {
|
|
218
|
+
name: "delete_entity",
|
|
219
|
+
description: "Delete an entity by primary key.",
|
|
220
|
+
inputSchema: {
|
|
221
|
+
type: "object",
|
|
222
|
+
properties: {
|
|
223
|
+
dataClass: { type: "string" },
|
|
224
|
+
key: { type: "string" }
|
|
225
|
+
},
|
|
226
|
+
required: ["dataClass", "key"]
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
invoke: async (args) => {
|
|
230
|
+
const writeError = adapter.assertWritable?.() ?? null;
|
|
231
|
+
if (writeError)
|
|
232
|
+
return toolResultErr(writeError);
|
|
233
|
+
return toolResultOk(await adapter.deleteEntity(String(args.dataClass ?? ""), String(args.key ?? "")));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
function registerDatastoreTools(registry, adapter) {
|
|
239
|
+
for (const handler of buildDatastoreToolHandlers(adapter)) {
|
|
240
|
+
registry.register(handler);
|
|
241
|
+
}
|
|
242
|
+
return registry;
|
|
243
|
+
}
|
|
244
|
+
export {
|
|
245
|
+
resolveAssistantToolHooks,
|
|
246
|
+
registerDatastoreTools,
|
|
247
|
+
createAssistantToolRegistry,
|
|
248
|
+
connectExternalTools
|
|
249
|
+
};
|
package/package.json
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
2
|
+
"name": "@4djs/assistant",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"types": "./dist/react/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/react/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./core": {
|
|
15
|
+
"types": "./dist/core/index.d.ts",
|
|
16
|
+
"import": "./dist/core/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./tools": {
|
|
19
|
+
"types": "./dist/tools/index.d.ts",
|
|
20
|
+
"import": "./dist/tools/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./styles.css": "./dist/styles.css"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"build": "bun run build:core && bun run build:tools && bun run build:react && bun run build:styles && bun run build:types",
|
|
27
|
+
"build:core": "bun build ./src/core/index.ts --outdir ./dist/core --target browser --format esm --external react --external react-dom",
|
|
28
|
+
"build:tools": "bun build ./src/tools/index.ts --outdir ./dist/tools --target browser --format esm --external @4djs/assistant/core",
|
|
29
|
+
"build:react": "bun build ./src/react/index.ts --outdir ./dist --target browser --format esm --external react --external react-dom --external react/jsx-runtime --external react/jsx-dev-runtime --external @4djs/assistant/core",
|
|
30
|
+
"build:styles": "mkdir -p dist && cp src/styles/assistant.css dist/styles.css",
|
|
31
|
+
"build:types": "tsc -p tsconfig.build.json && bun ./scripts/normalize-dts.ts",
|
|
32
|
+
"prepack": "bun run build"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"highlight.js": "11.11.1",
|
|
36
|
+
"katex": "0.17.0",
|
|
37
|
+
"lucide-react": "^0.511.0",
|
|
38
|
+
"mermaid": "11.15.0",
|
|
39
|
+
"react-markdown": "10.1.0",
|
|
40
|
+
"rehype-katex": "7.0.1",
|
|
41
|
+
"remark-gfm": "4.0.1",
|
|
42
|
+
"remark-math": "6.0.0",
|
|
43
|
+
"zustand": "^5.0.5"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
47
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@4d/typescript-config": "workspace:*",
|
|
51
|
+
"@types/react": "^19.1.2",
|
|
52
|
+
"@types/react-dom": "^19.1.2",
|
|
53
|
+
"react": "^19.1.0",
|
|
54
|
+
"react-dom": "^19.1.0",
|
|
55
|
+
"typescript": "catalog:"
|
|
56
|
+
}
|
|
52
57
|
}
|