@danceiny/gotry 0.0.1-rc.16 → 0.0.1-rc.18

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 (229) hide show
  1. package/README.md +161 -116
  2. package/README.zh-CN.md +173 -144
  3. package/bin/gotry-booking-copilot.js +53 -0
  4. package/bin/gotry-bootstrap.js +113 -66
  5. package/bin/gotry-inner.js +436 -70
  6. package/bin/gotry-runtime-resolution.d.ts +27 -0
  7. package/bin/gotry-runtime-resolution.js +50 -0
  8. package/bin/gotry.js +1 -1
  9. package/cordis.gotry-patch.yml +5 -1
  10. package/dist/capabilities/agent-reach-deep.js +1 -1
  11. package/dist/capabilities/agent-reach.js +1 -1
  12. package/dist/capabilities/anything.js +1 -1
  13. package/dist/capabilities/artifacts.js +1 -1
  14. package/dist/capabilities/effect.js +1 -1
  15. package/dist/capabilities/fact-log.js +1 -1
  16. package/dist/capabilities/flyai.js +20 -6
  17. package/dist/capabilities/hbcli.js +1 -1
  18. package/dist/capabilities/incident-log.js +1 -1
  19. package/dist/capabilities/model-override.js +18 -0
  20. package/dist/capabilities/opensky.js +1 -1
  21. package/dist/capabilities/resilience.js +1 -1
  22. package/dist/capabilities/session/action-cache.js +1 -1
  23. package/dist/capabilities/session/adapters/ctrip-flight.js +1 -1
  24. package/dist/capabilities/session/adapters/meituan-local.js +1 -1
  25. package/dist/capabilities/session/benchmark.js +1 -1
  26. package/dist/capabilities/session/extension-bridge.js +19 -6
  27. package/dist/capabilities/session/extension-channel.js +3 -3
  28. package/dist/capabilities/session/extension-distribution.js +234 -0
  29. package/dist/capabilities/session/extract.js +1 -1
  30. package/dist/capabilities/session/golden-score.js +92 -0
  31. package/dist/capabilities/session/health-watch.js +1 -1
  32. package/dist/capabilities/session/read-guard.js +1 -1
  33. package/dist/capabilities/session/static-flight-golden.js +137 -0
  34. package/dist/capabilities/session/transport.js +1 -1
  35. package/dist/capabilities/session/wizard.js +21 -251
  36. package/dist/capabilities/session-consent.js +1 -1
  37. package/dist/capabilities/session-login.js +11 -5
  38. package/dist/capabilities/session-search.js +46 -4
  39. package/dist/capabilities/weather.js +168 -46
  40. package/dist/data/session-golden-20.json +25 -0
  41. package/dist/data/sf-golden-manifest.json +102 -0
  42. package/dist/data/sf-static-routes.json +91 -0
  43. package/dist/scripts/action-cache-tests.js +1 -1
  44. package/dist/scripts/agent-planning-budget-e2e.js +227 -0
  45. package/dist/scripts/agent-planning-budget-tests.js +173 -0
  46. package/dist/scripts/agent-reach-deep-tests.js +1 -1
  47. package/dist/scripts/agent-reach-tests.js +1 -1
  48. package/dist/scripts/agent-reach-wrapper-tests.js +1 -1
  49. package/dist/scripts/anything-tests.js +1 -1
  50. package/dist/scripts/async-collect.js +1 -1
  51. package/dist/scripts/benchmark-environment-bridge-e2e.js +981 -0
  52. package/dist/scripts/benchmark-environment-bridge-tests.js +2544 -0
  53. package/dist/scripts/booking-copilot-availability-ledger-binding-tests.js +335 -0
  54. package/dist/scripts/booking-copilot-availability-policy-v2-tests.js +1355 -0
  55. package/dist/scripts/booking-copilot-bin-proof-tests.js +89 -0
  56. package/dist/scripts/booking-copilot-crossrepo-fixture-server.js +113 -0
  57. package/dist/scripts/booking-copilot-dsh-core-proof-tests.js +356 -0
  58. package/dist/scripts/booking-copilot-dsh-planner-proof-tests.js +557 -0
  59. package/dist/scripts/booking-copilot-dsh-plugin-proof-tests.js +140 -0
  60. package/dist/scripts/booking-copilot-event-sequence-concurrency-proof-tests.js +202 -0
  61. package/dist/scripts/booking-copilot-gap-code-contract-proof-tests.js +102 -0
  62. package/dist/scripts/booking-copilot-operation-ledger-concurrency-proof-tests.js +374 -0
  63. package/dist/scripts/booking-copilot-receipt-ledger-concurrency-proof-tests.js +447 -0
  64. package/dist/scripts/booking-copilot-runtime-proof-tests.js +205 -0
  65. package/dist/scripts/booking-copilot-server-proof-tests.js +317 -0
  66. package/dist/scripts/booking-copilot-startup-proof-tests.js +283 -0
  67. package/dist/scripts/booking-copilot-v2-runtime-proof-tests.js +3935 -0
  68. package/dist/scripts/booking-saga-tests.js +1 -1
  69. package/dist/scripts/booking-surface-contract-proof-tests.js +393 -0
  70. package/dist/scripts/booking-surface-v2-contract-proof-tests.js +1174 -0
  71. package/dist/scripts/bootstrap-tests.js +45 -39
  72. package/dist/scripts/build-changelog.js +1 -1
  73. package/dist/scripts/changelog-tests.js +1 -1
  74. package/dist/scripts/companion-tests.js +1 -1
  75. package/dist/scripts/diff-test.js +1 -1
  76. package/dist/scripts/dsh-runtime-closure-tests.js +225 -0
  77. package/dist/scripts/dsh-runtime-closure.js +150 -0
  78. package/dist/scripts/effect-tests.js +1 -1
  79. package/dist/scripts/engine-run.js +1 -1
  80. package/dist/scripts/engine-tests.js +1 -1
  81. package/dist/scripts/evaluation-cadence-tests.js +347 -0
  82. package/dist/scripts/evaluation-contract-tests.js +574 -0
  83. package/dist/scripts/extension-distribution-cli.js +35 -0
  84. package/dist/scripts/extension-distribution-tests.js +341 -0
  85. package/dist/scripts/extension-tests.js +128 -23
  86. package/dist/scripts/fact-gate-tests.js +1 -1
  87. package/dist/scripts/flyai-tests.js +1 -1
  88. package/dist/scripts/hbcli-e2e-tests.js +1 -1
  89. package/dist/scripts/hbcli-tests.js +1 -1
  90. package/dist/scripts/health-watch-cli.js +1 -1
  91. package/dist/scripts/i18n-tests.js +1 -1
  92. package/dist/scripts/incident-tests.js +1 -1
  93. package/dist/scripts/journey-tests.js +1 -1
  94. package/dist/scripts/ledger-tests.js +1 -1
  95. package/dist/scripts/ledger-workflow-crash.js +1 -1
  96. package/dist/scripts/memory-capture-tests.js +1 -1
  97. package/dist/scripts/memory-decay-tests.js +1 -1
  98. package/dist/scripts/memory-metrics.js +1 -1
  99. package/dist/scripts/memory-value-report.js +1 -1
  100. package/dist/scripts/model-override-e2e.js +176 -0
  101. package/dist/scripts/nightly-evidence-tests.js +1 -1
  102. package/dist/scripts/nightly-evidence.js +1 -1
  103. package/dist/scripts/nudge-digest.js +1 -1
  104. package/dist/scripts/onboarding-tests.js +21 -53
  105. package/dist/scripts/opensky-check.js +1 -1
  106. package/dist/scripts/opensky-tests.js +1 -1
  107. package/dist/scripts/pnpm-dsh-closure-proof.js +20 -0
  108. package/dist/scripts/price-drift-tests.js +1 -1
  109. package/dist/scripts/price-drift-watch.js +1 -1
  110. package/dist/scripts/probe-poi-tests.js +1 -1
  111. package/dist/scripts/product-metrics.js +1 -1
  112. package/dist/scripts/publish-preverify.js +40 -4
  113. package/dist/scripts/realtime-pricing-tests.js +1 -1
  114. package/dist/scripts/replay-async.js +1 -1
  115. package/dist/scripts/replay-real.js +1 -1
  116. package/dist/scripts/replay.js +1 -1
  117. package/dist/scripts/session-attach-diagnose.js +1 -1
  118. package/dist/scripts/session-attach-poc.js +1 -1
  119. package/dist/scripts/session-benchmark.js +1 -1
  120. package/dist/scripts/session-extract-tests.js +1 -1
  121. package/dist/scripts/session-login.js +1 -1
  122. package/dist/scripts/session-tests.js +70 -20
  123. package/dist/scripts/sf-live-benchmark.js +338 -0
  124. package/dist/scripts/sf-live-cli-tests.js +21 -0
  125. package/dist/scripts/sf-soft-score-tests.js +108 -0
  126. package/dist/scripts/sf-summary.js +93 -0
  127. package/dist/scripts/skeleton-check.js +1 -1
  128. package/dist/scripts/skeleton-integration-test.js +1 -1
  129. package/dist/scripts/skills-contract-tests.js +1 -1
  130. package/dist/scripts/smoke-session-gate-tests.js +29 -0
  131. package/dist/scripts/smoke.js +79 -33
  132. package/dist/scripts/state-cli-tests.js +1 -1
  133. package/dist/scripts/state-cli.js +1 -1
  134. package/dist/scripts/static-golden-tests.js +299 -0
  135. package/dist/scripts/time-eval-tests.js +1 -1
  136. package/dist/scripts/travel-timeline-tests.js +1 -1
  137. package/dist/scripts/unified-tests.js +1 -1
  138. package/dist/scripts/weather-tests.js +694 -44
  139. package/dist/scripts/z3-race-tests.js +1 -1
  140. package/dist/src/artifact-gate.js +1 -1
  141. package/dist/src/benchmark-agent-conformance.js +370 -0
  142. package/dist/src/benchmark-environment-bridge.js +384 -0
  143. package/dist/src/benchmark-headless-child-diagnostics.js +173 -0
  144. package/dist/src/benchmark-tool-isolation.js +124 -0
  145. package/dist/src/bookable-facts.js +1 -1
  146. package/dist/src/booking-saga.js +1 -1
  147. package/dist/src/booking-surface/availability-policy-v2.js +830 -0
  148. package/dist/src/booking-surface/canonical-schema.js +113 -0
  149. package/dist/src/booking-surface/contracts-v2.js +89 -0
  150. package/dist/src/booking-surface/contracts.js +46 -0
  151. package/dist/src/booking-surface/dsh-planner.js +453 -0
  152. package/dist/src/booking-surface/dsh-plugin.js +93 -0
  153. package/dist/src/booking-surface/error-codes.js +94 -0
  154. package/dist/src/booking-surface/index.js +15 -0
  155. package/dist/src/booking-surface/profile.js +68 -0
  156. package/dist/src/booking-surface/runtime-v2.js +1771 -0
  157. package/dist/src/booking-surface/runtime.js +351 -0
  158. package/dist/src/booking-surface/server-v2.js +334 -0
  159. package/dist/src/booking-surface/server.js +302 -0
  160. package/dist/src/booking-surface/startup.js +159 -0
  161. package/dist/src/booking-surface/validation-v2.js +319 -0
  162. package/dist/src/booking-surface/validation.js +809 -0
  163. package/dist/src/bridge.js +1 -1
  164. package/dist/src/companions.js +1 -1
  165. package/dist/src/contracts.js +1 -1
  166. package/dist/src/dsh-llm.js +1 -1
  167. package/dist/src/engine.js +1 -1
  168. package/dist/src/evaluation-cadence.js +234 -0
  169. package/dist/src/evaluation-contracts.js +906 -0
  170. package/dist/src/i18n.js +1 -1
  171. package/dist/src/index.js +50 -19
  172. package/dist/src/journey.js +1 -1
  173. package/dist/src/loop.js +1 -1
  174. package/dist/src/memory-capture.js +1 -1
  175. package/dist/src/memory-decay.js +1 -1
  176. package/dist/src/memory-utility.js +1 -1
  177. package/dist/src/mock-llm.js +1 -1
  178. package/dist/src/model.js +1 -1
  179. package/dist/src/realtime-pricing.js +1 -1
  180. package/dist/src/slot-spec.js +1 -1
  181. package/dist/src/state-ledger.js +2 -1
  182. package/dist/src/time-anchor.js +1 -1
  183. package/dist/src/tool-budget.js +136 -0
  184. package/dist/src/tool-packet.js +1 -1
  185. package/dist/src/travel-slots.js +1 -1
  186. package/dist/src/travel-timeline.js +1 -1
  187. package/dist/src/unified.js +1 -1
  188. package/dist/src/wish-pool.js +1 -1
  189. package/dist/src/z3-shared.js +1 -1
  190. package/extension/README.md +31 -7
  191. package/package.json +286 -11
  192. package/schemas/booking.surface.v1.schema.json +927 -0
  193. package/schemas/booking.surface.v2.schema.json +61 -0
  194. package/ts/capabilities/flyai.ts +16 -3
  195. package/ts/capabilities/session/extension-bridge.ts +37 -14
  196. package/ts/capabilities/session/extension-channel.ts +6 -3
  197. package/ts/capabilities/session/extension-distribution.ts +264 -0
  198. package/ts/capabilities/session/golden-score.ts +139 -0
  199. package/ts/capabilities/session/health-watch.ts +1 -1
  200. package/ts/capabilities/session/static-flight-golden.ts +209 -0
  201. package/ts/capabilities/session/wizard.ts +34 -176
  202. package/ts/capabilities/session-login.ts +15 -5
  203. package/ts/capabilities/session-search.ts +40 -3
  204. package/ts/capabilities/weather.ts +141 -52
  205. package/ts/package.json +3 -3
  206. package/ts/src/benchmark-agent-conformance.ts +448 -0
  207. package/ts/src/benchmark-environment-bridge.ts +348 -0
  208. package/ts/src/benchmark-headless-child-diagnostics.ts +184 -0
  209. package/ts/src/benchmark-tool-isolation.ts +166 -0
  210. package/ts/src/booking-surface/availability-policy-v2.ts +523 -0
  211. package/ts/src/booking-surface/canonical-schema.js +113 -0
  212. package/ts/src/booking-surface/contracts-v2.ts +118 -0
  213. package/ts/src/booking-surface/contracts.ts +380 -0
  214. package/ts/src/booking-surface/dsh-planner.ts +452 -0
  215. package/ts/src/booking-surface/dsh-plugin.js +93 -0
  216. package/ts/src/booking-surface/error-codes.ts +101 -0
  217. package/ts/src/booking-surface/index.ts +12 -0
  218. package/ts/src/booking-surface/profile.ts +42 -0
  219. package/ts/src/booking-surface/runtime-v2.ts +1466 -0
  220. package/ts/src/booking-surface/runtime.ts +483 -0
  221. package/ts/src/booking-surface/server-v2.ts +247 -0
  222. package/ts/src/booking-surface/server.ts +324 -0
  223. package/ts/src/booking-surface/startup.ts +196 -0
  224. package/ts/src/booking-surface/validation-v2.ts +205 -0
  225. package/ts/src/booking-surface/validation.ts +453 -0
  226. package/ts/src/index.ts +64 -11
  227. package/ts/src/state-ledger.ts +1 -0
  228. package/ts/src/tool-budget.ts +165 -0
  229. package/dist/scripts/wizard-bootstrap.js +0 -32
