@celljs/ta-channels 4.13.1 → 4.14.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.
package/host/index.mjs CHANGED
@@ -181,140 +181,6 @@ var TaPackageTextUtil;
181
181
  }
182
182
  TaPackageTextUtil2.pick = pick;
183
183
  })(TaPackageTextUtil || (TaPackageTextUtil = {}));
184
- // ../ta-protocol/esm/common/relay-protocol.js
185
- var TaRelayServer = Symbol("TaRelayServer");
186
- // ../ta-protocol/esm/common/remote-protocol.js
187
- var TaRemoteServer = Symbol("TaRemoteServer");
188
- // ../ta-protocol/esm/common/room-protocol.js
189
- var TaRoomServer = Symbol("TaRoomServer");
190
- var TaRoomWatchUtil;
191
- (function(TaRoomWatchUtil2) {
192
- function of(messages, state) {
193
- const prefixes = Array.isArray(state) ? state.filter((prefix) => typeof prefix === "string" && prefix.length > 0) : [];
194
- return { messages: messages !== false, state: [...new Set(prefixes)].sort() };
195
- }
196
- TaRoomWatchUtil2.of = of;
197
- function union(watches) {
198
- let messages = false;
199
- const state = [];
200
- for (const watch of watches) {
201
- messages || (messages = watch.messages);
202
- state.push(...watch.state);
203
- }
204
- return of(messages, messages ? [] : state);
205
- }
206
- TaRoomWatchUtil2.union = union;
207
- function same(a, b) {
208
- return a === b || !!a && !!b && a.messages === b.messages && a.state.join(`
209
- `) === b.state.join(`
210
- `);
211
- }
212
- TaRoomWatchUtil2.same = same;
213
- function hears(watch, event) {
214
- if (event.type === "message") {
215
- return watch.messages;
216
- }
217
- if (event.type === "state") {
218
- return watch.messages || watch.state.some((prefix) => event.key.startsWith(prefix));
219
- }
220
- return true;
221
- }
222
- TaRoomWatchUtil2.hears = hears;
223
- })(TaRoomWatchUtil || (TaRoomWatchUtil = {}));
224
- // ../ta-protocol/esm/common/settings-protocol.js
225
- var TaSettingsServer = Symbol("TaSettingsServer");
226
- // ../ta-protocol/esm/common/ta-extension-host.js
227
- var TA_HOST_EVENT = "ta:host";
228
- var TaHostUtil;
229
- (function(TaHostUtil2) {
230
- TaHostUtil2.WAIT_MS = 1000;
231
- function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
232
- return new Promise((resolve) => {
233
- let heard = false;
234
- let answered = false;
235
- const timer = setTimeout(() => resolve(undefined), waitMs);
236
- const request = {
237
- name,
238
- heard: () => {
239
- heard = true;
240
- },
241
- resolve: (answer) => {
242
- answered = true;
243
- clearTimeout(timer);
244
- resolve(answer);
245
- }
246
- };
247
- events.emit(TA_HOST_EVENT, request);
248
- if (!heard && !answered) {
249
- clearTimeout(timer);
250
- resolve(undefined);
251
- }
252
- });
253
- }
254
- TaHostUtil2.reach = reach;
255
- function marked(systemPrompt, mark) {
256
- return role(systemPrompt).includes(mark);
257
- }
258
- TaHostUtil2.marked = marked;
259
- function role(systemPrompt) {
260
- if (!systemPrompt) {
261
- return "";
262
- }
263
- const open = `<addendum>
264
- `;
265
- const start = systemPrompt.indexOf(open);
266
- const context = systemPrompt.indexOf(`<project_context>
267
- `);
268
- if (start < 0 || context >= 0 && context < start) {
269
- return "";
270
- }
271
- const end = systemPrompt.indexOf(`
272
- </addendum>`, start);
273
- return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
274
- }
275
- TaHostUtil2.role = role;
276
- })(TaHostUtil || (TaHostUtil = {}));
277
- var TA_ASK_ENTRY = "ta-ask";
278
- var TaAskUtil;
279
- (function(TaAskUtil2) {
280
- const LENGTH = 120;
281
- function entry(question) {
282
- const line = question.replace(/\s+/g, " ").trim();
283
- return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
284
- }
285
- TaAskUtil2.entry = entry;
286
- function asking(entries) {
287
- var _a;
288
- for (let i = entries.length - 1;i >= 0; i--) {
289
- const entry2 = entries[i];
290
- if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
291
- return;
292
- }
293
- if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
294
- return read(entry2);
295
- }
296
- }
297
- return;
298
- }
299
- TaAskUtil2.asking = asking;
300
- function next(asked, entry2) {
301
- var _a;
302
- if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
303
- return;
304
- }
305
- return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
306
- }
307
- TaAskUtil2.next = next;
308
- function read(found) {
309
- var _a;
310
- const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
311
- if (typeof question !== "string" || !question.trim()) {
312
- return;
313
- }
314
- const at = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
315
- return { question: entry(question).question, at: Number.isNaN(at) ? 0 : at };
316
- }
317
- })(TaAskUtil || (TaAskUtil = {}));
318
184
  // ../ta-protocol/esm/common/ta-protocol.js
