@eddyskywalker/dsh-chatgpt-subscription 0.27.0 → 0.27.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/CHANGELOG.md +13 -0
- package/lib/client.js +119 -6
- package/lib/client.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/types/client/progress-updates/markdown-lite.d.ts +30 -4
- package/lib/types/client/progress-updates/markdown-lite.d.ts.map +1 -1
- package/lib/types/client/progress-updates/progress-row.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -62222,7 +62222,7 @@ function createProgressUpdateTool(deps) {
|
|
|
62222
62222
|
message: {
|
|
62223
62223
|
type: "string",
|
|
62224
62224
|
required: true,
|
|
62225
|
-
description: "The details, about 1000 characters at most, in light Markdown: one paragraph of prose plus a few bullets."
|
|
62225
|
+
description: "The details, about 1000 characters at most, in light Markdown: one paragraph of prose plus a few bullets. Tables are supported: when several items share fields, use a GFM pipe table (header row plus a | --- | separator row) instead of one item per line."
|
|
62226
62226
|
}
|
|
62227
62227
|
},
|
|
62228
62228
|
output: {
|
|
@@ -62376,7 +62376,7 @@ const PROGRESS_GUIDANCE = [
|
|
|
62376
62376
|
"",
|
|
62377
62377
|
"怎么写:",
|
|
62378
62378
|
"- 每条给一行短标题(title,纯文本,不带 Markdown,不加结尾句号),细节放进正文(message)。",
|
|
62379
|
-
"- 正文用轻 Markdown:一段话说清发生了什么,必要时跟少量 bullet
|
|
62379
|
+
"- 正文用轻 Markdown:一段话说清发生了什么,必要时跟少量 bullet 列出要点。**有几行数据要对照时,用 GFM 管道符表格**(表头行 + `| --- |` 分隔行),不要写成排成一列的纯文本。",
|
|
62380
62380
|
"- 不要重复没有变化的状态:上一条报过的还在进行中,就不用再报一遍。",
|
|
62381
62381
|
"- 进展更新是给用户看的,不是给日志看的:写人话,别复述工具调用参数。",
|
|
62382
62382
|
"",
|
|
@@ -11,22 +11,28 @@
|
|
|
11
11
|
*
|
|
12
12
|
* ## 这个渲染器覆盖什么
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* 所以这里只做契约允许的那一小撮:
|
|
14
|
+
* 这里做的是模型汇报时**实际会写**的那一小撮:
|
|
16
15
|
*
|
|
17
16
|
* - 段落(空行分隔,段内换行保留)
|
|
18
17
|
* - `-` / `*` / `•` 开头的无序列表,以及 `1.` 开头的有序列表
|
|
18
|
+
* - GFM 表格(表头行 + 分隔行 + 数据行,支持 `:---` / `:---:` / `---:` 对齐)
|
|
19
19
|
* - 行内 `code`
|
|
20
20
|
* - `**粗体**`
|
|
21
21
|
* - `###` 标题(最多三级)
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* 表格是**后补**的:早先版本把它当「超出契约」排除了,结果模型写出来的管道符表格
|
|
24
|
+
* 整块落进段落分支、原样上屏(用户直接看到一堆竖线)。渲染一个表格的代价只是
|
|
25
|
+
* 一次前瞻扫描,远小于它被读错造成的损失。
|
|
26
|
+
*
|
|
27
|
+
* 仍然刻意**不做**图片、链接、原始 HTML、脚注与围栏代码块:这些要么需要安全过滤,
|
|
28
|
+
* 要么属于「进展汇报」这个场景不需要的重型排版。渲染结果全是 React 元素,不经过
|
|
25
29
|
* `dangerouslySetInnerHTML`,因此没有注入面。
|
|
26
30
|
*
|
|
27
31
|
* @module @eddyskywalker/dsh-chatgpt-subscription/client/progress-updates/markdown-lite
|
|
28
32
|
*/
|
|
29
33
|
import type { ReactNode } from 'react';
|
|
34
|
+
/** 表格里一列的对齐方式;GFM 分隔行的 `:---` / `:---:` / `---:` 决定。 */
|
|
35
|
+
export type ColumnAlign = 'left' | 'center' | 'right';
|
|
30
36
|
/** 块级解析的一个中间行类型。 */
|
|
31
37
|
type Block = {
|
|
32
38
|
kind: 'p';
|
|
@@ -41,7 +47,27 @@ type Block = {
|
|
|
41
47
|
kind: 'h';
|
|
42
48
|
level: number;
|
|
43
49
|
text: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'table';
|
|
52
|
+
header: string[];
|
|
53
|
+
aligns: ColumnAlign[];
|
|
54
|
+
rows: string[][];
|
|
44
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* 一行表格 → 单元格数组。
|
|
58
|
+
*
|
|
59
|
+
* 先按未转义的 `|` 切,再剥掉首尾因为 `| a | b |` 这种写法留下的空单元;
|
|
60
|
+
* `\|` 是单元格里的字面量竖线,切之前先换成占位符,切完再换回来。
|
|
61
|
+
* @param line - 表格的一行原文。
|
|
62
|
+
* @returns 去掉两侧空白的单元格。
|
|
63
|
+
*/
|
|
64
|
+
export declare function splitRow(line: string): string[];
|
|
65
|
+
/**
|
|
66
|
+
* 分隔行的每个单元格 → 对齐方式。
|
|
67
|
+
* @param line - 分隔行原文。
|
|
68
|
+
* @returns 与列一一对应的对齐方式;缺省 left。
|
|
69
|
+
*/
|
|
70
|
+
export declare function alignmentsOf(line: string): ColumnAlign[];
|
|
45
71
|
/**
|
|
46
72
|
* 把正文切成块。
|
|
47
73
|
* @param source - Markdown 原文。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-lite.d.ts","sourceRoot":"","sources":["../../../../src/client/progress-updates/markdown-lite.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"markdown-lite.d.ts","sourceRoot":"","sources":["../../../../src/client/progress-updates/markdown-lite.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAgCtC,wDAAwD;AACxD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAErD,oBAAoB;AACpB,KAAK,KAAK,GACN;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;CAAE,CAAA;AAKhF;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAM/C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAQxD;AAWD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,CA2EnD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAsElE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-row.d.ts","sourceRoot":"","sources":["../../../../src/client/progress-updates/progress-row.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"progress-row.d.ts","sourceRoot":"","sources":["../../../../src/client/progress-updates/progress-row.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc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