@xiaoso/dsh-tool-plus 0.1.0-beta.3 → 0.1.0-beta.4

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.
Files changed (155) hide show
  1. package/lib/abort-D1_Z5Ut5.mjs +51 -0
  2. package/lib/abort-dIkZBV7Q.mjs +51 -0
  3. package/lib/amazon-bedrock-B0nxT06F.mjs +917 -0
  4. package/lib/amazon-bedrock-WQhvjHYu.mjs +917 -0
  5. package/lib/anthropic-CJCauvYz.mjs +3115 -0
  6. package/lib/anthropic-CZghe_9U.mjs +3115 -0
  7. package/lib/anthropic-sCMH7JID.mjs +262 -0
  8. package/lib/anthropic-tTntD8BD.mjs +262 -0
  9. package/lib/api-key-login-BzqNdM2y.mjs +157 -0
  10. package/lib/api-key-login-CWVwvHT1.mjs +157 -0
  11. package/lib/aws-credentials-CXryMobh.mjs +867 -0
  12. package/lib/aws-credentials-ChG79ey-.mjs +867 -0
  13. package/lib/azure-openai-responses-Cgmc-rbL.mjs +274 -0
  14. package/lib/azure-openai-responses-DuukbD0F.mjs +274 -0
  15. package/lib/bun-shim.mjs +81 -6
  16. package/lib/bundled-references-Cavaffah.mjs +55 -0
  17. package/lib/bundled-references-sLN0YdXU.mjs +55 -0
  18. package/lib/callback-server-CQ5Jo8F-.mjs +398 -0
  19. package/lib/callback-server-DDSrZ6l_.mjs +398 -0
  20. package/lib/client.js +1 -1
  21. package/lib/cursor-B3zg7EHj.mjs +273 -0
  22. package/lib/cursor-B6TUEmgP.mjs +135 -0
  23. package/lib/cursor-D8gvtTL3.mjs +135 -0
  24. package/lib/cursor-DkSX2h3H.mjs +5441 -0
  25. package/lib/cursor-aJrXeYCb.mjs +273 -0
  26. package/lib/cursor-mJQwUKXK.mjs +5441 -0
  27. package/lib/device-code-DBo3B5nh.mjs +51 -0
  28. package/lib/device-code-DIb0FU-H.mjs +51 -0
  29. package/lib/devin-BHZZyMhO.mjs +95 -0
  30. package/lib/devin-BK7DHeca.mjs +114 -0
  31. package/lib/devin-CfMp3cXS.mjs +95 -0
  32. package/lib/devin-D9zR5B_R.mjs +542 -0
  33. package/lib/devin-Q1yem3lp.mjs +114 -0
  34. package/lib/devin-vNZTNUON.mjs +542 -0
  35. package/lib/error-Dd8DIqs-.mjs +1449 -0
  36. package/lib/error-yCSG0mGC.mjs +1449 -0
  37. package/lib/event-stream-BbFZJy-z.mjs +151 -0
  38. package/lib/event-stream-loUa0s1T.mjs +151 -0
  39. package/lib/fs-promises-shim-Bx0fpxuk.mjs +57 -0
  40. package/lib/github-copilot-B1yiyVRh.mjs +104 -0
  41. package/lib/github-copilot-BWT3eAOF.mjs +208 -0
  42. package/lib/github-copilot-CYkjeTi3.mjs +208 -0
  43. package/lib/github-copilot-jscUZ8Hf.mjs +104 -0
  44. package/lib/gitlab-duo-CM7Ref1H.mjs +155 -0
  45. package/lib/gitlab-duo-gubO4FNw.mjs +155 -0
  46. package/lib/gitlab-duo-workflow-BGAF6JDw.mjs +91 -0
  47. package/lib/gitlab-duo-workflow-D78tdn8E.mjs +91 -0
  48. package/lib/google-BS4T25Pn.mjs +30 -0
  49. package/lib/google-TFe-7-of.mjs +30 -0
  50. package/lib/google-antigravity-DGmwC2KV.mjs +198 -0
  51. package/lib/google-antigravity-DNYhgTpA.mjs +198 -0
  52. package/lib/google-auth-B6gjsZvg.mjs +232 -0
  53. package/lib/google-auth-De7_s3eo.mjs +232 -0
  54. package/lib/google-gemini-cli-CWu8HvXW.mjs +211 -0
  55. package/lib/google-gemini-cli-Cb97bzQc.mjs +850 -0
  56. package/lib/google-gemini-cli-Cqds_Q5T.mjs +850 -0
  57. package/lib/google-gemini-cli-Dsztq0N5.mjs +211 -0
  58. package/lib/google-oauth-shared-CuEHaDDj.mjs +147 -0
  59. package/lib/google-oauth-shared-yqlyqPPC.mjs +147 -0
  60. package/lib/google-shared-CgKmmdO3.mjs +760 -0
  61. package/lib/google-shared-Dr-VG-ap.mjs +760 -0
  62. package/lib/google-vertex-BDN2tLaD.mjs +99 -0
  63. package/lib/google-vertex-DopVOQOG.mjs +99 -0
  64. package/lib/identity-Da1GPU9a.mjs +219 -0
  65. package/lib/identity-xRP7_eSR.mjs +219 -0
  66. package/lib/idle-iterator-Baoyn3Hp.mjs +366 -0
  67. package/lib/idle-iterator-DUjKQEGT.mjs +366 -0
  68. package/lib/index.mjs +1731 -1178
  69. package/lib/kimi--wUOWER5.mjs +236 -0
  70. package/lib/kimi-Dh0pv3WZ.mjs +236 -0
  71. package/lib/markit-BL3cH47U.mjs +1417 -0
  72. package/lib/markit-BNiNY6SE.mjs +1417 -0
  73. package/lib/minimax-code-DCbuA6Yk.mjs +53 -0
  74. package/lib/minimax-code-Uq8Qu9LW.mjs +53 -0
  75. package/lib/models-D_XnT6ay.mjs +104660 -0
  76. package/lib/models-SGASygJ3.mjs +104660 -0
  77. package/lib/ollama-DPzBmq89.mjs +589 -0
  78. package/lib/ollama-DoBz5SFm.mjs +589 -0
  79. package/lib/openai-codex-Bi-4S4PX.mjs +255 -0
  80. package/lib/openai-codex-Ch8CkT3p.mjs +255 -0
  81. package/lib/openai-codex-responses-CvxL_FMF.mjs +3144 -0
  82. package/lib/openai-codex-responses-pejZgdZo.mjs +3144 -0
  83. package/lib/openai-completions-CF8IyNtP.mjs +1360 -0
  84. package/lib/openai-completions-DIf361kF.mjs +1360 -0
  85. package/lib/openai-reasoning-fallback-Nj6yB2rY.mjs +286 -0
  86. package/lib/openai-reasoning-fallback-OdJREP1o.mjs +286 -0
  87. package/lib/openai-responses-BqXJInHX.mjs +867 -0
  88. package/lib/openai-responses-Db_a-U4-.mjs +867 -0
  89. package/lib/opencode-DhMolSoB.mjs +38 -0
  90. package/lib/opencode-Rq_Q2vAO.mjs +38 -0
  91. package/lib/perplexity-C4iLVMUj.mjs +194 -0
  92. package/lib/perplexity-Uu7Jzg5b.mjs +194 -0
  93. package/lib/proxy-DDqrmjjC.mjs +190 -0
  94. package/lib/proxy-pM_NIv-H.mjs +190 -0
  95. package/lib/request-debug-HJMoJncL.mjs +183 -0
  96. package/lib/sanitize-text-CfcXzw5X.mjs +33 -0
  97. package/lib/scrapers-BkFfcPHj.mjs +9198 -0
  98. package/lib/scrapers-CVptboMs.mjs +9198 -0
  99. package/lib/scrapers-nhQAvc8d.mjs +9198 -0
  100. package/lib/shell-snapshot-fn-env.sh +67 -43
  101. package/lib/src-BgpusnsB.mjs +5076 -0
  102. package/lib/src-lDmkSRbm.mjs +5006 -0
  103. package/lib/stream-BlldLkVq.mjs +10236 -0
  104. package/lib/stream-CRtexYLe.mjs +10236 -0
  105. package/lib/stream-markup-healing-DMsxBx1L.mjs +491 -0
  106. package/lib/stream-markup-healing-KMkiAA00.mjs +491 -0
  107. package/lib/turndown-DN7ByzEI.mjs +667 -0
  108. package/lib/types/config/settings.d.ts +9 -1
  109. package/lib/types/config/truncate.d.ts +9 -5
  110. package/lib/types/tools/bash/background.d.ts +1 -1
  111. package/lib/types/tools/bash/bash-executor.d.ts +4 -0
  112. package/lib/types/tools/bash/bash-interceptor.d.ts +10 -8
  113. package/lib/types/tools/bash/cd-workdir.d.ts +35 -0
  114. package/lib/types/tools/bash/non-interactive-env.d.ts +2 -0
  115. package/lib/types/tools/bash/render.d.ts +4 -3
  116. package/lib/types/tools/bash/sanitize-text.d.ts +5 -0
  117. package/lib/types/tools/bash/shell-snapshot.d.ts +4 -1
  118. package/lib/types/tools/bash/shell-tokenize.d.ts +60 -0
  119. package/lib/types/tools/bash/streaming-output.d.ts +12 -212
  120. package/lib/types/tools/bash/which.d.ts +20 -0
  121. package/lib/types/tools/bash/windows-shell.d.ts +31 -0
  122. package/lib/types/tools/edit/adapter/index.d.ts +25 -3
  123. package/lib/types/tools/edit/adapter/tools/auto-generated-guard.d.ts +7 -17
  124. package/lib/types/tools/glob/adapter/index.d.ts +27 -1
  125. package/lib/types/tools/grep/adapter/index.d.ts +29 -1
  126. package/lib/types/tools/omp/edit/dispatch.d.ts +43 -0
  127. package/lib/types/tools/omp/edit/hashline/noop-loop-guard.d.ts +3 -1
  128. package/lib/types/tools/omp/tools/auto-generated-guard.d.ts +20 -0
  129. package/lib/types/tools/omp/tools/write.d.ts +4 -4
  130. package/lib/types/tools/shared/auto-generated-guard.dsh.d.ts +16 -4
  131. package/lib/types/tools/shared/bun-shim.d.ts +4 -0
  132. package/lib/types/tools/shared/fs-promises-shim.d.ts +3 -1
  133. package/lib/types/tools/shared/omp-prompt.d.ts +13 -7
  134. package/lib/types/tools/shared/session-state.d.ts +9 -3
  135. package/lib/utils-Bw139LTz.mjs +8119 -0
  136. package/lib/utils-CZw4tVZQ.mjs +12315 -0
  137. package/lib/utils-CiGN7OHR.mjs +12315 -0
  138. package/lib/utils-Cp76gCyk.mjs +8119 -0
  139. package/lib/utils-D0GRDgAr.mjs +12315 -0
  140. package/lib/utils-D2YknRk4.mjs +51 -0
  141. package/lib/utils-DzXZDfYc.mjs +51 -0
  142. package/lib/vision-guard-01qSwFpf.mjs +92 -0
  143. package/lib/vision-guard-DzZGaOga.mjs +92 -0
  144. package/lib/wafer-CgtPHerf.mjs +17 -0
  145. package/lib/wafer-cBtrn6q9.mjs +17 -0
  146. package/lib/xai-oauth-Buk8XVvM.mjs +446 -0
  147. package/lib/xai-oauth-CMal8l1O.mjs +446 -0
  148. package/lib/xiaomi-CZgwvX2G.mjs +157 -0
  149. package/lib/xiaomi-D2qT5cAC.mjs +157 -0
  150. package/lib/zai-7DWMkEqM.mjs +203 -0
  151. package/lib/zai-C59YnomG.mjs +203 -0
  152. package/lib/zip-Cg9ANN_U.mjs +1316 -0
  153. package/lib/zip-D36ZKsP8.mjs +1316 -0
  154. package/package.json +1 -1
  155. package/presets/package.json +1 -1