319
185
  var TaServer = Symbol("TaServer");
320
186
  var TaClient = Symbol("TaClient");
@@ -518,6 +384,176 @@ var TaSkillUse;
518
384
  }
519
385
  TaSkillUse2.command = command;
520
386
  })(TaSkillUse || (TaSkillUse = {}));
387
+
388
+ // ../ta-protocol/esm/common/presence-protocol.js
389
+ var TaPresenceServer = Symbol("TaPresenceServer");
390
+ var TaMessageAuthor;
391
+ (function(TaMessageAuthor2) {
392
+ const LINE = /^\[ta:by ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
393
+ const LINES = /^\[ta:by [^\]\n]*\]$\n?/gm;
394
+ function strip(message) {
395
+ const context = TaMessageContext.read(message);
396
+ if (context === undefined || !LINE.test(context)) {
397
+ return message;
398
+ }
399
+ const kept = context.replace(LINES, "").replace(/\n+$/, "");
400
+ const body = TaMessageContext.strip(message);
401
+ return kept.trim() ? TaMessageContext.wrap(kept, body) : body;
402
+ }
403
+ TaMessageAuthor2.strip = strip;
404
+ function mark(message, id, name) {
405
+ const plain = strip(message);
406
+ if (/^[/!]/.test(plain)) {
407
+ return plain;
408
+ }
409
+ const line = `[ta:by ${id.replace(/[\s\]]/g, "")} ${name.replace(/[\]\n]/g, " ").trim() || id}]`;
410
+ const context = TaMessageContext.read(plain);
411
+ return TaMessageContext.wrap(context === undefined ? line : `${context}
412
+ ${line}`, TaMessageContext.strip(plain));
413
+ }
414
+ TaMessageAuthor2.mark = mark;
415
+ function of(message) {
416
+ var _a;
417
+ const context = TaMessageContext.read(message);
418
+ const match = context === undefined ? null : LINE.exec(context);
419
+ return match ? { id: match[1], name: ((_a = match[2]) !== null && _a !== undefined ? _a : match[1]).trim() } : undefined;
420
+ }
421
+ TaMessageAuthor2.of = of;
422
+ })(TaMessageAuthor || (TaMessageAuthor = {}));
423
+ // ../ta-protocol/esm/common/relay-protocol.js
424
+ var TaRelayServer = Symbol("TaRelayServer");
425
+ // ../ta-protocol/esm/common/remote-protocol.js
426
+ var TaRemoteServer = Symbol("TaRemoteServer");
427
+ // ../ta-protocol/esm/common/room-protocol.js
428
+ var TaRoomServer = Symbol("TaRoomServer");
429
+ var TaRoomWatchUtil;
430
+ (function(TaRoomWatchUtil2) {
431
+ function of(messages, state) {
432
+ const prefixes = Array.isArray(state) ? state.filter((prefix) => typeof prefix === "string" && prefix.length > 0) : [];
433
+ return { messages: messages !== false, state: [...new Set(prefixes)].sort() };
434
+ }
435
+ TaRoomWatchUtil2.of = of;
436
+ function union(watches) {
437
+ let messages = false;
438
+ const state = [];
439
+ for (const watch of watches) {
440
+ messages || (messages = watch.messages);
441
+ state.push(...watch.state);
442
+ }
443
+ return of(messages, messages ? [] : state);
444
+ }
445
+ TaRoomWatchUtil2.union = union;
446
+ function same(a, b) {
447
+ return a === b || !!a && !!b && a.messages === b.messages && a.state.join(`
448
+ `) === b.state.join(`
449
+ `);
450
+ }
451
+ TaRoomWatchUtil2.same = same;
452
+ function hears(watch, event) {
453
+ if (event.type === "message") {
454
+ return watch.messages;
455
+ }
456
+ if (event.type === "state") {
457
+ return watch.messages || watch.state.some((prefix) => event.key.startsWith(prefix));
458
+ }
459
+ return true;
460
+ }
461
+ TaRoomWatchUtil2.hears = hears;
462
+ })(TaRoomWatchUtil || (TaRoomWatchUtil = {}));
463
+ // ../ta-protocol/esm/common/settings-protocol.js
464
+ var TaSettingsServer = Symbol("TaSettingsServer");
465
+ // ../ta-protocol/esm/common/ta-extension-host.js
466
+ var TA_HOST_EVENT = "ta:host";
467
+ var TaHostUtil;
468
+ (function(TaHostUtil2) {
469
+ TaHostUtil2.WAIT_MS = 1000;
470
+ function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
471
+ return new Promise((resolve) => {
472
+ let heard = false;
473
+ let answered = false;
474
+ const timer = setTimeout(() => resolve(undefined), waitMs);
475
+ const request = {
476
+ name,
477
+ heard: () => {
478
+ heard = true;
479
+ },
480
+ resolve: (answer) => {
481
+ answered = true;
482
+ clearTimeout(timer);
483
+ resolve(answer);
484
+ }
485
+ };
486
+ events.emit(TA_HOST_EVENT, request);
487
+ if (!heard && !answered) {
488
+ clearTimeout(timer);
489
+ resolve(undefined);
490
+ }
491
+ });
492
+ }
493
+ TaHostUtil2.reach = reach;
494
+ function marked(systemPrompt, mark) {
495
+ return role(systemPrompt).includes(mark);
496
+ }
497
+ TaHostUtil2.marked = marked;
498
+ function role(systemPrompt) {
499
+ if (!systemPrompt) {
500
+ return "";
501
+ }
502
+ const open = `<addendum>
503
+ `;
504
+ const start = systemPrompt.indexOf(open);
505
+ const context = systemPrompt.indexOf(`<project_context>
506
+ `);
507
+ if (start < 0 || context >= 0 && context < start) {
508
+ return "";
509
+ }
510
+ const end = systemPrompt.indexOf(`
511
+ </addendum>`, start);
512
+ return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
513
+ }
514
+ TaHostUtil2.role = role;
515
+ })(TaHostUtil || (TaHostUtil = {}));
516
+ var TA_ASK_ENTRY = "ta-ask";
517
+ var TaAskUtil;
518
+ (function(TaAskUtil2) {
519
+ const LENGTH = 120;
520
+ function entry(question) {
521
+ const line = question.replace(/\s+/g, " ").trim();
522
+ return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
523
+ }
524
+ TaAskUtil2.entry = entry;
525
+ function asking(entries) {
526
+ var _a;
527
+ for (let i = entries.length - 1;i >= 0; i--) {
528
+ const entry2 = entries[i];
529
+ if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
530
+ return;
531
+ }
532
+ if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
533
+ return read(entry2);
534
+ }
535
+ }
536
+ return;
537
+ }
538
+ TaAskUtil2.asking = asking;
539
+ function next(asked, entry2) {
540
+ var _a;
541
+ if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
542
+ return;
543
+ }
544
+ return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
545
+ }
546
+ TaAskUtil2.next = next;
547
+ function read(found) {
548
+ var _a;
549
+ const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
550
+ if (typeof question !== "string" || !question.trim()) {
551
+ return;
552
+ }
553
+ const at = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
554
+ return { question: entry(question).question, at: Number.isNaN(at) ? 0 : at };
555
+ }
556
+ })(TaAskUtil || (TaAskUtil = {}));
521
557
  // ../ta-protocol/esm/common/team-protocol.js
