@xrkseek/harness 0.4.3 → 0.4.5

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 (378) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/node_modules/@xrkseek/a2a/README.md +43 -0
  6. package/node_modules/@xrkseek/a2a/dist/client.d.ts +35 -0
  7. package/node_modules/@xrkseek/a2a/dist/client.d.ts.map +1 -0
  8. package/node_modules/@xrkseek/a2a/dist/client.js +229 -0
  9. package/node_modules/@xrkseek/a2a/dist/client.js.map +1 -0
  10. package/node_modules/@xrkseek/a2a/dist/inbound.d.ts +42 -0
  11. package/node_modules/@xrkseek/a2a/dist/inbound.d.ts.map +1 -0
  12. package/node_modules/@xrkseek/a2a/dist/inbound.js +263 -0
  13. package/node_modules/@xrkseek/a2a/dist/inbound.js.map +1 -0
  14. package/node_modules/@xrkseek/a2a/dist/index.d.ts +6 -0
  15. package/node_modules/@xrkseek/a2a/dist/index.d.ts.map +1 -0
  16. package/node_modules/@xrkseek/a2a/dist/index.js +6 -0
  17. package/node_modules/@xrkseek/a2a/dist/index.js.map +1 -0
  18. package/node_modules/@xrkseek/a2a/dist/peers.d.ts +25 -0
  19. package/node_modules/@xrkseek/a2a/dist/peers.d.ts.map +1 -0
  20. package/node_modules/@xrkseek/a2a/dist/peers.js +90 -0
  21. package/node_modules/@xrkseek/a2a/dist/peers.js.map +1 -0
  22. package/node_modules/@xrkseek/a2a/dist/protocol.d.ts +45 -0
  23. package/node_modules/@xrkseek/a2a/dist/protocol.d.ts.map +1 -0
  24. package/node_modules/@xrkseek/a2a/dist/protocol.js +172 -0
  25. package/node_modules/@xrkseek/a2a/dist/protocol.js.map +1 -0
  26. package/node_modules/@xrkseek/a2a/dist/tools.d.ts +10 -0
  27. package/node_modules/@xrkseek/a2a/dist/tools.d.ts.map +1 -0
  28. package/node_modules/@xrkseek/a2a/dist/tools.js +145 -0
  29. package/node_modules/@xrkseek/a2a/dist/tools.js.map +1 -0
  30. package/node_modules/@xrkseek/a2a/package.json +28 -0
  31. package/node_modules/@xrkseek/attachment/README.md +23 -17
  32. package/node_modules/@xrkseek/attachment/dist/image-tokens.d.ts +30 -0
  33. package/node_modules/@xrkseek/attachment/dist/image-tokens.d.ts.map +1 -0
  34. package/node_modules/@xrkseek/attachment/dist/image-tokens.js +142 -0
  35. package/node_modules/@xrkseek/attachment/dist/image-tokens.js.map +1 -0
  36. package/node_modules/@xrkseek/attachment/dist/index.d.ts +2 -0
  37. package/node_modules/@xrkseek/attachment/dist/index.d.ts.map +1 -1
  38. package/node_modules/@xrkseek/attachment/dist/index.js +2 -0
  39. package/node_modules/@xrkseek/attachment/dist/index.js.map +1 -1
  40. package/node_modules/@xrkseek/attachment/dist/request-projection.d.ts +20 -0
  41. package/node_modules/@xrkseek/attachment/dist/request-projection.d.ts.map +1 -0
  42. package/node_modules/@xrkseek/attachment/dist/request-projection.js +49 -0
  43. package/node_modules/@xrkseek/attachment/dist/request-projection.js.map +1 -0
  44. package/node_modules/@xrkseek/attachment-local/dist/request-image.d.ts +2 -11
  45. package/node_modules/@xrkseek/attachment-local/dist/request-image.d.ts.map +1 -1
  46. package/node_modules/@xrkseek/attachment-local/dist/request-image.js +3 -29
  47. package/node_modules/@xrkseek/attachment-local/dist/request-image.js.map +1 -1
  48. package/node_modules/@xrkseek/checkpoint/README.md +4 -2
  49. package/node_modules/@xrkseek/checkpoint/dist/process-git.d.ts +6 -0
  50. package/node_modules/@xrkseek/checkpoint/dist/process-git.d.ts.map +1 -1
  51. package/node_modules/@xrkseek/checkpoint/dist/process-git.js +23 -1
  52. package/node_modules/@xrkseek/checkpoint/dist/process-git.js.map +1 -1
  53. package/node_modules/@xrkseek/checkpoint/dist/store.d.ts +30 -2
  54. package/node_modules/@xrkseek/checkpoint/dist/store.d.ts.map +1 -1
  55. package/node_modules/@xrkseek/checkpoint/dist/store.js +58 -15
  56. package/node_modules/@xrkseek/checkpoint/dist/store.js.map +1 -1
  57. package/node_modules/@xrkseek/checkpoint/dist/types.d.ts +14 -4
  58. package/node_modules/@xrkseek/checkpoint/dist/types.d.ts.map +1 -1
  59. package/node_modules/@xrkseek/checkpoint/dist/types.js.map +1 -1
  60. package/node_modules/@xrkseek/checkpoint/package.json +4 -1
  61. package/node_modules/@xrkseek/context-fragments/dist/index.d.ts +14 -0
  62. package/node_modules/@xrkseek/context-fragments/dist/index.d.ts.map +1 -1
  63. package/node_modules/@xrkseek/context-fragments/dist/index.js +33 -0
  64. package/node_modules/@xrkseek/context-fragments/dist/index.js.map +1 -1
  65. package/node_modules/@xrkseek/core-agent/dist/index.d.ts +7 -0
  66. package/node_modules/@xrkseek/core-agent/dist/index.d.ts.map +1 -1
  67. package/node_modules/@xrkseek/core-agent/dist/index.js +6 -0
  68. package/node_modules/@xrkseek/core-agent/dist/index.js.map +1 -1
  69. package/node_modules/@xrkseek/core-agent-loop/dist/compaction.d.ts.map +1 -1
  70. package/node_modules/@xrkseek/core-agent-loop/dist/compaction.js +1 -0
  71. package/node_modules/@xrkseek/core-agent-loop/dist/compaction.js.map +1 -1
  72. package/node_modules/@xrkseek/core-agent-loop/dist/index.d.ts +12 -0
  73. package/node_modules/@xrkseek/core-agent-loop/dist/index.d.ts.map +1 -1
  74. package/node_modules/@xrkseek/core-agent-loop/dist/index.js +95 -50
  75. package/node_modules/@xrkseek/core-agent-loop/dist/index.js.map +1 -1
  76. package/node_modules/@xrkseek/core-session/dist/compaction.d.ts +14 -0
  77. package/node_modules/@xrkseek/core-session/dist/compaction.d.ts.map +1 -1
  78. package/node_modules/@xrkseek/core-session/dist/compaction.js +41 -1
  79. package/node_modules/@xrkseek/core-session/dist/compaction.js.map +1 -1
  80. package/node_modules/@xrkseek/core-session/dist/index.d.ts +1 -1
  81. package/node_modules/@xrkseek/core-session/dist/index.d.ts.map +1 -1
  82. package/node_modules/@xrkseek/core-session/dist/index.js +1 -1
  83. package/node_modules/@xrkseek/core-session/dist/index.js.map +1 -1
  84. package/node_modules/@xrkseek/core-session/package.json +1 -0
  85. package/node_modules/@xrkseek/core-system-prompt/dist/index.d.ts +1 -0
  86. package/node_modules/@xrkseek/core-system-prompt/dist/index.d.ts.map +1 -1
  87. package/node_modules/@xrkseek/core-system-prompt/dist/index.js +1 -0
  88. package/node_modules/@xrkseek/core-system-prompt/dist/index.js.map +1 -1
  89. package/node_modules/@xrkseek/core-system-prompt/dist/time-context.d.ts +22 -0
  90. package/node_modules/@xrkseek/core-system-prompt/dist/time-context.d.ts.map +1 -0
  91. package/node_modules/@xrkseek/core-system-prompt/dist/time-context.js +47 -0
  92. package/node_modules/@xrkseek/core-system-prompt/dist/time-context.js.map +1 -0
  93. package/node_modules/@xrkseek/core-tools/dist/definition.d.ts +14 -0
  94. package/node_modules/@xrkseek/core-tools/dist/definition.d.ts.map +1 -1
  95. package/node_modules/@xrkseek/core-tools/dist/definition.js.map +1 -1
  96. package/node_modules/@xrkseek/core-tools/dist/index.d.ts +2 -2
  97. package/node_modules/@xrkseek/core-tools/dist/index.d.ts.map +1 -1
  98. package/node_modules/@xrkseek/core-tools/dist/index.js +1 -1
  99. package/node_modules/@xrkseek/core-tools/dist/index.js.map +1 -1
  100. package/node_modules/@xrkseek/core-tools/dist/materialize.d.ts +9 -3
  101. package/node_modules/@xrkseek/core-tools/dist/materialize.d.ts.map +1 -1
  102. package/node_modules/@xrkseek/core-tools/dist/materialize.js +38 -8
  103. package/node_modules/@xrkseek/core-tools/dist/materialize.js.map +1 -1
  104. package/node_modules/@xrkseek/exec-computer-use/dist/format.d.ts +2 -0
  105. package/node_modules/@xrkseek/exec-computer-use/dist/format.d.ts.map +1 -1
  106. package/node_modules/@xrkseek/exec-computer-use/dist/format.js +4 -1
  107. package/node_modules/@xrkseek/exec-computer-use/dist/format.js.map +1 -1
  108. package/node_modules/@xrkseek/exec-environment/README.md +21 -0
  109. package/node_modules/@xrkseek/exec-environment/dist/http.d.ts +34 -0
  110. package/node_modules/@xrkseek/exec-environment/dist/http.d.ts.map +1 -0
  111. package/node_modules/@xrkseek/exec-environment/dist/http.js +259 -0
  112. package/node_modules/@xrkseek/exec-environment/dist/http.js.map +1 -0
  113. package/node_modules/@xrkseek/exec-environment/dist/index.d.ts +5 -0
  114. package/node_modules/@xrkseek/exec-environment/dist/index.d.ts.map +1 -0
  115. package/node_modules/@xrkseek/exec-environment/dist/index.js +4 -0
  116. package/node_modules/@xrkseek/exec-environment/dist/index.js.map +1 -0
  117. package/node_modules/@xrkseek/exec-environment/dist/local.d.ts +11 -0
  118. package/node_modules/@xrkseek/exec-environment/dist/local.d.ts.map +1 -0
  119. package/node_modules/@xrkseek/exec-environment/dist/local.js +30 -0
  120. package/node_modules/@xrkseek/exec-environment/dist/local.js.map +1 -0
  121. package/node_modules/@xrkseek/exec-environment/dist/resolve.d.ts +23 -0
  122. package/node_modules/@xrkseek/exec-environment/dist/resolve.d.ts.map +1 -0
  123. package/node_modules/@xrkseek/exec-environment/dist/resolve.js +39 -0
  124. package/node_modules/@xrkseek/exec-environment/dist/resolve.js.map +1 -0
  125. package/node_modules/@xrkseek/exec-environment/dist/types.d.ts +33 -0
  126. package/node_modules/@xrkseek/exec-environment/dist/types.d.ts.map +1 -0
  127. package/node_modules/@xrkseek/exec-environment/dist/types.js +9 -0
  128. package/node_modules/@xrkseek/exec-environment/dist/types.js.map +1 -0
  129. package/node_modules/@xrkseek/exec-environment/package.json +28 -0
  130. package/node_modules/@xrkseek/exec-fs/dist/index.d.ts.map +1 -1
  131. package/node_modules/@xrkseek/exec-fs/dist/index.js +1 -0
  132. package/node_modules/@xrkseek/exec-fs/dist/index.js.map +1 -1
  133. package/node_modules/@xrkseek/exec-fs/dist/present.d.ts +5 -2
  134. package/node_modules/@xrkseek/exec-fs/dist/present.d.ts.map +1 -1
  135. package/node_modules/@xrkseek/exec-fs/dist/present.js +22 -4
  136. package/node_modules/@xrkseek/exec-fs/dist/present.js.map +1 -1
  137. package/node_modules/@xrkseek/exec-image-gen/README.md +6 -4
  138. package/node_modules/@xrkseek/exec-image-gen/dist/format.d.ts.map +1 -1
  139. package/node_modules/@xrkseek/exec-image-gen/dist/format.js +6 -3
  140. package/node_modules/@xrkseek/exec-image-gen/dist/format.js.map +1 -1
  141. package/node_modules/@xrkseek/exec-image-gen/dist/index.d.ts +4 -2
  142. package/node_modules/@xrkseek/exec-image-gen/dist/index.d.ts.map +1 -1
  143. package/node_modules/@xrkseek/exec-image-gen/dist/index.js +4 -2
  144. package/node_modules/@xrkseek/exec-image-gen/dist/index.js.map +1 -1
  145. package/node_modules/@xrkseek/exec-image-gen/dist/memory.d.ts +4 -1
  146. package/node_modules/@xrkseek/exec-image-gen/dist/memory.d.ts.map +1 -1
  147. package/node_modules/@xrkseek/exec-image-gen/dist/memory.js +16 -1
  148. package/node_modules/@xrkseek/exec-image-gen/dist/memory.js.map +1 -1
  149. package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.d.ts +5 -2
  150. package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.d.ts.map +1 -1
  151. package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.js +88 -38
  152. package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.js.map +1 -1
  153. package/node_modules/@xrkseek/exec-image-gen/dist/references.d.ts +21 -0
  154. package/node_modules/@xrkseek/exec-image-gen/dist/references.d.ts.map +1 -0
  155. package/node_modules/@xrkseek/exec-image-gen/dist/references.js +145 -0
  156. package/node_modules/@xrkseek/exec-image-gen/dist/references.js.map +1 -0
  157. package/node_modules/@xrkseek/exec-image-gen/dist/schema.d.ts +15 -0
  158. package/node_modules/@xrkseek/exec-image-gen/dist/schema.d.ts.map +1 -0
  159. package/node_modules/@xrkseek/exec-image-gen/dist/schema.js +67 -0
  160. package/node_modules/@xrkseek/exec-image-gen/dist/schema.js.map +1 -0
  161. package/node_modules/@xrkseek/exec-image-gen/dist/tools.d.ts +5 -2
  162. package/node_modules/@xrkseek/exec-image-gen/dist/tools.d.ts.map +1 -1
  163. package/node_modules/@xrkseek/exec-image-gen/dist/tools.js +38 -36
  164. package/node_modules/@xrkseek/exec-image-gen/dist/tools.js.map +1 -1
  165. package/node_modules/@xrkseek/exec-image-gen/dist/types.d.ts +34 -2
  166. package/node_modules/@xrkseek/exec-image-gen/dist/types.d.ts.map +1 -1
  167. package/node_modules/@xrkseek/exec-image-gen/dist/types.js +16 -1
  168. package/node_modules/@xrkseek/exec-image-gen/dist/types.js.map +1 -1
  169. package/node_modules/@xrkseek/exec-memory/README.md +3 -2
  170. package/node_modules/@xrkseek/exec-memory/dist/index.d.ts +2 -1
  171. package/node_modules/@xrkseek/exec-memory/dist/index.d.ts.map +1 -1
  172. package/node_modules/@xrkseek/exec-memory/dist/index.js +2 -1
  173. package/node_modules/@xrkseek/exec-memory/dist/index.js.map +1 -1
  174. package/node_modules/@xrkseek/exec-memory/dist/provider.d.ts +1 -1
  175. package/node_modules/@xrkseek/exec-memory/dist/provider.d.ts.map +1 -1
  176. package/node_modules/@xrkseek/exec-memory/dist/resolve.d.ts +15 -4
  177. package/node_modules/@xrkseek/exec-memory/dist/resolve.d.ts.map +1 -1
  178. package/node_modules/@xrkseek/exec-memory/dist/resolve.js +13 -3
  179. package/node_modules/@xrkseek/exec-memory/dist/resolve.js.map +1 -1
  180. package/node_modules/@xrkseek/exec-memory/dist/sqlite.d.ts +19 -0
  181. package/node_modules/@xrkseek/exec-memory/dist/sqlite.d.ts.map +1 -0
  182. package/node_modules/@xrkseek/exec-memory/dist/sqlite.js +190 -0
  183. package/node_modules/@xrkseek/exec-memory/dist/sqlite.js.map +1 -0
  184. package/node_modules/@xrkseek/exec-memory/dist/write-path.d.ts +21 -0
  185. package/node_modules/@xrkseek/exec-memory/dist/write-path.d.ts.map +1 -1
  186. package/node_modules/@xrkseek/exec-memory/dist/write-path.js +128 -25
  187. package/node_modules/@xrkseek/exec-memory/dist/write-path.js.map +1 -1
  188. package/node_modules/@xrkseek/exec-video-gen/README.md +27 -19
  189. package/node_modules/@xrkseek/exec-video-gen/dist/catalog.d.ts +16 -0
  190. package/node_modules/@xrkseek/exec-video-gen/dist/catalog.d.ts.map +1 -0
  191. package/node_modules/@xrkseek/exec-video-gen/dist/catalog.js +90 -0
  192. package/node_modules/@xrkseek/exec-video-gen/dist/catalog.js.map +1 -0
  193. package/node_modules/@xrkseek/exec-video-gen/dist/format.d.ts.map +1 -1
  194. package/node_modules/@xrkseek/exec-video-gen/dist/format.js +3 -1
  195. package/node_modules/@xrkseek/exec-video-gen/dist/format.js.map +1 -1
  196. package/node_modules/@xrkseek/exec-video-gen/dist/index.d.ts +5 -2
  197. package/node_modules/@xrkseek/exec-video-gen/dist/index.d.ts.map +1 -1
  198. package/node_modules/@xrkseek/exec-video-gen/dist/index.js +5 -2
  199. package/node_modules/@xrkseek/exec-video-gen/dist/index.js.map +1 -1
  200. package/node_modules/@xrkseek/exec-video-gen/dist/memory.d.ts +3 -2
  201. package/node_modules/@xrkseek/exec-video-gen/dist/memory.d.ts.map +1 -1
  202. package/node_modules/@xrkseek/exec-video-gen/dist/memory.js +45 -4
  203. package/node_modules/@xrkseek/exec-video-gen/dist/memory.js.map +1 -1
  204. package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.d.ts +3 -6
  205. package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.d.ts.map +1 -1
  206. package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.js +81 -2
  207. package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.js.map +1 -1
  208. package/node_modules/@xrkseek/exec-video-gen/dist/references.d.ts +24 -0
  209. package/node_modules/@xrkseek/exec-video-gen/dist/references.d.ts.map +1 -0
  210. package/node_modules/@xrkseek/exec-video-gen/dist/references.js +151 -0
  211. package/node_modules/@xrkseek/exec-video-gen/dist/references.js.map +1 -0
  212. package/node_modules/@xrkseek/exec-video-gen/dist/schema.d.ts +15 -0
  213. package/node_modules/@xrkseek/exec-video-gen/dist/schema.d.ts.map +1 -0
  214. package/node_modules/@xrkseek/exec-video-gen/dist/schema.js +104 -0
  215. package/node_modules/@xrkseek/exec-video-gen/dist/schema.js.map +1 -0
  216. package/node_modules/@xrkseek/exec-video-gen/dist/tools.d.ts +4 -2
  217. package/node_modules/@xrkseek/exec-video-gen/dist/tools.d.ts.map +1 -1
  218. package/node_modules/@xrkseek/exec-video-gen/dist/tools.js +99 -70
  219. package/node_modules/@xrkseek/exec-video-gen/dist/tools.js.map +1 -1
  220. package/node_modules/@xrkseek/exec-video-gen/dist/types.d.ts +73 -2
  221. package/node_modules/@xrkseek/exec-video-gen/dist/types.d.ts.map +1 -1
  222. package/node_modules/@xrkseek/exec-video-gen/dist/types.js +20 -1
  223. package/node_modules/@xrkseek/exec-video-gen/dist/types.js.map +1 -1
  224. package/node_modules/@xrkseek/exec-web/README.md +2 -2
  225. package/node_modules/@xrkseek/exec-web/dist/browser-tools.d.ts +3 -0
  226. package/node_modules/@xrkseek/exec-web/dist/browser-tools.d.ts.map +1 -1
  227. package/node_modules/@xrkseek/exec-web/dist/browser-tools.js +3 -0
  228. package/node_modules/@xrkseek/exec-web/dist/browser-tools.js.map +1 -1
  229. package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.d.ts +32 -0
  230. package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.d.ts.map +1 -0
  231. package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.js +141 -0
  232. package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.js.map +1 -0
  233. package/node_modules/@xrkseek/exec-web/dist/index.d.ts +1 -0
  234. package/node_modules/@xrkseek/exec-web/dist/index.d.ts.map +1 -1
  235. package/node_modules/@xrkseek/exec-web/dist/index.js +1 -0
  236. package/node_modules/@xrkseek/exec-web/dist/index.js.map +1 -1
  237. package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts +1 -0
  238. package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts.map +1 -1
  239. package/node_modules/@xrkseek/llm-deepseek/dist/index.js +2 -1
  240. package/node_modules/@xrkseek/llm-deepseek/dist/index.js.map +1 -1
  241. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.d.ts +13 -3
  242. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.d.ts.map +1 -1
  243. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.js +27 -4
  244. package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.js.map +1 -1
  245. package/node_modules/@xrkseek/preset-harness/README.md +8 -8
  246. package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts +11 -1
  247. package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts.map +1 -1
  248. package/node_modules/@xrkseek/preset-harness/dist/preset.js +11 -3
  249. package/node_modules/@xrkseek/preset-harness/dist/preset.js.map +1 -1
  250. package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
  251. package/node_modules/@xrkseek/preset-minimal/README.md +2 -2
  252. package/node_modules/@xrkseek/preset-minimal/dist/preset.js +1 -1
  253. package/node_modules/@xrkseek/preset-minimal/dist/preset.js.map +1 -1
  254. package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
  255. package/node_modules/@xrkseek/preset-server/README.md +5 -5
  256. package/node_modules/@xrkseek/preset-server/dist/preset.d.ts.map +1 -1
  257. package/node_modules/@xrkseek/preset-server/dist/preset.js +3 -2
  258. package/node_modules/@xrkseek/preset-server/dist/preset.js.map +1 -1
  259. package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
  260. package/node_modules/@xrkseek/protocol/dist/session-events.d.ts +9 -0
  261. package/node_modules/@xrkseek/protocol/dist/session-events.d.ts.map +1 -1
  262. package/node_modules/@xrkseek/protocol/dist/session-events.js.map +1 -1
  263. package/node_modules/@xrkseek/protocol/dist/validate.d.ts.map +1 -1
  264. package/node_modules/@xrkseek/protocol/dist/validate.js +9 -0
  265. package/node_modules/@xrkseek/protocol/dist/validate.js.map +1 -1
  266. package/node_modules/@xrkseek/server-config/dist/index.d.ts +1 -0
  267. package/node_modules/@xrkseek/server-config/dist/index.d.ts.map +1 -1
  268. package/node_modules/@xrkseek/server-config/dist/index.js +1 -0
  269. package/node_modules/@xrkseek/server-config/dist/index.js.map +1 -1
  270. package/node_modules/@xrkseek/server-config/dist/json-text.d.ts +8 -0
  271. package/node_modules/@xrkseek/server-config/dist/json-text.d.ts.map +1 -0
  272. package/node_modules/@xrkseek/server-config/dist/json-text.js +12 -0
  273. package/node_modules/@xrkseek/server-config/dist/json-text.js.map +1 -0
  274. package/node_modules/@xrkseek/server-cron/README.md +3 -2
  275. package/node_modules/@xrkseek/server-cron/dist/executions.d.ts +31 -0
  276. package/node_modules/@xrkseek/server-cron/dist/executions.d.ts.map +1 -0
  277. package/node_modules/@xrkseek/server-cron/dist/executions.js +95 -0
  278. package/node_modules/@xrkseek/server-cron/dist/executions.js.map +1 -0
  279. package/node_modules/@xrkseek/server-cron/dist/index.d.ts +1 -0
  280. package/node_modules/@xrkseek/server-cron/dist/index.d.ts.map +1 -1
  281. package/node_modules/@xrkseek/server-cron/dist/index.js +6 -0
  282. package/node_modules/@xrkseek/server-cron/dist/index.js.map +1 -1
  283. package/node_modules/@xrkseek/server-cron/dist/scheduler.d.ts +4 -0
  284. package/node_modules/@xrkseek/server-cron/dist/scheduler.d.ts.map +1 -1
  285. package/node_modules/@xrkseek/server-cron/dist/scheduler.js +33 -24
  286. package/node_modules/@xrkseek/server-cron/dist/scheduler.js.map +1 -1
  287. package/node_modules/@xrkseek/server-cron/dist/tools.d.ts.map +1 -1
  288. package/node_modules/@xrkseek/server-cron/dist/tools.js +44 -6
  289. package/node_modules/@xrkseek/server-cron/dist/tools.js.map +1 -1
  290. package/node_modules/@xrkseek/server-face/dist/dispatch.d.ts.map +1 -1
  291. package/node_modules/@xrkseek/server-face/dist/dispatch.js +2 -0
  292. package/node_modules/@xrkseek/server-face/dist/dispatch.js.map +1 -1
  293. package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.d.ts +37 -2
  294. package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.d.ts.map +1 -1
  295. package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.js +191 -28
  296. package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.js.map +1 -1
  297. package/node_modules/@xrkseek/server-face/dist/handlers/worktree.d.ts +10 -0
  298. package/node_modules/@xrkseek/server-face/dist/handlers/worktree.d.ts.map +1 -0
  299. package/node_modules/@xrkseek/server-face/dist/handlers/worktree.js +33 -0
  300. package/node_modules/@xrkseek/server-face/dist/handlers/worktree.js.map +1 -0
  301. package/node_modules/@xrkseek/server-face/dist/host-open-path.d.ts +9 -0
  302. package/node_modules/@xrkseek/server-face/dist/host-open-path.d.ts.map +1 -1
  303. package/node_modules/@xrkseek/server-face/dist/host-open-path.js +13 -7
  304. package/node_modules/@xrkseek/server-face/dist/host-open-path.js.map +1 -1
  305. package/node_modules/@xrkseek/server-face/dist/index.d.ts +2 -2
  306. package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
  307. package/node_modules/@xrkseek/server-face/dist/index.js +1 -1
  308. package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
  309. package/node_modules/@xrkseek/server-face/dist/llm-provider-context.d.ts +2 -0
  310. package/node_modules/@xrkseek/server-face/dist/llm-provider-context.d.ts.map +1 -1
  311. package/node_modules/@xrkseek/server-face/dist/llm-provider-context.js +13 -0
  312. package/node_modules/@xrkseek/server-face/dist/llm-provider-context.js.map +1 -1
  313. package/node_modules/@xrkseek/server-face/dist/llm-resolve.d.ts.map +1 -1
  314. package/node_modules/@xrkseek/server-face/dist/llm-resolve.js +3 -1
  315. package/node_modules/@xrkseek/server-face/dist/llm-resolve.js.map +1 -1
  316. package/node_modules/@xrkseek/server-face/dist/model-catalog.d.ts +4 -0
  317. package/node_modules/@xrkseek/server-face/dist/model-catalog.d.ts.map +1 -1
  318. package/node_modules/@xrkseek/server-face/dist/model-catalog.js +24 -5
  319. package/node_modules/@xrkseek/server-face/dist/model-catalog.js.map +1 -1
  320. package/node_modules/@xrkseek/server-face/dist/presets-catalog.js +5 -5
  321. package/node_modules/@xrkseek/server-face/dist/presets-catalog.js.map +1 -1
  322. package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
  323. package/node_modules/@xrkseek/server-face/dist/runtime.js +14 -2
  324. package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
  325. package/node_modules/@xrkseek/server-face/dist/select-session-model.d.ts.map +1 -1
  326. package/node_modules/@xrkseek/server-face/dist/select-session-model.js +8 -0
  327. package/node_modules/@xrkseek/server-face/dist/select-session-model.js.map +1 -1
  328. package/node_modules/@xrkseek/server-face/dist/session-model-store.d.ts +11 -0
  329. package/node_modules/@xrkseek/server-face/dist/session-model-store.d.ts.map +1 -0
  330. package/node_modules/@xrkseek/server-face/dist/session-model-store.js +66 -0
  331. package/node_modules/@xrkseek/server-face/dist/session-model-store.js.map +1 -0
  332. package/node_modules/@xrkseek/server-face/dist/session-status.d.ts +64 -13
  333. package/node_modules/@xrkseek/server-face/dist/session-status.d.ts.map +1 -1
  334. package/node_modules/@xrkseek/server-face/dist/session-status.js +173 -5
  335. package/node_modules/@xrkseek/server-face/dist/session-status.js.map +1 -1
  336. package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts.map +1 -1
  337. package/node_modules/@xrkseek/server-face/dist/settings-credentials.js +4 -5
  338. package/node_modules/@xrkseek/server-face/dist/settings-credentials.js.map +1 -1
  339. package/node_modules/@xrkseek/server-face/dist/settings-schemas.d.ts.map +1 -1
  340. package/node_modules/@xrkseek/server-face/dist/settings-schemas.js +36 -4
  341. package/node_modules/@xrkseek/server-face/dist/settings-schemas.js.map +1 -1
  342. package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts +1 -1
  343. package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts.map +1 -1
  344. package/node_modules/@xrkseek/server-face/dist/subagent-tools.js +1 -1
  345. package/node_modules/@xrkseek/server-face/dist/subagent-tools.js.map +1 -1
  346. package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.d.ts +15 -1
  347. package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.d.ts.map +1 -1
  348. package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.js +35 -7
  349. package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.js.map +1 -1
  350. package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.d.ts +11 -0
  351. package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.d.ts.map +1 -0
  352. package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.js +22 -0
  353. package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.js.map +1 -0
  354. package/node_modules/@xrkseek/server-host/dist/index.d.ts +3 -0
  355. package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
  356. package/node_modules/@xrkseek/server-host/dist/index.js +178 -48
  357. package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
  358. package/node_modules/@xrkseek/server-host/dist/mcp-wire.d.ts.map +1 -1
  359. package/node_modules/@xrkseek/server-host/dist/mcp-wire.js +3 -3
  360. package/node_modules/@xrkseek/server-host/dist/mcp-wire.js.map +1 -1
  361. package/node_modules/@xrkseek/server-host/package.json +2 -0
  362. package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.d.ts +2 -2
  363. package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.d.ts.map +1 -1
  364. package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.js +9 -4
  365. package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.js.map +1 -1
  366. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.d.ts +37 -1
  367. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.d.ts.map +1 -1
  368. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.js +125 -9
  369. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.js.map +1 -1
  370. package/node_modules/@xrkseek/workspace/dist/index.d.ts +1 -0
  371. package/node_modules/@xrkseek/workspace/dist/index.d.ts.map +1 -1
  372. package/node_modules/@xrkseek/workspace/dist/index.js +1 -0
  373. package/node_modules/@xrkseek/workspace/dist/index.js.map +1 -1
  374. package/node_modules/@xrkseek/workspace/dist/skill-curator.d.ts +46 -0
  375. package/node_modules/@xrkseek/workspace/dist/skill-curator.d.ts.map +1 -0
  376. package/node_modules/@xrkseek/workspace/dist/skill-curator.js +114 -0
  377. package/node_modules/@xrkseek/workspace/dist/skill-curator.js.map +1 -0
  378. package/package.json +5 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAE1C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEpD,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAM,UAAU,YAAY;IAC1B,OAAO,OA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C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;aACxC,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Model-facing A2A tools (Hermes `a2a` toolset subset).
