@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.d.mts
CHANGED
|
@@ -2404,6 +2404,12 @@ type PrivateRoomApi = {
|
|
|
2404
2404
|
}>;
|
|
2405
2405
|
getTextVersion(versionId: string): Promise<Response>;
|
|
2406
2406
|
createTextVersion(): Promise<void>;
|
|
2407
|
+
executeContextualPrompt(options: {
|
|
2408
|
+
prompt: string;
|
|
2409
|
+
selectionText: string;
|
|
2410
|
+
context: string;
|
|
2411
|
+
signal: AbortSignal;
|
|
2412
|
+
}): Promise<string>;
|
|
2407
2413
|
simulate: {
|
|
2408
2414
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2409
2415
|
rawSend(data: string): void;
|
|
@@ -2617,6 +2623,13 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2617
2623
|
nonce: string | undefined;
|
|
2618
2624
|
messages: ClientMsg<P, E>[];
|
|
2619
2625
|
}): Promise<Response>;
|
|
2626
|
+
executeContextualPrompt({ roomId, selectionText, context, }: {
|
|
2627
|
+
roomId: string;
|
|
2628
|
+
prompt: string;
|
|
2629
|
+
selectionText: string;
|
|
2630
|
+
context: string;
|
|
2631
|
+
signal: AbortSignal;
|
|
2632
|
+
}): Promise<string>;
|
|
2620
2633
|
}
|
|
2621
2634
|
interface NotificationHttpApi<M extends BaseMetadata> {
|
|
2622
2635
|
getInboxNotifications(options?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -2404,6 +2404,12 @@ type PrivateRoomApi = {
|
|
|
2404
2404
|
}>;
|
|
2405
2405
|
getTextVersion(versionId: string): Promise<Response>;
|
|
2406
2406
|
createTextVersion(): Promise<void>;
|
|
2407
|
+
executeContextualPrompt(options: {
|
|
2408
|
+
prompt: string;
|
|
2409
|
+
selectionText: string;
|
|
2410
|
+
context: string;
|
|
2411
|
+
signal: AbortSignal;
|
|
2412
|
+
}): Promise<string>;
|
|
2407
2413
|
simulate: {
|
|
2408
2414
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2409
2415
|
rawSend(data: string): void;
|
|
@@ -2617,6 +2623,13 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2617
2623
|
nonce: string | undefined;
|
|
2618
2624
|
messages: ClientMsg<P, E>[];
|
|
2619
2625
|
}): Promise<Response>;
|
|
2626
|
+
executeContextualPrompt({ roomId, selectionText, context, }: {
|
|
2627
|
+
roomId: string;
|
|
2628
|
+
prompt: string;
|
|
2629
|
+
selectionText: string;
|
|
2630
|
+
context: string;
|
|
2631
|
+
signal: AbortSignal;
|
|
2632
|
+
}): Promise<string>;
|
|
2620
2633
|
}
|
|
2621
2634
|
interface NotificationHttpApi<M extends BaseMetadata> {
|
|
2622
2635
|
getInboxNotifications(options?: {
|
package/dist/index.js
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 = "cjs";
|
|
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 = _optionalChain([context, 'access', _141 => _141.dynamicSessionInfoSig, 'access', _142 => _142.get, 'call', _143 => _143(), 'optionalAccess', _144 => _144.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(),
|