@suifei/dsh-ai-team 0.4.133 → 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 +17 -0
- package/README.md +55 -3
- 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/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": [
|