dsh-thesis 1.0.0 → 2.0.1
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/LICENSE +21 -21
- package/NOTICE.md +1 -1
- package/README.md +48 -204
- package/docs/autopilot.md +73 -0
- package/docs/config.md +113 -0
- package/{DESIGN.md → docs/design.md} +94 -73
- package/docs/host-api.md +728 -640
- package/docs/release.md +126 -0
- package/docs/tools.md +76 -0
- package/docs/troubleshooting.md +88 -0
- package/docs/usage.md +87 -0
- package/lib/autopilot/index.d.ts +38 -0
- package/lib/autopilot/index.js +159 -0
- package/lib/autopilot/intent.d.ts +40 -0
- package/lib/autopilot/intent.js +82 -0
- package/lib/autopilot/messages.d.ts +22 -0
- package/lib/autopilot/messages.js +35 -0
- package/lib/autopilot/types.d.ts +60 -0
- package/lib/autopilot/types.js +10 -0
- package/lib/codewalk/engine.d.ts +1 -1
- package/lib/codewalk/engine.js +1 -1
- package/lib/codewalk/gate.d.ts +1 -1
- package/lib/codewalk/gate.js +1 -1
- package/lib/codewalk/host-types.d.ts +4 -31
- package/lib/codewalk/prestep.js +1 -1
- package/lib/codewalk/tools.js +2 -2
- package/lib/config.d.ts +17 -0
- package/lib/config.js +9 -1
- package/lib/dedup/index.js +0 -6
- package/lib/gates/messages.d.ts +7 -3
- package/lib/gates/messages.js +7 -4
- package/lib/index.d.ts +3 -1
- package/lib/index.js +10 -7
- package/lib/ingest/index.d.ts +1 -1
- package/lib/ingest/index.js +1 -3
- package/lib/intake/gate-rules.d.ts +6 -5
- package/lib/intake/gate-rules.js +6 -2
- package/lib/intake/index.d.ts +0 -17
- package/lib/intake/index.js +0 -51
- package/lib/intake/questions.d.ts +1 -1
- package/lib/intake/questions.js +1 -1
- package/lib/paper/lib/docx.js +70 -70
- package/lib/paper/lib/layout.d.ts +1 -1
- package/lib/paper/lib/layout.js +372 -372
- package/lib/paper/lib/ledger.d.ts +1 -1
- package/lib/paper/lib/ledger.js +1 -1
- package/lib/paper/lib/lit-cache.js +7 -7
- package/lib/paper/register.d.ts +2 -2
- package/lib/paper/register.js +2 -8
- package/lib/paper/tools/decision.js +5 -5
- package/lib/paper/tools/init.d.ts +1 -1
- package/lib/paper/tools/init.js +1 -1
- package/lib/paper/tools/lit.js +32 -32
- package/lib/ppt/index.d.ts +1 -2
- package/lib/ppt/index.js +1 -2
- package/lib/shared/define-tool.d.ts +1 -1
- package/lib/shared/define-tool.js +1 -1
- package/package.json +26 -21
- package/skills/code-walkthrough/SKILL.md +5 -3
- package/skills/thesis-defense/SKILL.md +1 -1
- package/skills/thesis-pipeline/SKILL.md +3 -3
- package/lib/codewalk/commands.d.ts +0 -23
- package/lib/codewalk/commands.js +0 -168
- package/lib/commands.d.ts +0 -33
- package/lib/commands.js +0 -60
- package/lib/dedup/commands.d.ts +0 -21
- package/lib/dedup/commands.js +0 -93
- package/lib/ingest/commands.d.ts +0 -23
- package/lib/ingest/commands.js +0 -74
- package/lib/paper/commands.d.ts +0 -13
- package/lib/paper/commands.js +0 -84
- package/lib/ppt/commands.d.ts +0 -28
- package/lib/ppt/commands.js +0 -71
package/lib/intake/index.d.ts
CHANGED
|
@@ -57,20 +57,3 @@ export interface IntakeExecLike {
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
/** 命令返回值(宿主 `CommandResult` 的形状)。 */
|
|
61
|
-
export interface IntakeCommandResult {
|
|
62
|
-
readonly kind: 'success' | 'error';
|
|
63
|
-
readonly text?: string;
|
|
64
|
-
}
|
|
65
|
-
/** 把 `/thesis-intake` 的一行输入翻译成追问动作。 */
|
|
66
|
-
export declare function parseCommandInput(raw: string): IntakeArgs;
|
|
67
|
-
/**
|
|
68
|
-
* 注册命令 `/thesis-intake`(命令名只允许 `[a-z][a-z0-9_-]*`)。
|
|
69
|
-
*
|
|
70
|
-
* 用法:`/thesis-intake` 取下一个问题;`/thesis-intake status|spec|done|start`;
|
|
71
|
-
* `/thesis-intake answer school.name XX大学`;`/thesis-intake skip ref.samples 暂时没有`。
|
|
72
|
-
* `ctx.commands` 不可用(未装配命令服务的宿主)时静默跳过,不影响工具能力。
|
|
73
|
-
*/
|
|
74
|
-
export declare function registerIntakeCommand(ctx: Context, options: {
|
|
75
|
-
intake: IntakeSubOptions;
|
|
76
|
-
}): boolean;
|
package/lib/intake/index.js
CHANGED
|
@@ -414,55 +414,4 @@ export function registerIntake(ctx, options) {
|
|
|
414
414
|
return await definition.execute(rawArgs, exec);
|
|
415
415
|
},
|
|
416
416
|
}));
|
|
417
|
-
registerIntakeCommand(ctx, options);
|
|
418
|
-
}
|
|
419
|
-
/** 把 `/thesis-intake` 的一行输入翻译成追问动作。 */
|
|
420
|
-
export function parseCommandInput(raw) {
|
|
421
|
-
const text = raw.trim();
|
|
422
|
-
if (text === '')
|
|
423
|
-
return { action: 'ask' };
|
|
424
|
-
const [head, ...rest] = text.split(/\s+/);
|
|
425
|
-
switch (head) {
|
|
426
|
-
case 'start':
|
|
427
|
-
case 'ask':
|
|
428
|
-
case 'status':
|
|
429
|
-
case 'spec':
|
|
430
|
-
case 'done':
|
|
431
|
-
return { action: head };
|
|
432
|
-
case 'answer': {
|
|
433
|
-
const [id, ...words] = rest;
|
|
434
|
-
return { action: 'answer', question_id: id ?? '', answer: words.join(' ') };
|
|
435
|
-
}
|
|
436
|
-
case 'skip': {
|
|
437
|
-
const [id, ...words] = rest;
|
|
438
|
-
return { action: 'skip', question_id: id ?? '', reason: words.join(' ') };
|
|
439
|
-
}
|
|
440
|
-
default:
|
|
441
|
-
// 不认识的第一个词:当作问题 id 的简写,等价于 answer(模型/人最常这么用)。
|
|
442
|
-
return { action: 'answer', question_id: head ?? '', answer: rest.join(' ') };
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* 注册命令 `/thesis-intake`(命令名只允许 `[a-z][a-z0-9_-]*`)。
|
|
447
|
-
*
|
|
448
|
-
* 用法:`/thesis-intake` 取下一个问题;`/thesis-intake status|spec|done|start`;
|
|
449
|
-
* `/thesis-intake answer school.name XX大学`;`/thesis-intake skip ref.samples 暂时没有`。
|
|
450
|
-
* `ctx.commands` 不可用(未装配命令服务的宿主)时静默跳过,不影响工具能力。
|
|
451
|
-
*/
|
|
452
|
-
export function registerIntakeCommand(ctx, options) {
|
|
453
|
-
const commands = ctx.commands;
|
|
454
|
-
if (commands === undefined || typeof commands.register !== 'function')
|
|
455
|
-
return false;
|
|
456
|
-
commands.register({
|
|
457
|
-
name: 'thesis-intake',
|
|
458
|
-
description: '逐题追问:材料到手后把模糊要求变成意图规格(一次一个问题)',
|
|
459
|
-
input: { hint: 'answer <问题id> <答案>|skip <问题id> <理由>|status|spec|done(缺省取下一个问题)' },
|
|
460
|
-
async handler(invocation) {
|
|
461
|
-
const args = parseCommandInput(invocation.rawInput ?? '');
|
|
462
|
-
const text = await runIntake(ctx.fs, options.intake, args, sessionCwd(invocation), invocation.signal);
|
|
463
|
-
// 工具层已经把失败写成可读中文,这里统一按 success 返回(命令不做二次包装)。
|
|
464
|
-
return { kind: 'success', text };
|
|
465
|
-
},
|
|
466
|
-
});
|
|
467
|
-
return true;
|
|
468
417
|
}
|
|
@@ -23,7 +23,7 @@ import type { IntakeState } from './state.ts';
|
|
|
23
23
|
* 没有工具兑现的产出物,测试立刻变红——这样「问了一堆用不上的要求」无法退化。
|
|
24
24
|
*/
|
|
25
25
|
export type IntakeAffect = '格式检查' | '引用规范' | '字数分配' | '写作规范' | '原创性' | '答案PPT' | '答辩问答' | '文献检索';
|
|
26
|
-
/** 每个产出物由哪些工具兑现(工具名是契约,见
|
|
26
|
+
/** 每个产出物由哪些工具兑现(工具名是契约,见 docs/design.md §5)。 */
|
|
27
27
|
export declare const AFFECT_TOOLS: Readonly<Record<IntakeAffect, readonly string[]>>;
|
|
28
28
|
/** 轻校验结果:`ok:false` + `note` 表示「记录但标注问题」,不阻断对话。 */
|
|
29
29
|
export interface AnswerCheck {
|
package/lib/intake/questions.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @module dsh-thesis/intake
|
|
16
16
|
*/
|
|
17
|
-
/** 每个产出物由哪些工具兑现(工具名是契约,见
|
|
17
|
+
/** 每个产出物由哪些工具兑现(工具名是契约,见 docs/design.md §5)。 */
|
|
18
18
|
export const AFFECT_TOOLS = {
|
|
19
19
|
格式检查: ['thesis_check'],
|
|
20
20
|
引用规范: ['thesis_lit_search', 'thesis_lit_save', 'thesis_lit_note', 'thesis_check'],
|
package/lib/paper/lib/docx.js
CHANGED
|
@@ -116,72 +116,72 @@ function blockXml(block) {
|
|
|
116
116
|
// ---------------------------------------------------------------------------
|
|
117
117
|
// 文档装配
|
|
118
118
|
// ---------------------------------------------------------------------------
|
|
119
|
-
const CONTENT_TYPES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
120
|
-
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
121
|
-
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
122
|
-
<Default Extension="xml" ContentType="application/xml"/>
|
|
123
|
-
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
|
|
124
|
-
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
|
125
|
-
</Types>
|
|
119
|
+
const CONTENT_TYPES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
120
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
121
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
122
|
+
<Default Extension="xml" ContentType="application/xml"/>
|
|
123
|
+
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
|
|
124
|
+
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
|
125
|
+
</Types>
|
|
126
126
|
`;
|
|
127
|
-
const ROOT_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
128
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
129
|
-
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
|
130
|
-
</Relationships>
|
|
127
|
+
const ROOT_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
128
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
129
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
|
130
|
+
</Relationships>
|
|
131
131
|
`;
|
|
132
|
-
const DOCUMENT_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
133
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"/>
|
|
132
|
+
const DOCUMENT_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
133
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"/>
|
|
134
134
|
`;
|
|
135
|
-
const STYLES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
136
|
-
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
137
|
-
<w:docDefaults>
|
|
138
|
-
<w:rPrDefault><w:rPr>
|
|
139
|
-
<w:rFonts w:ascii="Times New Roman" w:eastAsia="宋体" w:hAnsi="Times New Roman"/>
|
|
140
|
-
<w:sz w:val="24"/><w:szCs w:val="24"/>
|
|
141
|
-
</w:rPr></w:rPrDefault>
|
|
142
|
-
<w:pPrDefault><w:pPr><w:spacing w:line="360" w:lineRule="auto"/></w:pPr></w:pPrDefault>
|
|
143
|
-
</w:docDefaults>
|
|
144
|
-
<w:style w:type="paragraph" w:styleId="Normal"><w:name w:val="Normal"/></w:style>
|
|
145
|
-
<w:style w:type="paragraph" w:styleId="TitlePage">
|
|
146
|
-
<w:name w:val="Title Page"/>
|
|
147
|
-
<w:pPr><w:jc w:val="center"/><w:spacing w:before="1200" w:after="240"/></w:pPr>
|
|
148
|
-
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="44"/><w:szCs w:val="44"/></w:rPr>
|
|
149
|
-
</w:style>
|
|
150
|
-
<w:style w:type="paragraph" w:styleId="Subtitle">
|
|
151
|
-
<w:name w:val="Subtitle"/>
|
|
152
|
-
<w:pPr><w:jc w:val="center"/><w:spacing w:after="240"/></w:pPr>
|
|
153
|
-
<w:rPr><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr>
|
|
154
|
-
</w:style>
|
|
155
|
-
<w:style w:type="paragraph" w:styleId="Heading1">
|
|
156
|
-
<w:name w:val="heading 1"/>
|
|
157
|
-
<w:pPr><w:spacing w:before="240" w:after="120"/></w:pPr>
|
|
158
|
-
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr>
|
|
159
|
-
</w:style>
|
|
160
|
-
<w:style w:type="paragraph" w:styleId="Heading2">
|
|
161
|
-
<w:name w:val="heading 2"/>
|
|
162
|
-
<w:pPr><w:spacing w:before="200" w:after="100"/></w:pPr>
|
|
163
|
-
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr>
|
|
164
|
-
</w:style>
|
|
165
|
-
<w:style w:type="paragraph" w:styleId="Heading3">
|
|
166
|
-
<w:name w:val="heading 3"/>
|
|
167
|
-
<w:pPr><w:spacing w:before="160" w:after="80"/></w:pPr>
|
|
168
|
-
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="26"/><w:szCs w:val="26"/></w:rPr>
|
|
169
|
-
</w:style>
|
|
170
|
-
<w:style w:type="paragraph" w:styleId="ListBullet"><w:name w:val="List Bullet"/></w:style>
|
|
171
|
-
<w:style w:type="table" w:styleId="TableGrid">
|
|
172
|
-
<w:name w:val="Table Grid"/>
|
|
173
|
-
<w:tblPr>
|
|
174
|
-
<w:tblBorders>
|
|
175
|
-
<w:top w:val="single" w:sz="4" w:color="000000"/>
|
|
176
|
-
<w:left w:val="single" w:sz="4" w:color="000000"/>
|
|
177
|
-
<w:bottom w:val="single" w:sz="4" w:color="000000"/>
|
|
178
|
-
<w:right w:val="single" w:sz="4" w:color="000000"/>
|
|
179
|
-
<w:insideH w:val="single" w:sz="4" w:color="000000"/>
|
|
180
|
-
<w:insideV w:val="single" w:sz="4" w:color="000000"/>
|
|
181
|
-
</w:tblBorders>
|
|
182
|
-
</w:tblPr>
|
|
183
|
-
</w:style>
|
|
184
|
-
</w:styles>
|
|
135
|
+
const STYLES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
136
|
+
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
137
|
+
<w:docDefaults>
|
|
138
|
+
<w:rPrDefault><w:rPr>
|
|
139
|
+
<w:rFonts w:ascii="Times New Roman" w:eastAsia="宋体" w:hAnsi="Times New Roman"/>
|
|
140
|
+
<w:sz w:val="24"/><w:szCs w:val="24"/>
|
|
141
|
+
</w:rPr></w:rPrDefault>
|
|
142
|
+
<w:pPrDefault><w:pPr><w:spacing w:line="360" w:lineRule="auto"/></w:pPr></w:pPrDefault>
|
|
143
|
+
</w:docDefaults>
|
|
144
|
+
<w:style w:type="paragraph" w:styleId="Normal"><w:name w:val="Normal"/></w:style>
|
|
145
|
+
<w:style w:type="paragraph" w:styleId="TitlePage">
|
|
146
|
+
<w:name w:val="Title Page"/>
|
|
147
|
+
<w:pPr><w:jc w:val="center"/><w:spacing w:before="1200" w:after="240"/></w:pPr>
|
|
148
|
+
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="44"/><w:szCs w:val="44"/></w:rPr>
|
|
149
|
+
</w:style>
|
|
150
|
+
<w:style w:type="paragraph" w:styleId="Subtitle">
|
|
151
|
+
<w:name w:val="Subtitle"/>
|
|
152
|
+
<w:pPr><w:jc w:val="center"/><w:spacing w:after="240"/></w:pPr>
|
|
153
|
+
<w:rPr><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr>
|
|
154
|
+
</w:style>
|
|
155
|
+
<w:style w:type="paragraph" w:styleId="Heading1">
|
|
156
|
+
<w:name w:val="heading 1"/>
|
|
157
|
+
<w:pPr><w:spacing w:before="240" w:after="120"/></w:pPr>
|
|
158
|
+
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr>
|
|
159
|
+
</w:style>
|
|
160
|
+
<w:style w:type="paragraph" w:styleId="Heading2">
|
|
161
|
+
<w:name w:val="heading 2"/>
|
|
162
|
+
<w:pPr><w:spacing w:before="200" w:after="100"/></w:pPr>
|
|
163
|
+
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr>
|
|
164
|
+
</w:style>
|
|
165
|
+
<w:style w:type="paragraph" w:styleId="Heading3">
|
|
166
|
+
<w:name w:val="heading 3"/>
|
|
167
|
+
<w:pPr><w:spacing w:before="160" w:after="80"/></w:pPr>
|
|
168
|
+
<w:rPr><w:rFonts w:eastAsia="黑体"/><w:b/><w:sz w:val="26"/><w:szCs w:val="26"/></w:rPr>
|
|
169
|
+
</w:style>
|
|
170
|
+
<w:style w:type="paragraph" w:styleId="ListBullet"><w:name w:val="List Bullet"/></w:style>
|
|
171
|
+
<w:style w:type="table" w:styleId="TableGrid">
|
|
172
|
+
<w:name w:val="Table Grid"/>
|
|
173
|
+
<w:tblPr>
|
|
174
|
+
<w:tblBorders>
|
|
175
|
+
<w:top w:val="single" w:sz="4" w:color="000000"/>
|
|
176
|
+
<w:left w:val="single" w:sz="4" w:color="000000"/>
|
|
177
|
+
<w:bottom w:val="single" w:sz="4" w:color="000000"/>
|
|
178
|
+
<w:right w:val="single" w:sz="4" w:color="000000"/>
|
|
179
|
+
<w:insideH w:val="single" w:sz="4" w:color="000000"/>
|
|
180
|
+
<w:insideV w:val="single" w:sz="4" w:color="000000"/>
|
|
181
|
+
</w:tblBorders>
|
|
182
|
+
</w:tblPr>
|
|
183
|
+
</w:style>
|
|
184
|
+
</w:styles>
|
|
185
185
|
`;
|
|
186
186
|
/**
|
|
187
187
|
* 生成完整 .docx 字节。title 渲染为封面页;markdown 为正文(章节合并内容)。
|
|
@@ -194,13 +194,13 @@ export function buildDocx(opts) {
|
|
|
194
194
|
body.push('<w:p/>');
|
|
195
195
|
for (const block of blocks)
|
|
196
196
|
body.push(blockXml(block));
|
|
197
|
-
const document = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
198
|
-
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
199
|
-
<w:body>
|
|
200
|
-
${body.join('')}
|
|
201
|
-
<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"/></w:sectPr>
|
|
202
|
-
</w:body>
|
|
203
|
-
</w:document>
|
|
197
|
+
const document = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
198
|
+
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
199
|
+
<w:body>
|
|
200
|
+
${body.join('')}
|
|
201
|
+
<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"/></w:sectPr>
|
|
202
|
+
</w:body>
|
|
203
|
+
</w:document>
|
|
204
204
|
`;
|
|
205
205
|
const entries = [
|
|
206
206
|
{ name: '[Content_Types].xml', data: encoder.encode(CONTENT_TYPES) },
|