@@ -32,20 +32,19 @@ const c1 = runBootstrap([
32
32
  '--check-only'
33
33
  ], {});
34
34
  assert.equal(c1.code, 0, `--check-only 应 exit 0,实际 ${c1.code}\n${c1.out}`);
35
- assert.ok(c1.out.includes('hbcli'), '报告应含 hbcli 节');
36
- assert.ok(c1.out.includes('agent-reach'), '报告应含 agent-reach 节');
37
- assert.ok(c1.out.includes('flyai'), '报告应含 flyai(无需安装)节');
38
- assert.ok(c1.out.includes('dsh-better-sidebar'), '报告应含 dsh-better-sidebar 节(issue #25 产物查看面)');
39
- assert.ok(c1.out.includes('Session Bridge'), '报告应含会话扩展节(issue #21 传输层方案 C)');
40
- console.log('1. --check-only 探测报告 exit 0(hbcli/agent-reach/flyai/dsh-better-sidebar/会话扩展 五节齐)OK');
35
+ assert.ok(c1.out.includes('Session Bridge'), '报告应含扩展就位节(issue #21 传输层方案 C)');
36
+ assert.ok(!c1.out.includes('hbcli'), 'setup 不再替用户管 hbcli(已让出)');
37
+ assert.ok(!c1.out.includes('agent-reach'), 'setup 不再替用户管 agent-reach(已让出)');
38
+ assert.ok(!c1.out.includes('dsh-better-sidebar'), 'setup 不再替用户管 dsh-better-sidebar(已让出)');
39
+ console.log('1. --check-only 探测报告 exit 0(扩展就位 + 让出 hbcli/agent-reach/sidebar)OK');
41
40
  const c2 = runBootstrap([
42
41
  '--auto'
43
42
  ], {
44
43
  GOTRY_SETUP_SKIP: '1'
45
44
  });
