dsh-study-tools 0.0.0-stage → 0.2.6
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/EDITOR-LICENSES.txt +568 -0
- package/KATEX-LICENSE.txt +21 -0
- package/README.md +26 -2
- package/agent.js +15 -0
- package/client.js +2112 -0
- package/cordis.patch.yml +128 -0
- package/icon.svg +7 -0
- package/index.js +2 -0
- package/lib/protocol.js +100 -0
- package/locale/en.json +6 -0
- package/locale/zh-CN.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +43 -4
- package/src/client.js +1718 -0
- package/src/quiz-ui.css +457 -0
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
- insert:
|
|
2
|
+
- id: study-tools
|
|
3
|
+
name: dsh-study-tools
|
|
4
|
+
- insert:
|
|
5
|
+
- id: preset-study
|
|
6
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
7
|
+
config:
|
|
8
|
+
id: study
|
|
9
|
+
name: 学习模式
|
|
10
|
+
description: 互动题目、函数图、表格与编程练习;公式输入由独立插件提供。
|
|
11
|
+
order: 3
|
|
12
|
+
plugins:
|
|
13
|
+
- id: persona
|
|
14
|
+
name: '@deepseek-ai/dsh-persona'
|
|
15
|
+
config:
|
|
16
|
+
prefix: You are a thoughtful learning tutor powered by the {{model}} model.
|
|
17
|
+
- id: agent-instructions
|
|
18
|
+
name: '@deepseek-ai/dsh-agent-instructions'
|
|
19
|
+
config:
|
|
20
|
+
maxBytes: 65536
|
|
21
|
+
- id: time-context
|
|
22
|
+
name: '@deepseek-ai/dsh-time-context'
|
|
23
|
+
- id: tool-bash
|
|
24
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
25
|
+
disabled: !!js process.platform === 'win32'
|
|
26
|
+
- id: tool-pwsh
|
|
27
|
+
name: '@deepseek-ai/dsh-tool-pwsh'
|
|
28
|
+
disabled: !!js process.platform !== 'win32'
|
|
29
|
+
- id: tool-fs
|
|
30
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
31
|
+
config:
|
|
32
|
+
# Set false to drop the apply_patch tool beside edit.
|
|
33
|
+
applyPatch: false
|
|
34
|
+
- id: tool-fs-search
|
|
35
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
36
|
+
config:
|
|
37
|
+
sampleOverCapGlobResults: false
|
|
38
|
+
- id: tool-jobs
|
|
39
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
40
|
+
- id: skill-filesystem
|
|
41
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
42
|
+
config:
|
|
43
|
+
customSkillDirs:
|
|
44
|
+
- !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
|
|
45
|
+
- id: tool-skill
|
|
46
|
+
name: '@deepseek-ai/dsh-tool-skill'
|
|
47
|
+
- id: command-goal
|
|
48
|
+
name: '@deepseek-ai/dsh-command-goal'
|
|
49
|
+
- id: tool-goal
|
|
50
|
+
name: '@deepseek-ai/dsh-tool-goal'
|
|
51
|
+
- id: planning
|
|
52
|
+
name: cordis:group
|
|
53
|
+
group: true
|
|
54
|
+
isolate:
|
|
55
|
+
planMode: true
|
|
56
|
+
config:
|
|
57
|
+
- id: plan-mode
|
|
58
|
+
name: '@deepseek-ai/dsh-plan-mode'
|
|
59
|
+
config:
|
|
60
|
+
section: |
|
|
61
|
+
You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
62
|
+
|
|
63
|
+
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
|
64
|
+
|
|
65
|
+
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
|
66
|
+
|
|
67
|
+
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
|
68
|
+
|
|
69
|
+
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
|
70
|
+
|
|
71
|
+
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
|
72
|
+
- id: compaction
|
|
73
|
+
name: cordis:group
|
|
74
|
+
group: true
|
|
75
|
+
isolate:
|
|
76
|
+
compaction: true
|
|
77
|
+
toolResultPruner: true
|
|
78
|
+
config:
|
|
79
|
+
- id: compaction-basic
|
|
80
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
81
|
+
- id: command-compact
|
|
82
|
+
name: '@deepseek-ai/dsh-command-compact'
|
|
83
|
+
- id: tool-result-pruner
|
|
84
|
+
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
85
|
+
config:
|
|
86
|
+
thresholdChars: 8192
|
|
87
|
+
headChars: 4096
|
|
88
|
+
tailChars: 1024
|
|
89
|
+
- id: delegation
|
|
90
|
+
name: cordis:group
|
|
91
|
+
group: true
|
|
92
|
+
isolate:
|
|
93
|
+
workflowEngine: true
|
|
94
|
+
config:
|
|
95
|
+
- id: tool-subagent-control
|
|
96
|
+
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
97
|
+
config:
|
|
98
|
+
interrupt: false
|
|
99
|
+
- id: tool-subagent
|
|
100
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
101
|
+
config:
|
|
102
|
+
provider: spawn
|
|
103
|
+
toolName: subagent
|
|
104
|
+
modelSelection: true
|
|
105
|
+
modelDiscovery: true
|
|
106
|
+
- id: tool-subagent-fork
|
|
107
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
108
|
+
config:
|
|
109
|
+
provider: fork
|
|
110
|
+
toolName: subagent_fork
|
|
111
|
+
- id: workflow-ptc
|
|
112
|
+
name: '@deepseek-ai/dsh-workflow-ptc'
|
|
113
|
+
config:
|
|
114
|
+
provider: spawn
|
|
115
|
+
- id: tool-workflow
|
|
116
|
+
name: '@deepseek-ai/dsh-tool-workflow'
|
|
117
|
+
- id: tool-ask-user
|
|
118
|
+
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
119
|
+
- id: tool-todo
|
|
120
|
+
name: '@deepseek-ai/dsh-tool-todo'
|
|
121
|
+
config:
|
|
122
|
+
allowParallelInProgress: true
|
|
123
|
+
- id: present
|
|
124
|
+
name: '@deepseek-ai/dsh-tool-present'
|
|
125
|
+
- id: tool-office
|
|
126
|
+
name: '@deepseek-ai/dsh-tool-office'
|
|
127
|
+
- id: study-protocol
|
|
128
|
+
name: dsh-study-tools/agent
|
package/icon.svg
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<rect x="3" y="4" width="18" height="16" rx="3" />
|
|
3
|
+
<path d="M7 9.5l2 2 2-2" />
|
|
4
|
+
<path d="M13.5 9.5h3.5" />
|
|
5
|
+
<path d="M7 15.5h4" />
|
|
6
|
+
<path d="M13.5 15.5h3.5" />
|
|
7
|
+
</svg>
|
package/index.js
ADDED
package/lib/protocol.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 学习模式的协议文本,由该 Agent 预设通过 systemPrompt 服务加载。
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const PROTOCOL_SECTION_NAME = 'ds-tools-quiz-cards'
|
|
6
|
+
export const PROTOCOL_SECTION_ORDER = 3200
|
|
7
|
+
|
|
8
|
+
export const DS_TOOLS_PROTOCOL = `# 出题卡片(ds_tools)
|
|
9
|
+
|
|
10
|
+
当前 Agent 为学习模式。你可以在正常回答的**末尾**追加一个 \`\`\`ds_tools 代码块,界面会把它渲染成可作答的卡片。仅在有助于学习时使用组件,无需每次出题。
|
|
11
|
+
|
|
12
|
+
## 块格式
|
|
13
|
+
|
|
14
|
+
整块是一个 JSON 对象,最外层键固定为 ds_tools,值是一个数组:
|
|
15
|
+
|
|
16
|
+
\`\`\`ds_tools
|
|
17
|
+
{"ds_tools":[{"type":"quiz","question":"2+2 等于?","options":["3","4","5"],"answer":1,"explanation":"2+2=4"}]}
|
|
18
|
+
\`\`\`
|
|
19
|
+
|
|
20
|
+
- 先写清楚讲解,再另起一个代码块放 JSON;代码块语言名必须写成 ds_tools。
|
|
21
|
+
- 只放 JSON,不放 HTML、脚本、注释或尾随逗号。
|
|
22
|
+
- 一次考察的全部题目放进**同一个** ds_tools 块,方便用户一键汇总。
|
|
23
|
+
- 用户明确不要某类卡片时就别再给。
|
|
24
|
+
|
|
25
|
+
## 选择题 quiz
|
|
26
|
+
|
|
27
|
+
{"type":"quiz","question":"题干","options":["A","B","C"],"answer":1,"explanation":"解析"}
|
|
28
|
+
|
|
29
|
+
- answer 是正确选项的**下标**(从 0 开始),不是选项文字。
|
|
30
|
+
- options 至少两项,彼此互斥且唯一正确。
|
|
31
|
+
- explanation 讲清为什么对、其他项错在哪。
|
|
32
|
+
|
|
33
|
+
## 填空题 fill
|
|
34
|
+
|
|
35
|
+
{"type":"fill","question":"法国首都是____。","answers":["巴黎","Paris"],"explanation":"巴黎是法国首都。"}
|
|
36
|
+
|
|
37
|
+
- answers 第一项是标准答案,后面是同样算对的等价写法。
|
|
38
|
+
- 题干用下划线 ____ 标出要填的位置。
|
|
39
|
+
|
|
40
|
+
## 配图
|
|
41
|
+
|
|
42
|
+
题干配图写在 quiz / fill 的 image 字段,二选一:
|
|
43
|
+
|
|
44
|
+
- 搜现成照片:{"url":"https://…","alt":"中性描述"} —— 只有确实存在的地址才能写,不确定就改用 prompt。
|
|
45
|
+
- 让界面自己画:{"prompt":"足以独立说明画面的描述","aspect_ratio":"4:3"}
|
|
46
|
+
|
|
47
|
+
选项配图写 optionImages,长度必须和 options 一致,没图的项填 null:
|
|
48
|
+
|
|
49
|
+
{"type":"quiz","question":"哪幅是正弦曲线?","options":["甲","乙"],"answer":0,"optionImages":[{"prompt":"一条从原点上升的正弦曲线","aspect_ratio":"4:3"},{"prompt":"一条开口向上的抛物线","aspect_ratio":"4:3"}]}
|
|
50
|
+
|
|
51
|
+
- 图片只能帮助理解,不能透露答案。
|
|
52
|
+
- 题内已经用 image / optionImages 表达的画面,不要再单独输出 images 或 generate_image 组件。
|
|
53
|
+
|
|
54
|
+
## 独立配图组件
|
|
55
|
+
|
|
56
|
+
需要一张与具体题目无关的参考图时,可以在 ds_tools 里单独放:
|
|
57
|
+
|
|
58
|
+
{"type":"images","query":"金门大桥","title":"金门大桥参考图"}
|
|
59
|
+
{"type":"generate_image","prompt":"完整画面描述","aspect_ratio":"4:3"}
|
|
60
|
+
|
|
61
|
+
- 先调用 ds_image_search 获取真实地址,然后把结果写入题目 image 或 images 的 items 字段,不要编造图片地址。
|
|
62
|
+
- 图片生成须先调用 ds_image_generate 并取得成功结果再填写 url;未配置服务或失败时说明情况,不要声称已经生成。
|
|
63
|
+
- aspect_ratio 取 1:1、4:3、3:4、16:9 之一。
|
|
64
|
+
|
|
65
|
+
## 题干样式 question_style
|
|
66
|
+
|
|
67
|
+
{"color":"#334155","highlights":[{"text":"不正确","bold":true,"color":"#c62828","background":"#fff0c2","underline":true,"strike":false}]}
|
|
68
|
+
|
|
69
|
+
- color 是整题文字色;highlights 按 text 精确匹配题干片段,可组合加粗、文字色、背景、下划线、删除线。
|
|
70
|
+
- 只用来强调关键词,**不要用颜色暗示哪个选项正确**。
|
|
71
|
+
|
|
72
|
+
## 作答要求 requirements
|
|
73
|
+
|
|
74
|
+
出练习、布置编程题、或需要用户边对照条件边作答时,可以在同一个 ds_tools 块里附加一个要求栏,每次最多一个:
|
|
75
|
+
|
|
76
|
+
{"type":"requirements","title":"作答要求","text":"写明输入、输出与边界条件。\\n公式可用 $...$ 排版。"}
|
|
77
|
+
|
|
78
|
+
- text 是字符串,分点用 \\n 换行。
|
|
79
|
+
- 界面会把它展开在输入框上方,用户也能用右上角的「代码模式」把草稿整段当代码处理。
|
|
80
|
+
- 编程作答题还要给 language(java、python、javascript、typescript 之一)、signature(完整可复制的方法声明,只含签名)、starterCode(含参数和必要变量的待填骨架,**不要提前填好答案**)、instructions(简短纯文本要求列表)。界面会把 starterCode 一键插进输入框。
|
|
81
|
+
- 普通对话不需要要求栏,自己判断要不要给。
|
|
82
|
+
|
|
83
|
+
## 数学与代码
|
|
84
|
+
|
|
85
|
+
- 行内公式用 $...$,独立公式用 $$...$$。
|
|
86
|
+
- JSON 里的反斜杠要转义双写,写成 "$v=\\\\frac{\\\\Delta x}{\\\\Delta t}$"。
|
|
87
|
+
- 标识符用行内反引号;多行代码用带语言名的 Markdown 围栏,保留真实换行和四空格缩进,JSON 内换行写 \\n。
|
|
88
|
+
|
|
89
|
+
## 函数图 plot(独立、题干、选项都可用)
|
|
90
|
+
{"type":"plot","title":"函数对比","expressions":["a*x^2","sin(x)"],"xRange":[-5,5],"yRange":[-5,10],"xLabel":"$x$","yLabel":"$y$","params":{"a":{"min":-3,"max":3,"step":0.1,"value":1}}}
|
|
91
|
+
函数用 expression(单条)或 expressions(1—8 条)。支持 LaTeX 表达式、独立参数滑块、多色曲线、交点/跳跃/渐近线数值标记。复杂曲线的数值标记可能遗漏,不能当严格证明。按题意标坐标轴及单位。
|
|
92
|
+
|
|
93
|
+
## 表格 table
|
|
94
|
+
{"type":"table","title":"数值表","headers":["$x$","$x^2$"],"rows":[["1","1"],["2","4"]]}
|
|
95
|
+
表头、单元格、标题支持 Markdown 和美元符号包裹的 LaTeX。JSON 字符串里的反斜杠一律双写,不能直接写非法 JSON 的 \(。
|
|
96
|
+
题干可同时提供 image、plot、table,或 media 数组(type 为 image/plot/table),不必三选一。选项可用对象 {text,media},或对应的 optionImages、optionPlots、optionTables、optionMedia 数组。
|
|
97
|
+
不提供物理引擎或物理仿真组件。不要输出 physics 类型。
|
|
98
|
+
题目数量按用户要求,不限制为 8 题;一次考察放同一块。
|
|
99
|
+
要求栏仅在必要时输出。编程题给 language、starterCode、instructions,代码里用 // 或 /* */ 注明要求。新回复完成且草稿为空时,界面可自动填入骨架并打开代码模式;草稿非空不覆盖。历史要求栏由用户手动打开。不要将完整答案当骨架。
|
|
100
|
+
`
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-study-tools",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "学习工作台:把 ds_tools 渲染为练习卡、函数图、表格和作答要求,提供代码编辑模式。",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/AXTUT/dsh-study-tools.git"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"dsh": "0.2.2-rc.5"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./index.js",
|
|
15
|
+
"./client": "./client.js",
|
|
16
|
+
"./locale/*.json": "./locale/*.json",
|
|
17
|
+
"./icon": "./icon.svg",
|
|
18
|
+
"./agent": "./agent.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"index.js",
|
|
22
|
+
"client.js",
|
|
23
|
+
"lib/protocol.js",
|
|
24
|
+
"locale",
|
|
25
|
+
"icon.svg",
|
|
26
|
+
"agent.js",
|
|
27
|
+
"cordis.patch.yml",
|
|
28
|
+
"src",
|
|
29
|
+
"KATEX-LICENSE.txt",
|
|
30
|
+
"EDITOR-LICENSES.txt",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"dsh": {
|
|
34
|
+
"bundle": {
|
|
35
|
+
"patch": "./cordis.patch.yml"
|
|
36
|
+
},
|
|
37
|
+
"client": {
|
|
38
|
+
"platform": "web",
|
|
39
|
+
"immediately": true,
|
|
40
|
+
"inject": [
|
|
41
|
+
"@deepseek-ai/dsh-client-ui-conversation"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|