@rool-dev/extension 0.3.7-dev.2ccb343 → 0.3.7-dev.d9f341e
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 +13 -1
- package/dist/dev/DevHostController.d.ts +1 -0
- package/dist/dev/DevHostController.d.ts.map +1 -1
- package/dist/dev/DevHostController.js +5 -1
- package/dist/dev/host-shell.js +14 -2
- package/dist/dev/host-shell.js.map +1 -1
- package/dist/host.d.ts +4 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/protocol.d.ts +7 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/reactive.svelte.d.ts +64 -40
- package/dist/reactive.svelte.d.ts.map +1 -1
- package/dist/reactive.svelte.js +374 -109
- package/package.json +2 -2
- package/dist/client.d.ts +0 -145
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -378
package/README.md
CHANGED
|
@@ -183,6 +183,7 @@ These are Svelte 5 `$state` properties — use them directly in templates or `$e
|
|
|
183
183
|
| `role` | `RoolUserRole` | User's role (`owner`, `admin`, `editor`, `viewer`) |
|
|
184
184
|
| `linkAccess` | `LinkAccess` | URL sharing level |
|
|
185
185
|
| `userId` | `string` | Current user's ID |
|
|
186
|
+
| `user` | `BridgeUser` | Current user info (`{ id, name, email }`) |
|
|
186
187
|
| `isReadOnly` | `boolean` | True if viewer role |
|
|
187
188
|
|
|
188
189
|
### Object Operations
|
|
@@ -409,10 +410,20 @@ Extensions run in a sandboxed iframe (`allow-scripts allow-same-origin`). The ho
|
|
|
409
410
|
|
|
410
411
|
The bridge protocol:
|
|
411
412
|
1. Extension sends `rool:ready`
|
|
412
|
-
2. Host responds with `rool:init` (channel metadata, schema, space info)
|
|
413
|
+
2. Host responds with `rool:init` (channel metadata, schema, space info, user identity)
|
|
413
414
|
3. Extension calls channel methods → `rool:request` → host executes → `rool:response`
|
|
414
415
|
4. Host pushes real-time events → `rool:event` → extension updates reactive state
|
|
415
416
|
|
|
417
|
+
When creating a bridge host, pass `user` so the extension can display the current user's name:
|
|
418
|
+
|
|
419
|
+
```typescript
|
|
420
|
+
const host = createBridgeHost({
|
|
421
|
+
channel,
|
|
422
|
+
iframe,
|
|
423
|
+
user: { id: currentUser.id, name: currentUser.name, email: currentUser.email },
|
|
424
|
+
});
|
|
425
|
+
```
|
|
426
|
+
|
|
416
427
|
## CLI Commands
|
|
417
428
|
|
|
418
429
|
| Command | Description |
|
|
@@ -431,6 +442,7 @@ import type {
|
|
|
431
442
|
ReactiveObject,
|
|
432
443
|
ReactiveWatch,
|
|
433
444
|
WatchOptions,
|
|
445
|
+
BridgeUser,
|
|
434
446
|
RoolObject,
|
|
435
447
|
RoolObjectStat,
|
|
436
448
|
SpaceSchema,
|
|
@@ -71,6 +71,7 @@ export declare class DevHostController {
|
|
|
71
71
|
registerIframe(tabId: string, el: HTMLIFrameElement): void;
|
|
72
72
|
unregisterIframe(tabId: string): void;
|
|
73
73
|
logout(): void;
|
|
74
|
+
private get _bridgeUser();
|
|
74
75
|
private _bindBridge;
|
|
75
76
|
private _bindAllBridges;
|
|
76
77
|
private _destroyTab;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevHostController.d.ts","sourceRoot":"","sources":["../../src/dev/DevHostController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAe,sBAAsB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"DevHostController.d.ts","sourceRoot":"","sources":["../../src/dev/DevHostController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAe,sBAAsB,EAAE,MAAM,eAAe,CAA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S;gBAGxB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B,EACD,QAAQ,EAAE,MAAM,IAAI,EACpB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAoB3B,IAAI,IAAI,IAAI,YAAY,EAAE,CAoBzB;IAMK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA+DrB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0DjD;;;;;;OAMG;IACG,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB1D;;;OAGG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAiBpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAkExB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBnD,aAAa,IAAI,IAAI;IAUrB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,iBAAiB,GAAG,IAAI;IAK1D,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQrC,MAAM,IAAI,IAAI;IASd,OAAO,KAAK,WAAW,GAGtB;IAED,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,6BAA6B;IAYrC;;;OAGG;YACW,aAAa;IA4B3B,OAAO,CAAC,YAAY;CAKrB"}
|
|
@@ -358,11 +358,15 @@ export class DevHostController {
|
|
|
358
358
|
// ---------------------------------------------------------------------------
|
|
359
359
|
// Private helpers
|
|
360
360
|
// ---------------------------------------------------------------------------
|
|
361
|
+
get _bridgeUser() {
|
|
362
|
+
const cu = this.client.currentUser; // Always available after boot() authenticates
|
|
363
|
+
return { id: cu.id, name: cu.name, email: cu.email };
|
|
364
|
+
}
|
|
361
365
|
_bindBridge(tabId) {
|
|
362
366
|
const el = this.iframeEls[tabId];
|
|
363
367
|
const ch = this.channels[tabId];
|
|
364
368
|
if (el && ch && !this.bridgeHosts[tabId]) {
|
|
365
|
-
this.bridgeHosts[tabId] = createBridgeHost({ channel: ch, iframe: el });
|
|
369
|
+
this.bridgeHosts[tabId] = createBridgeHost({ channel: ch, iframe: el, user: this._bridgeUser });
|
|
366
370
|
}
|
|
367
371
|
}
|
|
368
372
|
_bindAllBridges() {
|
package/dist/dev/host-shell.js
CHANGED
|
@@ -7900,13 +7900,13 @@ var RoolChannel = class extends EventEmitter {
|
|
|
7900
7900
|
if (attachments?.length) attachmentUrls = await Promise.all(attachments.map((file) => this.mediaClient.upload(this._id, file)));
|
|
7901
7901
|
const parentInteractionId = explicitParent !== void 0 ? explicitParent : this._getActiveLeafImpl(conversationId) ?? null;
|
|
7902
7902
|
const interactionId = generateEntityId();
|
|
7903
|
+
this._activeLeaves.set(conversationId, interactionId);
|
|
7903
7904
|
const result = await this.graphqlClient.prompt(this._id, prompt, this._channelId, conversationId, {
|
|
7904
7905
|
...rest,
|
|
7905
7906
|
attachmentUrls,
|
|
7906
7907
|
interactionId,
|
|
7907
7908
|
parentInteractionId
|
|
7908
7909
|
});
|
|
7909
|
-
this._activeLeaves.set(conversationId, interactionId);
|
|
7910
7910
|
const objects = [];
|
|
7911
7911
|
const missing = [];
|
|
7912
7912
|
for (const id of result.modifiedObjectIds) {
|
|
@@ -9010,11 +9010,13 @@ var GETTER_MAP = { "getActiveLeafId": "activeLeafId" };
|
|
|
9010
9010
|
var BridgeHost = class {
|
|
9011
9011
|
channel;
|
|
9012
9012
|
iframe;
|
|
9013
|
+
user;
|
|
9013
9014
|
eventCleanups = [];
|
|
9014
9015
|
_destroyed = false;
|
|
9015
9016
|
constructor(options) {
|
|
9016
9017
|
this.channel = options.channel;
|
|
9017
9018
|
this.iframe = options.iframe;
|
|
9019
|
+
this.user = options.user;
|
|
9018
9020
|
window.addEventListener("message", this._onMessage);
|
|
9019
9021
|
for (const eventName of FORWARDED_EVENTS) {
|
|
9020
9022
|
const handler = (data) => {
|
|
@@ -9039,6 +9041,7 @@ var BridgeHost = class {
|
|
|
9039
9041
|
role: this.channel.role,
|
|
9040
9042
|
linkAccess: this.channel.linkAccess,
|
|
9041
9043
|
userId: this.channel.userId,
|
|
9044
|
+
user: this.user,
|
|
9042
9045
|
schema: this.channel.getSchema(),
|
|
9043
9046
|
metadata: this.channel.getAllMetadata()
|
|
9044
9047
|
};
|
|
@@ -9412,12 +9415,21 @@ var DevHostController = class {
|
|
|
9412
9415
|
this.client.logout();
|
|
9413
9416
|
window.location.reload();
|
|
9414
9417
|
}
|
|
9418
|
+
get _bridgeUser() {
|
|
9419
|
+
const cu = this.client.currentUser;
|
|
9420
|
+
return {
|
|
9421
|
+
id: cu.id,
|
|
9422
|
+
name: cu.name,
|
|
9423
|
+
email: cu.email
|
|
9424
|
+
};
|
|
9425
|
+
}
|
|
9415
9426
|
_bindBridge(tabId) {
|
|
9416
9427
|
const el = this.iframeEls[tabId];
|
|
9417
9428
|
const ch = this.channels[tabId];
|
|
9418
9429
|
if (el && ch && !this.bridgeHosts[tabId]) this.bridgeHosts[tabId] = createBridgeHost({
|
|
9419
9430
|
channel: ch,
|
|
9420
|
-
iframe: el
|
|
9431
|
+
iframe: el,
|
|
9432
|
+
user: this._bridgeUser
|
|
9421
9433
|
});
|
|
9422
9434
|
}
|
|
9423
9435
|
_bindAllBridges() {
|