@darqlabs/curator-sdk-react 0.6.1 → 0.8.0
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 +18 -0
- package/dist/cjs/CuratorAdapter.d.ts +37 -2
- package/dist/cjs/CuratorAdapter.d.ts.map +1 -1
- package/dist/cjs/CuratorAdapter.js +119 -20
- package/dist/cjs/CuratorAdapter.js.map +1 -1
- package/dist/cjs/CuratorChat.d.ts +8 -0
- package/dist/cjs/CuratorChat.d.ts.map +1 -1
- package/dist/cjs/CuratorChat.js +28 -8
- package/dist/cjs/CuratorChat.js.map +1 -1
- package/dist/cjs/historyMessages.d.ts +20 -1
- package/dist/cjs/historyMessages.d.ts.map +1 -1
- package/dist/cjs/historyMessages.js +25 -3
- package/dist/cjs/historyMessages.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mcpApps/McpAppContext.d.ts +39 -0
- package/dist/cjs/mcpApps/McpAppContext.d.ts.map +1 -0
- package/dist/cjs/mcpApps/McpAppContext.js +19 -0
- package/dist/cjs/mcpApps/McpAppContext.js.map +1 -0
- package/dist/cjs/mcpApps/McpAppToolPart.d.ts +27 -0
- package/dist/cjs/mcpApps/McpAppToolPart.d.ts.map +1 -0
- package/dist/cjs/mcpApps/McpAppToolPart.js +275 -0
- package/dist/cjs/mcpApps/McpAppToolPart.js.map +1 -0
- package/dist/cjs/mcpApps/hostBridge.d.ts +127 -0
- package/dist/cjs/mcpApps/hostBridge.d.ts.map +1 -0
- package/dist/cjs/mcpApps/hostBridge.js +306 -0
- package/dist/cjs/mcpApps/hostBridge.js.map +1 -0
- package/dist/esm/CuratorAdapter.d.ts +37 -2
- package/dist/esm/CuratorAdapter.d.ts.map +1 -1
- package/dist/esm/CuratorAdapter.js +119 -20
- package/dist/esm/CuratorAdapter.js.map +1 -1
- package/dist/esm/CuratorChat.d.ts +8 -0
- package/dist/esm/CuratorChat.d.ts.map +1 -1
- package/dist/esm/CuratorChat.js +28 -8
- package/dist/esm/CuratorChat.js.map +1 -1
- package/dist/esm/historyMessages.d.ts +20 -1
- package/dist/esm/historyMessages.d.ts.map +1 -1
- package/dist/esm/historyMessages.js +25 -3
- package/dist/esm/historyMessages.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mcpApps/McpAppContext.d.ts +39 -0
- package/dist/esm/mcpApps/McpAppContext.d.ts.map +1 -0
- package/dist/esm/mcpApps/McpAppContext.js +15 -0
- package/dist/esm/mcpApps/McpAppContext.js.map +1 -0
- package/dist/esm/mcpApps/McpAppToolPart.d.ts +27 -0
- package/dist/esm/mcpApps/McpAppToolPart.d.ts.map +1 -0
- package/dist/esm/mcpApps/McpAppToolPart.js +271 -0
- package/dist/esm/mcpApps/McpAppToolPart.js.map +1 -0
- package/dist/esm/mcpApps/hostBridge.d.ts +127 -0
- package/dist/esm/mcpApps/hostBridge.d.ts.map +1 -0
- package/dist/esm/mcpApps/hostBridge.js +300 -0
- package/dist/esm/mcpApps/hostBridge.js.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host side of the MCP Apps (SEP-1865) bridge: JSON-RPC 2.0 over a message
|
|
3
|
+
* transport, from the widget to one rendered view.
|
|
4
|
+
*
|
|
5
|
+
* Pure. Knows nothing about React, iframes or the network: the caller hands
|
|
6
|
+
* it a `post` function to reach the view and feeds it every message the view
|
|
7
|
+
* sends. Everything the view may ask for is a `handlers` callback, so the
|
|
8
|
+
* whole protocol can be exercised in a unit test with a fake view.
|
|
9
|
+
*
|
|
10
|
+
* What the view may do, and what this bridge does with it:
|
|
11
|
+
*
|
|
12
|
+
* ui/initialize → handshake; answers with host info,
|
|
13
|
+
* capabilities and context
|
|
14
|
+
* ui/notifications/initialized → view is ready; deliver the tool input,
|
|
15
|
+
* then the tool result once known
|
|
16
|
+
* tools/call → handlers.callTool (the Curator data plane)
|
|
17
|
+
* ui/message → handlers.sendMessage (app-reported text)
|
|
18
|
+
* ui/update-model-context → handlers.updateModelContext (surfaced only)
|
|
19
|
+
* ui/open-link → handlers.openLink (http(s) only)
|
|
20
|
+
* ui/request-display-mode → always `inline` in v1
|
|
21
|
+
* ui/notifications/size-changed → handlers.onSizeChange
|
|
22
|
+
* notifications/message → handlers.onLog
|
|
23
|
+
* ping → {}
|
|
24
|
+
* anything else → JSON-RPC "method not found"
|
|
25
|
+
*
|
|
26
|
+
* Method names are the ones ext-apps 2.0 emits (`ui/…`). The deprecated
|
|
27
|
+
* `notifications/…` spellings assistant-ui also accepts are NOT supported:
|
|
28
|
+
* fewer names to reason about, and our reference view uses the current SDK.
|
|
29
|
+
*/
|
|
30
|
+
export const MCP_APPS_PROTOCOL_VERSION = "2026-01-26";
|
|
31
|
+
const ERR = { invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602, internal: -32603 };
|
|
32
|
+
const DEFAULT_MAX_MESSAGE_CHARS = 2048;
|
|
33
|
+
// Control characters except tab / newline / carriage return.
|
|
34
|
+
// eslint-disable-next-line no-control-regex
|
|
35
|
+
const CONTROL_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g;
|
|
36
|
+
function isRecord(v) {
|
|
37
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The text of a spec-shaped `ui/message`: `{ role, content: [{type:"text", text}] }`.
|
|
41
|
+
* Also accepts a bare `{ text }` for lenient views. Control characters are
|
|
42
|
+
* stripped and the length capped; the result is plain text, never markup.
|
|
43
|
+
*/
|
|
44
|
+
export function extractMessageText(params, maxChars = DEFAULT_MAX_MESSAGE_CHARS) {
|
|
45
|
+
if (!isRecord(params))
|
|
46
|
+
return null;
|
|
47
|
+
let text = null;
|
|
48
|
+
if (Array.isArray(params.content)) {
|
|
49
|
+
text = params.content
|
|
50
|
+
.filter((c) => isRecord(c) && c.type === "text" && typeof c.text === "string")
|
|
51
|
+
.map((c) => c.text)
|
|
52
|
+
.join("\n");
|
|
53
|
+
}
|
|
54
|
+
else if (typeof params.text === "string") {
|
|
55
|
+
text = params.text;
|
|
56
|
+
}
|
|
57
|
+
if (text === null)
|
|
58
|
+
return null;
|
|
59
|
+
const clean = text.replace(CONTROL_CHARS, "").slice(0, maxChars).trim();
|
|
60
|
+
return clean.length > 0 ? clean : null;
|
|
61
|
+
}
|
|
62
|
+
/** Only web links leave the sandbox. */
|
|
63
|
+
export function isOpenableUrl(url) {
|
|
64
|
+
if (typeof url !== "string")
|
|
65
|
+
return false;
|
|
66
|
+
try {
|
|
67
|
+
const u = new URL(url);
|
|
68
|
+
return u.protocol === "https:" || u.protocol === "http:";
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export class McpAppHostBridge {
|
|
75
|
+
post;
|
|
76
|
+
handlers;
|
|
77
|
+
hostInfo;
|
|
78
|
+
hostContext;
|
|
79
|
+
maxMessageChars;
|
|
80
|
+
initialized = false;
|
|
81
|
+
closed = false;
|
|
82
|
+
nextId = 1;
|
|
83
|
+
pending = new Map();
|
|
84
|
+
/** Tool input, delivered on `initialized` (or immediately when already ready). */
|
|
85
|
+
toolInput;
|
|
86
|
+
toolInputSent = false;
|
|
87
|
+
/** Tool result, delivered after input once known. */
|
|
88
|
+
toolResult;
|
|
89
|
+
toolResultSent = false;
|
|
90
|
+
constructor(opts) {
|
|
91
|
+
this.post = opts.post;
|
|
92
|
+
this.handlers = opts.handlers;
|
|
93
|
+
this.hostInfo = opts.hostInfo ?? { name: "Curator", version: "1" };
|
|
94
|
+
this.hostContext = {
|
|
95
|
+
platform: "web",
|
|
96
|
+
displayMode: "inline",
|
|
97
|
+
availableDisplayModes: ["inline"],
|
|
98
|
+
...opts.hostContext,
|
|
99
|
+
};
|
|
100
|
+
this.maxMessageChars = opts.maxMessageChars ?? DEFAULT_MAX_MESSAGE_CHARS;
|
|
101
|
+
}
|
|
102
|
+
get isInitialized() {
|
|
103
|
+
return this.initialized;
|
|
104
|
+
}
|
|
105
|
+
// ── host → view ─────────────────────────────────────────────────────────
|
|
106
|
+
setToolInput(args) {
|
|
107
|
+
this.toolInput = args;
|
|
108
|
+
this.flush();
|
|
109
|
+
}
|
|
110
|
+
setToolResult(result) {
|
|
111
|
+
this.toolResult = result;
|
|
112
|
+
this.flush();
|
|
113
|
+
}
|
|
114
|
+
notifyToolCancelled(reason) {
|
|
115
|
+
this.notify("ui/notifications/tool-cancelled", { reason });
|
|
116
|
+
}
|
|
117
|
+
updateHostContext(patch) {
|
|
118
|
+
this.hostContext = { ...this.hostContext, ...patch };
|
|
119
|
+
if (this.initialized)
|
|
120
|
+
this.notify("ui/notifications/host-context-changed", patch);
|
|
121
|
+
}
|
|
122
|
+
/** Ask the view to tear down; resolves when it answers or after `timeoutMs`. */
|
|
123
|
+
async teardown(timeoutMs = 500) {
|
|
124
|
+
if (this.closed)
|
|
125
|
+
return;
|
|
126
|
+
if (this.initialized) {
|
|
127
|
+
await Promise.race([
|
|
128
|
+
this.request("ui/resource-teardown", {}).catch(() => undefined),
|
|
129
|
+
new Promise((r) => setTimeout(r, timeoutMs)),
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
this.close();
|
|
133
|
+
}
|
|
134
|
+
close() {
|
|
135
|
+
this.closed = true;
|
|
136
|
+
for (const p of this.pending.values())
|
|
137
|
+
p.reject(new Error("bridge closed"));
|
|
138
|
+
this.pending.clear();
|
|
139
|
+
}
|
|
140
|
+
// ── view → host ─────────────────────────────────────────────────────────
|
|
141
|
+
/** Feed one message received from the view. Non-JSON-RPC traffic is ignored. */
|
|
142
|
+
onMessage(data) {
|
|
143
|
+
if (this.closed || !isRecord(data) || data.jsonrpc !== "2.0")
|
|
144
|
+
return;
|
|
145
|
+
if ("method" in data && typeof data.method === "string") {
|
|
146
|
+
if ("id" in data && (typeof data.id === "string" || typeof data.id === "number")) {
|
|
147
|
+
void this.handleRequest(data);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this.handleNotification(data);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if ("id" in data && (typeof data.id === "string" || typeof data.id === "number")) {
|
|
155
|
+
const pending = this.pending.get(data.id);
|
|
156
|
+
if (!pending)
|
|
157
|
+
return;
|
|
158
|
+
this.pending.delete(data.id);
|
|
159
|
+
const res = data;
|
|
160
|
+
if (res.error)
|
|
161
|
+
pending.reject(new Error(res.error.message));
|
|
162
|
+
else
|
|
163
|
+
pending.resolve(res.result);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async handleRequest(req) {
|
|
167
|
+
const params = isRecord(req.params) ? req.params : {};
|
|
168
|
+
try {
|
|
169
|
+
switch (req.method) {
|
|
170
|
+
case "ui/initialize": {
|
|
171
|
+
const requested = typeof params.protocolVersion === "string" ? params.protocolVersion : MCP_APPS_PROTOCOL_VERSION;
|
|
172
|
+
this.respond(req.id, {
|
|
173
|
+
protocolVersion: requested,
|
|
174
|
+
hostInfo: this.hostInfo,
|
|
175
|
+
hostCapabilities: {
|
|
176
|
+
openLinks: {},
|
|
177
|
+
serverTools: {},
|
|
178
|
+
message: { text: {} },
|
|
179
|
+
updateModelContext: { text: {}, structuredContent: {} },
|
|
180
|
+
logging: {},
|
|
181
|
+
},
|
|
182
|
+
hostContext: this.hostContext,
|
|
183
|
+
});
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
case "ping":
|
|
187
|
+
this.respond(req.id, {});
|
|
188
|
+
return;
|
|
189
|
+
case "tools/call": {
|
|
190
|
+
if (typeof params.name !== "string" || !params.name) {
|
|
191
|
+
this.error(req.id, ERR.invalidParams, "`name` is required");
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const args = isRecord(params.arguments) ? params.arguments : {};
|
|
195
|
+
const meta = isRecord(params._meta) ? params._meta : undefined;
|
|
196
|
+
const result = await this.handlers.callTool({
|
|
197
|
+
name: params.name,
|
|
198
|
+
arguments: args,
|
|
199
|
+
...(meta ? { _meta: meta } : {}),
|
|
200
|
+
});
|
|
201
|
+
this.respond(req.id, result);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
case "ui/message": {
|
|
205
|
+
const text = extractMessageText(params, this.maxMessageChars);
|
|
206
|
+
if (!text) {
|
|
207
|
+
this.error(req.id, ERR.invalidParams, "ui/message needs text content");
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const accepted = await this.handlers.sendMessage(text);
|
|
211
|
+
this.respond(req.id, accepted ? {} : { isError: true });
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
case "ui/update-model-context": {
|
|
215
|
+
this.handlers.updateModelContext?.({
|
|
216
|
+
content: params.content,
|
|
217
|
+
structuredContent: params.structuredContent,
|
|
218
|
+
});
|
|
219
|
+
this.respond(req.id, {});
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
case "ui/open-link": {
|
|
223
|
+
const ok = isOpenableUrl(params.url) && (this.handlers.openLink?.(params.url) ?? false);
|
|
224
|
+
this.respond(req.id, ok ? {} : { isError: true });
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
case "ui/request-display-mode":
|
|
228
|
+
// Inline only in v1; the host has final authority per spec.
|
|
229
|
+
this.respond(req.id, { mode: "inline" });
|
|
230
|
+
return;
|
|
231
|
+
default:
|
|
232
|
+
this.error(req.id, ERR.methodNotFound, `${req.method} is not supported by this host`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch (err) {
|
|
236
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
237
|
+
this.handlers.onError?.(err instanceof Error ? err : new Error(message));
|
|
238
|
+
// A refused/failed tool call is still a well-formed JSON-RPC error; the
|
|
239
|
+
// view decides how to show it.
|
|
240
|
+
this.error(req.id, ERR.internal, message);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
handleNotification(n) {
|
|
244
|
+
const params = isRecord(n.params) ? n.params : {};
|
|
245
|
+
switch (n.method) {
|
|
246
|
+
case "ui/notifications/initialized":
|
|
247
|
+
this.initialized = true;
|
|
248
|
+
this.handlers.onInitialized?.();
|
|
249
|
+
this.flush();
|
|
250
|
+
return;
|
|
251
|
+
case "ui/notifications/size-changed":
|
|
252
|
+
this.handlers.onSizeChange?.({
|
|
253
|
+
...(typeof params.width === "number" ? { width: params.width } : {}),
|
|
254
|
+
...(typeof params.height === "number" ? { height: params.height } : {}),
|
|
255
|
+
});
|
|
256
|
+
return;
|
|
257
|
+
case "notifications/message":
|
|
258
|
+
this.handlers.onLog?.(params);
|
|
259
|
+
return;
|
|
260
|
+
default:
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// ── plumbing ────────────────────────────────────────────────────────────
|
|
265
|
+
flush() {
|
|
266
|
+
if (!this.initialized || this.closed)
|
|
267
|
+
return;
|
|
268
|
+
if (this.toolInput !== undefined && !this.toolInputSent) {
|
|
269
|
+
this.notify("ui/notifications/tool-input", { arguments: this.toolInput });
|
|
270
|
+
this.toolInputSent = true;
|
|
271
|
+
}
|
|
272
|
+
if (this.toolResult !== undefined && !this.toolResultSent) {
|
|
273
|
+
this.notify("ui/notifications/tool-result", this.toolResult);
|
|
274
|
+
this.toolResultSent = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
notify(method, params) {
|
|
278
|
+
if (this.closed)
|
|
279
|
+
return;
|
|
280
|
+
this.post({ jsonrpc: "2.0", method, params });
|
|
281
|
+
}
|
|
282
|
+
request(method, params) {
|
|
283
|
+
const id = this.nextId++;
|
|
284
|
+
return new Promise((resolve, reject) => {
|
|
285
|
+
this.pending.set(id, { resolve, reject });
|
|
286
|
+
this.post({ jsonrpc: "2.0", id, method, params });
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
respond(id, result) {
|
|
290
|
+
if (this.closed)
|
|
291
|
+
return;
|
|
292
|
+
this.post({ jsonrpc: "2.0", id, result });
|
|
293
|
+
}
|
|
294
|
+
error(id, code, message) {
|
|
295
|
+
if (this.closed)
|
|
296
|
+
return;
|
|
297
|
+
this.post({ jsonrpc: "2.0", id, error: { code, message } });
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=hostBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostBridge.js","sourceRoot":"","sources":["../../../src/mcpApps/hostBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,YAAY,CAAA;AA+DrD,MAAM,GAAG,GAAG,EAAE,cAAc,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAW,CAAA;AAChH,MAAM,yBAAyB,GAAG,IAAI,CAAA;AACtC,6DAA6D;AAC7D,4CAA4C;AAC5C,MAAM,aAAa,GAAG,iDAAiD,CAAA;AAEvE,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAe,EAAE,QAAQ,GAAG,yBAAyB;IACtF,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,IAAI,IAAI,GAAkB,IAAI,CAAA;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,IAAI,GAAG,MAAM,CAAC,OAAO;aAClB,MAA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AO,CAAC,MAAc,EAAE,MAAe;QAC7C,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;YACzC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,OAAO,CAAC,EAAmB,EAAE,MAAe;QAClD,IAAI,IAAI,CAAC,MAAM;YAAE,OAAM;QACvB,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;IAC3C,CAAC;IAEO,KAAK,CAAC,EAAmB,EAAE,IAAY,EAAE,OAAe;QAC9D,IAAI,IAAI,CAAC,MAAM;YAAE,OAAM;QACvB,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAA;IAC7D,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darqlabs/curator-sdk-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Official React components for Curator — drop-in chat widget and headless hook backed by @darqlabs/curator-sdk.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@assistant-ui/react": "^0.15.16",
|
|
31
|
-
"react-markdown": "^10.0.0"
|
|
31
|
+
"react-markdown": "^10.0.0",
|
|
32
|
+
"safe-content-frame": "0.0.27"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"react": "^18.0.0 || ^19.0.0",
|
|
35
36
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
36
|
-
"@darqlabs/curator-sdk": "^0.
|
|
37
|
+
"@darqlabs/curator-sdk": "^0.8.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@testing-library/react": "^16.1.0",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"react-dom": "^18.3.0",
|
|
47
48
|
"ts-jest": "^29.4.9",
|
|
48
49
|
"typescript": "^5.9.3",
|
|
49
|
-
"@darqlabs/curator-sdk": "^0.
|
|
50
|
+
"@darqlabs/curator-sdk": "^0.8.0"
|
|
50
51
|
},
|
|
51
52
|
"keywords": [
|
|
52
53
|
"curator",
|