3
+ */
4
+ import type { ToolDefinition } from "@xrkseek/core-tools";
5
+ import { type A2aClient, type A2aClientOptions } from "./client.js";
6
+ export interface CreateA2aToolsOptions extends A2aClientOptions {
7
+ readonly client?: A2aClient;
8
+ }
9
+ export declare function createA2aTools(options?: CreateA2aToolsOptions): ToolDefinition[];
10
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGrF,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;CAC7B;AAMD,wBAAgB,cAAc,CAC5B,OAAO,GAAE,qBAA0B,GAClC,cAAc,EAAE,CA2JlB"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Model-facing A2A tools (Hermes `a2a` toolset subset).
3
+ */
4
+ import { createA2aClient } from "./client.js";
5
+ import { ROLE_AGENT, ROLE_USER } from "./protocol.js";
6
+ function str(v) {
7
+ return typeof v === "string" ? v.trim() : "";
8
+ }
9
+ export function createA2aTools(options = {}) {
10
+ const client = options.client ?? createA2aClient(options);
11
+ const discover = {
12
+ name: "a2a_discover",
13
+ description: "Fetch and summarize an A2A peer Agent Card (skills, auth, protocol URL).",
14
+ parameters: {
15
+ type: "object",
16
+ properties: {
17
+ url: { type: "string", description: "Peer base URL (e.g. http://host:9900)." },
18
+ },
19
+ required: ["url"],
20
+ additionalProperties: false,
21
+ },
22
+ async execute(args) {
23
+ const url = str(args.url);
24
+ return { content: await client.discover(url) };
25
+ },
26
+ };
27
+ const call = {
28
+ name: "a2a_call",
29
+ description: "Send a task to an A2A peer (configured name or http(s) URL). Pass context_id from a prior reply to continue multi-turn. Anti-loop caps turns per context.",
30
+ parameters: {
31
+ type: "object",
32
+ properties: {
33
+ agent: {
34
+ type: "string",
35
+ description: "Configured peer name or full http(s) URL.",
36
+ },
37
+ message: { type: "string", description: "Task text for the peer." },
38
+ context_id: {
39
+ type: "string",
40
+ description: "Optional context id from a prior reply.",
41
+ },
42
+ },
43
+ required: ["agent", "message"],
44
+ additionalProperties: false,
45
+ },
46
+ async execute(args) {
47
+ const a = args;
48
+ const agent = str(a.agent || a.agent_name || a.name);
49
+ const message = str(a.message || a.text || a.task);
50
+ const contextId = str(a.context_id || a.contextId);
51
+ if (!agent || !message) {
52
+ return {
53
+ content: "Error: both 'agent' and 'message' are required.",
54
+ isError: true,
55
+ };
56
+ }
57
+ const result = await client.call(agent, message, contextId);
58
+ return { content: result.content, ...(result.ok ? {} : { isError: true }) };
59
+ },
60
+ };
61
+ const list = {
62
+ name: "a2a_list",
63
+ description: "List configured A2A peers and persisted conversation context ids (for a2a_history).",
64
+ parameters: {
65
+ type: "object",
66
+ properties: {},
67
+ additionalProperties: false,
68
+ },
69
+ async execute() {
70
+ const peers = client.listPeers();
71
+ const lines = ["Configured peers:"];
72
+ const names = Object.keys(peers);
73
+ if (names.length === 0) {
74
+ lines.push(" (none — set XRK_A2A_AGENTS or ~/.xrk/a2a_agents.json)");
75
+ }
76
+ else {
77
+ for (const name of names.sort()) {
78
+ const p = peers[name];
79
+ const caps = p.capabilities?.length
80
+ ? ` caps=[${p.capabilities.join(",")}]`
81
+ : "";
82
+ lines.push(` - ${name}: ${p.url}${caps}`);
83
+ }
84
+ }
85
+ const convos = client.listConversations();
86
+ lines.push(`Persisted conversations (${convos.length}) — recall with a2a_history:`);
87
+ for (const id of convos.slice(0, 40)) {
88
+ lines.push(` - ${id}`);
89
+ }
90
+ return { content: lines.join("\n") };
91
+ },
92
+ };
93
+ const history = {
94
+ name: "a2a_history",
95
+ description: "Recall a persisted A2A conversation transcript by context_id (survives restarts and session compaction).",
96
+ parameters: {
97
+ type: "object",
98
+ properties: {
99
+ context_id: {
100
+ type: "string",
101
+ description: "Context id of the conversation to recall.",
102
+ },
103
+ limit: {
104
+ type: "number",
105
+ description: "Max messages to return (default 50).",
106
+ },
107
+ },
108
+ required: ["context_id"],
109
+ additionalProperties: false,
110
+ },
111
+ async execute(args) {
112
+ const a = args;
113
+ const contextId = str(a.context_id || a.contextId);
114
+ if (!contextId) {
115
+ return {
116
+ content: "Error: 'context_id' is required (see a2a_list for known conversations).",
117
+ isError: true,
118
+ };
119
+ }
120
+ const limit = typeof a.limit === "number" && Number.isFinite(a.limit)
121
+ ? Math.max(1, Math.trunc(a.limit))
122
+ : 50;
123
+ const messages = client.history(contextId, limit);
124
+ if (messages.length === 0) {
125
+ return {
126
+ content: `No persisted conversation for context '${contextId}'.`,
127
+ };
128
+ }
129
+ const lines = [
130
+ `Conversation ${contextId} (last ${messages.length} messages):`,
131
+ ];
132
+ for (const m of messages) {
133
+ const role = m.role === ROLE_AGENT || m.role === "agent"
134
+ ? "agent"
135
+ : m.role === ROLE_USER || m.role === "user"
136
+ ? "user"
137
+ : m.role;
138
+ lines.push(`[${role}] ${m.text}`);
139
+ }
140
+ return { content: lines.join("\n") };
141
+ },
142
+ };
143
+ return [discover, call, list, history];
144
+ }
145
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAyC,MAAM,aAAa,CAAC;A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AAC,IAAI,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACpC,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@xrkseek/a2a",
3
+ "version": "0.1.0",
4
+ "description": "A2A client helpers: context_id persistence, history recall, anti-loop turn caps",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "dependencies": {
18
+ "@xrkseek/core-tools": "workspace:*",
19
+ "@xrkseek/xrk-home-paths": "workspace:*"
20
+ },
21
+ "license": "MIT",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/xrkseek/XRK-harness.git",
25
+ "directory": "packages/a2a"
26
+ },
27
+ "private": true
28
+ }
@@ -1,17 +1,23 @@
1
- # `@xrkseek/attachment`
2
-
3
- Durable **image** blob store (DSH-aligned). Session events hold `ImageAttachmentRef` only; bytes live here.
4
-
5
- ## Exports
6
-
7
- - `createMemoryAttachmentStore` — content-addressed in-memory store
8
- - `AttachmentStore` — `validateImage` / `saveImages` / `readImage`
9
- - `AttachmentError` — stable `code` (`IMAGE_TOO_LARGE`, `NOT_FOUND`, …)
10
-
11
- ## Non-goals (v1)
12
-
13
- - Disk / `$HOME` layout (Host may add later)
14
- - PDF / audio / video
15
- - GC / retention
16
-
17
- 文件地图:[docs/modules/attachment.md](../../docs/modules/attachment.md)(若有)· [docs/learn.md](../../docs/learn.md)
1
+ # `@xrkseek/attachment`
2
+
3
+ Durable **image** + generic-file blob store (DSH-aligned). Session events hold
4
+ `ImageAttachmentRef` / `FileAttachmentRef` only; bytes live here.
5
+
6
+ ## Exports
7
+
8
+ - `createMemoryAttachmentStore` — content-addressed in-memory store
9
+ - `AttachmentStore` — `validateImage` / `saveImages` / `readImage` / `readImageRequest`
10
+ - `AttachmentError` — stable `code` (`IMAGE_TOO_LARGE`, `IMAGE_TOO_MANY_PIXELS`, …)
11
+ - `sniffImageMediaType` / `readImageSize` — header sniff + intrinsic size
12
+ - `requestImageDimensions` / `longEdgeDimensions` — pure projection geometry
13
+ - `estimateImageTokens` / `requestImageTokenDimensions` — DeepSeek V41 vision-token
14
+ accounting (soft-budget + route request projection)
15
+ - `offloadRequestImages` — wire safety net for oversized base64 payloads
16
+
17
+ ## Non-goals (v1)
18
+
19
+ - Disk / `$HOME` layout (see `@xrkseek/attachment-local`)
20
+ - PDF / audio / video
21
+ - GC / retention
22
+
23
+ 文件地图:[docs/modules/attachment.md](../../docs/modules/attachment.md)(若有)· [docs/status.md](../../docs/status.md)
@@ -0,0 +1,30 @@
1
+ /**
2
+ * DeepSeek vision-token accounting (api-docs.deepseek.com Token & Token Usage,
3
+ * published `v41` configuration) ported for soft-budget / request projection.
4
+ *
5
+ * The provider scales an image below 544×544 total pixels up, aligns it to a
6
+ * 14px-patch grid, downsamples 3:1 per axis into token cells, and caps one
7
+ * image at 1024 tokens. The count is exact for this configuration (no
8
+ * alignment pad, no aspect-ratio clamp). Provider usage remains authoritative.
9
+ */
10
+ import { type ProjectedDimensions } from "./request-projection.js";
11
+ /** Provider cap on tokens for one request image. */
12
+ export declare const MAX_IMAGE_TOKENS = 1024;
13
+ /**
14
+ * Provider per-side limit when many images share a request (DSH
15
+ * `REQUEST_IMAGE_MAX_DIMENSION`). Applied after token-grid projection.
16
+ */
17
+ export declare const REQUEST_IMAGE_MAX_DIMENSION = 4096;
18
+ /**
19
+ * Dimensions the harness should send so the provider keeps the whole image:
20
+ * the source itself when its patch-padded grid fits the token cap, otherwise
21
+ * the source aspect ratio at the solved grid's long edge. Small images are
22
+ * never enlarged.
23
+ */
24
+ export declare function requestImageTokenDimensions(width: number, height: number): ProjectedDimensions;
25
+ /**
26
+ * Vision tokens charged for one request image of the given dimensions
27
+ * (DeepSeek V41 published calculator). At most {@link MAX_IMAGE_TOKENS}.
28
+ */
29
+ export declare function estimateImageTokens(width: number, height: number): number;
30
+ //# sourceMappingURL=image-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-tokens.d.ts","sourceRoot":"","sources":["../src/image-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAMjC,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAKrC;;;GAGG;AACH,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAsHhD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,mBAAmB,CAerB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUzE"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * DeepSeek vision-token accounting (api-docs.deepseek.com Token & Token Usage,
3
+ * published `v41` configuration) ported for soft-budget / request projection.
4
+ *
5
+ * The provider scales an image below 544×544 total pixels up, aligns it to a
6
+ * 14px-patch grid, downsamples 3:1 per axis into token cells, and caps one
7
+ * image at 1024 tokens. The count is exact for this configuration (no
8
+ * alignment pad, no aspect-ratio clamp). Provider usage remains authoritative.
9
+ */
10
+ import { longEdgeDimensions, } from "./request-projection.js";
11
+ /** Vision patch edge in pixels. */
12
+ const PATCH_SIZE = 14;
13
+ /** Per-axis patch-to-token downsampling ratio. */
14
+ const DOWNSAMPLE_RATIO = 3;
15
+ /** Provider cap on tokens for one request image. */
16
+ export const MAX_IMAGE_TOKENS = 1024;
17
+ /** Total-pixel floor; smaller images are scaled up before grid projection. */
18
+ const MIN_PIXELS = 544 * 544;
19
+ /** Pixels covered by one token cell along either axis. */
20
+ const CELL_SIZE = PATCH_SIZE * DOWNSAMPLE_RATIO;
21
+ /**
22
+ * Provider per-side limit when many images share a request (DSH
23
+ * `REQUEST_IMAGE_MAX_DIMENSION`). Applied after token-grid projection.
24
+ */
25
+ export const REQUEST_IMAGE_MAX_DIMENSION = 4096;
26
+ const intDiv = (value, divisor) => Math.floor(value / divisor);
27
+ const ceilDiv = (value, divisor) => Math.floor((value + divisor - 1) / divisor);
28
+ /** Token count of one grid: every row carries a separator, plus two framing tokens. */
29
+ function gridTokens(gridHeight, gridWidth) {
30
+ return gridHeight * (gridWidth + 1) + 2;
31
+ }
32
+ /** Token-cell count along one padded pixel axis. */
33
+ function gridCells(paddedLength) {
34
+ return ceilDiv(intDiv(paddedLength, PATCH_SIZE), DOWNSAMPLE_RATIO);
35
+ }
36
+ /** Solve the largest grid within `budget` tokens preserving the aspect ratio. */
37
+ function solveResizeRatio(height, width, budget) {
38
+ const aspect = height / width;
39
+ const idealGridWidth = Math.sqrt((budget - 2) / aspect + 0.25) - 0.5;
40
+ const idealGridHeight = idealGridWidth * aspect;
41
+ let bestHeight;
42
+ let bestWidth;
43
+ if (idealGridWidth < 1) {
44
+ const solvedGridWidth = 1;
45
+ const solvedGridHeight = intDiv(budget - 2, solvedGridWidth + 1);
46
+ bestWidth = solvedGridWidth * CELL_SIZE;
47
+ bestHeight = solvedGridHeight * CELL_SIZE;
48
+ }
49
+ else if (idealGridHeight < 1) {
50
+ const solvedGridHeight = 1;
51
+ const solvedGridWidth = intDiv(budget - 2, solvedGridHeight) - 1;
52
+ bestWidth = solvedGridWidth * CELL_SIZE;
53
+ bestHeight = solvedGridHeight * CELL_SIZE;
54
+ }
55
+ else {
56
+ const solvedGridWidth = Math.trunc(idealGridWidth);
57
+ const solvedGridHeight = Math.trunc(idealGridHeight);
58
+ const scale = Math.min((solvedGridWidth * CELL_SIZE) / width, (solvedGridHeight * CELL_SIZE) / height);
59
+ bestWidth = Math.trunc((width * scale) / PATCH_SIZE) * PATCH_SIZE;
60
+ bestHeight = Math.trunc((height * scale) / PATCH_SIZE) * PATCH_SIZE;
61
+ }
62
+ const gridHeight = gridCells(bestHeight);
63
+ const gridWidth = gridCells(bestWidth);
64
+ return {
65
+ gridHeight,
66
+ gridWidth,
67
+ bestHeight,
68
+ bestWidth,
69
+ numTokens: gridTokens(gridHeight, gridWidth),
70
+ };
71
+ }
72
+ /** Project padded pixel dimensions onto the largest in-budget token grid. */
73
+ function safeResize(height, width, paddedHeight, paddedWidth) {
74
+ const gridHeight = gridCells(paddedHeight);
75
+ const gridWidth = gridCells(paddedWidth);
76
+ const direct = {
77
+ gridHeight,
78
+ gridWidth,
79
+ bestHeight: paddedHeight,
80
+ bestWidth: paddedWidth,
81
+ numTokens: gridTokens(gridHeight, gridWidth),
82
+ };
83
+ if (direct.numTokens <= MAX_IMAGE_TOKENS)
84
+ return direct;
85
+ const solved = solveResizeRatio(height, width, MAX_IMAGE_TOKENS);
86
+ if (solved.numTokens > MAX_IMAGE_TOKENS) {
87
+ throw new Error(`image tokens: no grid fits the token budget for ${width}x${height}`);
88
+ }
89
+ return solved;
90
+ }
91
+ /** One scale-pad-project pass; the caller iterates it to a fixpoint. */
92
+ function resizeOnce(width, height) {
93
+ let scaledWidth = width;
94
+ let scaledHeight = height;
95
+ const pixels = scaledWidth * scaledHeight;
96
+ if (pixels < MIN_PIXELS && pixels > 0) {
97
+ const scale = Math.sqrt(MIN_PIXELS / pixels);
98
+ scaledWidth = Math.trunc(scaledWidth * scale);
99
+ scaledHeight = Math.trunc(scaledHeight * scale);
100
+ }
101
+ const paddedWidth = ceilDiv(scaledWidth, PATCH_SIZE) * PATCH_SIZE;
102
+ const paddedHeight = ceilDiv(scaledHeight, PATCH_SIZE) * PATCH_SIZE;
103
+ return safeResize(scaledHeight, scaledWidth, paddedHeight, paddedWidth);
104
+ }
105
+ function sameResize(a, b) {
106
+ return (a.gridHeight === b.gridHeight &&
107
+ a.gridWidth === b.gridWidth &&
108
+ a.bestHeight === b.bestHeight &&
109
+ a.bestWidth === b.bestWidth &&
110
+ a.numTokens === b.numTokens);
111
+ }
112
+ /**
113
+ * Dimensions the harness should send so the provider keeps the whole image:
114
+ * the source itself when its patch-padded grid fits the token cap, otherwise
115
+ * the source aspect ratio at the solved grid's long edge. Small images are
116
+ * never enlarged.
117
+ */
118
+ export function requestImageTokenDimensions(width, height) {
119
+ const paddedWidth = ceilDiv(width, PATCH_SIZE) * PATCH_SIZE;
120
+ const paddedHeight = ceilDiv(height, PATCH_SIZE) * PATCH_SIZE;
121
+ if (gridTokens(gridCells(paddedHeight), gridCells(paddedWidth)) <=
122
+ MAX_IMAGE_TOKENS) {
123
+ return { width, height };
124
+ }
125
+ const solved = solveResizeRatio(height, width, MAX_IMAGE_TOKENS);
126
+ return longEdgeDimensions(width, height, width >= height ? solved.bestWidth : solved.bestHeight);
127
+ }
128
+ /**
129
+ * Vision tokens charged for one request image of the given dimensions
130
+ * (DeepSeek V41 published calculator). At most {@link MAX_IMAGE_TOKENS}.
131
+ */
132
+ export function estimateImageTokens(width, height) {
133
+ let result = resizeOnce(width, height);
134
+ for (let iteration = 1; iteration < 10; iteration += 1) {
135
+ const next = resizeOnce(result.bestWidth, result.bestHeight);
136
+ if (sameResize(next, result))
137
+ return result.numTokens;
138
+ result = next;
139
+ }
140
+ throw new Error(`image tokens: resize did not converge for ${width}x${height}`);
141
+ }
142
+ //# sourceMappingURL=image-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-tokens.js","sourceRoot":"","sources":["../src/image-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AAEjC,mCAAmC;AACnC,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,kDAAkD;AAClD,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AC,KAAa,EAAE,MAAc;IAC/D,IAAI,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC,SAAS,CAAC;QACtD,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,IAAI,KAAK,CACb,6CAA6C,KAAK,IAAI,MAAM,EAAE,CAC/D,CAAC;AACJ,CAAC"}
@@ -10,4 +10,6 @@ export { createMemoryAttachmentStore, type CreateMemoryAttachmentStoreOptions, }
10
10
  export { sniffImageMediaType, readImageSize } from "./image-meta.js";
