@celljs/ta-rooms 4.17.0 → 4.18.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 +82 -18
- package/package.json +12 -12
- package/web/index.js +1002 -370
package/host/index.mjs
CHANGED
|
@@ -864,10 +864,10 @@ class RoomAgents {
|
|
|
864
864
|
const self = room?.members.find((member) => member.self);
|
|
865
865
|
if (!room || !self) {
|
|
866
866
|
throw new Error(TaLanguageUtil.pick(language(), {
|
|
867
|
-
"zh-CN": "
|
|
868
|
-
"zh-TW": "
|
|
867
|
+
"zh-CN": "你不在这个群里。",
|
|
868
|
+
"zh-TW": "你不在這個群裡。",
|
|
869
869
|
"en-US": "You are not in this room.",
|
|
870
|
-
"ja-JP": "
|
|
870
|
+
"ja-JP": "このグループチャットにいません。"
|
|
871
871
|
}));
|
|
872
872
|
}
|
|
873
873
|
return { room, self };
|
|
@@ -893,10 +893,10 @@ class RoomAgents {
|
|
|
893
893
|
}
|
|
894
894
|
if (mine.length >= AGENTS_MAX) {
|
|
895
895
|
throw new Error(TaLanguageUtil.pick(language(), {
|
|
896
|
-
"zh-CN":
|
|
897
|
-
"zh-TW":
|
|
896
|
+
"zh-CN": `一个群聊最多邀请 ${AGENTS_MAX} 个智能体。`,
|
|
897
|
+
"zh-TW": `一個群聊最多邀請 ${AGENTS_MAX} 個智慧體。`,
|
|
898
898
|
"en-US": `At most ${AGENTS_MAX} agents in a room.`,
|
|
899
|
-
"ja-JP": `1
|
|
899
|
+
"ja-JP": `1 つのグループチャットでは最大 ${AGENTS_MAX} 個のエージェントを招待できます。`
|
|
900
900
|
}));
|
|
901
901
|
}
|
|
902
902
|
const joined = {
|
|
@@ -928,10 +928,10 @@ class RoomAgents {
|
|
|
928
928
|
const next = mine.filter((each) => each !== gone);
|
|
929
929
|
await this.doubles.host.rooms.setState(room.id, RoomAgentsUtil.key(self.member), next.length ? next : null);
|
|
930
930
|
await (await this.doubles.chatOf(room.id)).say(TaLanguageUtil.pick(language(), {
|
|
931
|
-
"zh-CN": "
|
|
932
|
-
"zh-TW": "
|
|
931
|
+
"zh-CN": "我先离开群聊了。",
|
|
932
|
+
"zh-TW": "我先離開群聊了。",
|
|
933
933
|
"en-US": "I am leaving the room now.",
|
|
934
|
-
"ja-JP": "
|
|
934
|
+
"ja-JP": "グループチャットを離れます。"
|
|
935
935
|
}), self, { agent: { id: gone.id, name: gone.name } }).catch(() => {
|
|
936
936
|
return;
|
|
937
937
|
});
|
|
@@ -1157,10 +1157,10 @@ class RoomTasks extends RoomTasksBase {
|
|
|
1157
1157
|
const open = list.filter((task) => task.friend === member.id && !RoomTasksUtil.ended(task.status)).length;
|
|
1158
1158
|
const lang = language();
|
|
1159
1159
|
const why = quiet ? TaLanguageUtil.pick(lang, {
|
|
1160
|
-
"zh-CN": "
|
|
1161
|
-
"zh-TW": "
|
|
1160
|
+
"zh-CN": "这个群里分身不回答",
|
|
1161
|
+
"zh-TW": "這個群裡分身不回答",
|
|
1162
1162
|
"en-US": "the double keeps quiet here",
|
|
1163
|
-
"ja-JP": "
|
|
1163
|
+
"ja-JP": "このグループチャットではダブルは応答しません"
|
|
1164
1164
|
}) : open >= TASKS_OPEN ? TaLanguageUtil.pick(lang, {
|
|
1165
1165
|
"zh-CN": "手上的任务太多了",
|
|
1166
1166
|
"zh-TW": "手上的任務太多了",
|
|
@@ -1272,10 +1272,10 @@ class RoomTasks extends RoomTasksBase {
|
|
|
1272
1272
|
await this.mark((each) => each.id === id, {
|
|
1273
1273
|
status: "failed",
|
|
1274
1274
|
detail: TaLanguageUtil.pick(lang, {
|
|
1275
|
-
"zh-CN": "
|
|
1276
|
-
"zh-TW": "
|
|
1275
|
+
"zh-CN": "已经不在这个群里",
|
|
1276
|
+
"zh-TW": "已經不在這個群裡",
|
|
1277
1277
|
"en-US": "not in the room any more",
|
|
1278
|
-
"ja-JP": "
|
|
1278
|
+
"ja-JP": "もうこのグループチャットにいません"
|
|
1279
1279
|
}),
|
|
1280
1280
|
endedAt: this.now()
|
|
1281
1281
|
});
|
|
@@ -1627,10 +1627,10 @@ class RoomDoubles {
|
|
|
1627
1627
|
this.host.rooms.listRooms().then((rooms) => {
|
|
1628
1628
|
if (!rooms.find((room) => room.id === request.room)?.unlisted) {
|
|
1629
1629
|
this.grants.tell(`join:${request.room}:${request.id}:${request.at}`, request.title, TaLanguageUtil.pick(language(), {
|
|
1630
|
-
"zh-CN": `${request.name}
|
|
1631
|
-
"zh-TW": `${request.name}
|
|
1630
|
+
"zh-CN": `${request.name}想加入群聊`,
|
|
1631
|
+
"zh-TW": `${request.name}想加入群聊`,
|
|
1632
1632
|
"en-US": `${request.name} asks to join`,
|
|
1633
|
-
"ja-JP": `${request.name}
|
|
1633
|
+
"ja-JP": `${request.name}はグループチャットへの参加をリクエストしています`
|
|
1634
1634
|
}));
|
|
1635
1635
|
}
|
|
1636
1636
|
}).catch(() => {
|
|
@@ -1931,6 +1931,7 @@ class RoomDoubles {
|
|
|
1931
1931
|
var NOTIFY2 = "@celljs/ta-notify";
|
|
1932
1932
|
var NAME2 = "@celljs/ta-rooms";
|
|
1933
1933
|
var VIEW = `${NAME2}/friends`;
|
|
1934
|
+
var ROOMS_VIEW2 = `${NAME2}/rooms`;
|
|
1934
1935
|
|
|
1935
1936
|
class FriendNotices {
|
|
1936
1937
|
host;
|
|
@@ -1943,12 +1944,75 @@ class FriendNotices {
|
|
|
1943
1944
|
this.stop = this.host.rooms.onEvent((event) => {
|
|
1944
1945
|
if (event.type === "friend") {
|
|
1945
1946
|
this.tell(event.request);
|
|
1947
|
+
} else if (event.type === "rooms") {
|
|
1948
|
+
this.tellInvites();
|
|
1949
|
+
this.tellShares();
|
|
1946
1950
|
}
|
|
1947
1951
|
});
|
|
1952
|
+
this.tellInvites();
|
|
1953
|
+
this.tellShares();
|
|
1948
1954
|
}
|
|
1949
1955
|
dispose() {
|
|
1950
1956
|
this.stop?.();
|
|
1951
1957
|
}
|
|
1958
|
+
async tellInvites() {
|
|
1959
|
+
const invites = await Promise.resolve(this.host.rooms.listGroupInvites?.()).catch(() => {
|
|
1960
|
+
return;
|
|
1961
|
+
});
|
|
1962
|
+
for (const invite of invites ?? []) {
|
|
1963
|
+
const key = `invite:${invite.room}:${invite.at}`;
|
|
1964
|
+
if (this.told.has(key)) {
|
|
1965
|
+
continue;
|
|
1966
|
+
}
|
|
1967
|
+
this.told.add(key);
|
|
1968
|
+
const lang = language();
|
|
1969
|
+
await this.host.callPackageHost(NOTIFY2, "notify", [
|
|
1970
|
+
{
|
|
1971
|
+
from: NAME2,
|
|
1972
|
+
id: `invite:${invite.room}`,
|
|
1973
|
+
level: "ask",
|
|
1974
|
+
title: invite.title,
|
|
1975
|
+
text: TaLanguageUtil.pick(lang, {
|
|
1976
|
+
"zh-CN": `${invite.by.name} 邀请你加入群聊`,
|
|
1977
|
+
"zh-TW": `${invite.by.name} 邀請你加入群聊`,
|
|
1978
|
+
"en-US": `${invite.by.name} invites you to a group chat`,
|
|
1979
|
+
"ja-JP": `${invite.by.name} からグループチャットへの招待`
|
|
1980
|
+
}),
|
|
1981
|
+
view: ROOMS_VIEW2
|
|
1982
|
+
}
|
|
1983
|
+
]).catch(() => {
|
|
1984
|
+
return;
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
async tellShares() {
|
|
1989
|
+
const shares = await Promise.resolve(this.host.rooms.listFriendShares?.()).catch(() => {
|
|
1990
|
+
return;
|
|
1991
|
+
});
|
|
1992
|
+
for (const share of shares ?? []) {
|
|
1993
|
+
if (share.seen || this.told.has(`share:${share.id}`)) {
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
this.told.add(`share:${share.id}`);
|
|
1997
|
+
await this.host.callPackageHost(NOTIFY2, "notify", [
|
|
1998
|
+
{
|
|
1999
|
+
from: NAME2,
|
|
2000
|
+
id: `share:${share.id}`,
|
|
2001
|
+
level: "ask",
|
|
2002
|
+
title: share.title || share.by.name,
|
|
2003
|
+
text: TaLanguageUtil.pick(language(), {
|
|
2004
|
+
"zh-CN": `${share.by.name} 发给你`,
|
|
2005
|
+
"zh-TW": `${share.by.name} 傳給你`,
|
|
2006
|
+
"en-US": `${share.by.name} sent you this`,
|
|
2007
|
+
"ja-JP": `${share.by.name} から届きました`
|
|
2008
|
+
}),
|
|
2009
|
+
view: ROOMS_VIEW2
|
|
2010
|
+
}
|
|
2011
|
+
]).catch(() => {
|
|
2012
|
+
return;
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
1952
2016
|
async tell(request) {
|
|
1953
2017
|
const key = `${request.id}:${request.at}`;
|
|
1954
2018
|
if (this.told.has(key)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-rooms",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.0",
|
|
4
4
|
"description": "A pi package for Ta: rooms shared with other Ta through the relay, end to end: who asks to join and the owner's answer, your rooms and their members, your Ta friends, and links that invite",
|
|
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.
|
|
31
|
-
"@celljs/ta-relay": "4.
|
|
32
|
-
"@celljs/ta-web": "4.
|
|
30
|
+
"@celljs/ta-protocol": "4.18.0",
|
|
31
|
+
"@celljs/ta-relay": "4.18.0",
|
|
32
|
+
"@celljs/ta-web": "4.18.0",
|
|
33
33
|
"@types/react": "^19.3.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
},
|
|
38
38
|
"pi": {
|
|
39
39
|
"title": {
|
|
40
|
-
"en": "
|
|
41
|
-
"zh-CN": "
|
|
42
|
-
"zh-TW": "
|
|
43
|
-
"ja-JP": "
|
|
40
|
+
"en": "Group chats",
|
|
41
|
+
"zh-CN": "群聊",
|
|
42
|
+
"zh-TW": "群聊",
|
|
43
|
+
"ja-JP": "グループチャット"
|
|
44
44
|
},
|
|
45
45
|
"summary": {
|
|
46
|
-
"en": "
|
|
47
|
-
"zh-CN": "和别人的 Ta
|
|
48
|
-
"zh-TW": "和別人的 Ta
|
|
49
|
-
"ja-JP": "ほかの Ta
|
|
46
|
+
"en": "Group chats shared with other Ta, end to end: let in who asks, see who is there, invite by a link or a QR code, and your Ta friends.",
|
|
47
|
+
"zh-CN": "和别人的 Ta 共用的群聊,端到端加密:处理加入申请、查看成员和在线状态、用链接或二维码邀请,以及你的 Ta 好友。",
|
|
48
|
+
"zh-TW": "和別人的 Ta 共用的群聊,端到端加密:處理加入申請、檢視成員和線上狀態、用連結或QR 碼邀請,以及你的 Ta 好友。",
|
|
49
|
+
"ja-JP": "ほかの Ta と共有するエンドツーエンド暗号化のグループチャット:参加申請への対応、メンバーとオンライン状態の確認、リンクや QR コードでの招待、Ta の友だち。"
|
|
50
50
|
},
|
|
51
51
|
"icon": "Users",
|
|
52
52
|
"web": [
|