@celljs/ta-channels 4.16.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/README.en.md +2 -2
- package/README.md +2 -2
- package/extension/index.mjs +898 -204
- package/host/index.mjs +2199 -1011
- package/package.json +4 -4
- package/web/index.js +2268 -1526
package/README.en.md
CHANGED
|
@@ -8,14 +8,14 @@ A built-in Ta package (enabled by default but can be toggled in the Web client's
|
|
|
8
8
|
|
|
9
9
|
## Concepts
|
|
10
10
|
|
|
11
|
-
- **Agent**: a normal Ta session plus a name and responsibility (as `appendSystemPrompt`); the session name is the agent's name, and the session belongs to the `@celljs/ta-channels` group (folded into one row in the conversation list). Each agent has its own cartoon avatar (`
|
|
11
|
+
- **Agent**: a normal Ta session plus a name and responsibility (as `appendSystemPrompt`); the session name is the agent's name, and the session belongs to the `@celljs/ta-channels` group (folded into one row in the conversation list). Each agent has its own cartoon avatar (those of `ui.Face`, drawn by `FaceUtil` of ta-relay, with 25 shapes and color schemes stored in `face`; on creation, it tries to avoid duplicates with existing avatars; old data without `face` is assigned by id), blinks, and looks left and right while answering; Ta itself remains the Cell logo. The session file is recorded when first opened and reopened from the file next time. A session with an agent has no team tools.
|
|
12
12
|
- **Channel**: members (agents, with the first being the lead) and messages. Messages are sent to members `@`-mentioned; agents' answers are posted back to the channel, and if they `@` someone in their answer, it is passed on to them. Each agent processes one message at a time. Users can mute members in a channel (`muted`): they do not answer anything in this channel, even if `@`-mentioned; when the lead is muted, messages with no one `@`-mentioned go to the next unmuted member.
|
|
13
13
|
- **Loop prevention** (`ChannelsUtil.limit`): relaying between agents is at most 3 hops; one message yields at most 8 answers, with at most 2 per agent. When cut off, after this round a light-colored note is appended to the channel ("reached relay limit, waiting for you to continue"), only once per round; the return from `post_to_channel` includes this note too.
|
|
14
14
|
- **Tools**: each session in Ta (web pages and other clients connected to ta serve) has `create_agent`, `create_channel`, `add_to_channel`, `post_to_channel`, and `list_channels`. When a user specifies a goal ("assemble a team to do the landing page"), Ta creates agents and channels, posts the goal, and waits for answers from each member before replying to the user. When a role is missing from a channel, Ta uses `add_to_channel` to add an existing agent (added after existing members; lead unchanged). The open page marks this channel with a green dot in the sidebar, which disappears when opened. Pausing Ta just stops waiting; agents continue to answer in the channel.
|
|
15
15
|
- **Hand over to…** (WeChat's forward, of work rather than of words): say "give this to @life" in a conversation, or pick Hand over to… in the + of the message box and an agent or a channel; Ta first writes a brief in that conversation (the goal, what is done and decided, what is left or blocks, the files and commands that matter), then hands it over with the tool `hand_off`. An agent gets the brief as a message of its own conversation (starting with "Handed over from 'that conversation'", the session file of the conversation in the `<context>` for the model, to read when the brief is not enough) and goes on; a channel gets it as a message of Ta's, which its lead answers. Neither is waited for: the user follows it there. The conversation it came from keeps a card "Handed over to @life" (the model does not read it) with the brief, Open going to the agent's conversation or the channel. An external agent without Ta's tools writes the brief in a `ta-handoff` block in the turn the + asked for, and the pi extension hands it over. On the server it is `TeamService.handOff` (`web-src/handoff.ts`).
|
|
16
16
|
- **Channel notices and agents' cards** (see `docs/design/ta-social.md`): a channel's notice (decisions, conventions, to-dos) is in the `<context>` of every member's message; the members keep it with the tool `update_channel_notice` as the talk settles things, the user reads and edits it in the bar above the chat, and each change is a line of the channel. Share card… in a member's menu makes the link and QR code of its card (`TeamService.shareAgent`, 30 days, also while the computer is off; its name, face and role, secrets taken out); a card's link opened in Ta adds the agent in the directory picked (`addFromCard`), which first looks at the project and fits its role with `update_my_role`.
|
|
17
17
|
- **Tasks of the double** (see `docs/design/ta-double.md`): a channel Ta builds with its tools has `by: 'ta'` and the session that built it (`origin`), and is listed as a task of the double (`registerTasks`), not among the user's own channels; the agents it makes are `temporary`, shown with their team until the user keeps them in the members panel or the agent's menu, and one in no channel is listed among the members. This list of the navigation is called "Double": the double's card, the tasks in one list (what waits for you first, then what goes on, then what ended), the members (as contacts, by directory if the user wants), the channels, each section folding (kept in the browser). A team opened from its task shows in the workbench on the right, with "Open in the main area" in its bar. While the double asks first, the team tools ask with `ctx.ui.confirm` before they build a team and before work goes to a channel the user did not let them use. Below, the channels and agents once listed flat are now under "Channels" and "Members".
|
|
18
|
-
- **UI**: "Agents" at the top of the navigation bar (above "Conversations"; the first bottom tab on a phone) puts the double, channels, and agents together (the double is a built-in page from ta-web, and once enabled is listed at the top, no longer appears separately in the navigation bar); the search box and + are at the top of the sidebar. + → create agent opens a draft page in the main area: first assigns an unused name and avatar, clicking the name in the top bar can rename or pick from
|
|
18
|
+
- **UI**: "Agents" at the top of the navigation bar (above "Conversations"; the first bottom tab on a phone) puts the double, channels, and agents together (the double is a built-in page from ta-web, and once enabled is listed at the top, no longer appears separately in the navigation bar); the search box and + are at the top of the sidebar. + → create agent opens a draft page in the main area: first assigns an unused name and avatar, clicking the name in the top bar can rename or pick from 25 avatars, the sidebar has one more line "not started"; the agent is truly created when the first message is sent from the input box (responsibility is generic, what to do is written in this message), then switches to its session and sends the message. + → create channel is a dialog: name, search and check agents (1–12, first checked is lead), create; channel row has lead first, next member in overlapping avatars, lead is labeled beside the name, second line is the most recent message or who's answering; agents are grouped by working directory, second line is "idle" or which channel they're answering in, right side is time of most recent message. Click agent to open its session: it is in front at once, under the agent's name, showing that it opens (`pi.switchSession` takes the promise of the `openAgent` request), and shows as the current conversation once the server opens or finds the session. Hovering over agent row (long-press on touch) shows …, menu has: stop (abort its current answer), restart (open new session), rename, responsibility (edit the role in the system prompt, takes effect in next session), move to… (switch working directory, open new session in that directory), copy working directory, export conversation (Markdown, strip channel context blocks), add to channel, delete (leave all channels it's in, delete channels that only have it, keep the session file); when near the bottom the menu expands upward. Channel is a page in the main area (not in the right workbench), displayed as a group chat: others' messages on the left with avatar and name, user's on the right, consecutive messages are grouped, after a long pause insert a time line; top bar is channel name and member avatars, click avatar to open "Channel Members" (`members`, `location: 'panel'` view, follows the current channel) in the right workbench: lists members, lead has a marker, answering ones are marked green; each row opens that agent's session, hovering (long-press on touch) shows set as lead, mute, restart session (forget earlier conversation, open new session next time it answers, old session stays in conversation list), and remove from channel (at least one left); top has "Add Members" as a searchable agent list, check to add, bottom of list has "New Agent" to open the draft page for creating a new agent; bottom has delete channel (confirm once more, messages deleted too, ongoing answers no longer posted). Input box is the conversation input box (`pi.ui.Composer`), `@` lists members, + allows naming members or adding members (opens the member list for adding); messages use the conversation's Markdown rendering (`pi.ui.Markdown`), `@`-mentioned members are bold.
|
|
19
19
|
|
|
20
20
|
## Data and Forwarding
|
|
21
21
|
|
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ Ta 自带的 pi 包(默认开启,可在 Web 客户端的 设置 → 包 关
|
|
|
8
8
|
|
|
9
9
|
## 概念
|
|
10
10
|
|
|
11
|
-
- **智能体**:一个普通的 Ta 会话,加上名字和职责(作为 `appendSystemPrompt`),会话名就是智能体的名字,会话属于 `@celljs/ta-channels` 分组(对话列表里折成一行)。每个智能体有自己的卡通头像(`
|
|
11
|
+
- **智能体**:一个普通的 Ta 会话,加上名字和职责(作为 `appendSystemPrompt`),会话名就是智能体的名字,会话属于 `@celljs/ta-channels` 分组(对话列表里折成一行)。每个智能体有自己的卡通头像(`ui.Face` 那一套,ta-relay 的 `FaceUtil` 画,25 种形状和配色,记在 `face` 里;新建时尽量不和已有的重样,没有 `face` 的旧数据按 id 分配),会眨眼,回答时左右张望;Ta 自己仍是 Cell logo。会话文件一打开就记下,下次从文件重新打开。智能体的会话里没有团队工具。
|
|
12
12
|
- **频道**:成员(智能体,第一个是负责人)和消息。消息发给其中 `@` 到的成员;智能体的回答贴回频道,它在回答里 `@` 谁就再交给谁。每个智能体一次只处理一条消息。用户可以把成员设为免打扰(`muted`):它在这个频道里什么都不回答,被 `@` 也不回答;负责人免打扰时,没人被 `@` 的消息交给下一位没有免打扰的成员。
|
|
13
13
|
- **防循环**(`ChannelsUtil.limit`):智能体之间接力最多 3 跳,一条消息引出的回答最多 8 条、每个智能体最多 2 条;被截断时,等这一轮结束后在频道里追加一行淡色说明("已到交接上限,等你继续"),每轮只追加一次,`post_to_channel` 的返回里也带上这句。
|
|
14
14
|
- **工具**:ta serve 里 Ta 的每个会话(Web 页面里的对话,以及连到 ta serve 的其他客户端)都有 `create_agent`、`create_channel`、`add_to_channel`、`post_to_channel`、`list_channels`。用户说一个目标("组个团队做落地页")时,Ta 建好智能体和频道、把目标贴进去,等各成员回答完再回复用户;频道缺某个角色时,Ta 用 `add_to_channel` 把已有的智能体加进来(加在已有成员之后,负责人不变);开着的页面在侧栏给这个频道标一个绿点,打开后消失。中途停止 Ta 只是不再等待,智能体会在频道里接着回答。
|
|
15
15
|
- **交给…**(参照微信的转发,但转的是工作):对话里说"这个交给 @life",或在输入框的 + 里选"交给…"再挑一个智能体或频道,Ta 先在这个对话里写一份交接摘要(目标、已完成和已决定的、剩下的或卡住的、相关的文件和命令),再用工具 `hand_off` 交出去。交给智能体时,摘要作为一条消息进入它自己的对话(开头是"交接自'某某对话'",原对话的会话文件写在给模型读的 `<context>` 里,摘要不够时它可以去读),它接着干;交给频道时,摘要作为 Ta 的一条消息贴进频道,由负责人回答。两者都不等回答,用户在那边跟进。原对话里留一张"已交给 @life"卡片(模型读不到),显示摘要,点"打开"进入对方的对话或频道。没有 Ta 工具的外部 Agent 在 + 发起的这一轮把摘要写进 `ta-handoff` 代码块,由 pi 扩展交出去。服务端方法是 `TeamService.handOff`(`web-src/handoff.ts`)。
|
|
16
16
|
- **频道公告与智能体名片**(见 `docs/design/ta-social.md`):频道的公告(决定 / 约定 / 待办)放进每个成员每条消息的 `<context>`,成员用工具 `update_channel_notice` 随讨论更新,用户在聊天上方的公告栏查看和编辑,每次改动在频道里留一行提示。成员菜单"分享名片…"生成名片链接和二维码(`TeamService.shareAgent`,30 天,电脑关机也能打开;只带名字、头像和隐去密钥的职责);在 Ta 里打开名片链接,选目录后"加为我的智能体"(`addFromCard`),它先看这个项目,用 `update_my_role` 把职责改得贴合这里。
|
|
17
17
|
- **分身的任务**(见 `docs/design/ta-double.md`):Ta 用工具建的频道带 `by: 'ta'` 和建它的会话 `origin`,作为分身的任务(`registerTasks`)列出,不进用户自己的"频道"分组;它建的智能体带 `temporary`,只在团队里出现,在成员面板或智能体菜单里"留下"后才成为常驻成员,不在任何频道里的临时智能体也列在成员里。导航栏里这个列表叫"分身":分身卡片、"任务"(一个列表,待你处理的在前,然后进行中、已结束)、"成员"(像通讯录,可选按目录分组)、"频道",各组可折叠(折叠状态存在浏览器本地)。从任务打开的团队显示在右侧工作台,顶栏可"在主区打开"。分身开启"开始任务前先问我"时,建团队前、以及第一次往用户放行过以外的频道派活前,用 `ctx.ui.confirm` 询问。下文的列表描述里,原先平铺的频道和智能体现在分别在"频道"和"成员"分组。
|
|
18
|
-
- **界面**:导航栏最上面的"智能体"(在"对话"上面,手机上是第一个底部标签)把分身、频道和智能体放在一起(分身是 ta-web 内置的页面,开启后列在最上面,导航栏里不再单独出现):侧栏顶部是搜索框和 +。+ → 新建智能体在主区域打开一个草稿页:先给一个没人用的名字和头像,顶栏点名字可以改名、从
|
|
18
|
+
- **界面**:导航栏最上面的"智能体"(在"对话"上面,手机上是第一个底部标签)把分身、频道和智能体放在一起(分身是 ta-web 内置的页面,开启后列在最上面,导航栏里不再单独出现):侧栏顶部是搜索框和 +。+ → 新建智能体在主区域打开一个草稿页:先给一个没人用的名字和头像,顶栏点名字可以改名、从 25 个头像里挑,侧栏顶部多一行"还没开工";输入框发出第一条消息时才真正建好智能体(职责是通用的,具体做什么写在这条消息里),随即切到它的会话并发出这条消息。+ → 新建频道是一个弹窗:名称、搜索并勾选智能体(1–12 个,先勾的是负责人)、创建;频道行是负责人在前、下一位成员在后的叠放头像,名称旁标出负责人,第二行是最近一条消息或谁正在回答;智能体按工作目录分组,第二行是"空闲"或正在哪个频道回答,右侧是最近一次发言的时间。点智能体打开它的会话:立即切过去,以智能体的名字显示"正在打开"(`pi.switchSession` 接收 `openAgent` 请求的 Promise),服务端打开或找到会话后显示为当前对话。智能体行悬停(触屏上常显)出现 …,菜单里是:停止(中止它正在进行的回答)、重新开始(开新会话)、重命名、职责(编辑系统提示词里的角色,下一个会话生效)、移至…(换工作目录,在新目录开新会话)、复制工作目录、导出对话(Markdown,去掉频道的上下文块)、加入频道、删除(退出所在频道,只剩它的频道一并删除,会话文件保留);靠近底部时菜单向上展开。频道是主区域的一个页面(不进右侧工作台),以群聊显示:别人的消息在左边带头像和名字,用户的在右边,连续发言合成一组,停顿久了插一行时间;顶栏是频道名和成员头像,点头像在右侧工作台打开"频道成员"(`members`,`location: 'panel'` 的视图,跟着当前频道):列出成员,负责人带标记,正在回答的标绿;每行点开是智能体的会话,悬停(触屏上常显)出现设为负责人、免打扰、重开会话(忘掉之前的对话,下次回答时开新会话,旧会话仍在对话列表里)和移出频道(至少留一位);顶部"添加成员"换成可搜索的智能体列表,勾选后添加,列表底部的"新建智能体"打开新建智能体的草稿页;底部是删除频道(再确认一次,消息一并删除,正在进行的回答不再贴出)。输入框就是对话的输入框(`pi.ui.Composer`),`@` 列出成员,+ 里可以点名成员、添加成员(打开频道成员的添加列表),或"做成扩展"(在频道里请负责人用 ta-package 技能把这里商量和做成的事做成扩展);消息用对话的 Markdown 渲染(`pi.ui.Markdown`),点名的成员加粗。
|
|
19
19
|
|
|
20
20
|
## 数据与转发
|
|
21
21
|
|