dsh-plugin-dev-kb 1.6.0 → 1.8.0

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 (500) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.en.md +23 -6
  3. package/README.md +28 -8
  4. package/kb/INDEX.md +3 -3
  5. package/kb/README.md +9 -4
  6. package/kb/extra/AGENTS.md +1 -1
  7. package/kb/extra/cli-help.md +15 -7
  8. package/kb/extra/cli-help.zh.md +15 -7
  9. package/kb/extra/cookbook/adding-a-plugin-preview.md +18 -25
  10. package/kb/extra/cookbook/adding-a-plugin-preview.zh.md +18 -25
  11. package/kb/extra/cookbook/reviewing-persistence-type-changes.md +1 -1
  12. package/kb/extra/cookbook/reviewing-persistence-type-changes.zh.md +1 -1
  13. package/kb/extra/cookbook/reviewing-ui-design.md +166 -0
  14. package/kb/extra/cookbook/reviewing-ui-design.zh.md +166 -0
  15. package/kb/extra/deepseek-llm-api-wire-extensions.md +2 -2
  16. package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +2 -2
  17. package/kb/extra/defensive-patterns/conversation-and-session.md +2 -2
  18. package/kb/extra/defensive-patterns/conversation-and-session.zh.md +2 -2
  19. package/kb/extra/defensive-patterns/general.md +2 -0
  20. package/kb/extra/defensive-patterns/general.zh.md +2 -0
  21. package/kb/extra/defensive-patterns/package-surface.md +1 -0
  22. package/kb/extra/defensive-patterns/package-surface.zh.md +1 -0
  23. package/kb/extra/defensive-patterns/remote-and-api.md +5 -3
  24. package/kb/extra/defensive-patterns/remote-and-api.zh.md +5 -3
  25. package/kb/extra/development.md +16 -9
  26. package/kb/extra/development.zh.md +16 -9
  27. package/kb/extra/event-producer-consumer.md +64 -51
  28. package/kb/extra/event-producer-consumer.zh.md +64 -51
  29. package/kb/extra/i18n/README.md +2 -0
  30. package/kb/extra/i18n/README.zh.md +2 -0
  31. package/kb/extra/module-graph.md +204 -92
  32. package/kb/extra/module-graph.zh.md +204 -92
  33. package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.md +60 -0
  34. package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.zh.md +60 -0
  35. package/kb/extra/persistence-changes/2026-10-19-session-team-mode.md +48 -0
  36. package/kb/extra/persistence-changes/2026-10-19-session-team-mode.zh.md +48 -0
  37. package/kb/extra/persistence-changes/2026-10-22-action-card-status.md +60 -0
  38. package/kb/extra/persistence-changes/2026-10-22-action-card-status.zh.md +60 -0
  39. package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.md +60 -0
  40. package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.zh.md +60 -0
  41. package/kb/extra/persistence-changes/2026-10-27-retry-control-input.md +60 -0
  42. package/kb/extra/persistence-changes/2026-10-27-retry-control-input.zh.md +60 -0
  43. package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.md +60 -0
  44. package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.zh.md +60 -0
  45. package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.md +48 -0
  46. package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.zh.md +48 -0
  47. package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.md +48 -0
  48. package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.zh.md +48 -0
  49. package/kb/extra/persistence-changes/README.md +2 -0
  50. package/kb/extra/persistence-changes/README.zh.md +2 -0
  51. package/kb/extra/persistence-changes/historical-formats/README.md +1 -1
  52. package/kb/extra/persistence-changes/historical-formats/README.zh.md +1 -1
  53. package/kb/extra/rescope.md +7 -5
  54. package/kb/extra/rescope.zh.md +7 -5
  55. package/kb/extra/subsystems/agent-team.md +38 -75
  56. package/kb/extra/subsystems/agent-team.zh.md +38 -75
  57. package/kb/extra/subsystems/attachment.md +36 -13
  58. package/kb/extra/subsystems/attachment.zh.md +36 -13
  59. package/kb/extra/subsystems/boot.md +179 -5
  60. package/kb/extra/subsystems/boot.zh.md +179 -5
  61. package/kb/extra/subsystems/computer-use.md +78 -0
  62. package/kb/extra/subsystems/computer-use.zh.md +78 -0
  63. package/kb/extra/subsystems/deliverables.md +2 -0
  64. package/kb/extra/subsystems/deliverables.zh.md +2 -0
  65. package/kb/extra/subsystems/forge.md +1226 -0
  66. package/kb/extra/subsystems/forge.zh.md +1226 -0
  67. package/kb/extra/subsystems/liveshare.md +158 -0
  68. package/kb/extra/subsystems/liveshare.zh.md +158 -0
  69. package/kb/extra/subsystems/mcp.md +96 -1
  70. package/kb/extra/subsystems/mcp.zh.md +96 -1
  71. package/kb/extra/subsystems/worktrees.md +54 -3
  72. package/kb/extra/subsystems/worktrees.zh.md +54 -3
  73. package/kb/extra/testing.md +1 -1
  74. package/kb/extra/testing.zh.md +1 -1
  75. package/kb/extra/ui-design-review-cases.md +445 -0
  76. package/kb/extra/ui-design-review-cases.zh.md +445 -0
  77. package/kb/extra/ui-radius.md +3 -1
  78. package/kb/extra/ui-radius.zh.md +3 -1
  79. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.md +1 -1
  80. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.zh.md +1 -1
  81. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.md +24 -0
  82. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.zh.md +24 -0
  83. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.md +25 -0
  84. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.zh.md +25 -0
  85. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.md +30 -0
  86. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.zh.md +30 -0
  87. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.md +28 -0
  88. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.zh.md +28 -0
  89. package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.md +24 -0
  90. package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.zh.md +24 -0
  91. package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.md +23 -0
  92. package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.zh.md +23 -0
  93. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.md +20 -0
  94. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.zh.md +20 -0
  95. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.md +31 -0
  96. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.zh.md +31 -0
  97. package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.md +34 -0
  98. package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.zh.md +34 -0
  99. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.md +20 -0
  100. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.zh.md +20 -0
  101. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.md +18 -0
  102. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.zh.md +18 -0
  103. package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.md +18 -0
  104. package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.zh.md +18 -0
  105. package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.md +25 -0
  106. package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.zh.md +25 -0
  107. package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.md +23 -0
  108. package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.zh.md +23 -0
  109. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.md +22 -0
  110. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.zh.md +22 -0
  111. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.md +18 -0
  112. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.zh.md +18 -0
  113. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.md +17 -0
  114. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.zh.md +17 -0
  115. package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.md +19 -0
  116. package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.zh.md +19 -0
  117. package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.md +27 -0
  118. package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.zh.md +27 -0
  119. package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.md +18 -0
  120. package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.zh.md +18 -0
  121. package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.md +22 -0
  122. package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.zh.md +22 -0
  123. package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.md +17 -0
  124. package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.zh.md +17 -0
  125. package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.md +18 -0
  126. package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.zh.md +18 -0
  127. package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.md +18 -0
  128. package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.zh.md +18 -0
  129. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.md +18 -0
  130. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.zh.md +18 -0
  131. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.md +53 -0
  132. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.zh.md +53 -0
  133. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.md +30 -0
  134. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.zh.md +30 -0
  135. package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.md +20 -0
  136. package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.zh.md +20 -0
  137. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.md +18 -0
  138. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.zh.md +18 -0
  139. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.md +18 -0
  140. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.zh.md +18 -0
  141. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.md +24 -0
  142. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.zh.md +24 -0
  143. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.md +25 -0
  144. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.zh.md +25 -0
  145. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.md +22 -0
  146. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.zh.md +22 -0
  147. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.md +18 -0
  148. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.zh.md +18 -0
  149. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.md +19 -0
  150. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.zh.md +19 -0
  151. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.md +26 -0
  152. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.zh.md +26 -0
  153. package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.md +35 -0
  154. package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.zh.md +35 -0
  155. package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.md +21 -0
  156. package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.zh.md +21 -0
  157. package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.md +17 -0
  158. package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.zh.md +17 -0
  159. package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.md +23 -0
  160. package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.zh.md +23 -0
  161. package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.md +21 -0
  162. package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.zh.md +21 -0
  163. package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.md +20 -0
  164. package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.zh.md +20 -0
  165. package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.md +20 -0
  166. package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.zh.md +20 -0
  167. package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.md +19 -0
  168. package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.zh.md +19 -0
  169. package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.md +23 -0
  170. package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.zh.md +23 -0
  171. package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.md +20 -0
  172. package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.zh.md +20 -0
  173. package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.md +21 -0
  174. package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.zh.md +21 -0
  175. package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.md +21 -0
  176. package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.zh.md +21 -0
  177. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.md +18 -0
  178. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.zh.md +18 -0
  179. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.md +20 -0
  180. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.zh.md +20 -0
  181. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.md +19 -0
  182. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.zh.md +19 -0
  183. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.md +18 -0
  184. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.zh.md +18 -0
  185. package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.md +22 -0
  186. package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.zh.md +22 -0
  187. package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.md +20 -0
  188. package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.zh.md +20 -0
  189. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.md +19 -0
  190. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.zh.md +19 -0
  191. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.md +24 -0
  192. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.zh.md +24 -0
  193. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.md +21 -0
  194. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.zh.md +21 -0
  195. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.md +19 -0
  196. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.zh.md +19 -0
  197. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md +18 -0
  198. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md +18 -0
  199. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.md +21 -0
  200. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.zh.md +21 -0
  201. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.md +29 -0
  202. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.zh.md +29 -0
  203. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.md +29 -0
  204. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.zh.md +29 -0
  205. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.md +29 -0
  206. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.zh.md +29 -0
  207. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.md +18 -0
  208. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.zh.md +18 -0
  209. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.md +32 -0
  210. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.zh.md +32 -0
  211. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.md +30 -0
  212. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.zh.md +30 -0
  213. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.md +19 -0
  214. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.zh.md +19 -0
  215. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.md +21 -0
  216. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.zh.md +21 -0
  217. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.md +37 -0
  218. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.zh.md +37 -0
  219. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.md +22 -0
  220. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.zh.md +22 -0
  221. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.md +24 -0
  222. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.zh.md +24 -0
  223. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.md +20 -0
  224. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.zh.md +20 -0
  225. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.md +20 -0
  226. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.zh.md +20 -0
  227. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.md +17 -0
  228. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.zh.md +17 -0
  229. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.md +19 -0
  230. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.zh.md +19 -0
  231. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.md +18 -0
  232. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.zh.md +18 -0
  233. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.md +29 -0
  234. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.zh.md +29 -0
  235. package/kb/extra/web-styling.md +19 -1
  236. package/kb/extra/web-styling.zh.md +19 -1
  237. package/kb/meta/search-index.json +1272 -1098
  238. package/kb/meta/source.json +8 -4
  239. package/kb/site/develop/cordis-tutorial/04-events.md +1 -1
  240. package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  241. package/kb/site/develop/framework/events.md +1 -1
  242. package/kb/site/develop/practice/dynamic-cordis.md +1 -1
  243. package/kb/site/en/develop/cordis-tutorial/04-events.md +1 -1
  244. package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  245. package/kb/site/en/develop/framework/events.md +1 -1
  246. package/kb/site/en/develop/practice/dynamic-cordis.md +1 -1
  247. package/kb/site/en/guide/network-proxy.md +1 -1
  248. package/kb/site/en/guide/plugin-market.md +10 -10
  249. package/kb/site/en/guide/providers.md +5 -1
  250. package/kb/site/en/guide/python-sdk.md +17 -2
  251. package/kb/site/en/guide/schedule.md +45 -26
  252. package/kb/site/en/reference/agent-lifecycle.md +3 -1
  253. package/kb/site/en/reference/api-gateway.md +4 -4
  254. package/kb/site/en/reference/capability-seams.md +65 -17
  255. package/kb/site/en/reference/config-catalog.md +560 -238
  256. package/kb/site/en/reference/cookbook/adding-a-package.md +4 -2
  257. package/kb/site/en/reference/cookbook/extension-cookbook.md +1 -1
  258. package/kb/site/en/reference/cordis-api/context.md +1 -1
  259. package/kb/site/en/reference/cordis-api/events.md +9 -9
  260. package/kb/site/en/reference/cordis-api/fiber.md +85 -32
  261. package/kb/site/en/reference/cordis-api/inherited.md +10 -9
  262. package/kb/site/en/reference/experimental-persistence-catalog.md +3 -0
  263. package/kb/site/en/reference/index.md +14 -8
  264. package/kb/site/en/reference/persistence-catalog.md +532 -246
  265. package/kb/site/en/reference/subsystems/client-modules.md +19 -11
  266. package/kb/site/en/reference/subsystems/compaction.md +1 -1
  267. package/kb/site/en/reference/subsystems/conversation.md +2 -0
  268. package/kb/site/en/reference/subsystems/core.md +119 -65
  269. package/kb/site/en/reference/subsystems/filesystem.md +202 -28
  270. package/kb/site/en/reference/subsystems/index.md +3 -1
  271. package/kb/site/en/reference/subsystems/llm-streaming.md +92 -4
  272. package/kb/site/en/reference/subsystems/persistence.md +17 -7
  273. package/kb/site/en/reference/subsystems/plan.md +4 -4
  274. package/kb/site/en/reference/subsystems/ptc-runtime.md +12 -5
  275. package/kb/site/en/reference/subsystems/sandbox.md +11 -4
  276. package/kb/site/en/reference/subsystems/schedule.md +194 -430
  277. package/kb/site/en/reference/subsystems/session-projection.md +186 -44
  278. package/kb/site/en/reference/subsystems/session-reference.md +4 -3
  279. package/kb/site/en/reference/subsystems/session.md +119 -31
  280. package/kb/site/en/reference/subsystems/sidebar-right.md +12 -11
  281. package/kb/site/en/reference/subsystems/skills.md +4 -4
  282. package/kb/site/en/reference/subsystems/slots.md +30 -3
  283. package/kb/site/en/reference/subsystems/storage.md +26 -9
  284. package/kb/site/en/reference/subsystems/subagent.md +119 -102
  285. package/kb/site/en/reference/subsystems/system-prompt.md +13 -11
  286. package/kb/site/en/reference/subsystems/token-meter.md +45 -0
  287. package/kb/site/en/reference/subsystems/tools.md +222 -82
  288. package/kb/site/en/reference/subsystems/typert.md +21 -11
  289. package/kb/site/en/reference/subsystems/user-questions.md +22 -6
  290. package/kb/site/en/reference/subsystems/web-client.md +1 -1
  291. package/kb/site/en/reference/subsystems/web-server.md +68 -23
  292. package/kb/site/en/reference/subsystems/web.md +79 -21
  293. package/kb/site/en/reference/tool-catalog.md +270 -395
  294. package/kb/site/en/reference/tool-execution-pipeline.md +5 -4
  295. package/kb/site/guide/network-proxy.md +1 -1
  296. package/kb/site/guide/plugin-market.md +10 -10
  297. package/kb/site/guide/providers.md +5 -1
  298. package/kb/site/guide/python-sdk.md +17 -2
  299. package/kb/site/guide/schedule.md +45 -26
  300. package/kb/site/reference/agent-lifecycle.md +3 -1
  301. package/kb/site/reference/api-gateway.md +4 -4
  302. package/kb/site/reference/capability-seams.md +65 -17
  303. package/kb/site/reference/config-catalog.md +560 -238
  304. package/kb/site/reference/cookbook/adding-a-package.md +4 -2
  305. package/kb/site/reference/cookbook/extension-cookbook.md +1 -1
  306. package/kb/site/reference/cordis-api/context.md +1 -1
  307. package/kb/site/reference/cordis-api/events.md +9 -9
  308. package/kb/site/reference/cordis-api/fiber.md +87 -32
  309. package/kb/site/reference/cordis-api/inherited.md +10 -9
  310. package/kb/site/reference/experimental-persistence-catalog.md +3 -0
  311. package/kb/site/reference/index.md +14 -8
  312. package/kb/site/reference/persistence-catalog.md +532 -246
  313. package/kb/site/reference/subsystems/client-modules.md +19 -11
  314. package/kb/site/reference/subsystems/compaction.md +1 -1
  315. package/kb/site/reference/subsystems/conversation.md +4 -0
  316. package/kb/site/reference/subsystems/core.md +119 -65
  317. package/kb/site/reference/subsystems/filesystem.md +202 -28
  318. package/kb/site/reference/subsystems/index.md +3 -1
  319. package/kb/site/reference/subsystems/llm-streaming.md +92 -4
  320. package/kb/site/reference/subsystems/persistence.md +17 -7
  321. package/kb/site/reference/subsystems/plan.md +4 -4
  322. package/kb/site/reference/subsystems/ptc-runtime.md +12 -5
  323. package/kb/site/reference/subsystems/sandbox.md +11 -4
  324. package/kb/site/reference/subsystems/schedule.md +197 -433
  325. package/kb/site/reference/subsystems/session-projection.md +186 -44
  326. package/kb/site/reference/subsystems/session-reference.md +4 -3
  327. package/kb/site/reference/subsystems/session.md +119 -31
  328. package/kb/site/reference/subsystems/sidebar-right.md +12 -11
  329. package/kb/site/reference/subsystems/skills.md +4 -4
  330. package/kb/site/reference/subsystems/slots.md +30 -3
  331. package/kb/site/reference/subsystems/storage.md +26 -9
  332. package/kb/site/reference/subsystems/subagent.md +119 -102
  333. package/kb/site/reference/subsystems/system-prompt.md +13 -11
  334. package/kb/site/reference/subsystems/token-meter.md +45 -0
  335. package/kb/site/reference/subsystems/tools.md +222 -82
  336. package/kb/site/reference/subsystems/typert.md +21 -11
  337. package/kb/site/reference/subsystems/user-questions.md +22 -6
  338. package/kb/site/reference/subsystems/web-client.md +1 -1
  339. package/kb/site/reference/subsystems/web-server.md +68 -23
  340. package/kb/site/reference/subsystems/web.md +79 -21
  341. package/kb/site/reference/tool-catalog.md +273 -399
  342. package/kb/site/reference/tool-execution-pipeline.md +4 -3
  343. package/lib/index.js +123 -8
  344. package/lib/kb-version.js +118 -0
  345. package/package.json +4 -2
  346. package/scripts/refresh-kb.mjs +153 -0
  347. package/scripts/selfcheck.mjs +18 -0
  348. package/scripts/smoke.mjs +77 -0
  349. package/skills/dsh-plugin-dev-kb.md +7 -6
  350. package/skills/dsh-plugin-starter.md +65 -0
  351. package/skills/dsh-upgrade-assistant.md +62 -0
  352. package/kb/extra/agent-lifecycle.md +0 -91
  353. package/kb/extra/agent-lifecycle.zh.md +0 -93
  354. package/kb/extra/api-gateway.md +0 -172
  355. package/kb/extra/api-gateway.zh.md +0 -178
  356. package/kb/extra/architecture.md +0 -165
  357. package/kb/extra/architecture.zh.md +0 -169
  358. package/kb/extra/capability-seams.md +0 -714
  359. package/kb/extra/capability-seams.zh.md +0 -716
  360. package/kb/extra/config-catalog.md +0 -4801
  361. package/kb/extra/config-catalog.zh.md +0 -4803
  362. package/kb/extra/cookbook/adding-a-package.md +0 -170
  363. package/kb/extra/cookbook/adding-a-package.zh.md +0 -170
  364. package/kb/extra/cookbook/adding-a-settings-card.md +0 -72
  365. package/kb/extra/cookbook/adding-a-settings-card.zh.md +0 -72
  366. package/kb/extra/cookbook/adding-a-tool.md +0 -101
  367. package/kb/extra/cookbook/adding-a-tool.zh.md +0 -103
  368. package/kb/extra/cookbook/adding-an-llm-adapter.md +0 -43
  369. package/kb/extra/cookbook/adding-an-llm-adapter.zh.md +0 -43
  370. package/kb/extra/cookbook/extension-cookbook.md +0 -132
  371. package/kb/extra/cookbook/extension-cookbook.zh.md +0 -136
  372. package/kb/extra/cordis-api/context.md +0 -364
  373. package/kb/extra/cordis-api/context.zh.md +0 -366
  374. package/kb/extra/cordis-api/events.md +0 -207
  375. package/kb/extra/cordis-api/events.zh.md +0 -209
  376. package/kb/extra/cordis-api/fiber.md +0 -375
  377. package/kb/extra/cordis-api/fiber.zh.md +0 -377
  378. package/kb/extra/cordis-api/inherited.md +0 -38
  379. package/kb/extra/cordis-api/registry.md +0 -152
  380. package/kb/extra/cordis-api/registry.zh.md +0 -154
  381. package/kb/extra/cordis-api/service.md +0 -102
  382. package/kb/extra/cordis-api/service.zh.md +0 -104
  383. package/kb/extra/cordis-tutorial/01-first-plugin.md +0 -95
  384. package/kb/extra/cordis-tutorial/01-first-plugin.zh.md +0 -95
  385. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.md +0 -98
  386. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.zh.md +0 -98
  387. package/kb/extra/cordis-tutorial/03-services.md +0 -98
  388. package/kb/extra/cordis-tutorial/03-services.zh.md +0 -98
  389. package/kb/extra/cordis-tutorial/04-events.md +0 -144
  390. package/kb/extra/cordis-tutorial/04-events.zh.md +0 -144
  391. package/kb/extra/cordis-tutorial/05-config.md +0 -111
  392. package/kb/extra/cordis-tutorial/05-config.zh.md +0 -111
  393. package/kb/extra/cordis-tutorial/06-composition-and-hmr.md +0 -113
  394. package/kb/extra/cordis-tutorial/06-composition-and-hmr.zh.md +0 -113
  395. package/kb/extra/cordis-tutorial/07-into-the-harness.md +0 -108
  396. package/kb/extra/cordis-tutorial/07-into-the-harness.zh.md +0 -108
  397. package/kb/extra/cordis-tutorial/index.md +0 -60
  398. package/kb/extra/cordis-tutorial/index.zh.md +0 -62
  399. package/kb/extra/experimental-persistence-catalog.md +0 -17
  400. package/kb/extra/experimental-persistence-catalog.zh.md +0 -17
  401. package/kb/extra/persistence-catalog.md +0 -9140
  402. package/kb/extra/persistence-catalog.zh.md +0 -9142
  403. package/kb/extra/subsystems/README.md +0 -76
  404. package/kb/extra/subsystems/README.zh.md +0 -76
  405. package/kb/extra/subsystems/approval.md +0 -170
  406. package/kb/extra/subsystems/approval.zh.md +0 -170
  407. package/kb/extra/subsystems/client-modules.md +0 -198
  408. package/kb/extra/subsystems/client-modules.zh.md +0 -198
  409. package/kb/extra/subsystems/client-resources.md +0 -92
  410. package/kb/extra/subsystems/client-resources.zh.md +0 -92
  411. package/kb/extra/subsystems/commands.md +0 -223
  412. package/kb/extra/subsystems/commands.zh.md +0 -223
  413. package/kb/extra/subsystems/compaction.md +0 -284
  414. package/kb/extra/subsystems/compaction.zh.md +0 -284
  415. package/kb/extra/subsystems/conversation.md +0 -301
  416. package/kb/extra/subsystems/conversation.zh.md +0 -303
  417. package/kb/extra/subsystems/core.md +0 -1113
  418. package/kb/extra/subsystems/core.zh.md +0 -1125
  419. package/kb/extra/subsystems/credentials.md +0 -493
  420. package/kb/extra/subsystems/credentials.zh.md +0 -493
  421. package/kb/extra/subsystems/filesystem.md +0 -530
  422. package/kb/extra/subsystems/filesystem.zh.md +0 -530
  423. package/kb/extra/subsystems/goal.md +0 -313
  424. package/kb/extra/subsystems/goal.zh.md +0 -313
  425. package/kb/extra/subsystems/jobs.md +0 -554
  426. package/kb/extra/subsystems/jobs.zh.md +0 -554
  427. package/kb/extra/subsystems/llm-streaming.md +0 -1196
  428. package/kb/extra/subsystems/llm-streaming.zh.md +0 -1202
  429. package/kb/extra/subsystems/lsp.md +0 -202
  430. package/kb/extra/subsystems/lsp.zh.md +0 -202
  431. package/kb/extra/subsystems/permission-presets.md +0 -167
  432. package/kb/extra/subsystems/permission-presets.zh.md +0 -167
  433. package/kb/extra/subsystems/persistence.md +0 -418
  434. package/kb/extra/subsystems/persistence.zh.md +0 -418
  435. package/kb/extra/subsystems/plan.md +0 -87
  436. package/kb/extra/subsystems/plan.zh.md +0 -87
  437. package/kb/extra/subsystems/ptc-runtime.md +0 -250
  438. package/kb/extra/subsystems/ptc-runtime.zh.md +0 -250
  439. package/kb/extra/subsystems/sandbox.md +0 -221
  440. package/kb/extra/subsystems/sandbox.zh.md +0 -221
  441. package/kb/extra/subsystems/schedule.md +0 -550
  442. package/kb/extra/subsystems/schedule.zh.md +0 -550
  443. package/kb/extra/subsystems/scope.md +0 -59
  444. package/kb/extra/subsystems/scope.zh.md +0 -61
  445. package/kb/extra/subsystems/session-projection.md +0 -356
  446. package/kb/extra/subsystems/session-projection.zh.md +0 -356
  447. package/kb/extra/subsystems/session-query.md +0 -511
  448. package/kb/extra/subsystems/session-query.zh.md +0 -511
  449. package/kb/extra/subsystems/session-reference.md +0 -224
  450. package/kb/extra/subsystems/session-reference.zh.md +0 -224
  451. package/kb/extra/subsystems/session-telemetry.md +0 -212
  452. package/kb/extra/subsystems/session-telemetry.zh.md +0 -212
  453. package/kb/extra/subsystems/session-title.md +0 -213
  454. package/kb/extra/subsystems/session-title.zh.md +0 -213
  455. package/kb/extra/subsystems/session.md +0 -1339
  456. package/kb/extra/subsystems/session.zh.md +0 -1343
  457. package/kb/extra/subsystems/settings.md +0 -155
  458. package/kb/extra/subsystems/settings.zh.md +0 -155
  459. package/kb/extra/subsystems/shell.md +0 -314
  460. package/kb/extra/subsystems/shell.zh.md +0 -314
  461. package/kb/extra/subsystems/sidebar-right.md +0 -160
  462. package/kb/extra/subsystems/sidebar-right.zh.md +0 -160
  463. package/kb/extra/subsystems/skills.md +0 -352
  464. package/kb/extra/subsystems/skills.zh.md +0 -352
  465. package/kb/extra/subsystems/slots.md +0 -200
  466. package/kb/extra/subsystems/slots.zh.md +0 -204
  467. package/kb/extra/subsystems/spill.md +0 -124
  468. package/kb/extra/subsystems/spill.zh.md +0 -124
  469. package/kb/extra/subsystems/storage.md +0 -259
  470. package/kb/extra/subsystems/storage.zh.md +0 -259
  471. package/kb/extra/subsystems/subagent.md +0 -686
  472. package/kb/extra/subsystems/subagent.zh.md +0 -688
  473. package/kb/extra/subsystems/subprocess.md +0 -321
  474. package/kb/extra/subsystems/subprocess.zh.md +0 -321
  475. package/kb/extra/subsystems/system-prompt.md +0 -254
  476. package/kb/extra/subsystems/system-prompt.zh.md +0 -254
  477. package/kb/extra/subsystems/terminal.md +0 -184
  478. package/kb/extra/subsystems/terminal.zh.md +0 -184
  479. package/kb/extra/subsystems/token-meter.md +0 -106
  480. package/kb/extra/subsystems/token-meter.zh.md +0 -106
  481. package/kb/extra/subsystems/tools.md +0 -747
  482. package/kb/extra/subsystems/tools.zh.md +0 -747
  483. package/kb/extra/subsystems/typert.md +0 -690
  484. package/kb/extra/subsystems/typert.zh.md +0 -690
  485. package/kb/extra/subsystems/user-questions.md +0 -307
  486. package/kb/extra/subsystems/user-questions.zh.md +0 -307
  487. package/kb/extra/subsystems/web-client.md +0 -100
  488. package/kb/extra/subsystems/web-client.zh.md +0 -100
  489. package/kb/extra/subsystems/web-server.md +0 -302
  490. package/kb/extra/subsystems/web-server.zh.md +0 -302
  491. package/kb/extra/subsystems/web.md +0 -206
  492. package/kb/extra/subsystems/web.zh.md +0 -206
  493. package/kb/extra/subsystems/workflow.md +0 -278
  494. package/kb/extra/subsystems/workflow.zh.md +0 -278
  495. package/kb/extra/subsystems/workspace.md +0 -647
  496. package/kb/extra/subsystems/workspace.zh.md +0 -647
  497. package/kb/extra/tool-catalog.md +0 -2824
  498. package/kb/extra/tool-catalog.zh.md +0 -2832
  499. package/kb/extra/tool-execution-pipeline.md +0 -65
  500. package/kb/extra/tool-execution-pipeline.zh.md +0 -67
