@rool-dev/svelte 0.10.2 → 0.11.0-dev.59f195f
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 +134 -88
- package/dist/channel.svelte.d.ts +23 -27
- package/dist/channel.svelte.d.ts.map +1 -1
- package/dist/channel.svelte.js +106 -171
- package/dist/file-tree.svelte.d.ts +91 -0
- package/dist/file-tree.svelte.d.ts.map +1 -0
- package/dist/file-tree.svelte.js +399 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/rool.svelte.d.ts +22 -22
- package/dist/rool.svelte.d.ts.map +1 -1
- package/dist/rool.svelte.js +33 -39
- package/dist/space.svelte.d.ts +3 -2
- package/dist/space.svelte.d.ts.map +1 -1
- package/dist/space.svelte.js +7 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Svelte 5 bindings for Rool Spaces. Adds reactive state to the SDK using `$state` runes.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
**Requires Svelte 5.** For core concepts (objects, references, AI placeholders, undo/redo), see the [SDK documentation](../sdk/README.md).
|
|
5
|
+
**Requires Svelte 5.** For core concepts (objects, references, AI, WebDAV files, undo/redo), see the [SDK documentation](../sdk/README.md).
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
@@ -15,16 +13,18 @@ npm install @rool-dev/svelte
|
|
|
15
13
|
## Quick Start
|
|
16
14
|
|
|
17
15
|
```svelte
|
|
18
|
-
<script>
|
|
19
|
-
import { createRool } from '@rool-dev/svelte';
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { createRool, type ReactiveChannel } from '@rool-dev/svelte';
|
|
20
18
|
|
|
21
19
|
const rool = createRool();
|
|
22
|
-
rool.init();
|
|
20
|
+
void rool.init();
|
|
23
21
|
|
|
24
|
-
let channel = $state(null);
|
|
22
|
+
let channel = $state<ReactiveChannel | null>(null);
|
|
25
23
|
</script>
|
|
26
24
|
|
|
27
|
-
{#if
|
|
25
|
+
{#if rool.authenticated === null}
|
|
26
|
+
<p>Checking session...</p>
|
|
27
|
+
{:else if !rool.authenticated}
|
|
28
28
|
<button onclick={() => rool.login('My App')}>Login</button>
|
|
29
29
|
{:else}
|
|
30
30
|
<h1>My Spaces</h1>
|
|
@@ -50,14 +50,16 @@ The Svelte wrapper adds reactive state on top of the SDK:
|
|
|
50
50
|
| Reactive Property | Description |
|
|
51
51
|
|-------------------|-------------|
|
|
52
52
|
| `rool.authenticated` | Auth state (`null` = checking, `true`/`false` = known) |
|
|
53
|
+
| `rool.currentUser` | Current user profile after authentication |
|
|
53
54
|
| `rool.spaces` | List of available spaces |
|
|
54
55
|
| `rool.spacesLoading` | Whether spaces are loading |
|
|
55
56
|
| `rool.spacesError` | Error from loading spaces |
|
|
56
|
-
| `rool.connectionState` | SSE connection state |
|
|
57
|
+
| `rool.connectionState` | Client SSE connection state |
|
|
57
58
|
| `rool.userStorage` | User storage (cross-device preferences) |
|
|
58
|
-
| `
|
|
59
|
-
| `channel.
|
|
60
|
-
| `channel.
|
|
59
|
+
| `space.fileTree` | Canonical reactive WebDAV tree for `/`, including `/space` objects and `/rool-drive` user files |
|
|
60
|
+
| `channel.interactions` | Current conversation interactions |
|
|
61
|
+
| `channel.objectPaths` | Object paths derived from `space.fileTree` |
|
|
62
|
+
| `channel.collections` | Collection directories derived from `space.fileTree` |
|
|
61
63
|
| `channel.conversations` | Conversations in this channel (auto-updates on create/delete/rename) |
|
|
62
64
|
| `thread.interactions` | Interactions for a specific conversation (auto-updates) |
|
|
63
65
|
| `watch.objects` | Objects matching a filter (auto-updates) |
|
|
@@ -65,6 +67,22 @@ The Svelte wrapper adds reactive state on top of the SDK:
|
|
|
65
67
|
|
|
66
68
|
Everything else passes through to the SDK directly. See the [SDK documentation](../sdk/README.md) for full API details.
|
|
67
69
|
|
|
70
|
+
### Reactive File Tree
|
|
71
|
+
|
|
72
|
+
Every `ReactiveSpace` owns a canonical reactive WebDAV tree. It is kept current with server `filesChanged`/`filesReset` events and WebDAV `sync-collection`, so it covers both object files and user files without polling.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const space = await rool.openSpace(spaceId);
|
|
76
|
+
|
|
77
|
+
space.fileTree.nodes; // ReactiveFileNode[]
|
|
78
|
+
space.fileTree.byPath['/space']; // lookup by machine/WebDAV path
|
|
79
|
+
space.fileTree.childrenOf('/'); // /space and /rool-drive
|
|
80
|
+
space.fileTree.childrenOf('/rool-drive');
|
|
81
|
+
space.fileTree.objectPaths(); // object paths from /space/**/*.json
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Use this tree when UI needs to react to both files and objects. Object helpers like `channel.object()`, `channel.watch()`, `channel.objectPaths`, and `channel.collections` are backed by this tree.
|
|
85
|
+
|
|
68
86
|
## API
|
|
69
87
|
|
|
70
88
|
### Lifecycle
|
|
@@ -72,7 +90,7 @@ Everything else passes through to the SDK directly. See the [SDK documentation](
|
|
|
72
90
|
```typescript
|
|
73
91
|
const rool = createRool();
|
|
74
92
|
|
|
75
|
-
rool.init();
|
|
93
|
+
void rool.init(); // Process auth callbacks (call on app startup)
|
|
76
94
|
rool.login('My App'); // Redirect to login page
|
|
77
95
|
rool.signup('My App'); // Redirect to signup page
|
|
78
96
|
rool.verify(token); // Sign in from an email verification link (used by the official Rool app)
|
|
@@ -91,6 +109,7 @@ rool.destroy(); // Clean up all resources
|
|
|
91
109
|
// rool.spacesError → Error | null
|
|
92
110
|
// rool.connectionState → 'connected' | 'disconnected' | 'reconnecting'
|
|
93
111
|
// rool.userStorage → Record<string, unknown>
|
|
112
|
+
// rool.currentUser → CurrentUser | null
|
|
94
113
|
</script>
|
|
95
114
|
|
|
96
115
|
{#if rool.spacesLoading}
|
|
@@ -109,9 +128,10 @@ rool.destroy(); // Clean up all resources
|
|
|
109
128
|
Reactive cross-device storage for user preferences. Synced from server on `init()`, then kept up-to-date via SSE.
|
|
110
129
|
|
|
111
130
|
```svelte
|
|
112
|
-
<script>
|
|
131
|
+
<script lang="ts">
|
|
132
|
+
import { createRool } from '@rool-dev/svelte';
|
|
113
133
|
const rool = createRool();
|
|
114
|
-
rool.init();
|
|
134
|
+
void rool.init();
|
|
115
135
|
</script>
|
|
116
136
|
|
|
117
137
|
<!-- Reactive binding to storage values -->
|
|
@@ -122,9 +142,7 @@ Reactive cross-device storage for user preferences. Synced from server on `init(
|
|
|
122
142
|
{/if}
|
|
123
143
|
|
|
124
144
|
<!-- Theme toggle -->
|
|
125
|
-
<button onclick={() => rool.setUserStorage('theme',
|
|
126
|
-
rool.userStorage.theme === 'dark' ? 'light' : 'dark'
|
|
127
|
-
)}>
|
|
145
|
+
<button onclick={() => rool.setUserStorage('theme', rool.userStorage.theme === 'dark' ? 'light' : 'dark')}>
|
|
128
146
|
Toggle theme
|
|
129
147
|
</button>
|
|
130
148
|
```
|
|
@@ -161,47 +179,55 @@ space.close();
|
|
|
161
179
|
|
|
162
180
|
### ReactiveChannel
|
|
163
181
|
|
|
164
|
-
`space.openChannel()` returns a `ReactiveChannel` — the SDK's `RoolChannel` with reactive `interactions` and
|
|
182
|
+
`space.openChannel()` returns a `ReactiveChannel` — the SDK's `RoolChannel` with reactive `interactions`, `objectPaths`, `collections`, `conversations`, and file-tree-backed object helpers:
|
|
165
183
|
|
|
166
184
|
```svelte
|
|
167
|
-
<script>
|
|
168
|
-
|
|
169
|
-
|
|
185
|
+
<script lang="ts">
|
|
186
|
+
import { createRool, type ReactiveChannel, type ReactiveSpace } from '@rool-dev/svelte';
|
|
187
|
+
|
|
188
|
+
const rool = createRool();
|
|
189
|
+
void rool.init();
|
|
190
|
+
|
|
191
|
+
let space = $state<ReactiveSpace | null>(null);
|
|
192
|
+
let channel = $state<ReactiveChannel | null>(null);
|
|
170
193
|
|
|
171
|
-
async function open(spaceId) {
|
|
194
|
+
async function open(spaceId: string) {
|
|
172
195
|
space = await rool.openSpace(spaceId);
|
|
173
196
|
channel = await space.openChannel('main');
|
|
174
197
|
}
|
|
175
198
|
</script>
|
|
176
199
|
|
|
177
200
|
{#if channel}
|
|
178
|
-
<!-- Reactive: updates
|
|
201
|
+
<!-- Reactive: updates when the current conversation changes -->
|
|
179
202
|
{#each channel.interactions as interaction}
|
|
180
203
|
<div>
|
|
181
|
-
<strong>{interaction.operation}</strong>: {interaction.output}
|
|
204
|
+
<strong>{interaction.operation}</strong>: {interaction.output ?? ''}
|
|
182
205
|
</div>
|
|
183
206
|
{/each}
|
|
184
207
|
|
|
185
208
|
<!-- All SDK methods work directly -->
|
|
186
|
-
<button onclick={() => channel.prompt('Hello')}>Send</button>
|
|
209
|
+
<button onclick={() => void channel.prompt('Hello')}>Send</button>
|
|
187
210
|
{/if}
|
|
188
211
|
```
|
|
189
212
|
|
|
190
213
|
### Reactive Object
|
|
191
214
|
|
|
192
|
-
Track a single object by
|
|
215
|
+
Track a single object by machine path with auto-updates:
|
|
193
216
|
|
|
194
217
|
```svelte
|
|
195
|
-
<script>
|
|
196
|
-
|
|
197
|
-
let item = $state(null);
|
|
218
|
+
<script lang="ts">
|
|
219
|
+
import { createRool, type ReactiveChannel, type ReactiveObject } from '@rool-dev/svelte';
|
|
198
220
|
|
|
199
|
-
|
|
221
|
+
const rool = createRool();
|
|
222
|
+
void rool.init();
|
|
200
223
|
|
|
201
|
-
|
|
202
|
-
|
|
224
|
+
let channel = $state<ReactiveChannel | null>(null);
|
|
225
|
+
let item = $state<ReactiveObject | null>(null);
|
|
226
|
+
|
|
227
|
+
async function open(spaceId: string, path: string) {
|
|
228
|
+
const space = await rool.openSpace(spaceId);
|
|
203
229
|
channel = await space.openChannel('main');
|
|
204
|
-
item = channel.object(
|
|
230
|
+
item = channel.object(path); // e.g. '/space/article/welcome.json'
|
|
205
231
|
}
|
|
206
232
|
</script>
|
|
207
233
|
|
|
@@ -209,7 +235,7 @@ Track a single object by location with auto-updates:
|
|
|
209
235
|
{#if item.loading}
|
|
210
236
|
<p>Loading...</p>
|
|
211
237
|
{:else if item.data}
|
|
212
|
-
<div>{item.data.body.title}</div>
|
|
238
|
+
<div>{String(item.data.body.title ?? '')}</div>
|
|
213
239
|
{:else}
|
|
214
240
|
<p>Object not found</p>
|
|
215
241
|
{/if}
|
|
@@ -233,13 +259,16 @@ item.close() // Stop listening for updates
|
|
|
233
259
|
Create auto-updating watches of objects filtered by field values:
|
|
234
260
|
|
|
235
261
|
```svelte
|
|
236
|
-
<script>
|
|
237
|
-
|
|
238
|
-
let articles = $state(null);
|
|
262
|
+
<script lang="ts">
|
|
263
|
+
import { createRool, type ReactiveChannel, type ReactiveSpace, type ReactiveWatch } from '@rool-dev/svelte';
|
|
239
264
|
|
|
240
|
-
|
|
265
|
+
const rool = createRool();
|
|
266
|
+
void rool.init();
|
|
241
267
|
|
|
242
|
-
|
|
268
|
+
let space = $state<ReactiveSpace | null>(null);
|
|
269
|
+
let channel = $state<ReactiveChannel | null>(null);
|
|
270
|
+
let articles = $state<ReactiveWatch | null>(null);
|
|
271
|
+
async function open(spaceId: string) {
|
|
243
272
|
space = await rool.openSpace(spaceId);
|
|
244
273
|
channel = await space.openChannel('main');
|
|
245
274
|
// Create a reactive watch of all objects in the 'article' collection
|
|
@@ -252,18 +281,18 @@ Create auto-updating watches of objects filtered by field values:
|
|
|
252
281
|
<p>Loading...</p>
|
|
253
282
|
{:else}
|
|
254
283
|
{#each articles.objects as article}
|
|
255
|
-
<div>{article.body.title}</div>
|
|
284
|
+
<div>{String(article.body.title ?? '')}</div>
|
|
256
285
|
{/each}
|
|
257
286
|
{/if}
|
|
258
287
|
{/if}
|
|
259
288
|
```
|
|
260
289
|
|
|
261
|
-
Watches automatically re-fetch when
|
|
290
|
+
Watches automatically re-fetch when matching object files change in `space.fileTree`.
|
|
262
291
|
|
|
263
292
|
**Lifecycle:** Watches are tied to their channel. Closing the channel stops all updates — existing watches will retain their last data but no longer refresh. Calling `channel.watch()` after `close()` throws.
|
|
264
293
|
|
|
265
294
|
```typescript
|
|
266
|
-
// Watch options
|
|
295
|
+
// Watch options
|
|
267
296
|
const articles = channel.watch({
|
|
268
297
|
collection: 'article',
|
|
269
298
|
where: { status: 'published' },
|
|
@@ -282,36 +311,51 @@ articles.close() // Stop listening for updates
|
|
|
282
311
|
|
|
283
312
|
### Reactive Channel List
|
|
284
313
|
|
|
285
|
-
`space.channels` is a reactive `ChannelInfo[]`
|
|
314
|
+
`space.channels` is a reactive `ChannelInfo[]` on an opened `ReactiveSpace`. If you only need a live channel list without managing a `ReactiveSpace`, use `rool.channels(spaceId)` and call `close()` when done.
|
|
286
315
|
|
|
287
316
|
```svelte
|
|
288
|
-
<script>
|
|
289
|
-
|
|
317
|
+
<script lang="ts">
|
|
318
|
+
import { createRool, type ReactiveSpace } from '@rool-dev/svelte';
|
|
319
|
+
|
|
320
|
+
const rool = createRool();
|
|
321
|
+
void rool.init();
|
|
290
322
|
|
|
291
|
-
|
|
323
|
+
let space = $state<ReactiveSpace | null>(null);
|
|
324
|
+
async function open(spaceId: string) {
|
|
292
325
|
space = await rool.openSpace(spaceId);
|
|
293
326
|
}
|
|
294
327
|
</script>
|
|
295
328
|
|
|
296
329
|
{#if space}
|
|
297
330
|
{#each space.channels as ch}
|
|
298
|
-
<button onclick={() => space.openChannel(ch.id)}>{ch.name ?? ch.id}</button>
|
|
331
|
+
<button onclick={() => void space.openChannel(ch.id)}>{ch.name ?? ch.id}</button>
|
|
299
332
|
{/each}
|
|
300
333
|
{/if}
|
|
301
334
|
```
|
|
302
335
|
|
|
336
|
+
```typescript
|
|
337
|
+
const channels = rool.channels(spaceId);
|
|
338
|
+
channels.list; // ChannelInfo[]
|
|
339
|
+
channels.loading; // boolean
|
|
340
|
+
await channels.refresh();
|
|
341
|
+
channels.close();
|
|
342
|
+
```
|
|
343
|
+
|
|
303
344
|
### Reactive Conversation Handle
|
|
304
345
|
|
|
305
346
|
For apps with multiple independent interaction threads (e.g., chat with threads), use `channel.conversation()` to get a handle with reactive interactions:
|
|
306
347
|
|
|
307
348
|
```svelte
|
|
308
|
-
<script>
|
|
309
|
-
|
|
310
|
-
let thread = $state(null);
|
|
349
|
+
<script lang="ts">
|
|
350
|
+
import { createRool, type ReactiveChannel, type ReactiveConversationHandle, type ReactiveSpace } from '@rool-dev/svelte';
|
|
311
351
|
|
|
312
|
-
|
|
352
|
+
const rool = createRool();
|
|
353
|
+
void rool.init();
|
|
313
354
|
|
|
314
|
-
|
|
355
|
+
let space = $state<ReactiveSpace | null>(null);
|
|
356
|
+
let channel = $state<ReactiveChannel | null>(null);
|
|
357
|
+
let thread = $state<ReactiveConversationHandle | null>(null);
|
|
358
|
+
async function openThread(spaceId: string, threadId: string) {
|
|
315
359
|
space = await rool.openSpace(spaceId);
|
|
316
360
|
channel = await space.openChannel('main');
|
|
317
361
|
thread = channel.conversation(threadId);
|
|
@@ -323,17 +367,19 @@ For apps with multiple independent interaction threads (e.g., chat with threads)
|
|
|
323
367
|
<div>{interaction.output}</div>
|
|
324
368
|
{/each}
|
|
325
369
|
|
|
326
|
-
<button onclick={() => thread.prompt('Hello')}>Send</button>
|
|
370
|
+
<button onclick={() => void thread.prompt('Hello')}>Send</button>
|
|
327
371
|
{/if}
|
|
328
372
|
```
|
|
329
373
|
|
|
330
374
|
```typescript
|
|
331
375
|
// Reactive state
|
|
332
|
-
thread.interactions // $state<Interaction[]> —
|
|
376
|
+
thread.interactions // $state<Interaction[]> — updates from space/channel events
|
|
333
377
|
|
|
334
|
-
//
|
|
378
|
+
// Conversation-scoped methods
|
|
335
379
|
await thread.prompt('Hello')
|
|
336
|
-
await thread.
|
|
380
|
+
await thread.stop() // Stop this thread's in-flight interaction (false if none)
|
|
381
|
+
await thread.putObject('/space/note/welcome.json', { text: 'Note' })
|
|
382
|
+
await thread.patchObject('/space/note/welcome.json', { data: { text: 'Updated' } })
|
|
337
383
|
await thread.setSystemInstruction('Respond in haiku')
|
|
338
384
|
await thread.rename('Research Thread')
|
|
339
385
|
thread.getInteractions() // Manual read
|
|
@@ -343,7 +389,7 @@ thread.getSystemInstruction()
|
|
|
343
389
|
thread.close() // Stop listening for updates
|
|
344
390
|
```
|
|
345
391
|
|
|
346
|
-
Conversations are auto-created
|
|
392
|
+
Conversations are auto-created when you first write history or settings. Real-time events are owned by the space subscription; conversation handles subscribe to channel events locally.
|
|
347
393
|
|
|
348
394
|
### Channel Management
|
|
349
395
|
|
|
@@ -369,17 +415,18 @@ channel.name
|
|
|
369
415
|
channel.role
|
|
370
416
|
channel.channelId
|
|
371
417
|
|
|
372
|
-
// Object operations — addressed by
|
|
373
|
-
|
|
374
|
-
await channel.
|
|
375
|
-
await channel.
|
|
376
|
-
await channel.
|
|
377
|
-
await channel.moveObject(
|
|
378
|
-
await channel.deleteObjects([
|
|
379
|
-
await channel.findObjects({ collection: 'note' })
|
|
418
|
+
// Object operations — addressed by exact machine paths
|
|
419
|
+
const path = '/space/note/welcome.json';
|
|
420
|
+
await channel.getObject(path)
|
|
421
|
+
await channel.putObject(path, { text: 'Hello' })
|
|
422
|
+
await channel.patchObject(path, { data: { text: 'Updated' } })
|
|
423
|
+
await channel.moveObject(path, '/space/note/renamed.json')
|
|
424
|
+
await channel.deleteObjects(['/space/note/renamed.json'])
|
|
380
425
|
|
|
381
426
|
// AI
|
|
382
427
|
await channel.prompt('Summarize everything')
|
|
428
|
+
await channel.stop() // Stop the in-flight interaction (false if none)
|
|
429
|
+
await channel.stopInteraction(channel.activeLeafId!) // Stop a specific interaction by ID
|
|
383
430
|
|
|
384
431
|
// Schema
|
|
385
432
|
channel.getSchema()
|
|
@@ -387,7 +434,7 @@ await channel.createCollection('article', [
|
|
|
387
434
|
{ name: 'title', type: { kind: 'string' } },
|
|
388
435
|
{ name: 'status', type: { kind: 'enum', values: ['draft', 'published'] } },
|
|
389
436
|
])
|
|
390
|
-
await channel.alterCollection('article',
|
|
437
|
+
await channel.alterCollection('article', updatedFields)
|
|
391
438
|
await channel.dropCollection('article')
|
|
392
439
|
|
|
393
440
|
// Undo/Redo
|
|
@@ -405,7 +452,7 @@ await channel.renameConversation('Research')
|
|
|
405
452
|
// Conversation handles (reactive interactions for specific conversations)
|
|
406
453
|
const thread = channel.conversation('thread-42');
|
|
407
454
|
await thread.prompt('Hello'); // Uses thread-42's interaction history
|
|
408
|
-
// thread.interactions is reactive $state —
|
|
455
|
+
// thread.interactions is reactive $state — updates from space/channel events
|
|
409
456
|
thread.close(); // Stop listening when done
|
|
410
457
|
|
|
411
458
|
// Channel admin
|
|
@@ -417,22 +464,23 @@ See the [SDK documentation](../sdk/README.md) for complete API details.
|
|
|
417
464
|
### Utilities
|
|
418
465
|
|
|
419
466
|
```typescript
|
|
420
|
-
import {
|
|
467
|
+
import { machinePath, machineUri, isObjectPath, generateId } from '@rool-dev/svelte';
|
|
421
468
|
|
|
422
|
-
|
|
423
|
-
|
|
469
|
+
machinePath('rool-machine:/rool-drive/docs/read%20me.md');
|
|
470
|
+
// '/rool-drive/docs/read me.md'
|
|
424
471
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
472
|
+
machineUri('/space/article/welcome.json');
|
|
473
|
+
// 'rool-machine:/space/article/welcome.json'
|
|
474
|
+
|
|
475
|
+
isObjectPath('/space/article/welcome.json'); // true
|
|
476
|
+
generateId(); // 6-character alphanumeric ID
|
|
429
477
|
```
|
|
430
478
|
|
|
431
479
|
## Exported Types
|
|
432
480
|
|
|
433
481
|
```typescript
|
|
434
482
|
// Package types
|
|
435
|
-
import type { Rool, ReactiveChannel, ReactiveConversationHandle, ReactiveObject, ReactiveWatch, WatchOptions, ReactiveChannelList } from '@rool-dev/svelte';
|
|
483
|
+
import type { Rool, ReactiveSpace, ReactiveChannel, ReactiveConversationHandle, ReactiveObject, ReactiveWatch, WatchOptions, ReactiveChannelList, ReactiveFileTree, ReactiveFileNode, ReactiveFileRoot, ReactiveFileTreeEvent, ReactiveFileTreeSyncResult } from '@rool-dev/svelte';
|
|
436
484
|
|
|
437
485
|
// Re-exported from @rool-dev/sdk
|
|
438
486
|
import type {
|
|
@@ -442,6 +490,7 @@ import type {
|
|
|
442
490
|
RoolSpace,
|
|
443
491
|
RoolSpaceInfo,
|
|
444
492
|
RoolObject,
|
|
493
|
+
GetObjectsResult,
|
|
445
494
|
RoolObjectStat,
|
|
446
495
|
RoolUserRole,
|
|
447
496
|
ConnectionState,
|
|
@@ -450,30 +499,27 @@ import type {
|
|
|
450
499
|
ConversationInfo,
|
|
451
500
|
CurrentUser,
|
|
452
501
|
Interaction,
|
|
453
|
-
FindObjectsOptions,
|
|
454
502
|
PromptOptions,
|
|
455
|
-
|
|
503
|
+
PromptAttachment,
|
|
456
504
|
UpdateObjectOptions,
|
|
457
505
|
MoveObjectOptions,
|
|
506
|
+
CollectionOptions,
|
|
458
507
|
FieldType,
|
|
459
508
|
FieldDef,
|
|
460
509
|
CollectionDef,
|
|
461
510
|
SpaceSchema,
|
|
462
511
|
SpaceMember,
|
|
463
512
|
UserResult,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
513
|
+
SpaceFileStorageUsage,
|
|
514
|
+
RoolSpaceEvents,
|
|
515
|
+
WebDAVDepth,
|
|
516
|
+
WebDAVSyncLevel,
|
|
517
|
+
WebDAVPropName,
|
|
518
|
+
WebDAVResponse,
|
|
519
|
+
WebDAVProps,
|
|
469
520
|
} from '@rool-dev/svelte';
|
|
470
521
|
```
|
|
471
522
|
|
|
472
|
-
## Examples
|
|
473
|
-
|
|
474
|
-
- [soft-sql](../../examples/soft-sql) — SQL-style natural language queries with live tool call progress
|
|
475
|
-
- [flashcards](../../examples/flashcards) — Spaced repetition with AI-generated cards
|
|
476
|
-
|
|
477
523
|
## License
|
|
478
524
|
|
|
479
525
|
MIT - see [LICENSE](../../LICENSE) for details.
|
package/dist/channel.svelte.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { RoolChannel, RoolSpace, Interaction, RoolObject, ChannelInfo, ConversationInfo, ConversationHandle } from '@rool-dev/sdk';
|
|
2
|
+
import { ReactiveFileTree } from './file-tree.svelte.js';
|
|
2
3
|
/**
|
|
3
4
|
* Options for creating a reactive watch.
|
|
4
|
-
*
|
|
5
|
+
* Structured object filter for reactive updates.
|
|
5
6
|
*/
|
|
6
7
|
export interface WatchOptions {
|
|
7
8
|
/** Field requirements for exact matching */
|
|
@@ -14,16 +15,14 @@ export interface WatchOptions {
|
|
|
14
15
|
order?: 'asc' | 'desc';
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
* A reactive watch of objects that auto-updates when matching
|
|
18
|
+
* A reactive watch of objects that auto-updates when matching object files change.
|
|
18
19
|
*/
|
|
19
20
|
declare class ReactiveWatchImpl {
|
|
20
21
|
#private;
|
|
21
22
|
objects: RoolObject[];
|
|
22
23
|
loading: boolean;
|
|
23
|
-
constructor(channel: RoolChannel, options: WatchOptions);
|
|
24
|
-
/**
|
|
25
|
-
* Re-fetch the watched objects from the channel.
|
|
26
|
-
*/
|
|
24
|
+
constructor(channel: RoolChannel, fileTree: ReactiveFileTree, options: WatchOptions);
|
|
25
|
+
/** Re-fetch matching objects using the canonical file tree for paths. */
|
|
27
26
|
refresh(): Promise<void>;
|
|
28
27
|
close(): void;
|
|
29
28
|
}
|
|
@@ -35,7 +34,7 @@ declare class ReactiveObjectImpl {
|
|
|
35
34
|
#private;
|
|
36
35
|
data: RoolObject | undefined;
|
|
37
36
|
loading: boolean;
|
|
38
|
-
constructor(channel: RoolChannel,
|
|
37
|
+
constructor(channel: RoolChannel, fileTree: ReactiveFileTree, path: string);
|
|
39
38
|
refresh(): Promise<void>;
|
|
40
39
|
close(): void;
|
|
41
40
|
}
|
|
@@ -52,15 +51,11 @@ declare class ReactiveConversationHandleImpl {
|
|
|
52
51
|
getSystemInstruction(): string | undefined;
|
|
53
52
|
setSystemInstruction(...args: Parameters<ConversationHandle['setSystemInstruction']>): Promise<void>;
|
|
54
53
|
rename(...args: Parameters<ConversationHandle['rename']>): Promise<void>;
|
|
55
|
-
|
|
56
|
-
objects: RoolObject[];
|
|
57
|
-
message: string;
|
|
58
|
-
}>;
|
|
59
|
-
createObject(...args: Parameters<ConversationHandle['createObject']>): Promise<{
|
|
54
|
+
putObject(...args: Parameters<ConversationHandle['putObject']>): Promise<{
|
|
60
55
|
object: RoolObject;
|
|
61
56
|
message: string;
|
|
62
57
|
}>;
|
|
63
|
-
|
|
58
|
+
patchObject(...args: Parameters<ConversationHandle['patchObject']>): Promise<{
|
|
64
59
|
object: RoolObject;
|
|
65
60
|
message: string;
|
|
66
61
|
}>;
|
|
@@ -69,10 +64,13 @@ declare class ReactiveConversationHandleImpl {
|
|
|
69
64
|
message: string;
|
|
70
65
|
}>;
|
|
71
66
|
deleteObjects(...args: Parameters<ConversationHandle['deleteObjects']>): Promise<void>;
|
|
67
|
+
/** @deprecated Use deleteObjects instead. */
|
|
68
|
+
deletePaths(...args: Parameters<ConversationHandle['deletePaths']>): Promise<void>;
|
|
72
69
|
prompt(...args: Parameters<ConversationHandle['prompt']>): Promise<{
|
|
73
70
|
message: string;
|
|
74
71
|
objects: RoolObject[];
|
|
75
72
|
}>;
|
|
73
|
+
stop(): Promise<boolean>;
|
|
76
74
|
createCollection(...args: Parameters<ConversationHandle['createCollection']>): Promise<import("@rool-dev/sdk").CollectionDef>;
|
|
77
75
|
alterCollection(...args: Parameters<ConversationHandle['alterCollection']>): Promise<import("@rool-dev/sdk").CollectionDef>;
|
|
78
76
|
dropCollection(...args: Parameters<ConversationHandle['dropCollection']>): Promise<void>;
|
|
@@ -87,10 +85,10 @@ export type ReactiveConversationHandle = ReactiveConversationHandleImpl;
|
|
|
87
85
|
declare class ReactiveChannelImpl {
|
|
88
86
|
#private;
|
|
89
87
|
interactions: Interaction[];
|
|
90
|
-
|
|
88
|
+
objectPaths: string[];
|
|
91
89
|
collections: string[];
|
|
92
90
|
conversations: ConversationInfo[];
|
|
93
|
-
constructor(channel: RoolChannel);
|
|
91
|
+
constructor(channel: RoolChannel, fileTree: ReactiveFileTree);
|
|
94
92
|
get id(): string;
|
|
95
93
|
get name(): string;
|
|
96
94
|
get role(): import("@rool-dev/sdk").RoolUserRole;
|
|
@@ -99,22 +97,16 @@ declare class ReactiveChannelImpl {
|
|
|
99
97
|
get channelName(): string | null;
|
|
100
98
|
get isReadOnly(): boolean;
|
|
101
99
|
get linkAccess(): import("@rool-dev/sdk").LinkAccess;
|
|
102
|
-
get extensionUrl(): string | null;
|
|
103
|
-
get manifest(): import("@rool-dev/sdk").ExtensionManifest | null;
|
|
104
100
|
get isClosed(): boolean;
|
|
105
101
|
close(): void;
|
|
106
102
|
getObject(...args: Parameters<RoolChannel['getObject']>): Promise<RoolObject | undefined>;
|
|
103
|
+
getObjects(...args: Parameters<RoolChannel['getObjects']>): Promise<import("@rool-dev/sdk").GetObjectsResult>;
|
|
107
104
|
stat(...args: Parameters<RoolChannel['stat']>): import("@rool-dev/sdk").RoolObjectStat | undefined;
|
|
108
|
-
|
|
109
|
-
objects: RoolObject[];
|
|
110
|
-
message: string;
|
|
111
|
-
}>;
|
|
112
|
-
getObjectLocations(...args: Parameters<RoolChannel['getObjectLocations']>): string[];
|
|
113
|
-
createObject(...args: Parameters<RoolChannel['createObject']>): Promise<{
|
|
105
|
+
putObject(...args: Parameters<RoolChannel['putObject']>): Promise<{
|
|
114
106
|
object: RoolObject;
|
|
115
107
|
message: string;
|
|
116
108
|
}>;
|
|
117
|
-
|
|
109
|
+
patchObject(...args: Parameters<RoolChannel['patchObject']>): Promise<{
|
|
118
110
|
object: RoolObject;
|
|
119
111
|
message: string;
|
|
120
112
|
}>;
|
|
@@ -123,10 +115,14 @@ declare class ReactiveChannelImpl {
|
|
|
123
115
|
message: string;
|
|
124
116
|
}>;
|
|
125
117
|
deleteObjects(...args: Parameters<RoolChannel['deleteObjects']>): Promise<void>;
|
|
118
|
+
/** @deprecated Use deleteObjects instead. */
|
|
119
|
+
deletePaths(...args: Parameters<RoolChannel['deletePaths']>): Promise<void>;
|
|
126
120
|
prompt(...args: Parameters<RoolChannel['prompt']>): Promise<{
|
|
127
121
|
message: string;
|
|
128
122
|
objects: RoolObject[];
|
|
129
123
|
}>;
|
|
124
|
+
stop(): Promise<boolean>;
|
|
125
|
+
stopInteraction(...args: Parameters<RoolChannel['stopInteraction']>): Promise<boolean>;
|
|
130
126
|
checkpoint(...args: Parameters<RoolChannel['checkpoint']>): Promise<string>;
|
|
131
127
|
canUndo(): Promise<boolean>;
|
|
132
128
|
canRedo(): Promise<boolean>;
|
|
@@ -155,15 +151,15 @@ declare class ReactiveChannelImpl {
|
|
|
155
151
|
on(...args: Parameters<RoolChannel['on']>): () => void;
|
|
156
152
|
off(...args: Parameters<RoolChannel['off']>): void;
|
|
157
153
|
/**
|
|
158
|
-
* Create a reactive object that auto-updates when the object at this
|
|
154
|
+
* Create a reactive object that auto-updates when the object at this path changes.
|
|
159
155
|
*/
|
|
160
|
-
object(
|
|
156
|
+
object(path: string): ReactiveObject;
|
|
161
157
|
/**
|
|
162
158
|
* Create a reactive watch that auto-updates when matching objects change.
|
|
163
159
|
*/
|
|
164
160
|
watch(options: WatchOptions): ReactiveWatch;
|
|
165
161
|
}
|
|
166
|
-
export declare function wrapChannel(channel: RoolChannel): ReactiveChannel;
|
|
162
|
+
export declare function wrapChannel(channel: RoolChannel, fileTree: ReactiveFileTree): ReactiveChannel;
|
|
167
163
|
export type ReactiveChannel = ReactiveChannelImpl;
|
|
168
164
|
/**
|
|
169
165
|
* A reactive list of channels for a space that auto-updates via SSE events.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.svelte.d.ts","sourceRoot":"","sources":["../src/channel.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel.svelte.d.ts","sourceRoot":"","sources":["../src/channel.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAEnB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