@celljs/ta-channels 4.20.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.
@@ -687,6 +687,12 @@ var ChannelsUtil;
687
687
  }
688
688
  channel.dailyLimit = input.dailyLimit;
689
689
  }
690
+ if (input.shared !== undefined) {
691
+ if (typeof input.shared !== "string" || !input.shared) {
692
+ throw new Error("The group chat a channel became is the id of a room.");
693
+ }
694
+ channel.shared = input.shared;
695
+ }
690
696
  return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel, before };
691
697
  }
692
698
  ChannelsUtil.updateChannel = updateChannel;
@@ -699,6 +705,10 @@ var ChannelsUtil;
699
705
  return team.channels.filter((channel) => channel.by === "ta");
700
706
  }
701
707
  ChannelsUtil.taskChannels = taskChannels;
708
+ function liveChannels(team) {
709
+ return ownChannels(team).filter((channel) => !channel.shared);
710
+ }
711
+ ChannelsUtil.liveChannels = liveChannels;
702
712
  function ownChannels(team) {
703
713
  return team.channels.filter((channel) => channel.by !== "ta");
704
714
  }
@@ -1668,7 +1678,7 @@ var ChannelsText;
1668
1678
  if (message.author === SYSTEM) {
1669
1679
  return [];
1670
1680
  }
1671
- if (named.length > 0 || message.author !== USER && message.author !== TA) {
1681
+ if (named.length > 0 || message.author !== TA) {
1672
1682
  return named;
1673
1683
  }
1674
1684
  return members.length > 0 ? [members[0].id] : [];
package/host/index.mjs CHANGED
@@ -1120,6 +1120,12 @@ var ChannelsUtil;
1120
1120
  }
1121
1121
  channel.dailyLimit = input.dailyLimit;
1122
1122
  }
1123
+ if (input.shared !== undefined) {
1124
+ if (typeof input.shared !== "string" || !input.shared) {
1125
+ throw new Error("The group chat a channel became is the id of a room.");
1126
+ }
1127
+ channel.shared = input.shared;
1128
+ }
1123
1129
  return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel, before };
1124
1130
  }
1125
1131
  ChannelsUtil.updateChannel = updateChannel;
@@ -1132,6 +1138,10 @@ var ChannelsUtil;
1132
1138
  return team.channels.filter((channel) => channel.by === "ta");
1133
1139
  }
1134
1140
  ChannelsUtil.taskChannels = taskChannels;
1141
+ function liveChannels(team) {
1142
+ return ownChannels(team).filter((channel) => !channel.shared);
1143
+ }
1144
+ ChannelsUtil.liveChannels = liveChannels;
1135
1145
  function ownChannels(team) {
1136
1146
  return team.channels.filter((channel) => channel.by !== "ta");
1137
1147
  }
@@ -1607,7 +1617,7 @@ var ChannelsText;
1607
1617
  if (message.author === SYSTEM) {
1608
1618
  return [];
1609
1619
  }
1610
- if (named.length > 0 || message.author !== USER && message.author !== TA) {
1620
+ if (named.length > 0 || message.author !== TA) {
1611
1621
  return named;
1612
1622
  }
1613
1623
  return members.length > 0 ? [members[0].id] : [];
@@ -2323,6 +2333,53 @@ var TaAppUtil;
2323
2333
  })(TaAppUtil || (TaAppUtil = {}));
2324
2334
  // ../ta-protocol/esm/common/auth-protocol.js
2325
2335
  var TaAuthServer = Symbol("TaAuthServer");
2336
+ // ../ta-protocol/esm/common/confine-protocol.js
2337
+ var TA_CONFINED_MARK = "[ta:confined]";
2338
+ var AT = String.raw`(?:^|[;&|(\`]|\$\()\s*(?:sudo\s+|env\s+(?:\S+=\S*\s+)*|npx\s+|bunx\s+|pnpm\s+(?:exec|dlx)\s+|yarn\s+dlx\s+|exec\s+|xargs\s+(?:-\S+\s+)*)*`;
2339
+ var command = (names) => new RegExp(`${AT}(?:${names})(?=\\s|$|[;&|)])`, "m");
2340
+ var BLOCKED = [
2341
+ [/\bgit\b[^\n;&|]*\s(?:push|send-email|request-pull)\b/, "pushing: the user puts the work out once they looked at it"],
2342
+ [/\bgit\b[^\n;&|]*\sremote\s+(?:add|set-url|rename|remove|rm)\b/, "changing the remotes"],
2343
+ [/\bgit\b[^\n;&|]*\sconfig\b[^\n;&|]*(?:credential|url\.|core\.sshcommand|core\.hookspath)/i, "changing how git reaches others"],
2344
+ [/\b(?:publish|unpublish|deprecate)\b/, "publishing"],
2345
+ [
2346
+ command("wrangler|vercel|netlify|flyctl|fly|firebase|heroku|gh|aws|gcloud|az|kubectl|helm|terraform|pulumi|docker|podman|eas|fastlane|xcrun\\s+altool|twine"),
2347
+ "deploying, or the tools of a cloud"
2348
+ ],
2349
+ [command("ssh|scp|sftp|rsync|nc|ncat|netcat|telnet|ftp|socat"), "reaching other machines"],
2350
+ [
2351
+ /\b(?:curl|wget|http|https|Invoke-WebRequest|Invoke-RestMethod|iwr|irm)\b[^\n;&|]*(?:\s-[a-zA-Z]*[dFT]\b|\s--(?:data|upload|form|post|put|json)|\s-X\s*(?:POST|PUT|PATCH|DELETE)|\s-Method\s+(?:Post|Put|Patch|Delete)|\s-Body\b|\s-InFile\b)/i,
2352
+ "sending data out"
2353
+ ],
2354
+ [
2355
+ /(?:~|\$HOME|\$\{HOME\}|\$env:USERPROFILE|\/Users\/[^/\s]+|\/home\/[^/\s]+|\/root)[\\/]\.(?:ssh|aws|gnupg|netrc|npmrc|yarnrc|pypirc|zshenv|zshrc|zprofile|bashrc|bash_profile|profile|docker|kube|ta|codebuddy|claude|cursor|config[\\/](?:gh|gcloud|hub))\b/i,
2356
+ "the user's secrets and settings"
2357
+ ],
2358
+ [/\bsecurity\s+(?:find|dump|export)-/, "the keychain"],
2359
+ [command("printenv|env|set|export\\s+-p|declare\\s+-x|Get-ChildItem\\s+env:|gci\\s+env:|dir\\s+env:"), "printing the environment (it holds tokens)"],
2360
+ [command("sudo|su|doas|osascript|launchctl|crontab|defaults\\s+write|schtasks|reg"), "acting as the system"],
2361
+ [/\brm\s+-[a-zA-Z]*[rR][a-zA-Z]*\s+(?:-[a-zA-Z]+\s+)*(?:\/|~|\$HOME|\$\{HOME\})(?:\s|$|\/\s|\/\*)/, "deleting outside its directory"]
2362
+ ];
2363
+ var TaConfineUtil;
2364
+ (function(TaConfineUtil2) {
2365
+ TaConfineUtil2.FILE_TOOLS = ["read", "edit", "write", "grep", "find", "ls"];
2366
+ TaConfineUtil2.COMMAND_TOOLS = ["bash", "powershell"];
2367
+ function confine(role) {
2368
+ return role.includes(TA_CONFINED_MARK) ? role : `${TA_CONFINED_MARK}
2369
+ ${role}`;
2370
+ }
2371
+ TaConfineUtil2.confine = confine;
2372
+ function confined(systemPrompt) {
2373
+ return TaHostUtil.marked(systemPrompt, TA_CONFINED_MARK);
2374
+ }
2375
+ TaConfineUtil2.confined = confined;
2376
+ function blocked(commandText) {
2377
+ var _a;
2378
+ const text = String(commandText !== null && commandText !== undefined ? commandText : "");
2379
+ return (_a = BLOCKED.find(([pattern]) => pattern.test(text))) === null || _a === undefined ? undefined : _a[1];
2380
+ }
2381
+ TaConfineUtil2.blocked = blocked;
2382
+ })(TaConfineUtil || (TaConfineUtil = {}));
2326
2383
  // ../ta-protocol/esm/common/deployment-protocol.js
