@astralbeam/sdk 0.30.3 → 0.30.5
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 +1 -1
- package/dist/{api-CzXKVU8Z.js → api-CHFaeV-i.js} +3 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/{badge-Do9jhFNO.js → badge-C5nSyoPM.js} +1 -1
- package/dist/client.d.ts +2 -76
- package/dist/client.js +2 -2
- package/dist/{combobox-xio4DRYl.js → combobox-DXIOk4hb.js} +5 -5
- package/dist/{core-CBrD2uRW.js → core-DJGoi0HX.js} +134 -192
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-CI5Jut1h.d.ts → index-BVfd2Jll.d.ts} +0 -4
- package/dist/{index-COWV2LM7.d.ts → index-b-MbK0XS.d.ts} +1 -75
- package/dist/{item-U0ZPJBqA.js → item-D7P71wsB.js} +1 -1
- package/dist/listings-CwKMku_E.js +1 -0
- package/dist/{mcp-servers-B4IbhRo_.js → mcp-servers-CQTKrhfj.js} +1 -1
- package/dist/react.d.ts +1 -7
- package/dist/react.js +8 -9
- package/dist/server.d.ts +1 -3
- package/dist/server.js +8 -15
- package/dist/{styles.generated-BBScqnSk.js → styles.generated-BrC_vo9p.js} +5 -5
- package/dist/{validate-lNXZvCeQ.js → validate-DB08s2p8.js} +4 -8
- package/dist/widget-DoNGl4gQ.js +27 -0
- package/package.json +8 -8
- package/dist/listings-C1-zJbVB.js +0 -1
- package/dist/widget-BY5hZkCs.js +0 -27
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { At as personalMcpTestConnection, Bt as uploadChatFile, C as getChatConfig, Ct as personalMcpAuthorizeConnection, Dt as personalMcpDisconnectConnection, Et as personalMcpCreateConnection, Ht as isAstralBeamApiError, Lt as updateChatThread, Ot as personalMcpGetCatalog, S as deleteChatThread, Tt as personalMcpCompleteAuthorization, Ut as resolveApiUrl, Vt as astralBeamChatFetch, dt as getThreadAttachment, gt as listChatMessages, it as getRunChatUrl, k as getCurrentUser, kt as personalMcpSetHeaders, rt as getResolveChatToolResultUrl, vt as listChatThreads, wt as personalMcpBindBrowser, y as createChatThread } from "./api-
|
|
2
|
-
import { _ as strictDecoder, i as isObject, l as decode, p as JWTInvalid } from "./validate-
|
|
3
|
-
|
|
1
|
+
import { At as personalMcpTestConnection, Bt as uploadChatFile, C as getChatConfig, Ct as personalMcpAuthorizeConnection, Dt as personalMcpDisconnectConnection, Et as personalMcpCreateConnection, Ht as isAstralBeamApiError, Lt as updateChatThread, Ot as personalMcpGetCatalog, S as deleteChatThread, Tt as personalMcpCompleteAuthorization, Ut as resolveApiUrl, Vt as astralBeamChatFetch, dt as getThreadAttachment, gt as listChatMessages, it as getRunChatUrl, k as getCurrentUser, kt as personalMcpSetHeaders, rt as getResolveChatToolResultUrl, vt as listChatThreads, wt as personalMcpBindBrowser, y as createChatThread } from "./api-CHFaeV-i.js";
|
|
2
|
+
import { _ as strictDecoder, i as isObject, l as decode, p as JWTInvalid } from "./validate-DB08s2p8.js";
|
|
3
|
+
// \0rolldown/runtime.js
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
6
|
-
var __exportAll = (all,
|
|
7
|
-
let target = {};
|
|
6
|
+
var __exportAll = (all, flags) => {
|
|
7
|
+
let target = Object.setPrototypeOf({}, null);
|
|
8
8
|
for (var name in all) __defProp(target, name, {
|
|
9
9
|
get: all[name],
|
|
10
10
|
enumerable: true
|
|
11
11
|
});
|
|
12
|
-
if (!
|
|
13
|
-
return target;
|
|
12
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
//#region ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/util/decode_jwt.js
|
|
15
|
+
// ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/util/decode_jwt.js
|
|
17
16
|
function decodeJwt(jwt) {
|
|
18
17
|
if (typeof jwt != "string") throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
19
18
|
const { 1: encodedPayload, length } = jwt.split(".");
|
|
@@ -35,8 +34,7 @@ function decodeJwt(jwt) {
|
|
|
35
34
|
if (!isObject(claimsSet)) throw new JWTInvalid("Invalid JWT Claims Set");
|
|
36
35
|
return claimsSet;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
//#region ../node_modules/.bun/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/alien.js
|
|
37
|
+
// ../node_modules/.bun/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/alien.js
|
|
40
38
|
/* @__NO_SIDE_EFFECTS__ */
|
|
41
39
|
function createReactiveSystem({ update, notify, unwatched }) {
|
|
42
40
|
return {
|
|
@@ -206,8 +204,7 @@ function createReactiveSystem({ update, notify, unwatched }) {
|
|
|
206
204
|
return false;
|
|
207
205
|
}
|
|
208
206
|
}
|
|
209
|
-
|
|
210
|
-
//#region ../node_modules/.bun/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/atom.js
|
|
207
|
+
// ../node_modules/.bun/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/atom.js
|
|
211
208
|
function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
212
209
|
const isObserver = typeof nextHandler === "object";
|
|
213
210
|
const self = isObserver ? nextHandler : void 0;
|
|
@@ -365,8 +362,7 @@ function effect(fn) {
|
|
|
365
362
|
run();
|
|
366
363
|
return effectObj;
|
|
367
364
|
}
|
|
368
|
-
|
|
369
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/snapshot-atom.js
|
|
365
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/snapshot-atom.js
|
|
370
366
|
function isPlainObject(value) {
|
|
371
367
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
372
368
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -470,8 +466,7 @@ function subscribeAtom(atom, listener) {
|
|
|
470
466
|
}
|
|
471
467
|
new TextEncoder();
|
|
472
468
|
new TextDecoder();
|
|
473
|
-
|
|
474
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/response-stream.js
|
|
469
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/response-stream.js
|
|
475
470
|
var UnsupportedResponseStreamError = class extends Error {
|
|
476
471
|
missingFeature;
|
|
477
472
|
constructor(missingFeature) {
|
|
@@ -492,15 +487,13 @@ function createResponseStreamTextDecoder() {
|
|
|
492
487
|
if (typeof globalThis.TextDecoder !== "function") throw new UnsupportedResponseStreamError("TextDecoder");
|
|
493
488
|
return new globalThis.TextDecoder();
|
|
494
489
|
}
|
|
495
|
-
|
|
496
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/sse-utils.js
|
|
490
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/sse-utils.js
|
|
497
491
|
function parseSseDataLine(line) {
|
|
498
492
|
if (!line.startsWith("data:")) return line;
|
|
499
493
|
const data = line.slice(5);
|
|
500
494
|
return data.startsWith(" ") ? data.slice(1) : data;
|
|
501
495
|
}
|
|
502
|
-
|
|
503
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/message-date-normalizer.js
|
|
496
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/message-date-normalizer.js
|
|
504
497
|
function validDate(value) {
|
|
505
498
|
if (value instanceof Date) return Number.isNaN(value.getTime()) ? void 0 : value;
|
|
506
499
|
if (typeof value !== "string") return void 0;
|
|
@@ -531,8 +524,7 @@ function normalizeMessageDates(message) {
|
|
|
531
524
|
function normalizeMessagesDates(messages) {
|
|
532
525
|
return messages.map(normalizeMessageDates);
|
|
533
526
|
}
|
|
534
|
-
|
|
535
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.js
|
|
527
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.js
|
|
536
528
|
function definedDetails(value) {
|
|
537
529
|
return Object.keys(value).length > 0 ? value : void 0;
|
|
538
530
|
}
|
|
@@ -576,8 +568,7 @@ function fromSpecTokenUsage(usage, leftover) {
|
|
|
576
568
|
...completionTokensDetails !== void 0 ? { completionTokensDetails } : {}
|
|
577
569
|
};
|
|
578
570
|
}
|
|
579
|
-
|
|
580
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/merge-metadata.js
|
|
571
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/merge-metadata.js
|
|
581
572
|
function isPlainRecord$1(value) {
|
|
582
573
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
583
574
|
}
|
|
@@ -616,8 +607,7 @@ function withTanstackMetadata(value, tanstack) {
|
|
|
616
607
|
}
|
|
617
608
|
};
|
|
618
609
|
}
|
|
619
|
-
|
|
620
|
-
//#region ../node_modules/.bun/@ag-ui+core@1.0.0+969a6d035afea0f4/node_modules/@ag-ui/core/dist/version-CTNE2I0_.mjs
|
|
610
|
+
// ../node_modules/.bun/@ag-ui+core@1.0.0+969a6d035afea0f4/node_modules/@ag-ui/core/dist/version-CTNE2I0_.mjs
|
|
621
611
|
/**
|
|
622
612
|
* The discriminator carried by every event.
|
|
623
613
|
*/
|
|
@@ -655,8 +645,7 @@ let EventType = /* @__PURE__ */ function(EventType) {
|
|
|
655
645
|
EventType["SUBAGENT_ERROR"] = "SUBAGENT_ERROR";
|
|
656
646
|
return EventType;
|
|
657
647
|
}({});
|
|
658
|
-
|
|
659
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/tool-call-arguments.js
|
|
648
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/tool-call-arguments.js
|
|
660
649
|
function sameJsonValue(left, right) {
|
|
661
650
|
if (Object.is(left, right)) return true;
|
|
662
651
|
if (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => sameJsonValue(value, right[index]));
|
|
@@ -820,8 +809,7 @@ function finishToolCallArguments(streamed, end) {
|
|
|
820
809
|
input: parseToolArguments(args)
|
|
821
810
|
};
|
|
822
811
|
}
|
|
823
|
-
|
|
824
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/reasoning-encrypted-value.js
|
|
812
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/reasoning-encrypted-value.js
|
|
825
813
|
/**
|
|
826
814
|
* Id prefix for the reasoning message of a redacted thinking block (Anthropic
|
|
827
815
|
* `redacted_thinking`). AG-UI's `encryptedValue` does not say what kind of
|
|
@@ -832,8 +820,7 @@ var REDACTED_THINKING_ID_PREFIX = "redacted_thinking-";
|
|
|
832
820
|
function isRedactedThinkingId(id) {
|
|
833
821
|
return typeof id === "string" && id.startsWith("redacted_thinking-");
|
|
834
822
|
}
|
|
835
|
-
|
|
836
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupt-serialization.js
|
|
823
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupt-serialization.js
|
|
837
824
|
var SHA256_K = new Uint32Array([
|
|
838
825
|
1116352408,
|
|
839
826
|
1899447441,
|
|
@@ -1007,8 +994,7 @@ function cloneAndDeepFreezeJson(value) {
|
|
|
1007
994
|
freezeTree(clone);
|
|
1008
995
|
return clone;
|
|
1009
996
|
}
|
|
1010
|
-
|
|
1011
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupts.js
|
|
997
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupts.js
|
|
1012
998
|
function canonicalizeInterruptResolutions(resolutions) {
|
|
1013
999
|
const frozen = cloneAndDeepFreezeJson([...resolutions].sort((left, right) => left.interruptId.localeCompare(right.interruptId)));
|
|
1014
1000
|
const canonicalResolutions = canonicalInterruptJson(frozen);
|
|
@@ -1018,8 +1004,7 @@ function canonicalizeInterruptResolutions(resolutions) {
|
|
|
1018
1004
|
fingerprint: digestInterruptJson(canonicalResolutions)
|
|
1019
1005
|
});
|
|
1020
1006
|
}
|
|
1021
|
-
|
|
1022
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/schema-converter.js
|
|
1007
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/schema-converter.js
|
|
1023
1008
|
/**
|
|
1024
1009
|
* Build a JSONSchema object from any plain key/value source. The `JSONSchema`
|
|
1025
1010
|
* interface's `[key: string]: any` index signature makes every property
|
|
@@ -1286,8 +1271,7 @@ async function validateWithStandardSchema(schema, data) {
|
|
|
1286
1271
|
}))
|
|
1287
1272
|
};
|
|
1288
1273
|
}
|
|
1289
|
-
|
|
1290
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/approval-schema.js
|
|
1274
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/approval-schema.js
|
|
1291
1275
|
var jsonSchemaKeywords = /* @__PURE__ */ new Set([
|
|
1292
1276
|
"$schema",
|
|
1293
1277
|
"$id",
|
|
@@ -1400,8 +1384,7 @@ function hashSchemaInput(schema) {
|
|
|
1400
1384
|
if (schema === void 0) return digestInterruptJson("undefined");
|
|
1401
1385
|
return digestInterruptJson(canonicalInterruptJson(schemaToWire(schema).jsonSchema ?? { standardValidator: "unserialized" }));
|
|
1402
1386
|
}
|
|
1403
|
-
|
|
1404
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupt-resume.js
|
|
1387
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupt-resume.js
|
|
1405
1388
|
/**
|
|
1406
1389
|
* The `Interrupt.metadata` key under which this package's resume binding
|
|
1407
1390
|
* travels.
|
|
@@ -1521,8 +1504,7 @@ function readInterruptBinding(descriptor) {
|
|
|
1521
1504
|
generation
|
|
1522
1505
|
};
|
|
1523
1506
|
}
|
|
1524
|
-
|
|
1525
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupt-definition.js
|
|
1507
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/interrupt-definition.js
|
|
1526
1508
|
var INTERRUPT_PAYLOAD_METADATA_KEY = "tanstack:interruptPayload";
|
|
1527
1509
|
function schemaJson(schema, name) {
|
|
1528
1510
|
if (!isStandardJSONSchema(schema)) throw new TypeError(`${name} must be a Standard Schema with a JSON Schema converter.`);
|
|
@@ -1546,8 +1528,7 @@ function schemaJson(schema, name) {
|
|
|
1546
1528
|
function hashInterruptDefinitionSchema(schema) {
|
|
1547
1529
|
return digestInterruptJson(schemaJson(schema, "Interrupt schema").canonicalJson);
|
|
1548
1530
|
}
|
|
1549
|
-
|
|
1550
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/generic-interrupt-continuation.js
|
|
1531
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/generic-interrupt-continuation.js
|
|
1551
1532
|
/**
|
|
1552
1533
|
* `ResumeEntry.metadata` key for a first-party generic request.
|
|
1553
1534
|
*
|
|
@@ -1585,8 +1566,7 @@ function genericInterruptContinuationFromDescriptor(interrupt) {
|
|
|
1585
1566
|
...hasPayload ? { payload: metadata[INTERRUPT_PAYLOAD_METADATA_KEY] } : {}
|
|
1586
1567
|
};
|
|
1587
1568
|
}
|
|
1588
|
-
|
|
1589
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/subagent-wire.js
|
|
1569
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/subagent-wire.js
|
|
1590
1570
|
function isRecord$2(value) {
|
|
1591
1571
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1592
1572
|
}
|
|
@@ -1699,8 +1679,7 @@ function splitSubagentWire(messages) {
|
|
|
1699
1679
|
groups: [...groups.values()]
|
|
1700
1680
|
};
|
|
1701
1681
|
}
|
|
1702
|
-
|
|
1703
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/provider-executed.js
|
|
1682
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/provider-executed.js
|
|
1704
1683
|
/**
|
|
1705
1684
|
* Narrow a tool call's opaque `metadata` to the provider-executed convention.
|
|
1706
1685
|
* Returns the typed metadata when the call is provider-executed, else `null`.
|
|
@@ -1729,8 +1708,7 @@ function isProviderExecutedToolCall(toolCall) {
|
|
|
1729
1708
|
function isAssistantSegmentOf(id, parentId) {
|
|
1730
1709
|
return id?.startsWith(`${parentId}-segment-`) === true;
|
|
1731
1710
|
}
|
|
1732
|
-
|
|
1733
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/tool-result.js
|
|
1711
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/tool-result.js
|
|
1734
1712
|
var CONTENT_PART_TYPES = /* @__PURE__ */ new Set([
|
|
1735
1713
|
"text",
|
|
1736
1714
|
"image",
|
|
@@ -1790,8 +1768,7 @@ function normalizeToolResult(result) {
|
|
|
1790
1768
|
if (isContentPartArray(result)) return result;
|
|
1791
1769
|
return JSON.stringify(result);
|
|
1792
1770
|
}
|
|
1793
|
-
|
|
1794
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/block-order.js
|
|
1771
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/block-order.js
|
|
1795
1772
|
/**
|
|
1796
1773
|
* The order map for these entries in produced order, or undefined when they
|
|
1797
1774
|
* are in the default order (all thinking, then text, then tool calls).
|
|
@@ -1878,8 +1855,7 @@ function orderedAssistantBlocks(message) {
|
|
|
1878
1855
|
if (offset !== content.length || usedThinking.size !== thinking.length || usedCalls.size !== toolCalls.length) return;
|
|
1879
1856
|
return blocks;
|
|
1880
1857
|
}
|
|
1881
|
-
|
|
1882
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/messages.js
|
|
1858
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/messages.js
|
|
1883
1859
|
function isRecord$1(value) {
|
|
1884
1860
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1885
1861
|
}
|
|
@@ -2590,8 +2566,7 @@ function normalizeToUIMessage(message, generateId) {
|
|
|
2590
2566
|
function generateMessageId() {
|
|
2591
2567
|
return `msg-${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
2592
2568
|
}
|
|
2593
|
-
|
|
2594
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-wire.js
|
|
2569
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-wire.js
|
|
2595
2570
|
function isRecord(value) {
|
|
2596
2571
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2597
2572
|
}
|
|
@@ -2973,8 +2948,7 @@ function hashContent(s) {
|
|
|
2973
2948
|
for (let i = 0; i < s.length; i++) h = h * 31 + s.charCodeAt(i) | 0;
|
|
2974
2949
|
return Math.abs(h).toString(36);
|
|
2975
2950
|
}
|
|
2976
|
-
|
|
2977
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/restore-inbound-chunk.js
|
|
2951
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/restore-inbound-chunk.js
|
|
2978
2952
|
/**
|
|
2979
2953
|
* Rebuild TanStack `TokenUsage` (`promptTokens`) from spec `usage[]` plus
|
|
2980
2954
|
* leftover fields in `metadata.tanstack.usage`. Restore the in-process field
|
|
@@ -3010,8 +2984,7 @@ function restoreInboundChunk(chunk) {
|
|
|
3010
2984
|
if (tanstack.interruptErrors !== void 0) next["tanstack:interruptErrors"] = tanstack.interruptErrors;
|
|
3011
2985
|
return next;
|
|
3012
2986
|
}
|
|
3013
|
-
|
|
3014
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/tool-definition.js
|
|
2987
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/tool-definition.js
|
|
3015
2988
|
/**
|
|
3016
2989
|
* Create an isomorphic tool definition that can be used directly or instantiated for server/client
|
|
3017
2990
|
*
|
|
@@ -3108,8 +3081,7 @@ function toolDefinition(config) {
|
|
|
3108
3081
|
}
|
|
3109
3082
|
};
|
|
3110
3083
|
}
|
|
3111
|
-
|
|
3112
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/chunk-ids.js
|
|
3084
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/chunk-ids.js
|
|
3113
3085
|
function stringField(value) {
|
|
3114
3086
|
return typeof value === "string" && value !== "" ? value : void 0;
|
|
3115
3087
|
}
|
|
@@ -3121,8 +3093,7 @@ function getChunkRunId(chunk) {
|
|
|
3121
3093
|
}
|
|
3122
3094
|
return stringField(tanstackMetadata(chunk)?.runId);
|
|
3123
3095
|
}
|
|
3124
|
-
|
|
3125
|
-
//#region ../node_modules/.bun/partial-json@0.1.7/node_modules/partial-json/dist/options.js
|
|
3096
|
+
// ../node_modules/.bun/partial-json@0.1.7/node_modules/partial-json/dist/options.js
|
|
3126
3097
|
var require_options = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3127
3098
|
/**
|
|
3128
3099
|
* Sometimes you don't allow every type to be partially parsed.
|
|
@@ -3211,8 +3182,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3211
3182
|
};
|
|
3212
3183
|
exports.default = exports.Allow;
|
|
3213
3184
|
}));
|
|
3214
|
-
|
|
3215
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/json-parser.js
|
|
3185
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/json-parser.js
|
|
3216
3186
|
var import_dist = (/* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
3217
3187
|
var __createBinding = this$1 && this$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
3218
3188
|
if (k2 === void 0) k2 = k;
|
|
@@ -3433,8 +3403,7 @@ var defaultJSONParser = new PartialJSONParser();
|
|
|
3433
3403
|
function parsePartialJSON(jsonString) {
|
|
3434
3404
|
return defaultJSONParser.parse(jsonString);
|
|
3435
3405
|
}
|
|
3436
|
-
|
|
3437
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/strategies.js
|
|
3406
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/strategies.js
|
|
3438
3407
|
/**
|
|
3439
3408
|
* Immediate Strategy - emit on every chunk (default behavior)
|
|
3440
3409
|
*/
|
|
@@ -3443,8 +3412,7 @@ var ImmediateStrategy = class {
|
|
|
3443
3412
|
return true;
|
|
3444
3413
|
}
|
|
3445
3414
|
};
|
|
3446
|
-
|
|
3447
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/errors.js
|
|
3415
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/utilities/errors.js
|
|
3448
3416
|
/**
|
|
3449
3417
|
* Convert an AG-UI RUN_ERROR event to the Error shape exposed to consumers.
|
|
3450
3418
|
* Preserves the provider code and sanitized raw event when available.
|
|
@@ -3455,8 +3423,7 @@ function runErrorEventToError(chunk) {
|
|
|
3455
3423
|
if (chunk.rawEvent !== void 0) Object.assign(error, { rawEvent: chunk.rawEvent });
|
|
3456
3424
|
return error;
|
|
3457
3425
|
}
|
|
3458
|
-
|
|
3459
|
-
//#region ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/helpers.mjs
|
|
3426
|
+
// ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/helpers.mjs
|
|
3460
3427
|
/*!
|
|
3461
3428
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3462
3429
|
* (c) 2017-2022 Joachim Wester
|
|
@@ -3587,8 +3554,7 @@ var PatchError = function(_super) {
|
|
|
3587
3554
|
}
|
|
3588
3555
|
return PatchError;
|
|
3589
3556
|
}(Error);
|
|
3590
|
-
|
|
3591
|
-
//#region ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.mjs
|
|
3557
|
+
// ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.mjs
|
|
3592
3558
|
var core_exports = /* @__PURE__ */ __exportAll({
|
|
3593
3559
|
JsonPatchError: () => JsonPatchError,
|
|
3594
3560
|
_areEquals: () => _areEquals,
|
|
@@ -3916,8 +3882,7 @@ function _areEquals(a, b) {
|
|
|
3916
3882
|
}
|
|
3917
3883
|
return a !== a && b !== b;
|
|
3918
3884
|
}
|
|
3919
|
-
|
|
3920
|
-
//#region ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/duplex.mjs
|
|
3885
|
+
// ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/duplex.mjs
|
|
3921
3886
|
/*!
|
|
3922
3887
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3923
3888
|
* (c) 2017-2021 Joachim Wester
|
|
@@ -4093,8 +4058,7 @@ function compare(tree1, tree2, invertible) {
|
|
|
4093
4058
|
_generate(tree1, tree2, patches, "", invertible);
|
|
4094
4059
|
return patches;
|
|
4095
4060
|
}
|
|
4096
|
-
|
|
4097
|
-
//#region ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.mjs
|
|
4061
|
+
// ../node_modules/.bun/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.mjs
|
|
4098
4062
|
/**
|
|
4099
4063
|
* Default export for backwards compat
|
|
4100
4064
|
*/
|
|
@@ -4104,8 +4068,7 @@ var fast_json_patch_default = Object.assign({}, core_exports, duplex_exports, {
|
|
|
4104
4068
|
escapePathComponent,
|
|
4105
4069
|
unescapePathComponent
|
|
4106
4070
|
});
|
|
4107
|
-
|
|
4108
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/activity-records.js
|
|
4071
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/activity-records.js
|
|
4109
4072
|
function isActivityPart(part) {
|
|
4110
4073
|
return part.type === "activity";
|
|
4111
4074
|
}
|
|
@@ -4180,8 +4143,7 @@ function applyActivityDeltaToUIMessages(messages, chunk) {
|
|
|
4180
4143
|
return messages;
|
|
4181
4144
|
}
|
|
4182
4145
|
}
|
|
4183
|
-
|
|
4184
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/message-updaters.js
|
|
4146
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/message-updaters.js
|
|
4185
4147
|
/**
|
|
4186
4148
|
* Message Updaters (Internal)
|
|
4187
4149
|
*
|
|
@@ -4482,8 +4444,7 @@ function updateThinkingPart(messages, messageId, stepId, content, signature) {
|
|
|
4482
4444
|
};
|
|
4483
4445
|
});
|
|
4484
4446
|
}
|
|
4485
|
-
|
|
4486
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/processor.js
|
|
4447
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/processor.js
|
|
4487
4448
|
/**
|
|
4488
4449
|
* Unified Stream Processor
|
|
4489
4450
|
*
|
|
@@ -6619,8 +6580,7 @@ function createReplayStream(recording) {
|
|
|
6619
6580
|
for (const { chunk } of recording.chunks) yield chunk;
|
|
6620
6581
|
} };
|
|
6621
6582
|
}
|
|
6622
|
-
|
|
6623
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/byok/errors.js
|
|
6583
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/byok/errors.js
|
|
6624
6584
|
var ByokMissingError = class extends Error {
|
|
6625
6585
|
provider;
|
|
6626
6586
|
constructor(provider) {
|
|
@@ -6645,15 +6605,13 @@ var ByokUnresolvedProviderError = class extends Error {
|
|
|
6645
6605
|
this.name = "ByokUnresolvedProviderError";
|
|
6646
6606
|
}
|
|
6647
6607
|
};
|
|
6648
|
-
|
|
6649
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/byok/providers.js
|
|
6608
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/byok/providers.js
|
|
6650
6609
|
/** `[a-z][a-z0-9-]{0,63}` — lowercase, no underscores, max 64 chars. */
|
|
6651
6610
|
var BYOK_PROVIDER_ID_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
|
|
6652
6611
|
function isProviderId(value) {
|
|
6653
6612
|
return typeof value === "string" && BYOK_PROVIDER_ID_PATTERN.test(value);
|
|
6654
6613
|
}
|
|
6655
|
-
|
|
6656
|
-
//#region ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/byok/missing.js
|
|
6614
|
+
// ../node_modules/.bun/@tanstack+ai@1.2.0+ac75b968c23456b3/node_modules/@tanstack/ai/dist/esm/byok/missing.js
|
|
6657
6615
|
function isByokMissingBody(value) {
|
|
6658
6616
|
if (typeof value !== "object" || value === null) return false;
|
|
6659
6617
|
if (!("error" in value)) return false;
|
|
@@ -6665,8 +6623,7 @@ function isByokMissingBody(value) {
|
|
|
6665
6623
|
if (!("message" in error) || typeof error.message !== "string") return false;
|
|
6666
6624
|
return true;
|
|
6667
6625
|
}
|
|
6668
|
-
|
|
6669
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/connection-adapters.js
|
|
6626
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/connection-adapters.js
|
|
6670
6627
|
/**
|
|
6671
6628
|
* Associates connect-wrapped chunks with the run they were produced under.
|
|
6672
6629
|
* Content events (TEXT_MESSAGE_CONTENT, TOOL_CALL_*, …) carry no `runId` of
|
|
@@ -7359,8 +7316,7 @@ async function* abortableIterable(iterable, signal) {
|
|
|
7359
7316
|
await iterator.return?.();
|
|
7360
7317
|
}
|
|
7361
7318
|
}
|
|
7362
|
-
|
|
7363
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/interrupt-manager.js
|
|
7319
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/interrupt-manager.js
|
|
7364
7320
|
function isClientOwnedInterrupt(item) {
|
|
7365
7321
|
return item.resumable;
|
|
7366
7322
|
}
|
|
@@ -8277,8 +8233,7 @@ var InterruptManager = class {
|
|
|
8277
8233
|
});
|
|
8278
8234
|
}
|
|
8279
8235
|
};
|
|
8280
|
-
|
|
8281
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/byok/client.js
|
|
8236
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/byok/client.js
|
|
8282
8237
|
var registeredProviderIds = /* @__PURE__ */ new WeakMap();
|
|
8283
8238
|
/**
|
|
8284
8239
|
* Provider to stamp when the caller did not pass a slug.
|
|
@@ -8290,8 +8245,7 @@ function byokFallbackProviderId(byok) {
|
|
|
8290
8245
|
const registered = registeredProviderIds.get(byok) ?? [];
|
|
8291
8246
|
if (registered.length === 1) return registered[0];
|
|
8292
8247
|
}
|
|
8293
|
-
|
|
8294
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/byok/resolve.js
|
|
8248
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/byok/resolve.js
|
|
8295
8249
|
function resolveByokProviderId(byokProvider, ...candidates) {
|
|
8296
8250
|
const fromFn = byokProvider?.();
|
|
8297
8251
|
if (isProviderId(fromFn)) return fromFn;
|
|
@@ -8306,8 +8260,7 @@ async function prepareResolvedByokHeaders(byok, provider) {
|
|
|
8306
8260
|
await byok.prepare(provider);
|
|
8307
8261
|
return byok.headers(provider);
|
|
8308
8262
|
}
|
|
8309
|
-
|
|
8310
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/events.js
|
|
8263
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/events.js
|
|
8311
8264
|
/**
|
|
8312
8265
|
* Abstract base class for ChatClient event emission
|
|
8313
8266
|
*/
|
|
@@ -8469,8 +8422,7 @@ var ChatClientEventEmitter = class {
|
|
|
8469
8422
|
this.emitEvent("devtools:tool-fixture:applied", { ...fixture });
|
|
8470
8423
|
}
|
|
8471
8424
|
};
|
|
8472
|
-
|
|
8473
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/devtools-noop.js
|
|
8425
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/devtools-noop.js
|
|
8474
8426
|
var NoOpChatClientEventEmitter = class extends ChatClientEventEmitter {
|
|
8475
8427
|
emitEvent() {}
|
|
8476
8428
|
};
|
|
@@ -8514,8 +8466,7 @@ var NoOpChatDevtoolsBridge = class {
|
|
|
8514
8466
|
async applyFixture(_fixture) {}
|
|
8515
8467
|
};
|
|
8516
8468
|
var createNoOpChatDevtoolsBridge = (options) => new NoOpChatDevtoolsBridge(options);
|
|
8517
|
-
|
|
8518
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/client-persistor.js
|
|
8469
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/client-persistor.js
|
|
8519
8470
|
function getChunkToolCallId$1(chunk) {
|
|
8520
8471
|
return "toolCallId" in chunk && typeof chunk.toolCallId === "string" ? chunk.toolCallId : void 0;
|
|
8521
8472
|
}
|
|
@@ -8786,8 +8737,7 @@ var ChatPersistor = class {
|
|
|
8786
8737
|
return chunk.type === "TEXT_MESSAGE_START" || chunk.type === "TEXT_MESSAGE_CONTENT" || chunk.type === "TEXT_MESSAGE_CHUNK" || chunk.type === "TOOL_CALL_START" || chunk.type === "TOOL_CALL_ARGS" || chunk.type === "TOOL_CALL_END" || chunk.type === "TOOL_CALL_RESULT" || chunk.type === "TOOL_CALL_CHUNK" || chunk.type === "MESSAGES_SNAPSHOT" || chunk.type === "RUN_ERROR";
|
|
8787
8738
|
}
|
|
8788
8739
|
};
|
|
8789
|
-
|
|
8790
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/cleared-stream-tracker.js
|
|
8740
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/cleared-stream-tracker.js
|
|
8791
8741
|
function getChunkToolCallId(chunk) {
|
|
8792
8742
|
return "toolCallId" in chunk && typeof chunk.toolCallId === "string" ? chunk.toolCallId : void 0;
|
|
8793
8743
|
}
|
|
@@ -8879,8 +8829,7 @@ var ClearedStreamTracker = class {
|
|
|
8879
8829
|
return chunk.type === "TEXT_MESSAGE_START" || chunk.type === "TEXT_MESSAGE_CONTENT" || chunk.type === "TEXT_MESSAGE_CHUNK" || chunk.type === "TOOL_CALL_START" || chunk.type === "TOOL_CALL_ARGS" || chunk.type === "TOOL_CALL_END" || chunk.type === "TOOL_CALL_RESULT" || chunk.type === "TOOL_CALL_CHUNK" || chunk.type === "MESSAGES_SNAPSHOT" || chunk.type === "RUN_ERROR";
|
|
8880
8830
|
}
|
|
8881
8831
|
};
|
|
8882
|
-
|
|
8883
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/chat-client.js
|
|
8832
|
+
// ../node_modules/.bun/@tanstack+ai-client@1.0.0+ac75b968c23456b3/node_modules/@tanstack/ai-client/dist/esm/chat-client.js
|
|
8884
8833
|
var STREAM_PROCESSING_BUDGET_MS = 8;
|
|
8885
8834
|
function yieldToHost() {
|
|
8886
8835
|
const { scheduler } = globalThis;
|
|
@@ -11039,8 +10988,7 @@ var ChatClient = class {
|
|
|
11039
10988
|
this.devtoolsMounted = false;
|
|
11040
10989
|
}
|
|
11041
10990
|
};
|
|
11042
|
-
|
|
11043
|
-
//#region src/lib/debug.ts
|
|
10991
|
+
// src/lib/debug.ts
|
|
11044
10992
|
const badgeStyle = (color) => `background:${color};color:#fff;border-radius:3px;padding:1px 5px`;
|
|
11045
10993
|
const BADGE_STYLE = `${badgeStyle("#7c3aed")};font-weight:600`;
|
|
11046
10994
|
const TIME_STYLE = "color:#94a3b8;font-weight:400";
|
|
@@ -11067,8 +11015,7 @@ function createDebugLogger(enabled) {
|
|
|
11067
11015
|
console.log(`%cAstralBeam%c ${(/* @__PURE__ */ new Date()).toISOString().slice(11, 19)} %c${category}%c ${summary}`, BADGE_STYLE, TIME_STYLE, badgeStyle(CATEGORY_COLORS[category]), "", ...data === void 0 ? [] : [data]);
|
|
11068
11016
|
};
|
|
11069
11017
|
}
|
|
11070
|
-
|
|
11071
|
-
//#region src/core/threads.ts
|
|
11018
|
+
// src/core/threads.ts
|
|
11072
11019
|
function newUuid() {
|
|
11073
11020
|
const bytes = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
|
|
11074
11021
|
bytes[6] = bytes[6] & 15 | 64;
|
|
@@ -11183,8 +11130,7 @@ function selectedThread(key, id) {
|
|
|
11183
11130
|
else globalThis.sessionStorage?.setItem(key, id);
|
|
11184
11131
|
} catch {}
|
|
11185
11132
|
}
|
|
11186
|
-
|
|
11187
|
-
//#region src/lib/drafts.ts
|
|
11133
|
+
// src/lib/drafts.ts
|
|
11188
11134
|
let draftSessionId;
|
|
11189
11135
|
function draftStorageKey(apiUrl, identity, threadId) {
|
|
11190
11136
|
if (!threadId) {
|
|
@@ -11247,8 +11193,7 @@ function storedThreadAttachments({ apiUrl, identity, threadId, update, moveTo })
|
|
|
11247
11193
|
};
|
|
11248
11194
|
return globalThis.navigator?.locks ? navigator.locks.request("astralbeam:attachment-drafts", applyChanges) : Promise.resolve().then(applyChanges);
|
|
11249
11195
|
}
|
|
11250
|
-
|
|
11251
|
-
//#region src/core/protocol.ts
|
|
11196
|
+
// src/core/protocol.ts
|
|
11252
11197
|
const RENDER_WIDGET_TOOL = "render_widget";
|
|
11253
11198
|
const ASK_QUESTIONNAIRE_TOOL = "ask_questionnaire";
|
|
11254
11199
|
const SANDBOX_WRITE_FILE_TOOL = "sandbox_write_file";
|
|
@@ -11258,8 +11203,7 @@ const SANDBOX_LIST_FILES_TOOL = "sandbox_list_files";
|
|
|
11258
11203
|
const SANDBOX_RUN_COMMAND_TOOL = "sandbox_run_command";
|
|
11259
11204
|
/** CUSTOM stream event carrying sandbox provisioning progress, which no tool result can report. */
|
|
11260
11205
|
const SANDBOX_STATUS_EVENT = "astralbeam.sandbox.status";
|
|
11261
|
-
|
|
11262
|
-
//#region src/core/schema.ts
|
|
11206
|
+
// src/core/schema.ts
|
|
11263
11207
|
function toJsonSchema(parameters) {
|
|
11264
11208
|
if (!parameters) return {
|
|
11265
11209
|
type: "object",
|
|
@@ -11272,8 +11216,7 @@ async function validateParameters(parameters, input) {
|
|
|
11272
11216
|
const result = await validateWithStandardSchema(parameters, input);
|
|
11273
11217
|
return result.success ? result.data ?? {} : null;
|
|
11274
11218
|
}
|
|
11275
|
-
|
|
11276
|
-
//#region src/core/agent-tools.ts
|
|
11219
|
+
// src/core/agent-tools.ts
|
|
11277
11220
|
const HOST_TOOL_NOT_EXECUTED = Symbol("Host tool was not executed");
|
|
11278
11221
|
/** The full tool set declared to the agent; `render_widget` only when widgets are registered. */
|
|
11279
11222
|
function buildAgentTools(widgets, hostTools, renderWidget, debug, guardHostExecution) {
|
|
@@ -11408,8 +11351,7 @@ function buildHostTools(tools, debug, guardHostExecution) {
|
|
|
11408
11351
|
}
|
|
11409
11352
|
}));
|
|
11410
11353
|
}
|
|
11411
|
-
|
|
11412
|
-
//#region src/core/auth.ts
|
|
11354
|
+
// src/core/auth.ts
|
|
11413
11355
|
const REFRESH_SKEW_MS = 6e4;
|
|
11414
11356
|
const MAX_TOKEN_LENGTH = 16384;
|
|
11415
11357
|
function tokenTiming(token) {
|
|
@@ -11603,8 +11545,7 @@ async function fetchAuthenticatedChat(options) {
|
|
|
11603
11545
|
headers
|
|
11604
11546
|
});
|
|
11605
11547
|
}
|
|
11606
|
-
|
|
11607
|
-
//#region src/core/auth-lifecycle.ts
|
|
11548
|
+
// src/core/auth-lifecycle.ts
|
|
11608
11549
|
function startAuthentication(options) {
|
|
11609
11550
|
let timer;
|
|
11610
11551
|
const events = new AbortController();
|
|
@@ -11659,13 +11600,13 @@ function startAuthentication(options) {
|
|
|
11659
11600
|
unsubscribe();
|
|
11660
11601
|
};
|
|
11661
11602
|
}
|
|
11662
|
-
|
|
11663
|
-
//#region src/core/mcp.ts
|
|
11603
|
+
// src/core/mcp.ts
|
|
11664
11604
|
async function manageMcpConnection(operation, options) {
|
|
11665
11605
|
switch (operation.action) {
|
|
11666
|
-
case "connect":
|
|
11606
|
+
case "connect":
|
|
11667
11607
|
case "headers": {
|
|
11668
11608
|
const connection = await personalMcpCreateConnection({ mcp_server_id: operation.mcpServerId }, options);
|
|
11609
|
+
if (operation.action === "connect") return connection;
|
|
11669
11610
|
await personalMcpSetHeaders(connection.id, {
|
|
11670
11611
|
lock_version: connection.lock_version,
|
|
11671
11612
|
headers: operation.headers
|
|
@@ -11690,71 +11631,77 @@ async function authorizeMcpConnection(input, requestOptions) {
|
|
|
11690
11631
|
};
|
|
11691
11632
|
const url = new URL(response.popup_url);
|
|
11692
11633
|
url.searchParams.set("origin", window.location.origin);
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
const fail = (error) => {
|
|
11705
|
-
cleanup();
|
|
11706
|
-
reject(error instanceof Error ? error : /* @__PURE__ */ new Error("Authorization failed."));
|
|
11634
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
11635
|
+
let phase = { state: "waiting" };
|
|
11636
|
+
const controller = new AbortController();
|
|
11637
|
+
let completing = false;
|
|
11638
|
+
const fail = (error) => reject(error instanceof Error ? error : /* @__PURE__ */ new Error("Authorization failed."));
|
|
11639
|
+
const authorizationOptions = async () => {
|
|
11640
|
+
const options = await requestOptions();
|
|
11641
|
+
controller.signal.throwIfAborted();
|
|
11642
|
+
return {
|
|
11643
|
+
...options,
|
|
11644
|
+
signal: AbortSignal.any([controller.signal, ...options.signal ? [options.signal] : []])
|
|
11707
11645
|
};
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
if (finished) return;
|
|
11721
|
-
const connected = await personalMcpCompleteAuthorization(id, { attempt_id: attempt.id }, await requestOptions());
|
|
11722
|
-
if (finished) return;
|
|
11723
|
-
if (connected) {
|
|
11724
|
-
cleanup();
|
|
11725
|
-
resolve();
|
|
11726
|
-
return;
|
|
11727
|
-
}
|
|
11728
|
-
}
|
|
11729
|
-
if (popup.closed) fail(/* @__PURE__ */ new Error("Authorization window closed."));
|
|
11730
|
-
} catch (error) {
|
|
11731
|
-
const status = error instanceof Error ? error.status : void 0;
|
|
11732
|
-
if (!(error instanceof TypeError) && status !== 429 && (status ?? 0) < 500) fail(error);
|
|
11733
|
-
} finally {
|
|
11734
|
-
completing = false;
|
|
11646
|
+
};
|
|
11647
|
+
const complete = async () => {
|
|
11648
|
+
if (completing || controller.signal.aborted) return;
|
|
11649
|
+
completing = true;
|
|
11650
|
+
try {
|
|
11651
|
+
if (phase.state === "binding") {
|
|
11652
|
+
await personalMcpBindBrowser(id, {
|
|
11653
|
+
attempt_id: attempt.id,
|
|
11654
|
+
challenge: phase.challenge
|
|
11655
|
+
}, await authorizationOptions());
|
|
11656
|
+
controller.signal.throwIfAborted();
|
|
11657
|
+
phase = { state: "completing" };
|
|
11735
11658
|
}
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
complete();
|
|
11659
|
+
if (phase.state === "completing") {
|
|
11660
|
+
const connected = await personalMcpCompleteAuthorization(id, { attempt_id: attempt.id }, await authorizationOptions());
|
|
11661
|
+
controller.signal.throwIfAborted();
|
|
11662
|
+
if (connected) {
|
|
11663
|
+
resolve();
|
|
11664
|
+
return;
|
|
11665
|
+
}
|
|
11744
11666
|
}
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11667
|
+
if (popup.closed) fail(/* @__PURE__ */ new Error("Authorization window closed."));
|
|
11668
|
+
} catch (error) {
|
|
11669
|
+
const status = error instanceof Error ? error.status : void 0;
|
|
11670
|
+
if (!(error instanceof TypeError) && status !== 429 && (status ?? 0) < 500) fail(error);
|
|
11671
|
+
} finally {
|
|
11672
|
+
completing = false;
|
|
11673
|
+
}
|
|
11674
|
+
};
|
|
11675
|
+
const receive = (event) => {
|
|
11676
|
+
if (event.source !== popup || event.origin !== url.origin) return;
|
|
11677
|
+
const data = event.data;
|
|
11678
|
+
if (!data?.attempt || data.attempt.id !== attempt.id || data.attempt.organizationId !== attempt.organizationId || data.attempt.tenantId !== attempt.tenantId || data.attempt.connectionId !== attempt.connectionId) return;
|
|
11679
|
+
if (data.type === "mcp-browser-challenge" && phase.state === "waiting" && typeof data.challenge === "string") {
|
|
11680
|
+
phase = {
|
|
11681
|
+
state: "binding",
|
|
11682
|
+
challenge: data.challenge
|
|
11683
|
+
};
|
|
11684
|
+
complete();
|
|
11685
|
+
}
|
|
11686
|
+
};
|
|
11687
|
+
const poll = setInterval(() => void complete(), 5e3);
|
|
11688
|
+
const expiry = setTimeout(() => fail(/* @__PURE__ */ new Error("Authorization expired. Try connecting again.")), 6e5);
|
|
11689
|
+
try {
|
|
11748
11690
|
window.addEventListener("message", receive);
|
|
11749
11691
|
popup.location.replace(url.href);
|
|
11750
|
-
|
|
11692
|
+
await promise;
|
|
11693
|
+
} finally {
|
|
11694
|
+
controller.abort();
|
|
11695
|
+
window.removeEventListener("message", receive);
|
|
11696
|
+
clearInterval(poll);
|
|
11697
|
+
clearTimeout(expiry);
|
|
11698
|
+
}
|
|
11751
11699
|
return id;
|
|
11752
11700
|
} finally {
|
|
11753
11701
|
popup.close();
|
|
11754
11702
|
}
|
|
11755
11703
|
}
|
|
11756
|
-
|
|
11757
|
-
//#region src/core/messages.ts
|
|
11704
|
+
// src/core/messages.ts
|
|
11758
11705
|
function isSettledToolCall(part) {
|
|
11759
11706
|
return part.state === "complete" || part.state === "error" || part.output !== void 0;
|
|
11760
11707
|
}
|
|
@@ -11766,13 +11713,11 @@ function lastPartInProgress(messages) {
|
|
|
11766
11713
|
function hasPendingToolRun(messages, toolNames) {
|
|
11767
11714
|
return messages.some((message) => message.parts.some((part) => part.type === "tool-call" && !isSettledToolCall(part) && part.name !== "ask_questionnaire" && toolNames.has(part.name)));
|
|
11768
11715
|
}
|
|
11769
|
-
|
|
11770
|
-
//#region src/core/web.ts
|
|
11716
|
+
// src/core/web.ts
|
|
11771
11717
|
function webPartMetadata(part) {
|
|
11772
11718
|
return part.metadata ?? {};
|
|
11773
11719
|
}
|
|
11774
|
-
|
|
11775
|
-
//#region src/core/sandbox.ts
|
|
11720
|
+
// src/core/sandbox.ts
|
|
11776
11721
|
const SANDBOX_TOOLS = [
|
|
11777
11722
|
SANDBOX_WRITE_FILE_TOOL,
|
|
11778
11723
|
SANDBOX_READ_FILE_TOOL,
|
|
@@ -11884,8 +11829,7 @@ function describeSandboxCommandRun(run) {
|
|
|
11884
11829
|
if (run.truncated) parts.push("output truncated");
|
|
11885
11830
|
return parts.join(" · ");
|
|
11886
11831
|
}
|
|
11887
|
-
|
|
11888
|
-
//#region src/core/session.ts
|
|
11832
|
+
// src/core/session.ts
|
|
11889
11833
|
const HISTORY_FAILED = "Reopen this conversation or start a new one before sending.";
|
|
11890
11834
|
const CORE_OPTION_KEYS = Object.keys({
|
|
11891
11835
|
agentId: true,
|
|
@@ -13186,11 +13130,9 @@ function createAstralBeamChat(options, deferStart = false) {
|
|
|
13186
13130
|
}
|
|
13187
13131
|
};
|
|
13188
13132
|
}
|
|
13189
|
-
|
|
13190
|
-
//#region src/lib/define.ts
|
|
13133
|
+
// src/lib/define.ts
|
|
13191
13134
|
/** Declares a host tool; a Standard Schema `parameters` types (and validates) `execute`'s input. */
|
|
13192
13135
|
function defineTool(tool) {
|
|
13193
13136
|
return tool;
|
|
13194
13137
|
}
|
|
13195
|
-
//#endregion
|
|
13196
13138
|
export { SANDBOX_WRITE_FILE_TOOL as S, SANDBOX_LIST_FILES_TOOL as _, describeSandboxCommandRun as a, SANDBOX_RUN_COMMAND_TOOL as b, readSandboxCommandRun as c, hasPendingToolRun as d, isSettledToolCall as f, RENDER_WIDGET_TOOL as g, ASK_QUESTIONNAIRE_TOOL as h, collectSandboxActivity as i, readSandboxFileWrite as l, buildAgentTools as m, CORE_OPTION_KEYS as n, isSandboxTool as o, lastPartInProgress as p, createAstralBeamChat as r, readSandboxArtifact as s, defineTool as t, sandboxRefusal as u, SANDBOX_PUBLISH_ARTIFACT_TOOL as v, SANDBOX_STATUS_EVENT as x, SANDBOX_READ_FILE_TOOL as y };
|