@iota-uz/sdk 0.4.34 → 0.4.35
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/applet/core.cjs +157 -0
- package/dist/applet/core.cjs.map +1 -1
- package/dist/applet/core.d.cts +16 -1
- package/dist/applet/core.d.ts +16 -1
- package/dist/applet/core.mjs +156 -1
- package/dist/applet/core.mjs.map +1 -1
- package/dist/applet/host.d.cts +2 -31
- package/dist/applet/host.d.ts +2 -31
- package/dist/bichat/index.cjs +391 -2
- package/dist/bichat/index.cjs.map +1 -1
- package/dist/bichat/index.d.cts +227 -2
- package/dist/bichat/index.d.ts +227 -2
- package/dist/bichat/index.mjs +385 -3
- package/dist/bichat/index.mjs.map +1 -1
- package/dist/index.cjs +157 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +156 -124
- package/dist/index.mjs.map +1 -1
- package/dist/rpc-fh942_dj.d.cts +31 -0
- package/dist/rpc-fh942_dj.d.ts +31 -0
- package/package.json +4 -1
- package/tailwind/compiled.css +1 -1
package/dist/bichat/index.mjs
CHANGED
|
@@ -12677,7 +12677,9 @@ function ModelSelector() {
|
|
|
12677
12677
|
}, [currentModel, models, setModel]);
|
|
12678
12678
|
useEffect(() => {
|
|
12679
12679
|
const handler = (e) => {
|
|
12680
|
-
|
|
12680
|
+
const isModifierPressed = e.metaKey || e.ctrlKey;
|
|
12681
|
+
const isShortcutKey = e.code === "KeyM" || e.key.toLowerCase() === "m";
|
|
12682
|
+
if (isModifierPressed && e.shiftKey && !e.altKey && isShortcutKey) {
|
|
12681
12683
|
e.preventDefault();
|
|
12682
12684
|
rotateModel();
|
|
12683
12685
|
}
|
|
@@ -17053,6 +17055,140 @@ function useStreaming2(options = {}) {
|
|
|
17053
17055
|
reset
|
|
17054
17056
|
};
|
|
17055
17057
|
}
|
|
17058
|
+
var TERMINAL = /* @__PURE__ */ new Set([
|
|
17059
|
+
"completed",
|
|
17060
|
+
"cancelled",
|
|
17061
|
+
"failed"
|
|
17062
|
+
]);
|
|
17063
|
+
function useActiveRuns(dataSource, options = {}) {
|
|
17064
|
+
const [runs, setRuns] = useState({});
|
|
17065
|
+
const [ready, setReady] = useState(false);
|
|
17066
|
+
const onErrorRef = useRef(options.onError);
|
|
17067
|
+
onErrorRef.current = options.onError;
|
|
17068
|
+
const enabled = options.enabled ?? true;
|
|
17069
|
+
const retainTerminalMs = options.retainTerminalMs ?? 0;
|
|
17070
|
+
const emptyStateTimeoutMs = options.emptyStateTimeoutMs ?? 250;
|
|
17071
|
+
useEffect(() => {
|
|
17072
|
+
if (!enabled) {
|
|
17073
|
+
return;
|
|
17074
|
+
}
|
|
17075
|
+
if (!dataSource.subscribeActiveRuns) {
|
|
17076
|
+
return;
|
|
17077
|
+
}
|
|
17078
|
+
const controller = new AbortController();
|
|
17079
|
+
let stagingTimer;
|
|
17080
|
+
const staging = {};
|
|
17081
|
+
let sawSnapshotRow = false;
|
|
17082
|
+
const pendingTerminalTimers = /* @__PURE__ */ new Map();
|
|
17083
|
+
const flushSnapshot = () => {
|
|
17084
|
+
setRuns((prev) => ({ ...prev, ...staging }));
|
|
17085
|
+
setReady(true);
|
|
17086
|
+
stagingTimer = void 0;
|
|
17087
|
+
};
|
|
17088
|
+
const subscription = dataSource.subscribeActiveRuns({
|
|
17089
|
+
signal: controller.signal,
|
|
17090
|
+
onError: (evt) => onErrorRef.current?.(evt),
|
|
17091
|
+
onEvent: (evt) => {
|
|
17092
|
+
if (evt.event === "snapshot") {
|
|
17093
|
+
sawSnapshotRow = true;
|
|
17094
|
+
const pending2 = pendingTerminalTimers.get(evt.sessionId);
|
|
17095
|
+
if (pending2 !== void 0) {
|
|
17096
|
+
clearTimeout(pending2);
|
|
17097
|
+
pendingTerminalTimers.delete(evt.sessionId);
|
|
17098
|
+
}
|
|
17099
|
+
staging[evt.sessionId] = {
|
|
17100
|
+
runId: evt.runId,
|
|
17101
|
+
status: evt.status,
|
|
17102
|
+
updatedAt: evt.updatedAt
|
|
17103
|
+
};
|
|
17104
|
+
if (stagingTimer === void 0) {
|
|
17105
|
+
stagingTimer = setTimeout(flushSnapshot, 16);
|
|
17106
|
+
}
|
|
17107
|
+
return;
|
|
17108
|
+
}
|
|
17109
|
+
if (TERMINAL.has(evt.status)) {
|
|
17110
|
+
if (retainTerminalMs <= 0) {
|
|
17111
|
+
setRuns((prev) => {
|
|
17112
|
+
if (!(evt.sessionId in prev)) {
|
|
17113
|
+
return prev;
|
|
17114
|
+
}
|
|
17115
|
+
const next = { ...prev };
|
|
17116
|
+
delete next[evt.sessionId];
|
|
17117
|
+
return next;
|
|
17118
|
+
});
|
|
17119
|
+
return;
|
|
17120
|
+
}
|
|
17121
|
+
setRuns((prev) => ({
|
|
17122
|
+
...prev,
|
|
17123
|
+
[evt.sessionId]: {
|
|
17124
|
+
runId: evt.runId,
|
|
17125
|
+
status: evt.status,
|
|
17126
|
+
updatedAt: evt.updatedAt
|
|
17127
|
+
}
|
|
17128
|
+
}));
|
|
17129
|
+
const existing = pendingTerminalTimers.get(evt.sessionId);
|
|
17130
|
+
if (existing !== void 0) {
|
|
17131
|
+
clearTimeout(existing);
|
|
17132
|
+
}
|
|
17133
|
+
const handle = setTimeout(() => {
|
|
17134
|
+
pendingTerminalTimers.delete(evt.sessionId);
|
|
17135
|
+
setRuns((prev) => {
|
|
17136
|
+
if (!(evt.sessionId in prev)) {
|
|
17137
|
+
return prev;
|
|
17138
|
+
}
|
|
17139
|
+
const next = { ...prev };
|
|
17140
|
+
delete next[evt.sessionId];
|
|
17141
|
+
return next;
|
|
17142
|
+
});
|
|
17143
|
+
}, retainTerminalMs);
|
|
17144
|
+
pendingTerminalTimers.set(evt.sessionId, handle);
|
|
17145
|
+
return;
|
|
17146
|
+
}
|
|
17147
|
+
const pending = pendingTerminalTimers.get(evt.sessionId);
|
|
17148
|
+
if (pending !== void 0) {
|
|
17149
|
+
clearTimeout(pending);
|
|
17150
|
+
pendingTerminalTimers.delete(evt.sessionId);
|
|
17151
|
+
}
|
|
17152
|
+
setRuns((prev) => ({
|
|
17153
|
+
...prev,
|
|
17154
|
+
[evt.sessionId]: {
|
|
17155
|
+
runId: evt.runId,
|
|
17156
|
+
status: evt.status,
|
|
17157
|
+
updatedAt: evt.updatedAt
|
|
17158
|
+
}
|
|
17159
|
+
}));
|
|
17160
|
+
}
|
|
17161
|
+
});
|
|
17162
|
+
subscription?.catch((err) => {
|
|
17163
|
+
if (controller.signal.aborted) {
|
|
17164
|
+
return;
|
|
17165
|
+
}
|
|
17166
|
+
const surface = err instanceof Event ? err : new Event("error");
|
|
17167
|
+
onErrorRef.current?.(surface);
|
|
17168
|
+
});
|
|
17169
|
+
const readyTimeout = setTimeout(() => {
|
|
17170
|
+
if (!sawSnapshotRow) {
|
|
17171
|
+
setReady(true);
|
|
17172
|
+
}
|
|
17173
|
+
}, emptyStateTimeoutMs);
|
|
17174
|
+
return () => {
|
|
17175
|
+
controller.abort();
|
|
17176
|
+
if (stagingTimer !== void 0) {
|
|
17177
|
+
clearTimeout(stagingTimer);
|
|
17178
|
+
}
|
|
17179
|
+
clearTimeout(readyTimeout);
|
|
17180
|
+
for (const handle of pendingTerminalTimers.values()) {
|
|
17181
|
+
clearTimeout(handle);
|
|
17182
|
+
}
|
|
17183
|
+
pendingTerminalTimers.clear();
|
|
17184
|
+
};
|
|
17185
|
+
}, [dataSource, enabled, retainTerminalMs, emptyStateTimeoutMs]);
|
|
17186
|
+
const status = useCallback(
|
|
17187
|
+
(sessionId) => runs[sessionId]?.status,
|
|
17188
|
+
[runs]
|
|
17189
|
+
);
|
|
17190
|
+
return { runs, ready, status };
|
|
17191
|
+
}
|
|
17056
17192
|
|
|
17057
17193
|
// ui/src/bichat/index.ts
|
|
17058
17194
|
init_useTranslation();
|
|
@@ -19122,6 +19258,8 @@ function toStreamEvent(chunk) {
|
|
|
19122
19258
|
return chunk.sessionId ? { type: "user_message", sessionId: chunk.sessionId } : null;
|
|
19123
19259
|
case "interrupt":
|
|
19124
19260
|
return chunk.interrupt ? { type: "interrupt", interrupt: chunk.interrupt, sessionId: chunk.sessionId } : null;
|
|
19261
|
+
case "text_block_end":
|
|
19262
|
+
return { type: "text_block_end", seq: chunk.textBlockSeq ?? 0 };
|
|
19125
19263
|
case "done":
|
|
19126
19264
|
return { type: "done", sessionId: chunk.sessionId, generationMs: chunk.generationMs };
|
|
19127
19265
|
case "error":
|
|
@@ -19131,6 +19269,90 @@ function toStreamEvent(chunk) {
|
|
|
19131
19269
|
}
|
|
19132
19270
|
}
|
|
19133
19271
|
|
|
19272
|
+
// ui/src/bichat/utils/eventNames.ts
|
|
19273
|
+
var STREAM_EVENT_TYPES = [
|
|
19274
|
+
"chunk",
|
|
19275
|
+
"content",
|
|
19276
|
+
"thinking",
|
|
19277
|
+
"tool_start",
|
|
19278
|
+
"tool_end",
|
|
19279
|
+
"text_block_end",
|
|
19280
|
+
"snapshot",
|
|
19281
|
+
"interrupt",
|
|
19282
|
+
"citation",
|
|
19283
|
+
"usage",
|
|
19284
|
+
"ping",
|
|
19285
|
+
"stream_started",
|
|
19286
|
+
"done",
|
|
19287
|
+
"cancelled",
|
|
19288
|
+
"error",
|
|
19289
|
+
"failed"
|
|
19290
|
+
];
|
|
19291
|
+
var TERMINAL_STREAM_EVENT_TYPES = [
|
|
19292
|
+
"done",
|
|
19293
|
+
"cancelled",
|
|
19294
|
+
"error",
|
|
19295
|
+
"failed"
|
|
19296
|
+
];
|
|
19297
|
+
function isTerminalEvent(name) {
|
|
19298
|
+
return TERMINAL_STREAM_EVENT_TYPES.includes(name);
|
|
19299
|
+
}
|
|
19300
|
+
|
|
19301
|
+
// ui/src/bichat/data/openManagedEventSource.ts
|
|
19302
|
+
function openManagedEventSource(opts) {
|
|
19303
|
+
const graceMs = opts.connectGraceMs ?? 500;
|
|
19304
|
+
return new Promise((resolve, reject) => {
|
|
19305
|
+
const startedAt = Date.now();
|
|
19306
|
+
const es = new EventSource(opts.url, {
|
|
19307
|
+
withCredentials: opts.withCredentials ?? true
|
|
19308
|
+
});
|
|
19309
|
+
let settled = false;
|
|
19310
|
+
let sawEvent = false;
|
|
19311
|
+
const settle = (err) => {
|
|
19312
|
+
if (settled) {
|
|
19313
|
+
return;
|
|
19314
|
+
}
|
|
19315
|
+
settled = true;
|
|
19316
|
+
es.close();
|
|
19317
|
+
if (err) {
|
|
19318
|
+
reject(err);
|
|
19319
|
+
} else {
|
|
19320
|
+
resolve();
|
|
19321
|
+
}
|
|
19322
|
+
};
|
|
19323
|
+
if (opts.signal) {
|
|
19324
|
+
if (opts.signal.aborted) {
|
|
19325
|
+
settle();
|
|
19326
|
+
return;
|
|
19327
|
+
}
|
|
19328
|
+
opts.signal.addEventListener("abort", () => settle(), { once: true });
|
|
19329
|
+
}
|
|
19330
|
+
const forward = (name) => (evt) => {
|
|
19331
|
+
sawEvent = true;
|
|
19332
|
+
let parsed;
|
|
19333
|
+
try {
|
|
19334
|
+
parsed = JSON.parse(evt.data);
|
|
19335
|
+
} catch {
|
|
19336
|
+
parsed = { __unparseable: true, raw: String(evt.data) };
|
|
19337
|
+
}
|
|
19338
|
+
try {
|
|
19339
|
+
opts.onMessage(name, parsed);
|
|
19340
|
+
} catch {
|
|
19341
|
+
}
|
|
19342
|
+
};
|
|
19343
|
+
for (const name of opts.events) {
|
|
19344
|
+
es.addEventListener(name, forward(name));
|
|
19345
|
+
}
|
|
19346
|
+
es.onerror = (evt) => {
|
|
19347
|
+
opts.onError?.(evt);
|
|
19348
|
+
if (graceMs > 0 && !sawEvent && Date.now() - startedAt < graceMs) {
|
|
19349
|
+
const err = opts.onConnectError ? opts.onConnectError(evt) : new Error("EventSource failed to connect before first event");
|
|
19350
|
+
settle(err);
|
|
19351
|
+
}
|
|
19352
|
+
};
|
|
19353
|
+
});
|
|
19354
|
+
}
|
|
19355
|
+
|
|
19134
19356
|
// ui/src/bichat/data/AttachmentUploader.ts
|
|
19135
19357
|
init_chartSpec();
|
|
19136
19358
|
var MIME_TO_EXTENSION = {
|
|
@@ -19385,6 +19607,26 @@ async function ensureAttachmentUpload(attachment, context, uploadFileFn) {
|
|
|
19385
19607
|
}
|
|
19386
19608
|
|
|
19387
19609
|
// ui/src/bichat/data/MessageTransport.ts
|
|
19610
|
+
var RunEventsConnectError = class extends Error {
|
|
19611
|
+
constructor(message, cause) {
|
|
19612
|
+
super(message);
|
|
19613
|
+
this.name = "RunEventsConnectError";
|
|
19614
|
+
this.cause = cause;
|
|
19615
|
+
}
|
|
19616
|
+
};
|
|
19617
|
+
function generateRequestId() {
|
|
19618
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
19619
|
+
return crypto.randomUUID();
|
|
19620
|
+
}
|
|
19621
|
+
const bytes = new Uint8Array(16);
|
|
19622
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
19623
|
+
bytes[i] = Math.floor(Math.random() * 256);
|
|
19624
|
+
}
|
|
19625
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
19626
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
19627
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
19628
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
19629
|
+
}
|
|
19388
19630
|
async function* sendMessage(deps, sessionId, content, attachments = [], signal, options) {
|
|
19389
19631
|
const abortController = new AbortController();
|
|
19390
19632
|
let onExternalAbort;
|
|
@@ -19412,12 +19654,14 @@ async function* sendMessage(deps, sessionId, content, attachments = [], signal,
|
|
|
19412
19654
|
sessionId,
|
|
19413
19655
|
attachmentCount: streamAttachments.length
|
|
19414
19656
|
});
|
|
19657
|
+
const requestId = options?.requestId ?? generateRequestId();
|
|
19415
19658
|
const payload = {
|
|
19416
19659
|
sessionId,
|
|
19417
19660
|
content,
|
|
19418
19661
|
debugMode: options?.debugMode ?? false,
|
|
19419
19662
|
replaceFromMessageId: options?.replaceFromMessageID,
|
|
19420
|
-
attachments: streamAttachments
|
|
19663
|
+
attachments: streamAttachments,
|
|
19664
|
+
requestId
|
|
19421
19665
|
};
|
|
19422
19666
|
if (options?.reasoningEffort) {
|
|
19423
19667
|
payload.reasoningEffort = options.reasoningEffort;
|
|
@@ -19585,6 +19829,67 @@ async function resumeStream(deps, sessionId, runId, onChunk, signal) {
|
|
|
19585
19829
|
}
|
|
19586
19830
|
}
|
|
19587
19831
|
}
|
|
19832
|
+
function subscribeRunEvents(deps, sessionId, runId, options) {
|
|
19833
|
+
const base = buildStreamUrl(deps, "/events");
|
|
19834
|
+
const qs = new URLSearchParams({ sessionId, runId });
|
|
19835
|
+
const url = `${base}?${qs.toString()}`;
|
|
19836
|
+
const withCursor = options.lastEventId ? `${url}&${new URLSearchParams({ lastEventId: options.lastEventId }).toString()}` : url;
|
|
19837
|
+
const settleController = new AbortController();
|
|
19838
|
+
if (options.signal) {
|
|
19839
|
+
if (options.signal.aborted) {
|
|
19840
|
+
settleController.abort();
|
|
19841
|
+
} else {
|
|
19842
|
+
options.signal.addEventListener("abort", () => settleController.abort(), {
|
|
19843
|
+
once: true
|
|
19844
|
+
});
|
|
19845
|
+
}
|
|
19846
|
+
}
|
|
19847
|
+
return openManagedEventSource({
|
|
19848
|
+
url: withCursor,
|
|
19849
|
+
events: STREAM_EVENT_TYPES,
|
|
19850
|
+
withCredentials: true,
|
|
19851
|
+
signal: settleController.signal,
|
|
19852
|
+
onError: options.onError,
|
|
19853
|
+
onConnectError: (evt) => new RunEventsConnectError(
|
|
19854
|
+
"EventSource failed to connect before first event",
|
|
19855
|
+
evt
|
|
19856
|
+
),
|
|
19857
|
+
onMessage: (name, data) => {
|
|
19858
|
+
if (typeof data === "object" && data !== null && data.__unparseable) {
|
|
19859
|
+
options.onChunk({
|
|
19860
|
+
type: "error",
|
|
19861
|
+
error: `Failed to parse event: ${data.raw}`
|
|
19862
|
+
});
|
|
19863
|
+
return;
|
|
19864
|
+
}
|
|
19865
|
+
const parsed = data;
|
|
19866
|
+
if (!parsed.type) {
|
|
19867
|
+
parsed.type = name;
|
|
19868
|
+
}
|
|
19869
|
+
options.onChunk(parsed);
|
|
19870
|
+
if (isTerminalEvent(name) || isTerminalEvent(String(parsed.type))) {
|
|
19871
|
+
settleController.abort();
|
|
19872
|
+
}
|
|
19873
|
+
}
|
|
19874
|
+
});
|
|
19875
|
+
}
|
|
19876
|
+
function subscribeActiveRuns(deps, options) {
|
|
19877
|
+
const url = buildStreamUrl(deps, "/active-runs");
|
|
19878
|
+
return openManagedEventSource({
|
|
19879
|
+
url,
|
|
19880
|
+
events: ["snapshot", "update"],
|
|
19881
|
+
withCredentials: true,
|
|
19882
|
+
signal: options.signal,
|
|
19883
|
+
onError: options.onError,
|
|
19884
|
+
onMessage: (name, data) => {
|
|
19885
|
+
if (typeof data !== "object" || data === null || data.__unparseable) {
|
|
19886
|
+
return;
|
|
19887
|
+
}
|
|
19888
|
+
const body = data;
|
|
19889
|
+
options.onEvent({ event: name, ...body });
|
|
19890
|
+
}
|
|
19891
|
+
});
|
|
19892
|
+
}
|
|
19588
19893
|
async function submitQuestionAnswers(callRPC, sessionId, questionId, answers) {
|
|
19589
19894
|
try {
|
|
19590
19895
|
const flatAnswers = {};
|
|
@@ -19853,6 +20158,39 @@ var HttpDataSource = class {
|
|
|
19853
20158
|
signal
|
|
19854
20159
|
);
|
|
19855
20160
|
}
|
|
20161
|
+
/**
|
|
20162
|
+
* Open a native EventSource against GET /stream/events for the given
|
|
20163
|
+
* run. Used by components that want browser-native auto-reconnect
|
|
20164
|
+
* with Last-Event-ID (tab close, wifi drop, device switch). Prefer
|
|
20165
|
+
* over resumeStream when tailing an already-running generation that
|
|
20166
|
+
* another tab started.
|
|
20167
|
+
*/
|
|
20168
|
+
subscribeRunEvents(sessionId, runId, options) {
|
|
20169
|
+
return subscribeRunEvents(
|
|
20170
|
+
{
|
|
20171
|
+
baseUrl: this.config.baseUrl,
|
|
20172
|
+
streamEndpoint: this.config.streamEndpoint
|
|
20173
|
+
},
|
|
20174
|
+
sessionId,
|
|
20175
|
+
runId,
|
|
20176
|
+
options
|
|
20177
|
+
);
|
|
20178
|
+
}
|
|
20179
|
+
/**
|
|
20180
|
+
* Subscribe to the per-tenant active-run fan-out
|
|
20181
|
+
* (GET /stream/active-runs). Never resolves until the caller aborts
|
|
20182
|
+
* via the signal; use from a top-level component (sidebar container)
|
|
20183
|
+
* that mounts for the lifetime of the chat app.
|
|
20184
|
+
*/
|
|
20185
|
+
subscribeActiveRuns(options) {
|
|
20186
|
+
return subscribeActiveRuns(
|
|
20187
|
+
{
|
|
20188
|
+
baseUrl: this.config.baseUrl,
|
|
20189
|
+
streamEndpoint: this.config.streamEndpoint
|
|
20190
|
+
},
|
|
20191
|
+
options
|
|
20192
|
+
);
|
|
20193
|
+
}
|
|
19856
20194
|
async *sendMessage(sessionId, content, attachments = [], signal, options) {
|
|
19857
20195
|
this.abortController = new AbortController();
|
|
19858
20196
|
let onExternalAbort;
|
|
@@ -19926,6 +20264,50 @@ function createHttpDataSource(config) {
|
|
|
19926
20264
|
return new HttpDataSource(config);
|
|
19927
20265
|
}
|
|
19928
20266
|
|
|
19929
|
-
|
|
20267
|
+
// ui/src/bichat/utils/textBlocks.ts
|
|
20268
|
+
function splitIntoTextBlocks(content, offsets) {
|
|
20269
|
+
if (!content) {
|
|
20270
|
+
return [];
|
|
20271
|
+
}
|
|
20272
|
+
if (!offsets || offsets.length === 0) {
|
|
20273
|
+
return [{ seq: 0, content }];
|
|
20274
|
+
}
|
|
20275
|
+
const sanitized = [...offsets].map((n) => Math.max(0, Math.min(Math.floor(n), content.length))).sort((a, b) => a - b);
|
|
20276
|
+
const blocks = [];
|
|
20277
|
+
let cursor = 0;
|
|
20278
|
+
for (let i = 0; i < sanitized.length; i++) {
|
|
20279
|
+
const end = sanitized[i];
|
|
20280
|
+
if (end <= cursor) {
|
|
20281
|
+
continue;
|
|
20282
|
+
}
|
|
20283
|
+
const slice = content.slice(cursor, end);
|
|
20284
|
+
if (slice) {
|
|
20285
|
+
blocks.push({ seq: blocks.length, content: slice });
|
|
20286
|
+
}
|
|
20287
|
+
cursor = end;
|
|
20288
|
+
}
|
|
20289
|
+
if (cursor < content.length) {
|
|
20290
|
+
blocks.push({ seq: blocks.length, content: content.slice(cursor) });
|
|
20291
|
+
}
|
|
20292
|
+
return blocks;
|
|
20293
|
+
}
|
|
20294
|
+
function readTextBlockOffsets(partialMetadata) {
|
|
20295
|
+
if (!partialMetadata) {
|
|
20296
|
+
return [];
|
|
20297
|
+
}
|
|
20298
|
+
const raw = partialMetadata["text_block_offsets"];
|
|
20299
|
+
if (!Array.isArray(raw)) {
|
|
20300
|
+
return [];
|
|
20301
|
+
}
|
|
20302
|
+
const out = [];
|
|
20303
|
+
for (const entry of raw) {
|
|
20304
|
+
if (typeof entry === "number" && Number.isFinite(entry) && entry >= 0) {
|
|
20305
|
+
out.push(Math.floor(entry));
|
|
20306
|
+
}
|
|
20307
|
+
}
|
|
20308
|
+
return out;
|
|
20309
|
+
}
|
|
20310
|
+
|
|
20311
|
+
export { ATTACHMENT_ACCEPT_ATTRIBUTE, ActionButton, ActivityTrace, Alert_default as Alert, AllChatsList, ArchiveBanner_default as ArchiveBanner, ArchivedChatList, AssistantMessage, AssistantTurnView, MemoizedAttachmentGrid as AttachmentGrid, AttachmentPreview_default as AttachmentPreview, AttachmentUpload_default as AttachmentUpload, Avatar, AvatarStack, BiChatLayout, Bubble, CHART_VISUAL, ChartCard, ChatHeader, ChatMachine, ChatSession, ChatSessionProvider, MemoizedCodeBlock as CodeBlock, CodeOutputsPanel, CompactionDoodle, ConfigProvider, ConfirmModal, ConfirmationStep, DateGroupHeader, DebugPanel, DefaultErrorContent, DownloadCard, MemoizedEditableText as EditableText, MemoizedEmptyState as EmptyState, ErrorBoundary, HttpDataSource, ImageModal, InlineQuestionForm, InteractiveTableCard, IotaContextProvider, ListItemSkeleton, MemoizedLoadingSpinner as LoadingSpinner, MemoizedMarkdownRenderer as MarkdownRenderer, MessageActions, MessageInput, MessageList, MessageRole, ModelSelector, PermissionGuard, QuestionForm, QuestionStep, RateLimiter, RetryActionArea, RunEventsConnectError, STREAM_EVENT_TYPES, ScreenReaderAnnouncer, ScrollToBottomButton, MemoizedSearchInput as SearchInput, SessionArtifactList, SessionArtifactPreview, SessionArtifactsPanel, SessionItem_default as SessionItem, SessionMembersModal, SessionSkeleton, Sidebar2 as Sidebar, MemoizedSkeleton as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, SkeletonText, SkipLink, Slot, SourcesPanel, StreamError, StreamingCursor, SystemMessage, TERMINAL_STREAM_EVENT_TYPES, TabbedChartGroup, TabbedTableGroup, TableExportButton, TableWithExport, ThemeProvider, Toast, ToastContainer, TouchContextMenu, Turn, TurnBubble, MemoizedTypingIndicator as TypingIndicator, MemoizedUserAvatar as UserAvatar, MemoizedUserFilter as UserFilter, UserMessage, UserTurnView, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, errorMessageVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, getCSRFToken, getFileVisual, getToolLabel, getValidChildren, groupSessionsByDate, groupSteps, hasPermission, isImageMimeType, isPermissionDeniedError, isTerminalEvent, lightTheme, listItemVariants, messageContainerVariants, messageVariants, parseBichatStream, parseBichatStreamEvents, parseSSEStream, readTextBlockOffsets, scaleFadeVariants, sessionItemVariants, splitIntoTextBlocks, staggerContainerVariants, toErrorDisplay, typingDotVariants, useActionButtonContext, useActiveRuns, useAttachments, useAutoScroll, useAvatarContext, useBichatRouter, useBubbleContext, useChatInput, useChatMessaging, useChatSession, useConfig, useDataTable, useFocusTrap, useHttpDataSourceConfigFromApplet, useImageGallery, useIotaContext, useKeyboardShortcuts, useLongPress, useMarkdownCopy, useMessageActions, useModalLock, useOptionalChatMessaging, useRequiredConfig, useScrollToBottom, useSidebarState, useStreaming2 as useStreaming, useTheme, useToast, useTranslation, useTurnContext, validateAttachmentFile, validateFileCount, validateImageFile, verbTransitionVariants };
|
|
19930
20312
|
//# sourceMappingURL=index.mjs.map
|
|
19931
20313
|
//# sourceMappingURL=index.mjs.map
|