@rool-dev/sdk 0.3.1-dev.fa375c5 → 0.3.2-dev.1f10ef1
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 +95 -154
- package/dist/apps.d.ts +1 -1
- package/dist/apps.d.ts.map +1 -1
- package/dist/apps.js +1 -5
- package/dist/apps.js.map +1 -1
- package/dist/channel.d.ts +135 -4
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +354 -32
- package/dist/channel.js.map +1 -1
- package/dist/client.d.ts +18 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +26 -7
- package/dist/client.js.map +1 -1
- package/dist/graphql.d.ts +18 -11
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +90 -31
- package/dist/graphql.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/space.d.ts +0 -1
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js.map +1 -1
- package/dist/subscription.d.ts.map +1 -1
- package/dist/subscription.js +23 -6
- package/dist/subscription.js.map +1 -1
- package/dist/types.d.ts +136 -25
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,18 +4,14 @@ The TypeScript SDK for Rool, a persistent and collaborative environment for orga
|
|
|
4
4
|
|
|
5
5
|
> **Building a new Rool app?** Start with [`@rool-dev/app`](/app/) — it handles hosting, dev server, and gives you a reactive Svelte channel out of the box. This SDK is for advanced use cases: integrating Rool into an existing application, building Node.js scripts, or working outside the app sandbox.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The SDK manages authentication, real-time synchronization, and media storage. Core primitives:
|
|
8
8
|
|
|
9
|
-
Use Rool to programmatically instruct agents to generate content, research topics, or reorganize data. The client manages authentication, real-time synchronization, and media storage, supporting both single-user and multi-user workflows.
|
|
10
|
-
|
|
11
|
-
**Core primitives:**
|
|
12
9
|
- **Spaces** — Containers for objects, schema, metadata, and channels
|
|
13
|
-
- **Channels** — Named contexts within a space
|
|
10
|
+
- **Channels** — Named contexts within a space. All object and AI operations go through a channel.
|
|
11
|
+
- **Conversations** — Independent interaction histories within a channel.
|
|
14
12
|
- **Objects** — Key-value records with any fields you define. References between objects are data fields whose values are object IDs.
|
|
15
13
|
- **AI operations** — Create, update, or query objects using natural language and `{{placeholders}}`
|
|
16
14
|
|
|
17
|
-
See [Patterns & Examples](#patterns--examples) for what you can build.
|
|
18
|
-
|
|
19
15
|
## Installation
|
|
20
16
|
|
|
21
17
|
```bash
|
|
@@ -84,7 +80,7 @@ channel.close();
|
|
|
84
80
|
|
|
85
81
|
### Spaces and Channels
|
|
86
82
|
|
|
87
|
-
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
|
|
83
|
+
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 contains one or more **conversations**, each with independent interaction history.
|
|
88
84
|
|
|
89
85
|
There are two main handles:
|
|
90
86
|
- **`RoolSpace`** — Lightweight admin handle for user management, link access, channel management, and export. No real-time subscription.
|
|
@@ -111,6 +107,40 @@ The `channelId` is fixed when you open a channel and cannot be changed. To use a
|
|
|
111
107
|
- 1–32 characters
|
|
112
108
|
- Only alphanumeric characters, hyphens (`-`), and underscores (`_`)
|
|
113
109
|
|
|
110
|
+
### Conversations
|
|
111
|
+
|
|
112
|
+
A **conversation** is a named interaction history within a channel. By default, all operations use the `'default'` conversation — most apps never need to think about conversations at all.
|
|
113
|
+
|
|
114
|
+
For apps that need multiple independent interaction threads (e.g., a chat sidebar with multiple threads), use `channel.conversation()` to get a handle scoped to a specific conversation:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// Default conversation — most apps use this
|
|
118
|
+
const channel = await client.openChannel('space-id', 'main');
|
|
119
|
+
await channel.prompt('Hello'); // Uses 'default' conversation
|
|
120
|
+
|
|
121
|
+
// Conversation handle — for multi-thread UIs
|
|
122
|
+
const thread = channel.conversation('thread-42');
|
|
123
|
+
await thread.prompt('Hello'); // Uses 'thread-42' conversation
|
|
124
|
+
thread.getInteractions(); // Interactions for thread-42 only
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Each conversation has its own interaction history and optional system instruction. Conversations are auto-created on first interaction — no explicit create step needed. The 50-message cap applies per conversation. All conversations share one SSE connection per channel.
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// System instructions are per-conversation
|
|
131
|
+
const thread = channel.conversation('research');
|
|
132
|
+
await thread.setSystemInstruction('Respond in haiku');
|
|
133
|
+
|
|
134
|
+
// List all conversations in this channel
|
|
135
|
+
const conversations = channel.getConversations();
|
|
136
|
+
|
|
137
|
+
// Delete a conversation (cannot delete 'default')
|
|
138
|
+
await channel.deleteConversation('old-thread');
|
|
139
|
+
|
|
140
|
+
// Rename a conversation
|
|
141
|
+
await thread.rename('Research Thread');
|
|
142
|
+
```
|
|
143
|
+
|
|
114
144
|
### Objects & References
|
|
115
145
|
|
|
116
146
|
**Objects** are plain key-value records. The `id` field is reserved; everything else is application-defined.
|
|
@@ -557,6 +587,19 @@ client.on('userStorageChanged', ({ key, value, source }) => {
|
|
|
557
587
|
});
|
|
558
588
|
```
|
|
559
589
|
|
|
590
|
+
### Apps
|
|
591
|
+
|
|
592
|
+
Publish, manage, and discover apps. See [`@rool-dev/app`](/app/) for building apps.
|
|
593
|
+
|
|
594
|
+
| Method | Description |
|
|
595
|
+
|--------|-------------|
|
|
596
|
+
| `publishApp(appId, options): Promise<PublishedAppInfo>` | Publish or update an app (`options.bundle`: zip with `index.html` and `rool-app.json`) |
|
|
597
|
+
| `unpublishApp(appId): Promise<void>` | Unpublish an app |
|
|
598
|
+
| `listApps(): Promise<PublishedAppInfo[]>` | List your own published apps |
|
|
599
|
+
| `getAppInfo(appId): Promise<PublishedAppInfo \| null>` | Get info for a specific app |
|
|
600
|
+
| `findApps(options?): Promise<PublishedAppInfo[]>` | Search public apps. Options: `query` (semantic search string), `limit` (default 20, max 100). Omit `query` to browse all. |
|
|
601
|
+
| `installApp(spaceId, appId, channelId?): Promise<string>` | Install an app into a space. Creates/updates a channel with the app's manifest settings (name, system instruction, collections). Returns the channel ID. Defaults `channelId` to `appId`. |
|
|
602
|
+
|
|
560
603
|
### Utilities
|
|
561
604
|
|
|
562
605
|
| Method | Description |
|
|
@@ -637,6 +680,7 @@ A channel is a named context within a space. All object operations, AI prompts,
|
|
|
637
680
|
| `userId: string` | Current user's ID |
|
|
638
681
|
| `channelId: string` | Channel ID (read-only, fixed at open time) |
|
|
639
682
|
| `isReadOnly: boolean` | True if viewer role |
|
|
683
|
+
| `appUrl: string \| null` | URL of the installed app, or null if this is a plain channel |
|
|
640
684
|
|
|
641
685
|
### Lifecycle
|
|
642
686
|
|
|
@@ -644,6 +688,7 @@ A channel is a named context within a space. All object operations, AI prompts,
|
|
|
644
688
|
|--------|-------------|
|
|
645
689
|
| `close(): void` | Clean up resources and stop receiving updates |
|
|
646
690
|
| `rename(name): Promise<void>` | Rename this channel |
|
|
691
|
+
| `conversation(conversationId): ConversationHandle` | Get a handle scoped to a specific conversation (see [Conversations](#conversations)) |
|
|
647
692
|
|
|
648
693
|
### Object Operations
|
|
649
694
|
|
|
@@ -877,9 +922,12 @@ channel.on('metadataUpdated', ({ metadata, source }) => void)
|
|
|
877
922
|
// Collection schema changed
|
|
878
923
|
channel.on('schemaUpdated', ({ schema, source }) => void)
|
|
879
924
|
|
|
880
|
-
// Channel updated (
|
|
925
|
+
// Channel metadata updated (name, appUrl)
|
|
881
926
|
channel.on('channelUpdated', ({ channelId, source }) => void)
|
|
882
927
|
|
|
928
|
+
// Conversation interaction history updated
|
|
929
|
+
channel.on('conversationUpdated', ({ conversationId, channelId, source }) => void)
|
|
930
|
+
|
|
883
931
|
// Full state replacement (undo/redo, resync after error)
|
|
884
932
|
channel.on('reset', ({ source }) => void)
|
|
885
933
|
|
|
@@ -905,99 +953,21 @@ try {
|
|
|
905
953
|
|
|
906
954
|
## Interaction History
|
|
907
955
|
|
|
908
|
-
Each channel
|
|
956
|
+
Each channel contains one or more conversations, each with its own interaction history. History is stored in the space data and syncs in real-time. Truncated to the most recent 50 entries per conversation.
|
|
909
957
|
|
|
910
|
-
###
|
|
911
|
-
|
|
912
|
-
AI operations (`prompt`, `createObject`, `updateObject`, `findObjects`) automatically receive:
|
|
913
|
-
|
|
914
|
-
- **Interaction history** — Previous interactions and their results from this channel
|
|
915
|
-
- **Recently modified objects** — Objects in the space recently created or changed
|
|
916
|
-
- **Selected objects** — Objects passed via `objectIds` are given primary focus
|
|
917
|
-
|
|
918
|
-
This context flows automatically — no configuration needed. The AI sees enough history to maintain coherent interactions while respecting the `_`-prefixed field hiding rules.
|
|
919
|
-
|
|
920
|
-
### Accessing History
|
|
921
|
-
|
|
922
|
-
```typescript
|
|
923
|
-
// Get interactions for this channel
|
|
924
|
-
const interactions = channel.getInteractions();
|
|
925
|
-
// Returns: Interaction[]
|
|
926
|
-
```
|
|
927
|
-
|
|
928
|
-
### Channel History Methods
|
|
958
|
+
### Conversation History Methods
|
|
929
959
|
|
|
930
960
|
| Method | Description |
|
|
931
961
|
|--------|-------------|
|
|
932
|
-
| `getInteractions(): Interaction[]` | Get interactions for
|
|
933
|
-
| `getSystemInstruction(): string \| undefined` | Get system instruction for
|
|
934
|
-
| `setSystemInstruction(instruction): Promise<void>` | Set system instruction for
|
|
962
|
+
| `getInteractions(): Interaction[]` | Get interactions for the default conversation |
|
|
963
|
+
| `getSystemInstruction(): string \| undefined` | Get system instruction for the default conversation |
|
|
964
|
+
| `setSystemInstruction(instruction): Promise<void>` | Set system instruction for the default conversation. Pass `null` to clear. |
|
|
965
|
+
| `getConversations(): ConversationInfo[]` | List all conversations in this channel |
|
|
966
|
+
| `deleteConversation(conversationId): Promise<void>` | Delete a conversation (cannot delete `'default'`) |
|
|
967
|
+
| `renameConversation(name): Promise<void>` | Rename the default conversation |
|
|
935
968
|
|
|
936
969
|
Channel management (listing, renaming, deleting channels) is done via the client — see [Channel Management](#channel-management).
|
|
937
970
|
|
|
938
|
-
### System Instructions
|
|
939
|
-
|
|
940
|
-
System instructions customize how the AI behaves within a channel. The instruction persists across all prompts in that channel.
|
|
941
|
-
|
|
942
|
-
```typescript
|
|
943
|
-
// Make the AI behave like an SQL interpreter
|
|
944
|
-
await channel.setSystemInstruction(
|
|
945
|
-
'Behave like an intelligent SQL interpreter. Respond with simple markdown tables. ' +
|
|
946
|
-
'Translate the objects in the space to the implied structure in your responses.'
|
|
947
|
-
);
|
|
948
|
-
|
|
949
|
-
// Now prompts are interpreted as SQL-like queries
|
|
950
|
-
const { message } = await channel.prompt('SELECT task, due_date FROM tasks ORDER BY due_date');
|
|
951
|
-
// Returns a markdown table of tasks, even if no "tasks" objects exist -
|
|
952
|
-
// the AI infers actual tasks from the space content
|
|
953
|
-
|
|
954
|
-
// Clear the instruction to return to default behavior
|
|
955
|
-
await channel.setSystemInstruction(null);
|
|
956
|
-
```
|
|
957
|
-
|
|
958
|
-
System instructions are useful for:
|
|
959
|
-
- Defining response formats (tables, JSON, specific templates)
|
|
960
|
-
- Setting a persona or expertise area
|
|
961
|
-
- Constraining the AI to specific operations
|
|
962
|
-
- Creating domain-specific interfaces over your space data
|
|
963
|
-
|
|
964
|
-
### Listening for Updates
|
|
965
|
-
|
|
966
|
-
```typescript
|
|
967
|
-
channel.on('channelUpdated', ({ channelId, source }) => {
|
|
968
|
-
// Channel updated - refresh if needed
|
|
969
|
-
const interactions = channel.getInteractions();
|
|
970
|
-
renderInteractions(interactions);
|
|
971
|
-
});
|
|
972
|
-
```
|
|
973
|
-
|
|
974
|
-
### Multiple Channels
|
|
975
|
-
|
|
976
|
-
Each channel has its own interaction history. To work with multiple independent histories on the same space, open multiple channels:
|
|
977
|
-
|
|
978
|
-
```typescript
|
|
979
|
-
// Open two channels on the same space
|
|
980
|
-
const research = await client.openChannel('space-id', 'research');
|
|
981
|
-
const main = await client.openChannel('space-id', 'main');
|
|
982
|
-
|
|
983
|
-
// Each has independent history
|
|
984
|
-
await research.prompt("Analyze this data");
|
|
985
|
-
await main.prompt("Summarize findings");
|
|
986
|
-
|
|
987
|
-
// Close when done
|
|
988
|
-
research.close();
|
|
989
|
-
main.close();
|
|
990
|
-
```
|
|
991
|
-
|
|
992
|
-
**Use cases:**
|
|
993
|
-
- **Chat app with sidebar** — Each sidebar entry is a channel with a different channelId
|
|
994
|
-
- **Page refresh** — Store the channelId in localStorage to resume the same channel
|
|
995
|
-
- **Collaborative channels** — Share a channelId between users to enable shared AI interaction history
|
|
996
|
-
|
|
997
|
-
**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.
|
|
998
|
-
|
|
999
|
-
Note: Interaction history is truncated to the most recent 50 entries to manage space size.
|
|
1000
|
-
|
|
1001
971
|
### The ai Field
|
|
1002
972
|
|
|
1003
973
|
The `ai` field in interactions distinguishes AI-generated responses from synthetic confirmations:
|
|
@@ -1006,7 +976,7 @@ The `ai` field in interactions distinguishes AI-generated responses from synthet
|
|
|
1006
976
|
|
|
1007
977
|
### Tool Calls
|
|
1008
978
|
|
|
1009
|
-
The `toolCalls` array captures what the AI agent did during execution.
|
|
979
|
+
The `toolCalls` array captures what the AI agent did during execution. The `conversationUpdated` event fires when each tool starts and completes. A tool call without a `result` is still running; once `result` is present, the tool has finished.
|
|
1010
980
|
|
|
1011
981
|
## Data Types
|
|
1012
982
|
|
|
@@ -1057,17 +1027,36 @@ interface RoolObjectStat {
|
|
|
1057
1027
|
}
|
|
1058
1028
|
```
|
|
1059
1029
|
|
|
1060
|
-
### Channels
|
|
1030
|
+
### Channels and Conversations
|
|
1061
1031
|
|
|
1062
1032
|
```typescript
|
|
1063
|
-
//
|
|
1033
|
+
// Conversation — holds interaction history and optional system instruction
|
|
1034
|
+
interface Conversation {
|
|
1035
|
+
name?: string; // Conversation name (optional)
|
|
1036
|
+
systemInstruction?: string; // Custom system instruction for AI
|
|
1037
|
+
createdAt: number; // Timestamp when conversation was created
|
|
1038
|
+
createdBy: string; // User ID who created the conversation
|
|
1039
|
+
interactions: Interaction[]; // Interaction history
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// Conversation summary info (returned by channel.getConversations())
|
|
1043
|
+
interface ConversationInfo {
|
|
1044
|
+
id: string;
|
|
1045
|
+
name: string | null;
|
|
1046
|
+
systemInstruction: string | null;
|
|
1047
|
+
createdAt: number;
|
|
1048
|
+
createdBy: string;
|
|
1049
|
+
interactionCount: number;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// Channel container with metadata and conversations
|
|
1064
1053
|
interface Channel {
|
|
1065
1054
|
name?: string; // Channel name (optional)
|
|
1066
1055
|
createdAt: number; // Timestamp when channel was created
|
|
1067
1056
|
createdBy: string; // User ID who created the channel
|
|
1068
1057
|
createdByName?: string; // Display name at time of creation
|
|
1069
|
-
|
|
1070
|
-
|
|
1058
|
+
appUrl?: string; // URL of installed app (set by installApp)
|
|
1059
|
+
conversations: Record<string, Conversation>; // Keyed by conversation ID
|
|
1071
1060
|
}
|
|
1072
1061
|
|
|
1073
1062
|
// Channel summary info (returned by client.getChannels)
|
|
@@ -1078,6 +1067,7 @@ interface ChannelInfo {
|
|
|
1078
1067
|
createdBy: string;
|
|
1079
1068
|
createdByName: string | null;
|
|
1080
1069
|
interactionCount: number;
|
|
1070
|
+
appUrl: string | null; // URL of installed app, or null
|
|
1081
1071
|
}
|
|
1082
1072
|
```
|
|
1083
1073
|
|
|
@@ -1089,9 +1079,11 @@ Note: `Channel` and `ChannelInfo` are data types describing the stored channel m
|
|
|
1089
1079
|
interface ToolCall {
|
|
1090
1080
|
name: string; // Tool name (e.g., "create_object", "update_object", "search_web")
|
|
1091
1081
|
input: unknown; // Arguments passed to the tool
|
|
1092
|
-
result
|
|
1082
|
+
result?: string; // Truncated result (absent while tool is running)
|
|
1093
1083
|
}
|
|
1094
1084
|
|
|
1085
|
+
type InteractionStatus = 'pending' | 'streaming' | 'done' | 'error';
|
|
1086
|
+
|
|
1095
1087
|
interface Interaction {
|
|
1096
1088
|
id: string; // Unique ID for this interaction
|
|
1097
1089
|
timestamp: number;
|
|
@@ -1099,7 +1091,8 @@ interface Interaction {
|
|
|
1099
1091
|
userName?: string | null; // Display name at time of interaction
|
|
1100
1092
|
operation: 'prompt' | 'createObject' | 'updateObject' | 'deleteObjects';
|
|
1101
1093
|
input: string; // What the user did: prompt text or action description
|
|
1102
|
-
output: string | null; //
|
|
1094
|
+
output: string | null; // AI response or confirmation message (may be partial when streaming)
|
|
1095
|
+
status: InteractionStatus; // Lifecycle status (pending → streaming → done/error)
|
|
1103
1096
|
ai: boolean; // Whether AI was invoked (vs synthetic confirmation)
|
|
1104
1097
|
modifiedObjectIds: string[]; // Objects affected by this interaction
|
|
1105
1098
|
toolCalls: ToolCall[]; // Tools called during this interaction (for AI prompts)
|
|
@@ -1137,58 +1130,6 @@ interface PromptOptions {
|
|
|
1137
1130
|
}
|
|
1138
1131
|
```
|
|
1139
1132
|
|
|
1140
|
-
## Patterns & Examples
|
|
1141
|
-
|
|
1142
|
-
A Rool Space is a persistent, shared world model. Applications project different interaction patterns onto the same core primitives:
|
|
1143
|
-
|
|
1144
|
-
- **Objects** store durable state, with references to other objects via data fields
|
|
1145
|
-
- **Channels** provide independent AI interaction contexts over shared objects
|
|
1146
|
-
- **Events** describe what changed in real-time
|
|
1147
|
-
|
|
1148
|
-
Below are a few representative patterns.
|
|
1149
|
-
|
|
1150
|
-
### Chat With Generated Artifacts
|
|
1151
|
-
|
|
1152
|
-
- **Space**: documents, notes, images, tasks as objects
|
|
1153
|
-
- **Channels**: each chat thread is a separate channel on the same space
|
|
1154
|
-
- **UI**: renders interactions from `getInteractions()` as chat; derives artifact lists from object events
|
|
1155
|
-
|
|
1156
|
-
**Pattern**
|
|
1157
|
-
- Interaction history syncs in real-time; UI renders entries as chat bubbles
|
|
1158
|
-
- Artifacts are persistent objects shared across all channels
|
|
1159
|
-
- Listen to `channelUpdated` event to update chat UI
|
|
1160
|
-
- Selecting objects defines the AI working set via `objectIds`
|
|
1161
|
-
|
|
1162
|
-
### Multi-User World / Text Adventure
|
|
1163
|
-
|
|
1164
|
-
- **Space**: rooms, items, NPCs, players as objects
|
|
1165
|
-
- **References**: navigation, containment, location via data fields
|
|
1166
|
-
- **Channel**: player commands and narrative continuity
|
|
1167
|
-
|
|
1168
|
-
**Pattern**
|
|
1169
|
-
- The space is the shared world state
|
|
1170
|
-
- Objects can be created dynamically as the world expands
|
|
1171
|
-
- AI generates descriptions and events using `{{placeholders}}`
|
|
1172
|
-
|
|
1173
|
-
### Collaborative Knowledge Graph
|
|
1174
|
-
|
|
1175
|
-
- **Space**: concepts, sources, hypotheses as objects
|
|
1176
|
-
- **References**: semantic connections between objects via data fields
|
|
1177
|
-
- **Channel**: exploratory analysis and questioning
|
|
1178
|
-
|
|
1179
|
-
**Pattern**
|
|
1180
|
-
- Graph structure lives in object data fields containing other object IDs
|
|
1181
|
-
- AI operates on selected subgraphs via `objectIds`
|
|
1182
|
-
- Analysis results are stored; reasoning steps are transient
|
|
1183
|
-
|
|
1184
|
-
### Common Design Invariants
|
|
1185
|
-
|
|
1186
|
-
- Durable content lives in space objects
|
|
1187
|
-
- References between objects are data fields whose values are object IDs
|
|
1188
|
-
- Interaction history lives in channels (persistent, synced, truncated to 50 entries)
|
|
1189
|
-
- UI state lives in the client, space metadata, or `_`-prefixed fields
|
|
1190
|
-
- AI focus is controlled by object selection, not by replaying history
|
|
1191
|
-
|
|
1192
1133
|
## License
|
|
1193
1134
|
|
|
1194
1135
|
MIT - see [LICENSE](../../LICENSE) for details.
|
package/dist/apps.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class AppsClient {
|
|
|
18
18
|
/**
|
|
19
19
|
* Publish or update an app.
|
|
20
20
|
* @param appId - URL-safe identifier for the app
|
|
21
|
-
* @param options -
|
|
21
|
+
* @param options - Bundle zip file (must include index.html and rool-app.json)
|
|
22
22
|
*/
|
|
23
23
|
publish(appId: string, options: PublishAppOptions): Promise<PublishedAppInfo>;
|
|
24
24
|
/**
|
package/dist/apps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../src/apps.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAIpC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAkBzC;;OAEG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAsB1D;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../src/apps.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAIpC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAkBzC;;OAEG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAsB1D;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwBnF;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAe9C"}
|
package/dist/apps.js
CHANGED
|
@@ -47,7 +47,7 @@ export class AppsClient {
|
|
|
47
47
|
/**
|
|
48
48
|
* Publish or update an app.
|
|
49
49
|
* @param appId - URL-safe identifier for the app
|
|
50
|
-
* @param options -
|
|
50
|
+
* @param options - Bundle zip file (must include index.html and rool-app.json)
|
|
51
51
|
*/
|
|
52
52
|
async publish(appId, options) {
|
|
53
53
|
const tokens = await this.config.authManager.getTokens();
|
|
@@ -56,10 +56,6 @@ export class AppsClient {
|
|
|
56
56
|
const headers = { Authorization: `Bearer ${tokens.accessToken}`, 'X-Rool-Token': tokens.roolToken };
|
|
57
57
|
const formData = new FormData();
|
|
58
58
|
formData.append('bundle', options.bundle);
|
|
59
|
-
formData.append('name', options.name);
|
|
60
|
-
if (options.spa !== undefined) {
|
|
61
|
-
formData.append('spa', String(options.spa));
|
|
62
|
-
}
|
|
63
59
|
const response = await fetch(`${this.config.appsUrl}/${encodeURIComponent(appId)}`, {
|
|
64
60
|
method: 'POST',
|
|
65
61
|
headers,
|
package/dist/apps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../src/apps.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,cAAc;AACd,2DAA2D;AAC3D,gFAAgF;AAUhF,MAAM,OAAO,UAAU;IACb,MAAM,CAAmB;IAEjC,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,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;QAElD,MAAM,OAAO,GAA2B,EAAE,aAAa,EAAE,UAAU,MAAM,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QAE5H,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;YAClF,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,4BAA4B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;CACF"}
|
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, Channel, LinkAccess, SpaceSchema, CollectionDef, FieldDef } from './types.js';
|
|
6
|
+
import type { RoolObject, RoolObjectStat, ChannelEvents, RoolUserRole, PromptOptions, FindObjectsOptions, CreateObjectOptions, UpdateObjectOptions, MediaInfo, MediaResponse, Interaction, Channel, ConversationInfo, LinkAccess, SpaceSchema, CollectionDef, FieldDef } from './types.js';
|
|
7
7
|
export declare function generateEntityId(): string;
|
|
8
8
|
export interface ChannelConfig {
|
|
9
9
|
id: string;
|
|
@@ -56,6 +56,7 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
56
56
|
private _linkAccess;
|
|
57
57
|
private _userId;
|
|
58
58
|
private _channelId;
|
|
59
|
+
private _conversationId;
|
|
59
60
|
private _closed;
|
|
60
61
|
private graphqlClient;
|
|
61
62
|
private mediaClient;
|
|
@@ -94,11 +95,40 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
94
95
|
* Fixed at open time — cannot be changed.
|
|
95
96
|
*/
|
|
96
97
|
get channelId(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Get the conversation ID for this channel.
|
|
100
|
+
* Defaults to 'default' for most apps.
|
|
101
|
+
*/
|
|
102
|
+
get conversationId(): string;
|
|
97
103
|
get isReadOnly(): boolean;
|
|
98
104
|
/**
|
|
99
|
-
* Get
|
|
105
|
+
* Get the app URL if this channel was created via installApp, or null.
|
|
106
|
+
*/
|
|
107
|
+
get appUrl(): string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Get interactions for the current conversation.
|
|
100
110
|
*/
|
|
101
111
|
getInteractions(): Interaction[];
|
|
112
|
+
/** @internal */
|
|
113
|
+
_getInteractionsImpl(conversationId: string): Interaction[];
|
|
114
|
+
/**
|
|
115
|
+
* Get all conversations in this channel.
|
|
116
|
+
* Returns summary info (no full interaction data) for each conversation.
|
|
117
|
+
*/
|
|
118
|
+
getConversations(): ConversationInfo[];
|
|
119
|
+
/**
|
|
120
|
+
* Delete a conversation from this channel.
|
|
121
|
+
* Cannot delete the conversation you are currently using.
|
|
122
|
+
*/
|
|
123
|
+
deleteConversation(conversationId: string): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Get a handle for a specific conversation within this channel.
|
|
126
|
+
* The handle scopes AI and mutation operations to that conversation's
|
|
127
|
+
* interaction history, while sharing the channel's single SSE connection.
|
|
128
|
+
*
|
|
129
|
+
* Conversations are auto-created on first interaction — no explicit create needed.
|
|
130
|
+
*/
|
|
131
|
+
conversation(conversationId: string): ConversationHandle;
|
|
102
132
|
/**
|
|
103
133
|
* Close this channel and clean up resources.
|
|
104
134
|
* Stops real-time subscription and unregisters from client.
|
|
@@ -162,6 +192,11 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
162
192
|
objects: RoolObject[];
|
|
163
193
|
message: string;
|
|
164
194
|
}>;
|
|
195
|
+
/** @internal */
|
|
196
|
+
_findObjectsImpl(options: FindObjectsOptions, conversationId: string): Promise<{
|
|
197
|
+
objects: RoolObject[];
|
|
198
|
+
message: string;
|
|
199
|
+
}>;
|
|
165
200
|
/**
|
|
166
201
|
* Get all object IDs (sync, from local cache).
|
|
167
202
|
* The list is loaded on open and kept current via SSE events.
|
|
@@ -182,6 +217,11 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
182
217
|
object: RoolObject;
|
|
183
218
|
message: string;
|
|
184
219
|
}>;
|
|
220
|
+
/** @internal */
|
|
221
|
+
_createObjectImpl(options: CreateObjectOptions, conversationId: string): Promise<{
|
|
222
|
+
object: RoolObject;
|
|
223
|
+
message: string;
|
|
224
|
+
}>;
|
|
185
225
|
/**
|
|
186
226
|
* Update an existing object.
|
|
187
227
|
* @param objectId - The ID of the object to update
|
|
@@ -194,11 +234,18 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
194
234
|
object: RoolObject;
|
|
195
235
|
message: string;
|
|
196
236
|
}>;
|
|
237
|
+
/** @internal */
|
|
238
|
+
_updateObjectImpl(objectId: string, options: UpdateObjectOptions, conversationId: string): Promise<{
|
|
239
|
+
object: RoolObject;
|
|
240
|
+
message: string;
|
|
241
|
+
}>;
|
|
197
242
|
/**
|
|
198
243
|
* Delete objects by IDs.
|
|
199
244
|
* Other objects that reference deleted objects via data fields will retain stale ref values.
|
|
200
245
|
*/
|
|
201
246
|
deleteObjects(objectIds: string[]): Promise<void>;
|
|
247
|
+
/** @internal */
|
|
248
|
+
_deleteObjectsImpl(objectIds: string[], conversationId: string): Promise<void>;
|
|
202
249
|
/**
|
|
203
250
|
* Get the current schema for this space.
|
|
204
251
|
* Returns a map of collection names to their definitions.
|
|
@@ -211,6 +258,8 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
211
258
|
* @returns The created CollectionDef
|
|
212
259
|
*/
|
|
213
260
|
createCollection(name: string, fields: FieldDef[]): Promise<CollectionDef>;
|
|
261
|
+
/** @internal */
|
|
262
|
+
_createCollectionImpl(name: string, fields: FieldDef[], conversationId: string): Promise<CollectionDef>;
|
|
214
263
|
/**
|
|
215
264
|
* Alter an existing collection schema, replacing its field definitions.
|
|
216
265
|
* @param name - Name of the collection to alter
|
|
@@ -218,26 +267,47 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
218
267
|
* @returns The updated CollectionDef
|
|
219
268
|
*/
|
|
220
269
|
alterCollection(name: string, fields: FieldDef[]): Promise<CollectionDef>;
|
|
270
|
+
/** @internal */
|
|
271
|
+
_alterCollectionImpl(name: string, fields: FieldDef[], conversationId: string): Promise<CollectionDef>;
|
|
221
272
|
/**
|
|
222
273
|
* Drop a collection schema.
|
|
223
274
|
* @param name - Name of the collection to drop
|
|
224
275
|
*/
|
|
225
276
|
dropCollection(name: string): Promise<void>;
|
|
277
|
+
/** @internal */
|
|
278
|
+
_dropCollectionImpl(name: string, conversationId: string): Promise<void>;
|
|
226
279
|
/**
|
|
227
|
-
* Get the system instruction for
|
|
280
|
+
* Get the system instruction for the current conversation.
|
|
228
281
|
* Returns undefined if no system instruction is set.
|
|
229
282
|
*/
|
|
230
283
|
getSystemInstruction(): string | undefined;
|
|
284
|
+
/** @internal */
|
|
285
|
+
_getSystemInstructionImpl(conversationId: string): string | undefined;
|
|
231
286
|
/**
|
|
232
|
-
* Set the system instruction for
|
|
287
|
+
* Set the system instruction for the current conversation.
|
|
233
288
|
* Pass null to clear the instruction.
|
|
234
289
|
*/
|
|
235
290
|
setSystemInstruction(instruction: string | null): Promise<void>;
|
|
291
|
+
/** @internal */
|
|
292
|
+
_setSystemInstructionImpl(instruction: string | null, conversationId: string): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Rename the current conversation.
|
|
295
|
+
*/
|
|
296
|
+
renameConversation(name: string): Promise<void>;
|
|
297
|
+
/** @internal */
|
|
298
|
+
_renameConversationImpl(name: string, conversationId: string): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Ensure a conversation exists in the local channel cache.
|
|
301
|
+
* @internal
|
|
302
|
+
*/
|
|
303
|
+
_ensureConversationImpl(conversationId: string): void;
|
|
236
304
|
/**
|
|
237
305
|
* Set a space-level metadata value.
|
|
238
306
|
* Metadata is stored in meta and hidden from AI operations.
|
|
239
307
|
*/
|
|
240
308
|
setMetadata(key: string, value: unknown): void;
|
|
309
|
+
/** @internal */
|
|
310
|
+
_setMetadataImpl(key: string, value: unknown, conversationId: string): void;
|
|
241
311
|
/**
|
|
242
312
|
* Get a space-level metadata value.
|
|
243
313
|
*/
|
|
@@ -254,6 +324,11 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
254
324
|
message: string;
|
|
255
325
|
objects: RoolObject[];
|
|
256
326
|
}>;
|
|
327
|
+
/** @internal */
|
|
328
|
+
_promptImpl(prompt: string, options: PromptOptions | undefined, conversationId: string): Promise<{
|
|
329
|
+
message: string;
|
|
330
|
+
objects: RoolObject[];
|
|
331
|
+
}>;
|
|
257
332
|
/**
|
|
258
333
|
* Rename this channel.
|
|
259
334
|
*/
|
|
@@ -321,4 +396,60 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
|
|
|
321
396
|
*/
|
|
322
397
|
private _handleObjectDeleted;
|
|
323
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* A lightweight handle for a specific conversation within a channel.
|
|
401
|
+
*
|
|
402
|
+
* Scopes AI and mutation operations to a particular conversation's interaction
|
|
403
|
+
* history, while sharing the channel's single SSE connection and object state.
|
|
404
|
+
*
|
|
405
|
+
* Obtain via `channel.conversation('thread-id')`.
|
|
406
|
+
* Conversations are auto-created on first interaction.
|
|
407
|
+
*/
|
|
408
|
+
export declare class ConversationHandle {
|
|
409
|
+
/** @internal */
|
|
410
|
+
private _channel;
|
|
411
|
+
private _conversationId;
|
|
412
|
+
/** @internal */
|
|
413
|
+
constructor(channel: RoolChannel, conversationId: string);
|
|
414
|
+
/** The conversation ID this handle is scoped to. */
|
|
415
|
+
get conversationId(): string;
|
|
416
|
+
/** Get interactions for this conversation. */
|
|
417
|
+
getInteractions(): Interaction[];
|
|
418
|
+
/** Get the system instruction for this conversation. */
|
|
419
|
+
getSystemInstruction(): string | undefined;
|
|
420
|
+
/** Set the system instruction for this conversation. Pass null to clear. */
|
|
421
|
+
setSystemInstruction(instruction: string | null): Promise<void>;
|
|
422
|
+
/** Rename this conversation. */
|
|
423
|
+
rename(name: string): Promise<void>;
|
|
424
|
+
/** Find objects using structured filters and/or natural language. */
|
|
425
|
+
findObjects(options: FindObjectsOptions): Promise<{
|
|
426
|
+
objects: RoolObject[];
|
|
427
|
+
message: string;
|
|
428
|
+
}>;
|
|
429
|
+
/** Create a new object. */
|
|
430
|
+
createObject(options: CreateObjectOptions): Promise<{
|
|
431
|
+
object: RoolObject;
|
|
432
|
+
message: string;
|
|
433
|
+
}>;
|
|
434
|
+
/** Update an existing object. */
|
|
435
|
+
updateObject(objectId: string, options: UpdateObjectOptions): Promise<{
|
|
436
|
+
object: RoolObject;
|
|
437
|
+
message: string;
|
|
438
|
+
}>;
|
|
439
|
+
/** Delete objects by IDs. */
|
|
440
|
+
deleteObjects(objectIds: string[]): Promise<void>;
|
|
441
|
+
/** Send a prompt to the AI agent, scoped to this conversation's history. */
|
|
442
|
+
prompt(text: string, options?: PromptOptions): Promise<{
|
|
443
|
+
message: string;
|
|
444
|
+
objects: RoolObject[];
|
|
445
|
+
}>;
|
|
446
|
+
/** Create a new collection schema. */
|
|
447
|
+
createCollection(name: string, fields: FieldDef[]): Promise<CollectionDef>;
|
|
448
|
+
/** Alter an existing collection schema. */
|
|
449
|
+
alterCollection(name: string, fields: FieldDef[]): Promise<CollectionDef>;
|
|
450
|
+
/** Drop a collection schema. */
|
|
451
|
+
dropCollection(name: string): Promise<void>;
|
|
452
|
+
/** Set a space-level metadata value. */
|
|
453
|
+
setMetadata(key: string, value: unknown): void;
|
|
454
|
+
}
|
|
324
455
|
//# sourceMappingURL=channel.d.ts.map
|