@suifei/dsh-ai-team 0.3.19 → 0.3.20
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 +6 -0
- package/README.md +2 -2
- package/client.js +60 -7
- package/index.js +1 -1
- package/lib/host/service.js +53 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ dsh --profile ai-team --no-open --port 33271
|
|
|
87
87
|
- **主对话**:Human 的一句话进入 Main stream,Project owner 拆 Task;顶部「团队动态」直接显示正在推进的 Task 和运行中的成员,点击 Task 可打开 Thread。
|
|
88
88
|
- **看板**:四列;进行中的卡片显示 accountable owner 与执行者;数量只统计 active Task。
|
|
89
89
|
- **态势**:四象限——需要你、团队在做、等待受阻、最近完成。点击条目打开对应 Task 的 Thread。
|
|
90
|
-
- **收件箱**:跨 Project 聚合;顶部「待你处理 · N
|
|
90
|
+
- **收件箱**:跨 Project 聚合;顶部「待你处理 · N」一键进入;决策项直接展开全部问题与选项,可当场选择/填写并提交,不用再翻 Thread/报告。
|
|
91
91
|
- **直接对话**:点击成员名字直接打开该 Agent 的 DSH 原生 Session;没有 session 会先激活;打不开时落到成员资料,资料里有「直接对话」按钮。
|
|
92
92
|
- **成员任务**:成员资料里点「他的任务」,查看他 owner/assignee 的 Task。
|
|
93
93
|
- **成员资料**:点「⋯」改名、职责、personality、provider/model、运行配方、notes、skills、re-distill、离队/人才库。
|
|
@@ -102,7 +102,7 @@ dsh --profile ai-team --no-open --port 33271
|
|
|
102
102
|
| Task | 唯一 accountable owner;pending / in_progress / pending_acceptance / done / cancelled |
|
|
103
103
|
| Thread | append-only;回复带 `baseSeq`,旧基线会被拒并说明变化 |
|
|
104
104
|
| 验收 | maker 不能验收;QA 硬门禁;`qaChecklist` 逐项通过 |
|
|
105
|
-
| 收件箱 | Human/Agent 各自拉取;跨 Project 聚合;顶部待办入口;`askHuman`
|
|
105
|
+
| 收件箱 | Human/Agent 各自拉取;跨 Project 聚合;顶部待办入口;`askHuman` 结构化问题与选项直接展开并提交 |
|
|
106
106
|
| 关注 | 关注 Task;完成后收到 `followed_task_update` |
|
|
107
107
|
| 默认成员 | 新 Project 初始化墨渊 / 青岚 / 白砚;可改名、改职责、改个性、改模型 |
|
|
108
108
|
| 成员 | 持久 session;点击名字直接对话;「⋯」资料里有任务视图与直接对话 |
|
package/client.js
CHANGED
|
@@ -107,6 +107,11 @@ window.__ModuleLoader__.load({
|
|
|
107
107
|
inboxOpenTask: '打开 Task',
|
|
108
108
|
inboxAck: '知道了',
|
|
109
109
|
inboxAcked: '已标记处理。',
|
|
110
|
+
decisionChoose: '请选择…',
|
|
111
|
+
decisionAnswer: '填写你的决定',
|
|
112
|
+
decisionRecommend: '推荐',
|
|
113
|
+
decisionSubmit: '提交决策',
|
|
114
|
+
decisionSubmitted: '决策已提交给团队。',
|
|
110
115
|
inboxEmptyAction: '看任务看板',
|
|
111
116
|
projectEmptyTitle: '还没有项目',
|
|
112
117
|
projectEmptyBody: '创建项目属于 S-01;M1 之后接入。',
|
|
@@ -409,6 +414,11 @@ window.__ModuleLoader__.load({
|
|
|
409
414
|
inboxOpenTask: 'Open Task',
|
|
410
415
|
inboxAck: 'Acknowledge',
|
|
411
416
|
inboxAcked: 'Marked handled.',
|
|
417
|
+
decisionChoose: 'Choose…',
|
|
418
|
+
decisionAnswer: 'Write your decision',
|
|
419
|
+
decisionRecommend: 'Recommended',
|
|
420
|
+
decisionSubmit: 'Submit decision',
|
|
421
|
+
decisionSubmitted: 'Decision sent to the team.',
|
|
412
422
|
inboxEmptyAction: 'Open the board',
|
|
413
423
|
projectEmptyTitle: 'No projects yet',
|
|
414
424
|
projectEmptyBody: 'Project creation belongs to S-01; it lands after M1.',
|
|
@@ -955,6 +965,9 @@ window.__ModuleLoader__.load({
|
|
|
955
965
|
.at-inboxquestion { display: block; color: var(--dsw-alias-label-primary); }
|
|
956
966
|
.at-inboxoptions { display: block; color: var(--dsw-alias-label-tertiary); font-size: 11px; }
|
|
957
967
|
.at-inboxrecommend { display: block; color: var(--dsw-alias-state-business-primary); font-size: 11px; }
|
|
968
|
+
.at-decision { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
|
|
969
|
+
.at-decisionselect, .at-decisioninput { width: 100%; margin-top: 4px; padding: 4px 6px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; line-height: 18px; }
|
|
970
|
+
.at-decision .at-btn { align-self: flex-start; }
|
|
958
971
|
.at-inboxtitle { color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 20px; }
|
|
959
972
|
.at-inboxmeta { color: var(--dsw-alias-label-tertiary); font-size: 11px; line-height: 16px; }
|
|
960
973
|
.at-inboxstate { color: var(--dsw-alias-label-caption); font-size: 10.5px; }
|
|
@@ -1615,6 +1628,33 @@ window.__ModuleLoader__.load({
|
|
|
1615
1628
|
running.length ? h('div', { className: 'at-teampulseagents' }, t('teamPulseAgents').replace('{names}', running.map((agent) => agent.name).join('、'))) : null);
|
|
1616
1629
|
}
|
|
1617
1630
|
|
|
1631
|
+
function InboxDecision({ t, item, onSubmit }) {
|
|
1632
|
+
const questions = Array.isArray(item.ref?.questions) ? item.ref.questions : [];
|
|
1633
|
+
const [answers, setAnswers] = React.useState(() => questions.map(() => ''));
|
|
1634
|
+
const [busy, setBusy] = React.useState(false);
|
|
1635
|
+
const setAnswer = (index, value) => setAnswers((prev) => prev.map((entry, i) => i === index ? value : entry));
|
|
1636
|
+
const complete = questions.every((question, index) => answers[index].trim() !== '');
|
|
1637
|
+
const submit = async () => {
|
|
1638
|
+
if (!complete || busy) return;
|
|
1639
|
+
setBusy(true);
|
|
1640
|
+
try {
|
|
1641
|
+
await onSubmit(item, questions.map((question, index) => ({ id: question.id, value: answers[index].trim() })));
|
|
1642
|
+
} finally {
|
|
1643
|
+
setBusy(false);
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
return h('div', { className: 'at-decision' },
|
|
1647
|
+
h('ol', { className: 'at-inboxquestions' }, questions.map((question, index) => h('li', { key: question.id ?? index },
|
|
1648
|
+
h('span', { className: 'at-inboxquestion' }, question.text),
|
|
1649
|
+
Array.isArray(question.options) && question.options.length
|
|
1650
|
+
? h('select', { className: 'at-decisionselect', value: answers[index], onChange: (event) => setAnswer(index, event.target.value) },
|
|
1651
|
+
h('option', { value: '' }, t('decisionChoose')),
|
|
1652
|
+
question.options.map((option) => h('option', { key: option, value: option }, option)))
|
|
1653
|
+
: h('input', { className: 'at-decisioninput', value: answers[index], placeholder: question.recommendation ?? t('decisionAnswer'), onChange: (event) => setAnswer(index, event.target.value) }),
|
|
1654
|
+
question.recommendation ? h('span', { className: 'at-inboxrecommend' }, t('decisionRecommend') + ':' + question.recommendation) : null))),
|
|
1655
|
+
h('button', { className: 'at-btn at-btn-primary at-btn-small', type: 'button', disabled: !complete || busy, onClick: submit }, busy ? t('saving') : t('decisionSubmit')));
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1618
1658
|
function MemberView({ t, agent, tasks, onBack, onOpenTask, onOpenChat, onOpenProfile }) {
|
|
1619
1659
|
return h('div', { className: 'at-memberview' },
|
|
1620
1660
|
h('div', { className: 'at-memberviewhead' },
|
|
@@ -2748,6 +2788,15 @@ window.__ModuleLoader__.load({
|
|
|
2748
2788
|
setThreadOpen(true);
|
|
2749
2789
|
setRightNote('');
|
|
2750
2790
|
}
|
|
2791
|
+
async function answerDecision(item, answers) {
|
|
2792
|
+
try {
|
|
2793
|
+
await runCommand('decision.answer', { itemId: item.id, answers }, item.projectId ?? projectId);
|
|
2794
|
+
say(t('decisionSubmitted'));
|
|
2795
|
+
await reloadData();
|
|
2796
|
+
} catch (error) {
|
|
2797
|
+
say(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2751
2800
|
async function ackInbox(item) {
|
|
2752
2801
|
try {
|
|
2753
2802
|
await runCommand('inbox.ack', { itemId: item.id, disposition: 'read' }, item.projectId ?? projectId);
|
|
@@ -2963,12 +3012,14 @@ window.__ModuleLoader__.load({
|
|
|
2963
3012
|
? tf(t, 'inboxCompletedTitle', { title: item.ref?.title ?? item.ref?.taskId ?? '' })
|
|
2964
3013
|
: t('inboxItemTitle')),
|
|
2965
3014
|
Array.isArray(item.ref?.questions) && item.ref.questions.length
|
|
2966
|
-
?
|
|
2967
|
-
h(
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
3015
|
+
? item.state === 'unread'
|
|
3016
|
+
? h(InboxDecision, { t, item, onSubmit: answerDecision })
|
|
3017
|
+
: h('ol', { className: 'at-inboxquestions' }, item.ref.questions.map((question, index) => h('li', { key: question.id ?? index },
|
|
3018
|
+
h('span', { className: 'at-inboxquestion' }, question.text),
|
|
3019
|
+
Array.isArray(question.options) && question.options.length
|
|
3020
|
+
? h('span', { className: 'at-inboxoptions' }, question.options.join(' / '))
|
|
3021
|
+
: null,
|
|
3022
|
+
question.recommendation ? h('span', { className: 'at-inboxrecommend' }, '推荐:' + question.recommendation) : null)))
|
|
2972
3023
|
: null,
|
|
2973
3024
|
h('div', { className: 'at-inboxmeta' },
|
|
2974
3025
|
item.projectName ? item.projectName + ' · ' : '',
|
|
@@ -2979,7 +3030,9 @@ window.__ModuleLoader__.load({
|
|
|
2979
3030
|
item.state !== 'unread' ? h('div', { className: 'at-inboxstate' }, item.state) : null),
|
|
2980
3031
|
h('div', { className: 'at-inboxactions' },
|
|
2981
3032
|
item.ref?.taskId ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => openInboxTask(item) }, t('inboxOpenTask')) : null,
|
|
2982
|
-
item.state === 'unread'
|
|
3033
|
+
item.state === 'unread' && !(item.type === 'decision_required' && Array.isArray(item.ref?.questions) && item.ref.questions.length)
|
|
3034
|
+
? h('button', { className: 'at-btn at-btn-small at-btn-primary', type: 'button', onClick: () => ackInbox(item) }, t('inboxAck'))
|
|
3035
|
+
: null)))
|
|
2983
3036
|
: h(EmptyState, {
|
|
2984
3037
|
t,
|
|
2985
3038
|
icon: 'inbox',
|
package/index.js
CHANGED
|
@@ -34,7 +34,7 @@ export const name = 'ai-team';
|
|
|
34
34
|
/** The workbench only makes sense where the Web carrier exists. */
|
|
35
35
|
export const inject = ['webServer', 'permissionPresets', 'sandboxPolicy'];
|
|
36
36
|
|
|
37
|
-
const VERSION = '0.3.
|
|
37
|
+
const VERSION = '0.3.20';
|
|
38
38
|
const PROJECT_ID = 'prj_main';
|
|
39
39
|
const HUMAN_ID = 'mem_human';
|
|
40
40
|
|
package/lib/host/service.js
CHANGED
|
@@ -233,6 +233,7 @@ export class TeamService {
|
|
|
233
233
|
case 'thread.post': return await this.postThread(command, payload);
|
|
234
234
|
case 'inbox.ack': return await this.ack(command, payload);
|
|
235
235
|
case 'decision.request': return await this.requestDecision(command, payload);
|
|
236
|
+
case 'decision.answer': return await this.answerDecision(command, payload);
|
|
236
237
|
default: fail(ERRORS.INVALID_ARGUMENT, `unknown command: ${String(command.type)}`);
|
|
237
238
|
}
|
|
238
239
|
}
|
|
@@ -943,6 +944,58 @@ export class TeamService {
|
|
|
943
944
|
return { item, duplicate: false };
|
|
944
945
|
}
|
|
945
946
|
|
|
947
|
+
async answerDecision(command, payload) {
|
|
948
|
+
if (command.actor.kind !== 'human') fail(ERRORS.UNAUTHORIZED, 'only Human may answer a decision');
|
|
949
|
+
const item = this.state.inbox?.[payload.itemId];
|
|
950
|
+
if (item === undefined) fail(ERRORS.NOT_FOUND, `inbox item ${String(payload.itemId)} not found`);
|
|
951
|
+
if (item.type !== 'decision_required' || item.requiresDecision !== true) {
|
|
952
|
+
fail(ERRORS.INVALID_STATE, 'this inbox item is not a Human decision');
|
|
953
|
+
}
|
|
954
|
+
const humanId = command.actor.memberId;
|
|
955
|
+
if (item.memberId !== humanId) fail(ERRORS.UNAUTHORIZED, 'decision belongs to another member');
|
|
956
|
+
const answers = (Array.isArray(payload.answers) ? payload.answers : [])
|
|
957
|
+
.map((answer, index) => ({
|
|
958
|
+
id: typeof answer?.id === 'string' && answer.id !== '' ? answer.id : `q${index + 1}`,
|
|
959
|
+
value: typeof answer?.value === 'string' ? answer.value.trim() : '',
|
|
960
|
+
}))
|
|
961
|
+
.filter((answer) => answer.value !== '');
|
|
962
|
+
if (answers.length === 0) fail(ERRORS.INVALID_ARGUMENT, 'at least one answer is required');
|
|
963
|
+
const questions = Array.isArray(item.ref?.questions) ? item.ref.questions : [];
|
|
964
|
+
const lines = answers.map((answer) => {
|
|
965
|
+
const question = questions.find((candidate) => candidate.id === answer.id);
|
|
966
|
+
return `- ${question?.text ?? answer.id}: ${answer.value}`;
|
|
967
|
+
});
|
|
968
|
+
const body = `Human 决策:\n${lines.join('\n')}${typeof payload.note === 'string' && payload.note.trim() !== '' ? `\n备注:${payload.note.trim()}` : ''}`;
|
|
969
|
+
let entry = null;
|
|
970
|
+
if (typeof item.ref?.taskId === 'string' && this.state.tasks?.[item.ref.taskId] !== undefined) {
|
|
971
|
+
const taskId = item.ref.taskId;
|
|
972
|
+
const thread = this.state.threads?.[taskId] ?? createThread(taskId);
|
|
973
|
+
const outcome = appendReply(thread, {
|
|
974
|
+
authorId: humanId,
|
|
975
|
+
actorKind: 'human',
|
|
976
|
+
baseSeq: thread.headSeq,
|
|
977
|
+
body,
|
|
978
|
+
}, { at: this.now() });
|
|
979
|
+
await this.ledger.append({
|
|
980
|
+
type: 'thread/posted',
|
|
981
|
+
payload: { taskId, ...outcome.entry },
|
|
982
|
+
actor: command.actor,
|
|
983
|
+
projectId: command.projectId,
|
|
984
|
+
at: this.now(),
|
|
985
|
+
});
|
|
986
|
+
entry = outcome.entry;
|
|
987
|
+
}
|
|
988
|
+
const next = ackInboxItem(item, { disposition: 'done', decision: { answers, note: payload.note ?? '', body } }, { at: this.now() });
|
|
989
|
+
await this.ledger.append({
|
|
990
|
+
type: 'inbox/acked',
|
|
991
|
+
payload: { itemId: next.id, memberId: next.memberId, state: next.state, disposition: next.disposition, at: next.ackedAt },
|
|
992
|
+
actor: command.actor,
|
|
993
|
+
projectId: command.projectId,
|
|
994
|
+
at: this.now(),
|
|
995
|
+
});
|
|
996
|
+
return { item: next, entry };
|
|
997
|
+
}
|
|
998
|
+
|
|
946
999
|
async ack(command, payload) {
|
|
947
1000
|
const state = this.state;
|
|
948
1001
|
const item = state.inbox?.[payload.itemId];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
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",
|