2327
2384
  var TA_WELL_KNOWN_PATH = "/.well-known/ta";
2328
2385
 
@@ -2957,10 +3014,10 @@ var TaServer = Symbol("TaServer");
2957
3014
  var TaClient = Symbol("TaClient");
2958
3015
  var TaSlashCommandUtil;
2959
3016
  (function(TaSlashCommandUtil2) {
2960
- function description(command, language) {
3017
+ function description(command2, language) {
2961
3018
  var _a, _b;
2962
- const { descriptions } = command;
2963
- return (_b = (_a = descriptions === null || descriptions === undefined ? undefined : descriptions[language]) !== null && _a !== undefined ? _a : descriptions === null || descriptions === undefined ? undefined : descriptions[language.split("-")[0]]) !== null && _b !== undefined ? _b : command.description;
3019
+ const { descriptions } = command2;
3020
+ return (_b = (_a = descriptions === null || descriptions === undefined ? undefined : descriptions[language]) !== null && _a !== undefined ? _a : descriptions === null || descriptions === undefined ? undefined : descriptions[language.split("-")[0]]) !== null && _b !== undefined ? _b : command2.description;
2964
3021
  }
2965
3022
  TaSlashCommandUtil2.description = description;
2966
3023
  })(TaSlashCommandUtil || (TaSlashCommandUtil = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-channels",
3
- "version": "4.20.0",
3
+ "version": "4.22.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"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.20.0",
31
- "@celljs/ta-relay": "4.20.0",
32
- "@celljs/ta-web": "4.20.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
@@ -1032,6 +1032,12 @@ var ChannelsUtil;
1032
1032
  }
1033
1033
  channel.dailyLimit = input.dailyLimit;
1034
1034
  }
1035
+ if (input.shared !== undefined) {
1036
+ if (typeof input.shared !== "string" || !input.shared) {
1037
+ throw new Error("The group chat a channel became is the id of a room.");
1038
+ }
1039
+ channel.shared = input.shared;
1040
+ }
1035
1041
  return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel, before };
1036
1042
  }
1037
1043
  ChannelsUtil.updateChannel = updateChannel;
@@ -1044,6 +1050,10 @@ var ChannelsUtil;
1044
1050
  return team.channels.filter((channel) => channel.by === "ta");
1045
1051
  }
1046
1052
  ChannelsUtil.taskChannels = taskChannels;
1053
+ function liveChannels(team) {
1054
+ return ownChannels(team).filter((channel) => !channel.shared);
1055
+ }
1056
+ ChannelsUtil.liveChannels = liveChannels;
1047
1057
  function ownChannels(team) {
1048
1058
  return team.channels.filter((channel) => channel.by !== "ta");
1049
1059
  }
