@blade-hq/agent-react 2610.0.0-beta.60 → 2610.0.0-beta.61
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/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/random-id.d.ts +10 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17323,6 +17323,22 @@ function CurrentPlanPanel({
|
|
|
17323
17323
|
import { chatErrorForDisplay as chatErrorForDisplay2 } from "@blade-hq/agent-client";
|
|
17324
17324
|
import { useState as useState30 } from "react";
|
|
17325
17325
|
|
|
17326
|
+
// src/lib/random-id.ts
|
|
17327
|
+
function randomId() {
|
|
17328
|
+
const webCrypto = typeof globalThis !== "undefined" ? globalThis.crypto : void 0;
|
|
17329
|
+
if (webCrypto && typeof webCrypto.randomUUID === "function") {
|
|
17330
|
+
return webCrypto.randomUUID();
|
|
17331
|
+
}
|
|
17332
|
+
if (webCrypto && typeof webCrypto.getRandomValues === "function") {
|
|
17333
|
+
const bytes = webCrypto.getRandomValues(new Uint8Array(16));
|
|
17334
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
17335
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
17336
|
+
const hex3 = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
17337
|
+
return `${hex3.slice(0, 8)}-${hex3.slice(8, 12)}-${hex3.slice(12, 16)}-${hex3.slice(16, 20)}-${hex3.slice(20)}`;
|
|
17338
|
+
}
|
|
17339
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
17340
|
+
}
|
|
17341
|
+
|
|
17326
17342
|
// src/components/McpAppCard.tsx
|
|
17327
17343
|
import { BladeApiError } from "@blade-hq/agent-client";
|
|
17328
17344
|
|
|
@@ -42280,7 +42296,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
42280
42296
|
offChanged = client.sessions.onMcpAppChanged(sessionId, sourceId, () => refresh());
|
|
42281
42297
|
refresh(true);
|
|
42282
42298
|
};
|
|
42283
|
-
const instance =
|
|
42299
|
+
const instance = randomId();
|
|
42284
42300
|
const deliveredMessages = /* @__PURE__ */ new Set();
|
|
42285
42301
|
bridge.oncalltool = async (params, extra) => {
|
|
42286
42302
|
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
@@ -45383,7 +45399,7 @@ ${item.content}`), text].filter(Boolean).join("\n\n");
|
|
|
45383
45399
|
};
|
|
45384
45400
|
return /* @__PURE__ */ jsx26(McpAppMessageContext.Provider, { value: (message) => {
|
|
45385
45401
|
if (!sessionId || message.sessionId !== sessionId || isViewer) throw new Error("\u5F53\u524D\u4F1A\u8BDD\u4E0D\u80FD\u63A5\u6536\u5E94\u7528\u6D88\u606F");
|
|
45386
|
-
setPending((items) => [...items, { ...message, sessionId, id:
|
|
45402
|
+
setPending((items) => [...items, { ...message, sessionId, id: randomId() }]);
|
|
45387
45403
|
}, children: /* @__PURE__ */ jsxs22(
|
|
45388
45404
|
"div",
|
|
45389
45405
|
{
|