@rool-dev/sdk 0.9.0-dev.a397f4d → 0.9.0-dev.ccdc62b

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 CHANGED
@@ -4,13 +4,14 @@ The TypeScript SDK for Rool, a persistent and collaborative environment for orga
4
4
 
5
5
  > **Building a new Rool extension?** Start with [`@rool-dev/extension`](/extension/) — 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 extension sandbox.
6
6
 
7
- The SDK manages authentication, real-time synchronization, and media storage. Core primitives:
7
+ The SDK manages authentication, real-time synchronization, and per-space file storage. Core primitives:
8
8
 
9
- - **Spaces** — Containers for objects, schema, metadata, and channels
9
+ - **Spaces** — Containers for objects, schema, metadata, channels, and files
10
10
  - **Channels** — Named contexts within a space. All object and AI operations go through a channel.
11
11
  - **Conversations** — Independent interaction histories within 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
+ - **File storage** — Every space has WebDAV file storage
14
15
 
15
16
  ## Installation
16
17
 
@@ -82,11 +83,11 @@ channel.close();
82
83
 
83
84
  ### Spaces and Channels
84
85
 
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 contains one or more **conversations**, each with independent interaction history.
86
+ A **space** is a container that holds objects, schema, metadata, channels, and files. 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.
86
87
 
87
88
  There are two main handles:
88
- - **`RoolSpace`** — Live handle with SSE subscription for user management, link access, channel management, export, and channel lifecycle events. Extends `EventEmitter`.
89
- - **`RoolChannel`** — Full real-time handle for objects, AI prompts, media, schema, and undo/redo.
89
+ - **`RoolSpace`** — Live handle with SSE subscription for user management, link access, channel management, file storage, export, and channel lifecycle events. Extends `EventEmitter`.
90
+ - **`RoolChannel`** — Full real-time handle for objects, AI prompts, schema, and undo/redo.
90
91
 
91
92
  ```typescript
92
93
  // Open a space — live handle with SSE subscription
@@ -395,7 +396,7 @@ Returns a message (the AI's response) and the list of objects that were created
395
396
  | `ephemeral` | If true, don't record in interaction history (useful for tab completion) |
396
397
  | `readOnly` | If true, disable mutation tools (create, update, delete). Use for questions. |
397
398
  | `parentInteractionId` | Parent interaction in the conversation tree. Omit to auto-continue from the active leaf. Pass `null` to start a new root-level branch. Pass a specific ID to branch from that point (edit/reroll). |
398
- | `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. The AI can interpret images (JPEG, PNG, GIF, WebP, SVG), PDFs, text-based files (plain text, Markdown, CSV, HTML, XML, JSON), and DOCX documents. Other file types are uploaded and stored but the AI cannot read their contents. |
399
+ | `attachments` | Files to attach (`File`, `Blob`, or `{ data, contentType }`). Stored as authenticated space files; resulting `rool-drive:/...` references are stored on the interaction's `attachments` field for UI rendering. The AI can interpret images (JPEG, PNG, GIF, WebP, SVG), PDFs, text-based files (plain text, Markdown, CSV, HTML, XML, JSON), and DOCX documents. Other file types are uploaded and stored but the AI cannot natively consume their contents, only use shell tools on them. |
399
400
  | `signal` | `AbortSignal` to stop the prompt mid-flight. When aborted, the agent loop halts and the streaming response closes. Note that any LLM turn already in flight on Vertex keeps generating server-side and is billed. |
400
401
 
401
402
  ### Effort Levels
