@try-works/dsh-model-as-tool 0.1.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/bin/dsh-tool-mode-credentials.mjs +20 -0
  2. package/bin/dsh-tool-mode.mjs +202 -0
  3. package/catalog/desert-ant-models.json +693 -693
  4. package/client/client.model-tools.js +614 -0
  5. package/client/index.js +1717 -0
  6. package/lib/adapters/index.d.ts.map +1 -1
  7. package/lib/adapters/index.js +4 -4
  8. package/lib/bindings.d.ts.map +1 -1
  9. package/lib/bindings.js +26 -25
  10. package/lib/capability.d.ts.map +1 -1
  11. package/lib/capability.js +17 -0
  12. package/lib/capture-path.d.ts +97 -0
  13. package/lib/capture-path.d.ts.map +1 -0
  14. package/lib/capture-path.js +152 -0
  15. package/lib/diagnostics.d.ts +166 -0
  16. package/lib/diagnostics.d.ts.map +1 -0
  17. package/lib/diagnostics.js +135 -0
  18. package/lib/extension-dependencies.d.ts +325 -0
  19. package/lib/extension-dependencies.d.ts.map +1 -0
  20. package/lib/extension-dependencies.js +858 -0
  21. package/lib/extension-dispatch.d.ts +117 -0
  22. package/lib/extension-dispatch.d.ts.map +1 -0
  23. package/lib/extension-dispatch.js +124 -0
  24. package/lib/extension-registrar.d.ts +100 -0
  25. package/lib/extension-registrar.d.ts.map +1 -0
  26. package/lib/extension-registrar.js +134 -0
  27. package/lib/extensions-api.d.ts +221 -0
  28. package/lib/extensions-api.d.ts.map +1 -0
  29. package/lib/extensions-api.js +17 -0
  30. package/lib/extensions-remote.d.ts +54 -0
  31. package/lib/extensions-remote.d.ts.map +1 -0
  32. package/lib/extensions-remote.js +66 -0
  33. package/lib/extensions-service.d.ts +367 -0
  34. package/lib/extensions-service.d.ts.map +1 -0
  35. package/lib/extensions-service.js +1527 -0
  36. package/lib/harness-llm.d.ts +138 -0
  37. package/lib/harness-llm.d.ts.map +1 -0
  38. package/lib/harness-llm.js +218 -0
  39. package/lib/harness-serving.d.ts +95 -0
  40. package/lib/harness-serving.d.ts.map +1 -0
  41. package/lib/harness-serving.js +157 -0
  42. package/lib/headless.d.ts +97 -0
  43. package/lib/headless.d.ts.map +1 -0
  44. package/lib/headless.js +349 -0
  45. package/lib/http-acquisition.d.ts +27 -0
  46. package/lib/http-acquisition.d.ts.map +1 -0
  47. package/lib/http-acquisition.js +136 -0
  48. package/lib/index.d.ts +271 -7
  49. package/lib/index.d.ts.map +1 -1
  50. package/lib/index.js +2644 -70
  51. package/lib/invocation-accounting.d.ts +169 -0
  52. package/lib/invocation-accounting.d.ts.map +1 -0
  53. package/lib/invocation-accounting.js +148 -0
  54. package/lib/legacy-migration.d.ts +95 -0
  55. package/lib/legacy-migration.d.ts.map +1 -0
  56. package/lib/legacy-migration.js +429 -0
  57. package/lib/managed-workers.d.ts +151 -0
  58. package/lib/managed-workers.d.ts.map +1 -0
  59. package/lib/managed-workers.js +249 -0
  60. package/lib/mcp/client-grant.d.ts +74 -0
  61. package/lib/mcp/client-grant.d.ts.map +1 -0
  62. package/lib/mcp/client-grant.js +60 -0
  63. package/lib/mcp/credential-cli.d.ts +38 -0
  64. package/lib/mcp/credential-cli.d.ts.map +1 -0
  65. package/lib/mcp/credential-cli.js +148 -0
  66. package/lib/mcp/credential-store.d.ts +143 -0
  67. package/lib/mcp/credential-store.d.ts.map +1 -0
  68. package/lib/mcp/credential-store.js +454 -0
  69. package/lib/mcp/host-binding.d.ts +25 -0
  70. package/lib/mcp/host-binding.d.ts.map +1 -1
  71. package/lib/mcp/host-binding.js +107 -14
  72. package/lib/mcp/http.d.ts +68 -18
  73. package/lib/mcp/http.d.ts.map +1 -1
  74. package/lib/mcp/http.js +390 -62
  75. package/lib/mcp/oauth.d.ts +149 -0
  76. package/lib/mcp/oauth.d.ts.map +1 -0
  77. package/lib/mcp/oauth.js +396 -0
  78. package/lib/mcp/protocol.d.ts +46 -7
  79. package/lib/mcp/protocol.d.ts.map +1 -1
  80. package/lib/mcp/protocol.js +63 -16
  81. package/lib/mcp/rate-limit.d.ts +68 -0
  82. package/lib/mcp/rate-limit.d.ts.map +1 -0
  83. package/lib/mcp/rate-limit.js +114 -0
  84. package/lib/mcp/sdk-v2.d.ts +17 -0
  85. package/lib/mcp/sdk-v2.d.ts.map +1 -0
  86. package/lib/mcp/sdk-v2.js +181 -0
  87. package/lib/mcp/server.d.ts +11 -1
  88. package/lib/mcp/server.d.ts.map +1 -1
  89. package/lib/mcp/server.js +80 -13
  90. package/lib/mcp/stdio.d.ts.map +1 -1
  91. package/lib/mcp/stdio.js +9 -1
  92. package/lib/mcp/subscriptions.d.ts +43 -1
  93. package/lib/mcp/subscriptions.d.ts.map +1 -1
  94. package/lib/mcp/subscriptions.js +90 -9
  95. package/lib/model-qualification.d.ts +192 -0
  96. package/lib/model-qualification.d.ts.map +1 -0
  97. package/lib/model-qualification.js +178 -0
  98. package/lib/planning.d.ts +246 -0
  99. package/lib/planning.d.ts.map +1 -0
  100. package/lib/planning.js +457 -0
  101. package/lib/prepared-assets.d.ts +178 -0
  102. package/lib/prepared-assets.d.ts.map +1 -0
  103. package/lib/prepared-assets.js +286 -0
  104. package/lib/provider-bridge.d.ts +37 -0
  105. package/lib/provider-bridge.d.ts.map +1 -1
  106. package/lib/provider-bridge.js +189 -12
  107. package/lib/ptc-authority.d.ts +140 -0
  108. package/lib/ptc-authority.d.ts.map +1 -0
  109. package/lib/ptc-authority.js +216 -0
  110. package/lib/ptc-runtime.d.ts +156 -0
  111. package/lib/ptc-runtime.d.ts.map +1 -0
  112. package/lib/ptc-runtime.js +191 -0
  113. package/lib/publication.d.ts +2 -1
  114. package/lib/publication.d.ts.map +1 -1
  115. package/lib/publication.js +13 -5
  116. package/lib/receipt.d.ts.map +1 -1
  117. package/lib/receipt.js +8 -0
  118. package/lib/title-proposal.d.ts +194 -0
  119. package/lib/title-proposal.d.ts.map +1 -0
  120. package/lib/title-proposal.js +244 -0
  121. package/lib/tool-mode-run.d.ts +235 -0
  122. package/lib/tool-mode-run.d.ts.map +1 -0
  123. package/lib/tool-mode-run.js +283 -0
  124. package/lib/types.d.ts +3 -1
  125. package/lib/types.d.ts.map +1 -1
  126. package/lib/update-surface.d.ts +79 -0
  127. package/lib/update-surface.d.ts.map +1 -0
  128. package/lib/update-surface.js +224 -0
  129. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
  130. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
  131. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
  132. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
  133. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
  134. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
  135. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
  136. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
  137. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
  138. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -1
  139. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +69 -55
  140. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +4 -1
  141. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -1
  142. package/node_modules/@try-works/tool-mode-contracts/lib/index.js +26 -2
  143. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +28 -2
  144. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -1
  145. package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +93 -10
  146. package/node_modules/@try-works/tool-mode-contracts/package.json +0 -1
  147. package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
  148. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
  149. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
  150. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
  151. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +83 -0
  152. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
  153. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +125 -0
  154. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
  155. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
  156. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
  157. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
  158. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
  159. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
  160. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +32 -0
  161. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
  162. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +32 -0
  163. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
  164. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
  165. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
  166. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +126 -0
  167. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
  168. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +297 -0
  169. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +216 -0
  170. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
  171. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +800 -0
  172. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
  173. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
  174. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
  175. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
  176. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
  177. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
  178. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
  179. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
  180. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
  181. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
  182. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
  183. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +235 -0
  184. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +367 -0
  185. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
  186. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +807 -0
  187. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
  188. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
  189. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +243 -0
  190. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
  191. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
  192. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
  193. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
  194. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
  195. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
  196. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
  197. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
  198. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
  199. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
  200. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
  201. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
  202. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
  203. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
  204. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
  205. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +118 -0
  206. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
  207. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
  208. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
  209. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
  210. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
  211. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +150 -0
  212. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
  213. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +670 -0
  214. package/node_modules/@try-works/tool-mode-extension-sdk/package.json +53 -0
  215. package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
  216. package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
  217. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +427 -0
  218. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
  219. package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +592 -0
  220. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +60 -0
  221. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
  222. package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +936 -0
  223. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
  224. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
  225. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +200 -0
  226. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
  227. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
  228. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
  229. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +105 -0
  230. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
  231. package/node_modules/@try-works/tool-mode-recipes/lib/images.js +129 -0
  232. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
  233. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
  234. package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
  235. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +325 -0
  236. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
  237. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1310 -0
  238. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
  239. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
  240. package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
  241. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +227 -0
  242. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
  243. package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +407 -0
  244. package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
  245. package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
  246. package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
  247. package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
  248. package/package.json +43 -15
  249. package/remote/spec.mjs +462 -0
  250. package/remote/typert.host.mjs +14 -0
  251. package/remote/typert.remote-client.mjs +16 -0
  252. package/lib/adapters/tongue.d.ts +0 -31
  253. package/lib/adapters/tongue.d.ts.map +0 -1
  254. package/lib/adapters/tongue.js +0 -93
  255. package/lib/adapters/voz.d.ts +0 -28
  256. package/lib/adapters/voz.d.ts.map +0 -1
  257. package/lib/adapters/voz.js +0 -102
  258. /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts +0 -0
  259. /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts.map +0 -0
  260. /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.js +0 -0
