@celljs/ta-team 4.21.0 → 4.22.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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/web/index.js +36 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-team",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "description": "A pi package for Ta: people let into your Ta by a link, each with a role (admin, collaborator, viewer, guest, or one of your own), what they may do checked by the Ta service for every call and every tool, asking for more and the answers, and a record",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.21.0",
31
- "@celljs/ta-relay": "4.21.0",
32
- "@celljs/ta-web": "4.21.0",
30
+ "@celljs/ta-protocol": "4.22.0",
31
+ "@celljs/ta-relay": "4.22.0",
32
+ "@celljs/ta-web": "4.22.0",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {
package/web/index.js CHANGED
@@ -2861,6 +2861,36 @@ class TeamSharedHome {
2861
2861
  listeners = new Set;
2862
2862
  timer;
2863
2863
  items = () => this.current;
2864
+ asPartners = () => {
2865
+ const made = new WeakMap;
2866
+ let list = [];
2867
+ let from;
2868
+ return {
2869
+ partners: () => {
2870
+ if (from !== this.current) {
2871
+ from = this.current;
2872
+ list = this.current.map((item) => {
2873
+ let partner = made.get(item);
2874
+ if (!partner) {
2875
+ partner = {
2876
+ id: item.id,
2877
+ kind: item.kind === "agent" ? "agent" : "group",
2878
+ name: item.title,
2879
+ about: item.detail,
2880
+ icon: item.icon,
2881
+ ...item.face ? { face: item.face } : {},
2882
+ open: item.open
2883
+ };
2884
+ made.set(item, partner);
2885
+ }
2886
+ return partner;
2887
+ });
2888
+ }
2889
+ return list;
2890
+ },
2891
+ subscribe: this.subscribe
2892
+ };
2893
+ };
2864
2894
  subscribe = (listener) => {
2865
2895
  this.listeners.add(listener);
2866
2896
  return () => this.listeners.delete(listener);
@@ -2900,6 +2930,7 @@ class TeamSharedHome {
2900
2930
  show(joined) {
2901
2931
  const items = joined.flatMap((one) => (one.shared ?? []).map((shared) => ({
2902
2932
  id: `${one.owner}:${shared.kind}:${shared.id}`,
2933
+ kind: shared.kind,
2903
2934
  title: shared.name,
2904
2935
  detail: t("fromTa", { owner: one.owner }),
2905
2936
  icon: icon(shared.kind === "agent" ? "Bot" : "Hash"),
@@ -3852,7 +3883,11 @@ function activate(pi2) {
3852
3883
  book.load();
3853
3884
  const home = new TeamSharedHome;
3854
3885
  const stopHome = home.start();
3855
- pi2.registerHomeItems?.(home);
3886
+ if (typeof pi2.registerPartners === "function") {
3887
+ pi2.registerPartners(home.asPartners());
3888
+ } else {
3889
+ pi2.registerHomeItems?.(home);
3890
+ }
3856
3891
  TeamSharedHome.openPending();
3857
3892
  return () => {
3858
3893
  removeStyle();