46
- assert.equal(c2.code, 0, '--auto 跳过态应 exit 0(永不挡 npm install)');
45
+ assert.equal(c2.code, 0, '--auto 跳过态应 exit 0');
47
46
  assert.ok(c2.out.includes('跳过'), '应输出跳过说明');
48
- console.log('2. --auto + GOTRY_SETUP_SKIP=1 → exit 0(安装永不失败)OK');
47
+ console.log('2. --auto + GOTRY_SETUP_SKIP=1 → exit 0(永不挡 npm install)OK');
49
48
  const c3 = runBootstrap([], {
50
49
  GOTRY_SETUP_SKIP: '1'
51
50
  });
@@ -55,48 +54,55 @@ console.log('3. 显式模式 + GOTRY_SETUP_SKIP=1 → exit 0 OK');
55
54
  const c4 = runBootstrap([
56
55
  '--check-only'
57
56
  ], {
58
- GOTRY_SETUP_SIDEBAR: '0'
57
+ GOTRY_SETUP_EXTENSION: '0'
59
58
  });
60
59
  assert.equal(c4.code, 0, '单项跳过态应 exit 0');
61
- assert.ok(c4.out.includes('GOTRY_SETUP_SIDEBAR=0 跳过'), '应输出侧栏单项跳过说明');
62
- assert.ok(c4.out.includes('hbcli'), '其余节不受单项开关影响');
63
- console.log('4. GOTRY_SETUP_SIDEBAR=0 单项跳过(其余节照常)OK');
60
+ assert.ok(c4.out.includes('GOTRY_SETUP_EXTENSION=0 跳过'), '应输出扩展单项跳过说明');
61
+ console.log('4. GOTRY_SETUP_EXTENSION=0 单项跳过 OK');
64
62
  const c5 = runBootstrap([
65
- '--check-only'
66
- ], {});
67
- assert.ok(c5.out.includes('.gotry/extension'), '扩展报告应含落位路径 ~/.gotry/extension(绝对路径形态)');
68
- const c5b = runBootstrap([
69
- '--check-only'
70
- ], {
71
- GOTRY_SETUP_EXTENSION: '0'
72
- });
73
- assert.equal(c5b.code, 0, '扩展单项跳过态应 exit 0');
74
- assert.ok(c5b.out.includes('GOTRY_SETUP_EXTENSION=0 跳过'), '应输出扩展单项跳过说明');
75
- console.log('5. 会话扩展节(check-only 报告 + GOTRY_SETUP_EXTENSION=0 单项跳过)OK');
76
- const c6 = runBootstrap([
77
63
  'wizard',
78
64
  '--dry-run'
79
65
  ], {});
