@twinsearth/dsh-fang 3.1.30 → 3.1.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twinsearth/dsh-fang",
3
- "version": "3.1.30",
3
+ "version": "3.1.31",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "dsh-Fang (瓮城) — mother/fork plugin development environment for DeepSeek Harness: one readonly mother, a disposable child dsh-Web per task.",
@@ -129,7 +129,7 @@ export const AUDIT = {
129
129
  RUNTIME_ERROR: 'runtime-error',
130
130
  }
131
131
 
132
- export const FANG_VERSION = '3.1.30'
132
+ export const FANG_VERSION = '3.1.31'
133
133
 
134
134
  /**
135
135
  * @typedef {object} ForkInfo
@@ -208,8 +208,11 @@ export function parseYamlSubset(text) {
208
208
  const key = inlineKey[1]
209
209
  const restValue = rest.slice(inlineKey[0].length).trim()
210
210
  const mapped = {}
211
- if (restValue.length > 0) mapped[key] = parseScalar(restValue)
212
- else {
211
+ if (restValue.length > 0) {
212
+ const [folded, nextIndex] = foldContinuations({ content: restValue }, index + 1, virtualIndent)
213
+ mapped[key] = parseScalar(folded)
214
+ index = nextIndex - 1
215
+ } else {
213
216
  const next = tokens[index + 1]
214
217
  if (next !== undefined && next.indent > virtualIndent) {
215
218
  const [child, nextIndex] = parseBlock(index + 1, next.indent)
@@ -232,8 +235,9 @@ export function parseYamlSubset(text) {
232
235
  const childKey = match[1]
233
236
  const childRest = String(match[2] ?? '').trim()
234
237
  if (childRest.length > 0) {
235
- mapped[childKey] = parseScalar(childRest)
236
- index += 1
238
+ const [folded, nextIndex] = foldContinuations({ content: childRest }, index + 1, virtualIndent)
239
+ mapped[childKey] = parseScalar(folded)
240
+ index = nextIndex
237
241
  continue
238
242
  }
239
243
  const nextToken = tokens[index + 1]
@@ -255,6 +259,26 @@ export function parseYamlSubset(text) {
255
259
  return [items, index]
256
260
  }
257
261
 
262
+ // v3.1.31:折行纯量(plain scalar continuation)。
263
+ // DSH 会把超长 description 折成多行,续行缩进更深、且既不是 "key:" 也不是 "- item"。
264
+ // 结构行(映射键/序列项)一律不吸收,避免吞掉兄弟节点。
265
+ const KEY_LINE = /^[A-Za-z0-9_$.-]+:(?:\s|$)/
266
+ const isStructural = (token) => isSequenceLine(token) || KEY_LINE.test(token.content)
267
+ const foldContinuations = (valueToken, startIndex, parentIndent) => {
268
+ const parts = []
269
+ let index = startIndex
270
+ while (index < tokens.length) {
271
+ const token = tokens[index]
272
+ if (token.indent <= parentIndent) break
273
+ if (isStructural(token)) break
274
+ parts.push(token.content)
275
+ index += 1
276
+ }
277
+ if (parts.length === 0) return [valueToken.content, startIndex]
278
+ const first = valueToken.content
279
+ const joined = [first, ...parts].join(" ")
280
+ return [joined, index]
281
+ }
258
282
  const parseMapping = (startIndex, indent) => {
259
283
  const mapping = {}
260
284
  let index = startIndex
@@ -270,8 +294,10 @@ export function parseYamlSubset(text) {
270
294
  const key = match[1]
271
295
  const rest = String(match[2] ?? '').trim()
272
296
  if (rest.length > 0) {
273
- mapping[key] = parseScalar(rest)
274
- index += 1
297
+ // v3.1.31:先吸收折行续行,再按纯量解析。
298
+ const [folded, nextIndex] = foldContinuations({ content: rest }, index + 1, indent)
299
+ mapping[key] = parseScalar(folded)
300
+ index = nextIndex
275
301
  continue
276
302
  }
277
303
  const next = tokens[index + 1]