11
11
  export { attachmentIdForBytes } from "./digest.js";
12
12
  export { DEFAULT_MAX_REQUEST_IMAGE_BYTES, REQUEST_IMAGE_OFFLOAD_PLACEHOLDER, offloadRequestImages, } from "./request-image-bound.js";
13
+ export { longEdgeDimensions, requestImageDimensions, type ProjectedDimensions, } from "./request-projection.js";
14
+ export { MAX_IMAGE_TOKENS, REQUEST_IMAGE_MAX_DIMENSION, estimateImageTokens, requestImageTokenDimensions, } from "./image-tokens.js";
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EACL,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EACL,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC"}
@@ -8,4 +8,6 @@ export { createMemoryAttachmentStore, } from "./memory.js";
8
8
  export { sniffImageMediaType, readImageSize } from "./image-meta.js";
9
9
  export { attachmentIdForBytes } from "./digest.js";
10
10
  export { DEFAULT_MAX_REQUEST_IMAGE_BYTES, REQUEST_IMAGE_OFFLOAD_PLACEHOLDER, offloadRequestImages, } from "./request-image-bound.js";
11
+ export { longEdgeDimensions, requestImageDimensions, } from "./request-projection.js";
12
+ export { MAX_IMAGE_TOKENS, REQUEST_IMAGE_MAX_DIMENSION, estimateImageTokens, requestImageTokenDimensions, } from "./image-tokens.js";
11
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,2BAA2B,GAE5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,2BAA2B,GAE5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Pure request-projection geometry shared by model routes and soft-budget
3
+ * pricing. Aligned with DSH `@deepseek-ai/dsh-attachment` request-projection.
4
+ */
5
+ /** Integer width and height of one projected image. */
6
+ export interface ProjectedDimensions {
7
+ readonly width: number;
8
+ readonly height: number;
9
+ }
10
+ /**
11
+ * Aspect-preserving integer dimensions within a hard total-pixel budget.
12
+ * Small images are not enlarged.
13
+ */
14
+ export declare function requestImageDimensions(width: number, height: number, maxPixels: number): ProjectedDimensions;
15
+ /**
16
+ * Aspect-preserving dimensions with an exact long edge (short edge rounds).
17
+ * A long edge at or above the source returns the source unchanged.
18
+ */
19
+ export declare function longEdgeDimensions(width: number, height: number, longEdge: number): ProjectedDimensions;
20
+ //# sourceMappingURL=request-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-projection.d.ts","sourceRoot":"","sources":["../src/request-projection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,mBAAmB,CAqCrB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,mBAAmB,CAWrB"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Pure request-projection geometry shared by model routes and soft-budget
3
+ * pricing. Aligned with DSH `@deepseek-ai/dsh-attachment` request-projection.
4
+ */
5
+ /**
6
+ * Aspect-preserving integer dimensions within a hard total-pixel budget.
7
+ * Small images are not enlarged.
8
+ */
9
+ export function requestImageDimensions(width, height, maxPixels) {
10
+ const scale = Math.min(1, Math.sqrt(maxPixels / (width * height)));
11
+ if (scale === 1)
12
+ return { width, height };
13
+ if (width >= height) {
14
+ let projectedWidth = Math.max(1, Math.floor(width * scale));
15
+ let projectedHeight = Math.max(1, Math.round((projectedWidth * height) / width));
16
+ while (projectedWidth * projectedHeight > maxPixels &&
17
+ projectedWidth > 1) {
18
+ projectedWidth -= 1;
19
+ projectedHeight = Math.max(1, Math.round((projectedWidth * height) / width));
20
+ }
21
+ return { width: projectedWidth, height: projectedHeight };
22
+ }
23
+ let projectedHeight = Math.max(1, Math.floor(height * scale));
24
+ let projectedWidth = Math.max(1, Math.round((projectedHeight * width) / height));
25
+ while (projectedWidth * projectedHeight > maxPixels &&
26
+ projectedHeight > 1) {
27
+ projectedHeight -= 1;
28
+ projectedWidth = Math.max(1, Math.round((projectedHeight * width) / height));
29
+ }
30
+ return { width: projectedWidth, height: projectedHeight };
31
+ }
32
+ /**
33
+ * Aspect-preserving dimensions with an exact long edge (short edge rounds).
34
+ * A long edge at or above the source returns the source unchanged.
35
+ */
36
+ export function longEdgeDimensions(width, height, longEdge) {
37
+ if (longEdge >= Math.max(width, height))
38
+ return { width, height };
39
+ return width >= height
40
+ ? {
41
+ width: longEdge,
42
+ height: Math.max(1, Math.round((longEdge * height) / width)),
43
+ }
44
+ : {
45
+ width: Math.max(1, Math.round((longEdge * width) / height)),
46
+ height: longEdge,
47
+ };
48
+ }
49
+ //# sourceMappingURL=request-projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-projection.js","sourceRoot":"","sources":["../src/request-projection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAa,EACb,MAAc,EACd,SAAiB;IAEjB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC1C,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACpB,IAAI,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;QAC5D,IAAI,eAAe,GAAG,IAAI,CAAC,GAAG,CAC5B,CAAC,EACD,IAAI,CAAC,KAAK,CAAC,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAC9C,CAAC;QACF,OACE,cAAc,GAAG,eAAe,GAAG,SAAS;YAC5C,cAAc,GAAG,CAAC,EAClB,CAAC;YACD,cAAc,IAAI,CAAC,CAAC;YACpB,eAAe,GAAG,IAAI,CAAC,GAAG,CACxB,CAAC,EACD,IAAI,CAAC,KAAK,CAAC,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAC9C,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC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 -4,17 +4,8 @@ import type { ImageAttachmentRef, ImageRequestPolicy, RequestImageAttachment, St
4
4
  export declare const REQUEST_IMAGE_TRANSFORM_VERSION = "request-image-v4";