@@ -593,6 +594,7 @@ const client = new RoolClient({
593
594
  | `createSpace(name): Promise<RoolSpace>` | Create a new space, returns live handle with SSE subscription |
594
595
  | `deleteSpace(id): Promise<void>` | Permanently delete a space (cannot be undone) |
595
596
  | `importArchive(name, archive): Promise<RoolSpace>` | Import from a zip archive, creating a new space |
597
+ | `webdav(spaceId): RoolWebDAV` | Open a WebDAV client for a space's file storage |
596
598
 
597
599
  ### Channel Management
598
600
 
@@ -710,7 +712,7 @@ client.on('spaceRenamed', (id, name) => {
710
712
 
711
713
  ## RoolSpace API
712
714
 
713
- A space handle with a live SSE subscription. Extends `EventEmitter`. Manages user access, link sharing, channels, and export. The `channels` property auto-updates via SSE, and channel lifecycle events fire in real-time.
715
+ A space handle with a live SSE subscription. Extends `EventEmitter`. Manages user access, link sharing, channels, file storage, and export. The `channels` property auto-updates via SSE, and channel lifecycle events fire in real-time.
714
716
 
715
717
  `openSpace()` caches and reuses open spaces — calling it twice with the same ID returns the same instance. Call `close()` when done to stop the subscription and close all open channels.
716
718
 
@@ -724,6 +726,7 @@ A space handle with a live SSE subscription. Extends `EventEmitter`. Manages use
724
726
  | `linkAccess: LinkAccess` | URL sharing level |
725
727
  | `memberCount: number` | Number of users with access to the space |
726
728
  | `channels: ChannelInfo[]` | Live channel list (auto-updates via SSE) |
729
+ | `webdav: RoolWebDAV` | WebDAV client for this space's file storage |
727
730
 
728
731
  ### Methods
729
732
 
@@ -885,35 +888,63 @@ Store arbitrary data alongside the Space without it being part of the object dat
885
888
  | `getMetadata(key): unknown` | Get metadata value, or undefined if key not set |
886
889
  | `getAllMetadata(): Record<string, unknown>` | Get all metadata |
887
890
 
888
- ### Media
891
+ ### Space File Storage
889
892
 
890
- Media URLs in object fields are visible to AI. Both uploaded and AI-generated media work the same way — use `fetchMedia` to retrieve them for display.
893
+ Every space has authenticated file storage. WebDAV is the SDK surface for that storage: paths are relative to the space root, collection operations use WebDAV collection semantics, and `rool-drive:/...` references are the text-safe way to point at files.
891
894
 
892
- | Method | Description |
893
- |--------|-------------|
894
- | `uploadMedia(file): Promise<string>` | Upload file, returns URL |
895
- | `fetchMedia(url, options?): Promise<MediaResponse>` | Fetch any URL, returns headers and blob() method (adds auth for backend URLs, works for external URLs too). Pass `{ forceProxy: true }` to skip the direct fetch and route through the server proxy immediately. |
896
- | `deleteMedia(url): Promise<void>` | Delete media file by URL |
897
- | `listMedia(): Promise<MediaInfo[]>` | List all media with metadata |
895
+ Use `client.webdav(spaceId)` when you only have an ID, or `space.webdav` when you already have an open space.
898
896
 
899
897
  ```typescript
900
- // Upload an image
901
- const url = await channel.uploadMedia(file);
902
- await channel.createObject({ data: { type: 'photo', title: 'Photo', image: url } });
898
+ const webdav = client.webdav('space-id');
903
899
 
904
- // Or let AI generate one using a placeholder
905
- await channel.createObject({
906
- data: { type: 'photo', title: 'Mascot', image: '{{generate an image of a flying tortoise}}' }
900
+ await webdav.mkcol('docs');
901
+ await webdav.put('docs/readme.md', '# Hello', {
902
+ contentType: 'text/markdown',
903
+ ifNoneMatch: '*',
907
904
  });
908
905
 
909
- // Display media (handles auth automatically)
910
- const response = await channel.fetchMedia(object.image);
911
- if (response.contentType.startsWith('image/')) {
912
- const blob = await response.blob();
913
- img.src = URL.createObjectURL(blob);
914
- }
906
+ const listing = await webdav.propfind('docs/', {
907
+ depth: '1',
908
+ props: ['displayname', 'getcontentlength', 'getcontenttype', 'getetag'],
909
+ });
910
+
911
+ const file = await webdav.get('docs/readme.md');
912
+ console.log(await file.text());
913
+
914
+ const ref = webdav.ref('docs/read me.md'); // "rool-drive:/docs/read%20me.md"
915
+ const sameFile = await webdav.get(ref);
915
916
  ```
916
917
 
918
+ Paths are space-relative (`docs/readme.md`, not `/docs/readme.md`). `rool-drive:/...` references percent-encode path segments for use in text; `webdav.path('rool-drive:/docs/read%20me.md')` returns `docs/read me.md`. The WebDAV methods accept either paths or refs and normalize them to paths. `PUT` writes an exact path and does not create parent collections; create parents with `mkcol()` first. Helpers preserve WebDAV status semantics: non-success responses throw `WebDAVError` with `status`, `statusText`, and `body`.
919
+
920
+ | Method | Description |
921
+ |--------|-------------|
922
+ | `client.webdav(spaceId)` | Create a WebDAV client for a space |
923
+ | `space.webdav` | WebDAV client for an open space |
924
+ | `webdav.ref(path)` | Create a `rool-drive:/...` reference |
925
+ | `webdav.path(pathOrRef)` | Normalize a path or `rool-drive:/...` reference to a path |
926
+ | `webdav.propfind(pathOrRef, options)` | Read properties/list collections; explicit `depth` required |
927
+ | `webdav.get(pathOrRef, options?)` / `webdav.head(pathOrRef)` | Read a file, including optional byte ranges for `get` |
928
+ | `webdav.put(pathOrRef, body, options?)` | Write an exact file path; parents must already exist |
929
+ | `webdav.mkcol(path)` | Create one collection |
930
+ | `webdav.copy(source, destination, options?)` | Copy a file or collection within the same space |
931
+ | `webdav.move(source, destination, options?)` | Move a file or collection within the same space |
932
+ | `webdav.delete(pathOrRef, options?)` | Delete a file or collection |
933
+ | `webdav.lock(pathOrRef, options)` / `webdav.refreshLock(pathOrRef, token)` / `webdav.unlock(token)` | WebDAV Class 2 write locks |
934
+ | `webdav.request(method, path, init?)` | Raw authenticated WebDAV request escape hatch |
935
+
936
+ #### File references from AI responses
937
+
938
+ When an agent refers to a user-visible file, the SDK contract is `rool-drive:/path/to/file.ext`. That prefix makes a file reference unambiguous without exposing the authenticated WebDAV URL. In free text, ambiguous characters such as spaces are percent-encoded (`rool-drive:/docs/read%20me.md`).
939
+
940
+ ```typescript
941
+ const response = await space.webdav.get('rool-drive:/docs/readme.md');
942
+ const blob = await response.blob();
943
+ img.src = URL.createObjectURL(blob);
944
+ ```
945
+
946
+ Plain relative strings like `docs/readme.md` are valid WebDAV paths when you already know you are working with file storage. In user text or agent output, use `rool-drive:/docs/readme.md` so clients do not have to guess whether a string is a file. Prefer `webdav.ref(path)` rather than building refs by hand.
947
+
917
948
  ### Proxied Fetch
918
949
 
919
950
  Fetch external URLs via the server, bypassing CORS restrictions. Requires editor role or above. Private/internal IP ranges are blocked (SSRF protection).
@@ -994,7 +1025,7 @@ Export and import space data as zip archives for backup, portability, or migrati
994
1025
 
995
1026
  | Method | Description |
996
1027
  |--------|-------------|
997
- | `space.exportArchive(): Promise<Blob>` | Export objects, metadata, channels, and media as a zip archive |
1028
+ | `space.exportArchive(): Promise<Blob>` | Export objects, metadata, channels, and files as a zip archive |
998
1029
  | `client.importArchive(name, archive): Promise<RoolSpace>` | Import from a zip archive, creating a new space |
999
1030
 
1000
1031
  **Export:**
@@ -1011,7 +1042,7 @@ const space = await client.importArchive('Imported Data', archiveBlob);
1011
1042
  const channel = await space.openChannel('main');
1012
1043
  ```
1013
1044
 
1014
- 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.
1045
+ The archive bundles `data.json` (objects, metadata, and channels) together with the space file storage. File references are rewritten to relative paths within the archive and restored on import.
1015
1046
 
1016
1047
  ### Channel Events
1017
1048
 
@@ -1220,7 +1251,7 @@ interface Interaction {
1220
1251
  ai: boolean; // Whether AI was invoked (vs synthetic confirmation)
1221
1252
  modifiedObjectIds: string[]; // Objects affected by this interaction
1222
1253
  toolCalls: ToolCall[]; // Tools called during this interaction (for AI prompts)
1223
- attachments?: string[]; // Media URLs attached by the user (images, documents, etc.)
1254
+ attachments?: string[]; // rool-drive:/... file references attached by the user
1224
1255
  }
1225
1256
  ```
1226
1257
 
@@ -1234,8 +1265,6 @@ interface RoolSpaceInfo { id: string; name: string; role: RoolUserRole; ownerId:
1234
1265
  interface SpaceMember { id: string; email: string; role: RoolUserRole; photoUrl: string | null; }
1235
1266
  interface UserResult { id: string; email: string; name: string | null; photoUrl: string | null; }
1236
1267
  interface CurrentUser { id: string; email: string; name: string | null; photoUrl: string | null; slug: string; plan: string; creditsBalance: number; totalCreditsUsed: number; createdAt: string; lastActivity: string; processedAt: string; storage: Record<string, unknown>; }
1237
- interface MediaInfo { url: string; contentType: string; size: number; createdAt: string; }
1238
- interface MediaResponse { contentType: string; size: number | null; blob(): Promise<Blob>; }
1239
1268
  type ChangeSource = 'local_user' | 'remote_user' | 'remote_agent' | 'system';
1240
1269
  ```
1241
1270
 
@@ -1251,7 +1280,7 @@ interface PromptOptions {
1251
1280
  ephemeral?: boolean; // Don't record in interaction history
1252
1281
  readOnly?: boolean; // Disable mutation tools (default: false)
1253
1282
  parentInteractionId?: string | null; // Branch from a specific interaction (omit to auto-continue)
1254
- attachments?: Array<File | Blob | { data: string; contentType: string }>; // Files to attach (uploaded to media store)
1283
+ attachments?: Array<File | Blob | { data: string; contentType: string }>; // Files to attach
1255
1284
  }
1256
1285
  ```
1257
1286
 
package/dist/channel.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { EventEmitter } from './event-emitter.js';
2
2
  import type { GraphQLClient } from './graphql.js';
3
- import type { MediaClient } from './media.js';
3
+ import type { RestClient } from './rest.js';
4
+ import type { RoolWebDAV } from './webdav.js';
4
5
  import type { Logger } from './logger.js';
5
- import type { RoolObject, RoolObjectStat, ChannelEvents, RoolUserRole, PromptOptions, FindObjectsOptions, CreateObjectOptions, UpdateObjectOptions, MediaInfo, MediaResponse, ChannelEvent, Interaction, Channel, ConversationInfo, LinkAccess, SpaceSchema, CollectionDef, FieldDef, ExtensionManifest } from './types.js';
6
+ import type { RoolObject, RoolObjectStat, ChannelEvents, RoolUserRole, PromptOptions, FindObjectsOptions, CreateObjectOptions, UpdateObjectOptions, ChannelEvent, Interaction, Channel, ConversationInfo, LinkAccess, SpaceSchema, CollectionDef, FieldDef, ExtensionManifest } from './types.js';
6
7
  export declare function generateEntityId(): string;
7
8
  export interface ChannelConfig {
8
9
  id: string;
@@ -24,7 +25,8 @@ export interface ChannelConfig {
24
25
  /** Channel ID for this channel (required). */
25
26
  channelId: string;
26
27
  graphqlClient: GraphQLClient;
27
- mediaClient: MediaClient;
28
+ restClient: RestClient;
29
+ webdav: RoolWebDAV;
28
30
  logger: Logger;
29
31
  onClose: () => void;
30
32
  }
@@ -56,7 +58,8 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
56
58
  private _conversationId;
57
59
  private _closed;
58
60
  private graphqlClient;
59
- private mediaClient;
61
+ private restClient;
62
+ private webdav;
60
63
  private onCloseCallback;
61
64
  private logger;
62
65
  private _meta;
@@ -370,29 +373,6 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
370
373
  * Rename this channel.
371
374
  */
372
375
  rename(newName: string): Promise<void>;
373
- /**
374
- * List all media files for this space.
375
- */
376
- listMedia(): Promise<MediaInfo[]>;
377
- /**
378
- * Upload a file to this space. Returns the URL.
379
- */
380
- uploadMedia(file: File | Blob | {
381
- data: string;
382
- contentType: string;
383
- }): Promise<string>;
384
- /**
385
- * Fetch any URL, returning headers and a blob() method (like fetch Response).
386
- * Adds auth headers for backend media URLs, fetches external URLs via server proxy if CORS blocks.
387
- * Pass `{ forceProxy: true }` to skip the direct fetch and go straight through the server proxy.
388
- */
389
- fetchMedia(url: string, options?: {
390
- forceProxy?: boolean;
391
- }): Promise<MediaResponse>;
392
- /**
393
- * Delete a media file by URL.
394
- */
395
- deleteMedia(url: string): Promise<void>;
396
376
  /**
397
377
  * Fetch an external URL via the server proxy, bypassing CORS restrictions.
398
378
  * Requires editor role or above. Blocked for private/internal IP ranges (SSRF protection).
@@ -406,6 +386,8 @@ export declare class RoolChannel extends EventEmitter<ChannelEvents> {
406
386
  headers?: Record<string, string>;
407
387
  body?: unknown;
408
388
  }): Promise<Response>;
389
+ private uploadAttachment;
390
+ private ensureCollection;
409
391
  /**
410
392
  * Register a collector that resolves when the object arrives via SSE.
411
393
  * If the object is already in the buffer (arrived before collector), resolves immediately.
@@ -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,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,aAAa,EAEb,YAAY,EACZ,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,iBA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M,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAIpH,6BAA6B;IACvB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,4EAA4E;IACtE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAIxG,sCAAsC;IAChC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAIhF,2CAA2C;IACrC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAI/E,gCAAgC;IAC1B,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;CAG/C"}
package/dist/channel.js CHANGED
@@ -40,6 +40,80 @@ function findDefaultLeaf(interactions) {
40
40
  }
41
41
  return best?.id;
42
42
  }
43
+ function attachmentBody(file, index) {
44
+ if (isFile(file)) {
45
+ return {
46
+ filename: safeAttachmentFilename(file.name, index, file.type),
47
+ contentType: file.type || 'application/octet-stream',
48
+ body: file,
49
+ };
50
+ }
51
+ if (isBlob(file)) {
52
+ const contentType = file.type || 'application/octet-stream';
53
+ return {
54
+ filename: safeAttachmentFilename(`attachment-${index + 1}`, index, contentType),
55
+ contentType,
56
+ body: file,
57
+ };
58
+ }
59
+ return {
60
+ filename: safeAttachmentFilename(`attachment-${index + 1}`, index, file.contentType),
61
+ contentType: file.contentType,
62
+ body: base64Body(file.data),
63
+ };
64
+ }
65
+ function isFile(value) {
66
+ return typeof File !== 'undefined' && value instanceof File;
67
+ }
68
+ function isBlob(value) {
69
+ return typeof Blob !== 'undefined' && value instanceof Blob;
70
+ }
71
+ function safeAttachmentFilename(name, index, contentType) {
72
+ const fallback = `attachment.${extensionForContentType(contentType)}`;
73
+ const leaf = name.split(/[/\\]/).pop() || fallback;
74
+ const cleaned = leaf.replace(/[\x00-\x1f\x7f]/g, '').replace(/\s+/g, '_');
75
+ const safe = cleaned.replace(/[^A-Za-z0-9._-]/g, '_').replace(/^\.+$/, '') || fallback;
76
+ return `${index + 1}-${safe}`;
77
+ }
78
+ function extensionForContentType(contentType) {
79
+ if (contentType === 'image/png')
80
+ return 'png';
81
+ if (contentType === 'image/jpeg')
82
+ return 'jpg';
83
+ if (contentType === 'image/gif')
84
+ return 'gif';
85
+ if (contentType === 'image/webp')
86
+ return 'webp';
87
+ if (contentType === 'image/svg+xml')
88
+ return 'svg';
89
+ if (contentType === 'application/pdf')
90
+ return 'pdf';
91
+ if (contentType === 'text/markdown')
92
+ return 'md';
93
+ if (contentType === 'text/plain')
94
+ return 'txt';
95
+ if (contentType === 'text/csv')
96
+ return 'csv';
97
+ if (contentType === 'text/html')
98
+ return 'html';
99
+ if (contentType === 'application/json')
100
+ return 'json';
101
+ if (contentType === 'application/xml')
102
+ return 'xml';
103
+ return 'bin';
104
+ }
105
+ function base64Body(data) {
106
+ const clean = data.includes(',') ? data.slice(data.indexOf(',') + 1) : data;
107
+ if (typeof Buffer !== 'undefined') {
108
+ const buffer = Buffer.from(clean, 'base64');
109
+ return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
110
+ }
111
+ const binary = atob(clean);
112
+ const bytes = new Uint8Array(binary.length);
113
+ for (let i = 0; i < binary.length; i++)
114
+ bytes[i] = binary.charCodeAt(i);
115
+ return bytes.buffer;
116
+ }
43
117
  // Default timeout for waiting on SSE object events (30 seconds)
44
118
  const OBJECT_COLLECT_TIMEOUT = 30000;
45
119
  /**
@@ -70,7 +144,8 @@ export class RoolChannel extends EventEmitter {
70
144
  _conversationId;
71
145
  _closed = false;
72
146
  graphqlClient;
73
- mediaClient;
147
+ restClient;
148
+ webdav;
74
149
  onCloseCallback;
75
150
  logger;
76
151
  // Local cache for bounded data (schema, metadata, own channel, object IDs, stats)
@@ -99,7 +174,8 @@ export class RoolChannel extends EventEmitter {
99
174
  this._channelId = config.channelId;
100
175
  this._conversationId = 'default';
101
176
  this.graphqlClient = config.graphqlClient;
102
- this.mediaClient = config.mediaClient;
177
+ this.restClient = config.restClient;
178
+ this.webdav = config.webdav;
103
179
  this.logger = config.logger;
104
180
  this.onCloseCallback = config.onClose;
105
181
  // Initialize local cache from server data
@@ -770,17 +846,17 @@ export class RoolChannel extends EventEmitter {
770
846
  }
771
847
  /** @internal */
772
848
  async _promptImpl(prompt, options, conversationId) {
773
- // Upload attachments via media endpoint, then send URLs to the server
849
+ // Attachments become rool-drive:/ file references stored on the interaction.
774
850
  const { attachments, parentInteractionId: explicitParent, signal, ...rest } = options ?? {};
851
+ const interactionId = generateEntityId();
775
852
  let attachmentUrls;
776
853
  if (attachments?.length) {
777
- attachmentUrls = await Promise.all(attachments.map(file => this.mediaClient.upload(this._id, file)));
854
+ attachmentUrls = await Promise.all(attachments.map((file, index) => this.uploadAttachment(file, interactionId, index)));
778
855
  }
779
856
  // Auto-continue from active leaf if no explicit parent provided
780
857
  const parentInteractionId = explicitParent !== undefined
781
858
  ? explicitParent
782
859
  : (this._getActiveLeafImpl(conversationId) ?? null);
783
- const interactionId = generateEntityId();
784
860
  // Optimistically set active leaf before the server call.
785
861
  this._activeLeaves.set(conversationId, interactionId);
786
862
  let onAbort;
@@ -855,32 +931,6 @@ export class RoolChannel extends EventEmitter {
855
931
  throw error;
856
932
  }
857
933
  }
858
- /**
859
- * List all media files for this space.
860
- */
861
- async listMedia() {
862
- return this.mediaClient.list(this._id);
863
- }
864
- /**
865
- * Upload a file to this space. Returns the URL.
866
- */
867
- async uploadMedia(file) {
868
- return this.mediaClient.upload(this._id, file);
869
- }
870
- /**
871
- * Fetch any URL, returning headers and a blob() method (like fetch Response).
872
- * Adds auth headers for backend media URLs, fetches external URLs via server proxy if CORS blocks.
873
- * Pass `{ forceProxy: true }` to skip the direct fetch and go straight through the server proxy.
874
- */
875
- async fetchMedia(url, options) {
876
- return this.mediaClient.fetch(this._id, url, options);
877
- }
878
- /**
879
- * Delete a media file by URL.
880
- */
881
- async deleteMedia(url) {
882
- return this.mediaClient.delete(this._id, url);
883
- }
884
934
  /**
885
935
  * Fetch an external URL via the server proxy, bypassing CORS restrictions.
886
936
  * Requires editor role or above. Blocked for private/internal IP ranges (SSRF protection).
@@ -890,7 +940,22 @@ export class RoolChannel extends EventEmitter {
890
940
  * @returns The proxied Response
891
941
  */
892
942
  async fetch(url, init) {
893
- return this.mediaClient.proxyFetch(this._id, url, init);
943
+ return this.restClient.proxyFetch(this._id, url, init);
944
+ }
945
+ async uploadAttachment(file, interactionId, index) {
946
+ await this.ensureCollection('attachments');
947
+ const directory = `attachments/${interactionId}`;
948
+ await this.ensureCollection(directory);
949
+ const attachment = attachmentBody(file, index);
950
+ const path = `${directory}/${attachment.filename}`;
951
+ await this.webdav.put(path, attachment.body, { contentType: attachment.contentType });
952
+ return this.webdav.ref(path);
953
+ }
954
+ async ensureCollection(path) {
955
+ const response = await this.webdav.request('MKCOL', path, { collection: true });
956
+ if (response.status === 201 || response.status === 405)
957
+ return;
958
+ throw new Error(`Failed to create collection ${path}: ${response.status} ${await response.text()}`);
894
959
  }
895
960
  /**
896
961
  * Register a collector that resolves when the object arrives via SSE.