@rool-dev/sdk 0.2.0-dev.6769bdc → 0.2.0-dev.7f22925
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 +55 -53
- package/dist/channel.d.ts +14 -14
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +46 -46
- package/dist/channel.js.map +1 -1
- package/dist/client.d.ts +8 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -13
- package/dist/client.js.map +1 -1
- package/dist/graphql.d.ts +20 -20
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +71 -71
- 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 +8 -8
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +6 -6
- package/dist/space.js.map +1 -1
- package/dist/subscription.d.ts +7 -7
- package/dist/subscription.d.ts.map +1 -1
- package/dist/subscription.js +12 -12
- package/dist/subscription.js.map +1 -1
- package/dist/types.d.ts +17 -19
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Use Rool to programmatically instruct agents to generate content, research topic
|
|
|
8
8
|
|
|
9
9
|
**Core primitives:**
|
|
10
10
|
- **Spaces** — Containers for objects, schema, metadata, and channels
|
|
11
|
-
- **Channels** —
|
|
11
|
+
- **Channels** — Named contexts within a space, each with independent interaction history. All object and AI operations go through a channel.
|
|
12
12
|
- **Objects** — Key-value records with any fields you define. References between objects are data fields whose values are object IDs.
|
|
13
13
|
- **AI operations** — Create, update, or query objects using natural language and `{{placeholders}}`
|
|
14
14
|
|
|
@@ -82,7 +82,7 @@ channel.close();
|
|
|
82
82
|
|
|
83
83
|
### Spaces and Channels
|
|
84
84
|
|
|
85
|
-
A **space** is a container that holds objects, schema, metadata, and channels. A **channel** is a
|
|
85
|
+
A **space** is a container that holds objects, schema, metadata, and channels. A **channel** is a named context within a space — it's the handle you use for all object and AI operations. Each channel has its own interaction history.
|
|
86
86
|
|
|
87
87
|
There are two main handles:
|
|
88
88
|
- **`RoolSpace`** — Lightweight admin handle for user management, link access, channel management, and export. No real-time subscription.
|
|
@@ -95,15 +95,15 @@ await space.addUser(userId, 'editor');
|
|
|
95
95
|
await space.setLinkAccess('viewer');
|
|
96
96
|
|
|
97
97
|
// Open a channel for object and AI operations
|
|
98
|
-
const channel = await client.openChannel('space-id', 'my-
|
|
98
|
+
const channel = await client.openChannel('space-id', 'my-channel');
|
|
99
99
|
await channel.prompt('Create some planets');
|
|
100
100
|
|
|
101
101
|
// Or open a channel via the space handle
|
|
102
102
|
const channel2 = await space.openChannel('research');
|
|
103
|
-
await channel2.prompt('Analyze the data'); // Independent
|
|
103
|
+
await channel2.prompt('Analyze the data'); // Independent channel
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
The `
|
|
106
|
+
The `channelId` is fixed when you open a channel and cannot be changed. To use a different channel, open a new one. Both channels share the same objects and schema — only the interaction history differs.
|
|
107
107
|
|
|
108
108
|
### Objects & References
|
|
109
109
|
|
|
@@ -309,7 +309,7 @@ Returns a message (the AI's response) and the list of objects that were created
|
|
|
309
309
|
| `objectIds` | Limit context to specific objects |
|
|
310
310
|
| `responseSchema` | Request structured JSON instead of text summary |
|
|
311
311
|
| `effort` | Effort level: `'QUICK'`, `'STANDARD'` (default), `'REASONING'`, or `'RESEARCH'` |
|
|
312
|
-
| `ephemeral` | If true, don't record in
|
|
312
|
+
| `ephemeral` | If true, don't record in interaction history (useful for tab completion) |
|
|
313
313
|
| `readOnly` | If true, disable mutation tools (create, update, delete). Use for questions. |
|
|
314
314
|
| `attachments` | Files to attach (`File`, `Blob`, or `{ data, contentType }`). Uploaded to the media store via `uploadMedia()`. Resulting URLs are stored on the interaction's `attachments` field for UI rendering. **Currently only images are interpreted by the AI**; other file types are uploaded and stored but the AI cannot read their contents. |
|
|
315
315
|
|
|
@@ -382,7 +382,7 @@ console.log(result.categories, result.summary);
|
|
|
382
382
|
### Context Flow
|
|
383
383
|
|
|
384
384
|
AI operations automatically receive context:
|
|
385
|
-
- **Interaction history** — Previous interactions and their results from this channel
|
|
385
|
+
- **Interaction history** — Previous interactions and their results from this channel
|
|
386
386
|
- **Recently modified objects** — Objects created or changed recently
|
|
387
387
|
- **Selected objects** — Objects passed via `objectIds` are given primary focus
|
|
388
388
|
|
|
@@ -496,20 +496,20 @@ const client = new RoolClient({
|
|
|
496
496
|
|--------|-------------|
|
|
497
497
|
| `listSpaces(): Promise<RoolSpaceInfo[]>` | List available spaces |
|
|
498
498
|
| `openSpace(spaceId): Promise<RoolSpace>` | Open a space for admin operations (no real-time subscription) |
|
|
499
|
-
| `openChannel(spaceId,
|
|
499
|
+
| `openChannel(spaceId, channelId): Promise<RoolChannel>` | Open a channel on a space |
|
|
500
500
|
| `createSpace(name): Promise<RoolSpace>` | Create a new space, returns admin handle |
|
|
501
501
|
| `deleteSpace(id): Promise<void>` | Permanently delete a space (cannot be undone) |
|
|
502
502
|
| `importArchive(name, archive): Promise<RoolSpace>` | Import from a zip archive, creating a new space |
|
|
503
503
|
|
|
504
504
|
### Channel Management
|
|
505
505
|
|
|
506
|
-
Manage channels
|
|
506
|
+
Manage channels within a space. Available on both the client and space handles:
|
|
507
507
|
|
|
508
508
|
| Method | Description |
|
|
509
509
|
|--------|-------------|
|
|
510
510
|
| `client.renameChannel(spaceId, channelId, name): Promise<void>` | Rename a channel |
|
|
511
|
-
| `client.deleteChannel(spaceId, channelId): Promise<void>` | Delete a channel and its history |
|
|
512
|
-
| `space.getChannels():
|
|
511
|
+
| `client.deleteChannel(spaceId, channelId): Promise<void>` | Delete a channel and its interaction history |
|
|
512
|
+
| `space.getChannels(): ChannelInfo[]` | List channels (from cached snapshot) |
|
|
513
513
|
| `space.deleteChannel(channelId): Promise<void>` | Delete a channel |
|
|
514
514
|
| `channel.rename(name): Promise<void>` | Rename the current channel |
|
|
515
515
|
|
|
@@ -568,7 +568,7 @@ client.on('authStateChanged', (authenticated: boolean) => void)
|
|
|
568
568
|
client.on('spaceAdded', (space: RoolSpaceInfo) => void) // Space created or access granted
|
|
569
569
|
client.on('spaceRemoved', (spaceId: string) => void) // Space deleted or access revoked
|
|
570
570
|
client.on('spaceRenamed', (spaceId: string, newName: string) => void)
|
|
571
|
-
client.on('channelCreated', (spaceId: string, channel:
|
|
571
|
+
client.on('channelCreated', (spaceId: string, channel: ChannelInfo) => void)
|
|
572
572
|
client.on('channelRenamed', (spaceId: string, channelId: string, newName: string) => void)
|
|
573
573
|
client.on('channelDeleted', (spaceId: string, channelId: string) => void)
|
|
574
574
|
client.on('userStorageChanged', ({ key, value, source }: UserStorageChangedEvent) => void)
|
|
@@ -605,21 +605,21 @@ A space is a lightweight admin handle for space-level operations. It does not ha
|
|
|
605
605
|
|
|
606
606
|
| Method | Description |
|
|
607
607
|
|--------|-------------|
|
|
608
|
-
| `openChannel(
|
|
608
|
+
| `openChannel(channelId): Promise<RoolChannel>` | Open a channel on this space |
|
|
609
609
|
| `rename(newName): Promise<void>` | Rename this space |
|
|
610
610
|
| `delete(): Promise<void>` | Permanently delete this space |
|
|
611
611
|
| `listUsers(): Promise<SpaceMember[]>` | List users with access |
|
|
612
612
|
| `addUser(userId, role): Promise<void>` | Add user to space |
|
|
613
613
|
| `removeUser(userId): Promise<void>` | Remove user from space |
|
|
614
614
|
| `setLinkAccess(linkAccess): Promise<void>` | Set URL sharing level |
|
|
615
|
-
| `getChannels():
|
|
615
|
+
| `getChannels(): ChannelInfo[]` | List channels (from cached snapshot) |
|
|
616
616
|
| `deleteChannel(channelId): Promise<void>` | Delete a channel |
|
|
617
617
|
| `exportArchive(): Promise<Blob>` | Export space as zip archive |
|
|
618
618
|
| `refresh(): Promise<void>` | Refresh space data from server |
|
|
619
619
|
|
|
620
620
|
## RoolChannel API
|
|
621
621
|
|
|
622
|
-
A channel is a
|
|
622
|
+
A channel is a named context within a space. All object operations, AI prompts, and real-time sync go through a channel. The `channelId` is fixed at open time — to use a different channel, open a new one.
|
|
623
623
|
|
|
624
624
|
### Properties
|
|
625
625
|
|
|
@@ -630,7 +630,7 @@ A channel is a space + conversationId pair. All object operations, AI prompts, a
|
|
|
630
630
|
| `role: RoolUserRole` | User's role (`'owner' \| 'admin' \| 'editor' \| 'viewer'`) |
|
|
631
631
|
| `linkAccess: LinkAccess` | URL sharing level (`'none' \| 'viewer' \| 'editor'`) |
|
|
632
632
|
| `userId: string` | Current user's ID |
|
|
633
|
-
| `
|
|
633
|
+
| `channelId: string` | Channel ID (read-only, fixed at open time) |
|
|
634
634
|
| `isReadOnly: boolean` | True if viewer role |
|
|
635
635
|
|
|
636
636
|
### Lifecycle
|
|
@@ -638,7 +638,7 @@ A channel is a space + conversationId pair. All object operations, AI prompts, a
|
|
|
638
638
|
| Method | Description |
|
|
639
639
|
|--------|-------------|
|
|
640
640
|
| `close(): void` | Clean up resources and stop receiving updates |
|
|
641
|
-
| `rename(name): Promise<void>` | Rename this channel
|
|
641
|
+
| `rename(name): Promise<void>` | Rename this channel |
|
|
642
642
|
|
|
643
643
|
### Object Operations
|
|
644
644
|
|
|
@@ -659,7 +659,7 @@ Objects are plain key/value records. `id` is the only reserved field; everything
|
|
|
659
659
|
| Option | Description |
|
|
660
660
|
|--------|-------------|
|
|
661
661
|
| `data` | Object data fields (required). Include `id` to use a custom ID. Use `{{placeholder}}` for AI-generated content. Fields prefixed with `_` are hidden from AI. |
|
|
662
|
-
| `ephemeral` | If true, the operation won't be recorded in
|
|
662
|
+
| `ephemeral` | If true, the operation won't be recorded in interaction history. Useful for transient operations. |
|
|
663
663
|
|
|
664
664
|
#### updateObject Options
|
|
665
665
|
|
|
@@ -667,7 +667,7 @@ Objects are plain key/value records. `id` is the only reserved field; everything
|
|
|
667
667
|
|--------|-------------|
|
|
668
668
|
| `data` | Fields to add or update. Pass `null`/`undefined` to delete a field. Use `{{placeholder}}` for AI-generated content. Fields prefixed with `_` are hidden from AI. |
|
|
669
669
|
| `prompt` | Natural language instruction for AI to modify content. |
|
|
670
|
-
| `ephemeral` | If true, the operation won't be recorded in
|
|
670
|
+
| `ephemeral` | If true, the operation won't be recorded in interaction history. Useful for transient operations. |
|
|
671
671
|
|
|
672
672
|
#### findObjects Options
|
|
673
673
|
|
|
@@ -684,7 +684,7 @@ Find objects using structured filters and/or natural language.
|
|
|
684
684
|
| `limit` | Maximum number of results. |
|
|
685
685
|
| `objectIds` | Scope to specific object IDs. Constrains the candidate set in both structured and AI queries. |
|
|
686
686
|
| `order` | Sort order by modifiedAt: `'asc'` or `'desc'` (default: `'desc'`). |
|
|
687
|
-
| `ephemeral` | If true, the query won't be recorded in
|
|
687
|
+
| `ephemeral` | If true, the query won't be recorded in interaction history. Useful for responsive search. |
|
|
688
688
|
|
|
689
689
|
**Examples:**
|
|
690
690
|
|
|
@@ -818,7 +818,7 @@ Export and import space data as zip archives for backup, portability, or migrati
|
|
|
818
818
|
|
|
819
819
|
| Method | Description |
|
|
820
820
|
|--------|-------------|
|
|
821
|
-
| `space.exportArchive(): Promise<Blob>` | Export objects, metadata,
|
|
821
|
+
| `space.exportArchive(): Promise<Blob>` | Export objects, metadata, channels, and media as a zip archive |
|
|
822
822
|
| `client.importArchive(name, archive): Promise<RoolSpace>` | Import from a zip archive, creating a new space |
|
|
823
823
|
|
|
824
824
|
**Export:**
|
|
@@ -835,7 +835,7 @@ const space = await client.importArchive('Imported Data', archiveBlob);
|
|
|
835
835
|
const channel = await space.openChannel('main');
|
|
836
836
|
```
|
|
837
837
|
|
|
838
|
-
The archive format bundles `data.json` (with objects, metadata, and
|
|
838
|
+
The archive format bundles `data.json` (with objects, metadata, and channels) and a `media/` folder containing all media files. Media URLs are rewritten to relative paths within the archive and restored on import.
|
|
839
839
|
|
|
840
840
|
### Channel Events
|
|
841
841
|
|
|
@@ -856,8 +856,8 @@ channel.on('objectDeleted', ({ objectId, source }) => void)
|
|
|
856
856
|
// Space metadata
|
|
857
857
|
channel.on('metadataUpdated', ({ metadata, source }) => void)
|
|
858
858
|
|
|
859
|
-
//
|
|
860
|
-
channel.on('
|
|
859
|
+
// Channel updated (fetch with getInteractions())
|
|
860
|
+
channel.on('channelUpdated', ({ channelId, source }) => void)
|
|
861
861
|
|
|
862
862
|
// Full state replacement (undo/redo, resync after error)
|
|
863
863
|
channel.on('reset', ({ source }) => void)
|
|
@@ -884,13 +884,13 @@ try {
|
|
|
884
884
|
|
|
885
885
|
## Interaction History
|
|
886
886
|
|
|
887
|
-
Each channel has a `
|
|
887
|
+
Each channel has a `channelId` that identifies it. The history records all meaningful interactions (prompts, object mutations) as self-contained entries, each capturing the request and its result. History is stored in the space data itself and syncs in real-time to all clients.
|
|
888
888
|
|
|
889
889
|
### What the AI Receives
|
|
890
890
|
|
|
891
891
|
AI operations (`prompt`, `createObject`, `updateObject`, `findObjects`) automatically receive:
|
|
892
892
|
|
|
893
|
-
- **Interaction history** — Previous interactions and their results from this channel
|
|
893
|
+
- **Interaction history** — Previous interactions and their results from this channel
|
|
894
894
|
- **Recently modified objects** — Objects in the space recently created or changed
|
|
895
895
|
- **Selected objects** — Objects passed via `objectIds` are given primary focus
|
|
896
896
|
|
|
@@ -899,24 +899,24 @@ This context flows automatically — no configuration needed. The AI sees enough
|
|
|
899
899
|
### Accessing History
|
|
900
900
|
|
|
901
901
|
```typescript
|
|
902
|
-
// Get interactions for this channel
|
|
902
|
+
// Get interactions for this channel
|
|
903
903
|
const interactions = channel.getInteractions();
|
|
904
904
|
// Returns: Interaction[]
|
|
905
905
|
```
|
|
906
906
|
|
|
907
|
-
###
|
|
907
|
+
### Channel History Methods
|
|
908
908
|
|
|
909
909
|
| Method | Description |
|
|
910
910
|
|--------|-------------|
|
|
911
|
-
| `getInteractions(): Interaction[]` | Get interactions for this channel
|
|
912
|
-
| `getSystemInstruction(): string \| undefined` | Get system instruction for this
|
|
913
|
-
| `setSystemInstruction(instruction): Promise<void>` | Set system instruction for this
|
|
911
|
+
| `getInteractions(): Interaction[]` | Get interactions for this channel |
|
|
912
|
+
| `getSystemInstruction(): string \| undefined` | Get system instruction for this channel |
|
|
913
|
+
| `setSystemInstruction(instruction): Promise<void>` | Set system instruction for this channel. Pass `null` to clear. |
|
|
914
914
|
|
|
915
915
|
Channel management (listing, renaming, deleting channels) is done via the client — see [Channel Management](#channel-management).
|
|
916
916
|
|
|
917
917
|
### System Instructions
|
|
918
918
|
|
|
919
|
-
System instructions customize how the AI behaves within a
|
|
919
|
+
System instructions customize how the AI behaves within a channel. The instruction persists across all prompts in that channel.
|
|
920
920
|
|
|
921
921
|
```typescript
|
|
922
922
|
// Make the AI behave like an SQL interpreter
|
|
@@ -943,19 +943,19 @@ System instructions are useful for:
|
|
|
943
943
|
### Listening for Updates
|
|
944
944
|
|
|
945
945
|
```typescript
|
|
946
|
-
channel.on('
|
|
947
|
-
//
|
|
946
|
+
channel.on('channelUpdated', ({ channelId, source }) => {
|
|
947
|
+
// Channel updated - refresh if needed
|
|
948
948
|
const interactions = channel.getInteractions();
|
|
949
949
|
renderInteractions(interactions);
|
|
950
950
|
});
|
|
951
951
|
```
|
|
952
952
|
|
|
953
|
-
### Multiple
|
|
953
|
+
### Multiple Channels
|
|
954
954
|
|
|
955
|
-
Each channel
|
|
955
|
+
Each channel has its own interaction history. To work with multiple independent histories on the same space, open multiple channels:
|
|
956
956
|
|
|
957
957
|
```typescript
|
|
958
|
-
// Open two channels on the same space
|
|
958
|
+
// Open two channels on the same space
|
|
959
959
|
const research = await client.openChannel('space-id', 'research');
|
|
960
960
|
const main = await client.openChannel('space-id', 'main');
|
|
961
961
|
|
|
@@ -969,11 +969,11 @@ main.close();
|
|
|
969
969
|
```
|
|
970
970
|
|
|
971
971
|
**Use cases:**
|
|
972
|
-
- **Chat app with sidebar** — Each sidebar entry is a channel with a different
|
|
973
|
-
- **Page refresh** — Store the
|
|
974
|
-
- **Collaborative
|
|
972
|
+
- **Chat app with sidebar** — Each sidebar entry is a channel with a different channelId
|
|
973
|
+
- **Page refresh** — Store the channelId in localStorage to resume the same channel
|
|
974
|
+
- **Collaborative channels** — Share a channelId between users to enable shared AI interaction history
|
|
975
975
|
|
|
976
|
-
**Tip:** Use the user's id as
|
|
976
|
+
**Tip:** Use the user's id as channelId to share context across tabs/devices, or a fixed string like `'shared'` to share context across all users.
|
|
977
977
|
|
|
978
978
|
Note: Interaction history is truncated to the most recent 50 entries to manage space size.
|
|
979
979
|
|
|
@@ -985,7 +985,7 @@ The `ai` field in interactions distinguishes AI-generated responses from synthet
|
|
|
985
985
|
|
|
986
986
|
### Tool Calls
|
|
987
987
|
|
|
988
|
-
The `toolCalls` array captures what the AI agent did during execution. Use it to build responsive UIs that show progress while the agent works — the `
|
|
988
|
+
The `toolCalls` array captures what the AI agent did during execution. Use it to build responsive UIs that show progress while the agent works — the `channelUpdated` event fires as each tool completes, letting you display status updates or hints in real-time.
|
|
989
989
|
|
|
990
990
|
## Data Types
|
|
991
991
|
|
|
@@ -1036,21 +1036,21 @@ interface RoolObjectStat {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
```
|
|
1038
1038
|
|
|
1039
|
-
###
|
|
1039
|
+
### Channels
|
|
1040
1040
|
|
|
1041
1041
|
```typescript
|
|
1042
|
-
//
|
|
1043
|
-
interface
|
|
1044
|
-
name?: string; //
|
|
1045
|
-
createdAt: number; // Timestamp when
|
|
1046
|
-
createdBy: string; // User ID who created the
|
|
1042
|
+
// Channel container with metadata
|
|
1043
|
+
interface Channel {
|
|
1044
|
+
name?: string; // Channel name (optional)
|
|
1045
|
+
createdAt: number; // Timestamp when channel was created
|
|
1046
|
+
createdBy: string; // User ID who created the channel
|
|
1047
1047
|
createdByName?: string; // Display name at time of creation
|
|
1048
1048
|
systemInstruction?: string; // Custom system instruction for AI
|
|
1049
1049
|
interactions: Interaction[]; // Interaction history
|
|
1050
1050
|
}
|
|
1051
1051
|
|
|
1052
|
-
//
|
|
1053
|
-
interface
|
|
1052
|
+
// Channel summary info (returned by client.getChannels)
|
|
1053
|
+
interface ChannelInfo {
|
|
1054
1054
|
id: string;
|
|
1055
1055
|
name: string | null;
|
|
1056
1056
|
createdAt: number;
|
|
@@ -1060,6 +1060,8 @@ interface ConversationInfo {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
```
|
|
1062
1062
|
|
|
1063
|
+
Note: `Channel` and `ChannelInfo` are data types describing the stored channel metadata. The `Channel` interface is the wire format; `RoolChannel` is the live SDK class you interact with.
|
|
1064
|
+
|
|
1063
1065
|
### Interaction Types
|
|
1064
1066
|
|
|
1065
1067
|
```typescript
|
|
@@ -1108,7 +1110,7 @@ interface PromptOptions {
|
|
|
1108
1110
|
objectIds?: string[]; // Scope to specific objects
|
|
1109
1111
|
responseSchema?: Record<string, unknown>;
|
|
1110
1112
|
effort?: PromptEffort; // Effort level (default: 'STANDARD')
|
|
1111
|
-
ephemeral?: boolean; // Don't record in
|
|
1113
|
+
ephemeral?: boolean; // Don't record in interaction history
|
|
1112
1114
|
readOnly?: boolean; // Disable mutation tools (default: false)
|
|
1113
1115
|
attachments?: Array<File | Blob | { data: string; contentType: string }>; // Files to attach (uploaded to media store)
|
|
1114
1116
|
}
|
|
@@ -1119,7 +1121,7 @@ interface PromptOptions {
|
|
|
1119
1121
|
A Rool Space is a persistent, shared world model. Applications project different interaction patterns onto the same core primitives:
|
|
1120
1122
|
|
|
1121
1123
|
- **Objects** store durable state, with references to other objects via data fields
|
|
1122
|
-
- **Channels** provide independent AI
|
|
1124
|
+
- **Channels** provide independent AI interaction contexts over shared objects
|
|
1123
1125
|
- **Events** describe what changed in real-time
|
|
1124
1126
|
|
|
1125
1127
|
Below are a few representative patterns.
|
|
@@ -1133,7 +1135,7 @@ Below are a few representative patterns.
|
|
|
1133
1135
|
**Pattern**
|
|
1134
1136
|
- Interaction history syncs in real-time; UI renders entries as chat bubbles
|
|
1135
1137
|
- Artifacts are persistent objects shared across all channels
|
|
1136
|
-
- Listen to `
|
|
1138
|
+
- Listen to `channelUpdated` event to update chat UI
|
|
1137
1139
|
- Selecting objects defines the AI working set via `objectIds`
|
|
1138
1140
|
|
|
1139
1141
|
### Multi-User World / Text Adventure
|
package/dist/channel.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { GraphQLClient } from './graphql.js';
|
|
|
3
3
|
import type { MediaClient } from './media.js';
|
|
4
4
|
import type { AuthManager } from './auth.js';
|
|
5
5
|
import type { Logger } from './logger.js';
|
|
6
|
-
import type { RoolObject, RoolObjectStat, ChannelEvents, RoolUserRole, PromptOptions, FindObjectsOptions, CreateObjectOptions, UpdateObjectOptions, MediaInfo, MediaResponse, Interaction,
|
|
6
|
+
import type { RoolObject, RoolObjectStat, ChannelEvents, RoolUserRole, PromptOptions, FindObjectsOptions, CreateObjectOptions, UpdateObjectOptions, MediaInfo, MediaResponse, Interaction, Channel, LinkAccess, SpaceSchema, CollectionDef, FieldDef } from './types.js';
|
|
7
7
|
export declare function generateEntityId(): string;
|
|
8
8
|
export interface ChannelConfig {
|
|
9
9
|
id: string;
|
|
@@ -20,10 +20,10 @@ export interface ChannelConfig {
|
|
|
20
20
|
schema: SpaceSchema;
|
|
21
21
|
/** Space metadata */
|
|
22
22
|
meta: Record<string, unknown>;
|
|
23
|
-
/** This channel's conversation (undefined if new) */
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
23
|
+
/** This channel's conversation data (undefined if new) */
|
|
24
|
+
channel: Channel | undefined;
|
|
25
|
+
/** Channel ID for this channel (required). */
|
|
26
|
+
channelId: string;
|
|
27
27
|
graphqlClient: GraphQLClient;
|
|
28
28
|
mediaClient: MediaClient;
|
|
29
29
|
graphqlUrl: string;
|
|
@@ -32,11 +32,11 @@ export interface ChannelConfig {
|
|
|
32
32
|
onClose: (spaceId: string) => void;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* A channel is a space +
|
|
35
|
+
* A channel is a space + channelId pair.
|
|
36
36
|
*
|
|
37
|
-
* All object operations go through a channel. The
|
|
38
|
-
* at open time and cannot be changed. To use a different
|
|
39
|
-
* open a second
|
|
37
|
+
* All object operations go through a channel. The channelId is fixed
|
|
38
|
+
* at open time and cannot be changed. To use a different channel,
|
|
39
|
+
* open a second one.
|
|
40
40
|
*
|
|
41
41
|
* Objects are fetched on demand from the server; only schema, metadata,
|
|
42
42
|
* and the channel's own conversation are cached locally. Object changes
|
|
@@ -55,7 +55,7 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
55
55
|
private _role;
|
|
56
56
|
private _linkAccess;
|
|
57
57
|
private _userId;
|
|
58
|
-
private
|
|
58
|
+
private _channelId;
|
|
59
59
|
private _closed;
|
|
60
60
|
private graphqlClient;
|
|
61
61
|
private mediaClient;
|
|
@@ -85,10 +85,10 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
85
85
|
/** Current user's ID (for identifying own interactions) */
|
|
86
86
|
get userId(): string;
|
|
87
87
|
/**
|
|
88
|
-
* Get the
|
|
88
|
+
* Get the channel ID for this channel.
|
|
89
89
|
* Fixed at open time — cannot be changed.
|
|
90
90
|
*/
|
|
91
|
-
get
|
|
91
|
+
get channelId(): string;
|
|
92
92
|
get isReadOnly(): boolean;
|
|
93
93
|
/**
|
|
94
94
|
* Get interactions for this channel's conversation.
|
|
@@ -290,10 +290,10 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
290
290
|
*/
|
|
291
291
|
private _deliverObject;
|
|
292
292
|
/**
|
|
293
|
-
* Handle a
|
|
293
|
+
* Handle a channel event from the subscription.
|
|
294
294
|
* @internal
|
|
295
295
|
*/
|
|
296
|
-
private
|
|
296
|
+
private handleChannelEvent;
|
|
297
297
|
/**
|
|
298
298
|
* Handle an object_created SSE event.
|
|
299
299
|
* Deduplicates against optimistic local creates.
|
package/dist/channel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KA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