5
5
  /** DeepSeek request versions normally fit at these two preferred qualities. */
6
6
  export declare const REQUEST_IMAGE_QUALITIES: readonly [85, 80];
7
- /**
8
- * Compute aspect-preserving integer dimensions within a hard total-pixel budget.
9
- * @param width - positive source width.
10
- * @param height - positive source height.
11
- * @param maxPixels - positive width-times-height cap.
12
- * @returns inward-rounded dimensions; small images are not enlarged.
13
- */
14
- export declare function requestImageDimensions(width: number, height: number, maxPixels: number): {
15
- width: number;
16
- height: number;
17
- };
7
+ /** Re-export shared projection (callers historically imported from this module). */
8
+ export { requestImageDimensions } from '@xrkseek/attachment';
18
9
  /**
19
10
  * Complete deterministic identity for one attachment and route-owned request policy.
20
11
  * @param attachment - provider-independent durable normalized attachment reference.
@@ -1 +1 @@
1
- {"version":3,"file":"request-image.d.ts","sourceRoot":"","sources":["../src/request-image.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAO9D,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,qBAAqB,CAAA;AAM5B,2EAA2E;AAC3E,eAAO,MAAM,+BAA+B,qBAAqB,CAAA;AACjE,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,mBAAoB,CAAA;AAiBxD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAmBnC;AA8BD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,kBAAkB,GACzB,MAAM,CAER;AAmID;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC,CA0BjC"}
1
+ {"version":3,"file":"request-image.d.ts","sourceRoot":"","sources":["../src/request-image.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAU9D,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,qBAAqB,CAAA;AAM5B,2EAA2E;AAC3E,eAAO,MAAM,+BAA+B,qBAAqB,CAAA;AACjE,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,mBAAoB,CAAA;AAExD,oFAAoF;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AA6C5D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,kBAAkB,GACzB,MAAM,CAER;AAmID;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC,CA0BjC"}
@@ -2,7 +2,7 @@
2
2
  import { createHash, randomUUID } from 'node:crypto';
3
3
  import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
4
4
  import { dirname, join } from 'node:path';
5
- import { AttachmentError } from '@xrkseek/attachment';
5
+ import { AttachmentError, requestImageDimensions, } from '@xrkseek/attachment';
6
6
  import { hasLowColourCount } from './normalization.js';
7
7
  import { encodeFirstWithinLimit, isExhaustedEncoding } from './encoding.js';
8
8
  import { detectImage, encodedAlphaIsCompatible, probeImage } from './image.js';
@@ -11,37 +11,11 @@ import { getSharp } from './sharp-module.js';
11
11
  export const REQUEST_IMAGE_TRANSFORM_VERSION = 'request-image-v4';
12
12
  /** DeepSeek request versions normally fit at these two preferred qualities. */
