@dipoleml/dcode-cli 1.1.0 → 1.2.1

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 (447) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +1081 -12
  2. package/dist/dcode.cjs +59368 -45608
  3. package/dist/packages/browser-use-plugin/README.md +12 -12
  4. package/dist/packages/browser-use-plugin/docs/api.json +1 -1
  5. package/dist/packages/browser-use-plugin/docs/overview.md +5 -4
  6. package/dist/packages/browser-use-plugin/docs/workflow.md +1 -1
  7. package/dist/packages/browser-use-plugin/scripts/build.mjs +1 -0
  8. package/dist/packages/browser-use-plugin/skills/control-browser/SKILL.md +10 -7
  9. package/dist/packages/bundled-skills/skills/dynamic-workflows/SKILL.md +760 -687
  10. package/dist/packages/bundled-skills/skills/dynamic-workflows/examples.md +310 -1
  11. package/dist/packages/bundled-skills/skills/dynamic-workflows/patterns.md +336 -4
  12. package/dist/packages/node-repl-host/.dcode-plugin/plugin.json +1 -1
  13. package/dist/packages/node-repl-host/dist/mcp/server.js +9 -14
  14. package/dist/packages/node-repl-host/scripts/build.mjs +1 -0
  15. package/dist/provider/dcode-builtin.json +6612 -202
  16. package/node_modules/@dcode/contracts/dist/compact/index.d.ts +7 -7
  17. package/node_modules/@dcode/contracts/dist/config/index.d.ts +1 -1
  18. package/node_modules/@dcode/contracts/dist/events/event-reducer.js +1 -0
  19. package/node_modules/@dcode/contracts/dist/events/in-memory-session-event-store.js +3 -2
  20. package/node_modules/@dcode/contracts/dist/events/session-event-retention.d.ts +8 -0
  21. package/node_modules/@dcode/contracts/dist/events/session-event-retention.js +18 -0
  22. package/node_modules/@dcode/contracts/dist/events/session.events.d.ts +94 -16
  23. package/node_modules/@dcode/contracts/dist/events/session.events.js +10 -0
  24. package/node_modules/@dcode/contracts/dist/hooks/index.d.ts +134 -134
  25. package/node_modules/@dcode/contracts/dist/hooks/workspace-hook-trust.d.ts +14 -14
  26. package/node_modules/@dcode/contracts/dist/index.d.ts +2 -0
  27. package/node_modules/@dcode/contracts/dist/index.js +2 -0
  28. package/node_modules/@dcode/contracts/dist/interfaces/browser-control.port.d.ts +22 -0
  29. package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-hole.port.d.ts +92 -0
  30. package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-hole.port.js +9 -0
  31. package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-retune.port.d.ts +4 -4
  32. package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-retune.port.js +7 -3
  33. package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-workspace.port.js +8 -3
  34. package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run.port.d.ts +119 -18
  35. package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run.port.js +13 -0
  36. package/node_modules/@dcode/contracts/dist/interfaces/index.d.ts +1 -0
  37. package/node_modules/@dcode/contracts/dist/interfaces/index.js +1 -0
  38. package/node_modules/@dcode/contracts/dist/interfaces/mcp.port.d.ts +161 -1
  39. package/node_modules/@dcode/contracts/dist/interfaces/mcp.port.js +17 -0
  40. package/node_modules/@dcode/contracts/dist/interfaces/permission-full-access.d.ts +15 -15
  41. package/node_modules/@dcode/contracts/dist/interfaces/permission-full-access.js +1 -1
  42. package/node_modules/@dcode/contracts/dist/interfaces/permission.port.d.ts +15 -1
  43. package/node_modules/@dcode/contracts/dist/interfaces/provider-endpoint-routing.port.d.ts +19 -0
  44. package/node_modules/@dcode/contracts/dist/interfaces/provider-endpoint-routing.port.js +1 -0
  45. package/node_modules/@dcode/contracts/dist/interfaces/session-store.port.d.ts +4 -2
  46. package/node_modules/@dcode/contracts/dist/interfaces/session-store.port.js +5 -0
  47. package/node_modules/@dcode/contracts/dist/interfaces/session.port.d.ts +92 -3
  48. package/node_modules/@dcode/contracts/dist/interfaces/session.port.js +4 -1
  49. package/node_modules/@dcode/contracts/dist/interfaces/topic-resource.port.d.ts +25 -0
  50. package/node_modules/@dcode/contracts/dist/interfaces/topic-resource.port.js +1 -0
  51. package/node_modules/@dcode/contracts/dist/model/index.d.ts +15 -1
  52. package/node_modules/@dcode/contracts/dist/model/index.js +5 -0
  53. package/node_modules/@dcode/contracts/dist/model/invocation-context.d.ts +6 -1
  54. package/node_modules/@dcode/contracts/dist/plugins/index.d.ts +23 -0
  55. package/node_modules/@dcode/contracts/dist/plugins/index.js +2 -1
  56. package/node_modules/@dcode/contracts/dist/telemetry/agent-execution.d.ts +2 -0
  57. package/node_modules/@dcode/contracts/dist/telemetry/agent-execution.js +2 -0
  58. package/node_modules/@dcode/contracts/dist/telemetry/index.d.ts +5 -1
  59. package/node_modules/@dcode/contracts/dist/telemetry/index.js +12 -0
  60. package/node_modules/@dcode/contracts/dist/tools/agent.d.ts +12 -12
  61. package/node_modules/@dcode/contracts/dist/tools/amend-workflow.d.ts +39 -15
  62. package/node_modules/@dcode/contracts/dist/tools/amend-workflow.js +12 -6
  63. package/node_modules/@dcode/contracts/dist/tools/automation.d.ts +32 -32
  64. package/node_modules/@dcode/contracts/dist/tools/automation.js +1 -1
  65. package/node_modules/@dcode/contracts/dist/tools/bash.d.ts +16 -16
  66. package/node_modules/@dcode/contracts/dist/tools/bash.js +1 -1
  67. package/node_modules/@dcode/contracts/dist/tools/create-workflow.d.ts +365 -66
  68. package/node_modules/@dcode/contracts/dist/tools/create-workflow.js +92 -11
  69. package/node_modules/@dcode/contracts/dist/tools/edit.d.ts +16 -16
  70. package/node_modules/@dcode/contracts/dist/tools/eval-workflow-snippet.d.ts +6 -6
  71. package/node_modules/@dcode/contracts/dist/tools/eval-workflow-snippet.js +5 -1
  72. package/node_modules/@dcode/contracts/dist/tools/fill-workflow-hole.d.ts +729 -0
  73. package/node_modules/@dcode/contracts/dist/tools/fill-workflow-hole.js +102 -0
  74. package/node_modules/@dcode/contracts/dist/tools/get-workflow-run.d.ts +136 -28
  75. package/node_modules/@dcode/contracts/dist/tools/get-workflow-run.js +36 -0
  76. package/node_modules/@dcode/contracts/dist/tools/grep.d.ts +4 -4
  77. package/node_modules/@dcode/contracts/dist/tools/grep.js +4 -0
  78. package/node_modules/@dcode/contracts/dist/tools/index.d.ts +2 -0
  79. package/node_modules/@dcode/contracts/dist/tools/index.js +4 -0
  80. package/node_modules/@dcode/contracts/dist/tools/list-saved-workflows.d.ts +8 -8
  81. package/node_modules/@dcode/contracts/dist/tools/list-workflow-runs.d.ts +8 -8
  82. package/node_modules/@dcode/contracts/dist/tools/node-repl.d.ts +2 -2
  83. package/node_modules/@dcode/contracts/dist/tools/off-peak.d.ts +3 -3
  84. package/node_modules/@dcode/contracts/dist/tools/off-peak.js +2 -2
  85. package/node_modules/@dcode/contracts/dist/tools/performance.d.ts +22 -22
  86. package/node_modules/@dcode/contracts/dist/tools/plan-mode.d.ts +12 -12
  87. package/node_modules/@dcode/contracts/dist/tools/plan-mode.js +6 -4
  88. package/node_modules/@dcode/contracts/dist/tools/read-session-context.d.ts +86 -13
  89. package/node_modules/@dcode/contracts/dist/tools/read-session-context.js +37 -6
  90. package/node_modules/@dcode/contracts/dist/tools/read.d.ts +38 -38
  91. package/node_modules/@dcode/contracts/dist/tools/save-workflow.d.ts +21 -10
  92. package/node_modules/@dcode/contracts/dist/tools/save-workflow.js +22 -2
  93. package/node_modules/@dcode/contracts/dist/tools/saved-workflow.d.ts +4 -4
  94. package/node_modules/@dcode/contracts/dist/tools/send-message.d.ts +2 -2
  95. package/node_modules/@dcode/contracts/dist/tools/skill.js +1 -0
  96. package/node_modules/@dcode/contracts/dist/tools/task-output.d.ts +6 -6
  97. package/node_modules/@dcode/contracts/dist/tools/tool-result-metadata.d.ts +1228 -259
  98. package/node_modules/@dcode/contracts/dist/tools/tool-result-metadata.js +41 -0
  99. package/node_modules/@dcode/contracts/dist/tools/webfetch.d.ts +2 -2
  100. package/node_modules/@dcode/contracts/dist/tools/workflow-observation-display.d.ts +20 -20
  101. package/node_modules/@dcode/contracts/dist/tools/workflow-settings.d.ts +55 -0
  102. package/node_modules/@dcode/contracts/dist/tools/workflow-settings.js +86 -0
  103. package/node_modules/@dcode/contracts/dist/tools/workflow.d.ts +8 -8
  104. package/node_modules/@dcode/contracts/dist/tools/write.d.ts +18 -18
  105. package/node_modules/@dcode/contracts/dist/workflow/index.d.ts +98 -98
  106. package/node_modules/@dcode/contracts/dist/workflow/script.d.ts +12 -12
  107. package/node_modules/@dcode/i18n/dist/index.js +2 -2
  108. package/node_modules/@dcode/i18n/dist/locale.d.ts +1 -1
  109. package/node_modules/@dcode/i18n/dist/locale.js +4 -4
  110. package/node_modules/@dcode/i18n/dist/locales/en-US.js +5 -5
  111. package/node_modules/@dcode/i18n/dist/locales/fr-CA.d.ts +3 -0
  112. package/node_modules/@dcode/i18n/dist/locales/fr-CA.js +354 -0
  113. package/node_modules/@dcode/model-option-map/package.json +1 -1
  114. package/node_modules/@dcode/shared/dist/api-key-usage-scene.d.ts +7 -0
  115. package/node_modules/@dcode/shared/dist/api-key-usage-scene.js +6 -0
  116. package/node_modules/@dcode/shared/dist/attachment-source.d.ts +8 -0
  117. package/node_modules/@dcode/shared/dist/attachment-source.js +4 -0
  118. package/node_modules/@dcode/shared/dist/background-bash-output.d.ts +4 -4
  119. package/node_modules/@dcode/shared/dist/bots.d.ts +763 -15
  120. package/node_modules/@dcode/shared/dist/bots.js +236 -2
  121. package/node_modules/@dcode/shared/dist/browser-use/command-metadata.d.ts +2 -2
  122. package/node_modules/@dcode/shared/dist/browser-use/commands.d.ts +4 -3
  123. package/node_modules/@dcode/shared/dist/browser-use/commands.js +3 -1
  124. package/node_modules/@dcode/shared/dist/browser-use/nodeReplBroker.d.ts +5 -4
  125. package/node_modules/@dcode/shared/dist/browser-use/result.d.ts +6 -6
  126. package/node_modules/@dcode/shared/dist/channel-mention.d.ts +173 -0
  127. package/node_modules/@dcode/shared/dist/channel-mention.js +120 -0
  128. package/node_modules/@dcode/shared/dist/channels.d.ts +128 -1
  129. package/node_modules/@dcode/shared/dist/channels.js +66 -0
  130. package/node_modules/@dcode/shared/dist/clientConfig.d.ts +1 -0
  131. package/node_modules/@dcode/shared/dist/clientConfig.js +18 -2
  132. package/node_modules/@dcode/shared/dist/cloudContent.d.ts +160 -0
  133. package/node_modules/@dcode/shared/dist/cloudContent.js +116 -0
  134. package/node_modules/@dcode/shared/dist/coding-plan-subscription.d.ts +59 -0
  135. package/node_modules/@dcode/shared/dist/conversation-message-projection-policy.js +2 -0
  136. package/node_modules/@dcode/shared/dist/conversation-share.d.ts +351 -47
  137. package/node_modules/@dcode/shared/dist/conversation-share.js +8 -6
  138. package/node_modules/@dcode/shared/dist/conversationSelection.d.ts +23 -0
  139. package/node_modules/@dcode/shared/dist/conversationSelection.js +30 -0
  140. package/node_modules/@dcode/shared/dist/database-startup.d.ts +5 -5
  141. package/node_modules/@dcode/shared/dist/dcode-agent-model-state.js +14 -6
  142. package/node_modules/@dcode/shared/dist/dcode-agent-policy.d.ts +16 -1
  143. package/node_modules/@dcode/shared/dist/dcode-agent-policy.js +17 -1
  144. package/node_modules/@dcode/shared/dist/dcode-agent-runtime.js +1 -1
  145. package/node_modules/@dcode/shared/dist/dcode-protocol/index.d.ts +1733 -318
  146. package/node_modules/@dcode/shared/dist/dcode-protocol/index.js +555 -24
  147. package/node_modules/@dcode/shared/dist/dcode-protocol/trace.d.ts +9 -0
  148. package/node_modules/@dcode/shared/dist/dcode-protocol/trace.js +10 -0
  149. package/node_modules/@dcode/shared/dist/dcode-protocol-legacy-types.d.ts +30 -20
  150. package/node_modules/@dcode/shared/dist/dcode-protocol-legacy-types.js +3 -1
  151. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/apply.js +12 -3
  152. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/attachment-ref.d.ts +5 -0
  153. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/attachment-ref.js +3 -0
  154. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/coalesce.d.ts +3 -1
  155. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/coalesce.js +3 -1
  156. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/command.d.ts +359 -28
  157. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/command.js +67 -45
  158. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/controller.d.ts +170 -65
  159. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-session-config.d.ts +20 -0
  160. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-session-config.js +15 -0
  161. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-workflow-display.d.ts +34 -0
  162. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-workflow-display.js +45 -1
  163. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/delta.d.ts +1453 -278
  164. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/delta.js +45 -2
  165. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/index.d.ts +1 -0
  166. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/index.js +1 -0
  167. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/input-intent.d.ts +173 -6
  168. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/input-intent.js +29 -0
  169. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/rows.d.ts +731 -125
  170. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/rows.js +23 -11
  171. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/sessions-index-workflow-activity.d.ts +30 -11
  172. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/sessions-index-workflow-activity.js +35 -3
  173. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/sessions-index.d.ts +40 -25
  174. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/snapshot.d.ts +1444 -216
  175. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/snapshot.js +3 -0
  176. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/submission.d.ts +1 -0
  177. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/submission.js +1 -1
  178. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/telemetry.d.ts +62 -58
  179. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/toolDisplay.d.ts +185 -50
  180. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/toolDisplay.js +31 -3
  181. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/transport.d.ts +7145 -1002
  182. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/transport.js +18 -5
  183. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/wire-assembler.js +2 -1
  184. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/wire-fault.js +4 -1
  185. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/wire-reassembly.js +5 -3
  186. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-artifacts.d.ts +29 -1
  187. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-artifacts.js +64 -4
  188. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-command-rejections.d.ts +13 -0
  189. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-command-rejections.js +23 -0
  190. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-observation-display.d.ts +14 -14
  191. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-row-meta.d.ts +52 -8
  192. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-row-meta.js +22 -3
  193. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-run-settings-command.d.ts +4 -4
  194. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-run-settings-command.js +2 -2
  195. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-session.d.ts +21 -0
  196. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-session.js +44 -0
  197. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-status.d.ts +1 -1
  198. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-status.js +3 -2
  199. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-caps.js +5 -4
  200. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-concurrency.d.ts +26 -19
  201. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-concurrency.js +40 -32
  202. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-delta.d.ts +4 -3
  203. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-delta.js +4 -3
  204. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-entries.d.ts +12 -2
  205. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-entries.js +44 -6
  206. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-eviction.d.ts +2 -2
  207. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-eviction.js +17 -10
  208. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-holes.d.ts +33 -0
  209. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-holes.js +202 -0
  210. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-legacy.d.ts +1 -1
  211. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-legacy.js +1 -1
  212. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-phases.js +10 -1
  213. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-reducer.d.ts +1 -1
  214. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-reducer.js +29 -22
  215. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-started.js +5 -2
  216. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-tables.js +2 -1
  217. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-unlisted.js +6 -3
  218. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs.d.ts +125 -40
  219. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs.js +101 -26
  220. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-workspace.d.ts +4 -4
  221. package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workspace-hook-review.d.ts +1 -1
  222. package/node_modules/@dcode/shared/dist/dcode-session-content-profile.d.ts +5 -0
  223. package/node_modules/@dcode/shared/dist/dcode-session-content-profile.js +49 -0
  224. package/node_modules/@dcode/shared/dist/dcode-slash-command-help.js +4 -4
  225. package/node_modules/@dcode/shared/dist/dcode-task-mode-schema.d.ts +6 -1
  226. package/node_modules/@dcode/shared/dist/dcode-task-mode-schema.js +13 -1
  227. package/node_modules/@dcode/shared/dist/dcode-task-types-core.d.ts +12 -2
  228. package/node_modules/@dcode/shared/dist/dcode-task-types.d.ts +23 -0
  229. package/node_modules/@dcode/shared/dist/dcodeEndpoint.d.ts +20 -1
  230. package/node_modules/@dcode/shared/dist/dcodeEndpoint.js +98 -17
  231. package/node_modules/@dcode/shared/dist/desktopMenu.js +48 -48
  232. package/node_modules/@dcode/shared/dist/dynamic-workflow-feature.d.ts +35 -6
  233. package/node_modules/@dcode/shared/dist/dynamic-workflow-feature.js +45 -6
  234. package/node_modules/@dcode/shared/dist/env.d.ts +5 -4
  235. package/node_modules/@dcode/shared/dist/env.js +9 -9
  236. package/node_modules/@dcode/shared/dist/errors.d.ts +24 -0
  237. package/node_modules/@dcode/shared/dist/errors.js +54 -0
  238. package/node_modules/@dcode/shared/dist/execution-state.d.ts +4 -2
  239. package/node_modules/@dcode/shared/dist/execution-state.js +1 -1
  240. package/node_modules/@dcode/shared/dist/feedback.d.ts +1 -1
  241. package/node_modules/@dcode/shared/dist/gen-ui/contract.d.ts +140 -0
  242. package/node_modules/@dcode/shared/dist/gen-ui/contract.example.d.ts +5 -0
  243. package/node_modules/@dcode/shared/dist/gen-ui/contract.example.js +36 -0
  244. package/node_modules/@dcode/shared/dist/gen-ui/contract.js +196 -0
  245. package/node_modules/@dcode/shared/dist/gen-ui/contract.test.d.ts +2 -0
  246. package/node_modules/@dcode/shared/dist/gen-ui/contract.test.js +75 -0
  247. package/node_modules/@dcode/shared/dist/gen-ui/index.d.ts +2 -0
  248. package/node_modules/@dcode/shared/dist/gen-ui/index.js +2 -0
  249. package/node_modules/@dcode/shared/dist/gen-ui/module.d.ts +7 -0
  250. package/node_modules/@dcode/shared/dist/gen-ui/module.js +7 -0
  251. package/node_modules/@dcode/shared/dist/gen-ui/tweakProtocol.d.ts +202 -0
  252. package/node_modules/@dcode/shared/dist/gen-ui/tweakProtocol.js +126 -0
  253. package/node_modules/@dcode/shared/dist/helpAppConfig.d.ts +1 -1
  254. package/node_modules/@dcode/shared/dist/helpAppConfig.js +2 -2
  255. package/node_modules/@dcode/shared/dist/highspeed.d.ts +181 -0
  256. package/node_modules/@dcode/shared/dist/highspeed.js +112 -0
  257. package/node_modules/@dcode/shared/dist/index.d.ts +27 -5
  258. package/node_modules/@dcode/shared/dist/index.js +24 -2
  259. package/node_modules/@dcode/shared/dist/localTtft.d.ts +27 -27
  260. package/node_modules/@dcode/shared/dist/marketingTouch.d.ts +930 -0
  261. package/node_modules/@dcode/shared/dist/marketingTouch.js +170 -0
  262. package/node_modules/@dcode/shared/dist/mcp-apps/appTools.d.ts +83 -0
  263. package/node_modules/@dcode/shared/dist/mcp-apps/appTools.js +124 -0
  264. package/node_modules/@dcode/shared/dist/mcp-apps/content.d.ts +4 -0
  265. package/node_modules/@dcode/shared/dist/mcp-apps/content.js +8 -0
  266. package/node_modules/@dcode/shared/dist/mcp-apps/contract.d.ts +241 -0
  267. package/node_modules/@dcode/shared/dist/mcp-apps/contract.example.d.ts +31 -0
  268. package/node_modules/@dcode/shared/dist/mcp-apps/contract.example.js +42 -0
  269. package/node_modules/@dcode/shared/dist/mcp-apps/contract.js +101 -0
  270. package/node_modules/@dcode/shared/dist/mcp-apps/contract.test.d.ts +2 -0
  271. package/node_modules/@dcode/shared/dist/mcp-apps/contract.test.js +64 -0
  272. package/node_modules/@dcode/shared/dist/mcp-apps/hostContract.d.ts +47 -0
  273. package/node_modules/@dcode/shared/dist/mcp-apps/hostContract.js +8 -0
  274. package/node_modules/@dcode/shared/dist/mcp-apps/index.d.ts +9 -0
  275. package/node_modules/@dcode/shared/dist/mcp-apps/index.js +9 -0
  276. package/node_modules/@dcode/shared/dist/mcp-apps/instance.d.ts +10 -0
  277. package/node_modules/@dcode/shared/dist/mcp-apps/instance.js +11 -0
  278. package/node_modules/@dcode/shared/dist/mcp-apps/module.d.ts +12 -0
  279. package/node_modules/@dcode/shared/dist/mcp-apps/module.js +12 -0
  280. package/node_modules/@dcode/shared/dist/mcp-apps/resourceMime.d.ts +8 -0
  281. package/node_modules/@dcode/shared/dist/mcp-apps/resourceMime.js +73 -0
  282. package/node_modules/@dcode/shared/dist/mcp-apps/sampling.d.ts +101 -0
  283. package/node_modules/@dcode/shared/dist/mcp-apps/sampling.js +107 -0
  284. package/node_modules/@dcode/shared/dist/mcp-apps/sampling.test.d.ts +2 -0
  285. package/node_modules/@dcode/shared/dist/mcp-apps/sampling.test.js +55 -0
  286. package/node_modules/@dcode/shared/dist/mcp-apps/schemas.d.ts +78 -0
  287. package/node_modules/@dcode/shared/dist/mcp-apps/schemas.js +65 -0
  288. package/node_modules/@dcode/shared/dist/mcp-apps/toolMeta.d.ts +39 -0
  289. package/node_modules/@dcode/shared/dist/mcp-apps/toolMeta.js +199 -0
  290. package/node_modules/@dcode/shared/dist/mcp.d.ts +6 -2
  291. package/node_modules/@dcode/shared/dist/memory.d.ts +9 -0
  292. package/node_modules/@dcode/shared/dist/memory.js +2 -0
  293. package/node_modules/@dcode/shared/dist/model-execution.d.ts +31 -0
  294. package/node_modules/@dcode/shared/dist/model-execution.js +38 -0
  295. package/node_modules/@dcode/shared/dist/networkCapture.d.ts +49 -0
  296. package/node_modules/@dcode/shared/dist/networkCapture.js +41 -0
  297. package/node_modules/@dcode/shared/dist/node/genUiPaths.d.ts +6 -0
  298. package/node_modules/@dcode/shared/dist/node/genUiPaths.js +16 -0
  299. package/node_modules/@dcode/shared/dist/node/genUiPaths.test.d.ts +2 -0
  300. package/node_modules/@dcode/shared/dist/node/genUiPaths.test.js +30 -0
  301. package/node_modules/@dcode/shared/dist/node/networkCapture.d.ts +8 -0
  302. package/node_modules/@dcode/shared/dist/node/networkCapture.js +96 -0
  303. package/node_modules/@dcode/shared/dist/node/officialPluginCache.d.ts +1 -2
  304. package/node_modules/@dcode/shared/dist/node/subagentMarkdownMigration.d.ts +1 -2
  305. package/node_modules/@dcode/shared/dist/node.d.ts +2 -0
  306. package/node_modules/@dcode/shared/dist/node.js +2 -0
  307. package/node_modules/@dcode/shared/dist/output-style.d.ts +17 -0
  308. package/node_modules/@dcode/shared/dist/output-style.js +2 -0
  309. package/node_modules/@dcode/shared/dist/platform.d.ts +149 -1
  310. package/node_modules/@dcode/shared/dist/platform.js +2 -0
  311. package/node_modules/@dcode/shared/dist/platformUpdate.d.ts +61 -0
  312. package/node_modules/@dcode/shared/dist/platformUpdate.js +2 -0
  313. package/node_modules/@dcode/shared/dist/plugin-marketplaces.d.ts +5 -0
  314. package/node_modules/@dcode/shared/dist/plugin-marketplaces.js +20 -14
  315. package/node_modules/@dcode/shared/dist/project-access-token-client.d.ts +42 -0
  316. package/node_modules/@dcode/shared/dist/project-access-token-client.js +260 -0
  317. package/node_modules/@dcode/shared/dist/project-access-token-response.d.ts +4 -0
  318. package/node_modules/@dcode/shared/dist/project-access-token-response.js +9 -0
  319. package/node_modules/@dcode/shared/dist/project-access-token.d.ts +45 -0
  320. package/node_modules/@dcode/shared/dist/project-access-token.js +164 -0
  321. package/node_modules/@dcode/shared/dist/protocol.d.ts +41 -4
  322. package/node_modules/@dcode/shared/dist/protocol.js +1 -1
  323. package/node_modules/@dcode/shared/dist/provider-provisioning.d.ts +26 -2
  324. package/node_modules/@dcode/shared/dist/provider-provisioning.js +19 -3
  325. package/node_modules/@dcode/shared/dist/providers.d.ts +1 -2
  326. package/node_modules/@dcode/shared/dist/providers.js +1 -1
  327. package/node_modules/@dcode/shared/dist/remote-workspace-identity.d.ts +6 -1
  328. package/node_modules/@dcode/shared/dist/remote-workspace-identity.js +35 -1
  329. package/node_modules/@dcode/shared/dist/remoteAppConfig.js +1 -1
  330. package/node_modules/@dcode/shared/dist/remoteEnvironmentKey.js +19 -0
  331. package/node_modules/@dcode/shared/dist/remoteTarget.d.ts +14 -1
  332. package/node_modules/@dcode/shared/dist/remoteTarget.js +4 -0
  333. package/node_modules/@dcode/shared/dist/remoteUsageTelemetry.d.ts +27 -0
  334. package/node_modules/@dcode/shared/dist/remoteUsageTelemetry.js +43 -0
  335. package/node_modules/@dcode/shared/dist/rendererActionTrace.d.ts +35 -35
  336. package/node_modules/@dcode/shared/dist/request-security-edition/index.d.ts +3 -0
  337. package/node_modules/@dcode/shared/dist/request-security-edition/index.js +3 -0
  338. package/node_modules/@dcode/shared/dist/request-security-edition/policy.d.ts +3 -0
  339. package/node_modules/@dcode/shared/dist/request-security-edition/policy.js +5 -0
  340. package/node_modules/@dcode/shared/dist/request-security-edition/verification-policy.d.ts +19 -0
  341. package/node_modules/@dcode/shared/dist/request-security-edition/verification-policy.js +29 -0
  342. package/node_modules/@dcode/shared/dist/rewardsBridge.d.ts +8 -0
  343. package/node_modules/@dcode/shared/dist/rewardsBridge.js +80 -0
  344. package/node_modules/@dcode/shared/dist/rewardsEmbedded.d.ts +37 -0
  345. package/node_modules/@dcode/shared/dist/rewardsEmbedded.js +50 -0
  346. package/node_modules/@dcode/shared/dist/sessionCreateTelemetry.d.ts +3 -3
  347. package/node_modules/@dcode/shared/dist/subagent-profile-frontmatter.d.ts +10 -0
  348. package/node_modules/@dcode/shared/dist/subagent-profile-frontmatter.js +212 -0
  349. package/node_modules/@dcode/shared/dist/subagent-profile-parser.d.ts +10 -0
  350. package/node_modules/@dcode/shared/dist/subagent-profile-parser.js +200 -0
  351. package/node_modules/@dcode/shared/dist/subagent-profile.d.ts +82 -0
  352. package/node_modules/@dcode/shared/dist/subagent-profile.js +28 -0
  353. package/node_modules/@dcode/shared/dist/subagent-runtime-config.d.ts +135 -0
  354. package/node_modules/@dcode/shared/dist/subagent-runtime-config.js +39 -0
  355. package/node_modules/@dcode/shared/dist/subagents-types.d.ts +1 -1
  356. package/node_modules/@dcode/shared/dist/task-realtime-core.d.ts +57 -24
  357. package/node_modules/@dcode/shared/dist/task-realtime-core.js +8 -2
  358. package/node_modules/@dcode/shared/dist/test-ids-workflow.d.ts +4 -0
  359. package/node_modules/@dcode/shared/dist/test-ids-workflow.js +5 -0
  360. package/node_modules/@dcode/shared/dist/test-ids.d.ts +25 -0
  361. package/node_modules/@dcode/shared/dist/test-ids.js +25 -0
  362. package/node_modules/@dcode/shared/dist/tool-identity.d.ts +1 -1
  363. package/node_modules/@dcode/shared/dist/tool-identity.js +4 -0
  364. package/node_modules/@dcode/shared/dist/tool-plan-adapter.js +14 -1
  365. package/node_modules/@dcode/shared/dist/usage-stats.d.ts +13 -0
  366. package/node_modules/@dcode/shared/dist/validation.d.ts +1461 -85
  367. package/node_modules/@dcode/shared/dist/validation.js +423 -14
  368. package/node_modules/@dcode/shared/dist/validationAppSettings.d.ts +71 -15
  369. package/node_modules/@dcode/shared/dist/validationAppSettings.js +74 -12
  370. package/node_modules/@dcode/shared/dist/web-remote-control-heartbeat.d.ts +8 -0
  371. package/node_modules/@dcode/shared/dist/web-remote-control-heartbeat.js +40 -0
  372. package/node_modules/@dcode/shared/dist/web-remote-control-rpc-transport.d.ts +183 -0
  373. package/node_modules/@dcode/shared/dist/web-remote-control-rpc-transport.js +562 -0
  374. package/node_modules/@dcode/shared/dist/web-remote-control.d.ts +645 -0
  375. package/node_modules/@dcode/shared/dist/web-remote-control.js +174 -0
  376. package/node_modules/@dcode/shared/package.json +5 -2
  377. package/node_modules/@dcode/tui/dist/app-approval-panel.js +3 -2
  378. package/node_modules/@dcode/tui/dist/app-approval.d.ts +3 -1
  379. package/node_modules/@dcode/tui/dist/app-approval.js +9 -5
  380. package/node_modules/@dcode/tui/dist/app-compact-timeline.d.ts +3 -0
  381. package/node_modules/@dcode/tui/dist/app-compact-timeline.js +5 -2
  382. package/node_modules/@dcode/tui/dist/app-empty-transcript.d.ts +1 -0
  383. package/node_modules/@dcode/tui/dist/app-empty-transcript.js +1 -1
  384. package/node_modules/@dcode/tui/dist/app-file-mentions.d.ts +2 -0
  385. package/node_modules/@dcode/tui/dist/app-file-mentions.js +2 -2
  386. package/node_modules/@dcode/tui/dist/app-input-pane.d.ts +38 -0
  387. package/node_modules/@dcode/tui/dist/app-input-pane.js +19 -19
  388. package/node_modules/@dcode/tui/dist/app-input-status.d.ts +17 -0
  389. package/node_modules/@dcode/tui/dist/app-input-status.js +4 -4
  390. package/node_modules/@dcode/tui/dist/app-input.d.ts +1 -0
  391. package/node_modules/@dcode/tui/dist/app-input.js +1 -1
  392. package/node_modules/@dcode/tui/dist/app-markdown-theme.d.ts +2 -1
  393. package/node_modules/@dcode/tui/dist/app-markdown-theme.js +1 -1
  394. package/node_modules/@dcode/tui/dist/app-markdown.d.ts +1 -0
  395. package/node_modules/@dcode/tui/dist/app-markdown.js +1 -1
  396. package/node_modules/@dcode/tui/dist/app-mode-command.d.ts +3 -0
  397. package/node_modules/@dcode/tui/dist/app-mode-command.js +4 -4
  398. package/node_modules/@dcode/tui/dist/app-mode-suggestion-panel.d.ts +5 -0
  399. package/node_modules/@dcode/tui/dist/app-mode-suggestion-panel.js +1 -1
  400. package/node_modules/@dcode/tui/dist/app-mode.d.ts +1 -1
  401. package/node_modules/@dcode/tui/dist/app-mode.js +1 -1
  402. package/node_modules/@dcode/tui/dist/app-model-ref.d.ts +1 -0
  403. package/node_modules/@dcode/tui/dist/app-model-ref.js +1 -1
  404. package/node_modules/@dcode/tui/dist/app-motion.d.ts +13 -0
  405. package/node_modules/@dcode/tui/dist/app-motion.js +17 -7
  406. package/node_modules/@dcode/tui/dist/app-session-event-handler.d.ts +33 -0
  407. package/node_modules/@dcode/tui/dist/app-session-event-handler.js +4 -4
  408. package/node_modules/@dcode/tui/dist/app-shiki-diff-view.d.ts +18 -1
  409. package/node_modules/@dcode/tui/dist/app-shiki-diff-view.js +3 -3
  410. package/node_modules/@dcode/tui/dist/app-shiki-highlighter.d.ts +3 -0
  411. package/node_modules/@dcode/tui/dist/app-shiki-highlighter.js +7 -2
  412. package/node_modules/@dcode/tui/dist/app-sidebar-layout.d.ts +10 -0
  413. package/node_modules/@dcode/tui/dist/app-sidebar-layout.js +4 -4
  414. package/node_modules/@dcode/tui/dist/app-submit.d.ts +1 -0
  415. package/node_modules/@dcode/tui/dist/app-submit.js +1 -1
  416. package/node_modules/@dcode/tui/dist/app-thought-components.d.ts +7 -0
  417. package/node_modules/@dcode/tui/dist/app-thought-components.js +2 -2
  418. package/node_modules/@dcode/tui/dist/app-tool-transcript.d.ts +1 -0
  419. package/node_modules/@dcode/tui/dist/app-tool-transcript.js +3 -0
  420. package/node_modules/@dcode/tui/dist/app-view.d.ts +27 -0
  421. package/node_modules/@dcode/tui/dist/app-view.js +1 -1
  422. package/node_modules/@dcode/tui/dist/app-workflow-card.js +1 -1
  423. package/node_modules/@dcode/tui/dist/app-workflow-seed.d.ts +18 -1
  424. package/node_modules/@dcode/tui/dist/app-workflow-seed.js +4 -4
  425. package/node_modules/@dcode/tui/dist/index.js +5118 -2579
  426. package/node_modules/@dcode/tui/dist/tui.d.ts +3 -0
  427. package/node_modules/@dcode/tui/dist/tui.js +1 -1
  428. package/node_modules/@dcode/tui/dist/types.d.ts +1 -1
  429. package/node_modules/oniguruma-parser/LICENSE +1 -1
  430. package/node_modules/oniguruma-parser/README.md +15 -61
  431. package/node_modules/oniguruma-parser/dist/oniguruma-parser.min.js +4 -4
  432. package/node_modules/oniguruma-parser/dist/parser/parse.js +1 -1
  433. package/node_modules/oniguruma-parser/dist/traverser/traverse.js +1 -1
  434. package/node_modules/oniguruma-parser/package.json +5 -5
  435. package/node_modules/oniguruma-to-es/dist/cjs/generate.d.ts +1 -1
  436. package/node_modules/oniguruma-to-es/dist/cjs/index.js +121 -120
  437. package/node_modules/oniguruma-to-es/dist/cjs/subclass.d.ts +2 -2
  438. package/node_modules/oniguruma-to-es/dist/cjs/transform.d.ts +3 -5
  439. package/node_modules/oniguruma-to-es/dist/cjs/unicode.d.ts +1 -1
  440. package/node_modules/oniguruma-to-es/dist/esm/generate.d.ts +1 -1
  441. package/node_modules/oniguruma-to-es/dist/esm/index.js +1 -3
  442. package/node_modules/oniguruma-to-es/dist/esm/subclass.d.ts +2 -2
  443. package/node_modules/oniguruma-to-es/dist/esm/transform.d.ts +3 -5
  444. package/node_modules/oniguruma-to-es/dist/esm/unicode.d.ts +1 -1
  445. package/node_modules/oniguruma-to-es/dist/index.min.js +6 -6
  446. package/node_modules/oniguruma-to-es/package.json +5 -5
  447. package/package.json +5 -5
