@celljs/ta-host 4.18.0 → 4.20.0

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.
@@ -31,7 +31,9 @@ let RoomsBridge = RoomsBridge_1 = class RoomsBridge {
31
31
  this.watchers = new Map();
32
32
  this.rooms = {
33
33
  getIdentity: async () => RoomsBridge_1.identity(await this.hubs.identity()),
34
- setName: async (name) => RoomsBridge_1.identity(await this.hubs.setName(name)),
34
+ setName: async (name) => RoomsBridge_1.identity({ ...(await this.hubs.setName(name)), ...(await this.picture()) }),
35
+ setPicture: async (picture) => RoomsBridge_1.identity(await this.hubs.setPicture(picture)),
36
+ listPictures: () => this.hubs.pictures(),
35
37
  listRooms: async () => this.hubs.list(),
36
38
  createRoom: input => this.hubs.create(input),
37
39
  invite: (room, options) => this.hubs.invite(room, options !== null && options !== void 0 ? options : {}),
@@ -85,10 +87,20 @@ let RoomsBridge = RoomsBridge_1 = class RoomsBridge {
85
87
  (_a = this.stopLook) === null || _a === void 0 ? void 0 : _a.call(this);
86
88
  this.hubs.stop();
87
89
  }
88
- /** The look of this Ta others see is the double's, as the user picked it on a page (TA_DOUBLE_LOOK). */
90
+ /**
91
+ * The look of this Ta others see is the double's, as the user picked it on a page (TA_DOUBLE_LOOK); till then the
92
+ * kind its identity is given, kept there for the pages to draw the double as (setting it comes back here).
93
+ */
89
94
  async keepLook() {
90
95
  const look = await this.data.get(ta_protocol_1.TA_DOUBLE_LOOK.name, ta_protocol_1.TA_DOUBLE_LOOK.key).catch(() => undefined);
91
- await this.hubs.setLook(typeof look === 'string' && look ? look : ta_protocol_1.TA_DOUBLE_LOOK.initial).catch(() => undefined);
96
+ if (typeof look === 'string' && look) {
97
+ await this.hubs.setLook(look).catch(() => undefined);
98
+ return;
99
+ }
100
+ const identity = await this.hubs.identity().catch(() => undefined);
101
+ if (identity) {
102
+ await this.data.set(ta_protocol_1.TA_DOUBLE_LOOK.name, ta_protocol_1.TA_DOUBLE_LOOK.key, ta_protocol_1.TaDoubleLookUtil.given(identity.id)).catch(() => undefined);
103
+ }
92
104
  }
93
105
  /** `watch` undefined: no more. */
94
106
  watch(connection, watch) {
@@ -111,8 +123,13 @@ let RoomsBridge = RoomsBridge_1 = class RoomsBridge {
111
123
  }
112
124
  }
113
125
  }
114
- static identity({ id, name, look, shared }) {
115
- return { id, name, ...(look ? { look } : {}), ...(shared ? { shared } : {}) };
126
+ /** The picture of this Ta, for what is said of it after a change that does not give it. */
127
+ async picture() {
128
+ const { picture } = await this.hubs.identity();
129
+ return picture ? { picture } : {};
130
+ }
131
+ static identity({ id, name, look, shared, picture }) {
132
+ return { id, name, ...(look ? { look } : {}), ...(shared ? { shared } : {}), ...(picture ? { picture } : {}) };
116
133
  }
117
134
  };
118
135
  exports.RoomsBridge = RoomsBridge;
@@ -138,6 +155,12 @@ let TaRoomServerImpl = class TaRoomServerImpl {
138
155
  setName(name) {
139
156
  return ta_errors_1.TaErrors.guard(() => this.rooms.setName(name));
140
157
  }
158
+ setPicture(picture) {
159
+ return ta_errors_1.TaErrors.guard(() => this.rooms.setPicture(picture));
160
+ }
161
+ listPictures() {
162
+ return ta_errors_1.TaErrors.guard(() => this.rooms.listPictures());
163
+ }
141
164
  listRooms() {
142
165
  return ta_errors_1.TaErrors.guard(() => this.rooms.listRooms());
143
166
  }
@@ -176,6 +176,14 @@ const RULES = {
176
176
  closeTerminal: fixed('commands.terminal'),
177
177
  listTerminals: fixed('commands.terminal'),
178
178
  },
179
+ TaAccountServer: {
180
+ getAccount: fixed('settings.view'),
181
+ signIn: fixed('settings.manage'),
182
+ cancelSignIn: fixed('settings.manage'),
183
+ approve: fixed('settings.manage'),
184
+ remove: fixed('settings.manage'),
185
+ signOut: fixed('settings.manage'),
186
+ },
179
187
  TaRelayServer: {
180
188
  getRelay: fixed('settings.view'),
181
189
  pair: fixed('settings.manage'),
@@ -201,6 +209,8 @@ const RULES = {
201
209
  TaRoomServer: Object.fromEntries([
202
210
  'getIdentity',
203
211
  'setName',
212
+ 'setPicture',
213
+ 'listPictures',
204
214
  'listRooms',
205
215
  'createRoom',
206
216
  'invite',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-host",
3
- "version": "4.18.0",
3
+ "version": "4.20.0",
4
4
  "description": "ta serve: pi sessions for many clients over WebSocket",
5
5
  "keywords": [
6
6
  "cell-component"
@@ -34,15 +34,15 @@
34
34
  "watch": "tsc -b -w --preserveWatchOutput"
35
35
  },
36
36
  "dependencies": {
37
- "@celljs/ai-agent": "4.18.0",
38
- "@celljs/ai-coding-agent": "4.18.0",
39
- "@celljs/core": "4.18.0",
40
- "@celljs/rpc": "4.18.0",
41
- "@celljs/ta-exec": "4.18.0",
42
- "@celljs/ta-harness": "4.18.0",
43
- "@celljs/ta-protocol": "4.18.0",
44
- "@celljs/ta-relay": "4.18.0",
45
- "@celljs/web": "4.18.0",
37
+ "@celljs/ai-agent": "4.20.0",
38
+ "@celljs/ai-coding-agent": "4.20.0",
39
+ "@celljs/core": "4.20.0",
40
+ "@celljs/rpc": "4.20.0",
41
+ "@celljs/ta-exec": "4.20.0",
42
+ "@celljs/ta-harness": "4.20.0",
43
+ "@celljs/ta-protocol": "4.20.0",
44
+ "@celljs/ta-relay": "4.20.0",
45
+ "@celljs/web": "4.20.0",
46
46
  "@earendil-works/pi-coding-agent": "^1.5.2"
47
47
  },
48
48
  "devDependencies": {