@suifei/dsh-ai-team 0.4.134 → 0.4.135
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/CHANGELOG.md +11 -0
- package/README.md +30 -2
- package/client.js +104 -11
- package/index.js +11 -0
- package/lib/domain/avatar.js +47 -0
- package/lib/domain/catalog.js +8 -2
- package/lib/host/default-roster.js +1 -0
- package/lib/host/service.js +19 -3
- package/lib/ledger/fold.js +10 -0
- package/package.json +2 -1
- package/talents/algo-reimplementer/talent.yml +2 -1
- package/talents/analyst/talent.yml +2 -1
- package/talents/architect/talent.yml +2 -1
- package/talents/binary-analyst/talent.yml +2 -1
- package/talents/biz-analyst/talent.yml +2 -1
- package/talents/code-reviewer/talent.yml +2 -1
- package/talents/content-author/talent.yml +2 -1
- package/talents/content-strategist/talent.yml +2 -1
- package/talents/copywriter/talent.yml +2 -1
- package/talents/creative-director/talent.yml +2 -1
- package/talents/curriculum-designer/talent.yml +2 -1
- package/talents/data-analyst/talent.yml +2 -1
- package/talents/deobfuscator/talent.yml +2 -1
- package/talents/diagrammer/talent.yml +2 -1
- package/talents/dynamic-debugger/talent.yml +2 -1
- package/talents/editor/talent.yml +2 -1
- package/talents/editorial-lead/talent.yml +2 -1
- package/talents/education-lead/talent.yml +2 -1
- package/talents/engineer/talent.yml +2 -1
- package/talents/executor/talent.yml +2 -1
- package/talents/experiment-designer/talent.yml +2 -1
- package/talents/fact-checker/talent.yml +2 -1
- package/talents/game-artist/talent.yml +2 -1
- package/talents/game-designer/talent.yml +2 -1
- package/talents/game-director/talent.yml +2 -1
- package/talents/game-tester/talent.yml +2 -1
- package/talents/gameplay-programmer/talent.yml +2 -1
- package/talents/mobile-re/talent.yml +2 -1
- package/talents/paper-writer/talent.yml +2 -1
- package/talents/peer-reviewer/talent.yml +2 -1
- package/talents/pmo-lead/talent.yml +2 -1
- package/talents/principal-investigator/talent.yml +2 -1
- package/talents/qa-acceptor/talent.yml +2 -1
- package/talents/re-lead/talent.yml +2 -1
- package/talents/re-verifier/talent.yml +2 -1
- package/talents/research-lead/talent.yml +2 -1
- package/talents/researcher/talent.yml +2 -1
- package/talents/scriptwriter/talent.yml +2 -1
- package/talents/security-auditor/talent.yml +2 -1
- package/talents/seo-specialist/talent.yml +2 -1
- package/talents/storyboard-artist/talent.yml +2 -1
- package/talents/tech-writer/talent.yml +2 -1
- package/talents/ux-designer/talent.yml +2 -1
- package/talents/video-editor/talent.yml +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.135 - 2026-11-18
|
|
4
|
+
|
|
5
|
+
**头像:人才市场、团队、成员卡片都有头像(@suifei/hash-avatar,本机生成)**
|
|
6
|
+
|
|
7
|
+
- 头像由插件依赖 [`@suifei/hash-avatar`](https://www.npmjs.com/package/@suifei/hash-avatar)(契约 v1)在本机按名字画,经 `GET /ai-team/api/avatar.svg` 出 SVG,不连外网;与 [avatar.onrpc.com](https://avatar.onrpc.com/) 同参同图(实测逐字节一致)。参数是性别 / 年龄 / 人种。人才和按原名招来的成员是同一张脸;改名换脸,参数不变。显示不到 64px 时去掉外圈指纹。图片加载失败时退回首字母。
|
|
8
|
+
- **44 位内置人才都预置了头像参数**,默认亚洲人;负责人多为中年,执行、验收多为青年,性别按名字分配。`talent.yml` 新增可选字段 `avatar: { gender, age, race }`,取值 `male|female|neutral`、`baby|teen|youth|middle|old`、`asian|white|black|brown|auto`;写错的人才文件按 `catalog.load.fail` 跳过。内置人才版本各升一个小版本,盖过在线库 1.0.0 的旧副本。
|
|
9
|
+
- **出现头像的地方**:人才市场卡片、新建项目的团队成员卡片、组队的人才列表与已选成员、左栏成员、消息、人员池卡片、批量配置模型、成员资料标题。
|
|
10
|
+
- **自定义可选**:添加成员 · 自定义、新建人才、成员资料 · 资料页有头像挑选(性别 / 年龄 / 人种,左边实时预览)。招聘时带上人才的头像,复制成员带上原成员的,存为人才带上成员的。
|
|
11
|
+
- 账本:`project/member-added`、`member/profile-updated` 可带 `avatar`;`member.profile.update` 允许只改头像,写错的值返回 `E_INVALID_ARGUMENT`。没设过头像的老成员按来源人才的参数画。
|
|
12
|
+
- 测试:`test/avatar.test.js`(参数校验、内置人才全带头像、自建人才 / 存为人才、账本、服务层命令、本机渲染与 `avatar.svg` 路由);全量 435。实机截图核对(`.ptc/rounds/r54-steps.json`,`shots-r54/`),宿主页面里头像图片实际加载成功。
|
|
13
|
+
|
|
3
14
|
## 0.4.134 - 2026-11-18
|
|
4
15
|
|
|
5
16
|
**README:最近更新**
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<a href="https://www.npmjs.com/package/@suifei/dsh-ai-team"><img alt="npm" src="https://img.shields.io/npm/v/@suifei/dsh-ai-team?color=2f6feb&label=npm"></a>
|
|
13
13
|
<a href="https://github.com/suifei/dsh-ai-team/releases"><img alt="release" src="https://img.shields.io/github/v/release/suifei/dsh-ai-team?color=2f6feb"></a>
|
|
14
14
|
<a href="./LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-2f6feb"></a>
|
|
15
|
-
<img alt="tests" src="https://img.shields.io/badge/tests-
|
|
15
|
+
<img alt="tests" src="https://img.shields.io/badge/tests-435%20passing-2ea043">
|
|
16
16
|
<img alt="dsh" src="https://img.shields.io/badge/DeepSeek%20Harness-plugin-6f42c1">
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
- **人才市场**(0.4.124–0.4.129):9 个内置团队、44 位内置人才,各自带看家技能。可以招聘、复制为可编辑、自建人才并装技能,也能把项目成员「存为人才」;新建项目时选团队,或从人才里挑人组新团队。
|
|
31
31
|
- **主理人只调度交付**(0.4.128):主理人不看产出,只问负责人做全没有;内容由验收人把关。
|
|
32
32
|
- **在线人才库**(0.4.130–0.4.131):「同步在线库」从 [`@suifei/dsh-ai-team-catalog`](https://www.npmjs.com/package/@suifei/dsh-ai-team-catalog) 拉取最新的人才与团队。国内走 npmmirror 整包下载,约 1 秒同步完;逐个文件核对 sha256,失败不影响旧版本,可一键退回内置。
|
|
33
|
+
- **头像**(0.4.135):人才市场、团队、成员卡片都有头像,由 [`@suifei/hash-avatar`](https://www.npmjs.com/package/@suifei/hash-avatar) 在本机按名字生成(与 [avatar.onrpc.com](https://avatar.onrpc.com/) 同图,不连外网);内置人才预置了参数(默认亚洲人),自定义成员和人才可以选性别、年龄、人种。
|
|
33
34
|
- **弹窗与人员池**(0.4.132–0.4.133):
|
|
34
35
|
- 弹窗占主页面的 90%,功能按钮固定在右上角。
|
|
35
36
|
- 成员资料按「资料 / 模型 / 技能 / 协作」分页签。
|
|
@@ -48,9 +49,36 @@
|
|
|
48
49
|
|
|
49
50
|
完整记录见 [CHANGELOG](./CHANGELOG.md)。
|
|
50
51
|
|
|
52
|
+
### 顺带做了个头像库:hash-avatar
|
|
53
|
+
|
|
54
|
+
为了让人才市场里的每位人才都有一张自己的脸,我们另做了一个开源库 **[`@suifei/hash-avatar`](https://www.npmjs.com/package/@suifei/hash-avatar)**([GitHub](https://github.com/suifei/hash-avatar))。文渊阁的头像就是它在本机生成的。
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<img src="https://avatar.onrpc.com/v1/%E5%A2%A8%E6%B8%8A.svg?gender=male&age=middle&race=asian&size=96" width="72" alt="墨渊" />
|
|
58
|
+
<img src="https://avatar.onrpc.com/v1/%E9%9D%92%E5%B2%9A.svg?gender=female&age=youth&race=asian&size=96" width="72" alt="青岚" />
|
|
59
|
+
<img src="https://avatar.onrpc.com/v1/%E7%99%BD%E7%A0%9A.svg?gender=female&age=youth&race=asian&size=96" width="72" alt="白砚" />
|
|
60
|
+
<img src="https://avatar.onrpc.com/v1/%E7%8E%84%E7%AD%96.svg?gender=male&age=youth&race=asian&size=96" width="72" alt="玄策" />
|
|
61
|
+
<img src="https://avatar.onrpc.com/v1/%E7%9F%A5%E5%BE%AE.svg?gender=female&age=youth&race=asian&size=96" width="72" alt="知微" />
|
|
62
|
+
<img src="https://avatar.onrpc.com/v1/%E8%A7%82%E6%BE%9C.svg?gender=female&age=youth&race=asian&size=96" width="72" alt="观澜" />
|
|
63
|
+
</p>
|
|
64
|
+
|
|
65
|
+
- **由名字或 email 确定**:输入经 SHA-256 决定五官、发型和配色;同一个名字永远是同一张脸。外圈 128 个刻度画出哈希的前 128 位,两个不同输入撞上同一张图的概率低于 UUIDv4 撞车。
|
|
66
|
+
- **性别、年龄、人种只是渲染参数**,不进哈希,所以换参数后还是认得出同一个人:`gender=male|female|neutral`、`age=baby|teen|youth|middle|old`、`race=asian|white|black|brown|auto`。
|
|
67
|
+
- **零依赖、同步、浏览器和 Node 都能用**,一张约 0.1 ms、约 6 KB 的 SVG;Apache-2.0。
|
|
68
|
+
- **不写代码也能用**:`https://avatar.onrpc.com/<名字>.svg?gender=female&age=youth&race=asian` 直接当图片地址。
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npm i @suifei/hash-avatar
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const HashAvatar = require('@suifei/hash-avatar');
|
|
76
|
+
const svg = HashAvatar.svg('墨渊', { gender: 'male', age: 'middle', race: 'asian', size: 128 });
|
|
77
|
+
```
|
|
78
|
+
|
|
51
79
|
**人才市场**:成员来自可复用的「人才」,团队从人才里挑人组队。
|
|
52
80
|
|
|
53
|
-
- 人才 `talents/<人才>/talent.yml`:名字、岗位、`duty`(职责:`lead` 主理人 / `qa` 验收 / `executor`
|
|
81
|
+
- 人才 `talents/<人才>/talent.yml`:名字、岗位、`duty`(职责:`lead` 主理人 / `qa` 验收 / `executor` 执行,决定拿哪份岗位规程)、头像参数 `avatar: { gender, age, race }`、性格、分类与标签、推荐模型,以及自带技能(`talents/<人才>/skills/<技能>/SKILL.md`)。内置 10 位:默认团队的 6 位,外加架构、评审、技术文档、安全审计。
|
|
54
82
|
- 团队 `teams/<团队>/team.yml`:只引用人才(可覆盖名字、岗位、性格,追加技能),`skills/` 放这个团队的三份岗位规程(`ai-team-core` / `ai-team-qa` / `ai-team-executor`),`procedures` 可换成自己的规程。内置默认团队见 [`teams/default/`](teams/default/)。还预置了**逆向工程队** [`teams/reverse/`](teams/reverse/):静态分析、动态调试、OLLVM 去混淆、移动端逆向、算法复刻与行为对账(`teamPreset: reverse` 启用)。此外预置了文档(`docs`)、视频(`video`)、游戏(`game`)、自媒体写作(`content`)、深度研究(`research`)、科学研究(`science`)、中小学教育软件(`education`)等团队,共 44 位人才可在人才市场挑选、组合或自建。
|
|
55
83
|
- 「人员 → 添加成员」先打开人才市场:按分类、关键词挑一位,点「招聘」预填表单,改名、换模型后创建;也可以切到「自定义」从零填写。
|
|
56
84
|
- 自建:人才放 `~/.dsh/ai-team/catalog/user/talents/<人才>/`,团队放 `~/.dsh/ai-team/catalog/user/teams/<团队>/`,同名覆盖内置;插件设置 `teamPreset` 选新项目用哪个团队。
|
package/client.js
CHANGED
|
@@ -308,6 +308,8 @@ window.__ModuleLoader__.load({
|
|
|
308
308
|
talentLoadFailed: '人才市场读取失败:{error}',
|
|
309
309
|
talentSkills: '技能:{skills}',
|
|
310
310
|
talentUser: '自建',
|
|
311
|
+
avatarTitle: '头像', avatarGender: '性别', avatarAge: '年龄', avatarRace: '人种', avatarHint: '头像按名字在本机生成(hash-avatar);改名会换一张脸,参数不变。',
|
|
312
|
+
avatar_male: '男', avatar_female: '女', avatar_neutral: '中性', avatar_baby: '婴儿', avatar_teen: '少年', avatar_youth: '青年', avatar_middle: '中年', avatar_old: '老年', avatar_asian: '黄种人', avatar_white: '白人', avatar_black: '黑人', avatar_brown: '棕色人种', avatar_auto: '不指定',
|
|
311
313
|
profileTabBasic: '资料', profileTabModel: '模型', profileTabSkills: '技能', profileTabCollab: '协作', profileNotes: '备忘', profileNotesEmpty: '还没有备忘。', profileSkillsEmpty: '还没装技能;在下面填技能名加一个,或到人才市场招已带技能的人才。',
|
|
312
314
|
teamPickDetail: '人才简介', teamPickDetailEmpty: '在左边点一位人才,这里看简介;点「加入」放进右边的团队。', teamLeadMark: '负责人', projectTeamMembers: '团队成员 · {n} 位',
|
|
313
315
|
peopleModelBatch: '批量配置模型', peopleModelTitle: '配置模型', peopleModelHint: '选中的成员在其所在的全部项目里改用这个模型;之后仍可在成员资料里单独改。', peopleModelPick: '应用到 {n} 位', peopleModelAll: '全选', peopleModelNone: '全不选', peopleModelApply: '应用', peopleModelNeed: '先选模型', peopleModelDone: '已为 {people} 位成员配置 {model}(成功 {done} 处,失败 {failed} 处)。',
|
|
@@ -762,6 +764,8 @@ window.__ModuleLoader__.load({
|
|
|
762
764
|
talentLoadFailed: 'Could not load the talent market: {error}',
|
|
763
765
|
talentSkills: 'Skills: {skills}',
|
|
764
766
|
talentUser: 'Custom',
|
|
767
|
+
avatarTitle: 'Avatar', avatarGender: 'Gender', avatarAge: 'Age', avatarRace: 'Ethnicity', avatarHint: 'Drawn locally from the name (hash-avatar); renaming gives a new face with the same settings.',
|
|
768
|
+
avatar_male: 'Male', avatar_female: 'Female', avatar_neutral: 'Neutral', avatar_baby: 'Baby', avatar_teen: 'Teen', avatar_youth: 'Young', avatar_middle: 'Middle-aged', avatar_old: 'Senior', avatar_asian: 'Asian', avatar_white: 'White', avatar_black: 'Black', avatar_brown: 'Brown', avatar_auto: 'Any',
|
|
765
769
|
profileTabBasic: 'Profile', profileTabModel: 'Model', profileTabSkills: 'Skills', profileTabCollab: 'Collaboration', profileNotes: 'Notes', profileNotesEmpty: 'No notes yet.', profileSkillsEmpty: 'No skills yet; add one by name below, or hire a talent that comes with skills.',
|
|
766
770
|
teamPickDetail: 'Talent details', teamPickDetailEmpty: 'Pick a talent on the left to see its details; “Add” puts it into the team on the right.', teamLeadMark: 'Lead', projectTeamMembers: 'Team members · {n}',
|
|
767
771
|
peopleModelBatch: 'Set model for many', peopleModelTitle: 'Set model', peopleModelHint: 'The selected members switch to this model in every project they are in; each can still be changed in its profile.', peopleModelPick: 'Apply to {n}', peopleModelAll: 'All', peopleModelNone: 'None', peopleModelApply: 'Apply', peopleModelNeed: 'Pick a model first', peopleModelDone: 'Set {model} for {people} members ({done} ok, {failed} failed).',
|
|
@@ -1197,6 +1201,14 @@ window.__ModuleLoader__.load({
|
|
|
1197
1201
|
.at-streamjump:hover { color: var(--dsw-alias-label-primary); }
|
|
1198
1202
|
.at-msg { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
|
|
1199
1203
|
.at-avatar { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--dsw-alias-border-l2); border-radius: 999px; background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-secondary); font-size: 10px; font-weight: 500; }
|
|
1204
|
+
.at-avatar.at-avatar-img { overflow: hidden; border-color: transparent; background: transparent; padding: 0; }
|
|
1205
|
+
.at-avatar.at-avatar-img img { display: block; width: 100%; height: 100%; border-radius: 999px; }
|
|
1206
|
+
.at-talenttop { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
1207
|
+
.at-talenttop > .at-talenthead { flex: 1 1 auto; min-width: 0; }
|
|
1208
|
+
.at-avatarpick { display: flex; align-items: center; gap: 16px; padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--dsw-alias-bg-layer-1); }
|
|
1209
|
+
.at-avatarpickrows { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
1210
|
+
.at-avatarpickrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
|
1211
|
+
.at-avatarpickrow > .at-panetitle { width: 36px; flex: none; }
|
|
1200
1212
|
.at-avatar-human { border-color: transparent; background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-inverted); }
|
|
1201
1213
|
.at-msgb { min-width: 0; flex: 1; }
|
|
1202
1214
|
.at-msgh { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; color: var(--dsw-alias-label-tertiary); font-size: 12px; line-height: 18px; }
|
|
@@ -1456,7 +1468,7 @@ window.__ModuleLoader__.load({
|
|
|
1456
1468
|
.at-tcpick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
|
|
1457
1469
|
.at-tcpanel { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
|
|
1458
1470
|
.at-teamrows { display: flex; flex-direction: column; gap: 6px; }
|
|
1459
|
-
.at-teamrow { display: grid; grid-template-columns: minmax(0, 1fr) 76px auto auto; gap: 8px; align-items: center; }
|
|
1471
|
+
.at-teamrow { display: grid; grid-template-columns: 24px minmax(0, 1fr) 76px auto auto; gap: 8px; align-items: center; }
|
|
1460
1472
|
.at-teamrow > .at-modalmeta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1461
1473
|
.at-teamlead { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
|
|
1462
1474
|
.at-teampick { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
|
|
@@ -1641,8 +1653,35 @@ window.__ModuleLoader__.load({
|
|
|
1641
1653
|
h('span', null, label));
|
|
1642
1654
|
}
|
|
1643
1655
|
|
|
1644
|
-
|
|
1645
|
-
|
|
1656
|
+
/**
|
|
1657
|
+
* 头像:成员 / 人才按名字由插件本机画(/ai-team/api/avatar.svg,参数见 lib/domain/avatar.js),Human 用首字母。
|
|
1658
|
+
* 只给名字时按当前项目成员表(AVATAR_INDEX)找参数;图片加载失败时退回首字母。
|
|
1659
|
+
*/
|
|
1660
|
+
function Avatar({ name, human, avatar, seed, size = 24 }) {
|
|
1661
|
+
const [brokenUrl, setBrokenUrl] = React.useState('');
|
|
1662
|
+
const label = String(name ?? '?');
|
|
1663
|
+
const style = size === 24 ? undefined : { width: size + 'px', height: size + 'px', fontSize: Math.round(size * 0.45) + 'px' };
|
|
1664
|
+
const known = human ? null : AVATAR_INDEX.get(label);
|
|
1665
|
+
const url = human ? '' : avatarUrl(seed ?? known?.seed ?? avatarSeed(label), avatar ?? known?.avatar ?? AVATAR_FALLBACK, size);
|
|
1666
|
+
if (human || url === brokenUrl) return h('span', { className: cx('at-avatar', human && 'at-avatar-human'), style, 'aria-hidden': 'true' }, label.slice(0, 1));
|
|
1667
|
+
return h('span', { className: 'at-avatar at-avatar-img', style, 'aria-hidden': 'true' },
|
|
1668
|
+
h('img', { src: url, alt: '', loading: 'lazy', decoding: 'async', referrerPolicy: 'no-referrer', onError: () => setBrokenUrl(url) }));
|
|
1669
|
+
}
|
|
1670
|
+
/** 头像参数挑选(性别 / 年龄 / 人种),左边实时预览。人才新建、自定义成员、成员资料共用。 */
|
|
1671
|
+
function AvatarPicker({ t, value, seed, onChange }) {
|
|
1672
|
+
const current = { ...AVATAR_PICK_DEFAULT, ...(value || {}) };
|
|
1673
|
+
return h('div', { className: 'at-avatarpick' },
|
|
1674
|
+
h(Avatar, { name: seed, seed, avatar: current, size: 72 }),
|
|
1675
|
+
h('div', { className: 'at-avatarpickrows' },
|
|
1676
|
+
[['gender', 'avatarGender'], ['age', 'avatarAge'], ['race', 'avatarRace']].map(([key, label]) => h('div', { key, className: 'at-avatarpickrow' },
|
|
1677
|
+
h('span', { className: 'at-panetitle' }, t(label)),
|
|
1678
|
+
h('div', { className: 'at-mode at-addtabs', role: 'group', 'aria-label': t(label) }, AVATAR_CHOICES[key].map((option) => h('button', {
|
|
1679
|
+
key: option,
|
|
1680
|
+
type: 'button',
|
|
1681
|
+
'aria-pressed': current[key] === option ? 'true' : 'false',
|
|
1682
|
+
onClick: () => onChange({ ...current, [key]: option }),
|
|
1683
|
+
}, t('avatar_' + option)))))),
|
|
1684
|
+
h('div', { className: 'at-modalmeta' }, t('avatarHint'))));
|
|
1646
1685
|
}
|
|
1647
1686
|
|
|
1648
1687
|
function FollowToggle({ t, taskNo: no, following, onToggle, compact }) {
|
|
@@ -2029,6 +2068,7 @@ window.__ModuleLoader__.load({
|
|
|
2029
2068
|
const failure = agent.status === 'failed' ? (agent.lastFailure ?? null) : null;
|
|
2030
2069
|
return h('div', { className: 'at-agent', role: 'listitem' },
|
|
2031
2070
|
h('span', { className: 'at-dot at-dot-' + (agent.status ?? 'idle'), 'aria-hidden': 'true' }),
|
|
2071
|
+
h(Avatar, { name: agent.name, size: 30 }),
|
|
2032
2072
|
h('div', { className: 'at-agentmeta' },
|
|
2033
2073
|
h('button', { className: 'at-agentname', type: 'button', onClick: () => onAgent(agent), title: agent.name }, agent.name),
|
|
2034
2074
|
h('div', { className: 'at-agentrole', title: agent.role ?? '' },
|
|
@@ -2172,7 +2212,7 @@ window.__ModuleLoader__.load({
|
|
|
2172
2212
|
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => setPicked(new Set()) }, t('peopleModelNone'))),
|
|
2173
2213
|
h('div', { className: 'at-peoplecheck' }, people.map((person) => h('label', { key: person.name, className: 'at-checkcard' },
|
|
2174
2214
|
h('input', { type: 'checkbox', checked: picked.has(person.name), onChange: () => toggle(person.name) }),
|
|
2175
|
-
h(Avatar, { name: person.name, human: false }),
|
|
2215
|
+
h(Avatar, { name: person.name, human: false, size: 32 }),
|
|
2176
2216
|
h('span', null, h('b', null, person.name + (person.role ? ' · ' + person.role : '')),
|
|
2177
2217
|
h('small', null, (person.projects ?? []).map((row) => row.projectName).join('、')))))))));
|
|
2178
2218
|
}
|
|
@@ -2218,7 +2258,7 @@ window.__ModuleLoader__.load({
|
|
|
2218
2258
|
const localHere = localNames.has(person.name);
|
|
2219
2259
|
return h('div', { key: person.name, className: cx('at-pcard', person.failures > 0 && 'at-people-failed') },
|
|
2220
2260
|
h('div', { className: 'at-pcardhead' },
|
|
2221
|
-
h(Avatar, { name: person.name, human: false }),
|
|
2261
|
+
h(Avatar, { name: person.name, human: false, size: 40 }),
|
|
2222
2262
|
h('span', { className: 'at-peoplename' }, person.name),
|
|
2223
2263
|
person.role ? h('span', { className: 'at-people-role' }, person.role) : null),
|
|
2224
2264
|
h('div', { className: 'at-peoplebadges' }, badges.join(' · ')),
|
|
@@ -2836,12 +2876,14 @@ window.__ModuleLoader__.load({
|
|
|
2836
2876
|
: talent.source === 'user' ? withIco('user', t('talentUser'), 10)
|
|
2837
2877
|
: talent.source === 'official' ? withIco('cloud', t('talentOfficial'), 10) : null;
|
|
2838
2878
|
return [
|
|
2839
|
-
h('div', { key: 'head', className: 'at-
|
|
2879
|
+
h('div', { key: 'head', className: 'at-talenttop' },
|
|
2880
|
+
h(Avatar, { name: talent.name, seed: avatarSeed(talent.name), avatar: talent.avatar ?? AVATAR_FALLBACK, size: 40 }),
|
|
2881
|
+
h('div', { className: 'at-talenthead' },
|
|
2840
2882
|
h('span', { className: 'at-talentname' }, talent.name),
|
|
2841
2883
|
talent.role ? h('span', { className: 'at-talentrole' }, talent.role) : null,
|
|
2842
2884
|
talent.duty ? h('span', { className: 'at-talentduty' }, t(DUTY_LABEL[talent.duty])) : null,
|
|
2843
2885
|
lead ? h('span', { className: 'at-talentduty' }, withIco('check', t('teamLeadMark'), 10)) : null,
|
|
2844
|
-
badge ? h('span', { className: 'at-talentduty' }, badge) : null),
|
|
2886
|
+
badge ? h('span', { className: 'at-talentduty' }, badge) : null)),
|
|
2845
2887
|
talent.description ? h('div', { key: 'desc', className: 'at-talentdesc' }, talent.description) : null,
|
|
2846
2888
|
full && talent.personality ? h('div', { key: 'pers', className: 'at-modalmeta' }, talent.personality) : null,
|
|
2847
2889
|
talent.skills?.length ? h('div', { key: 'skills', className: 'at-modalmeta' }, tf(t, 'talentSkills', { skills: talent.skills.join('、') })) : null,
|
|
@@ -2956,6 +2998,8 @@ window.__ModuleLoader__.load({
|
|
|
2956
2998
|
h('label', { className: 'at-field' }, h('span', null, t('tcDuty')), h('select', { value: form.duty, onChange: set('duty') }, ['executor', 'qa', 'lead'].map((d) => h('option', { key: d, value: d }, t(DUTY_LABEL[d]))))),
|
|
2957
2999
|
h('label', { className: 'at-field' }, h('span', null, t('tcCategory')), h('input', { value: form.category, onChange: set('category') })),
|
|
2958
3000
|
h('label', { className: 'at-field' }, h('span', null, t('tcTags')), h('input', { value: form.tags, onChange: set('tags'), placeholder: t('tcTagsHint') }))),
|
|
3001
|
+
h('div', { className: 'at-field' }, h('span', null, t('avatarTitle')),
|
|
3002
|
+
h(AvatarPicker, { t, value: form.avatar, seed: avatarSeed(form.name), onChange: (avatar) => setForm((prev) => ({ ...prev, avatar })) })),
|
|
2959
3003
|
h('label', { className: 'at-field' }, h('span', null, t('tcPersonality')), h('textarea', { value: form.personality, onChange: set('personality'), placeholder: t('tcPersonalityHint') })),
|
|
2960
3004
|
h('div', { className: 'at-field' }, h('span', null, t('tcSkills')),
|
|
2961
3005
|
pending.length === 0 ? h('div', { className: 'at-modalmeta' }, t('tcEmpty')) : h('div', { className: 'at-tcskills' }, pending.map((sk) => h('span', { key: sk.name, className: 'at-tcskill' }, sk.name, h('button', { type: 'button', 'aria-label': t('tcRemove'), onClick: () => setPending((pp) => pp.filter((x) => x.name !== sk.name)) }, '×')))),
|
|
@@ -3019,7 +3063,7 @@ window.__ModuleLoader__.load({
|
|
|
3019
3063
|
'aria-selected': focused && focused.id === talent.id ? 'true' : 'false',
|
|
3020
3064
|
onClick: () => setFocus(talent.id),
|
|
3021
3065
|
onDoubleClick: () => add(talent),
|
|
3022
|
-
}, h('span', null, talent.name, ' ', h('span', { className: 'at-pickrole' }, talent.role)), talent.duty ? h('span', { className: 'at-pickrole' }, t(DUTY_LABEL[talent.duty])) : null)))),
|
|
3066
|
+
}, h('span', { className: 'at-talenttop' }, h(Avatar, { name: talent.name, seed: avatarSeed(talent.name), avatar: talent.avatar, size: 22 }), h('span', null, talent.name, ' ', h('span', { className: 'at-pickrole' }, talent.role))), talent.duty ? h('span', { className: 'at-pickrole' }, t(DUTY_LABEL[talent.duty])) : null)))),
|
|
3023
3067
|
h('div', { className: 'at-pane' },
|
|
3024
3068
|
h('div', { className: 'at-panetitle' }, t('teamPickDetail')),
|
|
3025
3069
|
focused ? h('div', { className: 'at-talent' },
|
|
@@ -3033,6 +3077,7 @@ window.__ModuleLoader__.load({
|
|
|
3033
3077
|
draft.members.length === 0 ? h('div', { className: 'at-modalmeta' }, t('teamEmptyPick')) : h('div', { className: 'at-teamrows' }, draft.members.map((m, i) => {
|
|
3034
3078
|
const talent = byId(m.talent) || { name: m.talent, role: '' };
|
|
3035
3079
|
return h('div', { key: i, className: 'at-teamrow' },
|
|
3080
|
+
h(Avatar, { name: m.name || talent.name, seed: avatarSeed(m.name || talent.name), avatar: talent.avatar, size: 24 }),
|
|
3036
3081
|
h('input', { value: m.name, placeholder: talent.name, 'aria-label': t('teamName'), onChange: (e) => rename(i, e.target.value), onFocus: () => setFocus(m.talent) }),
|
|
3037
3082
|
h('span', { className: 'at-modalmeta' }, talent.role),
|
|
3038
3083
|
h('label', { className: 'at-teamlead' }, h('input', { type: 'radio', name: 'team-lead', checked: draft.lead === i, onChange: () => setDraft({ ...draft, lead: i }) }), t('teamLead')),
|
|
@@ -3233,6 +3278,37 @@ window.__ModuleLoader__.load({
|
|
|
3233
3278
|
}
|
|
3234
3279
|
|
|
3235
3280
|
// <member-copy>
|
|
3281
|
+
// 头像:插件本机按名字画(@suifei/hash-avatar 契约 v1,与 avatar.onrpc.com 同图),人才与按原名招来的成员是同一张脸。
|
|
3282
|
+
const AVATAR_ROUTE = '/ai-team/api/avatar.svg';
|
|
3283
|
+
const AVATAR_CHOICES = { gender: ['male', 'female', 'neutral'], age: ['baby', 'teen', 'youth', 'middle', 'old'], race: ['asian', 'white', 'black', 'brown', 'auto'] };
|
|
3284
|
+
/** 没设过头像、也查不到来源人才的成员:亚洲人、青年、性别不指定。 */
|
|
3285
|
+
const AVATAR_FALLBACK = { gender: 'neutral', age: 'youth', race: 'asian' };
|
|
3286
|
+
/** 自建时的初始选项:亚洲人、青年、男。 */
|
|
3287
|
+
const AVATAR_PICK_DEFAULT = { gender: 'male', age: 'youth', race: 'asian' };
|
|
3288
|
+
/** 当前项目成员名 → { seed, avatar },给只拿到名字的地方(消息、人员池)用。 */
|
|
3289
|
+
const AVATAR_INDEX = new Map();
|
|
3290
|
+
/** 画像种子就是名字:人才和按原名招来的成员同一张脸;改名换脸,参数不变。 */
|
|
3291
|
+
function avatarSeed(name) {
|
|
3292
|
+
return String(name ?? '').trim() || '?';
|
|
3293
|
+
}
|
|
3294
|
+
function avatarUrl(seed, avatar, size) {
|
|
3295
|
+
const pick = (key) => (AVATAR_CHOICES[key].includes(avatar && avatar[key]) ? avatar[key] : AVATAR_FALLBACK[key]);
|
|
3296
|
+
const px = Math.max(16, Math.min(1024, Math.round((Number(size) || 24) * 2)));
|
|
3297
|
+
return AVATAR_ROUTE + '?name=' + encodeURIComponent(String(seed ?? '')) + '&gender=' + pick('gender') + '&age=' + pick('age') + '&race=' + pick('race') + '&size=' + px;
|
|
3298
|
+
}
|
|
3299
|
+
/** 成员的头像参数:自己设过的 > 来源人才的 > 默认(负责人按中年)。 */
|
|
3300
|
+
function memberAvatarOf(agent, talents) {
|
|
3301
|
+
if (agent && agent.avatar) return agent.avatar;
|
|
3302
|
+
const talent = (Array.isArray(talents) ? talents : []).find((x) => x && x.id === (agent && agent.talent));
|
|
3303
|
+
if (talent && talent.avatar) return talent.avatar;
|
|
3304
|
+
return { ...AVATAR_FALLBACK, age: agent && agent.duty === 'lead' ? 'middle' : AVATAR_FALLBACK.age };
|
|
3305
|
+
}
|
|
3306
|
+
function rememberAvatars(agents, talents) {
|
|
3307
|
+
AVATAR_INDEX.clear();
|
|
3308
|
+
for (const agent of Array.isArray(agents) ? agents : []) {
|
|
3309
|
+
if (agent && agent.kind !== 'human' && agent.name) AVATAR_INDEX.set(agent.name, { seed: avatarSeed(agent.name), avatar: memberAvatarOf(agent, talents) });
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3236
3312
|
/**
|
|
3237
3313
|
* 复制成员(#65:想要两个「玄策」一起写代码,只能手工重填一遍)。
|
|
3238
3314
|
* 沿用角色、人格、运行配方、模型、输出上限与技能;不带笔记、会话与任务(那是原成员自己的经历)。
|
|
@@ -3256,6 +3332,7 @@ window.__ModuleLoader__.load({
|
|
|
3256
3332
|
maxTokens: Number.isSafeInteger(maxTokens) && maxTokens > 0 ? maxTokens : null,
|
|
3257
3333
|
skills: (Array.isArray(source?.skills) ? source.skills : []).filter((skill) => typeof skill === 'string' && skill.trim() !== ''),
|
|
3258
3334
|
sourceName: String(source?.name ?? ''),
|
|
3335
|
+
avatar: source?.avatar ?? null,
|
|
3259
3336
|
};
|
|
3260
3337
|
}
|
|
3261
3338
|
/**
|
|
@@ -3281,6 +3358,7 @@ window.__ModuleLoader__.load({
|
|
|
3281
3358
|
sourceName: base,
|
|
3282
3359
|
talent: { id: String(talent?.id ?? ''), version: String(talent?.version ?? '') },
|
|
3283
3360
|
duty: ['lead', 'qa', 'executor'].includes(talent?.duty) ? talent.duty : null,
|
|
3361
|
+
avatar: talent?.avatar ?? null,
|
|
3284
3362
|
};
|
|
3285
3363
|
}
|
|
3286
3364
|
/** 人才市场筛选:分类精确匹配;关键词在名字、岗位、分类、标签、说明、技能里找(不分大小写)。 */
|
|
@@ -3294,7 +3372,7 @@ window.__ModuleLoader__.load({
|
|
|
3294
3372
|
});
|
|
3295
3373
|
}
|
|
3296
3374
|
function blankTalentForm() {
|
|
3297
|
-
return { name: '', role: '', duty: 'executor', category: '', tags: '', personality: '' };
|
|
3375
|
+
return { name: '', role: '', duty: 'executor', category: '', tags: '', personality: '', avatar: { ...AVATAR_PICK_DEFAULT } };
|
|
3298
3376
|
}
|
|
3299
3377
|
/** 新建人才表单 → POST /api/talents 的请求体:标签按逗号/顿号/空白拆开,职责只认三种。 */
|
|
3300
3378
|
function talentFormToBody(form) {
|
|
@@ -3306,6 +3384,7 @@ window.__ModuleLoader__.load({
|
|
|
3306
3384
|
category: String((form && form.category) || '').trim(),
|
|
3307
3385
|
tags,
|
|
3308
3386
|
personality: String((form && form.personality) || '').trim(),
|
|
3387
|
+
...(form && form.avatar ? { avatar: form.avatar } : {}),
|
|
3309
3388
|
};
|
|
3310
3389
|
}
|
|
3311
3390
|
/**
|
|
@@ -3315,7 +3394,7 @@ window.__ModuleLoader__.load({
|
|
|
3315
3394
|
const draft = (initial && initial.draft) || {};
|
|
3316
3395
|
const skills = Array.isArray(draft.skills) ? draft.skills : [];
|
|
3317
3396
|
return {
|
|
3318
|
-
form: { name: String(draft.name || ''), role: String(draft.role || ''), duty: ['lead', 'qa', 'executor'].includes(draft.duty) ? draft.duty : 'executor', category: String(draft.category || ''), tags: (Array.isArray(draft.tags) ? draft.tags : []).join(', '), personality: String(draft.personality || '') },
|
|
3397
|
+
form: { name: String(draft.name || ''), role: String(draft.role || ''), duty: ['lead', 'qa', 'executor'].includes(draft.duty) ? draft.duty : 'executor', category: String(draft.category || ''), tags: (Array.isArray(draft.tags) ? draft.tags : []).join(', '), personality: String(draft.personality || ''), avatar: draft.avatar ? { ...draft.avatar } : { ...AVATAR_PICK_DEFAULT } },
|
|
3319
3398
|
pending: skills.filter((x) => x && x.found).map((x) => ({ name: x.name, kind: 'member', fromProject: initial.projectId, fromMember: initial.memberId })),
|
|
3320
3399
|
missing: skills.filter((x) => x && !x.found).map((x) => x.name),
|
|
3321
3400
|
model: draft.model && (draft.model.provider || draft.model.model) ? draft.model : null,
|
|
@@ -3469,6 +3548,7 @@ window.__ModuleLoader__.load({
|
|
|
3469
3548
|
const [talentInit, setTalentInit] = React.useState(null);
|
|
3470
3549
|
const [mName, setMName] = React.useState('');
|
|
3471
3550
|
const [mRole, setMRole] = React.useState('');
|
|
3551
|
+
const [mAvatar, setMAvatar] = React.useState(null);
|
|
3472
3552
|
const [mPrompt, setMPrompt] = React.useState('');
|
|
3473
3553
|
const [mProvider, setMProvider] = React.useState('');
|
|
3474
3554
|
const [mEffort, setMEffort] = React.useState('');
|
|
@@ -3481,6 +3561,7 @@ window.__ModuleLoader__.load({
|
|
|
3481
3561
|
const [profileAgent, setProfileAgent] = React.useState(null);
|
|
3482
3562
|
const [pName, setPName] = React.useState('');
|
|
3483
3563
|
const [pRole, setPRole] = React.useState('');
|
|
3564
|
+
const [pAvatar, setPAvatar] = React.useState(null);
|
|
3484
3565
|
const [pPersonality, setPPersonality] = React.useState('');
|
|
3485
3566
|
const [pPreset, setPPreset] = React.useState('standard');
|
|
3486
3567
|
const [pProvider, setPProvider] = React.useState('');
|
|
@@ -3642,6 +3723,8 @@ window.__ModuleLoader__.load({
|
|
|
3642
3723
|
let alive = true;
|
|
3643
3724
|
const controller = typeof AbortController === 'function' ? new AbortController() : null;
|
|
3644
3725
|
// The package is @suifei/dsh-ai-team; the Host prefix is /ai-team.
|
|
3726
|
+
// 头像要按成员的来源人才取参数:进工作台(切项目)时顺带取人才列表(没设过头像的老成员靠它)。
|
|
3727
|
+
void loadTalents();
|
|
3645
3728
|
const query = projectId ? '?project=' + encodeURIComponent(projectId) : '';
|
|
3646
3729
|
async function load() {
|
|
3647
3730
|
const seq = ++loadSeqRef.current;
|
|
@@ -4306,6 +4389,7 @@ window.__ModuleLoader__.load({
|
|
|
4306
4389
|
setMModel(defaults.model ?? '');
|
|
4307
4390
|
setMEffort(defaults.reasoningEffort ?? '');
|
|
4308
4391
|
setMOwner((data?.agents ?? []).length === 0);
|
|
4392
|
+
setMAvatar({ ...AVATAR_PICK_DEFAULT });
|
|
4309
4393
|
setMCopy(null);
|
|
4310
4394
|
setMError('');
|
|
4311
4395
|
setMTab('market');
|
|
@@ -4413,6 +4497,7 @@ window.__ModuleLoader__.load({
|
|
|
4413
4497
|
setMProvider(draft.provider || defaults.provider || '');
|
|
4414
4498
|
setMModel(draft.model || defaults.model || '');
|
|
4415
4499
|
setMEffort(draft.reasoningEffort || defaults.reasoningEffort || '');
|
|
4500
|
+
setMAvatar(draft.avatar ? { ...draft.avatar } : { ...AVATAR_PICK_DEFAULT });
|
|
4416
4501
|
setMCopy(draft);
|
|
4417
4502
|
setMError('');
|
|
4418
4503
|
setMTab('custom');
|
|
@@ -4427,6 +4512,7 @@ window.__ModuleLoader__.load({
|
|
|
4427
4512
|
setMModel(draft.model);
|
|
4428
4513
|
setMEffort(draft.reasoningEffort);
|
|
4429
4514
|
setMOwner(false);
|
|
4515
|
+
setMAvatar({ ...memberAvatarOf(source, talents) });
|
|
4430
4516
|
setMCopy(draft);
|
|
4431
4517
|
setMError('');
|
|
4432
4518
|
setAddOpen(true);
|
|
@@ -4459,6 +4545,7 @@ window.__ModuleLoader__.load({
|
|
|
4459
4545
|
...(mCopy?.personality ? { personality: mCopy.personality } : {}),
|
|
4460
4546
|
...(mCopy?.talent?.id ? { talent: mCopy.talent.id, talentVersion: mCopy.talent.version } : {}),
|
|
4461
4547
|
...(mCopy?.duty ? { duty: mCopy.duty } : {}),
|
|
4548
|
+
...(mAvatar ? { avatar: mAvatar } : {}),
|
|
4462
4549
|
});
|
|
4463
4550
|
const memberId = added.member.id;
|
|
4464
4551
|
const patch = {
|
|
@@ -4552,6 +4639,7 @@ window.__ModuleLoader__.load({
|
|
|
4552
4639
|
setPTab('basic');
|
|
4553
4640
|
setPName(agent.name ?? '');
|
|
4554
4641
|
setPRole(agent.role ?? '');
|
|
4642
|
+
setPAvatar({ ...memberAvatarOf(agent, talents) });
|
|
4555
4643
|
setPPersonality(agent.personality ?? '');
|
|
4556
4644
|
setPPreset(agent.preset ?? agent.config?.preset ?? 'standard');
|
|
4557
4645
|
setPProvider(agent.config?.provider ?? '');
|
|
@@ -4575,6 +4663,7 @@ window.__ModuleLoader__.load({
|
|
|
4575
4663
|
name: pName.trim(),
|
|
4576
4664
|
role: pRole.trim(),
|
|
4577
4665
|
personality: pPersonality,
|
|
4666
|
+
...(pAvatar ? { avatar: pAvatar } : {}),
|
|
4578
4667
|
reason: 'workbench profile',
|
|
4579
4668
|
});
|
|
4580
4669
|
const config = profileAgent.config ?? {};
|
|
@@ -5059,6 +5148,8 @@ window.__ModuleLoader__.load({
|
|
|
5059
5148
|
const memberViewAgent = data.agents.find((agent) => agent.id === memberViewId) ?? null;
|
|
5060
5149
|
const memberViewTasks = memberViewAgent === null ? [] : tasks.filter((task) => task.ownerId === memberViewAgent.id || task.assigneeId === memberViewAgent.id);
|
|
5061
5150
|
const headerTitle = inPeople ? t('peopleTitle') : inInbox ? t('inboxTitle') : project ? '# ' + project.name : t('noProject');
|
|
5151
|
+
// 只拿到名字的地方(消息、人员池、批量配置)按这张表找成员的头像参数。
|
|
5152
|
+
rememberAvatars(data?.agents, talents);
|
|
5062
5153
|
const headerGoal = inPeople ? t('peopleGoal') : inInbox ? t('inboxGoal') : (project?.goal ?? '');
|
|
5063
5154
|
const unread = inboxUnread > 99 ? '99+' : inboxUnread;
|
|
5064
5155
|
|
|
@@ -5438,6 +5529,7 @@ window.__ModuleLoader__.load({
|
|
|
5438
5529
|
h('input', { value: mName, onChange: (event) => setMName(event.target.value), autoFocus: true })),
|
|
5439
5530
|
h('label', { className: 'at-field' }, h('span', null, t('memberRole')),
|
|
5440
5531
|
h('input', { value: mRole, onChange: (event) => setMRole(event.target.value) }))),
|
|
5532
|
+
h(AvatarPicker, { key: 'av', t, value: mAvatar, seed: avatarSeed(mName), onChange: setMAvatar }),
|
|
5441
5533
|
h('label', { key: 'prompt', className: 'at-field' }, h('span', null, t('memberPrompt')),
|
|
5442
5534
|
h('textarea', {
|
|
5443
5535
|
value: mPrompt,
|
|
@@ -5471,7 +5563,7 @@ window.__ModuleLoader__.load({
|
|
|
5471
5563
|
'aria-label': t('memberProfileTitle'),
|
|
5472
5564
|
onSubmit: (event) => { event.preventDefault(); saveProfile(); },
|
|
5473
5565
|
},
|
|
5474
|
-
h('h2', { className: 'at-modaltitle' },
|
|
5566
|
+
h('h2', { className: 'at-modaltitle' }, h(Avatar, { name: profileAgent.name, size: 28 }), tf(t, 'memberProfileTitleName', { name: profileAgent.name })),
|
|
5475
5567
|
// 右上角按钮按用途分组:去看(任务 / 对话)· 复用(复制 / 存为人才)· 会话维护(重试 / 重置 / 重新蒸馏,黄)· 离开(红)· 取消 / 保存。
|
|
5476
5568
|
h('div', { className: 'at-modalactions' },
|
|
5477
5569
|
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => { const target = profileAgent; setProfileAgent(null); openMemberView(target); } }, withIco('board', t('memberTasks'), 12)),
|
|
@@ -5508,6 +5600,7 @@ window.__ModuleLoader__.load({
|
|
|
5508
5600
|
onClick: () => setPTab(id),
|
|
5509
5601
|
}, withIco(icon, t(key), 12)))),
|
|
5510
5602
|
pTab === 'basic' ? [
|
|
5603
|
+
h(AvatarPicker, { key: 'av', t, value: pAvatar, seed: avatarSeed(pName.trim() || profileAgent.name), onChange: setPAvatar }),
|
|
5511
5604
|
h('div', { key: 'nr', className: 'at-fieldrow' },
|
|
5512
5605
|
h('label', { className: 'at-field' }, h('span', null, t('memberName')),
|
|
5513
5606
|
h('input', { value: pName, onChange: (event) => setPName(event.target.value), autoFocus: true })),
|
package/index.js
CHANGED
|
@@ -73,6 +73,7 @@ import { messageContent, normalizeAttachments } from './lib/domain/rich-message.
|
|
|
73
73
|
import { readAttachment, uploadAttachment } from './lib/host/attachment-routes.js';
|
|
74
74
|
import { createDiagLogger, defaultDiagDir, installDiagSink } from './lib/diaglog.js';
|
|
75
75
|
import { CATALOG_PACKAGE, clearOfficialCatalog, officialStatus, syncOfficialCatalog } from './lib/domain/catalog-sync.js';
|
|
76
|
+
import { renderAvatarSvg } from './lib/domain/avatar.js';
|
|
76
77
|
import { DEFAULT_TEAM, catalogRoots, deleteTalent, deleteTeam, forkTalent, installSkill, listInstallableSkills, listTalents, listTeams, loadCatalog, readSkillText, resolveTeam, talentFromMember, talentIdFrom, uniqueTalentId, uniqueTeamId, userCatalogDir, writeTalent, writeTeam } from './lib/domain/catalog.js';
|
|
77
78
|
|
|
78
79
|
export const name = 'ai-team';
|
|
@@ -2384,6 +2385,16 @@ export function apply(ctx, config = {}) {
|
|
|
2384
2385
|
return send(res, { talents: listTalents(talentCatalog(diag)) });
|
|
2385
2386
|
}
|
|
2386
2387
|
// 第 3 步:官方在线人才库。状态 / 同步(npmmirror → jsDelivr,逐文件 sha256 校验后整体替换)/ 清除(退回内置)。
|
|
2388
|
+
// 头像:@suifei/hash-avatar 本机出 SVG(与 avatar.onrpc.com 契约 v1 同图);同参同图,可长缓存。
|
|
2389
|
+
if (req.method === 'GET' && url.pathname === '/ai-team/api/avatar.svg') {
|
|
2390
|
+
const q = url.searchParams;
|
|
2391
|
+
const svg = renderAvatarSvg(q.get('name') ?? '', { gender: q.get('gender'), age: q.get('age'), race: q.get('race'), size: q.get('size') });
|
|
2392
|
+
res.statusCode = 200;
|
|
2393
|
+
res.setHeader('content-type', 'image/svg+xml; charset=utf-8');
|
|
2394
|
+
res.setHeader('cache-control', 'private, max-age=31536000, immutable');
|
|
2395
|
+
res.setHeader('x-content-type-options', 'nosniff');
|
|
2396
|
+
return res.end(svg);
|
|
2397
|
+
}
|
|
2387
2398
|
if (req.method === 'GET' && url.pathname === '/ai-team/api/catalog') {
|
|
2388
2399
|
return send(res, { package: CATALOG_PACKAGE, official: publicOfficial(officialStatus(dshHome())) });
|
|
2389
2400
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 头像参数(人才 talent.yml 的 `avatar`、成员资料的 `avatar`)与本机画图。
|
|
3
|
+
* 画图用 @suifei/hash-avatar(契约 v1,与 avatar.onrpc.com 同一张图),插件自己出 SVG,不连外网。
|
|
4
|
+
* 人才市场、团队、成员共用这一份校验与渲染。
|
|
5
|
+
*/
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
|
|
8
|
+
const HashAvatar = createRequire(import.meta.url)('@suifei/hash-avatar');
|
|
9
|
+
|
|
10
|
+
export const AVATAR_GENDERS = Object.freeze(['male', 'female', 'neutral']);
|
|
11
|
+
export const AVATAR_AGES = Object.freeze(['baby', 'teen', 'youth', 'middle', 'old']);
|
|
12
|
+
export const AVATAR_RACES = Object.freeze(['asian', 'white', 'black', 'brown', 'auto']);
|
|
13
|
+
|
|
14
|
+
/** 默认:亚洲人、青年、性别不指定。 */
|
|
15
|
+
export const DEFAULT_AVATAR = Object.freeze({ gender: 'neutral', age: 'youth', race: 'asian' });
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 校验头像参数。缺省(undefined / null)返回 null;字段可只给一部分,缺的按 DEFAULT_AVATAR 补。
|
|
19
|
+
* 写错的值抛错并说明哪一项,不静默改成别的。
|
|
20
|
+
* @param {unknown} value
|
|
21
|
+
* @param {string} [label]
|
|
22
|
+
* @returns {{ gender: string, age: string, race: string } | null}
|
|
23
|
+
*/
|
|
24
|
+
export function parseAvatar(value, label = 'avatar') {
|
|
25
|
+
if (value === undefined || value === null) return null;
|
|
26
|
+
if (typeof value !== 'object' || Array.isArray(value)) throw new Error(`${label} 必须是对象(gender / age / race)`);
|
|
27
|
+
const pick = (key, allowed) => {
|
|
28
|
+
const raw = value[key];
|
|
29
|
+
if (raw === undefined || raw === null || raw === '') return DEFAULT_AVATAR[key];
|
|
30
|
+
if (typeof raw !== 'string' || !allowed.includes(raw)) throw new Error(`${label}.${key} 只认 ${allowed.join(' / ')}`);
|
|
31
|
+
return raw;
|
|
32
|
+
};
|
|
33
|
+
return { gender: pick('gender', AVATAR_GENDERS), age: pick('age', AVATAR_AGES), race: pick('race', AVATAR_RACES) };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 画一张头像 SVG。参数宽松:写错或缺省的按 DEFAULT_AVATAR;尺寸夹到 16..1024;
|
|
38
|
+
* 小于 128px(客户端按 2 倍像素取图,即显示不到 64px)时去掉外圈指纹:太密看不清(见 hash-avatar README)。
|
|
39
|
+
* @param {string} name
|
|
40
|
+
* @param {{ gender?: string, age?: string, race?: string, size?: number|string }} [options]
|
|
41
|
+
*/
|
|
42
|
+
export function renderAvatarSvg(name, options = {}) {
|
|
43
|
+
const pick = (key, allowed) => (allowed.includes(options[key]) ? options[key] : DEFAULT_AVATAR[key]);
|
|
44
|
+
const size = Math.max(16, Math.min(1024, Math.round(Number(options.size) || 64)));
|
|
45
|
+
const input = String(name ?? '').trim().slice(0, 200) || '?';
|
|
46
|
+
return HashAvatar.svg(input, { gender: pick('gender', AVATAR_GENDERS), age: pick('age', AVATAR_AGES), race: pick('race', AVATAR_RACES), size, fingerprint: size >= 128 });
|
|
47
|
+
}
|
package/lib/domain/catalog.js
CHANGED
|
@@ -16,6 +16,7 @@ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, write
|
|
|
16
16
|
import { join } from 'node:path';
|
|
17
17
|
import { fileURLToPath } from 'node:url';
|
|
18
18
|
import { parse, stringify } from 'yaml';
|
|
19
|
+
import { parseAvatar } from './avatar.js';
|
|
19
20
|
import { compareVersions, officialRoot } from './catalog-sync.js';
|
|
20
21
|
|
|
21
22
|
/** 插件内置目录(包根,下有 talents/ 与 teams/)。 */
|
|
@@ -94,6 +95,7 @@ export function parseTalent(source, label = 'talent') {
|
|
|
94
95
|
personality: text(doc.personality, 2000),
|
|
95
96
|
skills: skillList(doc.skills, `${label}: skills`),
|
|
96
97
|
model,
|
|
98
|
+
avatar: parseAvatar(doc.avatar, `${label}: avatar`),
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
|
|
@@ -197,7 +199,7 @@ export function loadCatalog({ roots = catalogRoots(), diag } = {}) {
|
|
|
197
199
|
/** 人才市场列表(给「添加成员」弹窗):按分类、名字排序。 */
|
|
198
200
|
export function listTalents(catalog) {
|
|
199
201
|
return [...catalog.talents.values()]
|
|
200
|
-
.map(({ id, source, version, name, role, duty: d, category, tags, description, personality, skills, model, shadows }) => ({ id, source, version, name, role, duty: d, category, tags, description, personality, skills, model, forked: source === 'user' && shadows !== undefined }))
|
|
202
|
+
.map(({ id, source, version, name, role, duty: d, category, tags, description, personality, skills, model, avatar, shadows }) => ({ id, source, version, name, role, duty: d, category, tags, description, personality, skills, model, avatar: avatar ?? null, forked: source === 'user' && shadows !== undefined }))
|
|
201
203
|
.sort((a, b) => a.category.localeCompare(b.category, 'zh') || a.name.localeCompare(b.name, 'zh'));
|
|
202
204
|
}
|
|
203
205
|
|
|
@@ -224,6 +226,7 @@ export function resolveTeam(catalog, name = DEFAULT_TEAM, { diag } = {}) {
|
|
|
224
226
|
skills: [...new Set([...talent.skills, ...member.skills])],
|
|
225
227
|
talent: { id: talent.id, version: talent.version, source: talent.source },
|
|
226
228
|
model: talent.model,
|
|
229
|
+
avatar: talent.avatar ?? null,
|
|
227
230
|
};
|
|
228
231
|
});
|
|
229
232
|
return { id: wanted, source: entry.source, dir: entry.dir, team: { name: entry.name || wanted, description: entry.description, lead: entry.lead, procedures: entry.procedures, members } };
|
|
@@ -269,6 +272,8 @@ function talentDoc(input) {
|
|
|
269
272
|
if (skills.length) doc.skills = skills;
|
|
270
273
|
const m = input?.model;
|
|
271
274
|
if (m && (text(m.provider, 80) || text(m.model, 160))) doc.model = { provider: text(m.provider, 80), model: text(m.model, 160), reasoningEffort: text(m.reasoningEffort, 20) };
|
|
275
|
+
const avatar = parseAvatar(input?.avatar);
|
|
276
|
+
if (avatar) doc.avatar = avatar;
|
|
272
277
|
return doc;
|
|
273
278
|
}
|
|
274
279
|
|
|
@@ -355,7 +360,7 @@ export function listTeams(catalog) {
|
|
|
355
360
|
.map((entry) => {
|
|
356
361
|
const members = entry.members.map((m) => {
|
|
357
362
|
const t = catalog.talents.get(m.talent);
|
|
358
|
-
return { id: m.id, talent: m.talent, name: m.name || t?.name || m.talent, role: m.role || t?.role || '', duty: m.duty ?? t?.duty ?? null, description: t?.description ?? '', category: t?.category ?? '', skills: [...new Set([...(t?.skills ?? []), ...(m.skills ?? [])])], missing: t === undefined };
|
|
363
|
+
return { id: m.id, talent: m.talent, name: m.name || t?.name || m.talent, role: m.role || t?.role || '', duty: m.duty ?? t?.duty ?? null, description: t?.description ?? '', category: t?.category ?? '', skills: [...new Set([...(t?.skills ?? []), ...(m.skills ?? [])])], avatar: t?.avatar ?? null, missing: t === undefined };
|
|
359
364
|
});
|
|
360
365
|
return { id: entry.id, source: entry.source, name: entry.name || entry.id, description: entry.description, lead: entry.lead, members, broken: members.some((m) => m.missing) };
|
|
361
366
|
})
|
|
@@ -417,6 +422,7 @@ export function talentFromMember(member, duty) {
|
|
|
417
422
|
tags: [],
|
|
418
423
|
personality: text(member?.personality, 2000),
|
|
419
424
|
model: provider || model ? { provider, model, reasoningEffort: text(config.reasoningEffort, 20) } : null,
|
|
425
|
+
avatar: member?.avatar ?? null,
|
|
420
426
|
skills: (Array.isArray(member?.skills) ? member.skills : []).map((s) => text(String(s), 64)).filter((s) => SKILL_NAME.test(s)),
|
|
421
427
|
};
|
|
422
428
|
}
|
|
@@ -27,6 +27,7 @@ function teamFields(preset, member) {
|
|
|
27
27
|
talentVersion: member.talent.version,
|
|
28
28
|
...(member.duty ? { duty: member.duty } : {}),
|
|
29
29
|
...(member.skills?.length > 0 ? { skills: member.skills } : {}),
|
|
30
|
+
...(member.avatar ? { avatar: member.avatar } : {}),
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
|
package/lib/host/service.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { appendReply, createThread } from '../domain/thread.js';
|
|
23
23
|
import { boardView, quadrantsView, taskCard } from './views.js';
|
|
24
24
|
import { applyMemberConfigPatch, normalizeMemberConfig } from '../domain/member-config.js';
|
|
25
|
+
import { parseAvatar } from '../domain/avatar.js';
|
|
25
26
|
import { MEMBER_STATUS, isBoardIdle } from '../ledger/fold.js';
|
|
26
27
|
|
|
27
28
|
const MEMBER_STATUS_VALUES = new Set(Object.values(MEMBER_STATUS));
|
|
@@ -33,6 +34,15 @@ import { describeAttachments, findMentions, normalizeAttachments, plainMentionLi
|
|
|
33
34
|
* 主理人只调度交付、不核对产出(用户 2026-11-18):对别人的产出验收或退回都拒绝,并指路给验收人。
|
|
34
35
|
* 只在命令层拦,不进 fold:历史账本里主理人验收过的事件重放不受影响。
|
|
35
36
|
*/
|
|
37
|
+
/** 成员头像参数:写错的值按 INVALID_ARGUMENT 拒绝(lib/domain/avatar.js 同一份校验)。 */
|
|
38
|
+
function memberAvatar(value) {
|
|
39
|
+
try {
|
|
40
|
+
return parseAvatar(value);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
return fail(ERRORS.INVALID_ARGUMENT, error.message);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
36
46
|
function refuseLeadReview(state, reviewer) {
|
|
37
47
|
if (reviewer === null || reviewer === undefined || !isLeadMember(reviewer, state)) return;
|
|
38
48
|
fail(ERRORS.NOT_ELIGIBLE, 'the lead does not review deliverables: only ask the assignee whether it is complete, and leave acceptance to a QA member (or Human)', {
|
|
@@ -206,6 +216,7 @@ export class TeamService {
|
|
|
206
216
|
team: m.team ?? null,
|
|
207
217
|
talent: m.talent ?? null,
|
|
208
218
|
talentVersion: m.talentVersion ?? null,
|
|
219
|
+
avatar: m.avatar ?? null,
|
|
209
220
|
duty: m.duty ?? null,
|
|
210
221
|
profileVersion: m.profileVersion ?? 1,
|
|
211
222
|
distillVersion: m.distillVersion ?? 0,
|
|
@@ -763,6 +774,7 @@ export class TeamService {
|
|
|
763
774
|
const talent = ref(payload.talent);
|
|
764
775
|
const talentVersion = talent === null ? null : ref(payload.talentVersion);
|
|
765
776
|
const skills = Array.isArray(payload.skills) ? payload.skills.filter((name) => typeof name === 'string' && name.trim() !== '').map((name) => name.trim()) : [];
|
|
777
|
+
const avatar = memberAvatar(payload.avatar);
|
|
766
778
|
await this.append(command, 'project/member-added', {
|
|
767
779
|
memberId: member.id,
|
|
768
780
|
name: member.name,
|
|
@@ -775,6 +787,7 @@ export class TeamService {
|
|
|
775
787
|
...(talent !== null ? { talent, ...(talentVersion !== null ? { talentVersion } : {}) } : {}),
|
|
776
788
|
...(payload.duty ? { duty: payload.duty } : {}),
|
|
777
789
|
...(skills.length > 0 ? { skills } : {}),
|
|
790
|
+
...(avatar !== null ? { avatar } : {}),
|
|
778
791
|
});
|
|
779
792
|
return { member };
|
|
780
793
|
}
|
|
@@ -837,7 +850,7 @@ export class TeamService {
|
|
|
837
850
|
}
|
|
838
851
|
|
|
839
852
|
async updateMemberProfile(command, payload) {
|
|
840
|
-
if (command.actor.kind !== 'human') fail(ERRORS.UNAUTHORIZED, 'only Human may change name, role or
|
|
853
|
+
if (command.actor.kind !== 'human') fail(ERRORS.UNAUTHORIZED, 'only Human may change name, role, personality or avatar');
|
|
841
854
|
const member = this.state.members?.[payload.memberId];
|
|
842
855
|
if (member === undefined || member.kind !== 'agent') fail(ERRORS.NOT_FOUND, `agent ${String(payload.memberId)} not found`);
|
|
843
856
|
const text = (value) => (typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined);
|
|
@@ -845,14 +858,17 @@ export class TeamService {
|
|
|
845
858
|
const role = text(payload.role);
|
|
846
859
|
// An empty personality means "leave it unchanged", not "clear it".
|
|
847
860
|
const personality = text(payload.personality);
|
|
848
|
-
|
|
849
|
-
|
|
861
|
+
const avatar = memberAvatar(payload.avatar);
|
|
862
|
+
const avatarChanged = avatar !== null && JSON.stringify(avatar) !== JSON.stringify(member.avatar ?? null);
|
|
863
|
+
if (name === undefined && role === undefined && personality === undefined && !avatarChanged) {
|
|
864
|
+
fail(ERRORS.INVALID_ARGUMENT, 'name, role, personality or avatar is required');
|
|
850
865
|
}
|
|
851
866
|
await this.append(command, 'member/profile-updated', {
|
|
852
867
|
memberId: member.id,
|
|
853
868
|
...(name === undefined ? {} : { name }),
|
|
854
869
|
...(role === undefined ? {} : { role }),
|
|
855
870
|
...(personality === undefined ? {} : { personality }),
|
|
871
|
+
...(avatarChanged ? { avatar } : {}),
|
|
856
872
|
updatedBy: command.actor.memberId,
|
|
857
873
|
reason: payload.reason ?? '',
|
|
858
874
|
});
|
package/lib/ledger/fold.js
CHANGED
|
@@ -195,6 +195,13 @@ function makeProject(payload, event) {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
function avatarOr(value, fallback) {
|
|
199
|
+
if (!isPlainObject(value)) return fallback;
|
|
200
|
+
const pick = (key) => (typeof value[key] === 'string' && value[key] !== '' ? value[key] : null);
|
|
201
|
+
const avatar = { gender: pick('gender'), age: pick('age'), race: pick('race') };
|
|
202
|
+
return avatar.gender && avatar.age && avatar.race ? avatar : fallback;
|
|
203
|
+
}
|
|
204
|
+
|
|
198
205
|
function makeMember(payload, event, existing) {
|
|
199
206
|
const source = isPlainObject(payload.member) ? payload.member : payload;
|
|
200
207
|
const kind = source.kind === 'human' || source.kind === 'agent' ? source.kind : existing?.kind ?? 'agent';
|
|
@@ -211,6 +218,8 @@ function makeMember(payload, event, existing) {
|
|
|
211
218
|
// 招自人才市场的哪位人才、哪个版本(talents/<人才>/talent.yml)。
|
|
212
219
|
talent: stringOrNull(source.talent) ?? existing?.talent ?? null,
|
|
213
220
|
talentVersion: stringOrNull(source.talentVersion) ?? existing?.talentVersion ?? null,
|
|
221
|
+
// 头像参数 { gender, age, race }(lib/domain/avatar.js);没有就按来源人才的或默认的画。
|
|
222
|
+
avatar: avatarOr(source.avatar, existing?.avatar ?? null),
|
|
214
223
|
duty: ['lead', 'qa', 'executor'].includes(source.duty) ? source.duty : existing?.duty ?? null,
|
|
215
224
|
status,
|
|
216
225
|
preset: stringOrNull(source.preset),
|
|
@@ -1067,6 +1076,7 @@ function applyEventCore(state, event) {
|
|
|
1067
1076
|
name: textOr(source.name, existing.name),
|
|
1068
1077
|
role: textOr(source.role, existing.role),
|
|
1069
1078
|
personality: textOr(source.personality, existing.personality ?? ''),
|
|
1079
|
+
avatar: avatarOr(source.avatar, existing.avatar ?? null),
|
|
1070
1080
|
profileVersion: intOr(source.profileVersion, (existing.profileVersion ?? 1) + 1),
|
|
1071
1081
|
profileUpdatedAt: event.at,
|
|
1072
1082
|
profileUpdatedBy: textOr(source.updatedBy, actorMemberId(event)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.135",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@deepseek-ai/schemastery": "~3.19.0",
|
|
40
|
+
"@suifei/hash-avatar": "~1.0.1",
|
|
40
41
|
"yaml": "~2.9.1"
|
|
41
42
|
},
|
|
42
43
|
"files": [
|