@@ -0,0 +1,170 @@
1
+ import { z } from "zod";
2
+ import { cloudButtonThemeSchema } from "./cloudContent.js";
3
+ const id = z.string().trim().min(1).max(128);
4
+ const url = z
5
+ .string()
6
+ .max(4096)
7
+ .url()
8
+ .refine((value) => {
9
+ if (!URL.canParse(value))
10
+ return false;
11
+ const parsed = new URL(value);
12
+ return ["http:", "https:"].includes(parsed.protocol) && !parsed.username && !parsed.password;
13
+ });
14
+ export const marketingAssetSchema = z.object({
15
+ src: url,
16
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u),
17
+ });
18
+ const text = z.object({
19
+ format: z.enum(["plaintext", "html", "markdown"]),
20
+ content: z.string().max(20_000),
21
+ });
22
+ export const marketingNavigationSchema = z.discriminatedUnion("page", [
23
+ z.object({ page: z.literal("upgrade") }).strict(),
24
+ z.object({ page: z.literal("rewards") }).strict(),
25
+ z
26
+ .object({
27
+ page: z.literal("settings"),
28
+ section: z
29
+ .enum([
30
+ "general",
31
+ "appearance",
32
+ "models",
33
+ "browser",
34
+ "computer_use",
35
+ "memory",
36
+ "subagents",
37
+ "plugins",
38
+ "mcp",
39
+ "skills",
40
+ "commands",
41
+ "hooks",
42
+ "usage",
43
+ ])
44
+ .optional(),
45
+ provider_id: id.optional(),
46
+ })
47
+ .strict()
48
+ .refine((args) => args.provider_id === undefined || args.section === "models"),
49
+ z
50
+ .object({
51
+ page: z.literal("plugin_marketplace"),
52
+ plugin_id: id.regex(/^[^@\s]+@[^@\s]+$/u).optional(),
53
+ })
54
+ .strict(),
55
+ ]);
56
+ export const marketingActionSchema = z.discriminatedUnion("type", [
57
+ z.object({ type: z.literal("close") }),
58
+ z.object({ type: z.literal("open_url"), args: z.object({ url }) }),
59
+ z.object({ type: z.literal("claim_dcode_plan"), args: z.object({ plan_id: id }) }),
60
+ z.object({ type: z.literal("navigate"), args: marketingNavigationSchema }),
61
+ z.object({
62
+ type: z.literal("copy_text"),
63
+ args: z
64
+ .object({
65
+ text: z
66
+ .string()
67
+ .max(20_000)
68
+ .refine((value) => value.trim().length > 0),
69
+ })
70
+ .strict(),
71
+ }),
72
+ ]);
73
+ const button = z.object({
74
+ text,
75
+ action: marketingActionSchema,
76
+ theme: cloudButtonThemeSchema.nullish(),
77
+ });
78
+ // Banner 允许空格式;若复用弹窗约束会丢弃有效投放,仅在此按纯文本归一。
79
+ const bannerButton = button.omit({ theme: true }).extend({
80
+ text: text.extend({
81
+ format: z
82
+ .enum(["", "plaintext", "html", "markdown"])
83
+ .transform((value) => value || "plaintext"),
84
+ }),
85
+ });
86
+ const layout = z.enum(["", "v1"]).optional();
87
+ const visualArgs = z
88
+ .record(z.string(), z.unknown())
89
+ .refine((value) => JSON.stringify(value).length <= 64_000)
90
+ .optional();
91
+ const image = z.object({
92
+ type: z.literal("image"),
93
+ image: z.object({ default: marketingAssetSchema, dark: marketingAssetSchema.nullish() }),
94
+ args: visualArgs,
95
+ });
96
+ export const marketingVisualSchema = z.discriminatedUnion("type", [
97
+ image,
98
+ z.object({
99
+ type: z.literal("video"),
100
+ video: z.object({ src: marketingAssetSchema, fallback: marketingAssetSchema }),
101
+ args: visualArgs,
102
+ }),
103
+ z.object({
104
+ type: z.literal("bundle"),
105
+ bundle: z.object({
106
+ bundle: marketingAssetSchema,
107
+ entry: z
108
+ .string()
109
+ .min(1)
110
+ .max(240)
111
+ .refine((value) => !value.includes("\\") &&
112
+ value.split("/").every((part) => part && part !== "." && part !== "..")),
113
+ fallback: marketingAssetSchema.nullish(),
114
+ }),
115
+ args: visualArgs,
116
+ }),
117
+ ]);
118
+ export const marketingPopupSchema = z.object({
119
+ layout,
120
+ title: text,
121
+ description: text,
122
+ hero: marketingVisualSchema.nullish(),
123
+ buttons: z.array(button).max(4),
124
+ });
125
+ const banner = z
126
+ .object({
127
+ layout,
128
+ background: marketingVisualSchema,
129
+ buttons: z.array(bannerButton).max(2),
130
+ success_popup: marketingPopupSchema.nullish(),
131
+ })
132
+ .refine((value) => value.buttons.filter((b) => b.action.type === "close").length <= 1 &&
133
+ value.buttons.filter((b) => b.action.type !== "close").length <= 1);
134
+ const deliveryBase = { campaign_id: id, priority: z.number().int().min(0).max(100) };
135
+ // 服务端已将旧 card 改名为 banner;判别值与内容字段必须同步,否则有效投放会被丢弃。
136
+ export const marketingDeliverySchema = z.discriminatedUnion("resource_position", [
137
+ z.object({ ...deliveryBase, resource_position: z.literal("banner"), banner }),
138
+ z.object({ ...deliveryBase, resource_position: z.literal("popup"), popup: marketingPopupSchema }),
139
+ ]);
140
+ const envelope = z.object({
141
+ code: z.literal(0),
142
+ data: z.object({
143
+ server_time: z.number().finite(),
144
+ language: z.enum(["zh-CN", "en-US"]),
145
+ deliveries: z.array(z.unknown()).max(32),
146
+ }),
147
+ });
148
+ /** 单条坏投放不影响其他资源位;外层失败不能伪装成成功空结果。 */
149
+ export function parseMarketingTouchResponse(input) {
150
+ const { data } = envelope.parse(input);
151
+ const deliveries = [];
152
+ let rejectedCount = 0;
153
+ const positions = new Set();
154
+ for (const raw of data.deliveries) {
155
+ const result = marketingDeliverySchema.safeParse(raw);
156
+ if (!result.success || positions.has(result.data.resource_position)) {
157
+ rejectedCount++;
158
+ continue;
159
+ }
160
+ positions.add(result.data.resource_position);
161
+ deliveries.push(result.data);
162
+ }
163
+ return {
164
+ serverTime: data.server_time * 1000,
165
+ language: data.language,
166
+ deliveries,
167
+ rejectedCount,
168
+ };
169
+ }
170
+ //# sourceMappingURL=marketingTouch.js.map
@@ -0,0 +1,83 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * App-Provided Tools(MCP Apps 规范「App-Provided Tools」):页面在 `ui/initialize` 声明 `tools` 能力后,
4
+ * 宿主 `tools/list` 发现页面工具、登记到 agent 暴露给模型;模型调用经"实例信箱"(live-only 投影增量
5
+ * `pluginUi.appToolCall`,按 scopeId + generation 投递)到达渲染端,页面 `tools/call` 执行后回传。
6
+ * 这里只有限额、描述符归一化与模型侧命名;纯 domain,零 IO。
7
+ */
8
+ /** 每个页面实例最多登记的工具数(规范推荐值)。 */
9
+ export declare const MCP_APPS_APP_TOOLS_MAX_PER_INSTANCE = 50;
10
+ export declare const MCP_APPS_APP_TOOL_NAME_MAX_CHARS = 128;
11
+ export declare const MCP_APPS_APP_TOOL_TITLE_MAX_CHARS = 256;
12
+ export declare const MCP_APPS_APP_TOOL_DESCRIPTION_MAX_CHARS = 4096;
13
+ /** inputSchema / outputSchema 序列化后的上限(UTF-8 字节)。 */
14
+ export declare const MCP_APPS_APP_TOOL_SCHEMA_MAX_BYTES: number;
15
+ /** 渲染端认领待执行调用的期限;超时视为页面未运行(信箱投递不重发)。 */
16
+ export declare const MCP_APPS_APP_TOOL_CLAIM_TIMEOUT_MS = 5000;
17
+ /** 认领后页面执行 tools/call 的期限(规范推荐值)。 */
18
+ export declare const MCP_APPS_APP_TOOL_CALL_TIMEOUT_MS = 30000;
19
+ /** 单次结果序列化上限(规范推荐值)。 */
20
+ export declare const MCP_APPS_APP_TOOL_RESULT_MAX_BYTES: number;
21
+ /** 模型调用参数进信箱前的上限;超限直接以错误结束,不下发。 */
22
+ export declare const MCP_APPS_APP_TOOL_ARGUMENTS_MAX_BYTES: number;
23
+ /** list_changed 触发的重新登记最小间隔。 */
24
+ export declare const MCP_APPS_APP_TOOLS_REFRESH_INTERVAL_MS = 1000;
25
+ export declare const MCP_APPS_APP_TOOL_ERROR_MESSAGE_MAX_CHARS = 4096;
26
+ export declare const MCP_APPS_APP_TOOL_CALL_ID_MAX_CHARS = 128;
27
+ /** 模型侧名字前缀:与 server 工具的 `mcp__` 天然不冲突。 */
28
+ export declare const MCP_APPS_APP_TOOL_MODEL_NAME_PREFIX = "app__";
29
+ /** 与 agent 的 MCP 工具名同一清洗规则:非 `[A-Za-z0-9_-]` 替换为 `_` 并合并连续下划线。 */
30
+ export declare function sanitizeMcpAppsModelNamePart(name: string): string;
31
+ /** 模型侧名字 `app__<server>__<tool>`。 */
32
+ export declare function buildMcpAppsAppToolModelName(serverName: string, toolName: string): string;
33
+ export declare const mcpAppsAppToolAnnotationsSchema: z.ZodObject<{
34
+ title: z.ZodOptional<z.ZodString>;
35
+ readOnlyHint: z.ZodOptional<z.ZodBoolean>;
36
+ destructiveHint: z.ZodOptional<z.ZodBoolean>;
37
+ idempotentHint: z.ZodOptional<z.ZodBoolean>;
38
+ openWorldHint: z.ZodOptional<z.ZodBoolean>;
39
+ }, z.core.$strict>;
40
+ export type McpAppsAppToolAnnotations = z.infer<typeof mcpAppsAppToolAnnotationsSchema>;
41
+ export declare const mcpAppsAppToolDescriptorSchema: z.ZodObject<{
42
+ name: z.ZodString;
43
+ title: z.ZodOptional<z.ZodString>;
44
+ description: z.ZodOptional<z.ZodString>;
45
+ inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
47
+ annotations: z.ZodOptional<z.ZodObject<{
48
+ title: z.ZodOptional<z.ZodString>;
49
+ readOnlyHint: z.ZodOptional<z.ZodBoolean>;
50
+ destructiveHint: z.ZodOptional<z.ZodBoolean>;
51
+ idempotentHint: z.ZodOptional<z.ZodBoolean>;
52
+ openWorldHint: z.ZodOptional<z.ZodBoolean>;
53
+ }, z.core.$strict>>;
54
+ }, z.core.$strict>;
55
+ export type McpAppsAppToolDescriptor = z.infer<typeof mcpAppsAppToolDescriptorSchema>;
56
+ /**
57
+ * 渲染端用:把页面 `tools/list` 的结果收窄成可登记的描述符。不合规的项跳过(不让整次登记失败),
58
+ * 超过 50 个只取前 50 个;返回被跳过的名字与原因供日志。
59
+ */
60
+ export declare function normalizeMcpAppsAppTools(tools: readonly unknown[]): {
61
+ tools: McpAppsAppToolDescriptor[];
62
+ skipped: Array<{
63
+ name: string | null;
64
+ reason: string;
65
+ }>;
66
+ };
67
+ /** 页面 `tools/call` 的结果(MCP CallToolResult 形状,字段集宽松:content 项原样保留)。 */
68
+ export declare const mcpAppsAppToolCallResultSchema: z.ZodObject<{
69
+ content: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
70
+ structuredContent: z.ZodOptional<z.ZodUnknown>;
71
+ isError: z.ZodOptional<z.ZodBoolean>;
72
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
73
+ }, z.core.$strip>;
74
+ export type McpAppsAppToolCallResult = z.infer<typeof mcpAppsAppToolCallResultSchema>;
75
+ /** 信箱里的一次待执行调用:按 (scopeId, generation) 投递给唯一实例。 */
76
+ export interface McpAppsAppToolCallRequest {
77
+ activity?: boolean;
78
+ cancelled?: boolean;
79
+ callId: string;
80
+ toolName: string;
81
+ arguments: Record<string, unknown>;
82
+ }
83
+ //# sourceMappingURL=appTools.d.ts.map
@@ -0,0 +1,124 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * App-Provided Tools(MCP Apps 规范「App-Provided Tools」):页面在 `ui/initialize` 声明 `tools` 能力后,
4
+ * 宿主 `tools/list` 发现页面工具、登记到 agent 暴露给模型;模型调用经"实例信箱"(live-only 投影增量
5
+ * `pluginUi.appToolCall`,按 scopeId + generation 投递)到达渲染端,页面 `tools/call` 执行后回传。
6
+ * 这里只有限额、描述符归一化与模型侧命名;纯 domain,零 IO。
7
+ */
8
+ /** 每个页面实例最多登记的工具数(规范推荐值)。 */
9
+ export const MCP_APPS_APP_TOOLS_MAX_PER_INSTANCE = 50;
10
+ export const MCP_APPS_APP_TOOL_NAME_MAX_CHARS = 128;
11
+ export const MCP_APPS_APP_TOOL_TITLE_MAX_CHARS = 256;
12
+ export const MCP_APPS_APP_TOOL_DESCRIPTION_MAX_CHARS = 4096;
13
+ /** inputSchema / outputSchema 序列化后的上限(UTF-8 字节)。 */
14
+ export const MCP_APPS_APP_TOOL_SCHEMA_MAX_BYTES = 64 * 1024;
15
+ /** 渲染端认领待执行调用的期限;超时视为页面未运行(信箱投递不重发)。 */
16
+ export const MCP_APPS_APP_TOOL_CLAIM_TIMEOUT_MS = 5_000;
17
+ /** 认领后页面执行 tools/call 的期限(规范推荐值)。 */
18
+ export const MCP_APPS_APP_TOOL_CALL_TIMEOUT_MS = 30_000;
19
+ /** 单次结果序列化上限(规范推荐值)。 */
20
+ export const MCP_APPS_APP_TOOL_RESULT_MAX_BYTES = 10 * 1024 * 1024;
21
+ /** 模型调用参数进信箱前的上限;超限直接以错误结束,不下发。 */
22
+ export const MCP_APPS_APP_TOOL_ARGUMENTS_MAX_BYTES = 1024 * 1024;
23
+ /** list_changed 触发的重新登记最小间隔。 */
24
+ export const MCP_APPS_APP_TOOLS_REFRESH_INTERVAL_MS = 1_000;
25
+ export const MCP_APPS_APP_TOOL_ERROR_MESSAGE_MAX_CHARS = 4096;
26
+ export const MCP_APPS_APP_TOOL_CALL_ID_MAX_CHARS = 128;
27
+ /** 模型侧名字前缀:与 server 工具的 `mcp__` 天然不冲突。 */
28
+ export const MCP_APPS_APP_TOOL_MODEL_NAME_PREFIX = "app__";
29
+ const utf8Bytes = (value) => new TextEncoder().encode(value).length;
30
+ /** 与 agent 的 MCP 工具名同一清洗规则:非 `[A-Za-z0-9_-]` 替换为 `_` 并合并连续下划线。 */
31
+ export function sanitizeMcpAppsModelNamePart(name) {
32
+ const sanitized = name.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_");
33
+ return sanitized.length > 0 ? sanitized : "unknown";
34
+ }
35
+ /** 模型侧名字 `app__<server>__<tool>`。 */
36
+ export function buildMcpAppsAppToolModelName(serverName, toolName) {
37
+ return `${MCP_APPS_APP_TOOL_MODEL_NAME_PREFIX}${sanitizeMcpAppsModelNamePart(serverName)}__${sanitizeMcpAppsModelNamePart(toolName)}`;
38
+ }
39
+ const objectSchemaSchema = z
40
+ .record(z.string(), z.unknown())
41
+ .refine((value) => value.type === "object", { message: "schema type must be object" })
42
+ .refine((value) => utf8Bytes(JSON.stringify(value)) <= MCP_APPS_APP_TOOL_SCHEMA_MAX_BYTES, {
43
+ message: "schema is too large",
44
+ });
45
+ export const mcpAppsAppToolAnnotationsSchema = z.strictObject({
46
+ title: z.string().max(MCP_APPS_APP_TOOL_TITLE_MAX_CHARS).optional(),
47
+ readOnlyHint: z.boolean().optional(),
48
+ destructiveHint: z.boolean().optional(),
49
+ idempotentHint: z.boolean().optional(),
50
+ openWorldHint: z.boolean().optional(),
51
+ });
52
+ export const mcpAppsAppToolDescriptorSchema = z.strictObject({
53
+ name: z.string().min(1).max(MCP_APPS_APP_TOOL_NAME_MAX_CHARS),
54
+ title: z.string().max(MCP_APPS_APP_TOOL_TITLE_MAX_CHARS).optional(),
55
+ description: z.string().max(MCP_APPS_APP_TOOL_DESCRIPTION_MAX_CHARS).optional(),
56
+ inputSchema: objectSchemaSchema,
57
+ outputSchema: objectSchemaSchema.optional(),
58
+ annotations: mcpAppsAppToolAnnotationsSchema.optional(),
59
+ });
60
+ const ANNOTATION_BOOLEAN_KEYS = [
61
+ "readOnlyHint",
62
+ "destructiveHint",
63
+ "idempotentHint",
64
+ "openWorldHint",
65
+ ];
66
+ /**
67
+ * 渲染端用:把页面 `tools/list` 的结果收窄成可登记的描述符。不合规的项跳过(不让整次登记失败),
68
+ * 超过 50 个只取前 50 个;返回被跳过的名字与原因供日志。
69
+ */
70
+ export function normalizeMcpAppsAppTools(tools) {
71
+ const accepted = [];
72
+ const skipped = [];
73
+ const seen = new Set();
74
+ for (const raw of tools) {
75
+ const record = raw && typeof raw === "object" ? raw : null;
76
+ const name = typeof record?.name === "string" ? record.name : null;
77
+ if (accepted.length >= MCP_APPS_APP_TOOLS_MAX_PER_INSTANCE) {
78
+ skipped.push({ name, reason: "limit" });
79
+ continue;
80
+ }
81
+ if (!record || name === null) {
82
+ skipped.push({ name, reason: "invalid" });
83
+ continue;
84
+ }
85
+ if (seen.has(name)) {
86
+ skipped.push({ name, reason: "duplicate" });
87
+ continue;
88
+ }
89
+ const rawAnnotations = record.annotations && typeof record.annotations === "object"
90
+ ? record.annotations
91
+ : null;
92
+ const annotations = {};
93
+ if (typeof rawAnnotations?.title === "string")
94
+ annotations.title = rawAnnotations.title;
95
+ for (const key of ANNOTATION_BOOLEAN_KEYS) {
96
+ if (typeof rawAnnotations?.[key] === "boolean")
97
+ annotations[key] = rawAnnotations[key];
98
+ }
99
+ const candidate = {
100
+ name,
101
+ ...(typeof record.title === "string" ? { title: record.title } : {}),
102
+ ...(typeof record.description === "string" ? { description: record.description } : {}),
103
+ inputSchema: record.inputSchema,
104
+ ...(record.outputSchema !== undefined ? { outputSchema: record.outputSchema } : {}),
105
+ ...(Object.keys(annotations).length > 0 ? { annotations } : {}),
106
+ };
107
+ const parsed = mcpAppsAppToolDescriptorSchema.safeParse(candidate);
108
+ if (!parsed.success) {
109
+ skipped.push({ name, reason: parsed.error.issues[0]?.message ?? "invalid" });
110
+ continue;
111
+ }
112
+ seen.add(name);
113
+ accepted.push(parsed.data);
114
+ }
115
+ return { tools: accepted, skipped };
116
+ }
117
+ /** 页面 `tools/call` 的结果(MCP CallToolResult 形状,字段集宽松:content 项原样保留)。 */
118
+ export const mcpAppsAppToolCallResultSchema = z.object({
119
+ content: z.array(z.record(z.string(), z.unknown())),
120
+ structuredContent: z.unknown().optional(),
121
+ isError: z.boolean().optional(),
122
+ _meta: z.record(z.string(), z.unknown()).optional(),
123
+ });
124
+ //# sourceMappingURL=appTools.js.map
@@ -0,0 +1,4 @@
1
+ import type { McpAppsContentBlock } from "./hostContract.js";
2
+ /** 把 content 块里的 text 拼成一段纯文本;非 text 块跳过。 */
3
+ export declare function concatMcpAppsTextContent(content: readonly McpAppsContentBlock[]): string;
4
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** 把 content 块里的 text 拼成一段纯文本;非 text 块跳过。 */
2
+ export function concatMcpAppsTextContent(content) {
3
+ return content
4
+ .filter((block) => block.type === "text" && typeof block.text === "string")
5
+ .map((block) => block.text)
6
+ .join("\n");
7
+ }
8
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1,241 @@
1
+ /**
2
+ * MCP Apps 协议契约:agent、host、renderer 与 main 共用的常量、工具 UI 元数据类型、沙箱句柄与登记载荷。
3
+ * 页面 ↔ 宿主的线协议(`ui/*` 方法、握手、版本协商、JSON-RPC)由官方 `@modelcontextprotocol/ext-apps` 定义,
4
+ * 这里只保留 DCode 自己的扩展键与限额。只放类型与常量;归一化与 schema 在同目录其他文件,经 index.ts 导出。
5
+ */
6
+ /** MCP 扩展标识(规范「Extension Identifier」);与官方 SDK `EXTENSION_ID` 一致。 */
7
+ export declare const MCP_APPS_EXTENSION_ID = "io.modelcontextprotocol/ui";
8
+ /** UI 资源 mimeType(规范 MUST);与官方 SDK `RESOURCE_MIME_TYPE` 一致。 */
9
+ export declare const MCP_APPS_RESOURCE_MIME_TYPE = "text/html;profile=mcp-app";
10
+ /** 弃用的扁平键 `_meta["ui/resourceUri"]`;规范要求宿主 MUST 同时兼容,与官方 SDK `RESOURCE_URI_META_KEY` 一致。 */
11
+ export declare const MCP_APPS_LEGACY_RESOURCE_URI_META_KEY = "ui/resourceUri";
12
+ /**
13
+ * MCP client `initialize` 里的 ui 扩展能力声明(规范「Client (Host) Capabilities」)。
14
+ * 用 type 而不是 interface:MCP SDK 的 `ClientCapabilities.extensions` 要求值带字符串索引签名。
15
+ */
16
+ export type McpAppsClientCapability = {
17
+ mimeTypes: string[];
18
+ };
19
+ /** agent 对每个 MCP server 宣告的能力片段;放进 `Client` 构造参数的 `capabilities.extensions`。 */
20
+ export declare function buildMcpAppsClientCapabilities(): {
21
+ extensions: {
22
+ [extensionId: string]: McpAppsClientCapability;
23
+ };
24
+ };
25
+ /** 宿主 hostInfo.name;hostInfo.version 只供页面 feature detect,与应用版本无关。 */
26
+ export declare const MCP_APPS_HOST_NAME = "dcode";
27
+ export declare const MCP_APPS_HOST_VERSION = "1";
28
+ /** `ui/initialize` 握手超时(端口到达起算)与卸载前 `ui/resource-teardown` 的等待上限。 */
29
+ export declare const MCP_APPS_HANDSHAKE_TIMEOUT_MS = 15000;
30
+ export declare const MCP_APPS_TEARDOWN_TIMEOUT_MS = 500;
31
+ export type McpAppsDisplayMode = "inline" | "fullscreen" | "pip";
32
+ export type McpAppsToolVisibility = "model" | "app";
33
+ export declare const MCP_APPS_DEFAULT_TOOL_VISIBILITY: readonly McpAppsToolVisibility[];
34
+ /** MCP Apps 资源级 CSP(`McpUiResourceCsp`):四类域。资源 `_meta` 为主,工具级 `_meta.ui.csp` 只在资源没有声明时兜底。 */
35
+ export interface McpToolUiCsp {
36
+ connectDomains?: string[];
37
+ resourceDomains?: string[];
38
+ frameDomains?: string[];
39
+ baseUriDomains?: string[];
40
+ }
41
+ /**
42
+ * 资源级 `_meta["dcode/csp"]`:宿主缺省按规范块(只有 'self' 'unsafe-inline'),不放行 `'unsafe-eval'` /
43
+ * `'wasm-unsafe-eval'`;需要 eval / WebAssembly 的资源在这里显式声明。宿主经
44
+ * `hostCapabilities.experimental["dcode/csp"].flags` 宣告支持的键。
45
+ */
46
+ export declare const MCP_APPS_CSP_RELAXATION_META_KEY = "dcode/csp";
47
+ export declare const MCP_APPS_CSP_RELAXATION_FLAGS: readonly ["unsafeEval", "wasmUnsafeEval"];
48
+ export type McpAppCspRelaxationFlag = (typeof MCP_APPS_CSP_RELAXATION_FLAGS)[number];
49
+ export type McpAppCspRelaxations = Partial<Record<McpAppCspRelaxationFlag, boolean>>;
50
+ export declare function buildMcpAppsCspExperimentalCapability(): {
51
+ [MCP_APPS_CSP_RELAXATION_META_KEY]: {
52
+ flags: McpAppCspRelaxationFlag[];
53
+ };
54
+ };
55
+ /**
56
+ * 资源可声明的浏览器权限(规范草案 `UIResourceMeta.permissions` 的四键),顺序即归一化顺序。
57
+ * 宿主:未声明一律拒绝;camera / microphone / geolocation 首次使用时原生弹框确认,clipboardWrite 按声明放行。
58
+ */
59
+ export declare const MCP_APPS_RESOURCE_PERMISSIONS: readonly ["camera", "microphone", "geolocation", "clipboardWrite"];
60
+ export type McpAppsResourcePermission = (typeof MCP_APPS_RESOURCE_PERMISSIONS)[number];
61
+ /** 规范权限键 → 插件 iframe `allow` 的 Permissions Policy 特性名。 */
62
+ export declare const MCP_APPS_IFRAME_ALLOW_TOKENS: Record<McpAppsResourcePermission, string>;
63
+ /** 与官方 SDK `buildAllowAttribute` 同形:`"camera; clipboard-write"`;没有声明返回空串。 */
64
+ export declare function buildMcpAppsIframeAllow(permissions: readonly McpAppsResourcePermission[] | undefined): string;
65
+ /**
66
+ * `ui://` HTML 资源自己的 `_meta`(`resources/read` 内容项优先)。`heightHint` / `minFrameHeight` 是初始高度与
67
+ * 最小高度(px);`showInline` 为 true 时卡片强制常驻、不进折叠区。
68
+ */
69
+ export interface McpAppResourceMeta {
70
+ csp?: McpToolUiCsp;
71
+ cspRelaxations?: McpAppCspRelaxations;
72
+ /** `_meta.ui.permissions` 声明的浏览器权限(规范四键;顺序固定、去重)。 */
73
+ permissions?: McpAppsResourcePermission[];
74
+ prefersBorder?: boolean;
75
+ heightHint?: number;
76
+ minFrameHeight?: number;
77
+ showInline?: boolean;
78
+ }
79
+ /** 随沙箱句柄回到 renderer 的资源级呈现信息;CSP 与放宽只在 main 生效,不回传。 */
80
+ export type PluginSandboxResourceMeta = Omit<McpAppResourceMeta, "csp" | "cspRelaxations">;
81
+ /** 工具 `_meta` 归一化后的 UI 描述;`resourceUri` 非法时整个描述不存在。 */
82
+ export interface McpToolUiDescriptor {
83
+ resourceUri: string;
84
+ visibility?: McpAppsToolVisibility[];
85
+ preferredDisplayMode?: McpAppsDisplayMode;
86
+ csp?: McpToolUiCsp;
87
+ prefersBorder?: boolean;
88
+ /** 工具结果归属的面板 id(清单 `ui.surfaces[].id`)。 */
89
+ surface?: string;
90
+ /** 工具级 `openai/widgetShowCodexWidgetInline`,卡片强制常驻。 */
91
+ showInline?: boolean;
92
+ }
93
+ /** `_meta.ui.surface` / 清单 surface id 的长度与字符集(与 sandboxId 同源:可进 CSP host-source)。 */
94
+ export declare const MCP_APPS_SURFACE_ID_MAX_CHARS = 128;
95
+ export declare const MCP_APPS_SURFACE_ID_PATTERN: RegExp;
96
+ export declare const MCP_APPS_UI_RESOURCE_SCHEME = "ui://";
97
+ export declare const MCP_APPS_RESOURCE_URI_MAX_CHARS = 2048;
98
+ /**
99
+ * `display.ui.structuredContent` / `widgetMeta` / `content` 的持久化上限(JSON 文本的 UTF-8 字节)。
100
+ * 超限不截断字符串(半截 JSON 没有意义):字段整个省略,`truncated: true` 且 `truncatedBytes` 记被丢弃的字节数;
101
+ * 页面侧 `toolOutput` 为 null、`toolResponseMetadata["dcode/truncated"] = { bytes }`,可用 tools/call 重取。
102
+ */
103
+ export declare const MCP_APPS_STRUCTURED_CONTENT_MAX_BYTES: number;
104
+ export declare const MCP_APPS_WIDGET_META_MAX_BYTES: number;
105
+ export declare const MCP_APPS_CONTENT_MAX_BYTES: number;
106
+ export declare const MCP_APPS_TRUNCATED_META_KEY = "dcode/truncated";
107
+ /** host 侧接受的 `ui://` HTML 上限与 mimeType 白名单(规范只认带 profile 的;无 profile 的 text/html 是有意的宽松超集)。 */
108
+ export declare const MCP_APPS_HTML_MAX_BYTES: number;
109
+ export declare const MCP_APPS_HTML_MIME_TYPES: readonly ["text/html;profile=mcp-app", "text/html"];
110
+ /**
111
+ * 页面经 ui/update-model-context 与 ui/message 送来的 image 块:白名单三种位图,单张解码后 ≤ 4 MiB;
112
+ * 不在白名单或超限整个请求 -32602 `unsupported_content`。
113
+ */
114
+ export declare const MCP_APPS_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/webp"];
115
+ export declare const MCP_APPS_IMAGE_MAX_BYTES: number;
116
+ export { MCP_APPS_UI_READ_RESOURCE_MAX_BYTES, MCP_APPS_UI_READ_RESOURCE_MIME_ALLOWLIST, isMcpAppsUiReadResourceMimeAllowed, } from "./resourceMime.js";
117
+ /**
118
+ * `hostCapabilities.experimental` 里 DCode 扩展的键。官方 SDK 的 zod 会剥掉标准位之外的未知能力键,
119
+ * 扩展一律放 experimental(规范预留位),页面按键 feature detect。
120
+ */
121
+ export declare const MCP_APPS_WIDGET_STATE_EXPERIMENTAL_KEY = "dcode/widgetState";
122
+ export declare const MCP_APPS_RESOURCE_SUBSCRIBE_EXPERIMENTAL_KEY = "dcode/resourceSubscribe";
123
+ export declare const MCP_APPS_SURFACE_EXPERIMENTAL_KEY = "dcode/surface";
124
+ /**
125
+ * DCode 扩展方法 `ui/set-widget-state { widgetState }`(MCP Apps 无 widgetState):页面把界面状态交给宿主
126
+ * renderer 内存保存(不持久化,会话内重挂载可恢复);初值经 hostContext 的 `dcode/widgetState` 键随握手下发。
127
+ */
128
+ export declare const MCP_APPS_SET_WIDGET_STATE_METHOD = "ui/set-widget-state";
129
+ export declare const MCP_APPS_WIDGET_STATE_CONTEXT_KEY = "dcode/widgetState";
130
+ /** 宿主 renderer ↔ relay shell 之间唯一一条 MessageChannel 的名字;上面跑原始 JSON-RPC(官方 AppBridge / App)。 */
131
+ export declare const PLUGIN_SANDBOX_PORT_NAME = "plugin-sandbox-rpc";
132
+ /** MessagePort 的最小结构类型;宿主 renderer 的 Transport 与 relay shell 都只依赖这几个成员。 */
133
+ export interface PluginSandboxTransportPort {
134
+ postMessage(message: unknown): void;
135
+ onmessage: ((event: {
136
+ data: unknown;
137
+ }) => void) | null;
138
+ start?(): void;
139
+ close(): void;
140
+ }
141
+ /** main → 宿主 renderer 的端口事件(经 preload `window.postMessage` transfer)。 */
142
+ export interface PluginSandboxPortsEvent {
143
+ sandboxId: string;
144
+ initId: number;
145
+ port: PluginSandboxTransportPort;
146
+ }
147
+ /**
148
+ * renderer 可用的沙箱平台端口,以 `IPlatformService.pluginSandbox` 可选字段挂载;web 端为 undefined,UI 据此回退。
149
+ * 登记沙箱不在这里:它由 host 经 parentPort 完成,renderer 只拿句柄。
150
+ */
151
+ export interface PluginSandboxPlatformPort {
152
+ /** preload 已安装限定的沙箱原子移动适配。 */
153
+ supportsRetainedMove?: boolean;
154
+ /** 仅宿主操作可用;Main 校验 owner/代次后复制当前页面内容。 */
155
+ copyImage?(input: PluginSandboxCaptureRequest): Promise<void>;
156
+ /** 宿主窗口 webContents id;prepareSandbox 用它作为 owner,main 在 will-attach 时校验。 */
157
+ getOwnerWebContentsId(): Promise<number>;
158
+ /**
159
+ * 释放沙箱。带 initId 时只释放捕获的登记:新页面使用新 Agent 凭证和 sandboxId,
160
+ * 两条 IPC 路径不同(host parentPort vs ipcMain),旧 dispose 到得晚也不能误杀新登记。
161
+ */
162
+ disposeSandbox(sandboxId: string, initId?: number): Promise<void>;
163
+ consumeUserGesture(sandboxId: string): Promise<boolean>;
164
+ onPorts(handler: (event: PluginSandboxPortsEvent) => void): () => void;
165
+ }
166
+ export interface PluginSandboxCaptureRequest {
167
+ sandboxId: string;
168
+ initId: number;
169
+ captureRect: {
170
+ x: number;
171
+ y: number;
172
+ width: number;
173
+ height: number;
174
+ };
175
+ viewportSize: {
176
+ width: number;
177
+ height: number;
178
+ };
179
+ }
180
+ /**
181
+ * 沙箱作用域。工具卡片按 toolCallId,面板(清单 `ui.surfaces[]`)按 surfaceId;
182
+ * 两者都映射到一个字符串 scopeId 进注册表幂等键与 widgetState 路由,避免 main / host 认识"面板"概念。
183
+ */
184
+ export type PluginUiScopeRef = {
185
+ kind: "toolCall";
186
+ toolCallId: string;
187
+ } | {
188
+ kind: "surface";
189
+ surfaceId: string;
190
+ };
191
+ export declare function buildPluginSandboxScopeId(scope: PluginUiScopeRef): string;
192
+ /** host → main 登记沙箱内容的消息载荷(模式同 LocalMediaPreviewPathAuthorize*)。 */
193
+ export interface PluginSandboxRegisterRequestPayload {
194
+ instance: import("./instance.js").McpAppInstance;
195
+ requestId: string;
196
+ /** 工作区隔离;旧调用允许缺省,新宿主登记须贯穿实际 workspace 范围。 */
197
+ workspacePath?: string;
198
+ workspaceIdentity?: string;
199
+ ownerWebContentsId: number;
200
+ sessionId: string;
201
+ /** Gen UI has Host provenance and never impersonates an MCP plugin. */
202
+ contentKind?: "gen-ui";
203
+ pluginId?: string;
204
+ /** 资源所属的 MCP server 运行时名;沙箱 partition 按它派生(同一 server 的页面共享一份持久存储)。 */
205
+ serverName?: string;
206
+ /** `buildPluginSandboxScopeId` 的结果:`tool:<toolCallId>` 或 `surface:<surfaceId>`。 */
207
+ scopeId: string;
208
+ html: string;
209
+ /** 有效 CSP:资源级优先,工具级兜底(host plugin-ui-bridge 已合并)。 */
210
+ csp?: McpToolUiCsp;
211
+ /** 资源级 `_meta["dcode/csp"]` 声明的放宽项。 */
212
+ cspRelaxations?: McpAppCspRelaxations;
213
+ /** 资源声明的浏览器权限;main 据此放宽 Permissions-Policy 与 iframe allow,并把权限请求交给闸门。 */
214
+ permissions?: McpAppsResourcePermission[];
215
+ prefersBorder?: boolean;
216
+ /** 资源级尺寸提示,原样进句柄回给 renderer。 */
217
+ heightHint?: number;
218
+ minFrameHeight?: number;
219
+ /** 资源级强制常驻标记,随句柄 resourceMeta 回 renderer。 */
220
+ showInline?: boolean;
221
+ }
222
+ /** host 内部使用的登记输入:去掉传输层 requestId。 */
223
+ export type PluginSandboxRegisterInput = Omit<PluginSandboxRegisterRequestPayload, "requestId">;
224
+ export interface PluginSandboxHandle {
225
+ instance: import("./instance.js").McpAppInstance;
226
+ sandboxId: string;
227
+ initId: number;
228
+ shellUrl: string;
229
+ partition: string;
230
+ /** 资源级呈现信息(prefersBorder / heightHint / minFrameHeight / showInline);资源没声明时省略。 */
231
+ resourceMeta?: PluginSandboxResourceMeta;
232
+ }
233
+ export type PluginSandboxRegisterResultPayload = ({
234
+ requestId: string;
235
+ ok: true;
236
+ } & PluginSandboxHandle) | {
237
+ requestId: string;
238
+ ok: false;
239
+ error: string;
240
+ };
241
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1,31 @@
1
+ import type { McpToolUiDescriptor, PluginSandboxHandle } from "./contract.js";
2
+ /** 一个带 UI 资源的工具 `_meta` 归一化后应得到的描述。 */
3
+ export declare const exampleToolUiDescriptor: McpToolUiDescriptor;
4
+ /** main 登记成功后返回给 renderer 的句柄;partition 按 server 身份派生,同一 server 的页面共享。 */
5
+ export declare const exampleSandboxHandle: PluginSandboxHandle;
6
+ /** agent 对 MCP server `initialize` 时宣告的 ui 扩展能力。 */
7
+ export declare const exampleClientCapabilities: {
8
+ extensions: {
9
+ [extensionId: string]: import("./contract.js").McpAppsClientCapability;
10
+ };
11
+ };
12
+ /** 宿主在 hostCapabilities.experimental 里宣告的 CSP 放宽键。 */
13
+ export declare const exampleCspExperimental: {
14
+ "dcode/csp": {
15
+ flags: import("./contract.js").McpAppCspRelaxationFlag[];
16
+ };
17
+ };
18
+ /** 资源级 `_meta` 里声明放宽的写法。 */
19
+ export declare const exampleResourceMetaWithRelaxations: {
20
+ ui: {
21
+ csp: {
22
+ connectDomains: string[];
23
+ };
24
+ };
25
+ "dcode/csp": {
26
+ unsafeEval: boolean;
27
+ };
28
+ };
29
+ export declare const exampleSetWidgetStateMethod = "ui/set-widget-state";
30
+ export declare const examplePortName = "plugin-sandbox-rpc";
31
+ //# sourceMappingURL=contract.example.d.ts.map