522
558
  var TA_OWNER = "owner";
523
559
  var TA_UNDECLARED = "extensions.install";
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@celljs/ta-channels",
3
- "version": "4.13.1",
3
+ "version": "4.14.0",
4
4
  "description": "A pi package for Ta: agents with roles of their own and channels where the user, Ta and the agents talk; Ta builds the team for what the user wants",
5
5
  "keywords": [
6
6
  "pi-package"
7
7
  ],
8
- "homepage": "https://github.com/cellbang/cell",
8
+ "homepage": "https://github.com/cellbang/ta",
9
9
  "bugs": {
10
- "url": "https://github.com/cellbang/cell/issues"
10
+ "url": "https://github.com/cellbang/ta/issues"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.13.1",
31
- "@celljs/ta-relay": "4.13.1",
32
- "@celljs/ta-web": "4.13.1",
30
+ "@celljs/ta-protocol": "4.14.0",
31
+ "@celljs/ta-relay": "4.14.0",
32
+ "@celljs/ta-web": "4.14.0",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {
package/web/index.js CHANGED
@@ -3383,6 +3383,7 @@ function ChannelRoom({ context, channelId: fixed }) {
3383
3383
  className: "tac-msg-face"
3384
3384
  }, first && pi.ui.Face && /* @__PURE__ */ React.createElement(pi.ui.Face, {
3385
3385
  seed: message.by ?? TA_OWNER,
3386
+ double: (message.by ?? TA_OWNER) === TA_OWNER,
3386
3387
  size: 28
3387
3388
  })), /* @__PURE__ */ React.createElement("div", {
3388
3389
  className: "tac-msg-col"