@@ -0,0 +1,1226 @@
1
+ # Forges
2
+
3
+ [English](forge.md) | 中文
4
+
5
+ 实验性的 forge 能力 seam 从代码托管平台读取变更请求(change request,即 pull request 与 merge request)。[`dsh-experimental-forge`](../../packages/experimental/forge/README.zh.md) 是 Service Definition,提供 `ctx.forge`;[`dsh-experimental-forge-github`](../../packages/experimental/forge-github/README.zh.md) 是服务 GitHub 主机的 Service Provider;[`dsh-experimental-forge-session`](../../packages/experimental/forge-session/README.zh.md) 是把变更请求绑定到 Session 的 Consumer,提供 `ctx.forgeSession`;[`dsh-experimental-client-ui-forge`](../../packages/experimental/client-ui-forge/README.zh.md) 是提供 `ctx.forgePanel` 的 GUI Consumer。默认禁用的 [forge Bundle](../../packages/experimental/forge-bundle/README.zh.md) 可从插件页面组合这四个包,同时加载[工作树模型工具](../../packages/experimental/tool-worktree/README.zh.md),并为面板附带一个隔离的 [worktree 服务](../../packages/experimental/worktree/README.zh.md);除此之外,它们只能通过显式组合加载。
6
+
7
+ ## 提供方与变更请求
8
+
9
+ 一个提供方服务一个 forge 家族,例如 `github`。它把 Git 远端 URL 映射为仓库,把变更请求 URL 映射为引用,构造规范的变更请求 URL,按 head 分支查找打开状态的变更请求,并批量读取状态。`changeRequestKey` 从引用派生一个不区分大小写的键,因此 URL 拼写不同的监听方共享同一个轮询循环。
10
+
11
+ ```ts type-equiv
12
+ /** One repository on a code host, identified the way its provider addresses it. */
13
+ interface ForgeRepository {
14
+ /** Provider family that serves the repository, such as `github`. */
15
+ readonly forge: string
16
+ /** Lowercase host name, such as `github.com`. */
17
+ readonly host: string
18
+ /** Owner or namespace path as the host spells it. */
19
+ readonly owner: string
20
+ /** Repository name as the host spells it. */
21
+ readonly name: string
22
+ }
23
+ ```
24
+
25
+ ```ts type-equiv
26
+ /** One change request (pull request or merge request) in a repository. */
27
+ interface ChangeRequestRef {
28
+ /** Repository that holds the change request. */
29
+ readonly repository: ForgeRepository
30
+ /** Host-assigned change request number. */
31
+ readonly number: number
32
+ }
33
+ ```
34
+
35
+ ```ts type-equiv
36
+ /** Canonical identity of a change request across providers; built by `changeRequestKey`. */
37
+ type ChangeRequestKey = Branded<'ChangeRequestKey'>
38
+ ```
39
+
40
+ ```ts type-equiv
41
+ /**
42
+ * Host-specific access registered with `ctx.forge`. One provider serves one
43
+ * forge family; methods that take a signal must stop work when it aborts.
44
+ */
45
+ interface ForgeProvider {
46
+ /** Forge family name stored in every repository this provider returns. */
47
+ readonly forge: string
48
+ /** Publish a comment or completed review. Omission declares that this provider cannot write reviews. */
49
+ submitReview?(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
50
+ /** Map a Git remote URL to its repository, or undefined when this provider does not serve it. */
51
+ repositoryFromRemote(url: string): ForgeRepository | undefined
52
+ /** Map a change request web URL to its reference, or undefined when this provider does not serve it. */
53
+ changeRequestFromUrl(url: string): ChangeRequestRef | undefined
54
+ /** Build the canonical web URL of a change request this provider serves. */
55
+ changeRequestUrl(ref: ChangeRequestRef): string
56
+ /** Read the status of several change requests, returning one result per requested key. */
57
+ fetch(
58
+ refs: readonly ChangeRequestRef[],
59
+ signal: AbortSignal,
60
+ ): Promise<ReadonlyMap<ChangeRequestKey, ChangeRequestSnapshot | ForgeFailure>>
61
+ /** Read all checks for one change request on demand; omission declares that only the polling preview is available. */
62
+ fetchChecks?(ref: ChangeRequestRef, signal: AbortSignal): Promise<ChangeRequestSnapshot | ForgeFailure>
63
+ /** Find open change requests whose head is `branch` in `repository`, excluding the default branch and forks. */
64
+ findByHead(repository: ForgeRepository, branch: string, signal: AbortSignal): Promise<readonly ChangeRequestRef[]>
65
+ /** Report whether the provider can reach `host` with current credentials. */
66
+ readiness(host: string, signal: AbortSignal): Promise<ForgeReadiness>
67
+ /** Mark a draft change request ready for review, resolving to undefined once the host accepted it. */
68
+ markReady(ref: ChangeRequestRef, signal: AbortSignal): Promise<ForgeActionFailure | undefined>
69
+ /** Merge a change request while its head is still `request.headSha`, resolving to undefined once merged. */
70
+ merge(ref: ChangeRequestRef, request: MergeRequest, signal: AbortSignal): Promise<ForgeActionFailure | undefined>
71
+ /** Read the changes of a change request as the host computes them, as one unified patch with `a/` and `b/` path prefixes. */
72
+ diff(ref: ChangeRequestRef, signal: AbortSignal): Promise<string | ForgeFailure>
73
+ /** Read the text of `path` at `commit` in the change request's repository. */
74
+ fileText(ref: ChangeRequestRef, commit: string, path: string, signal: AbortSignal): Promise<string | ForgeFailure>
75
+ /** Build the web page of `path` at `commit` in the change request's repository. */
76
+ fileUrl(ref: ChangeRequestRef, commit: string, path: string): string
77
+ }
78
+ ```
79
+
80
+ ```ts type-equiv
81
+ /** Whether a provider can reach one host with the current credentials. */
82
+ interface ForgeReadiness {
83
+ /** `ready`, `unauthenticated` (sign-in needed), or `unavailable` (tool missing or host unreachable). */
84
+ readonly state: 'ready' | 'unauthenticated' | 'unavailable'
85
+ /** Human-readable detail, or null when ready. */
86
+ readonly message: string | null
87
+ }
88
+ ```
89
+
90
+ ## 状态轮询
91
+
92
+ `ctx.forge.watch` 让同一变更请求的所有监听方共享一个轮询循环,并把每次结果作为更新送达。每个 forge 同时最多只有一次读取在进行。轮询节奏、退避与超时规则见[注册表 README](../../packages/experimental/forge/README.zh.md#use-this-package)。
93
+
94
+ ```ts type-equiv
95
+ /** Lifecycle state of a change request. */
96
+ type ChangeRequestState = 'open' | 'closed' | 'merged'
97
+ ```
98
+
99
+ ```ts type-equiv
100
+ /** Normalized outcome of one status check. */
101
+ type CheckState = 'pending' | 'success' | 'failure' | 'neutral' | 'skipped' | 'cancelled'
102
+ ```
103
+
104
+ ```ts type-equiv
105
+ /** One status check reported for the head commit of a change request. */
106
+ interface ChangeRequestCheck {
107
+ /** Check name as the host displays it. */
108
+ readonly name: string
109
+ /** Normalized check outcome. */
110
+ readonly state: CheckState
111
+ /** Web page for the check, or null when the host reports none. */
112
+ readonly url: string | null
113
+ /** Workflow that produced the check, or null when the host reports none. */
114
+ readonly workflow: string | null
115
+ /** ISO 8601 time the check started, or null before it starts and when the host reports none. */
116
+ readonly startedAt: string | null
117
+ /** ISO 8601 time the check completed, or null while it runs and when the host reports none. */
118
+ readonly completedAt: string | null
119
+ }
120
+ ```
121
+
122
+ ```ts type-equiv
123
+ /** Combined outcome of all checks on the head commit. */
124
+ type ChecksRollup = 'none' | 'pending' | 'success' | 'failure'
125
+ ```
126
+
127
+ ```ts type-equiv
128
+ /** Whether the change request can merge into its base without conflicts. */
129
+ type Mergeability = 'mergeable' | 'conflicting' | 'unknown'
130
+ ```
131
+
132
+ ```ts type-equiv
133
+ /** Aggregate review outcome required by the host's merge rules. */
134
+ type ReviewDecision = 'approved' | 'changes-requested' | 'review-required' | 'none'
135
+ ```
136
+
137
+ ```ts type-equiv
138
+ /** Status of one change request at the time its provider read it. */
139
+ interface ChangeRequestSnapshot {
140
+ /** Change request the snapshot describes. */
141
+ readonly ref: ChangeRequestRef
142
+ /** Web page of the change request. */
143
+ readonly url: string
144
+ /** Title as the author wrote it. */
145
+ readonly title: string
146
+ /** Lifecycle state. */
147
+ readonly state: ChangeRequestState
148
+ /** Whether the author marked the change request as a draft. */
149
+ readonly draft: boolean
150
+ /** Author login, or null when the host hides it. */
151
+ readonly author: string | null
152
+ /** Branch that carries the proposed commits. */
153
+ readonly headBranch: string
154
+ /** Commit object name at the head of the change request. */
155
+ readonly headSha: string
156
+ /** Branch the change request merges into. */
157
+ readonly baseBranch: string
158
+ /** Lines the change request adds. */
159
+ readonly additions: number
160
+ /** Lines the change request deletes. */
161
+ readonly deletions: number
162
+ /** Merge conflict status; `unknown` while the host computes it. */
163
+ readonly mergeability: Mergeability
164
+ /**
165
+ * Whether the host would merge the change request now for the signed-in
166
+ * user: open, not a draft, and meeting the base branch's merge rules.
167
+ */
168
+ readonly mergeReady: boolean
169
+ /** Merge methods the repository accepts, the signed-in user's usual one first. */
170
+ readonly mergeMethods: readonly MergeMethod[]
171
+ /** Aggregate review outcome. */
172
+ readonly reviewDecision: ReviewDecision
173
+ /** Checks on the head commit in host order. */
174
+ readonly checks: readonly ChangeRequestCheck[]
175
+ /** Combined check outcome. */
176
+ readonly checksRollup: ChecksRollup
177
+ /** Whether the host reported more checks than `checks` contains. */
178
+ readonly checksTruncated: boolean
179
+ /** Number of review threads that are not resolved. */
180
+ readonly unresolvedThreads: number
181
+ /** ISO 8601 time of the host's last update to the change request. */
182
+ readonly updatedAt: string
183
+ /** ISO 8601 time the change request was merged or closed, or null while it is open. */
184
+ readonly closedAt: string | null
185
+ }
186
+ ```
187
+
188
+ ```ts type-equiv
189
+ /** Why a provider could not read a change request. */
190
+ interface ForgeFailure {
191
+ /**
192
+ * `not-found`: the host does not expose it; `unauthenticated`: credentials are missing or rejected;
193
+ * `too-large`: the host or the provider refuses an answer over its size limit, so reading again fails
194
+ * the same way; `unavailable`: any other failure.
195
+ */
196
+ readonly code: 'not-found' | 'unauthenticated' | 'too-large' | 'unavailable'
197
+ /** Human-readable cause. */
198
+ readonly message: string
199
+ }
200
+ ```
201
+
202
+ ```ts type-equiv
203
+ /** Latest polling result delivered to watchers of one change request. */
204
+ type ChangeRequestUpdate = {
205
+ /** Canonical identity of the watched change request. */
206
+ readonly key: ChangeRequestKey
207
+ /** Epoch milliseconds when the result settled. */
208
+ readonly fetchedAt: number
209
+ } & ({
210
+ /** Status read from the host. */
211
+ readonly snapshot: ChangeRequestSnapshot
212
+ } | {
213
+ /** Reason the status could not be read. */
214
+ readonly failure: ForgeFailure
215
+ })
216
+ ```
217
+
218
+ ```ts type-equiv
219
+ /**
220
+ * Receives every polling result for one watched change request.
221
+ * @param update - the settled result.
222
+ */
223
+ type ChangeRequestListener = (update: ChangeRequestUpdate) => void
224
+ ```
225
+
226
+ ## 变更请求操作
227
+
228
+ `ctx.forge.markReady` 把草稿标记为可评审,`ctx.forge.merge` 只在 head 仍是用户确认的提交时合并变更请求。主机拒绝时,两者都 resolve 为 `ForgeActionFailure` 而不是抛错,并在结束后立即轮询被监听的变更请求。快照的 `mergeReady` 与 `mergeMethods` 告诉消费方何时提供合并、可用哪些合并方式;GitHub 如何给出这两项由 [GitHub 提供方 README](../../packages/experimental/forge-github/README.zh.md#use-this-package) 说明。
229
+
230
+ ```ts type-equiv
231
+ /** A merge the user confirmed for the head commit they saw. */
232
+ interface MergeRequest {
233
+ /** How the commits enter the base branch. */
234
+ readonly method: MergeMethod
235
+ /** Commit object name the head must still have; the merge is refused once the head moves. */
236
+ readonly headSha: string
237
+ }
238
+ ```
239
+
240
+ ```ts type-equiv
241
+ /** Why a provider could not change a change request. */
242
+ interface ForgeActionFailure {
243
+ /**
244
+ * `unauthenticated`: credentials are missing or rejected; `stale`: the head
245
+ * moved past the confirmed commit; `failed`: the host refused or could not be reached.
246
+ */
247
+ readonly code: 'unauthenticated' | 'stale' | 'failed'
248
+ /** Human-readable cause, usually the host's own message. */
249
+ readonly message: string
250
+ }
251
+ ```
252
+
253
+ `ctx.forge.submitReview` 将明确指定的评论或完整评审交给 provider;未实现此能力的 provider 返回不支持。消费者保存待提交草稿,并在再次提交前核对结果不明的写操作。
254
+
255
+ ```ts type-equiv
256
+ /** One inline comment addressed to the old or new side of a pull request diff. */
257
+ interface ForgeLineComment {
258
+ readonly path: string
259
+ readonly side: 'L' | 'R'
260
+ readonly startLine: number
261
+ readonly endLine: number
262
+ readonly body: string
263
+ }
264
+ ```
265
+
266
+ ```ts type-equiv
267
+ /** A single published comment or one completed review containing all pending comments. */
268
+ type ForgeReviewRequest = {
269
+ /** Commit the user reviewed; providers must check it before writing and address that commit explicitly. */
270
+ readonly headSha: string
271
+ } & (
272
+ | { readonly kind: 'comment'; readonly comment: ForgeLineComment }
273
+ | { readonly kind: 'review'; readonly event: 'comment' | 'approve' | 'request-changes'; readonly body: string; readonly comments: readonly ForgeLineComment[] }
274
+ )
275
+ ```
276
+
277
+ ```ts type-equiv
278
+ /** Result of a review write; unknown outcomes must be checked on the host before another submission. */
279
+ type ForgeReviewResult =
280
+ | { readonly ok: true; readonly url: string }
281
+ | { readonly ok: false; readonly code: 'unsupported' | 'stale' | 'failed' | 'unknown'; readonly message: string }
282
+ ```
283
+
284
+ ## Session 绑定
285
+
286
+ `ctx.forgeSession` 从每个 Session 自己的日志派生其绑定:`gh pr create` 的结果绑定其输出的 URL,`gh pr view`、`gh pr edit` 与 `gh pr checkout` 调用绑定它们所操作的变更请求,`git push` 的结果通过 `ctx.forge` 触发按 head 分支的发现;面板也会报告其检出所跟踪的分支,触发同样的发现。track、dismiss 与发现操作都是 `plugin:forge-session/binding` 插件记录,位于模型可见对话之外。`forgeChangeRequests` 投影的客户端视图随 Session 摘要下发,列出绑定但不含其状态。识别与发现规则见 [Session 绑定 README](../../packages/experimental/forge-session/README.zh.md#use-this-package)。
287
+
288
+ ```ts type-equiv
289
+ /**
290
+ * How a change request became bound to a Session: `created` when a
291
+ * `gh pr create` result printed its URL, `referenced` when a `gh pr view`,
292
+ * `gh pr edit`, or `gh pr checkout` call named it or its result printed its
293
+ * own URL, `discovered` when a lookup found it for a branch the Session pushed
294
+ * or works on, `tracked` when a caller bound it by URL.
295
+ */
296
+ type BindingOrigin = 'created' | 'referenced' | 'discovered' | 'tracked'
297
+ ```
298
+
299
+ ```ts type-equiv
300
+ /** Payload of the `plugin:forge-session/binding` record. */
301
+ interface BindingRecord {
302
+ /**
303
+ * `track` binds or restores, `dismiss` hides, `discover` binds a branch lookup,
304
+ * and `reference` binds a CLI selector lookup without restoring dismissed entries.
305
+ */
306
+ readonly action: 'track' | 'dismiss' | 'discover' | 'reference'
307
+ /** Web URL of the change request. */
308
+ readonly url: string
309
+ }
310
+ ```
311
+
312
+ ```ts type-equiv
313
+ /** One change request bound to a Session and not dismissed, with its latest polling result. */
314
+ interface SessionChangeRequest {
315
+ /** Web URL as first recorded. */
316
+ readonly url: string
317
+ /** How the change request became bound. */
318
+ readonly origin: BindingOrigin
319
+ /** Parsed reference, or null when no registered provider serves the URL. */
320
+ readonly ref: ChangeRequestRef | null
321
+ /** Latest polling result, or null before the first poll and without a provider. */
322
+ readonly update: ChangeRequestUpdate | null
323
+ }
324
+ ```
325
+
326
+ ```ts type-equiv
327
+ /**
328
+ * Receives the complete visible list after a binding or provider change, or a polling result.
329
+ * @param changeRequests - every visible binding of the watched Session, in first-recorded order.
330
+ */
331
+ type SessionChangeRequestsListener = (changeRequests: readonly SessionChangeRequest[]) => void
332
+ ```
333
+
334
+ ## 面板
335
+
336
+ `ctx.forgePanel` 是 [forge 面板](../../packages/experimental/client-ui-forge/README.zh.md#use-this-package)的宿主 Remote。跟随一个 Session 时,它以流的形式推送 `ForgePanelState`:在 Session 执行环境中对其当前目录进行的只读 Git 检查、从上游远端或 `origin` 识别出的代码托管平台、该平台的登录状态、Session 的绑定及其轮询状态与最近的快照,以及它的 worktree 请求。它的操作可以列出基准分支、绑定和隐藏 URL、刷新、把已绑定的草稿标记为可评审或合并已绑定的变更请求、请求或撤回 worktree、停止正在进行的创建,以及恢复已删除的 worktree 或离开它回到源检出。请求是一条 `plugin:client-ui-forge/worktree` 记录。消息在 Session 的 Agent 空闲时进入其收件箱,面板会在这次投递唤醒 [Agent](../../packages/core/agent/README.zh.md) 之前启动它的维护任务,暂留这条消息的这一轮:对未完成的请求,它通过 `ctx.worktrees` 创建 worktree,尝试失败或被停止后等待下一次尝试或请求被撤回;对在所创建 worktree 中工作的 Session,它检查该 worktree,已被删除时等待它被恢复或离开。面板状态说明消息在等待什么,以及最近一次失败的尝试。对于没有被暂留的消息,由第一个步骤提议创建 worktree。第一轮开始之后的请求会被忽略。对 Session 检出的改动以其 Agent 的维护任务运行,因此其他客户端发来的消息会等它们完成。
337
+
338
+ ```ts type-equiv
339
+ /** Git facts for the checkout that contains the Session's current directory. */
340
+ interface ForgeCheckout {
341
+ /** Top-level directory of the checkout. */
342
+ readonly root: string
343
+ /** Checked-out branch, or null when HEAD is detached. */
344
+ readonly branch: string | null
345
+ /** Whether the checkout is a linked worktree of another checkout's repository. */
346
+ readonly linked: boolean
347
+ /** Abbreviated commit HEAD names, or null while the checked-out branch has no commit. */
348
+ readonly commit: string | null
349
+ }
350
+ ```
351
+
352
+ ```ts type-equiv
353
+ /** Inspection result for the Session's current directory. */
354
+ type ForgeCheckoutState =
355
+ /** The first inspection has not finished. */
356
+ | { readonly state: 'pending' }
357
+ /** The current directory is not inside a Git checkout. */
358
+ | { readonly state: 'none' }
359
+ /** Git could not run or reported an error. */
360
+ | { readonly state: 'failed'; readonly message: string }
361
+ /** The checkout facts. */
362
+ | { readonly state: 'ready'; readonly checkout: ForgeCheckout }
363
+ ```
364
+
365
+ ```ts type-equiv
366
+ /** The worktree the panel created and entered for a Session before its first step. */
367
+ interface ForgeSessionWorktree {
368
+ /** Canonical checkout directory. */
369
+ readonly path: string
370
+ /** Branch created for the checkout. */
371
+ readonly branch: string
372
+ /** Requested base branch, or null when the checkout started from HEAD of the source checkout. */
373
+ readonly from: string | null
374
+ /** Commit object name the branch started from. */
375
+ readonly baseCommit: string
376
+ /** Canonical root of the source checkout. */
377
+ readonly repositoryRoot: string
378
+ }
379
+ ```
380
+
381
+ ```ts type-equiv
382
+ /** Payload of the `plugin:client-ui-forge/worktree` record. */
383
+ type WorktreeRecord =
384
+ /** Create a worktree before the Session's first step, starting from `from`, or from HEAD when it is null. */
385
+ | { readonly action: 'request'; readonly from: string | null }
386
+ /** Withdraw the open request. */
387
+ | { readonly action: 'cancel' }
388
+ /** The requested worktree was created and became the Session's working directory. */
389
+ | { readonly action: 'created'; readonly worktree: ForgeSessionWorktree }
390
+ /** Restoration started; the checkout stays unavailable until restoration completes. */
391
+ | { readonly action: 'restoring' }
392
+ /** The recorded worktree was completely restored. */
393
+ | { readonly action: 'restored' }
394
+ ```
395
+
396
+ ```ts type-equiv
397
+ /** One open worktree request. */
398
+ interface ForgeWorktreeRequest {
399
+ /** Base branch, or null for HEAD of the source checkout. */
400
+ readonly from: string | null
401
+ }
402
+ ```
403
+
404
+ ```ts type-equiv
405
+ /** Why the Session's checkout cannot host a new worktree. */
406
+ type ForgeWorktreeBlocker =
407
+ /** The current directory is not inside a Git checkout. */
408
+ | 'not-git'
409
+ /** The Session's sandbox cannot write the checkout or its Git directory, as for a linked worktree outside the writable root. */
410
+ | 'outside-writable-root'
411
+ /** The Session runs read-only. */
412
+ | 'read-only'
413
+ ```
414
+
415
+ ```ts type-equiv
416
+ /** One running worktree creation. */
417
+ interface ForgeWorktreeCreation {
418
+ /** Running step: `prepare` validates and creates the branch, then `checkout` writes the files. */
419
+ readonly phase: 'prepare' | 'checkout'
420
+ /** Branch the attempt creates. */
421
+ readonly branch: string
422
+ /** Base branch, or null for HEAD. */
423
+ readonly from: string | null
424
+ /**
425
+ * Whether a message waits for the creation before its turn starts. Only
426
+ * such a creation can be stopped, after which the message keeps waiting; a
427
+ * creation at the first step serves a message the Session already holds.
428
+ */
429
+ readonly held: boolean
430
+ }
431
+ ```
432
+
433
+ ```ts type-equiv
434
+ /** One running restoration of the removed worktree a Session works in. */
435
+ interface ForgeWorktreeRestoration {
436
+ /** Running step: `prepare` registers the checkout again, creating a missing branch, then `checkout` writes the files. */
437
+ readonly phase: 'prepare' | 'checkout'
438
+ }
439
+ ```
440
+
441
+ ```ts type-equiv
442
+ /** The last attempt to create the requested worktree for a message, which failed. */
443
+ interface ForgeWorktreeFailure {
444
+ /** Branch the attempt created, or null when it failed before naming one. */
445
+ readonly branch: string | null
446
+ /** Base branch of the attempt, or null for HEAD. */
447
+ readonly from: string | null
448
+ /** Step that failed. */
449
+ readonly phase: 'prepare' | 'checkout'
450
+ /** Failure text. */
451
+ readonly message: string
452
+ }
453
+ ```
454
+
455
+ ```ts type-equiv
456
+ /**
457
+ * What a message waits for before its turn starts: the creation of the
458
+ * requested worktree, or the restoration or leaving of the removed worktree
459
+ * the Session works in.
460
+ */
461
+ type ForgeWorktreeWaiting = 'creation' | 'restoration'
462
+ ```
463
+
464
+ ```ts type-equiv
465
+ /** The recorded worktree whose directory is missing, invalid, or incompletely restored. */
466
+ interface ForgeMissingWorktree {
467
+ /** Whether its branch exists, or null when an incomplete restoration cannot inspect it. */
468
+ readonly branchExists: boolean | null
469
+ }
470
+ ```
471
+
472
+ ```ts type-equiv
473
+ /** Worktree facts of one Session in the panel state. */
474
+ interface ForgePanelWorktree {
475
+ /**
476
+ * Whether the Session can still request or withdraw a worktree: a worktree
477
+ * service is mounted, no turn has started, and none was created.
478
+ */
479
+ readonly editable: boolean
480
+ /** Why the checkout cannot host a worktree, or null when it can, before the first inspection, and after a failed one. */
481
+ readonly blocker: ForgeWorktreeBlocker | null
482
+ /** Open request, or null without one. */
483
+ readonly request: ForgeWorktreeRequest | null
484
+ /** Created worktree, or null before creation. */
485
+ readonly created: ForgeSessionWorktree | null
486
+ /** Running creation, or null. */
487
+ readonly creation: ForgeWorktreeCreation | null
488
+ /**
489
+ * The last failed attempt of the creation a message waits for, or null. It
490
+ * clears when another attempt starts, when the request changes or is
491
+ * withdrawn, and when the wait ends.
492
+ */
493
+ readonly failure: ForgeWorktreeFailure | null
494
+ /** The created worktree the Session works in when its directory is gone, or null. */
495
+ readonly missing: ForgeMissingWorktree | null
496
+ /** Running restoration of the removed worktree, or null. */
497
+ readonly restoration: ForgeWorktreeRestoration | null
498
+ /** What a message of the Session waits for before its turn starts, or null while none waits. */
499
+ readonly waiting: ForgeWorktreeWaiting | null
500
+ }
501
+ ```
502
+
503
+ ```ts type-equiv
504
+ /** One bound change request in the panel state. */
505
+ interface ForgePanelChangeRequest extends SessionChangeRequest {
506
+ /** Latest snapshot a poll returned, kept while later polls fail, or null before the first successful poll. */
507
+ readonly snapshot: ChangeRequestSnapshot | null
508
+ }
509
+ ```
510
+
511
+ ```ts type-equiv
512
+ /** Everything the panel shows for one Session. */
513
+ interface ForgePanelState {
514
+ /** Current working directory of the Session. */
515
+ readonly directory: string
516
+ /** Inspection result for `directory`. */
517
+ readonly checkout: ForgeCheckoutState
518
+ /** Code host repository of the checkout's upstream remote or `origin`, or null when no provider serves them. */
519
+ readonly repository: ForgeRepository | null
520
+ /** Sign-in state for the repository's host, or null before the first probe and without a repository. */
521
+ readonly readiness: ForgeReadiness | null
522
+ /** Visible change request bindings with their latest polling results, in first-recorded order. */
523
+ readonly changeRequests: readonly ForgePanelChangeRequest[]
524
+ /** Worktree request and creation state. */
525
+ readonly worktree: ForgePanelWorktree
526
+ /**
527
+ * Files the `branch` scope changes, or null before the first inspection,
528
+ * outside a checkout, and without a fork point.
529
+ */
530
+ readonly local: ForgeLocalChanges | null
531
+ }
532
+ ```
533
+
534
+ ```ts type-equiv
535
+ /** Local branches offered as the base of a new worktree. */
536
+ interface ForgeBranches {
537
+ /** Checked-out branch, or null when HEAD is detached. */
538
+ readonly current: string | null
539
+ /** Local branch names, `current` first and then most recently committed first, at most `maxBranches`. */
540
+ readonly branches: readonly string[]
541
+ }
542
+ ```
543
+
544
+ 会话列表经同一个 Remote 读取。`changeRequestStates` 以流的形式推送 `ForgeChangeRequestStatesFrame`:先是一个 `baseline`,包含调用方可读的已列出 Session 所绑定的每个变更请求最近一次已知的 `ForgeChangeRequestListState`,之后是发生变化的状态。宿主用一次运行服务所有流:已加载 Session 的绑定取自 `ctx.forgeSession`,其他 Session 的绑定取自缓存的 Session 摘要而不加载它们;每个已绑定的变更请求保持订阅,已关闭的按空闲间隔轮询以检测重新打开,每次变化都会存储,因此重启后在下次轮询之前就能显示最近已知的状态。Session 摘要还带有 `forgeWorktree` 投影的客户端视图:Session 的目录就是所创建的 worktree 或位于其下时为该 worktree,否则为 null。
545
+
546
+ ```ts type-equiv
547
+ /**
548
+ * The last polled state of one change request that a listed Session binds, as
549
+ * the Session list shows it.
550
+ */
551
+ type ForgeChangeRequestListState = Pick<
552
+ ChangeRequestSnapshot, 'url' | 'title' | 'state' | 'draft' | 'checksRollup' | 'reviewDecision' | 'mergeability'
553
+ > & {
554
+ /** Change request number on its code host. */
555
+ readonly number: number
556
+ }
557
+ ```
558
+
559
+ ```ts type-equiv
560
+ /**
561
+ * One frame of `forgePanel.changeRequestStates`: the known state of every
562
+ * change request the reader may see first, then the states that changed or
563
+ * became visible since the previous frame.
564
+ */
565
+ type ForgeChangeRequestStatesFrame =
566
+ | { readonly type: 'baseline'; readonly states: readonly ForgeChangeRequestListState[] }
567
+ | { readonly type: 'changed'; readonly states: readonly ForgeChangeRequestListState[] }
568
+ ```
569
+
570
+ 变更视图经同一个 Remote 读取。`localDiff` 读取 Session 检出的某个 `ForgeLocalScope`;`changeRequestDiff` 经提供方的 `diff` 读取已绑定变更请求在其最新状态 head 处的变更;两者返回的文件都已在宿主上解析为 `ForgeDiffFile` 的 hunk。`localText` 与 `changeRequestText` 读取一个文件的新版本,用来补出 hunk 之间未变更的行。每次检查还会把 `branch` 范围的规模统计为 `ForgePanelState.local`,供面板的变更卡片使用,始终以自动分叉点为准。`base` 指定了引用的 `branch` 范围改为与 HEAD 和该分支的合并基准比较;`diffBases` 列出视图可选的分支以及自动分叉点。
571
+
572
+ ```ts type-equiv
573
+ /** Which local changes a diff covers; each reads the Session's checkout through Git. */
574
+ type ForgeLocalScope =
575
+ /**
576
+ * The working tree and untracked files against a fork point: the merge base of HEAD with the
577
+ * `base` ref, or while `base` is null, the base commit of the worktree the Session created,
578
+ * else the merge base of HEAD with the default branch of the code host remote.
579
+ */
580
+ | { readonly kind: 'branch'; readonly base: string | null }
581
+ /** The working tree and untracked files against HEAD. */
582
+ | { readonly kind: 'uncommitted' }
583
+ /** The working tree and untracked files against the index. */
584
+ | { readonly kind: 'unstaged' }
585
+ /** The index against HEAD. */
586
+ | { readonly kind: 'staged' }
587
+ ```
588
+
589
+ ```ts type-equiv
590
+ /** A branch the `branch` scope can compare with. */
591
+ interface ForgeBaseBranch {
592
+ /** Full ref name: `refs/heads/<branch>` or `refs/remotes/<remote>/<branch>`. */
593
+ readonly ref: string
594
+ /** The ref without `refs/heads/` or `refs/remotes/`, such as `master` or `origin/master`. */
595
+ readonly name: string
596
+ }
597
+ ```
598
+
599
+ ```ts type-equiv
600
+ /** What the `branch` scope compares with while no base branch is chosen. */
601
+ interface ForgeAutomaticBase {
602
+ /** The created worktree's base branch or abbreviated base commit, or the default branch of the code host remote. */
603
+ readonly name: string
604
+ /** Whether the fork point is the base commit of the worktree the Session created rather than a merge base. */
605
+ readonly worktree: boolean
606
+ }
607
+ ```
608
+
609
+ ```ts type-equiv
610
+ /** Branches the `branch` scope can compare with, whose names contain a query. */
611
+ interface ForgeBaseBranches {
612
+ /** The fork point used while no base branch is chosen, whatever the query; null without one. */
613
+ readonly automatic: ForgeAutomaticBase | null
614
+ /** Remote-tracking branches without symbolic refs such as `origin/HEAD`, most recently committed first, at most `maxBranches`. */
615
+ readonly remote: readonly ForgeBaseBranch[]
616
+ /** Local branches other than the checked-out one, most recently committed first, at most `maxBranches`. */
617
+ readonly local: readonly ForgeBaseBranch[]
618
+ }
619
+ ```
620
+
621
+ ```ts type-equiv
622
+ /** One hunk of a file diff. */
623
+ interface ForgeDiffHunk {
624
+ /** First old line the hunk covers, or the old line it comes before when it covers none. */
625
+ readonly oldStart: number
626
+ /** Old lines the hunk covers. */
627
+ readonly oldLines: number
628
+ /** First new line the hunk covers, or the new line it comes before when it covers none. */
629
+ readonly newStart: number
630
+ /** New lines the hunk covers. */
631
+ readonly newLines: number
632
+ /** Lines in patch form: a leading space for context, `+` for added, `-` for deleted, and `\` for a missing final newline. */
633
+ readonly lines: readonly string[]
634
+ }
635
+ ```
636
+
637
+ ```ts type-equiv
638
+ /** How one file changed. */
639
+ type ForgeDiffStatus = 'added' | 'deleted' | 'modified' | 'renamed'
640
+ ```
641
+
642
+ ```ts type-equiv
643
+ /** One changed file of a diff. */
644
+ interface ForgeDiffFile {
645
+ /** Path relative to the repository root after the change, or before it for a deleted file. */
646
+ readonly path: string
647
+ /** Path before a rename, else null. */
648
+ readonly previousPath: string | null
649
+ /** How the file changed. */
650
+ readonly status: ForgeDiffStatus
651
+ /** Whether the content is binary, which carries no hunks. */
652
+ readonly binary: boolean
653
+ /** Whether an untracked file exceeds `maxDiffBytes`, so it carries no hunks. */
654
+ readonly oversized: boolean
655
+ /** Whether Git does not track the file yet; only local diffs list such files. */
656
+ readonly untracked: boolean
657
+ /** Lines added. */
658
+ readonly additions: number
659
+ /** Lines deleted. */
660
+ readonly deletions: number
661
+ /** Hunks in file order; none for a binary file or a change of mode or name only. */
662
+ readonly hunks: readonly ForgeDiffHunk[]
663
+ }
664
+ ```
665
+
666
+ ```ts type-equiv
667
+ /** Local changes of the Session's checkout in one scope. */
668
+ interface ForgeLocalDiff {
669
+ /** Ref or abbreviated commit the `branch` scope compares with, such as `origin/master`; null for other scopes. */
670
+ readonly base: string | null
671
+ /** Changed files in Git's path order, untracked files last. */
672
+ readonly files: readonly ForgeDiffFile[]
673
+ /** Untracked files left out beyond `maxUntrackedFiles`. */
674
+ readonly omitted: number
675
+ }
676
+ ```
677
+
678
+ ```ts type-equiv
679
+ /** Changes of a change request as its code host computes them. */
680
+ interface ForgeChangeRequestDiff {
681
+ /** Head commit the diff describes. */
682
+ readonly headSha: string
683
+ /** Changed files in the host's order. */
684
+ readonly files: readonly ForgeDiffFile[]
685
+ /**
686
+ * Commits the checkout's branch has beyond the head when that branch is the change request's head
687
+ * branch and the head commit is present locally; null otherwise.
688
+ */
689
+ readonly localAhead: number | null
690
+ /** Web page of each changed file at the head commit, by path. */
691
+ readonly fileUrls: Readonly<Record<string, string>>
692
+ }
693
+ ```
694
+
695
+ ```ts type-equiv
696
+ /** One file the `branch` scope changes, without its hunks. */
697
+ interface ForgeChangedFile {
698
+ /** Path relative to the repository root after the change. */
699
+ readonly path: string
700
+ /** Lines added, or 0 for a binary file. */
701
+ readonly additions: number
702
+ /** Lines deleted, or 0 for a binary file. */
703
+ readonly deletions: number
704
+ /** Whether the content is binary. */
705
+ readonly binary: boolean
706
+ }
707
+ ```
708
+
709
+ ```ts type-equiv
710
+ /** Size of the `branch` scope, which the panel's local changes card shows. */
711
+ interface ForgeLocalChanges {
712
+ /** Ref or abbreviated commit the scope compares with. */
713
+ readonly base: string
714
+ /** Changed files in Git's path order, untracked files last, at most `maxUntrackedFiles` of those. */
715
+ readonly files: readonly ForgeChangedFile[]
716
+ }
717
+ ```
718
+
719
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
720
+
721
+ <a id="cordis-surface"></a>
722
+
723
+ ## Cordis API
724
+
725
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
726
+
727
+ <a id="ctxforge--forgeservice"></a>
728
+
729
+ ### `ctx.forge` — `ForgeService`
730
+
731
+ Registry of forge providers. Watchers of one change request share a single polling loop; each forge has at most one fetch in flight, which batches every due change request of that forge.
732
+
733
+ ```ts cordis-catalog
734
+ /**
735
+ * Register the provider of one forge family as an effect on the calling
736
+ * fiber. Watches of that forge receive an `unavailable` failure when the
737
+ * registration ends. Unregistering cancels and awaits its in-flight calls;
738
+ * results from the withdrawn registration are discarded.
739
+ * @param provider - provider to serve `provider.forge`.
740
+ * @returns the disposer that unregisters the provider and waits for its calls to finish.
741
+ * @throws when another provider already serves the same forge.
742
+ */
743
+ register(provider: ForgeProvider): () => Promise<void>
744
+
745
+ /**
746
+ * Map a Git remote URL to a repository through the first provider that serves it.
747
+ * @param url - fetch or push URL as Git reports it.
748
+ * @returns the repository, or undefined when no provider serves the URL.
749
+ */
750
+ repositoryFromRemote(url: string): ForgeRepository | undefined
751
+
752
+ /**
753
+ * Map a change request web URL through the first provider that serves it.
754
+ * @param url - web URL of a pull or merge request.
755
+ * @returns the change request, or undefined when no provider serves the URL.
756
+ */
757
+ changeRequestFromUrl(url: string): ChangeRequestRef | undefined
758
+
759
+ /**
760
+ * Build the canonical web URL of a change request.
761
+ * @param ref - change request served by a registered provider.
762
+ * @returns the provider's canonical URL.
763
+ * @throws when no provider serves the change request's forge.
764
+ */
765
+ changeRequestUrl(ref: ChangeRequestRef): string
766
+
767
+ /**
768
+ * Find open change requests whose head is `branch`, excluding the default branch and forks.
769
+ * @param repository - repository served by a registered provider.
770
+ * @param branch - head branch name on the host.
771
+ * @param signal - cancellation for the lookup.
772
+ * @returns matching change requests, newest first as the provider reports them.
773
+ * @throws when no provider serves the repository's forge or the lookup fails.
774
+ */
775
+ async findByHead(repository: ForgeRepository, branch: string, signal: AbortSignal): Promise<readonly ChangeRequestRef[]>
776
+
777
+ /**
778
+ * Report whether the provider can reach the repository's host with current credentials.
779
+ * @param repository - repository served by a registered provider.
780
+ * @param signal - cancellation for the probe.
781
+ * @returns the provider's readiness for the host.
782
+ * @throws when no provider serves the repository's forge.
783
+ */
784
+ async readiness(repository: ForgeRepository, signal: AbortSignal): Promise<ForgeReadiness>
785
+
786
+ /**
787
+ * Mark a draft change request ready for review, then poll it at once when it is watched.
788
+ * @param ref - change request served by a registered provider.
789
+ * @param signal - cancellation of the request.
790
+ * @returns undefined once the host accepted the change, or why it did not.
791
+ * @throws when no provider serves the change request's forge, or with `signal.reason` when it aborts.
792
+ */
793
+ async markReady(ref: ChangeRequestRef, signal: AbortSignal): Promise<ForgeActionFailure | undefined>
794
+
795
+ /**
796
+ * Merge a change request while its head is still `request.headSha`, then
797
+ * poll it at once when it is watched.
798
+ * @param ref - change request served by a registered provider.
799
+ * @param request - merge method and the head commit the user confirmed.
800
+ * @param signal - cancellation of the request.
801
+ * @returns undefined once the host merged it, or why it did not.
802
+ * @throws when no provider serves the change request's forge, or with `signal.reason` when it aborts.
803
+ */
804
+ async merge(ref: ChangeRequestRef, request: MergeRequest, signal: AbortSignal): Promise<ForgeActionFailure | undefined>
805
+
806
+ /**
807
+ * Read complete check details independently of periodic polling.
808
+ * @param ref - change request served by a registered provider.
809
+ * @param signal - cancellation of the detail view.
810
+ * @returns a complete snapshot or the provider's failure; unsupported providers return unavailable.
811
+ * @throws on cancellation, provider disposal, or expiry of this read's own `fetchTimeoutMs` deadline.
812
+ */
813
+ async fetchChecks(ref: ChangeRequestRef, signal: AbortSignal): Promise<ChangeRequestSnapshot | ForgeFailure>
814
+
815
+ /**
816
+ * Read the changes of a change request as its host computes them.
817
+ * @param ref - change request served by a registered provider.
818
+ * @param signal - cancellation of the read.
819
+ * @returns one unified patch with `a/` and `b/` path prefixes, or why the host did not provide it.
820
+ * @throws when no provider serves the change request's forge, or with `signal.reason` when it aborts.
821
+ */
822
+ async diff(ref: ChangeRequestRef, signal: AbortSignal): Promise<string | ForgeFailure>
823
+
824
+ /**
825
+ * Publish one comment or a completed review, then refresh the watched status.
826
+ * @param ref - change request served by a registered provider.
827
+ * @param request - explicitly selected commit, comments, and review decision.
828
+ * @param signal - request cancellation.
829
+ * @returns a publication URL or a failure, including an unknown write outcome.
830
+ */
831
+ async submitReview(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
832
+
833
+ /**
834
+ * Read the text of one file at a commit of a change request's repository.
835
+ * @param ref - change request served by a registered provider.
836
+ * @param commit - commit object name.
837
+ * @param path - path relative to the repository root.
838
+ * @param signal - cancellation of the read.
839
+ * @returns the text, or why the host did not provide it.
840
+ * @throws when no provider serves the change request's forge, or with `signal.reason` when it aborts.
841
+ */
842
+ async fileText(ref: ChangeRequestRef, commit: string, path: string, signal: AbortSignal): Promise<string | ForgeFailure>
843
+
844
+ /**
845
+ * Build the web page of one file at a commit of a change request's repository.
846
+ * @param ref - change request served by a registered provider.
847
+ * @param commit - commit object name.
848
+ * @param path - path relative to the repository root.
849
+ * @returns the provider's URL.
850
+ * @throws when no provider serves the change request's forge.
851
+ */
852
+ fileUrl(ref: ChangeRequestRef, commit: string, path: string): string
853
+
854
+ /**
855
+ * Watch one change request as an effect on the calling fiber. The first
856
+ * watcher starts polling at once; listeners receive every later result,
857
+ * and `latest` returns the current one. Polling stops when the last watcher
858
+ * leaves. Listeners must not throw; a thrown error is logged and skipped.
859
+ * @param ref - change request to poll.
860
+ * @param listener - receives each polling result.
861
+ * @returns the disposer that stops this watch.
862
+ */
863
+ watch(ref: ChangeRequestRef, listener: ChangeRequestListener): () => void
864
+
865
+ /**
866
+ * Poll a watched change request at once, including after a terminal state.
867
+ * A fetch already in flight is followed immediately by another fetch; an
868
+ * unwatched change request is unchanged.
869
+ * @param ref - change request to poll.
870
+ */
871
+ refresh(ref: ChangeRequestRef): void
872
+
873
+ /**
874
+ * Read the latest polling result of a watched change request.
875
+ * @param ref - change request to read.
876
+ * @returns the latest result, or undefined before the first result or without a watch.
877
+ */
878
+ latest(ref: ChangeRequestRef): ChangeRequestUpdate | undefined
879
+ ```
880
+
881
+ Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental/forge/src/index.ts)
882
+
883
+ <a id="ctxforgepanel--forgepanelcontroller"></a>
884
+
885
+ ### `ctx.forgePanel` — `ForgePanelController`
886
+
887
+ Serves the forge panel. Following a Session inspects the checkout of its current directory using the Session's permissions and execution world, recognizes the code host of the upstream remote or `origin`, probes sign-in for that host, and polls the Session's bound change requests through `ctx.forge` until the last follower of that Session leaves. A worktree request makes the panel create a branch and checkout through an optional `ctx.worktrees` and enter it while the Session's first message waits in the inbox, or at the first step proposal of a message no wait took. After a failed or stopped attempt the message keeps waiting for another attempt or for the request to be withdrawn. A message also waits while the worktree the Session works in is gone, until that worktree is checked out again or left for the source checkout. Changes to a Session's checkout run as Agent maintenance, so a message that arrives meanwhile waits for them.
888
+
889
+ ```ts cordis-catalog
890
+ /**
891
+ * Stream the panel state of a Session: the current state first, then each
892
+ * later state. Intermediate states may be skipped when the reader is slower
893
+ * than the updates. The stream ends when `signal` aborts or the Remote stops.
894
+ * @param session - Session to follow.
895
+ * @param signal - ends the stream.
896
+ * @returns panel states in publication order.
897
+ */
898
+ @Remote({ mode: 'stream' }) async *follow(session: Session, signal: AbortSignal): AsyncIterable<ForgePanelState>
899
+
900
+ /**
901
+ * Stream the last known state of every change request that a listed
902
+ * Session the caller may read binds: the stored states first, then each
903
+ * state a poll changes or a new binding reveals. Listing reads no Session
904
+ * log: loaded Sessions report their bindings, others the cached Session
905
+ * summary, and a Session without one shows nothing until it is opened.
906
+ * Closed requests are polled at the idle cadence so reopening is observed. The
907
+ * stream ends when `signal` aborts or the Remote stops.
908
+ * @param signal - ends the stream.
909
+ * @returns frames in publication order.
910
+ * @throws when the Host lacks the Session query, projection cache, storage, or Session store service.
911
+ */
912
+ @Remote({ mode: 'stream' }) async *changeRequestStates(signal: AbortSignal): AsyncIterable<ForgeChangeRequestStatesFrame>
913
+
914
+ /**
915
+ * List the local branches that can start a worktree of the Session's current checkout.
916
+ * @param session - Session whose current directory is listed.
917
+ * @param signal - request cancellation.
918
+ * @returns the checked-out branch and at most `maxBranches` local branches, the checked-out one first.
919
+ * @throws when the current directory is not inside a checkout or Git fails.
920
+ */
921
+ @Remote async branches(session: Session, signal: AbortSignal): Promise<ForgeBranches>
922
+
923
+ /**
924
+ * List the branches the `branch` scope of the Session's current checkout can compare with.
925
+ * @param session - Session whose checkout is read.
926
+ * @param query - text the branch names must contain, ignoring case; empty for every branch.
927
+ * @param signal - request cancellation.
928
+ * @returns the automatic fork point and at most `maxBranches` remote-tracking and local branches each,
929
+ * most recently committed first, without the checked-out branch.
930
+ * @throws `forgePanel/not-a-checkout` outside a checkout; the Git error when Git fails or the listed refs exceed `maxDiffBytes`.
931
+ */
932
+ @Remote async diffBases(session: Session, query: string, signal: AbortSignal): Promise<ForgeBaseBranches>
933
+
934
+ /**
935
+ * Bind a change request to a Session by URL, or restore a dismissed binding.
936
+ * @param session - Session that receives the binding.
937
+ * @param url - web URL of the change request.
938
+ * @param signal - request cancellation.
939
+ * @throws `forgePanel/unrecognized-url` when no registered provider serves the URL.
940
+ */
941
+ @Remote async track(session: Session, url: string, signal: AbortSignal): Promise<void>
942
+
943
+ /**
944
+ * Hide a visible binding of a Session; other URLs leave the Session unchanged.
945
+ * @param session - Session that owns the binding.
946
+ * @param url - web URL of the change request.
947
+ * @param signal - request cancellation.
948
+ */
949
+ @Remote async dismiss(session: Session, url: string, signal: AbortSignal): Promise<void>
950
+
951
+ /**
952
+ * Reinspect a followed Session's checkout, probe sign-in again, and poll its
953
+ * change requests at once; an unfollowed Session is unchanged.
954
+ * @param session - Session whose panel refreshes.
955
+ * @param signal - request cancellation.
956
+ * @returns settles once the inspection and the sign-in probe have ended; poll results reach the panel stream later.
957
+ */
958
+ @Remote async refresh(session: Session, signal: AbortSignal): Promise<void>
959
+
960
+ /**
961
+ * Read the changes one scope covers in the checkout of the Session's
962
+ * current directory, with Git using the Session's sandbox policy.
963
+ * @param session - Session whose checkout is read.
964
+ * @param scope - which changes to read.
965
+ * @param signal - request cancellation.
966
+ * @returns the files, the base of the `branch` scope, and the untracked files left out.
967
+ * @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/base-missing` when the base branch
968
+ * chosen for the `branch` scope does not exist; `forgePanel/no-fork-point` for the `branch` scope without
969
+ * a fork point; `forgePanel/filter-config-failed` when filter configuration cannot be read completely, before
970
+ * any comparison; `forgePanel/diff-too-large` over `maxDiffBytes`; the Git error when Git fails.
971
+ */
972
+ @Remote async localDiff(session: Session, scope: ForgeLocalScope, signal: AbortSignal): Promise<ForgeLocalDiff>
973
+
974
+ /**
975
+ * Read the new side of one changed file in a scope, which supplies the
976
+ * unchanged lines between its hunks: the index for `staged`, else the working tree.
977
+ * @param session - Session whose checkout is read.
978
+ * @param scope - the scope the diff was read in.
979
+ * @param path - path relative to the checkout's top-level directory, as the diff names it.
980
+ * @param signal - request cancellation.
981
+ * @returns the text.
982
+ * @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/diff-too-large` over `maxDiffBytes`;
983
+ * an error for a path outside the checkout, binary content, or a failed read.
984
+ */
985
+ @Remote async localText(session: Session, scope: ForgeLocalScope, path: string, signal: AbortSignal): Promise<string>
986
+
987
+ /**
988
+ * Load complete checks for the change request whose list the user opened.
989
+ * @param session - Session retaining the visible binding.
990
+ * @param url - binding URL.
991
+ * @param headSha - commit displayed by the card; a different head rejects the result.
992
+ * @param signal - cancellation when the list closes.
993
+ * @returns the complete snapshot at the displayed head.
994
+ * @throws `forgePanel/not-bound` for an invisible binding, `forgePanel/stale-head` for a moved head,
995
+ * or `forgePanel/checks-failed` when the provider cannot complete the read.
996
+ */
997
+ @Remote async changeRequestChecks(session: Session, url: string, headSha: string, signal: AbortSignal): Promise<ChangeRequestSnapshot>
998
+
999
+ /**
1000
+ * Read the changes of a change request of a Session as its code host
1001
+ * computes them, at the head commit of its latest status. A patch already
1002
+ * read at the same head commit and base branch is reused from memory, for
1003
+ * any Session, until `maxCachedDiffBytes` evicts it.
1004
+ * @param session - Session the change request is bound to.
1005
+ * @param url - binding URL of the change request.
1006
+ * @param signal - request cancellation.
1007
+ * @returns the files, the head commit, each file's web page, and the commits the checkout has beyond the head.
1008
+ * @throws `forgePanel/not-bound` unless the URL is a visible binding of the Session that a provider serves;
1009
+ * `forgePanel/diff-too-large` when the host or its provider refuses the diff over a size limit;
1010
+ * `forgePanel/diff-failed` before its status was read and when the host does not provide the diff otherwise.
1011
+ */
1012
+ @Remote async changeRequestDiff(session: Session, url: string, signal: AbortSignal): Promise<ForgeChangeRequestDiff>
1013
+
1014
+ /**
1015
+ * Read one file of a change request's repository at a commit, which
1016
+ * supplies the unchanged lines between the hunks of its diff.
1017
+ * @param session - Session the change request is bound to.
1018
+ * @param url - binding URL of the change request.
1019
+ * @param commit - commit object name, the head commit of the diff.
1020
+ * @param path - path relative to the repository root.
1021
+ * @param signal - request cancellation.
1022
+ * @returns the text.
1023
+ * @throws `forgePanel/not-bound` unless the URL is a visible binding of the Session that a provider serves;
1024
+ * `forgePanel/diff-too-large` when the host or its provider refuses the file over a size limit;
1025
+ * `forgePanel/diff-failed` when the host does not provide the file otherwise.
1026
+ */
1027
+ @Remote async changeRequestText(session: Session, url: string, commit: string, path: string, signal: AbortSignal): Promise<string>
1028
+
1029
+ /**
1030
+ * Publish a line comment or completed review for a visible Session binding.
1031
+ * @param session - Session retaining the change request.
1032
+ * @param url - visible binding URL.
1033
+ * @param request - reviewed head, ranges, plain text, and explicit review decision.
1034
+ * @param signal - request cancellation.
1035
+ * @returns confirmed publication or a typed failure; unknown outcomes require reconciliation on the host.
1036
+ */
1037
+ @Remote async submitReview(session: Session, url: string, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
1038
+
1039
+ /**
1040
+ * Mark a draft change request of a Session ready for review; the change
1041
+ * request is polled again once the host answers.
1042
+ * @param session - Session the change request is bound to.
1043
+ * @param url - binding URL of the change request.
1044
+ * @param signal - request cancellation.
1045
+ * @throws `forgePanel/not-bound` unless the URL is a visible binding of the Session that a provider serves;
1046
+ * `forgePanel/action-failed` with the host's reason when the host refuses or cannot be reached.
1047
+ */
1048
+ @Remote async markReady(session: Session, url: string, signal: AbortSignal): Promise<void>
1049
+
1050
+ /**
1051
+ * Merge a change request of a Session while its head is still `headSha`;
1052
+ * the change request is polled again once the host answers.
1053
+ * @param session - Session the change request is bound to.
1054
+ * @param url - binding URL of the change request.
1055
+ * @param method - how the commits enter the base branch.
1056
+ * @param headSha - head commit the user confirmed.
1057
+ * @param signal - request cancellation.
1058
+ * @throws `forgePanel/not-bound` unless the URL is a visible binding of the Session that a provider serves;
1059
+ * `forgePanel/stale-head` when the head moved past `headSha`; `forgePanel/action-failed` with the host's
1060
+ * reason when the host refuses otherwise or cannot be reached.
1061
+ */
1062
+ @Remote async merge(session: Session, url: string, method: MergeMethod, headSha: string, signal: AbortSignal): Promise<void>
1063
+
1064
+ /**
1065
+ * Ask for a new worktree before the Session's first turn, replacing an open
1066
+ * request and forgetting a failed attempt. While the next message waits in
1067
+ * the inbox, or else at the first step proposal, the panel creates a branch
1068
+ * from `from`, or from HEAD of the current checkout when it is null, and
1069
+ * enters its checkout. A message that already waits after a failed or
1070
+ * stopped attempt keeps waiting for {@link ForgePanelController.retryWorktree}.
1071
+ * @param session - Session without a started turn.
1072
+ * @param from - local base branch, or null for HEAD.
1073
+ * @param signal - request cancellation.
1074
+ * @throws `forgePanel/invalid-branch` when `from` is empty; `forgePanel/worktrees-unavailable`
1075
+ * without a worktree service; `forgePanel/session-started` after a turn started or the worktree was
1076
+ * created; `forgePanel/session-busy` while the worktree is being created.
1077
+ */
1078
+ @Remote async requestWorktree(session: Session, from: string | null, signal: AbortSignal): Promise<void>
1079
+
1080
+ /**
1081
+ * Withdraw the open worktree request of a Session with its failed attempt,
1082
+ * which lets a waiting message go on in the current checkout; without a
1083
+ * request the Session is unchanged. Withdrawing needs no worktree service.
1084
+ * @param session - Session without a started turn.
1085
+ * @param signal - request cancellation.
1086
+ * @throws `forgePanel/session-started` after a turn started or the worktree was created;
1087
+ * `forgePanel/session-busy` while the worktree is being created.
1088
+ */
1089
+ @Remote async cancelWorktree(session: Session, signal: AbortSignal): Promise<void>
1090
+
1091
+ /**
1092
+ * Stop the creation a message of the Session waits for; the message keeps
1093
+ * waiting with the request still open. Without such a creation the Session
1094
+ * is unchanged.
1095
+ * @param session - Session whose creation stops.
1096
+ * @param signal - request cancellation.
1097
+ */
1098
+ @Remote async stopCreation(session: Session, signal: AbortSignal): Promise<void>
1099
+
1100
+ /**
1101
+ * Make another attempt, with a new branch name, at the worktree a message
1102
+ * of the Session waits for after a failed or stopped attempt.
1103
+ * @param session - Session whose message waits.
1104
+ * @param signal - request cancellation.
1105
+ * @throws `forgePanel/not-waiting` when no message waits or an attempt is running.
1106
+ */
1107
+ @Remote async retryWorktree(session: Session, signal: AbortSignal): Promise<void>
1108
+
1109
+ /**
1110
+ * Check out the created worktree of a Session again at its recorded
1111
+ * directory when that directory is gone: its branch when the branch still
1112
+ * exists, otherwise a new branch of the same name at the base commit. Changes
1113
+ * that were never committed are not recovered. Runs as Agent maintenance,
1114
+ * inside the wait of a message that waits for the restoration, which then
1115
+ * goes on; without a missing directory the Session is unchanged.
1116
+ * @param session - Session whose worktree directory is gone.
1117
+ * @param signal - request cancellation, which aborts the restoration.
1118
+ * @throws `forgePanel/no-worktree` without a created worktree; `forgePanel/worktrees-unavailable`
1119
+ * without a worktree service; `forgePanel/session-busy` while the Session's Agent is not loaded or
1120
+ * has other work; `forgePanel/restore-failed` when Git fails.
1121
+ */
1122
+ @Remote async restoreWorktree(session: Session, signal: AbortSignal): Promise<void>
1123
+
1124
+ /**
1125
+ * Move a Session from its created worktree to the source checkout the
1126
+ * worktree came from; the Session no longer works in the worktree. Runs as
1127
+ * Agent maintenance, inside the wait of a message that waits for the removed
1128
+ * worktree, which then goes on.
1129
+ * @param session - Session with a created worktree.
1130
+ * @param signal - request cancellation.
1131
+ * @throws `forgePanel/no-worktree` without a created worktree; `forgePanel/session-busy` while the
1132
+ * Session's Agent is not loaded or has other work; the working-directory service's error when the
1133
+ * source checkout no longer exists.
1134
+ */
1135
+ @Remote async continueInProject(session: Session, signal: AbortSignal): Promise<void>
1136
+ ```
1137
+
1138
+ Types: [Session](session.zh.md)
1139
+
1140
+ Source: [`packages/experimental/client-ui-forge/src/index.ts`](../../packages/experimental/client-ui-forge/src/index.ts)
1141
+
1142
+ <a id="ctxforgesession--forgesessionservice"></a>
1143
+
1144
+ ### `ctx.forgeSession` — `ForgeSessionService`
1145
+
1146
+ Session-scoped change request bindings. The `forgeChangeRequests` projection derives them from `gh pr create`, `gh pr view`, `gh pr edit`, `gh pr checkout`, and `git push` results and from `plugin:forge-session/binding` records. After each push result, and when a caller reports the branch a Session works on, the service looks up open change requests whose head is that branch and records the unbound ones as discovered. Watching a Session polls its visible change requests through `ctx.forge`.
1147
+
1148
+ ```ts cordis-catalog
1149
+ /**
1150
+ * List the change requests bound to a Session and not dismissed.
1151
+ * @param session - Session whose bindings are read.
1152
+ * @returns visible bindings in first-recorded order, each with its latest polling result.
1153
+ */
1154
+ changeRequests(session: Session): SessionChangeRequest[]
1155
+
1156
+ /**
1157
+ * Bind a change request to a Session by URL, or restore a dismissed binding.
1158
+ * Appends a `track` record with the provider's canonical URL unless the
1159
+ * change request is already visible.
1160
+ * @param session - Session that receives the binding.
1161
+ * @param url - web URL of the change request.
1162
+ * @throws when no registered provider recognizes the URL.
1163
+ */
1164
+ track(session: Session, url: string): void
1165
+
1166
+ /**
1167
+ * Look up open change requests whose head is a branch the Session works on,
1168
+ * and record the unbound ones as discovered, as after a push of that branch.
1169
+ * A remote that no provider recognizes changes nothing; a failed lookup is
1170
+ * logged and changes nothing.
1171
+ * @param session - Session that receives the bindings.
1172
+ * @param remote - URL of the remote that holds the branch.
1173
+ * @param branch - branch name on that remote.
1174
+ * @returns resolves once the lookup has recorded its bindings or failed.
1175
+ */
1176
+ discoverBranch(session: Session, remote: string, branch: string): Promise<void>
1177
+
1178
+ /**
1179
+ * Hide a visible binding. Appends a `dismiss` record; a URL that is not
1180
+ * visibly bound leaves the log unchanged. Discovery never restores a
1181
+ * dismissed binding; `track` does.
1182
+ * @param session - Session that owns the binding.
1183
+ * @param url - web URL of the change request.
1184
+ */
1185
+ dismiss(session: Session, url: string): void
1186
+
1187
+ /**
1188
+ * Watch a Session's visible change requests as an effect on the calling
1189
+ * fiber. Every visible change request that a provider recognizes is polled
1190
+ * through `ctx.forge` while the Session has a watcher. Listeners receive the
1191
+ * complete list after each later binding or provider change, or polling result; read the
1192
+ * current list with {@link changeRequests}. Listeners must not throw; a
1193
+ * thrown error is logged and skipped.
1194
+ * @param session - Session to watch.
1195
+ * @param listener - receives the complete visible list.
1196
+ * @returns the disposer that stops this watch.
1197
+ */
1198
+ watch(session: Session, listener: SessionChangeRequestsListener): () => void
1199
+ ```
1200
+
1201
+ Types: [Session](session.zh.md)
1202
+
1203
+ Source: [`packages/experimental/forge-session/src/index.ts`](../../packages/experimental/forge-session/src/index.ts)
1204
+
1205
+ <a id="forge-events"></a>
1206
+
1207
+ ### `forge/*` events
1208
+
1209
+ <a id="forgeproviders-changed--parallel"></a>
1210
+
1211
+ #### `forge/providers-changed` — parallel
1212
+
1213
+ Announces a provider registration or withdrawal after the registry changes. Listener failures are logged without preventing other listeners from running.
1214
+
1215
+ ```ts cordis-catalog
1216
+ /**
1217
+ * Announces a provider registration or withdrawal after the registry changes.
1218
+ * Listener failures are logged without preventing other listeners from running.
1219
+ * @param forge - family whose provider changed.
1220
+ * @mode parallel
1221
+ */
1222
+ 'forge/providers-changed'(forge: string): void | Promise<void>
1223
+ ```
1224
+
1225
+ Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental/forge/src/index.ts)
1226
+ <!-- END GENERATED cordis-surface -->