80
- assert.equal(c6.code, 0, `wizard --dry-run 应 exit 0,实际 ${c6.code}\n${c6.out}`);
81
- assert.ok(c6.out.includes('dry-run'), '应输出 dry-run 字样');
82
- assert.ok(c6.out.includes('Gotry Wizard') || c6.out.includes('gotry-wizard') || c6.out.includes('3 步'), '应输出引导步骤');
83
- assert.ok(c6.out.includes('ensure-extension-files'), 'dry-run 应列 5 步');
84
- assert.ok(c6.out.includes('open-chrome-extensions'), 'dry-run 应列开 chrome://extensions');
85
- assert.ok(c6.out.includes('clipboard-extension-path'), 'dry-run 应列剪贴板');
86
- assert.ok(c6.out.includes('panel-guide'), 'dry-run 应列面板');
87
- assert.ok(c6.out.includes('watch-extension-ready'), 'dry-run 应列 watch precheck');
88
- console.log('6. wizard 子命令(--dry-run 零网络,5 步齐全 + 引导文案)OK');
89
- const c7 = runBootstrap([
66
+ assert.equal(c5.code, 0, `wizard --dry-run 应 exit 0,实际 ${c5.code}\n${c5.out}`);
67
+ assert.ok(c5.out.includes('dry-run'), '应输出 dry-run 字样');
68
+ assert.ok(c5.out.includes('gotry-wizard'), '应输出 [gotry-wizard] 标签');
69
+ assert.ok(c5.out.includes('ensure-extension-files'), 'dry-run 应列 ensure-extension-files');
70
+ assert.ok(c5.out.includes('watch-extension-ready'), 'dry-run 应列 watch-extension-ready');
71
+ console.log('5. wizard 子命令(--dry-run 零网络,2 步齐全 + 极简 stdout)OK');
72
+ const c6 = runBootstrap([
90
73
  'wizard'
91
74
  ], {
92
75
  GOTRY_SETUP_EXTENSION: '0',
93
76
  GOTRY_ONBOARDING_TIMEOUT_MS: '600',
94
77
  GOTRY_ONBOARDING_INTERVAL_MS: '200'
95
78
  });
96
- assert.equal(c7.code, 1, `wizard(超时)应 exit 1,实际 ${c7.code}\n${c7.out}`);
97
- assert.ok(c7.out.includes('3 步') || c7.out.includes('gotry-wizard'), '应输出引导标题');
98
- console.log('7. wizard 真实路径(扩展未就绪,exit 1 + 引导标题 + 心跳)OK');
99
- console.log('BOOTSTRAP TESTS: 7/7 OK(探测报告/跳过开关/单项开关/postinstall 非致命/会话扩展/wizard --dry-run/wizard 真实)');
79
+ assert.equal(c6.code, 1, `wizard(超时)应 exit 1,实际 ${c6.code}\n${c6.out}`);
80
+ assert.ok(c6.out.includes('gotry-wizard'), '应输出 [gotry-wizard] 标签');
81
+ console.log('6. wizard 真实路径(扩展未就绪,exit 1 + 心跳)OK');
82
+ const c7 = runBootstrap([
83
+ '--check-only',
84
+ '--extension-from=github'
85
+ ], {
86
+ GOTRY_SETUP_HBCLI: '0',
87
+ GOTRY_SETUP_REACH: '0',
88
+ GOTRY_SETUP_SIDEBAR: '0',
89
+ GOTRY_EXTENSION_RELEASE_BASE: 'http://127.0.0.1:1/releases'
90
+ });
91
+ assert.equal(c7.code, 0, `github 通道降级应 exit 0,实际 ${c7.code}\n${c7.out}`);
92
+ assert.ok(c7.out.includes('GitHub Releases 下载通道'), '应打印 github 通道标题');
93
+ assert.ok(c7.out.includes('降级包内副本'), '失败应显式降级 bundled');
94
+ const c7b = runBootstrap([
95
+ '--check-only',
96
+ '--extension-from=不合法值'
97
+ ], {
98
+ GOTRY_SETUP_HBCLI: '0',
99
+ GOTRY_SETUP_REACH: '0',
100
+ GOTRY_SETUP_SIDEBAR: '0'
101
+ });
102
+ assert.equal(c7b.code, 0, `非法 --extension-from 值应回落 bundled 且 exit 0,实际 ${c7b.code}\n${c7b.out}`);
103
+ assert.ok(!c7b.out.includes('下载通道'), '非法值不应进入 github 通道');
104
+ console.log('7. 扩展分发 github 通道(不可达基址即时降级 + 非法值回落 bundled)OK');
105
+ console.log('BOOTSTRAP TESTS: 7/7 OK(扩展就位 + 跳过开关 / wizard --dry-run / wizard 真实 / 扩展分发通道 / 显式跳过 + auto 跳过 + 单项跳过)');
100
106
 
101
107
 
102
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/bootstrap-tests.ts
108
+ //# sourceURL=ts/scripts/bootstrap-tests.ts
@@ -276,4 +276,4 @@ if (process.argv[1]?.endsWith('build-changelog.ts')) {
276
276
  }
277
277
 
278
278
 
279
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/build-changelog.ts
279
+ //# sourceURL=ts/scripts/build-changelog.ts
@@ -162,4 +162,4 @@ ok('parseCommit feat(scope)!: breaking change marker 容错');
162
162
  console.log(`changelog tests: ${passed} 组断言全绿(纯函数)`);
163
163
 
164
164
 
165
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/changelog-tests.ts
165
+ //# sourceURL=ts/scripts/changelog-tests.ts
@@ -109,4 +109,4 @@ pass('多人并存与 id 稳定性', ()=>{
109
109
  console.log(`\nCOMPANION TESTS: ${n}/4 OK(memory-design P2 守门面)`);
110
110
 
111
111
 
112
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/companion-tests.ts
112
+ //# sourceURL=ts/scripts/companion-tests.ts
@@ -36,4 +36,4 @@ for (const id of Object.keys(tsV)){
36
36
  console.log('\nDIFF TEST OK: 双路径判定一致(纯 TS,无 Python 依赖)');
37
37
 
38
38
 
39
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/diff-test.ts
39
+ //# sourceURL=ts/scripts/diff-test.ts
@@ -0,0 +1,225 @@
1
+ import assert from 'node:assert/strict';
2
+ import test from 'node:test';
3
+ import { parsePnpmDshLock, parsePnpmRootDshImporter, REQUIRED_DSH_RUNTIME_PACKAGE_COUNT, validateDshRuntimeClosure, validatePnpmRootDshImporter } from './dsh-runtime-closure.js';
4
+ const VERSION = '0.1.2-alpha.3';
5
+ function validInput() {
6
+ return {
7
+ dependencies: {
8
+ '@deepseek-ai/dsh': VERSION,
9
+ '@deepseek-ai/dsh-session-title': VERSION
10
+ },
11
+ lockPackages: {
12
+ 'node_modules/@deepseek-ai/dsh': {
13
+ version: VERSION
14
+ },
15
+ 'node_modules/@deepseek-ai/dsh-session-title': {
16
+ version: VERSION
17
+ }
18
+ },
19
+ runtimeVersion: VERSION
20
+ };
21
+ }
22
+ test('accepts an exact coherent DSH prerelease closure', ()=>{
23
+ assert.deepEqual(validateDshRuntimeClosure(validInput()), {
24
+ names: [
25
+ '@deepseek-ai/dsh',
26
+ '@deepseek-ai/dsh-session-title'
27
+ ],
28
+ version: VERSION
29
+ });
30
+ });
31
+ test('rejects a lock package missing from the published direct dependencies', ()=>{
32
+ const input = validInput();
33
+ input.dependencies = {
34
+ '@deepseek-ai/dsh': VERSION
35
+ };
36
+ assert.throws(()=>validateDshRuntimeClosure(input), /DSH closure 未精确声明/);
37
+ });
38
+ test('rejects an extra ranged DSH dependency absent from the tested lock closure', ()=>{
39
+ const input = validInput();
40
+ input.dependencies['@deepseek-ai/dsh-web'] = '^0.1.2-alpha.3';
41
+ assert.throws(()=>validateDshRuntimeClosure(input), /DSH manifest 与 lock 集合不一致/);
42
+ });
43
+ test('rejects a nested DSH package from another prerelease', ()=>{
44
+ const input = validInput();
45
+ input.lockPackages['node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-session-title'] = {
46
+ version: '0.1.2-alpha.4'
47
+ };
48
+ assert.throws(()=>validateDshRuntimeClosure(input), /DSH lock 版本漂移/);
49
+ });
50
+ test('rejects drift from the runtime spawn guard version', ()=>{
51
+ const input = validInput();
52
+ input.runtimeVersion = '0.1.2-alpha.4';
53
+ assert.throws(()=>validateDshRuntimeClosure(input), /DSH runtime guard 版本漂移/);
54
+ });
55
+ test('parses each pnpm DSH resolution once across packages and snapshots', ()=>{
56
+ const lock = `
57
+ packages:
58
+ '@deepseek-ai/dsh@0.1.2-alpha.3': {}
59
+ '@deepseek-ai/dsh-session@0.1.2-alpha.3': {}
60
+ snapshots:
61
+ '@deepseek-ai/dsh@0.1.2-alpha.3': {}
62
+ `;
63
+ assert.deepEqual(parsePnpmDshLock(lock), {
64
+ 'node_modules/@deepseek-ai/dsh': {
65
+ version: VERSION
66
+ },
67
+ 'node_modules/@deepseek-ai/dsh-session': {
68
+ version: VERSION
69
+ }
70
+ });
71
+ });
72
+ test('preserves two pnpm resolutions of the same DSH package for mixed-version rejection', ()=>{
73
+ const lock = `
74
+ packages:
75
+ '@deepseek-ai/dsh@0.1.2-alpha.3': {}
76
+ '@deepseek-ai/dsh-session@0.1.2-alpha.3': {}
77
+ '@deepseek-ai/dsh-session@0.1.2-alpha.4': {}
78
+ `;
79
+ const parsed = parsePnpmDshLock(lock);
80
+ assert.equal(Object.keys(parsed).length, 3);
81
+ assert.throws(()=>validateDshRuntimeClosure({
82
+ dependencies: {
83
+ '@deepseek-ai/dsh': VERSION,
84
+ '@deepseek-ai/dsh-session': VERSION
85
+ },
86
+ lockPackages: parsed,
87
+ runtimeVersion: VERSION
88
+ }), /DSH lock 版本漂移/);
89
+ });
90
+ test('parses only the root pnpm importer DSH entries', ()=>{
91
+ const lock = `
92
+ lockfileVersion: '9.0'
93
+ importers:
94
+ .:
95
+ dependencies:
96
+ '@deepseek-ai/dsh':
97
+ specifier: 0.1.2-alpha.3
98
+ version: 0.1.2-alpha.3(peer@1.0.0)
99
+ '@deepseek-ai/dsh-session':
100
+ specifier: 0.1.2-alpha.3
101
+ version: 0.1.2-alpha.3
102
+ ts:
103
+ dependencies:
104
+ '@deepseek-ai/dsh-web':
105
+ specifier: 0.1.2-alpha.4
106
+ version: 0.1.2-alpha.4
107
+ packages: {}
108
+ `;
109
+ assert.deepEqual(parsePnpmRootDshImporter(lock), {
110
+ '@deepseek-ai/dsh': {
111
+ specifier: VERSION,
112
+ resolvedVersion: VERSION
113
+ },
114
+ '@deepseek-ai/dsh-session': {
115
+ specifier: VERSION,
116
+ resolvedVersion: VERSION
117
+ }
118
+ });
119
+ });
120
+ test('rejects a pnpm root importer missing a published DSH dependency', ()=>{
121
+ assert.throws(()=>validatePnpmRootDshImporter({
122
+ dependencies: validInput().dependencies,
123
+ importerEntries: {
124
+ '@deepseek-ai/dsh': {
125
+ specifier: VERSION,
126
+ resolvedVersion: VERSION
127
+ }
128
+ },
129
+ runtimeVersion: VERSION
130
+ }), /pnpm root importer 与 manifest 集合不一致/);
131
+ });
132
+ test('rejects a ranged DSH specifier in the pnpm root importer', ()=>{
133
+ assert.throws(()=>validatePnpmRootDshImporter({
134
+ dependencies: validInput().dependencies,
135
+ importerEntries: {
136
+ '@deepseek-ai/dsh': {
137
+ specifier: VERSION,
138
+ resolvedVersion: VERSION
139
+ },
140
+ '@deepseek-ai/dsh-session-title': {
141
+ specifier: '^0.1.2-alpha.3',
142
+ resolvedVersion: VERSION
143
+ }
144
+ },
145
+ runtimeVersion: VERSION
146
+ }), /pnpm root importer 未精确锁定/);
147
+ });
148
+ test('rejects a drifted resolved DSH version in the pnpm root importer', ()=>{
149
+ assert.throws(()=>validatePnpmRootDshImporter({
150
+ dependencies: validInput().dependencies,
151
+ importerEntries: {
152
+ '@deepseek-ai/dsh': {
153
+ specifier: VERSION,
154
+ resolvedVersion: '0.1.2-alpha.4'
155
+ },
156
+ '@deepseek-ai/dsh-session-title': {
157
+ specifier: VERSION,
158
+ resolvedVersion: VERSION
159
+ }
160
+ },
161
+ runtimeVersion: VERSION
162
+ }), /pnpm root importer resolved 版本漂移/);
163
+ });
164
+ test('rejects a missing resolved DSH version in the pnpm root importer', ()=>{
165
+ const lock = `
166
+ importers:
167
+ .:
168
+ dependencies:
169
+ '@deepseek-ai/dsh':
170
+ specifier: 0.1.2-alpha.3
171
+ `;
172
+ assert.throws(()=>parsePnpmRootDshImporter(lock), /pnpm root importer version 不可用/);
173
+ });
174
+ test('rejects duplicate resolved DSH versions in the pnpm root importer', ()=>{
175
+ const lock = `
176
+ importers:
177
+ .:
178
+ dependencies:
179
+ '@deepseek-ai/dsh':
180
+ specifier: 0.1.2-alpha.3
181
+ version: 0.1.2-alpha.3
182
+ version: 0.1.2-alpha.4
183
+ `;
184
+ assert.throws(()=>parsePnpmRootDshImporter(lock), /pnpm root importer version 不可用/);
185
+ });
186
+ test('rejects a coherent closure below the required package count', ()=>{
187
+ assert.throws(()=>validateDshRuntimeClosure({
188
+ ...validInput(),
189
+ expectedPackageCount: REQUIRED_DSH_RUNTIME_PACKAGE_COUNT
190
+ }), /DSH closure 包数量不符/);
191
+ });
192
+ test('rejects a coherent root importer below the required package count', ()=>{
193
+ assert.throws(()=>validatePnpmRootDshImporter({
194
+ dependencies: validInput().dependencies,
195
+ importerEntries: {
196
+ '@deepseek-ai/dsh': {
197
+ specifier: VERSION,
198
+ resolvedVersion: VERSION
199
+ },
200
+ '@deepseek-ai/dsh-session-title': {
201
+ specifier: VERSION,
202
+ resolvedVersion: VERSION
203
+ }
204
+ },
205
+ runtimeVersion: VERSION,
206
+ expectedPackageCount: REQUIRED_DSH_RUNTIME_PACKAGE_COUNT
207
+ }), /pnpm root importer 包数量不符/);
208
+ });
209
+ test('rejects duplicate DSH entries in the pnpm root importer', ()=>{
210
+ const lock = `
211
+ importers:
212
+ .:
213
+ dependencies:
214
+ '@deepseek-ai/dsh':
215
+ specifier: 0.1.2-alpha.3
216
+ version: 0.1.2-alpha.3
217
+ '@deepseek-ai/dsh':
218
+ specifier: 0.1.2-alpha.3
219
+ version: 0.1.2-alpha.3
220
+ `;
221
+ assert.throws(()=>parsePnpmRootDshImporter(lock), /pnpm root importer DSH 依赖重复/);
222
+ });
223
+
224
+
225
+ //# sourceURL=ts/scripts/dsh-runtime-closure-tests.ts
@@ -0,0 +1,150 @@
1
+ export const REQUIRED_DSH_RUNTIME_PACKAGE_COUNT = 216;
2
+ function yamlScalar(value) {
3
+ const trimmed = value.trim().replace(/\s+#.*$/, '');
4
+ const quoted = trimmed.match(/^(['"])(.*)\1$/);
5
+ return quoted?.[2] ?? trimmed;
6
+ }
7
+ function indentation(line) {
8
+ return line.match(/^ */)?.[0].length ?? 0;
9
+ }
10
+ function resolvedPnpmVersion(value) {
11
+ return yamlScalar(value).replace(/\(.+$/, '');
12
+ }
13
+ export function parsePnpmRootDshImporter(text) {
14
+ const lines = text.split(/\r?\n/);
15
+ const importers = lines.map((line, index)=>line === 'importers:' ? index : -1).filter((index)=>index >= 0);
16
+ if (importers.length !== 1) throw new Error('pnpm lock importers 区块不可用');
17
+ const importersStart = importers[0];
18
+ const importersEnd = lines.findIndex((line, index)=>index > importersStart && line.trim() !== '' && indentation(line) === 0);
19
+ const rootCandidates = lines.map((line, index)=>index > importersStart && (importersEnd < 0 || index < importersEnd) && /^ {2}(?:\.|'\.'|"\."):\s*$/.test(line) ? index : -1).filter((index)=>index >= 0);
20
+ if (rootCandidates.length !== 1) throw new Error('pnpm root importer 不唯一');
21
+ const rootStart = rootCandidates[0];
22
+ const rootEndRelative = lines.slice(rootStart + 1, importersEnd < 0 ? lines.length : importersEnd).findIndex((line)=>line.trim() !== '' && indentation(line) <= 2);
23
+ const rootEnd = rootEndRelative < 0 ? importersEnd < 0 ? lines.length : importersEnd : rootStart + 1 + rootEndRelative;
24
+ const dependencyBlocks = lines.map((line, index)=>index > rootStart && index < rootEnd && /^ {4}dependencies:\s*$/.test(line) ? index : -1).filter((index)=>index >= 0);
25
+ if (dependencyBlocks.length !== 1) throw new Error('pnpm root importer dependencies 区块不可用');
26
+ const dependenciesStart = dependencyBlocks[0];
27
+ const dependenciesEndRelative = lines.slice(dependenciesStart + 1, rootEnd).findIndex((line)=>line.trim() !== '' && indentation(line) <= 4);
28
+ const dependenciesEnd = dependenciesEndRelative < 0 ? rootEnd : dependenciesStart + 1 + dependenciesEndRelative;
29
+ const entries = lines.map((line, index)=>{
30
+ if (index <= dependenciesStart || index >= dependenciesEnd) return null;
31
+ const match = line.match(/^ {6}(['"]?)([^'":\s]+)\1:\s*$/);
32
+ return match ? {
33
+ index,
34
+ name: match[2]
35
+ } : null;
36
+ }).filter((entry)=>entry !== null);
37
+ const importerEntries = {};
38
+ for(let entryIndex = 0; entryIndex < entries.length; entryIndex += 1){
39
+ const entry = entries[entryIndex];
40
+ if (entry.name !== '@deepseek-ai/dsh' && !entry.name.startsWith('@deepseek-ai/dsh-')) continue;
41
+ if (Object.hasOwn(importerEntries, entry.name)) throw new Error(`pnpm root importer DSH 依赖重复:${entry.name}`);
42
+ const end = entries[entryIndex + 1]?.index ?? dependenciesEnd;
43
+ const block = lines.slice(entry.index + 1, end);
44
+ const specifiers = block.map((line)=>line.match(/^ {8}specifier:\s*(.+)$/)?.[1]).filter((value)=>value !== undefined);
45
+ if (specifiers.length !== 1) throw new Error(`pnpm root importer specifier 不可用:${entry.name}`);
46
+ const versions = block.map((line)=>line.match(/^ {8}version:\s*(.+)$/)?.[1]).filter((value)=>value !== undefined);
47
+ if (versions.length !== 1) throw new Error(`pnpm root importer version 不可用:${entry.name}`);
48
+ importerEntries[entry.name] = {
49
+ specifier: yamlScalar(specifiers[0]),
50
+ resolvedVersion: resolvedPnpmVersion(versions[0])
51
+ };
52
+ }
53
+ return importerEntries;
54
+ }
55
+ export function validatePnpmRootDshImporter(input) {
56
+ const manifestNames = Object.keys(input.dependencies).filter((name)=>name === '@deepseek-ai/dsh' || name.startsWith('@deepseek-ai/dsh-')).sort();
57
+ const importerNames = Object.keys(input.importerEntries).sort();
58
+ const missing = manifestNames.filter((name)=>!importerNames.includes(name));
59
+ const extra = importerNames.filter((name)=>!manifestNames.includes(name));
60
+ if (missing.length > 0 || extra.length > 0) {
61
+ throw new Error(`pnpm root importer 与 manifest 集合不一致:missing=${missing.join(',') || '-'};extra=${extra.join(',') || '-'}`);
62
+ }
63
+ for (const name of importerNames){
64
+ const importerEntry = input.importerEntries[name];
65
+ if (input.dependencies[name] !== input.runtimeVersion || importerEntry.specifier !== input.runtimeVersion) {
66
+ throw new Error(`pnpm root importer 未精确锁定:${name}@${input.runtimeVersion}`);
67
+ }
68
+ if (importerEntry.resolvedVersion !== input.runtimeVersion) {
69
+ throw new Error(`pnpm root importer resolved 版本漂移:${name}@${importerEntry.resolvedVersion}(expected ${input.runtimeVersion})`);
70
+ }
71
+ }
72
+ if (input.expectedPackageCount !== undefined && importerNames.length !== input.expectedPackageCount) {
73
+ throw new Error(`pnpm root importer 包数量不符:${importerNames.length}(expected ${input.expectedPackageCount})`);
74
+ }
75
+ return {
76
+ names: importerNames,
77
+ version: input.runtimeVersion
78
+ };
79
+ }
80
+ export function parsePnpmDshLock(text) {
81
+ const packages = {};
82
+ const seen = new Set();
83
+ const variants = new Map();
84
+ const entry = /^\s{2}['"]?(\@deepseek-ai\/dsh(?:-[^@'":\s]+)?)@([^'":\s(]+)(?:\([^'"]*\))?['"]?:/gm;
85
+ for (const match of text.matchAll(entry)){
86
+ const name = match[1];
87
+ const version = match[2];
88
+ const identity = `${name}@${version}`;
89
+ if (seen.has(identity)) continue;
90
+ seen.add(identity);
91
+ const variant = variants.get(name) ?? 0;
92
+ variants.set(name, variant + 1);
93
+ const prefix = variant === 0 ? '' : `.pnpm-variant-${variant}/node_modules/`;
94
+ packages[`node_modules/${prefix}${name}`] = {
95
+ version
96
+ };
97
+ }
98
+ return packages;
99
+ }
100
+ export function validateDshRuntimeClosure(input) {
101
+ const dshVersion = input.dependencies['@deepseek-ai/dsh'];
102
+ if (typeof dshVersion !== 'string' || !/^\d+\.\d+\.\d+-[0-9A-Za-z.-]+$/.test(dshVersion)) {
103
+ throw new Error('@deepseek-ai/dsh 必须以精确 prerelease 版本声明');
104
+ }
105
+ if (dshVersion !== input.runtimeVersion) {
106
+ throw new Error(`DSH runtime guard 版本漂移:${input.runtimeVersion}(manifest ${dshVersion})`);
107
+ }
108
+ const dshNodes = Object.entries(input.lockPackages).flatMap(([path, metadata])=>{
109
+ const match = path.match(/(?:^|\/)node_modules\/(\@deepseek-ai\/dsh(?:-[^/]+)?)$/);
110
+ return match ? [
111
+ {
112
+ name: match[1],
113
+ version: metadata.version
114
+ }
115
+ ] : [];
116
+ }).sort((left, right)=>left.name.localeCompare(right.name));
117
+ if (dshNodes.length === 0) throw new Error('package-lock 未解析到 DSH runtime closure');
118
+ for (const dependency of dshNodes){
119
+ if (dependency.version !== dshVersion) {
120
+ throw new Error(`DSH lock 版本漂移:${dependency.name}@${dependency.version ?? 'missing'}(expected ${dshVersion})`);
121
+ }
122
+ }
123
+ const lockNames = [
124
+ ...new Set(dshNodes.map((dependency)=>dependency.name))
125
+ ].sort();
126
+ const manifestNames = Object.keys(input.dependencies).filter((name)=>name === '@deepseek-ai/dsh' || name.startsWith('@deepseek-ai/dsh-')).sort();
127
+ const missing = lockNames.filter((name)=>!manifestNames.includes(name));
128
+ const extra = manifestNames.filter((name)=>!lockNames.includes(name));
129
+ if (missing.length > 0) {
130
+ throw new Error(`DSH closure 未精确声明:${missing[0]}@${dshVersion}`);
131
+ }
132
+ if (extra.length > 0) {
133
+ throw new Error(`DSH manifest 与 lock 集合不一致:missing=${missing.join(',') || '-'};extra=${extra.join(',') || '-'}`);
134
+ }
135
+ for (const name of manifestNames){
136
+ if (input.dependencies[name] !== dshVersion) {
137
+ throw new Error(`DSH closure 未精确声明:${name}@${dshVersion}`);
138
+ }
139
+ }
140
+ if (input.expectedPackageCount !== undefined && lockNames.length !== input.expectedPackageCount) {
141
+ throw new Error(`DSH closure 包数量不符:${lockNames.length}(expected ${input.expectedPackageCount})`);
142
+ }
143
+ return {
144
+ names: lockNames,
145
+ version: dshVersion
146
+ };
147
+ }
148
+
149
+
150
+ //# sourceURL=ts/scripts/dsh-runtime-closure.ts
@@ -471,4 +471,4 @@ console.log('10c. mock 解译器夹具回放(预订链 CI 形态)OK');
471
471
  console.log('EFFECT INTERPRETER TESTS: 10/10 OK(effect_interpreter.v1:注册表封闭/退避链/断路三态/Sentinel 不重试/mock 夹具/SESSION 红线/真实降级/M0 预订链读效应,纯离线)');
472
472
 
473
473
 
474
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/effect-tests.ts
474
+ //# sourceURL=ts/scripts/effect-tests.ts
@@ -11,4 +11,4 @@ console.log(`(TS 引擎总耗时含 WASM init: ${Date.now() - t0}ms, recommended
11
11
  console.log(result['answer_md']);
12
12
 
13
13
 
14
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/engine-run.ts
14
+ //# sourceURL=ts/scripts/engine-run.ts
@@ -42,4 +42,4 @@ assert.ok(v.suggestions.some((s)=>s.text.includes('预算提高到')));
42
42
  console.log('TS ENGINE TESTS: 8/8 OK');
43
43
 
44
44
 
45
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/scripts/engine-tests.ts
45
+ //# sourceURL=ts/scripts/engine-tests.ts