@@ -0,0 +1,667 @@
1
+ import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
+ __installBunShim();
3
+ import { r as __exportAll } from "./fs-promises-shim-Bx0fpxuk.mjs";
4
+ //#region node_modules/.pnpm/@oh-my-pi+pi-utils@17.3.5/node_modules/@oh-my-pi/pi-utils/src/turndown/gfm.ts
5
+ function descendantElements(node, name) {
6
+ const matches = [];
7
+ for (const child of Array.from(node.children)) {
8
+ if (child.nodeName === name) matches.push(child);
9
+ if (child.nodeName !== "TABLE") matches.push(...descendantElements(child, name));
10
+ }
11
+ return matches;
12
+ }
13
+ function isHeadingTable(node) {
14
+ if (node.nodeName !== "TABLE") return false;
15
+ const firstRow = descendantElements(node, "TR")[0];
16
+ if (!firstRow) return false;
17
+ const cells = Array.from(firstRow.children);
18
+ return cells.length > 0 && cells.every((cell) => cell.nodeName === "TH");
19
+ }
20
+ function cellAlignment(cell) {
21
+ const explicit = cell.getAttribute("align")?.toLowerCase();
22
+ if (explicit === "left" || explicit === "center" || explicit === "right") return explicit;
23
+ const style = cell.getAttribute("style") ?? "";
24
+ const styled = /(?:^|;)\s*text-align\s*:\s*(left|center|right)\s*(?:;|$)/i.exec(style)?.[1]?.toLowerCase();
25
+ return styled === "left" || styled === "center" || styled === "right" ? styled : void 0;
26
+ }
27
+ function alignmentMarker(cell) {
28
+ const alignment = cellAlignment(cell);
29
+ if (alignment === "left") return ":--";
30
+ if (alignment === "center") return ":-:";
31
+ if (alignment === "right") return "--:";
32
+ return "---";
33
+ }
34
+ function renderTable(service, table) {
35
+ const rows = descendantElements(table, "TR");
36
+ const rendered = [];
37
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
38
+ const row = rows[rowIndex];
39
+ if (!row) continue;
40
+ const cells = Array.from(row.children).filter((cell) => cell.nodeName === "TH" || cell.nodeName === "TD");
41
+ const values = cells.map((cell) => service.convertChildren(cell).trim());
42
+ rendered.push(`| ${values.join(" | ")} |`);
43
+ if (rowIndex === 0) rendered.push(`| ${cells.map(alignmentMarker).join(" | ")} |`);
44
+ }
45
+ return `\n\n${rendered.join("\n")}\n\n`;
46
+ }
47
+ /** Install GitHub fenced code blocks selected by `highlight-source-*` wrappers. */
48
+ const highlightedCodeBlock = (service) => {
49
+ service.addRule("highlightedCodeBlock", {
50
+ filter(node) {
51
+ return node.nodeName === "DIV" && /(?:^|\s)highlight-source-([^\s]+)/.test(node.getAttribute("class") ?? "");
52
+ },
53
+ replacement(_content, node, options) {
54
+ const language = /(?:^|\s)highlight-source-([^\s]+)/.exec(node.getAttribute("class") ?? "")?.[1] ?? "";
55
+ const text = descendantElements(node, "PRE")[0]?.textContent ?? "";
56
+ return `\n\n${options.fence}${language}\n${text}\n${options.fence}\n\n`;
57
+ }
58
+ });
59
+ };
60
+ /** Install GFM strikethrough conversion. */
61
+ const strikethrough = (service) => {
62
+ service.addRule("strikethrough", {
63
+ filter: [
64
+ "del",
65
+ "s",
66
+ "strike"
67
+ ],
68
+ replacement(content) {
69
+ return `~${content}~`;
70
+ }
71
+ });
72
+ };
73
+ /** Install GFM task-list checkbox conversion. */
74
+ const taskListItems = (service) => {
75
+ service.addRule("taskListItems", {
76
+ filter(node) {
77
+ return node.nodeName === "INPUT" && node.parentNode?.nodeName === "LI" && (node.getAttribute("type") ?? "").toLowerCase() === "checkbox";
78
+ },
79
+ replacement(_content, node) {
80
+ return node.hasAttribute("checked") ? "[x] " : "[ ] ";
81
+ }
82
+ });
83
+ };
84
+ /** Install GFM table conversion for tables with a heading row. */
85
+ const tables = (service) => {
86
+ service.addRule("table", {
87
+ filter: isHeadingTable,
88
+ replacement(_content, node) {
89
+ return renderTable(service, node);
90
+ }
91
+ });
92
+ };
93
+ /** Install every GFM rule used by the coding agent. */
94
+ const gfm = (service) => {
95
+ highlightedCodeBlock(service);
96
+ strikethrough(service);
97
+ tables(service);
98
+ taskListItems(service);
99
+ };
100
+ //#endregion
101
+ //#region node_modules/.pnpm/@oh-my-pi+pi-utils@17.3.5/node_modules/@oh-my-pi/pi-utils/src/turndown/html.ts
102
+ const VOID_ELEMENTS = {
103
+ AREA: true,
104
+ BASE: true,
105
+ BR: true,
106
+ COL: true,
107
+ EMBED: true,
108
+ HR: true,
109
+ IMG: true,
110
+ INPUT: true,
111
+ LINK: true,
112
+ META: true,
113
+ PARAM: true,
114
+ SOURCE: true,
115
+ TRACK: true,
116
+ WBR: true
117
+ };
118
+ const NAMED_ENTITIES = {
119
+ amp: "&",
120
+ apos: "'",
121
+ copy: "©",
122
+ gt: ">",
123
+ hellip: "…",
124
+ laquo: "«",
125
+ lt: "<",
126
+ mdash: "—",
127
+ nbsp: "\xA0",
128
+ ndash: "–",
129
+ quot: "\"",
130
+ raquo: "»",
131
+ reg: "®"
132
+ };
133
+ function decodeEntities(value) {
134
+ return value.replace(/&(#(?:x[\da-f]+|\d+)|[a-z][\da-z]+);?/gi, (entity, name) => {
135
+ if (name.charAt(0) === "#") {
136
+ const hexadecimal = name.charAt(1).toLowerCase() === "x";
137
+ const number = Number.parseInt(name.slice(hexadecimal ? 2 : 1), hexadecimal ? 16 : 10);
138
+ if (!Number.isFinite(number) || number <= 0 || number > 1114111) return entity;
139
+ try {
140
+ return String.fromCodePoint(number);
141
+ } catch {
142
+ return "�";
143
+ }
144
+ }
145
+ return NAMED_ENTITIES[name.toLowerCase()] ?? entity;
146
+ });
147
+ }
148
+ function escapeAttribute(value) {
149
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
150
+ }
151
+ var HtmlNode = class {
152
+ parentNode = null;
153
+ childNodes = [];
154
+ get children() {
155
+ return this.childNodes.filter((child) => child.nodeType === 1);
156
+ }
157
+ get firstChild() {
158
+ return this.childNodes[0] ?? null;
159
+ }
160
+ get lastChild() {
161
+ return this.childNodes[this.childNodes.length - 1] ?? null;
162
+ }
163
+ get previousSibling() {
164
+ if (!this.parentNode) return null;
165
+ const index = this.parentNode.childNodes.indexOf(this);
166
+ return index > 0 ? this.parentNode.childNodes[index - 1] ?? null : null;
167
+ }
168
+ get nextSibling() {
169
+ if (!this.parentNode) return null;
170
+ const index = this.parentNode.childNodes.indexOf(this);
171
+ return index >= 0 ? this.parentNode.childNodes[index + 1] ?? null : null;
172
+ }
173
+ get textContent() {
174
+ return this.childNodes.map((child) => child.textContent).join("");
175
+ }
176
+ getAttribute(_name) {
177
+ return null;
178
+ }
179
+ hasAttribute(_name) {
180
+ return false;
181
+ }
182
+ append(child) {
183
+ child.parentNode = this;
184
+ this.childNodes.push(child);
185
+ }
186
+ };
187
+ var HtmlText = class extends HtmlNode {
188
+ nodeType = 3;
189
+ nodeName = "#text";
190
+ value;
191
+ constructor(value) {
192
+ super();
193
+ this.value = value;
194
+ }
195
+ get textContent() {
196
+ return this.value;
197
+ }
198
+ get outerHTML() {
199
+ return this.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
200
+ }
201
+ };
202
+ var HtmlElement = class extends HtmlNode {
203
+ nodeType = 1;
204
+ nodeName;
205
+ #attributes;
206
+ constructor(name, attributes) {
207
+ super();
208
+ this.nodeName = name.toUpperCase();
209
+ this.#attributes = attributes;
210
+ }
211
+ getAttribute(name) {
212
+ return this.#attributes.get(name.toLowerCase()) ?? null;
213
+ }
214
+ hasAttribute(name) {
215
+ return this.#attributes.has(name.toLowerCase());
216
+ }
217
+ get outerHTML() {
218
+ const tag = this.nodeName.toLowerCase();
219
+ const attributes = [...this.#attributes].map(([name, value]) => value === "" ? name : `${name}="${escapeAttribute(value)}"`).join(" ");
220
+ const opening = `<${tag}${attributes ? ` ${attributes}` : ""}>`;
221
+ if (VOID_ELEMENTS[this.nodeName]) return opening;
222
+ return `${opening}${this.childNodes.map((child) => child.outerHTML).join("")}</${tag}>`;
223
+ }
224
+ };
225
+ var HtmlFragment = class extends HtmlNode {
226
+ nodeType = 11;
227
+ nodeName = "#document-fragment";
228
+ get outerHTML() {
229
+ return this.childNodes.map((child) => child.outerHTML).join("");
230
+ }
231
+ };
232
+ function parseAttributes(source) {
233
+ const attributes = /* @__PURE__ */ new Map();
234
+ for (const match of source.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)) {
235
+ const name = match[1]?.toLowerCase();
236
+ if (!name) continue;
237
+ attributes.set(name, decodeEntities(match[2] ?? match[3] ?? match[4] ?? ""));
238
+ }
239
+ return attributes;
240
+ }
241
+ function* htmlTokens(html) {
242
+ let cursor = 0;
243
+ while (cursor < html.length) {
244
+ if (html.charAt(cursor) !== "<") {
245
+ const nextTag = html.indexOf("<", cursor);
246
+ const end = nextTag < 0 ? html.length : nextTag;
247
+ yield html.slice(cursor, end);
248
+ cursor = end;
249
+ continue;
250
+ }
251
+ if (!/[/!a-z]/i.test(html.charAt(cursor + 1))) {
252
+ yield "<";
253
+ cursor++;
254
+ continue;
255
+ }
256
+ if (html.startsWith("<!--", cursor)) {
257
+ const commentEnd = html.indexOf("-->", cursor + 4);
258
+ const end = commentEnd < 0 ? html.length : commentEnd + 3;
259
+ yield html.slice(cursor, end);
260
+ cursor = end;
261
+ continue;
262
+ }
263
+ let quote;
264
+ let tagEnd = cursor + 1;
265
+ for (; tagEnd < html.length; tagEnd++) {
266
+ const character = html.charAt(tagEnd);
267
+ if (quote) {
268
+ if (character === quote) quote = void 0;
269
+ } else if (character === "\"" || character === "'") quote = character;
270
+ else if (character === ">") break;
271
+ }
272
+ if (tagEnd >= html.length) {
273
+ yield "<";
274
+ cursor++;
275
+ continue;
276
+ }
277
+ yield html.slice(cursor, tagEnd + 1);
278
+ cursor = tagEnd + 1;
279
+ }
280
+ }
281
+ /** Parse an HTML fragment into the small DOM subset needed by Turndown. */
282
+ function parseHtmlFragment(html) {
283
+ const root = new HtmlFragment();
284
+ const stack = [root];
285
+ for (const token of htmlTokens(html)) {
286
+ const parent = stack[stack.length - 1] ?? root;
287
+ if (token.startsWith("<!--") || /^<!/i.test(token)) continue;
288
+ if (!token.startsWith("<")) {
289
+ parent.append(new HtmlText(decodeEntities(token)));
290
+ continue;
291
+ }
292
+ const closing = /^<\/\s*([a-z][\w:-]*)[^>]*>$/i.exec(token);
293
+ if (closing) {
294
+ const name = closing[1]?.toUpperCase();
295
+ for (let index = stack.length - 1; index > 0; index--) {
296
+ if (stack[index]?.nodeName !== name) continue;
297
+ stack.length = index;
298
+ break;
299
+ }
300
+ continue;
301
+ }
302
+ const opening = /^<\s*([a-z][\w:-]*)([\s\S]*?)\/?\s*>$/i.exec(token);
303
+ if (!opening?.[1]) {
304
+ parent.append(new HtmlText("<"));
305
+ continue;
306
+ }
307
+ const element = new HtmlElement(opening[1], parseAttributes(opening[2] ?? ""));
308
+ parent.append(element);
309
+ if (!VOID_ELEMENTS[element.nodeName] && !/\/\s*>$/.test(token)) stack.push(element);
310
+ }
311
+ return root;
312
+ }
313
+ /** Serialize a standards-shaped or internal HTML node. */
314
+ function serializeNode(node) {
315
+ if (typeof node.outerHTML === "string") return node.outerHTML;
316
+ if (node.nodeType === 3) return node.textContent ?? "";
317
+ return Array.from(node.childNodes).map(serializeNode).join("");
318
+ }
319
+ //#endregion
320
+ //#region node_modules/.pnpm/@oh-my-pi+pi-utils@17.3.5/node_modules/@oh-my-pi/pi-utils/src/turndown/service.ts
321
+ const BLOCK_ELEMENTS = {
322
+ ADDRESS: true,
323
+ ARTICLE: true,
324
+ ASIDE: true,
325
+ BLOCKQUOTE: true,
326
+ BODY: true,
327
+ CANVAS: true,
328
+ CENTER: true,
329
+ DD: true,
330
+ DETAILS: true,
331
+ DIR: true,
332
+ DIV: true,
333
+ DL: true,
334
+ DT: true,
335
+ FIELDSET: true,
336
+ FIGCAPTION: true,
337
+ FIGURE: true,
338
+ FOOTER: true,
339
+ FORM: true,
340
+ FRAMESET: true,
341
+ H1: true,
342
+ H2: true,
343
+ H3: true,
344
+ H4: true,
345
+ H5: true,
346
+ H6: true,
347
+ HEADER: true,
348
+ HGROUP: true,
349
+ HR: true,
350
+ HTML: true,
351
+ ISINDEX: true,
352
+ LI: true,
353
+ MAIN: true,
354
+ MENU: true,
355
+ NAV: true,
356
+ NOFRAMES: true,
357
+ NOSCRIPT: true,
358
+ OL: true,
359
+ OUTPUT: true,
360
+ P: true,
361
+ PRE: true,
362
+ SECTION: true,
363
+ SUMMARY: true,
364
+ TABLE: true,
365
+ TBODY: true,
366
+ TD: true,
367
+ TFOOT: true,
368
+ TH: true,
369
+ THEAD: true,
370
+ TR: true,
371
+ UL: true
372
+ };
373
+ const NONBLANK_EMPTY_ELEMENTS = {
374
+ A: true,
375
+ AUDIO: true,
376
+ BR: true,
377
+ HR: true,
378
+ IFRAME: true,
379
+ IMG: true,
380
+ INPUT: true,
381
+ SCRIPT: true,
382
+ SOURCE: true,
383
+ TD: true,
384
+ TH: true,
385
+ VIDEO: true
386
+ };
387
+ const DEFAULT_OPTIONS = {
388
+ headingStyle: "setext",
389
+ hr: "* * *",
390
+ bulletListMarker: "*",
391
+ codeBlockStyle: "indented",
392
+ fence: "```",
393
+ emDelimiter: "_",
394
+ strongDelimiter: "**",
395
+ linkStyle: "inlined",
396
+ linkReferenceStyle: "full",
397
+ preformattedCode: false
398
+ };
399
+ function matchesFilter(filter, node, options) {
400
+ if (typeof filter === "function") return filter(node, options);
401
+ const name = node.nodeName.toLowerCase();
402
+ if (typeof filter === "string") return name === filter.toLowerCase();
403
+ return filter.some((tag) => name === tag.toLowerCase());
404
+ }
405
+ function contentWithFlankingWhitespace(content, delimiter) {
406
+ const leading = content.match(/^\s+/)?.[0] ?? "";
407
+ const trailing = content.match(/\s+$/)?.[0] ?? "";
408
+ const body = content.slice(leading.length, trailing ? -trailing.length : void 0);
409
+ return body ? `${leading}${delimiter}${body}${delimiter}${trailing}` : "";
410
+ }
411
+ function languageFromCode(node) {
412
+ const className = Array.from(node.children).find((child) => child.nodeName === "CODE")?.getAttribute("class") ?? "";
413
+ return /(?:^|\s)language-([^\s]+)/.exec(className)?.[1] ?? "";
414
+ }
415
+ function listItemPrefix(node, options) {
416
+ const parent = node.parentNode;
417
+ if (parent?.nodeName !== "OL") return `${options.bulletListMarker} `;
418
+ const start = Number(parent.getAttribute("start") ?? "1");
419
+ const siblings = Array.from(parent.children);
420
+ return `${(Number.isFinite(start) ? start : 1) + siblings.indexOf(node)}. `;
421
+ }
422
+ function hasNonblankDescendant(node) {
423
+ for (const child of Array.from(node.children)) if (NONBLANK_EMPTY_ELEMENTS[child.nodeName] || hasNonblankDescendant(child)) return true;
424
+ return false;
425
+ }
426
+ /** Convert HTML fragments to Markdown with extensible Turndown-compatible rules. */
427
+ var TurndownService = class {
428
+ options;
429
+ #rules = [];
430
+ #keepFilters = [];
431
+ #removeFilters = [];
432
+ #references = [];
433
+ #previousSourceWhitespace = false;
434
+ constructor(options = {}) {
435
+ this.options = {
436
+ ...DEFAULT_OPTIONS,
437
+ ...options
438
+ };
439
+ }
440
+ /** Install a highest-priority named conversion rule. */
441
+ addRule(key, rule) {
442
+ const previous = this.#rules.findIndex((entry) => entry.key === key);
443
+ if (previous >= 0) this.#rules.splice(previous, 1);
444
+ this.#rules.unshift({
445
+ key,
446
+ rule
447
+ });
448
+ return this;
449
+ }
450
+ /** Preserve matching elements as HTML when no custom rule handles them. */
451
+ keep(filter) {
452
+ this.#keepFilters.unshift(filter);
453
+ return this;
454
+ }
455
+ /** Drop matching elements and all of their converted content. */
456
+ remove(filter) {
457
+ this.#removeFilters.unshift(filter);
458
+ return this;
459
+ }
460
+ /** Install one plugin or an ordered list of plugins. */
461
+ use(plugin) {
462
+ if (typeof plugin === "function") plugin(this);
463
+ else for (const install of plugin) install(this);
464
+ return this;
465
+ }
466
+ /** Escape Markdown punctuation using Turndown's public escaping rules. */
467
+ escape(text) {
468
+ return text.replace(/\\/g, "\\\\").replace(/([*_[\]])/g, "\\$1").replace(/^(\s*)(#{1,6}|[+>])(?=\s)/gm, "$1\\$2").replace(/^(\s*)-(?=\s)/gm, "$1\\-").replace(/^(\s*\d+)\.(?=\s)/gm, "$1\\.");
469
+ }
470
+ /** Convert an HTML string or standards-shaped DOM node to Markdown. */
471
+ turndown(input) {
472
+ const root = typeof input === "string" ? parseHtmlFragment(input) : input;
473
+ this.#references = [];
474
+ this.#previousSourceWhitespace = false;
475
+ let markdown = root.nodeType === 9 || root.nodeType === 11 ? this.#convertChildren(root) : this.#convertNode(root);
476
+ markdown = markdown.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n ]+$/, "").replace(/\n{3,}/g, "\n\n");
477
+ if (this.#references.length > 0) markdown += `\n\n${this.#references.map((reference) => reference.destination).join("\n")}`;
478
+ return markdown;
479
+ }
480
+ /** Convert only a node's children within the active conversion. */
481
+ convertChildren(node) {
482
+ return this.#convertChildren(node);
483
+ }
484
+ #convertChildren(node) {
485
+ let content = "";
486
+ for (const child of Array.from(node.childNodes)) content += this.#convertNode(child);
487
+ return content;
488
+ }
489
+ #convertNode(node) {
490
+ if (node.nodeType === 3) {
491
+ const text = node.textContent ?? "";
492
+ if (node.parentNode?.nodeName === "PRE") return text;
493
+ let collapsed = text.replace(/[\t\r\n\f ]+/g, " ");
494
+ if (this.#previousSourceWhitespace && collapsed.startsWith(" ")) collapsed = collapsed.slice(1);
495
+ this.#previousSourceWhitespace = collapsed.endsWith(" ");
496
+ return node.parentNode?.nodeName === "CODE" ? collapsed : this.escape(collapsed);
497
+ }
498
+ if (node.nodeType !== 1) return this.#convertChildren(node);
499
+ if (!(node.textContent ?? "").trim() && !NONBLANK_EMPTY_ELEMENTS[node.nodeName] && !hasNonblankDescendant(node)) return this.options.blankReplacement?.("", node, this.options) ?? (BLOCK_ELEMENTS[node.nodeName] ? "\n\n" : "");
500
+ const block = Boolean(BLOCK_ELEMENTS[node.nodeName]);
501
+ if (block) this.#previousSourceWhitespace = false;
502
+ const content = this.#convertChildren(node);
503
+ if (block) this.#previousSourceWhitespace = false;
504
+ if (node.nodeName === "CODE") this.#previousSourceWhitespace = false;
505
+ const custom = this.#rules.find((entry) => matchesFilter(entry.rule.filter, node, this.options));
506
+ if (custom) return custom.rule.replacement(content, node, this.options);
507
+ if (this.#keepFilters.some((filter) => matchesFilter(filter, node, this.options))) return this.options.keepReplacement?.(content, node, this.options) ?? serializeNode(node);
508
+ if (this.#removeFilters.some((filter) => matchesFilter(filter, node, this.options))) return "";
509
+ return this.#defaultReplacement(content, node);
510
+ }
511
+ #defaultReplacement(content, node) {
512
+ const name = node.nodeName;
513
+ if (name === "P") return content.trim() ? `\n\n${content.trim()}\n\n` : "";
514
+ if (/^H[1-6]$/.test(name)) {
515
+ const level = Number(name.charAt(1));
516
+ const body = content.trim();
517
+ if (this.options.headingStyle === "setext" && level < 3) return `\n\n${body}\n${(level === 1 ? "=" : "-").repeat(body.length)}\n\n`;
518
+ return `\n\n${"#".repeat(level)} ${body}\n\n`;
519
+ }
520
+ if (name === "BR") return " \n";
521
+ if (name === "HR") return `\n\n${this.options.hr}\n\n`;
522
+ if (name === "BLOCKQUOTE") {
523
+ const body = content.trim().replace(/\n{3,}/g, "\n\n").replace(/^/gm, "> ");
524
+ return body ? `\n\n${body}\n\n` : "";
525
+ }
526
+ if (name === "UL" || name === "OL") {
527
+ const body = content.replace(/^\n+|\n+$/g, "");
528
+ return node.parentNode?.nodeName === "LI" ? `\n${body}` : `\n\n${body}\n\n`;
529
+ }
530
+ if (name === "LI") {
531
+ const body = content.replace(/^\n+/, "").replace(/\n+$/, "\n").replace(/\n/gm, "\n ");
532
+ return `${listItemPrefix(node, this.options)}${body}${node.nextSibling ? "\n" : ""}`;
533
+ }
534
+ if (name === "PRE" && Array.from(node.children).some((child) => child.nodeName === "CODE")) return this.#replacePre(node);
535
+ if (name === "EM" || name === "I") return contentWithFlankingWhitespace(content, this.options.emDelimiter);
536
+ if (name === "STRONG" || name === "B") return contentWithFlankingWhitespace(content, this.options.strongDelimiter);
537
+ if (name === "CODE") return this.#replaceInlineCode(content);
538
+ if (name === "A") return this.#replaceLink(content, node);
539
+ if (name === "IMG") return this.#replaceImage(node);
540
+ if (this.options.defaultReplacement) return this.options.defaultReplacement(content, node, this.options);
541
+ if (BLOCK_ELEMENTS[name]) return content.trim() ? `\n\n${content.trim()}\n\n` : "";
542
+ return content;
543
+ }
544
+ #replacePre(node) {
545
+ const text = node.textContent ?? "";
546
+ if (this.options.codeBlockStyle === "indented") return `\n\n${text.replace(/^/gm, " ")}\n\n`;
547
+ const fenceCharacter = this.options.fence.charAt(0);
548
+ let longestFence = this.options.fence.length;
549
+ let run = 0;
550
+ for (const character of text) {
551
+ run = character === fenceCharacter ? run + 1 : 0;
552
+ longestFence = Math.max(longestFence, run + 1);
553
+ }
554
+ const fence = fenceCharacter.repeat(longestFence);
555
+ const body = text.replace(/\n$/, "");
556
+ return `\n\n${fence}${languageFromCode(node)}\n${body}\n${fence}\n\n`;
557
+ }
558
+ #replaceInlineCode(text) {
559
+ const body = text.trim();
560
+ if (!body) return "";
561
+ let longestRun = 0;
562
+ let run = 0;
563
+ for (const character of body) {
564
+ run = character === "`" ? run + 1 : 0;
565
+ longestRun = Math.max(longestRun, run);
566
+ }
567
+ const delimiter = "`".repeat(longestRun + 1);
568
+ const padding = /^`|`$/.test(body) ? " " : "";
569
+ return `${delimiter}${padding}${body}${padding}${delimiter}`;
570
+ }
571
+ #replaceLink(content, node) {
572
+ const href = (node.getAttribute("href") ?? "").replace(/([()<>])/g, "\\$1");
573
+ const title = node.getAttribute("title");
574
+ const destination = `${href}${title ? ` "${title.replace(/"/g, "\\\"")}"` : ""}`;
575
+ if (this.options.linkStyle !== "referenced") return `[${content}](${destination})`;
576
+ const referenceNumber = this.#references.length + 1;
577
+ let label = String(referenceNumber);
578
+ if (this.options.linkReferenceStyle === "collapsed") label = "";
579
+ if (this.options.linkReferenceStyle === "shortcut") label = content;
580
+ const marker = this.options.linkReferenceStyle === "shortcut" ? `[${content}]` : `[${content}][${label}]`;
581
+ this.#references.push({ destination: `[${label || content}]: ${destination}` });
582
+ return marker;
583
+ }
584
+ #replaceImage(node) {
585
+ const source = (node.getAttribute("src") ?? "").replace(/([()<>])/g, "\\$1");
586
+ if (!source) return "";
587
+ const alternative = this.escape(node.getAttribute("alt") ?? "");
588
+ const title = node.getAttribute("title");
589
+ return `![${alternative}](${source}${title ? ` "${title.replace(/"/g, "\\\"")}"` : ""})`;
590
+ }
591
+ };
592
+ //#endregion
593
+ //#region src/tools/omp/utils/turndown.ts
594
+ var turndown_exports = /* @__PURE__ */ __exportAll({
595
+ createTurndown: () => createTurndown,
596
+ normalizeTablesHtml: () => normalizeTablesHtml
597
+ });
598
+ /**
599
+ * Build a Turndown instance configured for GFM with the fixes omp relies on:
600
+ * `~~strikethrough~~`, unescaped heading periods, and single-space list markers.
601
+ *
602
+ * Shared by the web scrapers (HTML → markdown) and the markit document engine
603
+ * (`src/markit`). The rule set must stay identical across both call sites.
604
+ */
605
+ function createTurndown() {
606
+ const turndown = new TurndownService({
607
+ headingStyle: "atx",
608
+ codeBlockStyle: "fenced",
609
+ bulletListMarker: "-"
610
+ });
611
+ turndown.use(gfm);
612
+ turndown.addRule("strikethrough", {
613
+ filter: [
614
+ "del",
615
+ "s",
616
+ "strike"
617
+ ],
618
+ replacement(content) {
619
+ return `~~${content}~~`;
620
+ }
621
+ });
622
+ turndown.addRule("heading", {
623
+ filter: [
624
+ "h1",
625
+ "h2",
626
+ "h3",
627
+ "h4",
628
+ "h5",
629
+ "h6"
630
+ ],
631
+ replacement(content, node) {
632
+ const level = Number(node.nodeName.charAt(1));
633
+ return `\n\n${"#".repeat(level)} ${content.replace(/\\([.])/g, "$1").trim()}\n\n`;
634
+ }
635
+ });
636
+ turndown.addRule("listItem", {
637
+ filter: "li",
638
+ replacement(content, node, options) {
639
+ const body = content.replace(/^\n+/, "").replace(/\n+$/, "\n").replace(/\n/gm, "\n ");
640
+ const parent = node.parentNode;
641
+ let prefix = `${options.bulletListMarker} `;
642
+ if (parent?.nodeName === "OL") {
643
+ const start = parent.getAttribute("start");
644
+ const index = Array.prototype.indexOf.call(parent.children, node);
645
+ prefix = `${(start ? Number(start) : 1) + index}. `;
646
+ }
647
+ return prefix + body + (node.nextSibling ? "\n" : "");
648
+ }
649
+ });
650
+ return turndown;
651
+ }
652
+ /**
653
+ * Normalize HTML tables so turndown-plugin-gfm can render them:
654
+ * - strip `<p>` tags inside `<td>`/`<th>` cells (joining paragraphs with a space)
655
+ * - wrap the first row in `<thead>` when missing
656
+ */
657
+ function normalizeTablesHtml(html) {
658
+ let result = html.replace(/<(td|th)([^>]*)>([\s\S]*?)<\/(td|th)>/gi, (_match, tag, attrs, inner, closeTag) => {
659
+ return `<${tag}${attrs}>${inner.replace(/^\s*<p>/i, "").replace(/<\/p>\s*$/i, "").replace(/<\/p>\s*<p>/gi, " ")}</${closeTag}>`;
660
+ });
661
+ result = result.replace(/<table([^>]*)>\s*(?:<tbody>\s*)?(<tr[\s\S]*?<\/tr>)([\s\S]*?)<\/(?:tbody>\s*<\/)?table>/gi, (_match, attrs, firstRow, rest) => {
662
+ return `<table${attrs}><thead>${firstRow.replace(/<td/gi, "<th").replace(/<\/td>/gi, "</th>")}</thead><tbody>${rest}</tbody></table>`;
663
+ });
664
+ return result;
665
+ }
666
+ //#endregion
667
+ export { normalizeTablesHtml as n, turndown_exports as r, createTurndown as t };
@@ -95,7 +95,15 @@ export interface RuntimeConfig {
95
95
  export declare const BASH_PLUS_SETTINGS_NS: import("@deepseek-ai/dsh-settings").SettingsNamespace;
96
96
  /** OMP-parity defaults for the completion-message truncation policy. */
97
97
  export declare const DEFAULT_OUTPUT_TRUNCATE: OutputTruncateConfig;
98
- /** OMP-parity defaults for the timing knobs (timeouts in ms; OMP uses seconds). */
98
+ /**
99
+ * Timing knobs (ms). DEFAULT_MAX_TIMEOUT_MS is OMP-parity (= upstream bash
100
+ * per-tool max 3600s); DEFAULT_TIMEOUT_MS was deliberately relaxed from
101
+ * 300_000 to 3_600_000 with the bash-plus settings card (763023e,
102
+ * 2026-08-19) — NOT OMP-parity (OMP bash default is 300s), compensated by
103
+ * auto-backgrounding after DEFAULT_AUTO_BACKGROUND_MS. By design there is no
104
+ * upstream `tools.maxTimeout` global-cap equivalent: maxTimeoutMs always
105
+ * applies. (second-impl-audit.md S-11 终局, 2026-08-29.)
106
+ */
99
107
  export declare const DEFAULT_TIMEOUT_MS = 3600000;
100
108
  export declare const DEFAULT_MAX_TIMEOUT_MS = 3600000;
101
109
  export declare const DEFAULT_AUTO_BACKGROUND_MS = 60000;