@celljs/ta-channels 4.32.1 → 4.34.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 +104 -0
- package/package.json +4 -4
- package/web/index.js +170 -10
package/host/index.mjs
CHANGED
|
@@ -2725,6 +2725,58 @@ ${role}`;
|
|
|
2725
2725
|
}
|
|
2726
2726
|
TaConfineUtil2.blocked = blocked;
|
|
2727
2727
|
})(TaConfineUtil || (TaConfineUtil = {}));
|
|
2728
|
+
// ../ta-protocol/esm/common/context-protocol.js
|
|
2729
|
+
var TA_CONTEXT_SETTINGS = {
|
|
2730
|
+
renewAt: "context.renewAt",
|
|
2731
|
+
asked: "context.asked",
|
|
2732
|
+
unattended: "context.unattended",
|
|
2733
|
+
double: "context.double",
|
|
2734
|
+
fold: "context.fold"
|
|
2735
|
+
};
|
|
2736
|
+
var TaContextUtil;
|
|
2737
|
+
(function(TaContextUtil2) {
|
|
2738
|
+
TaContextUtil2.AUTO_PERCENT = 60;
|
|
2739
|
+
TaContextUtil2.AUTO_CAP = 250000;
|
|
2740
|
+
TaContextUtil2.DISMISS_STEP = 25;
|
|
2741
|
+
TaContextUtil2.MIN_TOKENS = 40000;
|
|
2742
|
+
TaContextUtil2.MIN_FOLD = 8000;
|
|
2743
|
+
TaContextUtil2.MAX_FAILURES = 2;
|
|
2744
|
+
TaContextUtil2.MODES = ["auto", "ask", "off"];
|
|
2745
|
+
TaContextUtil2.RENEW_AT = ["auto", "40", "60", "80", "never"];
|
|
2746
|
+
TaContextUtil2.FOLDS = ["on", "off"];
|
|
2747
|
+
TaContextUtil2.DEFAULTS = { renewAt: "auto", asked: "ask", unattended: "auto", double: "auto", fold: "on" };
|
|
2748
|
+
function settings(data) {
|
|
2749
|
+
const context = data && typeof data === "object" ? data.context : undefined;
|
|
2750
|
+
const mode = (value, fallback) => TaContextUtil2.MODES.includes(value) ? value : fallback;
|
|
2751
|
+
return {
|
|
2752
|
+
renewAt: renewAt(context === null || context === undefined ? undefined : context.renewAt),
|
|
2753
|
+
asked: mode(context === null || context === undefined ? undefined : context.asked, TaContextUtil2.DEFAULTS.asked),
|
|
2754
|
+
unattended: mode(context === null || context === undefined ? undefined : context.unattended, TaContextUtil2.DEFAULTS.unattended),
|
|
2755
|
+
double: mode(context === null || context === undefined ? undefined : context.double, TaContextUtil2.DEFAULTS.double),
|
|
2756
|
+
fold: TaContextUtil2.FOLDS.includes(context === null || context === undefined ? undefined : context.fold) ? context === null || context === undefined ? undefined : context.fold : TaContextUtil2.DEFAULTS.fold
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2759
|
+
TaContextUtil2.settings = settings;
|
|
2760
|
+
function renewAt(value) {
|
|
2761
|
+
if (value === "auto" || value === "never") {
|
|
2762
|
+
return value;
|
|
2763
|
+
}
|
|
2764
|
+
const percent2 = typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
2765
|
+
return typeof percent2 === "number" && percent2 >= 1 && percent2 <= 95 ? Math.round(percent2) : TaContextUtil2.DEFAULTS.renewAt;
|
|
2766
|
+
}
|
|
2767
|
+
function threshold(at, window) {
|
|
2768
|
+
if (at === "never" || window <= 0) {
|
|
2769
|
+
return 0;
|
|
2770
|
+
}
|
|
2771
|
+
const tokens = at === "auto" ? Math.min(Math.round(window * TaContextUtil2.AUTO_PERCENT / 100), TaContextUtil2.AUTO_CAP) : Math.round(window * at / 100);
|
|
2772
|
+
return Math.max(tokens, TaContextUtil2.MIN_TOKENS);
|
|
2773
|
+
}
|
|
2774
|
+
TaContextUtil2.threshold = threshold;
|
|
2775
|
+
function percent(gauge) {
|
|
2776
|
+
return gauge.tokens !== undefined && gauge.window > 0 ? Math.round(gauge.tokens / gauge.window * 100) : undefined;
|
|
2777
|
+
}
|
|
2778
|
+
TaContextUtil2.percent = percent;
|
|
2779
|
+
})(TaContextUtil || (TaContextUtil = {}));
|
|
2728
2780
|
// ../ta-protocol/esm/common/deployment-protocol.js
|
|
2729
2781
|
var TA_WELL_KNOWN_PATH = "/.well-known/ta";
|
|
2730
2782
|
|
|
@@ -2999,6 +3051,35 @@ var TaGuestUtil;
|
|
|
2999
3051
|
}
|
|
3000
3052
|
TaGuestUtil2.role = role;
|
|
3001
3053
|
})(TaGuestUtil || (TaGuestUtil = {}));
|
|
3054
|
+
// ../ta-protocol/esm/common/inbox-protocol.js
|
|
3055
|
+
var TaInboxUtil;
|
|
3056
|
+
(function(TaInboxUtil2) {
|
|
3057
|
+
TaInboxUtil2.KEEP_MS = 7 * 24 * 3600000;
|
|
3058
|
+
TaInboxUtil2.KEEP_MAX = 500;
|
|
3059
|
+
TaInboxUtil2.RETRY_MS = [60000, 5 * 60000, 30 * 60000];
|
|
3060
|
+
function merge(messages) {
|
|
3061
|
+
if (messages.length === 1) {
|
|
3062
|
+
return messages[0];
|
|
3063
|
+
}
|
|
3064
|
+
const contexts = messages.map((message) => TaMessageContext.read(message)).filter((context) => !!context);
|
|
3065
|
+
const seen = messages.map((message) => TaMessageContext.strip(message).trim()).filter(Boolean);
|
|
3066
|
+
const text = seen.join(`
|
|
3067
|
+
|
|
3068
|
+
`);
|
|
3069
|
+
return contexts.length ? TaMessageContext.wrap(contexts.join(`
|
|
3070
|
+
`), text) : text;
|
|
3071
|
+
}
|
|
3072
|
+
TaInboxUtil2.merge = merge;
|
|
3073
|
+
function sort(events) {
|
|
3074
|
+
const waiting = events.filter((event) => event.status === "waiting").sort((a, b) => a.at - b.at);
|
|
3075
|
+
const went = events.filter((event) => event.status !== "waiting").sort((a, b) => {
|
|
3076
|
+
var _a, _b, _c, _d;
|
|
3077
|
+
return ((_b = (_a = b.doneAt) !== null && _a !== undefined ? _a : b.deliveredAt) !== null && _b !== undefined ? _b : b.at) - ((_d = (_c = a.doneAt) !== null && _c !== undefined ? _c : a.deliveredAt) !== null && _d !== undefined ? _d : a.at);
|
|
3078
|
+
});
|
|
3079
|
+
return [...waiting, ...went];
|
|
3080
|
+
}
|
|
3081
|
+
TaInboxUtil2.sort = sort;
|
|
3082
|
+
})(TaInboxUtil || (TaInboxUtil = {}));
|
|
3002
3083
|
// ../ta-protocol/esm/common/location.js
|
|
3003
3084
|
var TaLocation;
|
|
3004
3085
|
(function(TaLocation2) {
|
|
@@ -3639,6 +3720,29 @@ var TaDesktopUtil;
|
|
|
3639
3720
|
})(TaDesktopUtil || (TaDesktopUtil = {}));
|
|
3640
3721
|
// ../ta-protocol/esm/common/settings-protocol.js
|
|
3641
3722
|
var TaSettingsServer = Symbol("TaSettingsServer");
|
|
3723
|
+
var TA_SETTINGS = [
|
|
3724
|
+
{ key: "model", type: "model" },
|
|
3725
|
+
{ key: "defaultThinkingLevel", type: "enum", values: ["off", "minimal", "low", "medium", "high", "xhigh", "max"] },
|
|
3726
|
+
{ key: "transport", type: "enum", values: ["auto", "sse", "websocket", "websocket-cached"], default: "auto" },
|
|
3727
|
+
{ key: "steeringMode", type: "enum", values: ["one-at-a-time", "all"], default: "one-at-a-time" },
|
|
3728
|
+
{ key: "followUpMode", type: "enum", values: ["one-at-a-time", "all"], default: "one-at-a-time" },
|
|
3729
|
+
{ key: TA_CONTEXT_SETTINGS.renewAt, type: "enum", values: TaContextUtil.RENEW_AT, default: TaContextUtil.DEFAULTS.renewAt },
|
|
3730
|
+
{ key: TA_CONTEXT_SETTINGS.asked, type: "enum", values: TaContextUtil.MODES, default: TaContextUtil.DEFAULTS.asked },
|
|
3731
|
+
{ key: TA_CONTEXT_SETTINGS.unattended, type: "enum", values: TaContextUtil.MODES, default: TaContextUtil.DEFAULTS.unattended },
|
|
3732
|
+
{ key: TA_CONTEXT_SETTINGS.double, type: "enum", values: TaContextUtil.MODES, default: TaContextUtil.DEFAULTS.double },
|
|
3733
|
+
{ key: TA_CONTEXT_SETTINGS.fold, type: "enum", values: TaContextUtil.FOLDS, default: TaContextUtil.DEFAULTS.fold },
|
|
3734
|
+
{ key: "compaction.enabled", type: "boolean", default: true },
|
|
3735
|
+
{ key: "compaction.reserveTokens", type: "number", default: 16384 },
|
|
3736
|
+
{ key: "compaction.keepRecentTokens", type: "number", default: 20000 },
|
|
3737
|
+
{ key: "retry.enabled", type: "boolean", default: true },
|
|
3738
|
+
{ key: "retry.maxRetries", type: "number", default: 3 },
|
|
3739
|
+
{ key: "codemode.mode", type: "enum", values: ["only", "on"], default: "only" },
|
|
3740
|
+
{ key: "enableSkillCommands", type: "boolean", default: true },
|
|
3741
|
+
{ key: "images.autoResize", type: "boolean", default: true },
|
|
3742
|
+
{ key: "images.blockImages", type: "boolean", default: false },
|
|
3743
|
+
{ key: "shellPath", type: "string" },
|
|
3744
|
+
{ key: "shellCommandPrefix", type: "string" }
|
|
3745
|
+
];
|
|
3642
3746
|
// ../ta-protocol/esm/common/ta-protocol.js
|
|
3643
3747
|
var TaServer = Symbol("TaServer");
|
|
3644
3748
|
var TaClient = Symbol("TaClient");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-channels",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.34.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.
|
|
31
|
-
"@celljs/ta-relay": "4.
|
|
32
|
-
"@celljs/ta-web": "4.
|
|
30
|
+
"@celljs/ta-protocol": "4.34.0",
|
|
31
|
+
"@celljs/ta-relay": "4.34.0",
|
|
32
|
+
"@celljs/ta-web": "4.34.0",
|
|
33
33
|
"@types/react": "^19.3.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
package/web/index.js
CHANGED
|
@@ -1535,7 +1535,7 @@ var JA = {
|
|
|
1535
1535
|
noChannelToJoin: "すべてのグループチャットに既に含まれています",
|
|
1536
1536
|
joined: "{name} が #{channel} に参加しました。",
|
|
1537
1537
|
deleteAgent: "削除",
|
|
1538
|
-
confirmDeleteAgent: "{name}
|
|
1538
|
+
confirmDeleteAgent: "{name} を削除しますか?グループチャットから外れ、ほかに誰もいないグループチャットも削除されます。30 日以内なら「削除したエージェント」から復元できます。",
|
|
1539
1539
|
pin: "ピン留め",
|
|
1540
1540
|
unpin: "ピン留めを解除",
|
|
1541
1541
|
pinned: "ピン留めされています",
|
|
@@ -1623,7 +1623,20 @@ var JA = {
|
|
|
1623
1623
|
cardAddHint: "追加後、このディレクトリ下のプロジェクトを確認し、役割をここに合わせます;変更内容はセッションで通知します。",
|
|
1624
1624
|
cardAdded: "@{name} として追加されました",
|
|
1625
1625
|
cardOpen: "会話を開く",
|
|
1626
|
-
cardFailed: "このカードを開けません:{message}"
|
|
1626
|
+
cardFailed: "このカードを開けません:{message}",
|
|
1627
|
+
optimize: "最適化",
|
|
1628
|
+
optimizeAll: "すべて最適化",
|
|
1629
|
+
optimizing: "Ta が使い方に合わせた最適化を検討中です。提案はこの会話に届きます",
|
|
1630
|
+
noInitiative: "エージェントを最適化するには「提案」をオンにしてください",
|
|
1631
|
+
removedAgents: "削除したエージェント({n})",
|
|
1632
|
+
removedTitle: "削除したエージェント",
|
|
1633
|
+
removedHint: "30 日間保持され、復元すると元のグループチャットに戻ります",
|
|
1634
|
+
removedAt: "{days} 日前に削除",
|
|
1635
|
+
removedToday: "今日削除",
|
|
1636
|
+
removedIn: "元は {channels}",
|
|
1637
|
+
restore: "復元",
|
|
1638
|
+
restored: "{name} を復元しました",
|
|
1639
|
+
noRemoved: "この 30 日間に削除したエージェントはありません"
|
|
1627
1640
|
};
|
|
1628
1641
|
|
|
1629
1642
|
// web-src/i18n-zh.ts
|
|
@@ -1790,7 +1803,7 @@ var ZH = {
|
|
|
1790
1803
|
noChannelToJoin: "它已经在所有群聊里了",
|
|
1791
1804
|
joined: "{name} 已加入 #{channel}。",
|
|
1792
1805
|
deleteAgent: "删除",
|
|
1793
|
-
confirmDeleteAgent: "删除 {name}
|
|
1806
|
+
confirmDeleteAgent: "删除 {name}?它会退出所在的群聊,只剩它一个成员的群聊也会一起删除。30 天内可以在「已移除的智能体」里恢复。",
|
|
1794
1807
|
pin: "置顶",
|
|
1795
1808
|
unpin: "取消置顶",
|
|
1796
1809
|
pinned: "已置顶",
|
|
@@ -1878,7 +1891,20 @@ var ZH = {
|
|
|
1878
1891
|
cardAddHint: "加进来后它会先看看这个目录下的项目,把职责调整得贴合这里;改了什么会在它的对话里告诉你。",
|
|
1879
1892
|
cardAdded: "已添加为 @{name}",
|
|
1880
1893
|
cardOpen: "打开对话",
|
|
1881
|
-
cardFailed: "打不开这张名片:{message}"
|
|
1894
|
+
cardFailed: "打不开这张名片:{message}",
|
|
1895
|
+
optimize: "优化",
|
|
1896
|
+
optimizeAll: "全部优化",
|
|
1897
|
+
optimizing: "Ta 正在看怎么按你的用法优化,建议会出现在这个对话里",
|
|
1898
|
+
noInitiative: "打开「主动」后才能优化智能体",
|
|
1899
|
+
removedAgents: "已移除的智能体({n})",
|
|
1900
|
+
removedTitle: "已移除的智能体",
|
|
1901
|
+
removedHint: "保留 30 天,恢复后回到原来的群聊",
|
|
1902
|
+
removedAt: "{days} 天前移除",
|
|
1903
|
+
removedToday: "今天移除",
|
|
1904
|
+
removedIn: "原在 {channels}",
|
|
1905
|
+
restore: "恢复",
|
|
1906
|
+
restored: "{name} 已恢复",
|
|
1907
|
+
noRemoved: "最近 30 天没有移除的智能体"
|
|
1882
1908
|
};
|
|
1883
1909
|
|
|
1884
1910
|
// web-src/i18n-zh-tw.ts
|
|
@@ -2045,7 +2071,7 @@ var ZH_TW = {
|
|
|
2045
2071
|
noChannelToJoin: "它已經在所有群聊里了",
|
|
2046
2072
|
joined: "{name} 已加入 #{channel}。",
|
|
2047
2073
|
deleteAgent: "刪除",
|
|
2048
|
-
confirmDeleteAgent: "刪除 {name}
|
|
2074
|
+
confirmDeleteAgent: "刪除 {name}?它會退出所在的群聊,只剩它一個成員的群聊也會一起刪除。30 天內可以在「已移除的智慧體」裡恢復。",
|
|
2049
2075
|
pin: "置頂",
|
|
2050
2076
|
unpin: "取消置頂",
|
|
2051
2077
|
pinned: "已置頂",
|
|
@@ -2133,7 +2159,20 @@ var ZH_TW = {
|
|
|
2133
2159
|
cardAddHint: "加進來後它會先看看這個目錄下的專案,把職責調整得貼合這裡;改了什麼會在它的對話裡告訴你。",
|
|
2134
2160
|
cardAdded: "已新增為 @{name}",
|
|
2135
2161
|
cardOpen: "開啟對話",
|
|
2136
|
-
cardFailed: "打不開這張名片:{message}"
|
|
2162
|
+
cardFailed: "打不開這張名片:{message}",
|
|
2163
|
+
optimize: "優化",
|
|
2164
|
+
optimizeAll: "全部優化",
|
|
2165
|
+
optimizing: "Ta 正在看怎麼按你的用法優化,建議會出現在這個對話裡",
|
|
2166
|
+
noInitiative: "開啟「主動」後才能優化智慧體",
|
|
2167
|
+
removedAgents: "已移除的智慧體({n})",
|
|
2168
|
+
removedTitle: "已移除的智慧體",
|
|
2169
|
+
removedHint: "保留 30 天,恢復後回到原來的群聊",
|
|
2170
|
+
removedAt: "{days} 天前移除",
|
|
2171
|
+
removedToday: "今天移除",
|
|
2172
|
+
removedIn: "原在 {channels}",
|
|
2173
|
+
restore: "恢復",
|
|
2174
|
+
restored: "{name} 已恢復",
|
|
2175
|
+
noRemoved: "最近 30 天沒有移除的智慧體"
|
|
2137
2176
|
};
|
|
2138
2177
|
|
|
2139
2178
|
// web-src/i18n.ts
|
|
@@ -2300,7 +2339,7 @@ var EN = {
|
|
|
2300
2339
|
noChannelToJoin: "It is in every group chat already",
|
|
2301
2340
|
joined: "{name} joined #{channel}.",
|
|
2302
2341
|
deleteAgent: "Delete",
|
|
2303
|
-
confirmDeleteAgent: "Delete {name}? It leaves its group chats, and group chats with no one else go too
|
|
2342
|
+
confirmDeleteAgent: "Delete {name}? It leaves its group chats, and group chats with no one else go too. It waits 30 days among the removed agents to restore.",
|
|
2304
2343
|
pin: "Pin",
|
|
2305
2344
|
unpin: "Unpin",
|
|
2306
2345
|
pinned: "Pinned",
|
|
@@ -2388,7 +2427,20 @@ var EN = {
|
|
|
2388
2427
|
cardAddHint: "It looks at the project there first and fits its role to it; you see what it changed in its conversation.",
|
|
2389
2428
|
cardAdded: "Added as @{name}",
|
|
2390
2429
|
cardOpen: "Open the conversation",
|
|
2391
|
-
cardFailed: "Could not open the card: {message}"
|
|
2430
|
+
cardFailed: "Could not open the card: {message}",
|
|
2431
|
+
optimize: "Optimize",
|
|
2432
|
+
optimizeAll: "Optimize all agents",
|
|
2433
|
+
optimizing: "Ta is looking at how to fit them to your work; what it suggests waits in this conversation",
|
|
2434
|
+
noInitiative: "Turn on Initiative to optimize agents",
|
|
2435
|
+
removedAgents: "Removed agents ({n})",
|
|
2436
|
+
removedTitle: "Removed agents",
|
|
2437
|
+
removedHint: "Kept 30 days; restored, an agent goes back to its group chats",
|
|
2438
|
+
removedAt: "Removed {days} days ago",
|
|
2439
|
+
removedToday: "Removed today",
|
|
2440
|
+
removedIn: "was in {channels}",
|
|
2441
|
+
restore: "Restore",
|
|
2442
|
+
restored: "{name} is back",
|
|
2443
|
+
noRemoved: "No agent removed in the last 30 days"
|
|
2392
2444
|
};
|
|
2393
2445
|
var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
|
|
2394
2446
|
var ChannelWords;
|
|
@@ -2408,6 +2460,7 @@ var DOUBLE_PAGE = "assistant/assistant";
|
|
|
2408
2460
|
var CHANNEL_PAGE = `${NAME}/channel`;
|
|
2409
2461
|
var MEMBERS_VIEW = `${NAME}/members`;
|
|
2410
2462
|
var AGENT_INFO_VIEW = `${NAME}/agent-info`;
|
|
2463
|
+
var REMOVED_VIEW = `${NAME}/removed-agents`;
|
|
2411
2464
|
var ROOM_INFO_VIEW = "@celljs/ta-rooms/members";
|
|
2412
2465
|
var CHANNEL_KEY = "ta-channels.channel";
|
|
2413
2466
|
|
|
@@ -3462,6 +3515,7 @@ function MoreMenu({ pi, label, items }) {
|
|
|
3462
3515
|
}
|
|
3463
3516
|
|
|
3464
3517
|
// web-src/agent-menu.tsx
|
|
3518
|
+
var INITIATIVE = "@celljs/ta-initiative";
|
|
3465
3519
|
async function copy(text) {
|
|
3466
3520
|
try {
|
|
3467
3521
|
await navigator.clipboard.writeText(text);
|
|
@@ -3559,6 +3613,18 @@ var AgentActions;
|
|
|
3559
3613
|
await context.pi.ui.showView(AGENT_INFO_VIEW);
|
|
3560
3614
|
}
|
|
3561
3615
|
AgentActions.profile = profile;
|
|
3616
|
+
async function optimize(context, ids) {
|
|
3617
|
+
const { pi } = context;
|
|
3618
|
+
const w = ChannelViews.words(pi);
|
|
3619
|
+
const file = await pi.packages.callPackageHost(INITIATIVE, "optimizeAgents", [ids]).catch(() => {
|
|
3620
|
+
throw new Error(w.noInitiative);
|
|
3621
|
+
});
|
|
3622
|
+
pi.ui.notify(w.optimizing, "info");
|
|
3623
|
+
if (typeof file === "string" && file) {
|
|
3624
|
+
await pi.openChat?.(file);
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
AgentActions.optimize = optimize;
|
|
3562
3628
|
function menu(context, agent, working) {
|
|
3563
3629
|
const w = ChannelViews.words(context.pi);
|
|
3564
3630
|
const edits = ChannelsUtil.may(context.service.state.team).agent(agent.id);
|
|
@@ -3569,6 +3635,7 @@ var AgentActions;
|
|
|
3569
3635
|
...edits ? [{ key: "restart", label: w.restart, icon: icon("RotateCcw"), run: run(context, () => restart(context, agent)) }] : []
|
|
3570
3636
|
],
|
|
3571
3637
|
[
|
|
3638
|
+
...edits ? [{ key: "optimize", label: w.optimize, icon: icon("Sparkles"), run: run(context, () => optimize(context, [agent.id])) }] : [],
|
|
3572
3639
|
...edits ? [{ key: "card", label: w.shareCard, icon: icon("Contact"), run: () => shareCard(context, agent) }] : [],
|
|
3573
3640
|
...edits ? [{ key: "join", label: w.joinChannel, icon: icon("UserPlus"), run: () => joinChannel(context, agent) }] : [],
|
|
3574
3641
|
{ key: "export", label: w.exportChat, icon: icon("Download"), run: run(context, () => exportChat(context, agent)) }
|
|
@@ -3930,7 +3997,7 @@ function AgentInfoView({ context }) {
|
|
|
3930
3997
|
location: cwd
|
|
3931
3998
|
}), cwd && SidebarUtil.folder(cwd)), () => setDialog("move")), /* @__PURE__ */ React.createElement("div", {
|
|
3932
3999
|
className: "tac-members-sep"
|
|
3933
|
-
}), edits && action(w.shareCard, () => AgentActions.shareCard(context, agent)), edits && action(w.joinChannel, () => AgentActions.joinChannel(context, agent)), action(w.exportChat, act(() => AgentActions.exportChat(context, agent))), cwd && action(w.copyCwd, act(() => AgentActions.copyCwd(context, cwd)))), edits && /* @__PURE__ */ React.createElement("div", {
|
|
4000
|
+
}), edits && action(w.optimize, act(() => AgentActions.optimize(context, [agent.id]))), edits && action(w.shareCard, () => AgentActions.shareCard(context, agent)), edits && action(w.joinChannel, () => AgentActions.joinChannel(context, agent)), action(w.exportChat, act(() => AgentActions.exportChat(context, agent))), cwd && action(w.copyCwd, act(() => AgentActions.copyCwd(context, cwd)))), edits && /* @__PURE__ */ React.createElement("div", {
|
|
3934
4001
|
className: "tac-members-foot"
|
|
3935
4002
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
3936
4003
|
type: "button",
|
|
@@ -6565,7 +6632,27 @@ class ChannelPartners {
|
|
|
6565
6632
|
if (!ChannelsUtil.may(service.state.team).create) {
|
|
6566
6633
|
return [];
|
|
6567
6634
|
}
|
|
6568
|
-
|
|
6635
|
+
const w = ChannelViews.words(pi);
|
|
6636
|
+
const { agents, removed } = service.state.team;
|
|
6637
|
+
return [
|
|
6638
|
+
{ key: "agent", label: w.newAgent, icon: ChannelViews.icon(pi, "Bot"), run: () => newAgent(this.context) },
|
|
6639
|
+
...agents.length ? [
|
|
6640
|
+
{
|
|
6641
|
+
key: "optimize",
|
|
6642
|
+
label: w.optimizeAll,
|
|
6643
|
+
icon: ChannelViews.icon(pi, "Sparkles"),
|
|
6644
|
+
run: AgentActions.run(this.context, () => AgentActions.optimize(this.context))
|
|
6645
|
+
}
|
|
6646
|
+
] : [],
|
|
6647
|
+
...removed?.length ? [
|
|
6648
|
+
{
|
|
6649
|
+
key: "removed",
|
|
6650
|
+
label: ChannelWords.format(w.removedAgents, { n: String(removed.length) }),
|
|
6651
|
+
icon: ChannelViews.icon(pi, "Archive"),
|
|
6652
|
+
run: () => void pi.ui.showView(REMOVED_VIEW)
|
|
6653
|
+
}
|
|
6654
|
+
] : []
|
|
6655
|
+
];
|
|
6569
6656
|
}
|
|
6570
6657
|
async group(members) {
|
|
6571
6658
|
if (!members.every((member) => member.extension === NAME && member.kind === "agent")) {
|
|
@@ -6749,6 +6836,63 @@ class ChannelPartners {
|
|
|
6749
6836
|
}
|
|
6750
6837
|
}
|
|
6751
6838
|
|
|
6839
|
+
// web-src/removed-view.tsx
|
|
6840
|
+
var DAY_MS = 24 * 60 * 60000;
|
|
6841
|
+
function RemovedAgentsView({ context }) {
|
|
6842
|
+
const { pi, service } = context;
|
|
6843
|
+
const { team, loaded } = useChannels(service);
|
|
6844
|
+
const w = ChannelViews.words(pi);
|
|
6845
|
+
const [busy, setBusy] = React.useState();
|
|
6846
|
+
const removed = [...team.removed ?? []].reverse();
|
|
6847
|
+
const restore = (one) => {
|
|
6848
|
+
setBusy(one.agent.id);
|
|
6849
|
+
service.restoreAgent(one.agent.id).then((agent) => pi.ui.notify(ChannelWords.format(w.restored, { name: agent.name }), "info")).catch((error) => pi.ui.notify(ChannelViews.message(error), "error")).finally(() => setBusy(undefined));
|
|
6850
|
+
};
|
|
6851
|
+
if (!removed.length) {
|
|
6852
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
6853
|
+
className: "tac-view tac-members"
|
|
6854
|
+
}, loaded && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
6855
|
+
title: w.noRemoved
|
|
6856
|
+
}));
|
|
6857
|
+
}
|
|
6858
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
6859
|
+
className: "tac-view tac-members"
|
|
6860
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
6861
|
+
className: "tac-members-scroll"
|
|
6862
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
6863
|
+
className: "tac-members-note"
|
|
6864
|
+
}, w.removedHint), removed.map((one) => {
|
|
6865
|
+
const days = Math.floor((Date.now() - one.at) / DAY_MS);
|
|
6866
|
+
const channels = [...one.channels.flatMap((id) => team.channels.filter((channel) => channel.id === id)), ...one.gone].map((channel) => `#${channel.name}`);
|
|
6867
|
+
const detail = [
|
|
6868
|
+
days < 1 ? w.removedToday : ChannelWords.format(w.removedAt, { days: String(days) }),
|
|
6869
|
+
...channels.length ? [ChannelWords.format(w.removedIn, { channels: channels.join("、") })] : []
|
|
6870
|
+
].join(" · ");
|
|
6871
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
6872
|
+
key: one.agent.id,
|
|
6873
|
+
className: "tac-member tac-removed"
|
|
6874
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
6875
|
+
className: "tac-member-main"
|
|
6876
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
6877
|
+
face: one.agent.face ?? 0,
|
|
6878
|
+
size: 32
|
|
6879
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
6880
|
+
className: "tac-member-text"
|
|
6881
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
6882
|
+
className: "tac-member-name"
|
|
6883
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
6884
|
+
className: "tac-member-label"
|
|
6885
|
+
}, one.agent.name)), /* @__PURE__ */ React.createElement("span", {
|
|
6886
|
+
className: "tac-member-detail"
|
|
6887
|
+
}, detail))), /* @__PURE__ */ React.createElement("button", {
|
|
6888
|
+
type: "button",
|
|
6889
|
+
className: "tac-link tac-restore",
|
|
6890
|
+
disabled: !!busy,
|
|
6891
|
+
onClick: () => restore(one)
|
|
6892
|
+
}, w.restore));
|
|
6893
|
+
})));
|
|
6894
|
+
}
|
|
6895
|
+
|
|
6752
6896
|
// web-src/sidebar-hooks.ts
|
|
6753
6897
|
var FOLDED_KEY = "ta-channels.folded";
|
|
6754
6898
|
var BY_DIRECTORY_KEY = "ui.membersByDirectory";
|
|
@@ -7872,6 +8016,12 @@ textarea.tac-input { resize: vertical; min-height: 56px; line-height: 1.5; }
|
|
|
7872
8016
|
.tac-member-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); line-height: calc(17px * var(--ta-font-scale)); }
|
|
7873
8017
|
.tac-member-detail.tac-live { color: var(--ta-green); }
|
|
7874
8018
|
.tac-member.tac-muted .tac-member-main > :first-child { opacity: 0.5; }
|
|
8019
|
+
.tac-removed:hover, .tac-removed:focus-within { background: none; }
|
|
8020
|
+
.tac-removed .tac-member-main { cursor: default; }
|
|
8021
|
+
.tac-removed .tac-member-main > :first-child { opacity: 0.55; }
|
|
8022
|
+
.tac-restore { flex: none; margin-right: 8px; padding: 4px 10px; border-radius: 8px; background: var(--ta-hover); color: var(--ta-text); font-weight: 500; }
|
|
8023
|
+
.tac-restore:hover { background: var(--ta-hover-strong); }
|
|
8024
|
+
.tac-restore:disabled { opacity: 0.5; cursor: default; }
|
|
7875
8025
|
.tac-member-actions { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 8px; opacity: 0; transition: opacity 120ms; }
|
|
7876
8026
|
.tac-member:hover .tac-member-actions, .tac-member:focus-within .tac-member-actions, .tac-member.tac-muted .tac-member-actions { opacity: 1; }
|
|
7877
8027
|
.tac-member.tac-muted:not(:hover):not(:focus-within) .tac-member-actions > :not(.tac-on) { visibility: hidden; }
|
|
@@ -8249,6 +8399,16 @@ function activate(pi) {
|
|
|
8249
8399
|
navigation: false,
|
|
8250
8400
|
order: 61
|
|
8251
8401
|
});
|
|
8402
|
+
pi.registerView("removed-agents", {
|
|
8403
|
+
title: () => ChannelWords.of(pi.ui.language).removedTitle,
|
|
8404
|
+
icon: ChannelViews.icon(pi, "Archive"),
|
|
8405
|
+
render: () => /* @__PURE__ */ React.createElement(RemovedAgentsView, {
|
|
8406
|
+
context
|
|
8407
|
+
}),
|
|
8408
|
+
location: "panel",
|
|
8409
|
+
navigation: false,
|
|
8410
|
+
order: 62
|
|
8411
|
+
});
|
|
8252
8412
|
pi.registerView("members", {
|
|
8253
8413
|
title: () => ChannelWords.of(pi.ui.language).showMembers,
|
|
8254
8414
|
icon: ChannelViews.icon(pi, "Users"),
|