13
13
  export const REQUEST_IMAGE_QUALITIES = [85, 80];
14
+ /** Re-export shared projection (callers historically imported from this module). */
15
+ export { requestImageDimensions } from '@xrkseek/attachment';
14
16
  function digest(value) {
15
17
  return createHash('sha256').update(value).digest('hex');
16
18
  }
17
- /**
18
- * Compute aspect-preserving integer dimensions within a hard total-pixel budget.
19
- * @param width - positive source width.
20
- * @param height - positive source height.
21
- * @param maxPixels - positive width-times-height cap.
22
- * @returns inward-rounded dimensions; small images are not enlarged.
23
- */
24
- export function requestImageDimensions(width, height, maxPixels) {
25
- const scale = Math.min(1, Math.sqrt(maxPixels / (width * height)));
26
- if (scale === 1)
27
- return { width, height };
28
- if (width >= height) {
29
- let projectedWidth = Math.max(1, Math.floor(width * scale));
30
- let projectedHeight = Math.max(1, Math.round(projectedWidth * height / width));
31
- while (projectedWidth * projectedHeight > maxPixels && projectedWidth > 1) {
32
- projectedWidth -= 1;
33
- projectedHeight = Math.max(1, Math.round(projectedWidth * height / width));
34
- }
35
- return { width: projectedWidth, height: projectedHeight };
36
- }
37
- let projectedHeight = Math.max(1, Math.floor(height * scale));
38
- let projectedWidth = Math.max(1, Math.round(projectedHeight * width / height));
39
- while (projectedWidth * projectedHeight > maxPixels && projectedHeight > 1) {
40
- projectedHeight -= 1;
41
- projectedWidth = Math.max(1, Math.round(projectedHeight * width / height));
42
- }
43
- return { width: projectedWidth, height: projectedHeight };
44
- }
45
19
  function checkedInteger(value, name) {
46
20
  if (!Number.isSafeInteger(value) || value <= 0) {
47
21
  throw new AttachmentError(`${name} must be a positive integer.`, 'INVALID_ATTACHMENT_REF');