@@ -0,0 +1,191 @@
1
+ /**
2
+ * PTC runtime integration: a guarded mount and the ONE authorized tool pipeline.
3
+ *
4
+ * The directive is explicit that this is repository work, not a missing upstream product:
5
+ *
6
+ * "Use the existing `@deepseek-ai/dsh-ptc-runtime` interface and a compatible
7
+ * `@deepseek-ai/dsh-ptc-runtime-node` backend. Compose its filesystem, subprocess,
8
+ * sandbox, and policy dependencies. **Do not call `ctx.ptcRuntime` without mounting a
9
+ * provider and then report the missing service as an unavailable upstream product.**"
10
+ *
11
+ * "Native DSH PTC and external `tool_mode_run` must use the SAME authorized tool
12
+ * pipeline."
13
+ *
14
+ * Two facts shape the mount, both discovered by reading the DSH source rather than guessed:
15
+ *
16
+ * 1. **The base bundle already mounts a provider.** `packages/bundle/base/cordis.patch.yml`
17
+ * registers `@deepseek-ai/dsh-ptc-runtime-node`, so an UNGUARDED `ctx.plugin(...)`
18
+ * throws `service "ptcRuntime" has been registered at <...>`. The guard is mandatory in
19
+ * both outcomes, so it is not conditional on which host this finds.
20
+ * 2. **The composed services are the inject list**, not something the plugin supplies:
21
+ * `static inject = ['fs','subprocess','sandbox','sandboxPolicy']`. Mounting them here
22
+ * would hit the same duplicate-service throw.
23
+ *
24
+ * Everything that touches Cordis or DSH is INJECTED, so the guard logic and the authorized
25
+ * pipeline are testable without a live runtime.
26
+ *
27
+ * @module @try-works/dsh-model-as-tool/ptc-runtime
28
+ */
29
+ import { authorizeProgramTools, describeRejections, } from "./ptc-authority.js";
30
+ /** The service key the abstract runtime registers itself under. */
31
+ export const PTC_SERVICE = 'ptcRuntime';
32
+ /**
33
+ * Mount the Node PTC backend, but only when nothing already provides the service.
34
+ *
35
+ * @param ctx - the host context.
36
+ * @param backend - the backend plugin, or `undefined` when it could not be resolved.
37
+ * @param config - backend configuration.
38
+ * @returns what happened.
39
+ */
40
+ export async function mountPtcRuntimeIfAbsent(ctx, backend, config = {}) {
41
+ /**
42
+ * THE GUARD. Checked first, because the base bundle mounts a provider and an unguarded
43
+ * `ctx.plugin` throws rather than being idempotent.
44
+ */
45
+ if (ctx.get(PTC_SERVICE) !== undefined) {
46
+ return { mounted: false, reason: 'already-provided', service: PTC_SERVICE };
47
+ }
48
+ if (backend === undefined || backend === null) {
49
+ /**
50
+ * Reported as a REASON, not an exception: a deployment without the backend can still
51
+ * run native tools, and failing the whole plugin load would remove working
52
+ * functionality because an optional one is absent.
53
+ */
54
+ return { mounted: false, reason: 'backend-unavailable', service: PTC_SERVICE };
55
+ }
56
+ await ctx.plugin(backend, config);
57
+ return { mounted: true, service: PTC_SERVICE };
58
+ }
59
+ /** The default budgets, mirroring the backend's own documented defaults. */
60
+ export const PTC_DEFAULT_BUDGETS = {
61
+ timeoutMs: 120_000,
62
+ maxTimeoutMs: 600_000,
63
+ maxOutputBytes: 64 * 1024 * 1024,
64
+ maxOldGenerationSizeMb: 512,
65
+ };
66
+ /**
67
+ * Build the namespace a program may call (CODE-03, SEC-03).
68
+ *
69
+ * Refuses the WHOLE request when any name is unattainable, so a program never runs against
70
+ * a smaller namespace than it declares.
71
+ *
72
+ * @param request - what to bind.
73
+ * @returns the namespace, or the refusal message.
74
+ */
75
+ export function buildToolBindings(request) {
76
+ const decision = authorizeProgramTools({ requested: request.requested }, request.authority, request.resolve);
77
+ if (!decision.ok) {
78
+ return { ok: false, message: describeRejections(decision.rejections) };
79
+ }
80
+ const global = request.global ?? 'tools';
81
+ /**
82
+ * The namespace global obeys the same portability rule the backend enforces, so an
83
+ * invalid one is refused here with a clear reason rather than by the runtime later.
84
+ */
85
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(global)) {
86
+ return {
87
+ ok: false,
88
+ message: `the binding namespace "${global}" is not a language-portable identifier; `
89
+ + 'the same namespace list must work against every backend',
90
+ };
91
+ }
92
+ return { ok: true, namespace: { global, functions: decision.bindings } };
93
+ }
94
+ /**
95
+ * The budgets a run is admitted with (RES-10).
96
+ *
97
+ * A requested budget is clamped to the ceiling rather than refused: a caller asking for
98
+ * longer than policy allows gets policy's figure, which is the direction that cannot be
99
+ * widened by asking.
100
+ * @param requestedMs - what the caller asked for, if anything.
101
+ * @returns the admitted budget.
102
+ */
103
+ export function admitTimeout(requestedMs) {
104
+ if (requestedMs === null) {
105
+ // `null` means "no deadline". That is a request to REMOVE a limit, so it is clamped to
106
+ // the ceiling rather than honoured — otherwise a caller could opt out of budgeting.
107
+ return PTC_DEFAULT_BUDGETS.maxTimeoutMs;
108
+ }
109
+ if (requestedMs === undefined)
110
+ return PTC_DEFAULT_BUDGETS.timeoutMs;
111
+ if (!Number.isFinite(requestedMs) || requestedMs <= 0)
112
+ return PTC_DEFAULT_BUDGETS.timeoutMs;
113
+ return Math.min(requestedMs, PTC_DEFAULT_BUDGETS.maxTimeoutMs);
114
+ }
115
+ /**
116
+ * Whether the confinement acceptance tests have passed on this deployment
117
+ * (CODE-09).
118
+ *
119
+ * This is the SINGLE release-gate flip point. It is a module-level flag with a
120
+ * TEST-ONLY setter so the acceptance test that eventually passes can open the
121
+ * gate for its own proof — the "export APPEARS when the gate opens" case must be
122
+ * executable before the gate opens in production, not exercised there for the
123
+ * first time. Production builds leave it false.
124
+ */
125
+ let confinementEvidence = false;
126
+ /** The current confinement evidence (CODE-09). */
127
+ export function confinementDemonstrated() {
128
+ return confinementEvidence;
129
+ }
130
+ /**
131
+ * The environment marker that arms the test seam (CODE-09).
132
+ *
133
+ * The setter below SHIPS in the built artifact (there is no separate test
134
+ * bundle), so it must be inert in every normal process. It therefore refuses to
135
+ * move the gate unless the OPERATOR started this process with an explicit
136
+ * marker — which is itself an operator action, so opening the gate always costs
137
+ * an operator decision and never happens by config, by import or by accident.
138
+ * The acceptance test sets the marker; production never does.
139
+ */
140
+ const CONFINEMENT_SEAM_ENV = 'DSH_PTC_CONFINEMENT_SEAM';
141
+ const CONFINEMENT_SEAM_TOKEN = 'open-for-acceptance-test';
142
+ /**
143
+ * Set the confinement evidence (TEST SEAM, CODE-09).
144
+ *
145
+ * The setter is the seam the acceptance test uses. It is inert — throws without
146
+ * moving anything — unless the process carries the explicit environment marker,
147
+ * so the built artifact cannot have the gate opened by code that merely imports
148
+ * it. A production build never sets the marker.
149
+ * @param value - the evidence state to adopt.
150
+ */
151
+ export function setConfinementDemonstratedForTest(value) {
152
+ if (process.env[CONFINEMENT_SEAM_ENV] !== CONFINEMENT_SEAM_TOKEN) {
153
+ throw new Error('the confinement evidence is a release gate; the acceptance-test seam is '
154
+ + 'closed in this process because the operator marker is absent');
155
+ }
156
+ confinementEvidence = value;
157
+ }
158
+ /**
159
+ * Whether generated-code execution may be exposed to callers (CODE-08, CODE-10).
160
+ *
161
+ * Exposure is the CONJUNCTION of two independent facts, and neither can stand in
162
+ * for the other:
163
+ *
164
+ * - CODE-09: the specification's confinement tests must have passed. They have
165
+ * not run here, so this half is false — no configuration can open it.
166
+ * - CODE-10: the OPERATOR must have granted hosted code execution, which is a
167
+ * separate consent from ordinary model-tool access. The caller passes the
168
+ * operator's grant in, so the gate has a real input rather than being a literal.
169
+ *
170
+ * A host with the grant flipped but no confinement evidence stays closed; a host
171
+ * with confinement evidence but no operator grant stays closed too.
172
+ * @param operatorGranted - whether the operator granted hosted code execution.
173
+ * @returns whether a caller may be served.
174
+ */
175
+ export function mayExposeToClients(operatorGranted) {
176
+ return operatorGranted && confinementDemonstrated();
177
+ }
178
+ /**
179
+ * Describe why generated-code execution is withheld, naming WHICH fact is unmet.
180
+ * @param operatorGranted - whether the operator granted hosted code execution.
181
+ * @returns the reason callers are given.
182
+ */
183
+ export function exposureWithheldReason(operatorGranted) {
184
+ if (!operatorGranted) {
185
+ return 'generated-code execution is disabled: the operator has not granted hosted '
186
+ + 'code execution (CODE-10); it is a separate consent from model-tool access';
187
+ }
188
+ return 'generated-code execution is withheld until the confinement tests pass; '
189
+ + 'the runtime is mounted and usable in-process, and no production client is served it';
190
+ }
191
+ //# sourceMappingURL=ptc-runtime.js.map
@@ -24,6 +24,7 @@
24
24
  *
