@liveblocks/core 2.16.0 → 2.16.1-ai1
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.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "2.16.
|
|
9
|
+
var PKG_VERSION = "2.16.1-ai1";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -1556,6 +1556,25 @@ function createApiClient({
|
|
|
1556
1556
|
}
|
|
1557
1557
|
);
|
|
1558
1558
|
}
|
|
1559
|
+
async function executeContextualPrompt(options) {
|
|
1560
|
+
const result = await httpClient.post(
|
|
1561
|
+
url`/v2/c/rooms/${options.roomId}/ai/contextual-prompt`,
|
|
1562
|
+
await authManager.getAuthValue({
|
|
1563
|
+
requestedScope: "room:read",
|
|
1564
|
+
roomId: options.roomId
|
|
1565
|
+
}),
|
|
1566
|
+
{
|
|
1567
|
+
prompt: options.prompt,
|
|
1568
|
+
selectionText: options.selectionText,
|
|
1569
|
+
context: options.context
|
|
1570
|
+
},
|
|
1571
|
+
{ signal: options.signal }
|
|
1572
|
+
);
|
|
1573
|
+
if (!result || result.content.length === 0) {
|
|
1574
|
+
throw new Error("No content returned from server");
|
|
1575
|
+
}
|
|
1576
|
+
return result.content[0].text;
|
|
1577
|
+
}
|
|
1559
1578
|
async function listTextVersions(options) {
|
|
1560
1579
|
const result = await httpClient.get(
|
|
1561
1580
|
url`/v2/c/rooms/${options.roomId}/versions`,
|
|
@@ -1796,7 +1815,9 @@ function createApiClient({
|
|
|
1796
1815
|
deleteInboxNotification,
|
|
1797
1816
|
// User threads
|
|
1798
1817
|
getUserThreads_experimental,
|
|
1799
|
-
getUserThreadsSince_experimental
|
|
1818
|
+
getUserThreadsSince_experimental,
|
|
1819
|
+
// ai
|
|
1820
|
+
executeContextualPrompt
|
|
1800
1821
|
};
|
|
1801
1822
|
}
|
|
1802
1823
|
function getBearerTokenFromAuthValue(authValue) {
|
|
@@ -6589,6 +6610,12 @@ function createRoom(options, config) {
|
|
|
6589
6610
|
async function createTextVersion() {
|
|
6590
6611
|
return httpClient.createTextVersion({ roomId });
|
|
6591
6612
|
}
|
|
6613
|
+
async function executeContextualPrompt(options2) {
|
|
6614
|
+
return httpClient.executeContextualPrompt({
|
|
6615
|
+
roomId,
|
|
6616
|
+
...options2
|
|
6617
|
+
});
|
|
6618
|
+
}
|
|
6592
6619
|
function sendMessages(messages) {
|
|
6593
6620
|
const serializedPayload = JSON.stringify(messages);
|
|
6594
6621
|
const nonce = context.dynamicSessionInfoSig.get()?.nonce;
|
|
@@ -7573,6 +7600,8 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7573
7600
|
getTextVersion,
|
|
7574
7601
|
// create a version
|
|
7575
7602
|
createTextVersion,
|
|
7603
|
+
// execute contextual prompt
|
|
7604
|
+
executeContextualPrompt,
|
|
7576
7605
|
// Support for the Liveblocks browser extension
|
|
7577
7606
|
getSelf_forDevTools: () => selfAsTreeNode.get(),
|
|
7578
7607
|
getOthers_forDevTools: () => others_forDevTools.get(),
|