@xirang-ai/dsh-teamflow 0.1.0 → 0.1.2
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 +18 -14
- package/README.md +18 -14
- package/RELEASE.md +9 -9
- package/cordis.patch.yml +2 -0
- package/lib/client.js +494 -153
- package/lib/index.d.ts +7 -1
- package/lib/index.js +10 -4
- package/lib/remote/contract.d.ts +34 -1
- package/lib/remote/contract.js +16 -0
- package/lib/remote/service.d.ts +15 -2
- package/lib/remote/service.js +49 -6
- package/lib/requirement-discussion.d.ts +23 -0
- package/lib/requirement-discussion.js +26 -0
- package/lib/store/db.d.ts +8 -3
- package/lib/store/db.js +34 -2
- package/lib/store/docs.d.ts +9 -11
- package/lib/store/docs.js +25 -52
- package/lib/store/model.d.ts +23 -0
- package/lib/store/model.js +4 -0
- package/lib/store/paths.d.ts +20 -0
- package/lib/store/paths.js +54 -1
- package/lib/store/schema.js +71 -14
- package/lib/store/workflow.d.ts +50 -25
- package/lib/store/workflow.js +210 -97
- package/lib/tools/get-bug.js +1 -1
- package/lib/tools/get-design-doc.js +1 -1
- package/lib/tools/get-requirement.js +1 -1
- package/lib/tools/get-story.js +1 -1
- package/lib/tools/index.js +7 -0
- package/lib/tools/link-session.d.ts +3 -0
- package/lib/tools/link-session.js +87 -0
- package/locale/en.json +5 -1
- package/locale/zh.json +5 -1
- package/package.json +4 -4
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `teamflow_link_session` — confirm the discussion prepared for this conversation.
|
|
3
|
+
*
|
|
4
|
+
* The browser creates the session and registers a pending binding before the
|
|
5
|
+
* first message, so the Agent must not need a record id. The session id is the
|
|
6
|
+
* durable identity of the conversation; linking is idempotent. Requirements,
|
|
7
|
+
* stories and defects share this tool; `teamflow_link_requirement_session`
|
|
8
|
+
* stays as a compatibility alias with the same implementation.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
13
|
+
/** Where the Agent should read the record after linking. */
|
|
14
|
+
function nextStep(subjectType) {
|
|
15
|
+
if (subjectType === 'story')
|
|
16
|
+
return 'teamflow_get_story';
|
|
17
|
+
if (subjectType === 'bug')
|
|
18
|
+
return 'teamflow_get_bug';
|
|
19
|
+
return 'teamflow_get_requirement';
|
|
20
|
+
}
|
|
21
|
+
/** Build the generic session-linking tool bound to one Host context. */
|
|
22
|
+
export function linkSessionTool(environment) {
|
|
23
|
+
return defineTool({
|
|
24
|
+
name: 'teamflow_link_session',
|
|
25
|
+
description: 'Confirm that this conversation belongs to the requirement, story or defect it was started from. Call it once at the very beginning of a discussion; it takes no arguments and returns the subject type, id, title and confirmation time.',
|
|
26
|
+
parameters: {},
|
|
27
|
+
output: {
|
|
28
|
+
schema: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
properties: {
|
|
32
|
+
subjectType: { type: 'string', required: true },
|
|
33
|
+
subjectId: { type: 'string', required: true },
|
|
34
|
+
title: { type: 'string', required: true },
|
|
35
|
+
sessionId: { type: 'string', required: true },
|
|
36
|
+
kind: { type: 'string', required: true },
|
|
37
|
+
linkedAt: { type: 'string', required: true },
|
|
38
|
+
alreadyLinked: { type: 'boolean', required: true },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
render: (_args, value) => [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: [
|
|
45
|
+
`已把本会话登记到${subjectLabel(value.subjectType)} ${value.subjectId}《${value.title}》。`,
|
|
46
|
+
`接下来调用 ${nextStep(value.subjectType)} 读取正文,再结合用户补充继续讨论。`,
|
|
47
|
+
].join('\n'),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
async execute(_args, exec) {
|
|
52
|
+
exec.signal.throwIfAborted();
|
|
53
|
+
const sessionId = exec.agent?.session.header.id?.trim() ?? '';
|
|
54
|
+
if (sessionId.length === 0) {
|
|
55
|
+
throw new Error('teamflow: 无法从当前会话取得 session id,不能登记讨论会话。');
|
|
56
|
+
}
|
|
57
|
+
const before = environment.database.workflow.getDiscussionSession(sessionId);
|
|
58
|
+
const session = environment.database.workflow.linkDiscussionSession(sessionId);
|
|
59
|
+
const title = subjectTitle(environment, session.subjectType, session.subjectId);
|
|
60
|
+
return {
|
|
61
|
+
subjectType: session.subjectType,
|
|
62
|
+
subjectId: session.subjectId,
|
|
63
|
+
title,
|
|
64
|
+
sessionId: session.sessionId,
|
|
65
|
+
kind: session.kind,
|
|
66
|
+
linkedAt: session.linkedAt ?? session.preparedAt ?? session.createdAt,
|
|
67
|
+
alreadyLinked: before?.linkedAt != null,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function subjectLabel(subjectType) {
|
|
73
|
+
if (subjectType === 'story')
|
|
74
|
+
return '故事';
|
|
75
|
+
if (subjectType === 'bug')
|
|
76
|
+
return '缺陷';
|
|
77
|
+
return '需求';
|
|
78
|
+
}
|
|
79
|
+
/** Record title, falling back to the id so a dangling row still reports something readable. */
|
|
80
|
+
function subjectTitle(environment, subjectType, subjectId) {
|
|
81
|
+
const workflow = environment.database.workflow;
|
|
82
|
+
if (subjectType === 'story')
|
|
83
|
+
return workflow.getStory(subjectId)?.title ?? subjectId;
|
|
84
|
+
if (subjectType === 'bug')
|
|
85
|
+
return workflow.getBug(subjectId)?.title ?? subjectId;
|
|
86
|
+
return workflow.getRequirement(subjectId)?.title ?? subjectId;
|
|
87
|
+
}
|
package/locale/en.json
CHANGED
|
@@ -26,10 +26,12 @@
|
|
|
26
26
|
"composer.locked": "The conversation has started; create a new one to switch agents.",
|
|
27
27
|
"composer.noPreset": "The preset agent is not loaded, so the switch was not applied.",
|
|
28
28
|
"composer.other": "Other (default)",
|
|
29
|
-
"create.attachment.add": "Add
|
|
29
|
+
"create.attachment.add": "Add attachments",
|
|
30
30
|
"create.attachment.blocked": "Attachments are still uploading; wait for them to finish before sending.",
|
|
31
31
|
"create.attachment.busy": "The conversation is busy, so the attachments were not sent. Try again.",
|
|
32
32
|
"create.attachment.cancelled": "Upload cancelled; nothing was sent.",
|
|
33
|
+
"create.attachment.dropActive": "Release to attach these files.",
|
|
34
|
+
"create.attachment.dropHint": "Click to choose files, or drop them here.",
|
|
33
35
|
"create.attachment.failed": "Upload failed",
|
|
34
36
|
"create.attachment.failed.network": "The upload failed. Check the network and try again.",
|
|
35
37
|
"create.attachment.failed.rejected": "The host rejected the file (damaged content or wrong type).",
|
|
@@ -131,6 +133,7 @@
|
|
|
131
133
|
"delete.statusMissing": "—",
|
|
132
134
|
"delete.summary": "{total} record(s), {deletable} deletable",
|
|
133
135
|
"detail.branch": "Branch",
|
|
136
|
+
"detail.bugDiscussion": "Discuss this bug in a new session",
|
|
134
137
|
"detail.bugBody": "What happened",
|
|
135
138
|
"detail.completedAt": "Completed",
|
|
136
139
|
"detail.description": "Description",
|
|
@@ -146,6 +149,7 @@
|
|
|
146
149
|
"detail.discussionNewDetail": "Discuss the detailed design in a new conversation",
|
|
147
150
|
"detail.discussionNewSplit": "Split Stories in a new conversation",
|
|
148
151
|
"detail.discussionOpen": "Open",
|
|
152
|
+
"detail.storyDiscussion": "Discuss this story in a new session",
|
|
149
153
|
"detail.discussionStarting": "Creating conversation…",
|
|
150
154
|
"detail.docs": "Detailed design",
|
|
151
155
|
"detail.docsEmpty": "No detailed design written yet.",
|
package/locale/zh.json
CHANGED
|
@@ -26,10 +26,12 @@
|
|
|
26
26
|
"composer.locked": "会话已开始,无法再切换 Agent;请新建会话。",
|
|
27
27
|
"composer.noPreset": "预设 Agent 未加载,无法切换。",
|
|
28
28
|
"composer.other": "其他(默认)",
|
|
29
|
-
"create.attachment.add": "
|
|
29
|
+
"create.attachment.add": "添加附件",
|
|
30
30
|
"create.attachment.blocked": "附件正在上传,上传完成后再提交。",
|
|
31
31
|
"create.attachment.busy": "会话正忙,附件未发送,请稍后重试。",
|
|
32
32
|
"create.attachment.cancelled": "已取消上传,附件未发送。",
|
|
33
|
+
"create.attachment.dropActive": "松手即可添加附件。",
|
|
34
|
+
"create.attachment.dropHint": "点击选择文件,或把文件拖到这里。",
|
|
33
35
|
"create.attachment.failed": "上传失败",
|
|
34
36
|
"create.attachment.failed.network": "上传暂时失败,请检查网络后重试。",
|
|
35
37
|
"create.attachment.failed.rejected": "宿主拒绝了该文件(内容损坏或类型不符)。",
|
|
@@ -131,6 +133,7 @@
|
|
|
131
133
|
"delete.statusMissing": "—",
|
|
132
134
|
"delete.summary": "共 {total} 条,可删除 {deletable} 条",
|
|
133
135
|
"detail.branch": "分支",
|
|
136
|
+
"detail.bugDiscussion": "在新会话中进行缺陷讨论",
|
|
134
137
|
"detail.bugBody": "缺陷说明",
|
|
135
138
|
"detail.completedAt": "完成时间",
|
|
136
139
|
"detail.description": "故事说明",
|
|
@@ -146,6 +149,7 @@
|
|
|
146
149
|
"detail.discussionNewDetail": "在新会话中进行详细设计讨论",
|
|
147
150
|
"detail.discussionNewSplit": "在新会话中进行故事拆分",
|
|
148
151
|
"detail.discussionOpen": "打开",
|
|
152
|
+
"detail.storyDiscussion": "在新会话中进行故事讨论",
|
|
149
153
|
"detail.discussionStarting": "正在创建会话…",
|
|
150
154
|
"detail.docs": "详细设计",
|
|
151
155
|
"detail.docsEmpty": "还没有写详细设计。",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xirang-ai/dsh-teamflow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "DeepSeek Harness plugin: Xirang workbench for the requirement → development → defect pipeline.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/xirang-ai/teamflow.git"
|
|
8
|
+
"url": "git+https://github.com/xirang-ai/dsh-teamflow.git"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"deepseek-harness",
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
"@deepseek-ai/schemastery": "^3.19.0",
|
|
116
116
|
"nanoid": "^6.0.2"
|
|
117
117
|
},
|
|
118
|
-
"homepage": "https://github.com/xirang-ai/teamflow#readme",
|
|
118
|
+
"homepage": "https://github.com/xirang-ai/dsh-teamflow#readme",
|
|
119
119
|
"bugs": {
|
|
120
|
-
"url": "https://github.com/xirang-ai/teamflow/issues"
|
|
120
|
+
"url": "https://github.com/xirang-ai/dsh-teamflow/issues"
|
|
121
121
|
}
|
|
122
122
|
}
|