25
25
  * @module @try-works/dsh-model-as-tool/publication
26
26
  */
27
+ import type { ModelReadiness } from '@try-works/tool-mode-extension-sdk';
27
28
  /** Why a candidate contribution did not reach the published surface. */
28
29
  export interface WithheldContribution {
29
30
  /** Stable reason code. */
@@ -42,7 +43,7 @@ export interface ImplementationCandidate {
42
43
  /** The catalog model backing it. */
43
44
  readonly modelId: string;
44
45
  /** Whether the model is prepared and callable right now. */
45
- readonly readiness: 'unprepared' | 'preparing' | 'ready' | 'failed';
46
+ readonly readiness: ModelReadiness;
46
47
  /** Whether the model can run on this host at all. */
47
48
  readonly runnable: boolean;
48
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"publication.d.ts","sourceRo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jB,OAAO,GAAE;QAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAA;KAAO;IAK5I,wCAAwC;IACxC,IAAI,OAAO,IAAI,iBAAiB,CAE/B;IAED;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAMtC;;;;;;;OAOG;IACH,cAAc,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,cAAc,EAAE;CAI/E"}
@@ -24,6 +24,12 @@
24
24
  *
25
25
  * @module @try-works/dsh-model-as-tool/publication
26
26
  */
27
+ const CALLABLE_READINESS = new Set([
28
+ 'prepared-cold',
29
+ 'loading',
30
+ 'ready',
31
+ 'busy',
32
+ ]);
27
33
  /**
28
34
  * Build a coherent surface from the candidates available now.
29
35
  *
@@ -56,12 +62,14 @@ export function buildSurface(options) {
56
62
  extensionId: implementation.extensionId,
57
63
  modelId: implementation.modelId,
58
64
  readiness: implementation.readiness,
59
- // Callable requires BOTH that the host can run it and that it is ready.
60
- callable: implementation.runnable && implementation.readiness === 'ready',
65
+ // Callable requires BOTH that the host can run it and that preparation
66
+ // says a call is possible. Residency states such as prepared-cold/loading
67
+ // affect admission, not publication (RES-04).
68
+ callable: implementation.runnable && CALLABLE_READINESS.has(implementation.readiness),
61
69
  reason: !implementation.runnable
62
70
  ? 'this model cannot run on this host'
63
- : implementation.readiness === 'ready'
64
- ? 'prepared and callable'
71
+ : CALLABLE_READINESS.has(implementation.readiness)
72
+ ? `model is ${implementation.readiness}; prepared and callable`
65
73
  : `model is ${implementation.readiness}; the tool is not advertised as working`,
66
74
  });
67
75
  }
@@ -84,7 +92,7 @@ export function buildSurface(options) {
84
92
  });
85
93
  continue;
86
94
  }
87
- if (selected.readiness !== 'ready') {
95
+ if (!CALLABLE_READINESS.has(selected.readiness)) {
88
96
  // EXT-24: an active package with an unprepared model may publish readiness
89
97
  // and preparation guidance, but MUST NOT advertise working inference.
90
98
  withheld.push({
@@ -1 +1 @@
1
- {"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../src/receipt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,iFAAiF;IACjF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,+CAA+C;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9C,wEAAwE;IACxE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5C,sDAAsD;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,8DAA8D;IAC9D,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAA;IAC7C,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CACrC;AAED,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,YA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9C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAA;IACjE,iFAAiF;IACjF,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAA;IACnC,kEAAkE;IAClE,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;CAC5C;AAED,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,EAAE,kBAKhC,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GAChG,OAAO,CAQT"}
package/lib/receipt.js CHANGED
@@ -63,6 +63,14 @@ export function redactText(text) {
63
63
  .replace(/\b(?:npm_|ghp_|gho_|ghs_|sk-|xox[baprs]-)[A-Za-z0-9_-]{8,}/g, '<redacted>')
64
64
  .replace(/\bBearer\s+[A-Za-z0-9._-]{8,}/gi, 'Bearer <redacted>')
65
65
  .replace(/\b[A-Fa-f0-9]{40,}\b/g, '<redacted>')
66
+ // SEC-01: a generated secret is exactly 32 base64url bytes (43 characters). A
67
+ // note that ever embedded one is redacted here, even though nothing in the
68
+ // receipt pipeline takes a secret as input. The boundaries are NON-WORD
69
+ // lookarounds, not \b: a base64url secret may begin or end with '-' (or '_'),
70
+ // which are word characters — a \b-bounded pattern misses such a secret when
71
+ // it abuts another word character, and the reviewer demonstrated real
72
+ // crypto-random secrets with a leading '-' surviving redaction.
73
+ .replace(/(?<![A-Za-z0-9_-])[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g, '<redacted>')
66
74
  .replace(/[A-Za-z]:\\[^\s"']*/g, '<path>')
