@nexface/chat 0.1.15-alpha.11 → 0.1.15-alpha.13
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/dist/assistant-attachments.js +13 -13
- package/dist/assistant-components.js +1 -1
- package/dist/assistant-runtime.js +3 -3
- package/dist/attachments.js +8 -8
- package/dist/default-chat.js +171 -160
- package/dist/react.js +3 -3
- package/dist/storage.js +2 -2
- package/dist/ui/attachment.aui.js +4 -2
- package/dist/voice/use-voice.js +4 -4
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ const durablePreview = (preview) => preview?.startsWith("data:image/") ? preview
|
|
|
5
5
|
// Stop local waiting even when a service ignores cancellation; consume late rejections.
|
|
6
6
|
function abortable(signal, task) {
|
|
7
7
|
return new Promise((resolve, reject) => {
|
|
8
|
-
const abort = () => reject(new DOMException("
|
|
8
|
+
const abort = () => reject(new DOMException("Attachment processing was cancelled.", "AbortError"));
|
|
9
9
|
signal.addEventListener("abort", abort, { once: true });
|
|
10
10
|
void task.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
11
11
|
if (signal.aborted)
|
|
@@ -51,16 +51,16 @@ export class AssistantAttachments {
|
|
|
51
51
|
}
|
|
52
52
|
async *add({ file }) {
|
|
53
53
|
if (this.disposed || this.options === false)
|
|
54
|
-
throw new Error("
|
|
54
|
+
throw new Error("Attachments are disabled.");
|
|
55
55
|
const options = this.options;
|
|
56
56
|
const maxCount = options.maxCount ?? 3;
|
|
57
57
|
if (!Number.isInteger(maxCount) || maxCount <= 0) {
|
|
58
|
-
this.notice("
|
|
59
|
-
throw new Error("
|
|
58
|
+
this.notice("The attachment count limit must be a positive integer.");
|
|
59
|
+
throw new Error("The attachment count limit must be a positive integer.");
|
|
60
60
|
}
|
|
61
61
|
if (this.entries.size >= maxCount) {
|
|
62
|
-
this.notice("
|
|
63
|
-
throw new Error("
|
|
62
|
+
this.notice("The attachment count limit has been exceeded.");
|
|
63
|
+
throw new Error("The attachment count limit has been exceeded.");
|
|
64
64
|
}
|
|
65
65
|
const entry = {
|
|
66
66
|
id: crypto.randomUUID(),
|
|
@@ -109,10 +109,10 @@ export class AssistantAttachments {
|
|
|
109
109
|
async send(attachment) {
|
|
110
110
|
const entry = this.entries.get(attachment.id);
|
|
111
111
|
if (!entry)
|
|
112
|
-
throw new Error("
|
|
112
|
+
throw new Error("The attachment has been removed.");
|
|
113
113
|
this.assertLive(entry);
|
|
114
114
|
if (entry.adding || entry.error)
|
|
115
|
-
throw new Error(entry.error ?? "
|
|
115
|
+
throw new Error(entry.error ?? "The attachment is not ready yet.");
|
|
116
116
|
try {
|
|
117
117
|
let content;
|
|
118
118
|
if (entry.adapter) {
|
|
@@ -124,13 +124,13 @@ export class AssistantAttachments {
|
|
|
124
124
|
}));
|
|
125
125
|
this.assertLive(entry);
|
|
126
126
|
if (!Array.isArray(result.content) || !result.content.length)
|
|
127
|
-
throw new Error("
|
|
127
|
+
throw new Error("Attachment processing must return text or inline images.");
|
|
128
128
|
content = result.content.map((part) => {
|
|
129
129
|
if (part.type === "text")
|
|
130
130
|
return TextInputContentSchema.parse(part);
|
|
131
131
|
const image = ImageInputContentSchema.parse(part);
|
|
132
132
|
if (image.source.type !== "data")
|
|
133
|
-
throw new Error("
|
|
133
|
+
throw new Error("Attachments only support inline images. Image URLs are not supported.");
|
|
134
134
|
return image;
|
|
135
135
|
});
|
|
136
136
|
}
|
|
@@ -165,14 +165,14 @@ export class AssistantAttachments {
|
|
|
165
165
|
.then(() => entry.adapter?.remove?.({ id: entry.id, file: entry.file, data: entry.data }))
|
|
166
166
|
.catch((error) => {
|
|
167
167
|
if (!this.disposed)
|
|
168
|
-
this.notice(
|
|
168
|
+
this.notice(`Attachment cleanup failed: ${errorText(error)}`);
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
take(attachments) {
|
|
172
172
|
return attachments.map((attachment) => {
|
|
173
173
|
const entry = this.entries.get(attachment.id);
|
|
174
174
|
if (!entry?.result)
|
|
175
|
-
throw new Error("
|
|
175
|
+
throw new Error("The attachment is not ready yet.");
|
|
176
176
|
return entry.result;
|
|
177
177
|
});
|
|
178
178
|
}
|
|
@@ -191,6 +191,6 @@ export class AssistantAttachments {
|
|
|
191
191
|
}
|
|
192
192
|
assertLive(entry) {
|
|
193
193
|
if (!this.live(entry))
|
|
194
|
-
throw new DOMException("
|
|
194
|
+
throw new DOMException("Attachment processing was cancelled.", "AbortError");
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -20,7 +20,7 @@ export function AttachmentTile({ binding, savedPreview, }) {
|
|
|
20
20
|
const preview = binding?.attachments.preview(attachment.id) ??
|
|
21
21
|
savedPreview ??
|
|
22
22
|
attachment.content?.find((part) => part.type === "image")?.image;
|
|
23
|
-
return (_jsx(AttachmentUI, { preview: preview, children: _jsxs("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [_jsx(AttachmentPrimitive.Name, {}), binding && attachment.status.type === "requires-action" ? (_jsx("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" })) : null, attachment.status.type === "running" ? (_jsx("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" })) : null, attachment.status.type === "incomplete" ? (_jsx("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "
|
|
23
|
+
return (_jsx(AttachmentUI, { preview: preview, children: _jsxs("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [_jsx(AttachmentPrimitive.Name, {}), binding && attachment.status.type === "requires-action" ? (_jsx("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" })) : null, attachment.status.type === "running" ? (_jsx("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" })) : null, attachment.status.type === "incomplete" ? (_jsx("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "Attachment processing failed" })) : null] }) }));
|
|
24
24
|
}
|
|
25
25
|
export function AssistantComposer({ binding, options, placeholder, suggestion, busy, cancelling, cancel, }) {
|
|
26
26
|
const input = useRef(null);
|
|
@@ -108,7 +108,7 @@ export function SessionRuntime({ id, chat, options, dictation, open = true, bloc
|
|
|
108
108
|
isSendDisabled: !active || blocked || attachments.blocked || voice.state.status !== "idle",
|
|
109
109
|
onNew: async (message) => {
|
|
110
110
|
if (!alive.current || latest.current.activeSessionId !== id)
|
|
111
|
-
throw new MessageNotSentError("
|
|
111
|
+
throw new MessageNotSentError("The session has changed. Return to the original session and send again.");
|
|
112
112
|
const files = attachments.take(message.attachments ?? []);
|
|
113
113
|
const text = message.content
|
|
114
114
|
.flatMap((part) => (part.type === "text" ? [part.text] : []))
|
|
@@ -120,7 +120,7 @@ export function SessionRuntime({ id, chat, options, dictation, open = true, bloc
|
|
|
120
120
|
onEdit: onEdit
|
|
121
121
|
? async (message) => {
|
|
122
122
|
if (!message.sourceId)
|
|
123
|
-
throw new Error("
|
|
123
|
+
throw new Error("The message to edit was not found.");
|
|
124
124
|
const text = message.content
|
|
125
125
|
.flatMap((part) => (part.type === "text" ? [part.text] : []))
|
|
126
126
|
.join("");
|
|
@@ -184,7 +184,7 @@ export function SessionRuntime({ id, chat, options, dictation, open = true, bloc
|
|
|
184
184
|
if (!alive.current)
|
|
185
185
|
return;
|
|
186
186
|
if (latest.current.activeSessionId !== id)
|
|
187
|
-
throw new Error("
|
|
187
|
+
throw new Error("The session has changed. Return to the original session and send again.");
|
|
188
188
|
assertChatSendable(latest.current, id);
|
|
189
189
|
const completed = results.flatMap((result) => result.status === "fulfilled" ? [result.value] : []);
|
|
190
190
|
const files = attachments.take(completed);
|
package/dist/attachments.js
CHANGED
|
@@ -13,9 +13,9 @@ export const attachmentContent = (attachment) => Array.isArray(attachment.conten
|
|
|
13
13
|
export function validateAttachment(file, options) {
|
|
14
14
|
if (options.maxSizeBytes !== undefined &&
|
|
15
15
|
(!Number.isFinite(options.maxSizeBytes) || options.maxSizeBytes <= 0))
|
|
16
|
-
throw new Error("
|
|
16
|
+
throw new Error("The attachment size limit must be a positive number.");
|
|
17
17
|
if (file.size > (options.maxSizeBytes ?? 5 * 1024 * 1024))
|
|
18
|
-
throw new Error(
|
|
18
|
+
throw new Error(`File is too large: ${file.name}`);
|
|
19
19
|
const extension = file.name.split(".").at(-1)?.toLowerCase() ?? "";
|
|
20
20
|
const mime = file.type || types[extension] || "";
|
|
21
21
|
const accepted = (options.accept ?? attachmentAccept)
|
|
@@ -25,17 +25,17 @@ export function validateAttachment(file, options) {
|
|
|
25
25
|
part === `.${extension}` ||
|
|
26
26
|
part === mime ||
|
|
27
27
|
(part.endsWith("/*") && mime.startsWith(part.slice(0, -1)))))
|
|
28
|
-
throw new Error(
|
|
28
|
+
throw new Error(`File is not accepted: ${file.name}`);
|
|
29
29
|
}
|
|
30
30
|
export async function readAttachment(file, options) {
|
|
31
31
|
if (options.maxSizeBytes !== undefined &&
|
|
32
32
|
(!Number.isFinite(options.maxSizeBytes) || options.maxSizeBytes <= 0))
|
|
33
|
-
throw new Error("
|
|
33
|
+
throw new Error("The attachment size limit must be a positive number.");
|
|
34
34
|
const extension = file.name.split(".").at(-1)?.toLowerCase() ?? "";
|
|
35
35
|
const mime = types[extension];
|
|
36
36
|
if (!mime ||
|
|
37
37
|
(file.type && file.type !== mime && !(extension === "md" && file.type === "text/plain"))) {
|
|
38
|
-
throw new Error(
|
|
38
|
+
throw new Error(`Unsupported file type: ${file.name}`);
|
|
39
39
|
}
|
|
40
40
|
const accepted = (options.accept ?? attachmentAccept)
|
|
41
41
|
.split(",")
|
|
@@ -43,10 +43,10 @@ export async function readAttachment(file, options) {
|
|
|
43
43
|
if (!accepted.some((part) => part === `.${extension}` ||
|
|
44
44
|
part === mime ||
|
|
45
45
|
(part.endsWith("/*") && mime.startsWith(part.slice(0, -1))))) {
|
|
46
|
-
throw new Error(
|
|
46
|
+
throw new Error(`File is not accepted: ${file.name}`);
|
|
47
47
|
}
|
|
48
48
|
if (file.size > (options.maxSizeBytes ?? 5 * 1024 * 1024))
|
|
49
|
-
throw new Error(
|
|
49
|
+
throw new Error(`File is too large: ${file.name}`);
|
|
50
50
|
const id = globalThis.crypto.randomUUID();
|
|
51
51
|
if (!mime.startsWith("image/")) {
|
|
52
52
|
const value = await read(file, false);
|
|
@@ -67,7 +67,7 @@ function read(file, image) {
|
|
|
67
67
|
return new Promise((resolve, reject) => {
|
|
68
68
|
const reader = new FileReader();
|
|
69
69
|
reader.onload = () => resolve(String(reader.result));
|
|
70
|
-
reader.onerror = () => reject(new Error(
|
|
70
|
+
reader.onerror = () => reject(new Error(`Unable to read file: ${file.name}`));
|
|
71
71
|
if (image)
|
|
72
72
|
reader.readAsDataURL(file);
|
|
73
73
|
else
|
package/dist/default-chat.js
CHANGED
|
@@ -13,8 +13,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
var __export = (target, all2) => {
|
|
16
|
-
for (var
|
|
17
|
-
__defProp(target,
|
|
16
|
+
for (var name3 in all2)
|
|
17
|
+
__defProp(target, name3, { get: all2[name3], enumerable: true });
|
|
18
18
|
};
|
|
19
19
|
var __copyProps = (to, from, except, desc) => {
|
|
20
20
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -476,18 +476,18 @@ var require_extend = __commonJS({
|
|
|
476
476
|
target[options2.name] = options2.newValue;
|
|
477
477
|
}
|
|
478
478
|
};
|
|
479
|
-
var getProperty = function getProperty2(obj,
|
|
480
|
-
if (
|
|
481
|
-
if (!hasOwn.call(obj,
|
|
479
|
+
var getProperty = function getProperty2(obj, name3) {
|
|
480
|
+
if (name3 === "__proto__") {
|
|
481
|
+
if (!hasOwn.call(obj, name3)) {
|
|
482
482
|
return void 0;
|
|
483
483
|
} else if (gOPD) {
|
|
484
|
-
return gOPD(obj,
|
|
484
|
+
return gOPD(obj, name3).value;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
return obj[
|
|
487
|
+
return obj[name3];
|
|
488
488
|
};
|
|
489
489
|
module.exports = function extend2() {
|
|
490
|
-
var options2,
|
|
490
|
+
var options2, name3, src, copy, copyIsArray, clone;
|
|
491
491
|
var target = arguments[0];
|
|
492
492
|
var i = 1;
|
|
493
493
|
var length = arguments.length;
|
|
@@ -503,9 +503,9 @@ var require_extend = __commonJS({
|
|
|
503
503
|
for (; i < length; ++i) {
|
|
504
504
|
options2 = arguments[i];
|
|
505
505
|
if (options2 != null) {
|
|
506
|
-
for (
|
|
507
|
-
src = getProperty(target,
|
|
508
|
-
copy = getProperty(options2,
|
|
506
|
+
for (name3 in options2) {
|
|
507
|
+
src = getProperty(target, name3);
|
|
508
|
+
copy = getProperty(options2, name3);
|
|
509
509
|
if (target !== copy) {
|
|
510
510
|
if (deep && copy && (isPlainObject3(copy) || (copyIsArray = isArray(copy)))) {
|
|
511
511
|
if (copyIsArray) {
|
|
@@ -514,9 +514,9 @@ var require_extend = __commonJS({
|
|
|
514
514
|
} else {
|
|
515
515
|
clone = src && isPlainObject3(src) ? src : {};
|
|
516
516
|
}
|
|
517
|
-
setProperty(target, { name:
|
|
517
|
+
setProperty(target, { name: name3, newValue: extend2(deep, clone, copy) });
|
|
518
518
|
} else if (typeof copy !== "undefined") {
|
|
519
|
-
setProperty(target, { name:
|
|
519
|
+
setProperty(target, { name: name3, newValue: copy });
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
}
|
|
@@ -1981,10 +1981,10 @@ var useDataRenderers = () => {
|
|
|
1981
1981
|
const [state, setState] = useState3(_temp);
|
|
1982
1982
|
let t0;
|
|
1983
1983
|
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1984
|
-
t0 = (
|
|
1984
|
+
t0 = (name3, render) => {
|
|
1985
1985
|
setState((prev) => {
|
|
1986
1986
|
const renderers = nullProtoRecord(prev.renderers);
|
|
1987
|
-
renderers[
|
|
1987
|
+
renderers[name3] = [...renderers[name3] ?? [], render];
|
|
1988
1988
|
return {
|
|
1989
1989
|
...prev,
|
|
1990
1990
|
renderers
|
|
@@ -1993,9 +1993,9 @@ var useDataRenderers = () => {
|
|
|
1993
1993
|
return () => {
|
|
1994
1994
|
setState((prev_0) => {
|
|
1995
1995
|
const renderers_0 = nullProtoRecord(prev_0.renderers);
|
|
1996
|
-
const remaining = renderers_0[
|
|
1997
|
-
if (remaining.length > 0) renderers_0[
|
|
1998
|
-
else delete renderers_0[
|
|
1996
|
+
const remaining = renderers_0[name3]?.filter((r2) => r2 !== render) ?? [];
|
|
1997
|
+
if (remaining.length > 0) renderers_0[name3] = remaining;
|
|
1998
|
+
else delete renderers_0[name3];
|
|
1999
1999
|
return {
|
|
2000
2000
|
...prev_0,
|
|
2001
2001
|
renderers: renderers_0
|
|
@@ -2060,27 +2060,27 @@ var mergeModelContexts = (configSet) => {
|
|
|
2060
2060
|
${config.system}`;
|
|
2061
2061
|
else acc.system = config.system;
|
|
2062
2062
|
}
|
|
2063
|
-
if (config.tools) for (const [
|
|
2064
|
-
const existing = acc.tools !== void 0 && Object.hasOwn(acc.tools,
|
|
2063
|
+
if (config.tools) for (const [name3, tool2] of Object.entries(config.tools)) {
|
|
2064
|
+
const existing = acc.tools !== void 0 && Object.hasOwn(acc.tools, name3) ? acc.tools[name3] : void 0;
|
|
2065
2065
|
if (existing && existing !== tool2) {
|
|
2066
|
-
const existingPriority = toolPriorities[
|
|
2066
|
+
const existingPriority = toolPriorities[name3];
|
|
2067
2067
|
if (existingPriority === priority) {
|
|
2068
|
-
if (!tool2.overwrite) throw new Error(`You tried to define a tool with the name ${
|
|
2069
|
-
acc.tools[
|
|
2068
|
+
if (!tool2.overwrite) throw new Error(`You tried to define a tool with the name ${name3}, but it already exists.`);
|
|
2069
|
+
acc.tools[name3] = stripOverwrite(tool2);
|
|
2070
2070
|
continue;
|
|
2071
2071
|
}
|
|
2072
2072
|
const higherPriorityTool = existingPriority > priority ? existing : tool2;
|
|
2073
2073
|
const lowerPriorityTool = existingPriority > priority ? tool2 : existing;
|
|
2074
|
-
acc.tools[
|
|
2074
|
+
acc.tools[name3] = stripOverwrite({
|
|
2075
2075
|
...lowerPriorityTool,
|
|
2076
2076
|
...higherPriorityTool
|
|
2077
2077
|
});
|
|
2078
|
-
toolPriorities[
|
|
2078
|
+
toolPriorities[name3] = Math.max(existingPriority, priority);
|
|
2079
2079
|
continue;
|
|
2080
2080
|
}
|
|
2081
2081
|
if (!acc.tools) acc.tools = nullProtoRecord();
|
|
2082
|
-
acc.tools[
|
|
2083
|
-
if (!Object.hasOwn(toolPriorities,
|
|
2082
|
+
acc.tools[name3] = stripOverwrite(tool2);
|
|
2083
|
+
if (!Object.hasOwn(toolPriorities, name3)) toolPriorities[name3] = priority;
|
|
2084
2084
|
}
|
|
2085
2085
|
if (config.config) acc.config = {
|
|
2086
2086
|
...acc.config,
|
|
@@ -2126,10 +2126,10 @@ var INTROSPECTION_PROPS = /* @__PURE__ */ new Set([
|
|
|
2126
2126
|
"__v_isShallow",
|
|
2127
2127
|
"__v_skip"
|
|
2128
2128
|
]);
|
|
2129
|
-
var handleIntrospectionProp = (prop,
|
|
2130
|
-
if (prop === Symbol.toStringTag) return
|
|
2129
|
+
var handleIntrospectionProp = (prop, name3) => {
|
|
2130
|
+
if (prop === Symbol.toStringTag) return name3;
|
|
2131
2131
|
if (typeof prop === "symbol") return void 0;
|
|
2132
|
-
if (prop === "toJSON") return () =>
|
|
2132
|
+
if (prop === "toJSON") return () => name3;
|
|
2133
2133
|
if (INTROSPECTION_PROPS.has(prop)) return void 0;
|
|
2134
2134
|
return false;
|
|
2135
2135
|
};
|
|
@@ -2192,7 +2192,7 @@ var createClientAccessor = (meta, read) => {
|
|
|
2192
2192
|
});
|
|
2193
2193
|
return proxy;
|
|
2194
2194
|
};
|
|
2195
|
-
var createErrorClientAccessor = (message,
|
|
2195
|
+
var createErrorClientAccessor = (message, name3) => {
|
|
2196
2196
|
const fail = () => {
|
|
2197
2197
|
throw new Error(message);
|
|
2198
2198
|
};
|
|
@@ -2201,7 +2201,7 @@ var createErrorClientAccessor = (message, name2) => {
|
|
|
2201
2201
|
apply: fail,
|
|
2202
2202
|
get: (_, prop) => {
|
|
2203
2203
|
if (prop === "source" || prop === "query") return null;
|
|
2204
|
-
if (prop === "name") return
|
|
2204
|
+
if (prop === "name") return name3;
|
|
2205
2205
|
if (prop === CLIENT_ID_SYMBOL) return fail();
|
|
2206
2206
|
const introspection = handleIntrospectionProp(prop, "AssistantClientAccessor");
|
|
2207
2207
|
if (introspection !== false) return introspection;
|
|
@@ -2791,21 +2791,21 @@ var useScopeValue = (element2, derived) => {
|
|
|
2791
2791
|
} else t0 = $[2];
|
|
2792
2792
|
return useResource(t0);
|
|
2793
2793
|
};
|
|
2794
|
-
var useScopeMount = (
|
|
2794
|
+
var useScopeMount = (name3, element2) => {
|
|
2795
2795
|
const building = useAssistantContextValue();
|
|
2796
2796
|
const derived = isDerivedElement(element2);
|
|
2797
2797
|
const value = useScopeValue(element2, derived);
|
|
2798
2798
|
const methods = derived ? value : value.methods;
|
|
2799
2799
|
const meta = useScopeMeta(element2);
|
|
2800
2800
|
const accessor = useMemo3(() => createClientAccessor({
|
|
2801
|
-
name:
|
|
2801
|
+
name: name3,
|
|
2802
2802
|
...meta
|
|
2803
2803
|
}, () => methods), [
|
|
2804
|
-
|
|
2804
|
+
name3,
|
|
2805
2805
|
meta,
|
|
2806
2806
|
methods
|
|
2807
2807
|
]);
|
|
2808
|
-
building[
|
|
2808
|
+
building[name3] = accessor;
|
|
2809
2809
|
return accessor;
|
|
2810
2810
|
};
|
|
2811
2811
|
var ScopeMount = resource(useScopeMount);
|
|
@@ -2933,24 +2933,24 @@ var useTapRootAssistantClient = ({ parent, entries, destroySignal }) => {
|
|
|
2933
2933
|
} : effects
|
|
2934
2934
|
};
|
|
2935
2935
|
};
|
|
2936
|
-
var useDerivedScopeMount = (parent, building,
|
|
2936
|
+
var useDerivedScopeMount = (parent, building, name3, element2) => {
|
|
2937
2937
|
const { get } = element2.args[0];
|
|
2938
2938
|
const value = useSyncExternalStore3(parent.subscribe, () => get(parent), () => get(parent));
|
|
2939
2939
|
const meta = useScopeMeta(element2);
|
|
2940
2940
|
const accessor = useMemo3(() => createClientAccessor({
|
|
2941
|
-
name:
|
|
2941
|
+
name: name3,
|
|
2942
2942
|
...meta
|
|
2943
2943
|
}, () => value), [
|
|
2944
|
-
|
|
2944
|
+
name3,
|
|
2945
2945
|
meta,
|
|
2946
2946
|
value
|
|
2947
2947
|
]);
|
|
2948
|
-
building[
|
|
2948
|
+
building[name3] = accessor;
|
|
2949
2949
|
return accessor;
|
|
2950
2950
|
};
|
|
2951
2951
|
var useDerivedOnlyClient = (parent, entries) => {
|
|
2952
2952
|
if (isDevelopment2) {
|
|
2953
|
-
const [mountKeys] = useState3(() => entries.map(([
|
|
2953
|
+
const [mountKeys] = useState3(() => entries.map(([name3]) => name3).join(","));
|
|
2954
2954
|
const root4 = entries.find(([, element2]) => !isDerivedElement(element2));
|
|
2955
2955
|
if (root4) throw new Error(`Scope "${root4[0]}" is a root scope but this useAui mounted derived-only; remount with a new key to change scope kinds.`);
|
|
2956
2956
|
const keys2 = entries.map(([name_0]) => name_0).join(",");
|
|
@@ -2978,7 +2978,7 @@ var useDerivedOnlyClient = (parent, entries) => {
|
|
|
2978
2978
|
subscribe: parent.subscribe,
|
|
2979
2979
|
on
|
|
2980
2980
|
});
|
|
2981
|
-
const accessors = entries.map(([
|
|
2981
|
+
const accessors = entries.map(([name3, element2]) => useDerivedScopeMount(parent, building, name3, element2));
|
|
2982
2982
|
const client = useCommittedClient(building, [parent, ...accessors]);
|
|
2983
2983
|
useInsertionEffect2(() => {
|
|
2984
2984
|
clientRef.parent = parent;
|
|
@@ -3040,8 +3040,8 @@ function useAui(clients) {
|
|
|
3040
3040
|
return parent;
|
|
3041
3041
|
}
|
|
3042
3042
|
function _temp3(t0) {
|
|
3043
|
-
const [
|
|
3044
|
-
return withKey(
|
|
3043
|
+
const [name3, element2] = t0;
|
|
3044
|
+
return withKey(name3, ScopeMount(name3, element2));
|
|
3045
3045
|
}
|
|
3046
3046
|
function _temp22(t0) {
|
|
3047
3047
|
const [, element2] = t0;
|
|
@@ -3719,10 +3719,10 @@ function _temp24(fn) {
|
|
|
3719
3719
|
return fn();
|
|
3720
3720
|
}
|
|
3721
3721
|
function _temp33(acc, t0) {
|
|
3722
|
-
const [
|
|
3722
|
+
const [name3, tool_0] = t0;
|
|
3723
3723
|
if (tool_0.type === "mcp") return acc;
|
|
3724
3724
|
const { display: _display, render: _render, renderText: _renderText, ...rest } = tool_0;
|
|
3725
|
-
acc[
|
|
3725
|
+
acc[name3] = rest;
|
|
3726
3726
|
return acc;
|
|
3727
3727
|
}
|
|
3728
3728
|
|
|
@@ -6957,14 +6957,14 @@ var ToolCallReaderImpl = class {
|
|
|
6957
6957
|
// ../../node_modules/.pnpm/assistant-stream@0.3.44/node_modules/assistant-stream/dist/core/tool/ToolExecutionStream.js
|
|
6958
6958
|
var import_secure_json_parse2 = __toESM(require_secure_json_parse(), 1);
|
|
6959
6959
|
var TOOL_EXECUTION_ID = /* @__PURE__ */ Symbol.for("assistant-stream.tool-execution-id");
|
|
6960
|
-
var invokeExecutionCallback = (
|
|
6960
|
+
var invokeExecutionCallback = (name3, callback, toolCallId, toolName, executionId) => {
|
|
6961
6961
|
try {
|
|
6962
6962
|
const result = callback?.(toolCallId, toolName, executionId);
|
|
6963
6963
|
Promise.resolve(result).catch((error) => {
|
|
6964
|
-
console.error(`[assistant-stream] ${
|
|
6964
|
+
console.error(`[assistant-stream] ${name3} callback threw an error`, error);
|
|
6965
6965
|
});
|
|
6966
6966
|
} catch (error) {
|
|
6967
|
-
console.error(`[assistant-stream] ${
|
|
6967
|
+
console.error(`[assistant-stream] ${name3} callback threw an error`, error);
|
|
6968
6968
|
}
|
|
6969
6969
|
};
|
|
6970
6970
|
var pathKey = (path2) => path2.join(",");
|
|
@@ -7226,8 +7226,8 @@ function unstable_getInteractableSnapshots(message) {
|
|
|
7226
7226
|
const items = custom.interactables;
|
|
7227
7227
|
return Array.isArray(items) ? items : void 0;
|
|
7228
7228
|
}
|
|
7229
|
-
function interactableToolName(
|
|
7230
|
-
return `update_${
|
|
7229
|
+
function interactableToolName(name3) {
|
|
7230
|
+
return `update_${name3.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
7231
7231
|
}
|
|
7232
7232
|
var getArrayItemId = (item) => {
|
|
7233
7233
|
if (!isRecord(item)) return void 0;
|
|
@@ -7322,20 +7322,20 @@ var createAddedItemIdFactory = (result) => {
|
|
|
7322
7322
|
return (field) => idsByField.get(field)?.shift();
|
|
7323
7323
|
};
|
|
7324
7324
|
var versionsCache = /* @__PURE__ */ new WeakMap();
|
|
7325
|
-
function unstable_getInteractableVersions(messages, id,
|
|
7325
|
+
function unstable_getInteractableVersions(messages, id, name3) {
|
|
7326
7326
|
let byName = versionsCache.get(messages);
|
|
7327
7327
|
if (!byName) {
|
|
7328
7328
|
byName = /* @__PURE__ */ new Map();
|
|
7329
7329
|
versionsCache.set(messages, byName);
|
|
7330
7330
|
}
|
|
7331
|
-
let byId = byName.get(
|
|
7331
|
+
let byId = byName.get(name3);
|
|
7332
7332
|
if (!byId) {
|
|
7333
7333
|
byId = /* @__PURE__ */ new Map();
|
|
7334
|
-
byName.set(
|
|
7334
|
+
byName.set(name3, byId);
|
|
7335
7335
|
}
|
|
7336
7336
|
const cached = byId.get(id);
|
|
7337
7337
|
if (cached) return cached;
|
|
7338
|
-
const toolName = interactableToolName(
|
|
7338
|
+
const toolName = interactableToolName(name3);
|
|
7339
7339
|
const versions = [];
|
|
7340
7340
|
const current = () => versions[versions.length - 1];
|
|
7341
7341
|
for (const msg of messages) {
|
|
@@ -7358,7 +7358,7 @@ function unstable_getInteractableVersions(messages, id, name2) {
|
|
|
7358
7358
|
for (const part of msg.content ?? []) {
|
|
7359
7359
|
const p = asToolCallPart(part);
|
|
7360
7360
|
if (!p) continue;
|
|
7361
|
-
if (p.toolCallId === id && p.toolName ===
|
|
7361
|
+
if (p.toolCallId === id && p.toolName === name3) {
|
|
7362
7362
|
if (p.args && typeof p.args === "object") versions.push({
|
|
7363
7363
|
state: p.args,
|
|
7364
7364
|
origin: "create",
|
|
@@ -7381,8 +7381,8 @@ function unstable_getInteractableVersions(messages, id, name2) {
|
|
|
7381
7381
|
byId.set(id, versions);
|
|
7382
7382
|
return versions;
|
|
7383
7383
|
}
|
|
7384
|
-
function findModelKnownState(messages, id,
|
|
7385
|
-
const versions = unstable_getInteractableVersions(messages, id,
|
|
7384
|
+
function findModelKnownState(messages, id, name3) {
|
|
7385
|
+
const versions = unstable_getInteractableVersions(messages, id, name3);
|
|
7386
7386
|
const last = versions[versions.length - 1];
|
|
7387
7387
|
return last ? { state: last.state } : void 0;
|
|
7388
7388
|
}
|
|
@@ -11126,11 +11126,11 @@ var ToolInvocationTracker = class {
|
|
|
11126
11126
|
_getWrappedTools() {
|
|
11127
11127
|
const tools = this._getTools();
|
|
11128
11128
|
if (!tools) return void 0;
|
|
11129
|
-
return Object.fromEntries(Object.entries(tools).map(([
|
|
11129
|
+
return Object.fromEntries(Object.entries(tools).map(([name3, tool2]) => {
|
|
11130
11130
|
const execute = tool2.execute;
|
|
11131
11131
|
const streamCall = tool2.streamCall;
|
|
11132
|
-
if (execute === void 0 && streamCall === void 0) return [
|
|
11133
|
-
return [
|
|
11132
|
+
if (execute === void 0 && streamCall === void 0) return [name3, tool2];
|
|
11133
|
+
return [name3, {
|
|
11134
11134
|
...tool2,
|
|
11135
11135
|
...execute !== void 0 && { execute: (...[args, context]) => {
|
|
11136
11136
|
const executionId = getToolExecutionId(context);
|
|
@@ -11415,9 +11415,9 @@ var ToolInvocationTracker = class {
|
|
|
11415
11415
|
|
|
11416
11416
|
// ../../node_modules/.pnpm/@assistant-ui+core@0.3.20_@assistant-ui+store@0.3.14_@assistant-ui+tap@0.9.18_@types+re_dee34b6e359fd521e7d8189e1205a377/node_modules/@assistant-ui/core/dist/runtimes/external-store/external-store-thread-runtime-core.js
|
|
11417
11417
|
var EMPTY_ARRAY4 = Object.freeze([]);
|
|
11418
|
-
var observeAdapterCallback = (
|
|
11418
|
+
var observeAdapterCallback = (name3, result) => {
|
|
11419
11419
|
Promise.resolve(result).catch((error) => {
|
|
11420
|
-
console.error(`[ExternalStoreThreadRuntimeCore] ${
|
|
11420
|
+
console.error(`[ExternalStoreThreadRuntimeCore] ${name3} callback rejected`, error);
|
|
11421
11421
|
});
|
|
11422
11422
|
};
|
|
11423
11423
|
var hasUpcomingMessage = (isRunning, messages) => {
|
|
@@ -12540,8 +12540,8 @@ var ToolUIDisplay = (t0) => {
|
|
|
12540
12540
|
} else t2 = $[8];
|
|
12541
12541
|
return t2;
|
|
12542
12542
|
};
|
|
12543
|
-
var getDataRenderer = (dataRenderers,
|
|
12544
|
-
const named = dataRenderers.renderers[
|
|
12543
|
+
var getDataRenderer = (dataRenderers, name3, inlineFallback) => {
|
|
12544
|
+
const named = dataRenderers.renderers[name3]?.[0];
|
|
12545
12545
|
if (named) return named;
|
|
12546
12546
|
return dataRenderers.fallbacks[0] ?? inlineFallback;
|
|
12547
12547
|
};
|
|
@@ -14791,8 +14791,8 @@ import { jsx as jsx24 } from "react/jsx-runtime";
|
|
|
14791
14791
|
var __defProp7 = Object.defineProperty;
|
|
14792
14792
|
var __name6 = (target, value) => __defProp7(target, "name", { value, configurable: true });
|
|
14793
14793
|
// @__NO_SIDE_EFFECTS__
|
|
14794
|
-
function createCollection(
|
|
14795
|
-
const PROVIDER_NAME2 =
|
|
14794
|
+
function createCollection(name3) {
|
|
14795
|
+
const PROVIDER_NAME2 = name3 + "CollectionProvider";
|
|
14796
14796
|
const [createCollectionContext, createCollectionScope3] = createContextScope(PROVIDER_NAME2);
|
|
14797
14797
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
14798
14798
|
PROVIDER_NAME2,
|
|
@@ -14805,7 +14805,7 @@ function createCollection(name2) {
|
|
|
14805
14805
|
return /* @__PURE__ */ jsx23(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
14806
14806
|
}, "CollectionProvider");
|
|
14807
14807
|
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
14808
|
-
const COLLECTION_SLOT_NAME =
|
|
14808
|
+
const COLLECTION_SLOT_NAME = name3 + "CollectionSlot";
|
|
14809
14809
|
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
14810
14810
|
const CollectionSlot = react_compat_exports.forwardRef(
|
|
14811
14811
|
(props, forwardedRef) => {
|
|
@@ -14816,7 +14816,7 @@ function createCollection(name2) {
|
|
|
14816
14816
|
}
|
|
14817
14817
|
);
|
|
14818
14818
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
14819
|
-
const ITEM_SLOT_NAME =
|
|
14819
|
+
const ITEM_SLOT_NAME = name3 + "CollectionItemSlot";
|
|
14820
14820
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
14821
14821
|
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
14822
14822
|
const CollectionItemSlot = react_compat_exports.forwardRef(
|
|
@@ -14834,7 +14834,7 @@ function createCollection(name2) {
|
|
|
14834
14834
|
);
|
|
14835
14835
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
14836
14836
|
function useCollection3(scope) {
|
|
14837
|
-
const context = useCollectionContext(
|
|
14837
|
+
const context = useCollectionContext(name3 + "CollectionConsumer", scope);
|
|
14838
14838
|
const getItems = react_compat_exports.useCallback(() => {
|
|
14839
14839
|
const collectionNode = context.collectionRef.current;
|
|
14840
14840
|
if (!collectionNode) return [];
|
|
@@ -15165,8 +15165,8 @@ function toSafeInteger(number2) {
|
|
|
15165
15165
|
}
|
|
15166
15166
|
__name6(toSafeInteger, "toSafeInteger");
|
|
15167
15167
|
// @__NO_SIDE_EFFECTS__
|
|
15168
|
-
function createCollection2(
|
|
15169
|
-
const PROVIDER_NAME2 =
|
|
15168
|
+
function createCollection2(name3) {
|
|
15169
|
+
const PROVIDER_NAME2 = name3 + "CollectionProvider";
|
|
15170
15170
|
const [createCollectionContext, createCollectionScope3] = createContextScope(PROVIDER_NAME2);
|
|
15171
15171
|
const [CollectionContextProvider, useCollectionContext] = createCollectionContext(
|
|
15172
15172
|
PROVIDER_NAME2,
|
|
@@ -15221,7 +15221,7 @@ function createCollection2(name2) {
|
|
|
15221
15221
|
);
|
|
15222
15222
|
}, "CollectionProviderImpl");
|
|
15223
15223
|
CollectionProviderImpl.displayName = PROVIDER_NAME2 + "Impl";
|
|
15224
|
-
const COLLECTION_SLOT_NAME =
|
|
15224
|
+
const COLLECTION_SLOT_NAME = name3 + "CollectionSlot";
|
|
15225
15225
|
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
15226
15226
|
const CollectionSlot = react_compat_exports.forwardRef(
|
|
15227
15227
|
(props, forwardedRef) => {
|
|
@@ -15232,7 +15232,7 @@ function createCollection2(name2) {
|
|
|
15232
15232
|
}
|
|
15233
15233
|
);
|
|
15234
15234
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
15235
|
-
const ITEM_SLOT_NAME =
|
|
15235
|
+
const ITEM_SLOT_NAME = name3 + "CollectionItemSlot";
|
|
15236
15236
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
15237
15237
|
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
15238
15238
|
const CollectionItemSlot = react_compat_exports.forwardRef(
|
|
@@ -15279,7 +15279,7 @@ function createCollection2(name2) {
|
|
|
15279
15279
|
}
|
|
15280
15280
|
__name6(useInitCollection, "useInitCollection");
|
|
15281
15281
|
function useCollection3(scope) {
|
|
15282
|
-
const { itemMap } = useCollectionContext(
|
|
15282
|
+
const { itemMap } = useCollectionContext(name3 + "CollectionConsumer", scope);
|
|
15283
15283
|
return itemMap;
|
|
15284
15284
|
}
|
|
15285
15285
|
__name6(useCollection3, "useCollection");
|
|
@@ -15714,10 +15714,10 @@ function dispatchUpdate() {
|
|
|
15714
15714
|
document.dispatchEvent(event);
|
|
15715
15715
|
}
|
|
15716
15716
|
__name9(dispatchUpdate, "dispatchUpdate");
|
|
15717
|
-
function handleAndDispatchCustomEvent(
|
|
15717
|
+
function handleAndDispatchCustomEvent(name3, handler, detail, { discrete }) {
|
|
15718
15718
|
const target = detail.originalEvent.target;
|
|
15719
|
-
const event = new CustomEvent(
|
|
15720
|
-
if (handler) target.addEventListener(
|
|
15719
|
+
const event = new CustomEvent(name3, { bubbles: false, cancelable: true, detail });
|
|
15720
|
+
if (handler) target.addEventListener(name3, handler, { once: true });
|
|
15721
15721
|
if (discrete) {
|
|
15722
15722
|
dispatchDiscreteCustomEvent(target, event);
|
|
15723
15723
|
} else {
|
|
@@ -16299,7 +16299,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
16299
16299
|
continue;
|
|
16300
16300
|
}
|
|
16301
16301
|
const {
|
|
16302
|
-
name:
|
|
16302
|
+
name: name3,
|
|
16303
16303
|
fn
|
|
16304
16304
|
} = currentMiddleware;
|
|
16305
16305
|
const {
|
|
@@ -16323,8 +16323,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
16323
16323
|
});
|
|
16324
16324
|
x = nextX != null ? nextX : x;
|
|
16325
16325
|
y = nextY != null ? nextY : y;
|
|
16326
|
-
middlewareData[
|
|
16327
|
-
...middlewareData[
|
|
16326
|
+
middlewareData[name3] = {
|
|
16327
|
+
...middlewareData[name3],
|
|
16328
16328
|
...data
|
|
16329
16329
|
};
|
|
16330
16330
|
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
@@ -19593,8 +19593,8 @@ function RemoveScrollSideCar(props) {
|
|
|
19593
19593
|
}
|
|
19594
19594
|
}
|
|
19595
19595
|
}, []);
|
|
19596
|
-
var shouldCancel = react_compat_exports.useCallback(function(
|
|
19597
|
-
var event = { name:
|
|
19596
|
+
var shouldCancel = react_compat_exports.useCallback(function(name3, delta, target, should) {
|
|
19597
|
+
var event = { name: name3, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
19598
19598
|
shouldPreventQueue.current.push(event);
|
|
19599
19599
|
setTimeout(function() {
|
|
19600
19600
|
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
@@ -20514,8 +20514,8 @@ Primitive2.Root = Primitive;
|
|
|
20514
20514
|
var __defProp25 = Object.defineProperty;
|
|
20515
20515
|
var __exportAll = (all2, no_symbols) => {
|
|
20516
20516
|
let target = {};
|
|
20517
|
-
for (var
|
|
20518
|
-
get: all2[
|
|
20517
|
+
for (var name3 in all2) __defProp25(target, name3, {
|
|
20518
|
+
get: all2[name3],
|
|
20519
20519
|
enumerable: true
|
|
20520
20520
|
});
|
|
20521
20521
|
if (!no_symbols) __defProp25(target, Symbol.toStringTag, { value: "Module" });
|
|
@@ -22330,11 +22330,11 @@ AttachmentPrimitiveRoot.displayName = "AttachmentPrimitive.Root";
|
|
|
22330
22330
|
import { Fragment as Fragment8, jsx as jsx43 } from "react/jsx-runtime";
|
|
22331
22331
|
var AttachmentPrimitiveName = () => {
|
|
22332
22332
|
const $ = c(2);
|
|
22333
|
-
const
|
|
22333
|
+
const name3 = useAuiState(_temp31);
|
|
22334
22334
|
let t0;
|
|
22335
|
-
if ($[0] !==
|
|
22336
|
-
t0 = /* @__PURE__ */ jsx43(Fragment8, { children:
|
|
22337
|
-
$[0] =
|
|
22335
|
+
if ($[0] !== name3) {
|
|
22336
|
+
t0 = /* @__PURE__ */ jsx43(Fragment8, { children: name3 });
|
|
22337
|
+
$[0] = name3;
|
|
22338
22338
|
$[1] = t0;
|
|
22339
22339
|
} else t0 = $[1];
|
|
22340
22340
|
return t0;
|
|
@@ -29681,7 +29681,7 @@ var errorText = (error) => error instanceof Error ? error.message : String(error
|
|
|
29681
29681
|
var durablePreview = (preview) => preview?.startsWith("data:image/") ? preview : void 0;
|
|
29682
29682
|
function abortable(signal, task) {
|
|
29683
29683
|
return new Promise((resolve, reject) => {
|
|
29684
|
-
const abort = () => reject(new DOMException("
|
|
29684
|
+
const abort = () => reject(new DOMException("Attachment processing was cancelled.", "AbortError"));
|
|
29685
29685
|
signal.addEventListener("abort", abort, { once: true });
|
|
29686
29686
|
void task.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
29687
29687
|
if (signal.aborted) abort();
|
|
@@ -29721,16 +29721,16 @@ var AssistantAttachments = class {
|
|
|
29721
29721
|
return this.entries.get(id)?.preview;
|
|
29722
29722
|
}
|
|
29723
29723
|
async *add({ file }) {
|
|
29724
|
-
if (this.disposed || this.options === false) throw new Error("
|
|
29724
|
+
if (this.disposed || this.options === false) throw new Error("Attachments are disabled.");
|
|
29725
29725
|
const options2 = this.options;
|
|
29726
29726
|
const maxCount = options2.maxCount ?? 3;
|
|
29727
29727
|
if (!Number.isInteger(maxCount) || maxCount <= 0) {
|
|
29728
|
-
this.notice("
|
|
29729
|
-
throw new Error("
|
|
29728
|
+
this.notice("The attachment count limit must be a positive integer.");
|
|
29729
|
+
throw new Error("The attachment count limit must be a positive integer.");
|
|
29730
29730
|
}
|
|
29731
29731
|
if (this.entries.size >= maxCount) {
|
|
29732
|
-
this.notice("
|
|
29733
|
-
throw new Error("
|
|
29732
|
+
this.notice("The attachment count limit has been exceeded.");
|
|
29733
|
+
throw new Error("The attachment count limit has been exceeded.");
|
|
29734
29734
|
}
|
|
29735
29735
|
const entry = {
|
|
29736
29736
|
id: crypto.randomUUID(),
|
|
@@ -29776,9 +29776,10 @@ var AssistantAttachments = class {
|
|
|
29776
29776
|
}
|
|
29777
29777
|
async send(attachment) {
|
|
29778
29778
|
const entry = this.entries.get(attachment.id);
|
|
29779
|
-
if (!entry) throw new Error("
|
|
29779
|
+
if (!entry) throw new Error("The attachment has been removed.");
|
|
29780
29780
|
this.assertLive(entry);
|
|
29781
|
-
if (entry.adding || entry.error)
|
|
29781
|
+
if (entry.adding || entry.error)
|
|
29782
|
+
throw new Error(entry.error ?? "The attachment is not ready yet.");
|
|
29782
29783
|
try {
|
|
29783
29784
|
let content3;
|
|
29784
29785
|
if (entry.adapter) {
|
|
@@ -29793,11 +29794,14 @@ var AssistantAttachments = class {
|
|
|
29793
29794
|
);
|
|
29794
29795
|
this.assertLive(entry);
|
|
29795
29796
|
if (!Array.isArray(result.content) || !result.content.length)
|
|
29796
|
-
throw new Error("
|
|
29797
|
+
throw new Error("Attachment processing must return text or inline images.");
|
|
29797
29798
|
content3 = result.content.map((part) => {
|
|
29798
29799
|
if (part.type === "text") return TextInputContentSchema.parse(part);
|
|
29799
29800
|
const image3 = ImageInputContentSchema.parse(part);
|
|
29800
|
-
if (image3.source.type !== "data")
|
|
29801
|
+
if (image3.source.type !== "data")
|
|
29802
|
+
throw new Error(
|
|
29803
|
+
"Attachments only support inline images. Image URLs are not supported."
|
|
29804
|
+
);
|
|
29801
29805
|
return image3;
|
|
29802
29806
|
});
|
|
29803
29807
|
} else content3 = attachmentContent(entry.local);
|
|
@@ -29823,13 +29827,13 @@ var AssistantAttachments = class {
|
|
|
29823
29827
|
entry.controller.abort();
|
|
29824
29828
|
if (!this.disposed) this.changed();
|
|
29825
29829
|
void Promise.resolve().then(() => entry.adapter?.remove?.({ id: entry.id, file: entry.file, data: entry.data })).catch((error) => {
|
|
29826
|
-
if (!this.disposed) this.notice(
|
|
29830
|
+
if (!this.disposed) this.notice(`Attachment cleanup failed: ${errorText(error)}`);
|
|
29827
29831
|
});
|
|
29828
29832
|
}
|
|
29829
29833
|
take(attachments) {
|
|
29830
29834
|
return attachments.map((attachment) => {
|
|
29831
29835
|
const entry = this.entries.get(attachment.id);
|
|
29832
|
-
if (!entry?.result) throw new Error("
|
|
29836
|
+
if (!entry?.result) throw new Error("The attachment is not ready yet.");
|
|
29833
29837
|
return entry.result;
|
|
29834
29838
|
});
|
|
29835
29839
|
}
|
|
@@ -29845,7 +29849,8 @@ var AssistantAttachments = class {
|
|
|
29845
29849
|
return !this.disposed && !entry.controller.signal.aborted && this.entries.get(entry.id) === entry;
|
|
29846
29850
|
}
|
|
29847
29851
|
assertLive(entry) {
|
|
29848
|
-
if (!this.live(entry))
|
|
29852
|
+
if (!this.live(entry))
|
|
29853
|
+
throw new DOMException("Attachment processing was cancelled.", "AbortError");
|
|
29849
29854
|
}
|
|
29850
29855
|
};
|
|
29851
29856
|
|
|
@@ -29872,7 +29877,7 @@ function useVoiceInput(options2) {
|
|
|
29872
29877
|
listen() {
|
|
29873
29878
|
const config = latest.current;
|
|
29874
29879
|
if (!config.active || !config.open || config.blocked || !config.dictation || !source)
|
|
29875
|
-
throw new Error("
|
|
29880
|
+
throw new Error("Voice input cannot start right now.");
|
|
29876
29881
|
cancel();
|
|
29877
29882
|
const token = ++generation.current;
|
|
29878
29883
|
const composer = config.composer();
|
|
@@ -29906,7 +29911,7 @@ function useVoiceInput(options2) {
|
|
|
29906
29911
|
else composer.setText(confirmed);
|
|
29907
29912
|
emit(ends, { transcript: "", isFinal: true });
|
|
29908
29913
|
if (reason === "stopped" && !hasConfirmed)
|
|
29909
|
-
latest.current.notice("
|
|
29914
|
+
latest.current.notice("No speech was recognized. Please try again.");
|
|
29910
29915
|
setStatus("idle");
|
|
29911
29916
|
};
|
|
29912
29917
|
const terminate = () => {
|
|
@@ -29962,14 +29967,18 @@ function useVoiceInput(options2) {
|
|
|
29962
29967
|
}
|
|
29963
29968
|
if (!cancelled)
|
|
29964
29969
|
latest.current.notice(
|
|
29965
|
-
error instanceof Error ? error.message : "
|
|
29970
|
+
error instanceof Error ? error.message : "Voice input failed. Please try again."
|
|
29966
29971
|
);
|
|
29967
29972
|
};
|
|
29968
29973
|
const complete = () => {
|
|
29969
29974
|
if (!valid2()) return;
|
|
29970
29975
|
const reason = input?.status.type === "ended" ? input.status.reason : "stopped";
|
|
29971
29976
|
if (reason === "error")
|
|
29972
|
-
failure(
|
|
29977
|
+
failure(
|
|
29978
|
+
new Error(
|
|
29979
|
+
"Voice input failed. Check authentication, microphone permissions, and your network connection."
|
|
29980
|
+
)
|
|
29981
|
+
);
|
|
29973
29982
|
else finish(reason);
|
|
29974
29983
|
};
|
|
29975
29984
|
try {
|
|
@@ -30112,7 +30121,9 @@ function SessionRuntime({
|
|
|
30112
30121
|
isSendDisabled: !active || blocked || attachments.blocked || voice.state.status !== "idle",
|
|
30113
30122
|
onNew: async (message) => {
|
|
30114
30123
|
if (!alive.current || latest.current.activeSessionId !== id)
|
|
30115
|
-
throw new MessageNotSentError(
|
|
30124
|
+
throw new MessageNotSentError(
|
|
30125
|
+
"The session has changed. Return to the original session and send again."
|
|
30126
|
+
);
|
|
30116
30127
|
const files = attachments.take(message.attachments ?? []);
|
|
30117
30128
|
const text7 = message.content.flatMap((part) => part.type === "text" ? [part.text] : []).join("");
|
|
30118
30129
|
attachments.commit(message.attachments ?? []);
|
|
@@ -30120,7 +30131,7 @@ function SessionRuntime({
|
|
|
30120
30131
|
await latest.current.sendMessage(text7, files);
|
|
30121
30132
|
},
|
|
30122
30133
|
onEdit: onEdit ? async (message) => {
|
|
30123
|
-
if (!message.sourceId) throw new Error("
|
|
30134
|
+
if (!message.sourceId) throw new Error("The message to edit was not found.");
|
|
30124
30135
|
const text7 = message.content.flatMap((part) => part.type === "text" ? [part.text] : []).join("");
|
|
30125
30136
|
try {
|
|
30126
30137
|
await onEdit(message.sourceId, text7);
|
|
@@ -30171,7 +30182,7 @@ function SessionRuntime({
|
|
|
30171
30182
|
if (failed?.status === "rejected") throw failed.reason;
|
|
30172
30183
|
if (!alive.current) return;
|
|
30173
30184
|
if (latest.current.activeSessionId !== id)
|
|
30174
|
-
throw new Error("
|
|
30185
|
+
throw new Error("The session has changed. Return to the original session and send again.");
|
|
30175
30186
|
assertChatSendable(latest.current, id);
|
|
30176
30187
|
const completed = results.flatMap(
|
|
30177
30188
|
(result) => result.status === "fulfilled" ? [result.value] : []
|
|
@@ -30275,12 +30286,12 @@ var AttachmentPreviewDialog = ({ children }) => {
|
|
|
30275
30286
|
};
|
|
30276
30287
|
var AttachmentThumb = () => {
|
|
30277
30288
|
const src = usePreview();
|
|
30278
|
-
const
|
|
30289
|
+
const name3 = useAuiState((s) => s.attachment.name);
|
|
30279
30290
|
return /* @__PURE__ */ jsx79(Avatar3, { className: cn("aui-attachment-tile-avatar h-full w-full rounded-none"), children: src ? /* @__PURE__ */ jsx79(
|
|
30280
30291
|
"img",
|
|
30281
30292
|
{
|
|
30282
30293
|
src,
|
|
30283
|
-
alt:
|
|
30294
|
+
alt: name3,
|
|
30284
30295
|
className: cn("aui-attachment-tile-image h-full w-full rounded-none object-cover")
|
|
30285
30296
|
}
|
|
30286
30297
|
) : /* @__PURE__ */ jsx79(AvatarFallback3, { children: /* @__PURE__ */ jsx79(
|
|
@@ -30321,7 +30332,7 @@ var AttachmentContent = ({ children }) => {
|
|
|
30321
30332
|
const isUploading = uploadState === "uploading";
|
|
30322
30333
|
const isError = uploadState === "error";
|
|
30323
30334
|
const errorMessage = useAuiState(
|
|
30324
|
-
(s) => s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error" ? s.attachment.status.message ?? "
|
|
30335
|
+
(s) => s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error" ? s.attachment.status.message ?? "Attachment processing failed" : void 0
|
|
30325
30336
|
);
|
|
30326
30337
|
return /* @__PURE__ */ jsx79(TooltipProvider2, { children: /* @__PURE__ */ jsxs19(Tooltip2, { children: [
|
|
30327
30338
|
/* @__PURE__ */ jsxs19(
|
|
@@ -30353,7 +30364,7 @@ var AttachmentContent = ({ children }) => {
|
|
|
30353
30364
|
onKeyUp: (e) => {
|
|
30354
30365
|
if (e.key === " ") e.currentTarget.click();
|
|
30355
30366
|
},
|
|
30356
|
-
"aria-label": `${typeLabel}\u9644\u4EF6${
|
|
30367
|
+
"aria-label": isError ? `${name}: Attachment processing failed` : `${typeLabel}\u9644\u4EF6${isUploading ? "\uFF0C\u6B63\u5728\u5904\u7406" : ""}`,
|
|
30357
30368
|
children: [
|
|
30358
30369
|
/* @__PURE__ */ jsx79(AttachmentThumb, {}),
|
|
30359
30370
|
isUploading && /* @__PURE__ */ jsx79(
|
|
@@ -30391,12 +30402,12 @@ var AttachmentContent = ({ children }) => {
|
|
|
30391
30402
|
] }) });
|
|
30392
30403
|
};
|
|
30393
30404
|
var AttachmentRemove = () => {
|
|
30394
|
-
const
|
|
30405
|
+
const name3 = useAuiState((s) => s.attachment.name);
|
|
30395
30406
|
return /* @__PURE__ */ jsx79(AttachmentPrimitiveRemove, { asChild: true, children: /* @__PURE__ */ jsx79(
|
|
30396
30407
|
TooltipIconButton,
|
|
30397
30408
|
{
|
|
30398
30409
|
tooltip: "\u79FB\u9664\u9644\u4EF6",
|
|
30399
|
-
"aria-label": `\u79FB\u9664 ${
|
|
30410
|
+
"aria-label": `\u79FB\u9664 ${name3}`,
|
|
30400
30411
|
className: cn(
|
|
30401
30412
|
"aui-attachment-tile-remove absolute end-1 top-1 size-5 rounded-full bg-black/50! text-white after:absolute after:-inset-1.5 hover:bg-black/70! hover:text-white! active:scale-[0.96] motion-reduce:transition-none"
|
|
30402
30413
|
),
|
|
@@ -30589,10 +30600,10 @@ function stringify(values, options2) {
|
|
|
30589
30600
|
var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
30590
30601
|
var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
30591
30602
|
var emptyOptions = {};
|
|
30592
|
-
function
|
|
30603
|
+
function name2(name3, options2) {
|
|
30593
30604
|
const settings = options2 || emptyOptions;
|
|
30594
30605
|
const re2 = settings.jsx ? nameReJsx : nameRe;
|
|
30595
|
-
return re2.test(
|
|
30606
|
+
return re2.test(name3);
|
|
30596
30607
|
}
|
|
30597
30608
|
|
|
30598
30609
|
// ../../node_modules/.pnpm/hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/lib/index.js
|
|
@@ -32278,7 +32289,7 @@ function createJsxElementProps(state, node2) {
|
|
|
32278
32289
|
crashEstree(state, node2.position);
|
|
32279
32290
|
}
|
|
32280
32291
|
} else {
|
|
32281
|
-
const
|
|
32292
|
+
const name3 = attribute.name;
|
|
32282
32293
|
let value;
|
|
32283
32294
|
if (attribute.value && typeof attribute.value === "object") {
|
|
32284
32295
|
if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
|
|
@@ -32292,7 +32303,7 @@ function createJsxElementProps(state, node2) {
|
|
|
32292
32303
|
} else {
|
|
32293
32304
|
value = attribute.value === null ? true : attribute.value;
|
|
32294
32305
|
}
|
|
32295
|
-
props[
|
|
32306
|
+
props[name3] = /** @type {Props[keyof Props]} */
|
|
32296
32307
|
value;
|
|
32297
32308
|
}
|
|
32298
32309
|
}
|
|
@@ -32306,11 +32317,11 @@ function createChildren(state, node2) {
|
|
|
32306
32317
|
const child2 = node2.children[index5];
|
|
32307
32318
|
let key;
|
|
32308
32319
|
if (state.passKeys) {
|
|
32309
|
-
const
|
|
32310
|
-
if (
|
|
32311
|
-
const count3 = countsByName.get(
|
|
32312
|
-
key =
|
|
32313
|
-
countsByName.set(
|
|
32320
|
+
const name3 = child2.type === "element" ? child2.tagName : child2.type === "mdxJsxFlowElement" || child2.type === "mdxJsxTextElement" ? child2.name : void 0;
|
|
32321
|
+
if (name3) {
|
|
32322
|
+
const count3 = countsByName.get(name3) || 0;
|
|
32323
|
+
key = name3 + "-" + count3;
|
|
32324
|
+
countsByName.set(name3, count3 + 1);
|
|
32314
32325
|
}
|
|
32315
32326
|
}
|
|
32316
32327
|
const result = one(state, child2, key);
|
|
@@ -32360,16 +32371,16 @@ function parseStyle(state, value) {
|
|
|
32360
32371
|
throw message;
|
|
32361
32372
|
}
|
|
32362
32373
|
}
|
|
32363
|
-
function findComponentFromName(state,
|
|
32374
|
+
function findComponentFromName(state, name3, allowExpression) {
|
|
32364
32375
|
let result;
|
|
32365
32376
|
if (!allowExpression) {
|
|
32366
|
-
result = { type: "Literal", value:
|
|
32367
|
-
} else if (
|
|
32368
|
-
const identifiers =
|
|
32377
|
+
result = { type: "Literal", value: name3 };
|
|
32378
|
+
} else if (name3.includes(".")) {
|
|
32379
|
+
const identifiers = name3.split(".");
|
|
32369
32380
|
let index5 = -1;
|
|
32370
32381
|
let node2;
|
|
32371
32382
|
while (++index5 < identifiers.length) {
|
|
32372
|
-
const prop =
|
|
32383
|
+
const prop = name2(identifiers[index5]) ? { type: "Identifier", name: identifiers[index5] } : { type: "Literal", value: identifiers[index5] };
|
|
32373
32384
|
node2 = node2 ? {
|
|
32374
32385
|
type: "MemberExpression",
|
|
32375
32386
|
object: node2,
|
|
@@ -32381,14 +32392,14 @@ function findComponentFromName(state, name2, allowExpression) {
|
|
|
32381
32392
|
ok(node2, "always a result");
|
|
32382
32393
|
result = node2;
|
|
32383
32394
|
} else {
|
|
32384
|
-
result =
|
|
32395
|
+
result = name2(name3) && !/^[a-z]/.test(name3) ? { type: "Identifier", name: name3 } : { type: "Literal", value: name3 };
|
|
32385
32396
|
}
|
|
32386
32397
|
if (result.type === "Literal") {
|
|
32387
|
-
const
|
|
32398
|
+
const name4 = (
|
|
32388
32399
|
/** @type {string | number} */
|
|
32389
32400
|
result.value
|
|
32390
32401
|
);
|
|
32391
|
-
return own.call(state.components,
|
|
32402
|
+
return own.call(state.components, name4) ? state.components[name4] : name4;
|
|
32392
32403
|
}
|
|
32393
32404
|
if (state.evaluater) {
|
|
32394
32405
|
return state.evaluater.evaluateExpression(result);
|
|
@@ -36864,8 +36875,8 @@ function tokenizeHtmlFlow(effects, ok3, nok) {
|
|
|
36864
36875
|
function tagName(code4) {
|
|
36865
36876
|
if (code4 === null || code4 === 47 || code4 === 62 || markdownLineEndingOrSpace(code4)) {
|
|
36866
36877
|
const slash = code4 === 47;
|
|
36867
|
-
const
|
|
36868
|
-
if (!slash && !closingTag && htmlRawNames.includes(
|
|
36878
|
+
const name3 = buffer.toLowerCase();
|
|
36879
|
+
if (!slash && !closingTag && htmlRawNames.includes(name3)) {
|
|
36869
36880
|
marker = 1;
|
|
36870
36881
|
return self2.interrupt ? ok3(code4) : continuation(code4);
|
|
36871
36882
|
}
|
|
@@ -37056,8 +37067,8 @@ function tokenizeHtmlFlow(effects, ok3, nok) {
|
|
|
37056
37067
|
}
|
|
37057
37068
|
function continuationRawEndTag(code4) {
|
|
37058
37069
|
if (code4 === 62) {
|
|
37059
|
-
const
|
|
37060
|
-
if (htmlRawNames.includes(
|
|
37070
|
+
const name3 = buffer.toLowerCase();
|
|
37071
|
+
if (htmlRawNames.includes(name3)) {
|
|
37061
37072
|
effects.consume(code4);
|
|
37062
37073
|
return continuationClose;
|
|
37063
37074
|
}
|
|
@@ -39967,17 +39978,17 @@ var BIGINT = 8;
|
|
|
39967
39978
|
|
|
39968
39979
|
// ../../node_modules/.pnpm/@ungap+structured-clone@1.3.3/node_modules/@ungap/structured-clone/esm/deserialize.js
|
|
39969
39980
|
var env = typeof self === "object" ? self : globalThis;
|
|
39970
|
-
var guard = (
|
|
39971
|
-
switch (
|
|
39981
|
+
var guard = (name3, init) => {
|
|
39982
|
+
switch (name3) {
|
|
39972
39983
|
case "Function":
|
|
39973
39984
|
case "SharedWorker":
|
|
39974
39985
|
case "Worker":
|
|
39975
39986
|
case "eval":
|
|
39976
39987
|
case "setInterval":
|
|
39977
39988
|
case "setTimeout":
|
|
39978
|
-
throw new TypeError("unable to deserialize " +
|
|
39989
|
+
throw new TypeError("unable to deserialize " + name3);
|
|
39979
39990
|
}
|
|
39980
|
-
return new env[
|
|
39991
|
+
return new env[name3](init);
|
|
39981
39992
|
};
|
|
39982
39993
|
var deserializer = ($, _) => {
|
|
39983
39994
|
const as = (out, index5) => {
|
|
@@ -40023,9 +40034,9 @@ var deserializer = ($, _) => {
|
|
|
40023
40034
|
return set;
|
|
40024
40035
|
}
|
|
40025
40036
|
case ERROR: {
|
|
40026
|
-
const { name:
|
|
40037
|
+
const { name: name3, message } = value;
|
|
40027
40038
|
return as(
|
|
40028
|
-
typeof env[
|
|
40039
|
+
typeof env[name3] === "function" ? guard(name3, message) : new Error(message),
|
|
40029
40040
|
index5
|
|
40030
40041
|
);
|
|
40031
40042
|
}
|
|
@@ -40421,7 +40432,7 @@ function visitParents(tree, test, visitor, reverse) {
|
|
|
40421
40432
|
node2 && typeof node2 === "object" ? node2 : {}
|
|
40422
40433
|
);
|
|
40423
40434
|
if (typeof value.type === "string") {
|
|
40424
|
-
const
|
|
40435
|
+
const name3 = (
|
|
40425
40436
|
// `hast`
|
|
40426
40437
|
typeof value.tagName === "string" ? value.tagName : (
|
|
40427
40438
|
// `xast`
|
|
@@ -40429,7 +40440,7 @@ function visitParents(tree, test, visitor, reverse) {
|
|
|
40429
40440
|
)
|
|
40430
40441
|
);
|
|
40431
40442
|
Object.defineProperty(visit2, "name", {
|
|
40432
|
-
value: "node (" + color(node2.type + (
|
|
40443
|
+
value: "node (" + color(node2.type + (name3 ? "<" + name3 + ">" : "")) + ")"
|
|
40433
40444
|
});
|
|
40434
40445
|
}
|
|
40435
40446
|
return visit2;
|
|
@@ -41478,21 +41489,21 @@ var VFile = class {
|
|
|
41478
41489
|
return decoder.decode(this.value);
|
|
41479
41490
|
}
|
|
41480
41491
|
};
|
|
41481
|
-
function assertPart(part,
|
|
41492
|
+
function assertPart(part, name3) {
|
|
41482
41493
|
if (part && part.includes(minpath.sep)) {
|
|
41483
41494
|
throw new Error(
|
|
41484
|
-
"`" +
|
|
41495
|
+
"`" + name3 + "` cannot be a path: did not expect `" + minpath.sep + "`"
|
|
41485
41496
|
);
|
|
41486
41497
|
}
|
|
41487
41498
|
}
|
|
41488
|
-
function assertNonEmpty(part,
|
|
41499
|
+
function assertNonEmpty(part, name3) {
|
|
41489
41500
|
if (!part) {
|
|
41490
|
-
throw new Error("`" +
|
|
41501
|
+
throw new Error("`" + name3 + "` cannot be empty");
|
|
41491
41502
|
}
|
|
41492
41503
|
}
|
|
41493
|
-
function assertPath2(path2,
|
|
41504
|
+
function assertPath2(path2, name3) {
|
|
41494
41505
|
if (!path2) {
|
|
41495
|
-
throw new Error("Setting `" +
|
|
41506
|
+
throw new Error("Setting `" + name3 + "` requires `path` to be set too");
|
|
41496
41507
|
}
|
|
41497
41508
|
}
|
|
41498
41509
|
function isUint8Array(value) {
|
|
@@ -42120,20 +42131,20 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
42120
42131
|
}
|
|
42121
42132
|
};
|
|
42122
42133
|
var unified = new Processor().freeze();
|
|
42123
|
-
function assertParser(
|
|
42134
|
+
function assertParser(name3, value) {
|
|
42124
42135
|
if (typeof value !== "function") {
|
|
42125
|
-
throw new TypeError("Cannot `" +
|
|
42136
|
+
throw new TypeError("Cannot `" + name3 + "` without `parser`");
|
|
42126
42137
|
}
|
|
42127
42138
|
}
|
|
42128
|
-
function assertCompiler(
|
|
42139
|
+
function assertCompiler(name3, value) {
|
|
42129
42140
|
if (typeof value !== "function") {
|
|
42130
|
-
throw new TypeError("Cannot `" +
|
|
42141
|
+
throw new TypeError("Cannot `" + name3 + "` without `compiler`");
|
|
42131
42142
|
}
|
|
42132
42143
|
}
|
|
42133
|
-
function assertUnfrozen(
|
|
42144
|
+
function assertUnfrozen(name3, frozen) {
|
|
42134
42145
|
if (frozen) {
|
|
42135
42146
|
throw new Error(
|
|
42136
|
-
"Cannot call `" +
|
|
42147
|
+
"Cannot call `" + name3 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
|
|
42137
42148
|
);
|
|
42138
42149
|
}
|
|
42139
42150
|
}
|
|
@@ -42142,10 +42153,10 @@ function assertNode(node2) {
|
|
|
42142
42153
|
throw new TypeError("Expected node, got `" + node2 + "`");
|
|
42143
42154
|
}
|
|
42144
42155
|
}
|
|
42145
|
-
function assertDone(
|
|
42156
|
+
function assertDone(name3, asyncName, complete) {
|
|
42146
42157
|
if (!complete) {
|
|
42147
42158
|
throw new Error(
|
|
42148
|
-
"`" +
|
|
42159
|
+
"`" + name3 + "` finished async. Use `" + asyncName + "` instead"
|
|
42149
42160
|
);
|
|
42150
42161
|
}
|
|
42151
42162
|
}
|
|
@@ -46408,7 +46419,7 @@ function AttachmentTile({
|
|
|
46408
46419
|
/* @__PURE__ */ jsx97(AttachmentPrimitiveName, {}),
|
|
46409
46420
|
binding && attachment.status.type === "requires-action" ? /* @__PURE__ */ jsx97("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" }) : null,
|
|
46410
46421
|
attachment.status.type === "running" ? /* @__PURE__ */ jsx97("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" }) : null,
|
|
46411
|
-
attachment.status.type === "incomplete" ? /* @__PURE__ */ jsx97("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "
|
|
46422
|
+
attachment.status.type === "incomplete" ? /* @__PURE__ */ jsx97("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "Attachment processing failed" }) : null
|
|
46412
46423
|
] }) });
|
|
46413
46424
|
}
|
|
46414
46425
|
function AssistantComposer({
|
|
@@ -46928,7 +46939,7 @@ function Chat({
|
|
|
46928
46939
|
title: "\u4FDD\u5B58\u5E76\u91CD\u65B0\u53D1\u9001\uFF1F",
|
|
46929
46940
|
description: "\u4FEE\u6539\u540E\u5C06\u91CD\u65B0\u751F\u6210\u56DE\u7B54\u3002\u6B64\u524D\u5DF2\u6267\u884C\u7684\u4E1A\u52A1\u64CD\u4F5C\u4E0D\u4F1A\u64A4\u9500\uFF0C\u91CD\u65B0\u53D1\u9001\u53EF\u80FD\u91CD\u590D\u6267\u884C\u3002",
|
|
46930
46941
|
action: perform,
|
|
46931
|
-
cancel: () => reject(new Error("
|
|
46942
|
+
cancel: () => reject(new Error("Resending was cancelled."))
|
|
46932
46943
|
});
|
|
46933
46944
|
else perform();
|
|
46934
46945
|
});
|
package/dist/react.js
CHANGED
|
@@ -138,7 +138,7 @@ export function NexfaceProvider(props) {
|
|
|
138
138
|
};
|
|
139
139
|
if (writeChatStorage(chatStorageKey, stored, store.version) === "conflict") {
|
|
140
140
|
store.warning =
|
|
141
|
-
"
|
|
141
|
+
"Chat history was updated in another tab. Saving is paused in this tab. Copy any new messages you want to keep, then refresh to load the latest history.";
|
|
142
142
|
changed();
|
|
143
143
|
}
|
|
144
144
|
};
|
|
@@ -264,9 +264,9 @@ export function NexfaceProvider(props) {
|
|
|
264
264
|
}, []);
|
|
265
265
|
sendGuards.set(sendMessage, (sessionId) => {
|
|
266
266
|
if (store.activeId !== sessionId)
|
|
267
|
-
throw new ClientError("CHAT_RUN_ACTIVE", "
|
|
267
|
+
throw new ClientError("CHAT_RUN_ACTIVE", "The session has changed. Return to the original session and send again.");
|
|
268
268
|
if (busy())
|
|
269
|
-
throw new ClientError("CHAT_RUN_ACTIVE", "
|
|
269
|
+
throw new ClientError("CHAT_RUN_ACTIVE", "A task is already running. Try sending again later.");
|
|
270
270
|
getClientController(active().client).assertRecoveryAvailable();
|
|
271
271
|
});
|
|
272
272
|
const session = active();
|
package/dist/storage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNexfaceError, runError, toolError } from "./errors.js";
|
|
2
2
|
import { attachmentContent } from "./attachments.js";
|
|
3
3
|
export const chatStorageKey = "nexface:chat:sessions:v3";
|
|
4
|
-
const interruptedMessage = "
|
|
4
|
+
const interruptedMessage = "The page was refreshed and previous actions were not resumed. Verify their results before continuing.";
|
|
5
5
|
const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
6
|
function legacyPageTaskResult(message) {
|
|
7
7
|
if (message.role !== "assistant" ||
|
|
@@ -238,7 +238,7 @@ export function conversationFromMessages(messages) {
|
|
|
238
238
|
"nxf_executeCode",
|
|
239
239
|
]);
|
|
240
240
|
if (messages.some((message) => message.parts.some((part) => part.type === "tool" && legacy.has(part.name))))
|
|
241
|
-
throw new Error("
|
|
241
|
+
throw new Error("This legacy session cannot be restored. Upgrade and start a new session.");
|
|
242
242
|
// Restore conversation content only. Runtime catalogs, snapshots, approvals and Skills belong to the new page.
|
|
243
243
|
return messages
|
|
244
244
|
.filter((message) => message.role !== "assistant" || message.parts.length > 0)
|
|
@@ -59,7 +59,7 @@ const AttachmentContent = ({ children }) => {
|
|
|
59
59
|
const isUploading = uploadState === "uploading";
|
|
60
60
|
const isError = uploadState === "error";
|
|
61
61
|
const errorMessage = useAuiState((s) => s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error"
|
|
62
|
-
? (s.attachment.status.message ?? "
|
|
62
|
+
? (s.attachment.status.message ?? "Attachment processing failed")
|
|
63
63
|
: undefined);
|
|
64
64
|
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsxs(AttachmentPrimitive.Root, { className: cn("aui-attachment-root relative", isComposer && "animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none", isImage && !isComposer && "aui-attachment-root-message only:*:first:size-24"), children: [_jsx(AttachmentPreviewDialog, { children: _jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: cn("aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--nxf-composer-radius,1rem)-var(--nxf-composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10", isError && "after:ring-destructive/60 dark:after:ring-destructive/60"), role: "button", tabIndex: 0, onKeyDown: (e) => {
|
|
65
65
|
if (e.key === "Enter") {
|
|
@@ -72,7 +72,9 @@ const AttachmentContent = ({ children }) => {
|
|
|
72
72
|
}, onKeyUp: (e) => {
|
|
73
73
|
if (e.key === " ")
|
|
74
74
|
e.currentTarget.click();
|
|
75
|
-
}, "aria-label":
|
|
75
|
+
}, "aria-label": isError
|
|
76
|
+
? `${name}: Attachment processing failed`
|
|
77
|
+
: `${typeLabel}附件${isUploading ? ",正在处理" : ""}`, children: [_jsx(AttachmentThumb, {}), isUploading && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(Loader2Icon, { className: cn("text-muted-foreground size-4 animate-spin") }) })), isError && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(AlertCircleIcon, { className: cn("text-destructive size-4") }) }))] }) }) }), isComposer && _jsx(AttachmentRemove, {}), children] }), _jsxs(TooltipContent, { side: "top", children: [_jsx(AttachmentPrimitive.Name, {}), errorMessage && _jsx("p", { className: cn("aui-attachment-error-message"), children: errorMessage })] })] }) }));
|
|
76
78
|
};
|
|
77
79
|
const AttachmentRemove = () => {
|
|
78
80
|
const name = useAuiState((s) => s.attachment.name);
|
package/dist/voice/use-voice.js
CHANGED
|
@@ -16,7 +16,7 @@ export function useVoiceInput(options) {
|
|
|
16
16
|
listen() {
|
|
17
17
|
const config = latest.current;
|
|
18
18
|
if (!config.active || !config.open || config.blocked || !config.dictation || !source)
|
|
19
|
-
throw new Error("
|
|
19
|
+
throw new Error("Voice input cannot start right now.");
|
|
20
20
|
cancel();
|
|
21
21
|
const token = ++generation.current;
|
|
22
22
|
const composer = config.composer();
|
|
@@ -57,7 +57,7 @@ export function useVoiceInput(options) {
|
|
|
57
57
|
composer.setText(confirmed);
|
|
58
58
|
emit(ends, { transcript: "", isFinal: true });
|
|
59
59
|
if (reason === "stopped" && !hasConfirmed)
|
|
60
|
-
latest.current.notice("
|
|
60
|
+
latest.current.notice("No speech was recognized. Please try again.");
|
|
61
61
|
setStatus("idle");
|
|
62
62
|
};
|
|
63
63
|
const terminate = () => {
|
|
@@ -123,14 +123,14 @@ export function useVoiceInput(options) {
|
|
|
123
123
|
/* The source already failed. */
|
|
124
124
|
}
|
|
125
125
|
if (!cancelled)
|
|
126
|
-
latest.current.notice(error instanceof Error ? error.message : "
|
|
126
|
+
latest.current.notice(error instanceof Error ? error.message : "Voice input failed. Please try again.");
|
|
127
127
|
};
|
|
128
128
|
const complete = () => {
|
|
129
129
|
if (!valid())
|
|
130
130
|
return;
|
|
131
131
|
const reason = input?.status.type === "ended" ? input.status.reason : "stopped";
|
|
132
132
|
if (reason === "error")
|
|
133
|
-
failure(new Error("
|
|
133
|
+
failure(new Error("Voice input failed. Check authentication, microphone permissions, and your network connection."));
|
|
134
134
|
else
|
|
135
135
|
finish(reason);
|
|
136
136
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexface/chat",
|
|
3
|
-
"version": "0.1.15-alpha.
|
|
3
|
+
"version": "0.1.15-alpha.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@ag-ui/core": "0.0.59",
|
|
21
|
-
"@nexface/agent": "0.1.15-alpha.
|
|
21
|
+
"@nexface/agent": "0.1.15-alpha.13",
|
|
22
22
|
"class-variance-authority": "0.7.1",
|
|
23
23
|
"clsx": "2.1.1",
|
|
24
24
|
"fast-json-patch": "3.1.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"use-sync-external-store": "1.7.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@nexface/tools": "0.1.15-alpha.
|
|
30
|
+
"@nexface/tools": "0.1.15-alpha.13",
|
|
31
31
|
"react": ">=17",
|
|
32
32
|
"react-dom": ">=17"
|
|
33
33
|
},
|