@rool-dev/client 0.4.10 → 0.5.0-dev.9189ef4
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 +103 -31
- package/dist/client.d.ts +6 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +23 -6
- package/dist/client.js.map +1 -1
- package/dist/graphql.d.ts +12 -12
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +58 -50
- package/dist/graphql.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/space.d.ts +28 -5
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +78 -16
- package/dist/space.js.map +1 -1
- package/dist/subscription.d.ts +2 -1
- package/dist/subscription.d.ts.map +1 -1
- package/dist/subscription.js +4 -3
- package/dist/subscription.js.map +1 -1
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,47 +144,89 @@ const client = new RoolClient({
|
|
|
144
144
|
|
|
145
145
|
---
|
|
146
146
|
|
|
147
|
-
##
|
|
147
|
+
## Conversations and AI Context
|
|
148
148
|
|
|
149
|
-
Each `RoolSpace` instance has a `
|
|
149
|
+
Each `RoolSpace` instance has a `conversationId` that tracks conversation history with the AI for that space. Conversations are stored in the space data itself and sync in real-time to all clients. This enables interactive, multi-turn chat where you send only the new message each call (not the full transcript), and the conversation preserves prior turns for context.
|
|
150
150
|
|
|
151
151
|
AI operations (`prompt`, `createObject`, `updateObject`, `findObjects`) automatically receive:
|
|
152
152
|
|
|
153
|
-
- **Conversation history** — Previous prompts and responses from this
|
|
154
|
-
- **Recently modified objects** — Objects created or changed during this
|
|
153
|
+
- **Conversation history** — Previous prompts and responses from this conversation
|
|
154
|
+
- **Recently modified objects** — Objects created or changed during this conversation
|
|
155
155
|
- **Selected objects** — Objects passed via `objectIds` are given primary focus
|
|
156
156
|
|
|
157
157
|
This context flows automatically — no configuration needed. The AI sees enough history to maintain coherent interactions while respecting the `_`-prefixed field hiding rules.
|
|
158
158
|
|
|
159
|
-
###
|
|
159
|
+
### Accessing Conversation History
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
Conversations are stored in the space and accessible via the Space API:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
// Get messages for the current conversation
|
|
165
|
+
const messages = space.getConversation();
|
|
166
|
+
// Returns: ConversationMessage[]
|
|
167
|
+
|
|
168
|
+
// Get a specific conversation by ID
|
|
169
|
+
const conversation = space.getConversationById('other-conversation-id');
|
|
170
|
+
// Returns: Conversation | undefined
|
|
171
|
+
|
|
172
|
+
// List all conversation IDs in the space
|
|
173
|
+
const conversationIds = space.getConversationIds();
|
|
174
|
+
// Returns: string[]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Each message contains:
|
|
178
|
+
```typescript
|
|
179
|
+
interface ConversationMessage {
|
|
180
|
+
timestamp: number;
|
|
181
|
+
role: 'user' | 'assistant';
|
|
182
|
+
userId: string; // Who sent/triggered this message
|
|
183
|
+
content: string;
|
|
184
|
+
modifiedObjectIds: string[]; // Objects changed by this interaction
|
|
185
|
+
source: string; // Operation type: 'prompt', 'createObject', etc.
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Conversation Events
|
|
190
|
+
|
|
191
|
+
Listen for conversation updates:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
space.on('conversationUpdated', ({ conversationId, source }) => {
|
|
195
|
+
// Conversation changed - refresh from getConversation() if needed
|
|
196
|
+
const messages = space.getConversation();
|
|
197
|
+
renderMessages(messages);
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Conversation Isolation
|
|
202
|
+
|
|
203
|
+
By default, each call to `openSpace()` or `createSpace()` generates a new `conversationId`. This means:
|
|
204
|
+
- Opening a space twice gives you two independent AI conversation histories
|
|
163
205
|
- Closing and reopening a space starts fresh
|
|
164
206
|
|
|
165
|
-
### Resuming
|
|
207
|
+
### Resuming Conversations
|
|
166
208
|
|
|
167
|
-
Pass a `
|
|
209
|
+
Pass a `conversationId` to continue a previous conversation:
|
|
168
210
|
|
|
169
211
|
```typescript
|
|
170
|
-
// First
|
|
212
|
+
// First conversation - save the conversationId
|
|
171
213
|
const space = await client.openSpace('abc123');
|
|
172
|
-
const
|
|
214
|
+
const savedConversationId = space.conversationId;
|
|
173
215
|
space.close();
|
|
174
216
|
|
|
175
|
-
// Later - resume the same
|
|
176
|
-
const resumedSpace = await client.openSpace('abc123', {
|
|
177
|
-
// AI now has access to conversation history from
|
|
217
|
+
// Later - resume the same conversation
|
|
218
|
+
const resumedSpace = await client.openSpace('abc123', { conversationId: savedConversationId });
|
|
219
|
+
// AI now has access to conversation history from before
|
|
178
220
|
```
|
|
179
221
|
|
|
180
222
|
**Use cases:**
|
|
181
|
-
- **Page refresh** — Store `
|
|
182
|
-
- **Multiple
|
|
183
|
-
- **Collaborative
|
|
223
|
+
- **Page refresh** — Store `conversationId` in localStorage to maintain context across reloads
|
|
224
|
+
- **Multiple conversations** — Maintain and switch between different conversation contexts with the same space
|
|
225
|
+
- **Collaborative conversations** — Share a `conversationId` between users to enable shared AI conversation history
|
|
184
226
|
|
|
185
|
-
**Tip:** Use the user's id as `
|
|
227
|
+
**Tip:** Use the user's id as `conversationId` to share context across tabs/devices, or a fixed string like `'shared'` to share context across all users.
|
|
186
228
|
|
|
187
|
-
Note:
|
|
229
|
+
Note: Conversations are truncated to the most recent 50 messages per conversation to manage space size.
|
|
188
230
|
|
|
189
231
|
---
|
|
190
232
|
|
|
@@ -206,8 +248,8 @@ Note: Sessions are not persisted indefinitely server-side. For long-term context
|
|
|
206
248
|
| Method | Description |
|
|
207
249
|
|--------|-------------|
|
|
208
250
|
| `listSpaces(): Promise<RoolSpaceInfo[]>` | List available spaces |
|
|
209
|
-
| `openSpace(id, options?): Promise<RoolSpace>` | Open a space for editing. Options: `{
|
|
210
|
-
| `createSpace(name?, options?): Promise<RoolSpace>` | Create a new space. Options: `{
|
|
251
|
+
| `openSpace(id, options?): Promise<RoolSpace>` | Open a space for editing. Options: `{ conversationId?: string }` |
|
|
252
|
+
| `createSpace(name?, options?): Promise<RoolSpace>` | Create a new space. Options: `{ conversationId?: string }` |
|
|
211
253
|
| `deleteSpace(id): Promise<void>` | Delete a space |
|
|
212
254
|
|
|
213
255
|
### Current User
|
|
@@ -249,9 +291,17 @@ Spaces are first-class objects with built-in undo/redo, event emission, and real
|
|
|
249
291
|
| `id: string` | Space ID |
|
|
250
292
|
| `name: string` | Space name |
|
|
251
293
|
| `role: RoolUserRole` | User's role (`'owner' \| 'editor' \| 'viewer'`) |
|
|
252
|
-
| `
|
|
294
|
+
| `conversationId: string` | ID for AI conversation continuity (tracks message history) |
|
|
253
295
|
| `isReadOnly(): boolean` | True if viewer role |
|
|
254
296
|
|
|
297
|
+
### Conversation Access
|
|
298
|
+
|
|
299
|
+
| Method | Description |
|
|
300
|
+
|--------|-------------|
|
|
301
|
+
| `getConversation(): ConversationMessage[]` | Get messages for the current conversationId |
|
|
302
|
+
| `getConversationById(id): Conversation \| undefined` | Get a specific conversation by ID |
|
|
303
|
+
| `getConversationIds(): string[]` | List all conversation IDs in the space |
|
|
304
|
+
|
|
255
305
|
### Lifecycle
|
|
256
306
|
|
|
257
307
|
| Method | Description |
|
|
@@ -554,6 +604,9 @@ space.on('unlinked', ({ sourceId, relation, targetId, source }) => void)
|
|
|
554
604
|
// Space metadata
|
|
555
605
|
space.on('metadataUpdated', ({ metadata, source }) => void)
|
|
556
606
|
|
|
607
|
+
// Conversation history updated (fetch messages with getConversation())
|
|
608
|
+
space.on('conversationUpdated', ({ conversationId, source }) => void)
|
|
609
|
+
|
|
557
610
|
// Full state replacement (undo/redo, resync after error)
|
|
558
611
|
space.on('reset', ({ source }) => void)
|
|
559
612
|
|
|
@@ -601,6 +654,7 @@ interface RoolObject {
|
|
|
601
654
|
interface RoolSpaceData {
|
|
602
655
|
objects: Record<string, RoolObjectEntry>;
|
|
603
656
|
meta: Record<string, unknown>; // Space-level metadata
|
|
657
|
+
conversations?: Record<string, Conversation>; // AI conversation history
|
|
604
658
|
}
|
|
605
659
|
|
|
606
660
|
// Full stored object structure (for advanced use with getData())
|
|
@@ -610,6 +664,23 @@ interface RoolObjectEntry {
|
|
|
610
664
|
}
|
|
611
665
|
```
|
|
612
666
|
|
|
667
|
+
### Conversation Types
|
|
668
|
+
|
|
669
|
+
```typescript
|
|
670
|
+
interface ConversationMessage {
|
|
671
|
+
timestamp: number;
|
|
672
|
+
role: 'user' | 'assistant';
|
|
673
|
+
userId: string; // Who sent/triggered this message
|
|
674
|
+
content: string;
|
|
675
|
+
modifiedObjectIds: string[]; // Objects created/modified by this interaction
|
|
676
|
+
source: string; // Operation: 'prompt', 'createObject', 'updateObject', etc.
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
interface Conversation {
|
|
680
|
+
messages: ConversationMessage[];
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
613
684
|
### Info Types
|
|
614
685
|
|
|
615
686
|
```typescript
|
|
@@ -639,27 +710,28 @@ interface PromptOptions {
|
|
|
639
710
|
A Rool Space is a persistent, shared world model. Applications project different interaction patterns onto the same core primitives:
|
|
640
711
|
|
|
641
712
|
- **Objects and relations** store durable state
|
|
642
|
-
- **
|
|
643
|
-
- **
|
|
713
|
+
- **Conversations** store AI interaction history (prompts, responses, modified objects)
|
|
714
|
+
- **Events** describe what changed in real-time
|
|
644
715
|
|
|
645
716
|
Below are a few representative patterns.
|
|
646
717
|
|
|
647
718
|
### Chat With Generated Artifacts
|
|
648
719
|
|
|
649
720
|
- **Space**: documents, notes, images, tasks as objects
|
|
650
|
-
- **
|
|
651
|
-
- **UI**: renders
|
|
721
|
+
- **Conversation**: chat history stored in space, synced across clients
|
|
722
|
+
- **UI**: renders messages from `getConversation()`; derives artifact lists from object events
|
|
652
723
|
|
|
653
724
|
**Pattern**
|
|
654
|
-
- Chat is
|
|
725
|
+
- Chat is stored in space conversations and syncs in real-time
|
|
655
726
|
- Artifacts are persistent objects
|
|
727
|
+
- Listen to `conversationUpdated` to update chat UI
|
|
656
728
|
- Selecting objects defines the AI working set via `objectIds`
|
|
657
729
|
|
|
658
730
|
### Multi-User World / Text Adventure
|
|
659
731
|
|
|
660
732
|
- **Space**: rooms, items, NPCs, players as objects
|
|
661
733
|
- **Relations**: navigation, containment, location
|
|
662
|
-
- **
|
|
734
|
+
- **Conversation**: player commands and narrative continuity
|
|
663
735
|
|
|
664
736
|
**Pattern**
|
|
665
737
|
- The space is the shared world state
|
|
@@ -670,7 +742,7 @@ Below are a few representative patterns.
|
|
|
670
742
|
|
|
671
743
|
- **Space**: concepts, sources, hypotheses as objects
|
|
672
744
|
- **Relations**: semantic links between them
|
|
673
|
-
- **
|
|
745
|
+
- **Conversation**: exploratory analysis and questioning
|
|
674
746
|
|
|
675
747
|
**Pattern**
|
|
676
748
|
- Graph structure lives in relations
|
|
@@ -679,8 +751,8 @@ Below are a few representative patterns.
|
|
|
679
751
|
|
|
680
752
|
### Common Design Invariants
|
|
681
753
|
|
|
682
|
-
- Durable
|
|
683
|
-
-
|
|
754
|
+
- Durable content lives in space objects and relations
|
|
755
|
+
- Conversation history lives in space conversations (persistent, synced, truncated to 50 messages)
|
|
684
756
|
- UI state lives in the client, space metadata, or `_`-prefixed fields
|
|
685
757
|
- AI focus is controlled by object selection, not by replaying chat
|
|
686
758
|
|
package/dist/client.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
18
18
|
private authManager;
|
|
19
19
|
private graphqlClient;
|
|
20
20
|
private subscriptionManager;
|
|
21
|
+
private _userId;
|
|
21
22
|
private openSpaces;
|
|
22
23
|
constructor(config: RoolClientConfig);
|
|
23
24
|
/**
|
|
@@ -68,10 +69,10 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
68
69
|
* The space manages its own real-time subscription.
|
|
69
70
|
*
|
|
70
71
|
* @param spaceId - The ID of the space to open
|
|
71
|
-
* @param options.
|
|
72
|
+
* @param options.conversationId - Optional conversation ID for AI context continuity. If not provided, a new conversation is created.
|
|
72
73
|
*/
|
|
73
74
|
openSpace(spaceId: string, options?: {
|
|
74
|
-
|
|
75
|
+
conversationId?: string;
|
|
75
76
|
}): Promise<RoolSpace>;
|
|
76
77
|
/**
|
|
77
78
|
* Create a new space.
|
|
@@ -79,10 +80,10 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
79
80
|
* The space manages its own real-time subscription.
|
|
80
81
|
*
|
|
81
82
|
* @param name - Optional name for the space
|
|
82
|
-
* @param options.
|
|
83
|
+
* @param options.conversationId - Optional conversation ID for AI context continuity. If not provided, a new conversation is created.
|
|
83
84
|
*/
|
|
84
85
|
createSpace(name?: string, options?: {
|
|
85
|
-
|
|
86
|
+
conversationId?: string;
|
|
86
87
|
}): Promise<RoolSpace>;
|
|
87
88
|
/**
|
|
88
89
|
* Delete a space.
|
|
@@ -102,6 +103,7 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
102
103
|
/**
|
|
103
104
|
* Ensure the client-level event subscription is active.
|
|
104
105
|
* Called automatically when opening spaces.
|
|
106
|
+
* Also fetches and caches the current user ID.
|
|
105
107
|
* @internal
|
|
106
108
|
*/
|
|
107
109
|
private ensureSubscribed;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKlD,OAAO,EAAE,SAAS,EAAoB,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EAGb,WAAW,EACX,UAAU,EACV,QAAQ,EAET,MAAM,YAAY,CAAC;AAUpB;;;;;;;;;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|
|
25
25
|
graphqlClient;
|
|
26
26
|
subscriptionManager = null;
|
|
27
|
+
// Current user ID (fetched after auth, used for optimistic updates)
|
|
28
|
+
_userId = null;
|
|
27
29
|
// Registry of open spaces (for cleanup on logout/destroy)
|
|
28
30
|
openSpaces = new Map();
|
|
29
31
|
constructor(config) {
|
|
@@ -91,6 +93,7 @@ export class RoolClient extends EventEmitter {
|
|
|
91
93
|
logout() {
|
|
92
94
|
this.authManager.logout();
|
|
93
95
|
this.unsubscribe();
|
|
96
|
+
this._userId = null;
|
|
94
97
|
// Close all open spaces
|
|
95
98
|
for (const space of this.openSpaces.values()) {
|
|
96
99
|
space.close();
|
|
@@ -139,7 +142,7 @@ export class RoolClient extends EventEmitter {
|
|
|
139
142
|
* The space manages its own real-time subscription.
|
|
140
143
|
*
|
|
141
144
|
* @param spaceId - The ID of the space to open
|
|
142
|
-
* @param options.
|
|
145
|
+
* @param options.conversationId - Optional conversation ID for AI context continuity. If not provided, a new conversation is created.
|
|
143
146
|
*/
|
|
144
147
|
async openSpace(spaceId, options) {
|
|
145
148
|
// Ensure client subscription is active (for lifecycle events)
|
|
@@ -154,7 +157,8 @@ export class RoolClient extends EventEmitter {
|
|
|
154
157
|
name: spaceInfo?.name ?? spaceId,
|
|
155
158
|
role: spaceInfo?.role ?? 'viewer',
|
|
156
159
|
initialData: spaceData,
|
|
157
|
-
|
|
160
|
+
userId: this._userId ?? undefined,
|
|
161
|
+
conversationId: options?.conversationId,
|
|
158
162
|
graphqlClient: this.graphqlClient,
|
|
159
163
|
mediaClient: this.mediaClient,
|
|
160
164
|
graphqlUrl: this.urls.graphql,
|
|
@@ -171,7 +175,7 @@ export class RoolClient extends EventEmitter {
|
|
|
171
175
|
* The space manages its own real-time subscription.
|
|
172
176
|
*
|
|
173
177
|
* @param name - Optional name for the space
|
|
174
|
-
* @param options.
|
|
178
|
+
* @param options.conversationId - Optional conversation ID for AI context continuity. If not provided, a new conversation is created.
|
|
175
179
|
*/
|
|
176
180
|
async createSpace(name, options) {
|
|
177
181
|
// Ensure client subscription is active (for lifecycle events)
|
|
@@ -179,14 +183,15 @@ export class RoolClient extends EventEmitter {
|
|
|
179
183
|
const spaceId = generateEntityId();
|
|
180
184
|
const spaceName = name ?? spaceId;
|
|
181
185
|
const initialData = { objects: {}, meta: {} };
|
|
182
|
-
// Create on server with name (use a temporary
|
|
186
|
+
// Create on server with name (use a temporary conversationId for lifecycle ops)
|
|
183
187
|
await this.graphqlClient.createSpace(spaceId, spaceName, generateEntityId());
|
|
184
188
|
const space = new RoolSpace({
|
|
185
189
|
id: spaceId,
|
|
186
190
|
name: spaceName,
|
|
187
191
|
role: 'owner',
|
|
188
192
|
initialData,
|
|
189
|
-
|
|
193
|
+
userId: this._userId ?? undefined,
|
|
194
|
+
conversationId: options?.conversationId,
|
|
190
195
|
graphqlClient: this.graphqlClient,
|
|
191
196
|
mediaClient: this.mediaClient,
|
|
192
197
|
graphqlUrl: this.urls.graphql,
|
|
@@ -202,7 +207,7 @@ export class RoolClient extends EventEmitter {
|
|
|
202
207
|
* Note: This does not affect any open Space instances - they become stale.
|
|
203
208
|
*/
|
|
204
209
|
async deleteSpace(spaceId) {
|
|
205
|
-
// Use a temporary
|
|
210
|
+
// Use a temporary conversationId for lifecycle ops
|
|
206
211
|
await this.graphqlClient.deleteSpace(spaceId, generateEntityId());
|
|
207
212
|
// Client-level event will be emitted via SSE subscription
|
|
208
213
|
}
|
|
@@ -238,11 +243,23 @@ export class RoolClient extends EventEmitter {
|
|
|
238
243
|
/**
|
|
239
244
|
* Ensure the client-level event subscription is active.
|
|
240
245
|
* Called automatically when opening spaces.
|
|
246
|
+
* Also fetches and caches the current user ID.
|
|
241
247
|
* @internal
|
|
242
248
|
*/
|
|
243
249
|
async ensureSubscribed() {
|
|
244
250
|
if (this.subscriptionManager)
|
|
245
251
|
return;
|
|
252
|
+
// Fetch user ID if not already cached
|
|
253
|
+
if (!this._userId) {
|
|
254
|
+
try {
|
|
255
|
+
const user = await this.graphqlClient.getAccount();
|
|
256
|
+
this._userId = user.id;
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
// Non-fatal - will retry on next space open
|
|
260
|
+
console.warn('[RoolClient] Failed to fetch user ID:', error);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
246
263
|
this.subscriptionManager = new ClientSubscriptionManager({
|
|
247
264
|
graphqlUrl: this.urls.graphql,
|
|
248
265
|
authManager: this.authManager,
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAqBzD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,UAAW,SAAQ,YAA8B;IACpD,IAAI,CAAe;IACnB,WAAW,CAAc;IACzB,aAAa,CAAgB;IAC7B,mBAAmB,GAAqC,IAAI,CAAC;IAErE,0DAA0D;IAClD,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAElD,YAAY,MAAwB;QAClC,KAAK,EAAE,CAAC;QAER,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,0BAA0B;QAC9E,IAAI,CAAC,IAAI,GAAG;YACV,OAAO,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG,OAAO,UAAU;YAClD,KAAK,EAAE,MAAM,CAAC,QAAQ,IAAI,GA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@ export declare class GraphQLClient {
|
|
|
10
10
|
private get graphqlUrl();
|
|
11
11
|
listSpaces(): Promise<RoolSpaceInfo[]>;
|
|
12
12
|
getSpace(spaceId: string): Promise<RoolSpaceData>;
|
|
13
|
-
createSpace(spaceId: string, name: string,
|
|
14
|
-
deleteSpace(spaceId: string,
|
|
15
|
-
renameSpace(spaceId: string, name: string,
|
|
16
|
-
setSpace(spaceId: string, space: RoolSpaceData,
|
|
17
|
-
setSpaceMeta(spaceId: string, meta: Record<string, unknown>,
|
|
18
|
-
link(spaceId: string, source: string, relation: string, target: string,
|
|
19
|
-
unlink(spaceId: string, source: string, relation
|
|
20
|
-
deleteObjects(spaceId: string, ids: string[],
|
|
21
|
-
createObject(spaceId: string, data: Record<string, unknown>,
|
|
22
|
-
updateObject(spaceId: string, id: string,
|
|
23
|
-
findObjects(spaceId: string, options: FindObjectsOptions,
|
|
13
|
+
createSpace(spaceId: string, name: string, conversationId: string): Promise<void>;
|
|
14
|
+
deleteSpace(spaceId: string, conversationId: string): Promise<void>;
|
|
15
|
+
renameSpace(spaceId: string, name: string, conversationId: string): Promise<void>;
|
|
16
|
+
setSpace(spaceId: string, space: RoolSpaceData, conversationId: string, echoId: string): Promise<void>;
|
|
17
|
+
setSpaceMeta(spaceId: string, meta: Record<string, unknown>, conversationId: string): Promise<void>;
|
|
18
|
+
link(spaceId: string, source: string, relation: string, target: string, conversationId: string, echoId: string): Promise<void>;
|
|
19
|
+
unlink(spaceId: string, source: string, relation: string | undefined, target: string | undefined, conversationId: string, echoId: string): Promise<void>;
|
|
20
|
+
deleteObjects(spaceId: string, ids: string[], conversationId: string, echoId: string): Promise<void>;
|
|
21
|
+
createObject(spaceId: string, data: Record<string, unknown>, conversationId: string, echoId: string, prompt?: string): Promise<string>;
|
|
22
|
+
updateObject(spaceId: string, id: string, conversationId: string, echoId: string, data?: Record<string, unknown>, prompt?: string): Promise<string>;
|
|
23
|
+
findObjects(spaceId: string, options: FindObjectsOptions, conversationId: string, echoId: string): Promise<{
|
|
24
24
|
objects: RoolObject[];
|
|
25
25
|
message: string;
|
|
26
26
|
}>;
|
|
27
|
-
prompt(spaceId: string, prompt: string,
|
|
27
|
+
prompt(spaceId: string, prompt: string, conversationId: string, echoId: string, options?: PromptOptions): Promise<{
|
|
28
28
|
message: string;
|
|
29
29
|
modifiedObjectIds: string[];
|
|
30
30
|
}>;
|
package/dist/graphql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../src/graphql.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAa7C,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAOD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIvC,OAAO,KAAK,UAAU,GAErB;IAEK,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IActC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAejD,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../src/graphql.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAa7C,MAAM,WAAW,mBAAmB;IAClC,UAAU,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