67
75
  .replace(/(?<![\w.])\/(?:[\w.-]+\/)+[\w.-]+/g, '<path>');
68
76
  }
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Title and description proposal (TOOL-06), with the language-evidence rule from
3
+ * TOOL-03.
4
+ *
5
+ * TOOL-06 is mostly a list of things a title generator must NOT do, and the sharpest of
6
+ * them is this: **a refusal or an incomplete generation must not become a valid empty
7
+ * title.** That failure is easy to ship and hard to notice, because the shape of the
8
+ * response is correct — `{ title: "" }` looks like a result — and a caller writing it
9
+ * into a document produces an empty heading rather than an error.
10
+ *
11
+ * The other rules here are enforced rather than described:
12
+ *
13
+ * - **No invented facts.** A number in a proposed title that does not appear in the
14
+ * source is a claim the source does not support. This is checkable, so it is checked.
15
+ * - **No changed source meaning.** Enforced through the same provenance check plus a
16
+ * refusal to accept a title with no overlap with the source.
17
+ * - **No calling another tool.** Structural: the response shape carries no tool-call
18
+ * field, so there is nothing to dispatch.
19
+ * - **Maximum lengths in the schema**, which the contract states and this enforces.
20
+ *
21
+ * @module @try-works/dsh-model-as-tool/title-proposal
22
+ */
23
+ /** The lengths the contract states (TOOL-06). */
24
+ export interface TitleLimits {
25
+ /** Maximum characters in a title. */
26
+ readonly maxTitleChars: number;
27
+ /** Maximum characters in a description. */
28
+ readonly maxDescriptionChars: number;
29
+ /** Maximum repair attempts permitted. Zero when repairs are disabled. */
30
+ readonly maxRepairs: number;
31
+ }
32
+ /**
33
+ * The evaluated defaults for a section title (TOOL-06).
34
+ *
35
+ * Stated in the contract rather than chosen per call, because "define maximum
36
+ * title/description lengths in the schema and evaluated recipe" means a caller cannot
37
+ * widen them by asking.
38
+ */
39
+ export declare const SECTION_TITLE_LIMITS: TitleLimits;
40
+ /**
41
+ * The contract limits for one configuration's CODE-11 repair ceiling.
42
+ *
43
+ * The title/description lengths stay contract-stated; the repair ceiling is
44
+ * the operator's configured number (an integer 0..8, default 1). An invalid
45
+ * ceiling is a REFUSAL, never a silent clamp — the recorded lineage must show
46
+ * the budget the operator actually approved.
47
+ * @param repairCeiling - the configured ceiling; absent means the default 1.
48
+ * @returns the limits the repair decision and lineage honor.
49
+ */
50
+ export declare function titleLimitsFor(repairCeiling?: number): TitleLimits;
51
+ /** What a title is being proposed for. */
52
+ export type TitleKind = 'section' | 'page' | 'document';
53
+ /** The raw response a text model produced (TOOL-06). */
54
+ export interface RawTitleResponse {
55
+ /** The title text, when the model produced one. */
56
+ readonly title?: string;
57
+ /** The description text, when the model produced one. */
58
+ readonly description?: string;
59
+ /**
60
+ * Set when the model refused.
61
+ *
62
+ * Distinguishing a refusal from an empty generation is what stops the first becoming
63
+ * a valid empty title.
64
+ */
65
+ readonly refused?: boolean;
66
+ /** Why it refused, when it did. */
67
+ readonly refusalReason?: string;
68
+ /**
69
+ * Set when generation was cut short.
70
+ *
71
+ * A truncated generation is not a short one; reporting it as a title claims a
72
+ * complete answer from an incomplete one.
73
+ */
74
+ readonly incomplete?: boolean;
75
+ }
76
+ /** How a proposal ended. */
77
+ export type TitleOutcome =
78
+ /** A usable title. */
79
+ {
80
+ readonly kind: 'proposed';
81
+ readonly title: string;
82
+ readonly description: string;
83
+ /** How many repair attempts were consumed, for the accounting TOOL-06 asks for. */
84
+ readonly repairs: number;
85
+ }
86
+ /**
87
+ * The model refused.
88
+ *
89
+ * An ERROR for the caller, never an empty title.
90
+ */
91
+ | {
92
+ readonly kind: 'refused';
93
+ readonly reason: string;
94
+ }
95
+ /** The generation was cut short. An error, never a short title. */
96
+ | {
97
+ readonly kind: 'incomplete';
98
+ readonly reason: string;
99
+ }
100
+ /** The response could not be used as a title. */
101
+ | {
102
+ readonly kind: 'invalid';
103
+ readonly reason: string;
104
+ }
105
+ /** The response failed validation against a rule below. */
106
+ | {
107
+ readonly kind: 'rejected';
108
+ readonly reason: string;
109
+ };
110
+ /**
111
+ * Accept or refuse a title proposal (TOOL-06).
112
+ *
113
+ * @param response - the model's raw response.
114
+ * @param source - the text the title was proposed for, used for provenance.
115
+ * @param limits - the lengths the contract states.
116
+ * @returns the outcome, which is an error rather than an empty title whenever the
117
+ * response was not a usable one.
118
+ */
119
+ export declare function acceptTitle(response: RawTitleResponse, source: string, limits?: TitleLimits): TitleOutcome;
120
+ /**
121
+ * Whether a repair attempt may run (TOOL-06).
122
+ *
123
+ * The requirement says to COUNT repair attempts when they are enabled, so the count is
124
+ * returned rather than kept internally — an uncounted retry is how a budget silently
125
+ * becomes unbounded.
126
+ * @param limits - the contract's limits.
127
+ * @param repairsSoFar - repairs already consumed.
128
+ * @param previous - what the previous attempt produced.
129
+ * @returns whether to repair, and how many repairs would then be consumed.
130
+ */
131
+ export declare function mayRepairTitle(limits: TitleLimits, repairsSoFar: number, previous: TitleOutcome): {
132
+ readonly repair: boolean;
133
+ readonly repairs: number;
134
+ readonly reason?: string;
135
+ };
136
+ /**
137
+ * One repair-lineage entry (CODE-11): the traceable per-attempt record the
138
+ * budget lineage owes — which repair, the budget before and after the
139
+ * decision, and the outcome the decision produced. A COUNT alone cannot show
140
+ * WHERE a budget was spent; the lineage does.
141
+ */
142
+ export interface RepairLineageEntry {
143
+ /** One-based repair attempt index. */
144
+ readonly repairIndex: number;
145
+ /** The repair budget before the decision. */
146
+ readonly budgetBefore: number;
147
+ /** The repair budget after the decision (one lower when a repair ran). */
148
+ readonly budgetAfter: number;
149
+ /** What the previous attempt produced, so the lineage names WHY. */
150
+ readonly previousKind: string;
151
+ /** The decision outcome for this attempt. */
152
+ readonly outcome: 'repaired' | 'exhausted' | 'not-needed';
153
+ }
154
+ /**
155
+ * Record one repair decision into the lineage (CODE-11, pure and testable).
156
+ * @param lineage - the lineage so far (mutated in place, then returned).
157
+ * @param decision - the `mayRepairTitle` decision for this attempt.
158
+ * @param previousKind - the previous outcome kind.
159
+ * @param budgetBefore - the budget the decision was made against.
160
+ * @returns the updated lineage.
161
+ */
162
+ export declare function recordRepairLineage(lineage: RepairLineageEntry[], decision: {
163
+ readonly repair: boolean;
164
+ readonly repairs: number;
165
+ }, previousKind: string, budgetBefore: number): RepairLineageEntry[];
166
+ /**
167
+ * Whether a tool may call another tool to fulfil this contract (TOOL-06).
168
+ *
169
+ * It may not: "do not call another tool". Returns false so the prohibition is asserted,
170
+ * and the response shape carries no tool-call field for one to be dispatched from.
171
+ * @returns always false.
172
+ */
173
+ export declare function mayCallAnotherTool(): boolean;
174
+ /** What a language result actually examined (TOOL-03). */
175
+ export type LanguageEvidence = 'text' | 'audio';
176
+ /**
177
+ * Whether a language result may be cited as evidence for a medium (TOOL-03).
178
+ *
179
+ * A text detector's result is evidence about the TEXT it processed and nothing else.
180
+ * The requirement forbids using it as evidence of the language SPOKEN in audio it has
181
+ * not processed, and the refusal is per-medium rather than per-result because the result
182
+ * itself is sound — only its use as audio evidence is not.
183
+ * @param examined - what the result examined.
184
+ * @param claimed - the medium being claimed.
185
+ * @returns whether the claim is supported.
186
+ */
187
+ export declare function supportsLanguageClaim(examined: LanguageEvidence, claimed: LanguageEvidence): boolean;
188
+ /**
189
+ * Describe what a language result is evidence for (TOOL-03).
190
+ * @param examined - what the result examined.
191
+ * @returns a description that does not overstate the result.
192
+ */
193
+ export declare function describeLanguageEvidence(examined: LanguageEvidence): string;
194
+ //# sourceMappingURL=title-proposal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title-proposal.d.ts","sourceRoot":"","sources":["../src/title-proposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,2CAA2C;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAKlC,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,GA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