@@ -1350,7 +1360,7 @@ var JA = {
1350
1360
  makeExtensionAsk: "このグループチャットで作成された事項を拡張機能にする(ta-package スキルで)、将来は 1 クリックで再利用可能",
1351
1361
  add: "追加",
1352
1362
  allMembers: "すべてのエージェントがこのグループチャットに既に含まれています",
1353
- membersHint: "最初に選択したメンバーがリーダー:誰も @ で指定されていないメッセージに答えます。",
1363
+ membersHint: "最初に選択したメンバーがリーダー:Ta がグループに任せた仕事を受けます。答えてほしいエージェントは @ で指定します。",
1354
1364
  create: "作成",
1355
1365
  cancel: "キャンセル",
1356
1366
  back: "戻る",
@@ -1364,7 +1374,7 @@ var JA = {
1364
1374
  noAgents: "まだエージェントがありません",
1365
1375
  noAgentsHint: "グループチャットはエージェントで構成されます:最初に 1 つ作成",
1366
1376
  pick: "グループチャットを選択",
1367
- quiet: "まだメッセージがありません。@ でメンバーを指定するか、リーダーが回答します。",
1377
+ quiet: "まだメッセージがありません。@ で指定したエージェントが答えます。",
1368
1378
  placeholder: "{channel} に送信;@ でメンバーを指定",
1369
1379
  answering: "{name} が回答中",
1370
1380
  failed: "回答がありません",
@@ -1413,14 +1423,14 @@ var JA = {
1413
1423
  noAgentsYet: "まだエージェントがありません",
1414
1424
  noAgentsYetHint: "+ で作成するか、Ta にチームを組ませて",
1415
1425
  partners: "仲間",
1416
- groupsSection: "グループチャット",
1426
+ groupsSection: "チャット",
1417
1427
  agentsSection: "エージェント",
1428
+ agentTag: "エージェント",
1418
1429
  noPartners: "まだ仲間がいません",
1419
1430
  noPartnersHint: "+ でエージェントやグループチャットを作るか、友だちを追加して",
1420
- inviteFriends: "友だちを招待",
1421
- noFriends: "まだ友だちがいません",
1422
- shareGroup: "共有グループチャットにする",
1423
- shareGroupHint: "同じ名前のグループチャットを作り、選んだ友だちと中継で暗号化して共有します。エージェントも一緒に入ります。ここの履歴はこのコンピュータに残り、友だちには送られません。",
1431
+ shareGroupHint: "このグループチャットを選んだ友だちと中継で暗号化して共有します。エージェントもそのまま残ります。友だちには参加後のメッセージが見え、それ以前の履歴はこのコンピュータにあなただけのものとして残ります。",
1432
+ sharedBefore: "それ以前の履歴(あなただけに表示)",
1433
+ sharedBeforeTile: "以前の履歴",
1424
1434
  sharedMade: "「{name}」を友だちと共有しました。参加するとすぐ入れます。",
1425
1435
  addFriends: "友だちを追加",
1426
1436
  friend: "友だち",
@@ -1592,7 +1602,7 @@ var ZH = {
1592
1602
  makeExtensionAsk: "把这个群聊里商量和做成的事做成扩展(用 ta-package 技能),以后一键就能再用",
1593
1603
  add: "添加",
1594
1604
  allMembers: "所有智能体都已在这个群聊里",
1595
- membersHint: "先选的成员是负责人:没人被 @ 的消息由它回答。",
1605
+ membersHint: "先选的成员是负责人:Ta 派给群的事由它接。想让哪个智能体回答你,就 @ 它。",
1596
1606
  create: "创建",
1597
1607
  cancel: "取消",
1598
1608
  back: "返回",
@@ -1606,7 +1616,7 @@ var ZH = {
1606
1616
  noAgents: "还没有智能体",
1607
1617
  noAgentsHint: "群聊由智能体组成,先新建一个",
1608
1618
  pick: "选一个群聊",
1609
- quiet: "还没有消息。用 @ 点名成员,不点名就由负责人回答。",
1619
+ quiet: "还没有消息。@ 哪个智能体,它就会回答。",
1610
1620
  placeholder: "发到 {channel};@ 点名成员",
1611
1621
  answering: "{name} 正在回答",
1612
1622
  failed: "没有回答",
@@ -1655,14 +1665,14 @@ var ZH = {
1655
1665
  noAgentsYet: "还没有智能体",
1656
1666
  noAgentsYetHint: "点 + 新建,或让 Ta 组个团队",
1657
1667
  partners: "伙伴",
1658
- groupsSection: "群聊",
1668
+ groupsSection: "聊天",
1659
1669
  agentsSection: "智能体",
1670
+ agentTag: "智能体",
1660
1671
  noPartners: "还没有伙伴",
1661
1672
  noPartnersHint: "点 + 新建智能体或群聊,或加个好友",
1662
- inviteFriends: "邀请好友",
1663
- noFriends: "还没有好友",
1664
- shareGroup: "建成共享群聊",
1665
- shareGroupHint: "会新建一个同名的群聊,经中继加密和你选的好友共享,群里的智能体一起进去;这里的聊天记录留在本机,不发给好友。",
1673
+ shareGroupHint: "这个群聊会经中继加密和你选的好友共享,群里的智能体都在。好友从加入起看到新消息,之前的记录只留在本机,只有你能看到。",
1674
+ sharedBefore: "之前的聊天记录,只有你能看到",
1675
+ sharedBeforeTile: "之前的记录",
1666
1676
  sharedMade: "已和好友共享「{name}」:好友点加入就进来。",
1667
1677
  addFriends: "添加好友",
1668
1678
  friend: "好友",
@@ -1834,7 +1844,7 @@ var ZH_TW = {
1834
1844
  makeExtensionAsk: "把這個群聊里商量和做成的事做成擴充功能(用 ta-package 技能),以後一鍵就能再用",
1835
1845
  add: "新增",
1836
1846
  allMembers: "所有智慧體都已在這個群聊里",
1837
- membersHint: "先選的成員是負責人:沒人被 @ 的訊息由它回答。",
1847
+ membersHint: "先選的成員是負責人:Ta 派給群的事由它接。想讓哪個智慧體回答你,就 @ 它。",
1838
1848
  create: "建立",
1839
1849
  cancel: "取消",
1840
1850
  back: "返回",
@@ -1848,7 +1858,7 @@ var ZH_TW = {
1848
1858
  noAgents: "還沒有智慧體",
1849
1859
  noAgentsHint: "群聊由智慧體組成,先新建一個",
1850
1860
  pick: "選一個群聊",
1851
- quiet: "還沒有訊息。用 @ 點名成員,不點名就由負責人回答。",
1861
+ quiet: "還沒有訊息。@ 哪個智慧體,它就會回答。",
1852
1862
  placeholder: "發到 {channel};@ 點名成員",
1853
1863
  answering: "{name} 正在回答",
1854
1864
  failed: "沒有回答",
@@ -1897,14 +1907,14 @@ var ZH_TW = {
1897
1907
  noAgentsYet: "還沒有智慧體",
1898
1908
  noAgentsYetHint: "點 + 新建,或讓 Ta 組個團隊",
1899
1909
  partners: "夥伴",
1900
- groupsSection: "群聊",
1910
+ groupsSection: "聊天",
1901
1911
  agentsSection: "智慧體",
1912
+ agentTag: "智慧體",
1902
1913
  noPartners: "還沒有夥伴",
1903
1914
  noPartnersHint: "點 + 新建智慧體或群聊,或加個好友",
1904
- inviteFriends: "邀請好友",
1905
- noFriends: "還沒有好友",
1906
- shareGroup: "建成共享群聊",
1907
- shareGroupHint: "會新建一個同名的群聊,經中繼加密和你選的好友共享,群裡的智慧體一起進去;這裡的聊天記錄留在本機,不發給好友。",
1915
+ shareGroupHint: "這個群聊會經中繼加密和你選的好友共享,群裡的智慧體都在。好友從加入起看到新訊息,之前的記錄只留在本機,只有你能看到。",
1916
+ sharedBefore: "之前的聊天記錄,只有你能看到",
1917
+ sharedBeforeTile: "之前的記錄",
1908
1918
  sharedMade: "已和好友共享「{name}」:好友點加入就進來。",
1909
1919
  addFriends: "新增好友",
1910
1920
  friend: "好友",
@@ -2076,7 +2086,7 @@ var EN = {
2076
2086
  makeExtensionAsk: "Make what this group chat worked out an extension, with the ta-package skill, to do it again in a click",
2077
2087
  add: "Add",
2078
2088
  allMembers: "Every agent is in this group chat already",
2079
- membersHint: "The first one you pick leads: it answers what names nobody.",
2089
+ membersHint: "The first one you pick leads: it answers what Ta hands the group chat. Mention an agent with @ to have it answer you.",
2080
2090
  create: "Create",
2081
2091
  cancel: "Cancel",
2082
2092
  back: "Back",
@@ -2090,7 +2100,7 @@ var EN = {
2090
2100
  noAgents: "No agents yet",
2091
2101
  noAgentsHint: "A group chat is made of agents: create one first",
2092
2102
  pick: "Pick a group chat",
2093
- quiet: "Nothing said yet. Mention a member with @, or the lead answers.",
2103
+ quiet: "Nothing said yet. Mention an agent with @ to have it answer.",
2094
2104
  placeholder: "Message {channel}; @ names a member",
2095
2105
  answering: "{name} is answering",
2096
2106
  failed: "did not answer",
@@ -2139,14 +2149,14 @@ var EN = {
2139
2149
  noAgentsYet: "No agents yet",
2140
2150
  noAgentsYetHint: "Create one with +, or ask Ta for a team",
2141
2151
  partners: "Partners",
2142
- groupsSection: "Group chats",
2152
+ groupsSection: "Chats",
2143
2153
  agentsSection: "Agents",
2154
+ agentTag: "Agent",
2144
2155
  noPartners: "No one to work with yet",
2145
2156
  noPartnersHint: "Create an agent or a group chat with +, or add a friend",
2146
- inviteFriends: "Invite friends",
2147
- noFriends: "No friends yet",
2148
- shareGroup: "Make it shared",
2149
- shareGroupHint: "A group chat of the same name is made, shared with the friends you pick through the relay, sealed; its agents go in too. What was said here stays on this computer.",
2157
+ shareGroupHint: "This group chat is shared with the friends you pick through the relay, sealed, its agents in it too. They see what is said from when they join; what was said before stays on this computer, for you alone.",
2158
+ sharedBefore: "What was said before, for you alone",
2159
+ sharedBeforeTile: "Earlier",
2150
2160
  sharedMade: "“{name}” is shared with your friends now: they are in once they join.",
2151
2161
  addFriends: "Add friends",
2152
2162
  friend: "Friend",
@@ -3025,86 +3035,16 @@ async function createShared(context, title, friends, agents) {
3025
3035
  }
3026
3036
  const { link } = await rooms.invite(room.id);
3027
3037
  await pi.openLink?.(link);
3038
+ return room.id;
3028
3039
  }
3029
3040
  var ROOMS_PACKAGE = "@celljs/ta-rooms";
3030
3041
  var ROOMS_KIND = "ta-rooms";
3031
- function ShareDialog({ context, channel, onClose }) {
3042
+ async function becomeGroup(context, channel, friends, agents) {
3032
3043
  const { pi } = context;
3033
- const w = ChannelViews.words(pi);
3034
- const friends = useFriends(pi);
3035
- const Check = ChannelViews.icon(pi, "Check");
3036
- const [picked, setPicked] = React.useState([]);
3037
- const [busy, setBusy] = React.useState(false);
3038
- const [error, setError] = React.useState();
3039
- const toggle = (friend) => setPicked(picked.includes(friend.id) ? picked.filter((id) => id !== friend.id) : [...picked, friend.id]);
3040
- const share = () => {
3041
- setBusy(true);
3042
- setError(undefined);
3043
- createShared(context, channel.name, picked, channel.members).then(() => {
3044
- onClose();
3045
- pi.ui.notify(ChannelWords.format(w.sharedMade, { name: channel.name }), "info");
3046
- }, (failure) => {
3047
- setBusy(false);
3048
- setError(ChannelViews.message(failure));
3049
- });
3050
- };
3051
- return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
3052
- title: w.inviteFriends,
3053
- onClose
3054
- }, /* @__PURE__ */ React.createElement("div", {
3055
- className: "tac-dialog"
3056
- }, /* @__PURE__ */ React.createElement("div", {
3057
- className: "tac-dialog-note"
3058
- }, w.shareGroupHint), /* @__PURE__ */ React.createElement("div", {
3059
- className: "tac-pick-list"
3060
- }, friends.length === 0 && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
3061
- compact: true,
3062
- title: w.noFriends
3063
- }), friends.map((friend) => {
3064
- const on = picked.includes(friend.id);
3065
- return /* @__PURE__ */ React.createElement("button", {
3066
- key: friend.id,
3067
- type: "button",
3068
- "aria-pressed": on,
3069
- className: `tac-pick${on ? " tac-on" : ""}`,
3070
- onClick: () => toggle(friend)
3071
- }, /* @__PURE__ */ React.createElement("span", {
3072
- className: "tac-check"
3073
- }, on && /* @__PURE__ */ React.createElement(Check, {
3074
- size: 13,
3075
- strokeWidth: 3
3076
- })), pi.ui.Face ? /* @__PURE__ */ React.createElement(pi.ui.Face, {
3077
- seed: friend.id,
3078
- size: 30,
3079
- look: friend.look
3080
- }) : /* @__PURE__ */ React.createElement("span", {
3081
- className: "tac-pick-face"
3082
- }), /* @__PURE__ */ React.createElement("span", {
3083
- className: "tac-pick-text"
3084
- }, /* @__PURE__ */ React.createElement("span", {
3085
- className: "tac-pick-name"
3086
- }, friend.name), /* @__PURE__ */ React.createElement("span", {
3087
- className: "tac-pick-role"
3088
- }, w.friend)));
3089
- })), error && /* @__PURE__ */ React.createElement("div", {
3090
- className: "tac-empty tac-error"
3091
- }, error), /* @__PURE__ */ React.createElement("div", {
3092
- className: "tac-dialog-actions"
3093
- }, /* @__PURE__ */ React.createElement("button", {
3094
- type: "button",
3095
- className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
3096
- disabled: busy || picked.length === 0,
3097
- onClick: share
3098
- }, w.shareGroup, busy && /* @__PURE__ */ React.createElement("span", {
3099
- className: "ta-spinner ta-busy-mark ta-on-brand"
3100
- })))));
3101
- }
3102
- function openShareGroup(context, channel) {
3103
- context.pi.ui.custom?.(({ close }) => /* @__PURE__ */ React.createElement(ShareDialog, {
3104
- context,
3105
- channel,
3106
- onClose: close
3107
- }));
3044
+ const members = [...channel.members, ...agents.filter((id) => !channel.members.includes(id))];
3045
+ const room = await createShared(context, channel.name, friends, members);
3046
+ await context.service.updateChannel(channel.id, { shared: room });
3047
+ pi.ui.notify(ChannelWords.format(ChannelViews.words(pi).sharedMade, { name: channel.name }), "info");
3108
3048
  }
3109
3049
 
3110
3050
  // web-src/create.tsx
@@ -4090,7 +4030,7 @@ var ChannelsText;
4090
4030
  if (message.author === SYSTEM) {
4091
4031
  return [];
4092
4032
  }
4093
- if (named.length > 0 || message.author !== USER && message.author !== TA) {
4033
+ if (named.length > 0 || message.author !== TA) {
4094
4034
  return named;
4095
4035
  }
4096
4036
  return members.length > 0 ? [members[0].id] : [];
@@ -5612,7 +5552,6 @@ function MemberList({ context, team, channel, faces, working }) {
5612
5552
  const [confirming, setConfirming] = React.useState(false);
5613
5553
  const [editing, setEditing] = React.useState();
5614
5554
  const UserPlus = ChannelViews.icon(pi, "UserPlus");
5615
- const Contact = ChannelViews.icon(pi, "Contact");
5616
5555
  const Crown = ChannelViews.icon(pi, "Crown");
5617
5556
  const BellOff = ChannelViews.icon(pi, "BellOff");
5618
5557
  const RotateCcw = ChannelViews.icon(pi, "RotateCcw");
@@ -5674,19 +5613,7 @@ function MemberList({ context, team, channel, faces, working }) {
5674
5613
  className: "tac-member-text"
5675
5614
  }, /* @__PURE__ */ React.createElement("span", {
5676
5615
  className: "tac-member-name"
5677
- }, w.addMembers))), pi.rooms && channel.by !== "ta" && /* @__PURE__ */ React.createElement("button", {
5678
- type: "button",
5679
- className: "tac-member-main",
5680
- onClick: () => openShareGroup(context, channel)
5681
- }, /* @__PURE__ */ React.createElement("span", {
5682
- className: "tac-member-plus"
5683
- }, /* @__PURE__ */ React.createElement(Contact, {
5684
- size: 16
5685
- })), /* @__PURE__ */ React.createElement("span", {
5686
- className: "tac-member-text"
5687
- }, /* @__PURE__ */ React.createElement("span", {
5688
- className: "tac-member-name"
5689
- }, w.inviteFriends))), members.map((agent, index) => {
5616
+ }, w.addMembers))), members.map((agent, index) => {
5690
5617
  const lead = index === 0;
5691
5618
  const off = muted.includes(agent.id);
5692
5619
  const answering = working.includes(agent.id);
@@ -5889,7 +5816,11 @@ function MemberPicker({ context, team, channel, faces }) {
5889
5816
  const Check = ChannelViews.icon(pi, "Check");
5890
5817
  const UserPlus = ChannelViews.icon(pi, "UserPlus");
5891
5818
  const back = () => ui.set({ adding: false });
5892
- const { busy, error, submit } = useSubmit(() => service.addMembers(channel.id, picked), back);
5819
+ const friends = useFriends(pi).filter(() => !!pi.rooms && channel.by !== "ta" && !channel.shared);
5820
+ const [pickedFriends, setPickedFriends] = React.useState([]);
5821
+ const toggleFriend = (id) => setPickedFriends(pickedFriends.includes(id) ? pickedFriends.filter((other) => other !== id) : [...pickedFriends, id]);
5822
+ const { busy, error, submit } = useSubmit(() => pickedFriends.length > 0 ? becomeGroup(context, channel, pickedFriends, picked) : service.addMembers(channel.id, picked), back);
5823
+ const count = picked.length + pickedFriends.length;
5893
5824
  const others = team.agents.filter((agent) => !channel.members.includes(agent.id));
5894
5825
  const shown = others.filter((agent) => SidebarUtil.matches(query, agent.name, agent.role));
5895
5826
  const toggle = (id) => setPicked(picked.includes(id) ? picked.filter((other) => other !== id) : [...picked, id]);
@@ -5952,7 +5883,39 @@ function MemberPicker({ context, team, channel, faces }) {
5952
5883
  size: 12,
5953
5884
  strokeWidth: 3
5954
5885
  })));
5955
- }), /* @__PURE__ */ React.createElement("div", {
5886
+ }), friends.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
5887
+ className: "tac-members-label"
5888
+ }, w.addFriends), friends.filter((friend) => SidebarUtil.matches(query, friend.name)).map((friend) => {
5889
+ const on = pickedFriends.includes(friend.id);
5890
+ return /* @__PURE__ */ React.createElement("button", {
5891
+ key: friend.id,
5892
+ type: "button",
5893
+ className: `tac-member-main tac-pick${on ? " tac-on" : ""}`,
5894
+ "aria-pressed": on,
5895
+ onClick: () => toggleFriend(friend.id)
5896
+ }, pi.ui.Face ? /* @__PURE__ */ React.createElement(pi.ui.Face, {
5897
+ seed: friend.id,
5898
+ size: 32,
5899
+ look: friend.look
5900
+ }) : /* @__PURE__ */ React.createElement("span", {
5901
+ className: "tac-pick-face"
5902
+ }), /* @__PURE__ */ React.createElement("span", {
5903
+ className: "tac-member-text"
5904
+ }, /* @__PURE__ */ React.createElement("span", {
5905
+ className: "tac-member-name"
5906
+ }, /* @__PURE__ */ React.createElement("span", {
5907
+ className: "tac-member-label"
5908
+ }, friend.name)), /* @__PURE__ */ React.createElement("span", {
5909
+ className: "tac-member-detail"
5910
+ }, w.friend)), /* @__PURE__ */ React.createElement("span", {
5911
+ className: "tac-check"
5912
+ }, on && /* @__PURE__ */ React.createElement(Check, {
5913
+ size: 12,
5914
+ strokeWidth: 3
5915
+ })));
5916
+ }), pickedFriends.length > 0 && /* @__PURE__ */ React.createElement("div", {
5917
+ className: "tac-members-note"
5918
+ }, w.shareGroupHint)), /* @__PURE__ */ React.createElement("div", {
5956
5919
  className: "tac-members-sep"
5957
5920
  }), /* @__PURE__ */ React.createElement("button", {
5958
5921
  type: "button",
@@ -5973,13 +5936,186 @@ function MemberPicker({ context, team, channel, faces }) {
5973
5936
  }, /* @__PURE__ */ React.createElement("button", {
5974
5937
  type: "button",
5975
5938
  className: busy ? "tac-button tac-primary tac-wide ta-busy" : "tac-button tac-primary tac-wide",
5976
- disabled: busy || picked.length === 0,
5939
+ disabled: busy || count === 0,
5977
5940
  onClick: submit
5978
- }, picked.length > 0 ? ChannelWords.format(w.addCount, { count: String(picked.length) }) : w.add, busy && /* @__PURE__ */ React.createElement("span", {
5941
+ }, count > 0 ? ChannelWords.format(w.addCount, { count: String(count) }) : w.add, busy && /* @__PURE__ */ React.createElement("span", {
5979
5942
  className: "ta-spinner ta-busy-mark ta-on-brand"
5980
5943
  }))));
5981
5944
  }
5982
5945
 
5946
+ // web-src/partners.tsx
5947
+ class ChannelPartners {
5948
+ context;
5949
+ current = [];
5950
+ signature = "";
5951
+ listeners = new Set;
5952
+ faces = new Map;
5953
+ read = new Set;
5954
+ constructor(context) {
5955
+ this.context = context;
5956
+ }
5957
+ partners = () => this.current;
5958
+ subscribe = (listener) => {
5959
+ this.listeners.add(listener);
5960
+ return () => this.listeners.delete(listener);
5961
+ };
5962
+ start() {
5963
+ const stopService = this.context.service.subscribe(() => this.refresh());
5964
+ const stopUi = this.context.ui.subscribe(() => this.refresh());
5965
+ this.refresh();
5966
+ return () => {
5967
+ stopService();
5968
+ stopUi();
5969
+ };
5970
+ }
5971
+ add() {
5972
+ const { pi } = this.context;
5973
+ return [{ key: "agent", label: ChannelViews.words(pi).newAgent, icon: ChannelViews.icon(pi, "Bot"), run: () => newAgent(this.context) }];
5974
+ }
5975
+ async group(members) {
5976
+ if (!members.every((member) => member.extension === NAME && member.kind === "agent")) {
5977
+ return false;
5978
+ }
5979
+ const { service } = this.context;
5980
+ const names = members.map((member) => member.name.replace(/[@#,]/g, "")).join("、");
5981
+ const name = ChannelsUtil.freeName(service.state.team, names.length > MAX_NAME - 3 ? `${names.slice(0, MAX_NAME - 4)}…` : names);
5982
+ const channel = await service.createChannel({ name, members: members.map((member) => member.id) });
5983
+ this.context.showChannel(channel.id);
5984
+ return true;
5985
+ }
5986
+ addon() {
5987
+ const { pi, service } = this.context;
5988
+ const before = (roomId) => ChannelsUtil.ownChannels(service.state.team).find((channel) => channel.shared === roomId);
5989
+ return {
5990
+ tile: (room) => before(room.id) ? { label: ChannelViews.words(pi).sharedBeforeTile, icon: "Clock", status: ChannelViews.words(pi).sharedBefore } : undefined,
5991
+ open: (room) => {
5992
+ const channel = before(room.id);
5993
+ if (channel) {
5994
+ this.context.showChannel(channel.id);
5995
+ }
5996
+ },
5997
+ subscribe: (listener) => service.subscribe(listener)
5998
+ };
5999
+ }
6000
+ refresh() {
6001
+ const { pi, service, ui } = this.context;
6002
+ const { team, messages, working, loaded } = service.state;
6003
+ if (!loaded) {
6004
+ return;
6005
+ }
6006
+ const channels = ChannelsUtil.liveChannels(team);
6007
+ for (const channel of channels) {
6008
+ if (!this.read.has(channel.id)) {
6009
+ this.read.add(channel.id);
6010
+ service.messages(channel.id).catch(() => {
6011
+ return;
6012
+ });
6013
+ }
6014
+ }
6015
+ const agents = ChannelsUtil.standing(team);
6016
+ const { fresh } = ui.state;
6017
+ const language = pi.ui.language;
6018
+ const signature = [
6019
+ language,
6020
+ ...agents.map((agent) => [agent.id, agent.name, agent.role, agent.face, agent.sessionFile ?? "", agent.cwd ?? ""].join(":")),
6021
+ ...channels.map((channel) => [
6022
+ channel.id,
6023
+ channel.name,
6024
+ channel.topic ?? "",
6025
+ channel.members.join("/"),
6026
+ messages[channel.id]?.at(-1)?.id ?? "",
6027
+ (working[channel.id] ?? []).join("/"),
6028
+ fresh.includes(channel.id) ? 1 : 0
6029
+ ].join(":"))
6030
+ ].join("|");
6031
+ if (signature === this.signature) {
6032
+ return;
6033
+ }
6034
+ this.signature = signature;
6035
+ const w = ChannelWords.of(language);
6036
+ this.current = [...agents.map((agent) => this.agent(agent)), ...channels.map((channel) => this.channel(channel, w))];
6037
+ for (const listener of this.listeners) {
6038
+ listener();
6039
+ }
6040
+ }
6041
+ agent(agent) {
6042
+ const { pi } = this.context;
6043
+ const w = ChannelViews.words(pi);
6044
+ return {
6045
+ id: agent.id,
6046
+ kind: "agent",
6047
+ name: agent.name,
6048
+ face: this.agentFace(agent.id),
6049
+ icon: ChannelViews.icon(pi, "Bot"),
6050
+ about: agent.role,
6051
+ chat: agent.sessionFile ? { sessionFile: agent.sessionFile } : undefined,
6052
+ location: agent.cwd,
6053
+ open: () => ChannelViews.openAgent(this.context, agent.id),
6054
+ menu: () => [[{ key: "delete", label: w.deleteAgent, danger: true, run: () => void deleteAgent(this.context, agent) }]]
6055
+ };
6056
+ }
6057
+ channel(channel, w) {
6058
+ const { pi, service, ui } = this.context;
6059
+ const { team, messages, working } = service.state;
6060
+ const busy = working[channel.id] ?? [];
6061
+ const name = (id) => ChannelsText.authorName(team, id, { user: w.you, ta: w.ta });
6062
+ const last = messages[channel.id]?.filter((message) => message.author !== SYSTEM).at(-1);
6063
+ return {
6064
+ id: channel.id,
6065
+ kind: "group",
6066
+ name: channel.name,
6067
+ face: this.channelFace(channel.id),
6068
+ icon: ChannelViews.icon(pi, "Hash"),
6069
+ about: channel.topic ?? membersOf(team, channel).map((agent) => agent.name).join("、"),
6070
+ chat: {
6071
+ last: busy.length > 0 ? ChannelWords.format(w.answeringNow, { name: busy.map(name).join("、") }) : last ? `${name(last.author)}:${last.text.replace(/\s+/g, " ")}` : undefined,
6072
+ at: SidebarUtil.channelAt(channel, messages[channel.id]),
6073
+ unseen: ui.state.fresh.includes(channel.id),
6074
+ busy: busy.length > 0
6075
+ },
6076
+ open: () => this.context.showChannel(channel.id),
6077
+ menu: () => [[{ key: "delete", label: w.deleteChannel, danger: true, run: () => void deleteChannel(this.context, channel) }]]
6078
+ };
6079
+ }
6080
+ agentFace(id) {
6081
+ return this.face(`agent:${id}`, function AgentFace({ size, state: { team, working } }) {
6082
+ const faces = useFaces(team);
6083
+ return /* @__PURE__ */ React.createElement(Face, {
6084
+ face: faces.get(id) ?? 0,
6085
+ size,
6086
+ working: Object.values(working).some((ids) => ids.includes(id))
6087
+ });
6088
+ });
6089
+ }
6090
+ channelFace(id) {
6091
+ return this.face(`channel:${id}`, function ChannelFace({ size, state: { team, working } }) {
6092
+ const faces = useFaces(team);
6093
+ const channel = team.channels.find((each) => each.id === id);
6094
+ return /* @__PURE__ */ React.createElement(RoomFace, {
6095
+ members: channel ? membersOf(team, channel) : [],
6096
+ faces,
6097
+ size,
6098
+ working: working[id] ?? []
6099
+ });
6100
+ });
6101
+ }
6102
+ face(key, Draw) {
6103
+ let face = this.faces.get(key);
6104
+ if (!face) {
6105
+ const { service } = this.context;
6106
+ face = function PartnerFace({ size }) {
6107
+ const state = React.useSyncExternalStore((listener) => service.subscribe(listener), () => service.state);
6108
+ return /* @__PURE__ */ React.createElement(Draw, {
6109
+ size,
6110
+ state
6111
+ });
6112
+ };
6113
+ this.faces.set(key, face);
6114
+ }
6115
+ return face;
6116
+ }
6117
+ }
6118
+
5983
6119
  // web-src/sidebar-hooks.ts
5984
6120
  var FOLDED_KEY = "ta-channels.folded";
5985
6121
  var BY_DIRECTORY_KEY = "ui.membersByDirectory";
@@ -6408,7 +6544,7 @@ function AgentsSidebar({ context, partners = false }) {
6408
6544
  const Empty = pi.ui.Empty;
6409
6545
  const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
6410
6546
  const { team, working } = state;
6411
- const own = React.useMemo(() => ChannelsUtil.ownChannels(team), [team]);
6547
+ const own = React.useMemo(() => ChannelsUtil.liveChannels(team), [team]);
6412
6548
  const seen = useSeenTasks(pi.storage, tasks);
6413
6549
  const said = Object.values(state.messages).reduce((count, list) => count + list.length, 0);
6414
6550
  const sessionLines = useSessionLines(context, `${said}:${Object.values(working).flat().join(",")}:${team.agents.length}`);
@@ -6480,6 +6616,53 @@ function AgentsSidebar({ context, partners = false }) {
6480
6616
  fresh > 0 ? ChannelWords.format(w.freshCount, { count: String(fresh) }) : "",
6481
6617
  running > 0 ? ChannelWords.format(w.runningCount, { count: String(running) }) : ""
6482
6618
  ].filter(Boolean).join(" · ");
6619
+ const agentRow = (agent, tag = false) => {
6620
+ const where = team.channels.find((channel) => working[channel.id]?.includes(agent.id));
6621
+ const cwd = agent.cwd ?? serverCwd;
6622
+ const last = lastLines?.get(agent.id);
6623
+ const line = lastLines ? last?.text ?? w.noMessages : "";
6624
+ const busy = !!where || answering.has(agent.id);
6625
+ const needsYou = asking.has(agent.id);
6626
+ const unseen = !busy && needsLook(agent.id);
6627
+ return /* @__PURE__ */ React.createElement(Row, {
6628
+ pi,
6629
+ key: agent.id,
6630
+ avatar: /* @__PURE__ */ React.createElement(AgentAvatar, {
6631
+ agent,
6632
+ faces,
6633
+ size: 40,
6634
+ working: busy
6635
+ }),
6636
+ title: agent.name,
6637
+ badge: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PinMark, {
6638
+ pi,
6639
+ pinned: agent.pinned
6640
+ }), tag && /* @__PURE__ */ React.createElement("span", {
6641
+ className: "tac-kind"
6642
+ }, w.agentTag)),
6643
+ place: /* @__PURE__ */ React.createElement(HostTag, {
6644
+ location: cwd
6645
+ }),
6646
+ preview: needsYou ? w.needsYou : where ? ChannelWords.format(w.answeringIn, { channel: where.name }) : line,
6647
+ live: busy && !needsYou,
6648
+ waiting: needsYou,
6649
+ fresh: unseen,
6650
+ dot: needsYou ? "ask" : busy ? "running" : unseen ? "attention" : undefined,
6651
+ time: lastLines ? SidebarUtil.time(last?.at ?? agent.createdAt, pi.ui.language) : "",
6652
+ hint: SidebarUtil.where(cwd),
6653
+ selected: agentSelected(agent),
6654
+ deleting: state.deleting.includes(agent.id),
6655
+ onSelect: () => openAgent(agent),
6656
+ more: /* @__PURE__ */ React.createElement(AgentMenu, {
6657
+ context,
6658
+ agent,
6659
+ cwd,
6660
+ working: !!where
6661
+ }),
6662
+ swipe: swipePinDelete(pi, !!agent.pinned, (pinned) => context.service.updateAgent(agent.id, { pinned }), () => deleteAgent(context, agent))
6663
+ });
6664
+ };
6665
+ const chatAgents = partners && lastLines ? agents.filter((agent) => lastLines.has(agent.id)) : [];
6483
6666
  return /* @__PURE__ */ React.createElement("div", {
6484
6667
  className: "tac-view"
6485
6668
  }, /* @__PURE__ */ React.createElement("div", {
@@ -6574,10 +6757,10 @@ function AgentsSidebar({ context, partners = false }) {
6574
6757
  type: "button",
6575
6758
  className: "tac-show-all",
6576
6759
  onClick: () => setAllEnded(!allEnded)
6577
- }, allEnded ? w.showFewer : ChannelWords.format(w.showAll, { count: String(groups.ended.length) }))), (channels.length > 0 || groupItems.length > 0) && /* @__PURE__ */ React.createElement(Section, {
6760
+ }, allEnded ? w.showFewer : ChannelWords.format(w.showAll, { count: String(groups.ended.length) }))), (channels.length > 0 || groupItems.length > 0 || chatAgents.length > 0) && /* @__PURE__ */ React.createElement(Section, {
6578
6761
  id: "channels",
6579
6762
  title: partners ? w.groupsSection : w.channelsSection,
6580
- count: channels.length + groupItems.length,
6763
+ count: channels.length + groupItems.length + chatAgents.length,
6581
6764
  folded,
6582
6765
  onFold: fold,
6583
6766
  alert: channels.some((channel) => unread.includes(channel.id)) || groupItems.some((item) => item.unseen)
@@ -6587,8 +6770,14 @@ function AgentsSidebar({ context, partners = false }) {
6587
6770
  pinned: !!channel.pinned,
6588
6771
  at: SidebarUtil.channelAt(channel, state.messages[channel.id])
6589
6772
  })),
6590
- ...groupItems.map((item) => ({ item, pinned: false, at: item.at ?? 0 }))
6773
+ ...groupItems.map((item) => ({ item, pinned: false, at: item.at ?? 0 })),
6774
+ ...chatAgents.map((agent) => ({ agent, pinned: !!agent.pinned, at: latest.get(agent.id) ?? agent.createdAt }))
6591
6775
  ], partners).map((entry) => {
6776
+ if ("agent" in entry) {
6777
+ return /* @__PURE__ */ React.createElement(React.Fragment, {
6778
+ key: `agent:${entry.agent.id}`
6779
+ }, agentRow(entry.agent, true));
6780
+ }
6592
6781
  if (!("channel" in entry)) {
6593
6782
  return /* @__PURE__ */ React.createElement(HomeRow, {
6594
6783
  key: entry.item.key,
@@ -6657,50 +6846,7 @@ function AgentsSidebar({ context, partners = false }) {
6657
6846
  size: 12
6658
6847
  }), /* @__PURE__ */ React.createElement("span", null, SidebarUtil.folder(group.cwd)), /* @__PURE__ */ React.createElement(HostTag, {
6659
6848
  location: group.cwd
6660
- })), group.agents.map((agent) => {
6661
- const where = team.channels.find((channel) => working[channel.id]?.includes(agent.id));
6662
- const cwd = agent.cwd ?? serverCwd;
6663
- const last = lastLines?.get(agent.id);
6664
- const line = lastLines ? last?.text ?? w.noMessages : "";
6665
- const busy = !!where || answering.has(agent.id);
6666
- const needsYou = asking.has(agent.id);
6667
- const unseen = !busy && needsLook(agent.id);
6668
- return /* @__PURE__ */ React.createElement(Row, {
6669
- pi,
6670
- key: agent.id,
6671
- avatar: /* @__PURE__ */ React.createElement(AgentAvatar, {
6672
- agent,
6673
- faces,
6674
- size: 40,
6675
- working: busy
6676
- }),
6677
- title: agent.name,
6678
- badge: /* @__PURE__ */ React.createElement(PinMark, {
6679
- pi,
6680
- pinned: agent.pinned
6681
- }),
6682
- place: /* @__PURE__ */ React.createElement(HostTag, {
6683
- location: cwd
6684
- }),
6685
- preview: needsYou ? w.needsYou : where ? ChannelWords.format(w.answeringIn, { channel: where.name }) : line,
6686
- live: busy && !needsYou,
6687
- waiting: needsYou,
6688
- fresh: unseen,
6689
- dot: needsYou ? "ask" : busy ? "running" : unseen ? "attention" : undefined,
6690
- time: lastLines ? SidebarUtil.time(last?.at ?? agent.createdAt, pi.ui.language) : "",
6691
- hint: SidebarUtil.where(cwd),
6692
- selected: agentSelected(agent),
6693
- deleting: state.deleting.includes(agent.id),
6694
- onSelect: () => openAgent(agent),
6695
- more: /* @__PURE__ */ React.createElement(AgentMenu, {
6696
- context,
6697
- agent,
6698
- cwd,
6699
- working: !!where
6700
- }),
6701
- swipe: swipePinDelete(pi, !!agent.pinned, (pinned) => context.service.updateAgent(agent.id, { pinned }), () => deleteAgent(context, agent))
6702
- });
6703
- })))), homeSections.map((section) => /* @__PURE__ */ React.createElement(Section, {
6849
+ })), group.agents.map((agent) => agentRow(agent))))), homeSections.map((section) => /* @__PURE__ */ React.createElement(Section, {
6704
6850
  key: section.id,
6705
6851
  id: section.id,
6706
6852
  title: section.title,
@@ -6831,6 +6977,7 @@ function SidebarHead({ context }) {
6831
6977
 
6832
6978
  // web-src/style.ts
6833
6979
  var STYLE = `
6980
+ .tac-kind { flex: none; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--ta-hover); color: var(--ta-muted); font-size: calc(10.5px * var(--ta-font-scale)); line-height: 16px; font-weight: 500; }
6834
6981
  .tac-view { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: calc(13px * var(--ta-font-scale)); }
6835
6982
  .tac-action { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ta-muted); cursor: pointer; }
6836
6983
  .tac-action:hover { background: var(--ta-hover); color: var(--ta-text); }
@@ -7072,6 +7219,7 @@ textarea.tac-input { resize: vertical; min-height: 56px; line-height: 1.5; }
7072
7219
  .tac-members-label { padding: 10px 10px 6px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
7073
7220
  .tac-members-head { display: flex; align-items: center; gap: 6px; flex: none; padding: 10px 12px 4px 8px; font-size: calc(13.5px * var(--ta-font-scale)); }
7074
7221
  .tac-members-search { flex: none; margin: 6px 16px 2px; }
7222
+ .tac-members-note { padding: 4px 10px 8px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); line-height: 1.5; }
7075
7223
  .tac-members-sep { height: 1px; margin: 6px 10px; background: var(--ta-border-muted); }
7076
7224
  .tac-member { position: relative; display: flex; align-items: center; border-radius: 12px; transition: background 120ms; }
7077
7225
  .tac-member:hover, .tac-member:focus-within { background: var(--ta-hover); }
@@ -7398,21 +7546,28 @@ function activate(pi) {
7398
7546
  new ChannelToolLines(context).register();
7399
7547
  pi.registerMessageRenderer(HandOff.CARD, HandOffView.card(context));
7400
7548
  pi.registerComposerAddon(HandOffView.composerAddon(context));
7401
- const partners = !!pi.ui.doubleInChats;
7402
- pi.registerView("channels", {
7403
- title: () => partners ? ChannelWords.of(pi.ui.language).partners : ChannelWords.of(pi.ui.language).title,
7404
- icon: ChannelViews.icon(pi, partners ? "Users" : "Bot"),
7405
- head: () => /* @__PURE__ */ React.createElement(SidebarHead, {
7406
- context
7407
- }),
7408
- render: () => /* @__PURE__ */ React.createElement(AgentsSidebar, {
7409
- context,
7410
- partners
7411
- }),
7412
- location: "sidebar",
7413
- pages: partners ? [CHANNEL_PAGE, AGENT_PAGE] : [DOUBLE_PAGE, CHANNEL_PAGE, AGENT_PAGE],
7414
- order: 80
7415
- });
7549
+ const shared = typeof pi.registerPartners === "function" ? new ChannelPartners(context) : undefined;
7550
+ const stopPartners = shared?.start();
7551
+ if (shared) {
7552
+ pi.registerPartners(shared);
7553
+ pi.registerRoomAddon?.(shared.addon());
7554
+ } else {
7555
+ const partners = !!pi.ui.doubleInChats;
7556
+ pi.registerView("channels", {
7557
+ title: () => partners ? ChannelWords.of(pi.ui.language).partners : ChannelWords.of(pi.ui.language).title,
7558
+ icon: ChannelViews.icon(pi, partners ? "Users" : "Bot"),
7559
+ head: () => /* @__PURE__ */ React.createElement(SidebarHead, {
7560
+ context
7561
+ }),
7562
+ render: () => /* @__PURE__ */ React.createElement(AgentsSidebar, {
7563
+ context,
7564
+ partners
7565
+ }),
7566
+ location: "sidebar",
7567
+ pages: partners ? [CHANNEL_PAGE, AGENT_PAGE] : [DOUBLE_PAGE, CHANNEL_PAGE, AGENT_PAGE],
7568
+ order: 80
7569
+ });
7570
+ }
7416
7571
  pi.registerView("channel", {
7417
7572
  title: () => {
7418
7573
  const channel = service.state.team.channels.find((candidate) => candidate.id === ui.state.channelId);
@@ -7458,6 +7613,7 @@ function activate(pi) {
7458
7613
  service.load();
7459
7614
  return () => {
7460
7615
  stopFocus();
7616
+ stopPartners?.();
7461
7617
  service.dispose();
7462
7618
  removeStyle();
7463
7619
  };