@try-works/dsh-model-as-tool 0.1.2 → 0.3.6

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 (267) 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 +592 -0
  5. package/client/index.js +1679 -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 +197 -0
  19. package/lib/extension-dependencies.d.ts.map +1 -0
  20. package/lib/extension-dependencies.js +369 -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 +217 -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 +334 -0
  34. package/lib/extensions-service.d.ts.map +1 -0
  35. package/lib/extensions-service.js +1351 -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 +250 -7
  49. package/lib/index.d.ts.map +1 -1
  50. package/lib/index.js +2625 -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/lang-detect.d.ts +16 -0
  130. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
  131. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +85 -0
  132. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
  133. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
  134. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
  135. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts +20 -0
  136. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
  137. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -0
  138. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
  139. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
  140. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
  141. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
  142. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
  143. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
  144. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts +82 -0
  145. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
  146. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
  147. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
  148. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
  149. package/node_modules/@try-works/tool-mode-contracts/lib/index.js +48 -0
  150. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +104 -0
  151. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
  152. package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +55 -0
  153. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +107 -0
  154. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
  155. package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
  156. package/node_modules/@try-works/tool-mode-contracts/package.json +34 -0
  157. package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
  158. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
  159. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
  160. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
  161. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +83 -0
  162. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
  163. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +125 -0
  164. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
  165. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
  166. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
  167. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
  168. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
  169. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
  170. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +31 -0
  171. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
  172. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +31 -0
  173. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
  174. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
  175. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +185 -0
  176. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +126 -0
  177. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
  178. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +297 -0
  179. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +216 -0
  180. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
  181. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +800 -0
  182. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
  183. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
  184. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
  185. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
  186. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
  187. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
  188. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
  189. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
  190. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
  191. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
  192. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
  193. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +235 -0
  194. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +367 -0
  195. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
  196. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +807 -0
  197. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
  198. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
  199. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
  200. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
  201. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
  202. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
  203. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
  204. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
  205. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
  206. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
  207. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
  208. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
  209. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
  210. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
  211. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
  212. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +118 -0
  213. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
  214. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
  215. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
  216. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
  217. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
  218. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +150 -0
  219. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
  220. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +670 -0
  221. package/node_modules/@try-works/tool-mode-extension-sdk/package.json +53 -0
  222. package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
  223. package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
  224. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +427 -0
  225. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
  226. package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +592 -0
  227. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +60 -0
  228. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
  229. package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +936 -0
  230. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
  231. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
  232. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +200 -0
  233. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
  234. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
  235. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
  236. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +105 -0
  237. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
  238. package/node_modules/@try-works/tool-mode-recipes/lib/images.js +129 -0
  239. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
  240. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
  241. package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
  242. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +325 -0
  243. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
  244. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1310 -0
  245. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
  246. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
  247. package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
  248. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +227 -0
  249. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
  250. package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +407 -0
  251. package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
  252. package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
  253. package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
  254. package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
  255. package/package.json +50 -17
  256. package/remote/spec.mjs +439 -0
  257. package/remote/typert.host.mjs +14 -0
  258. package/remote/typert.remote-client.mjs +16 -0
  259. package/lib/adapters/tongue.d.ts +0 -31
  260. package/lib/adapters/tongue.d.ts.map +0 -1
  261. package/lib/adapters/tongue.js +0 -93
  262. package/lib/adapters/voz.d.ts +0 -28
  263. package/lib/adapters/voz.d.ts.map +0 -1
  264. package/lib/adapters/voz.js +0 -102
  265. /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts +0 -0
  266. /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts.map +0 -0
  267. /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.js +0 -0
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The host-side contribution registrar (EXT-21..EXT-30, ARCH-06).
3
+ *
4
+ * This is the bridge that was MISSING: `ExtensionLifecycle` could install, activate and
5
+ * publish contributions, and the SDK was fully tested doing so — but the HOST never
6
+ * mounted the lifecycle, so **no extension's tools ever reached the DSH registry**. An
7
+ * extension could be installed, activated and reported `observedActivation: 'active'` with
8
+ * its tool listed, and a caller still could not invoke it.
9
+ *
10
+ * The registrar is the other half: it turns a published contribution into a real registry
11
+ * entry, and withdraws it again on deactivation.
12
+ *
13
+ * Four rules, each of which has been a real defect somewhere:
14
+ *
15
+ * - **Handles are opaque and unguessable.** An extension must not be able to construct a
16
+ * handle and withdraw a contribution it does not own. A sequence number is guessable;
17
+ * the handle is a branded object the caller never sees the inside of.
18
+ * - **Withdrawing is idempotent.** A deactivation that runs twice must not throw the
19
+ * second time, and must not withdraw a DIFFERENT contribution that reused the handle.
20
+ * - **A name collision is refused, not silently overwritten.** Two extensions contributing
21
+ * `transcribe` is a configuration error; letting the second win would silently change
22
+ * what an existing caller reaches.
23
+ * - **The host stamps identity.** The contribution carries an extension id, but the HOST
24
+ * decides what that means; a package claiming another's id is refused rather than
25
+ * trusted.
26
+ *
27
+ * @module @try-works/dsh-model-as-tool/extension-registrar
28
+ */
29
+ import type { Contribution, ContributionRegistrar } from '@try-works/tool-mode-extension-sdk';
30
+ /** One thing the registrar can put into the DSH registry. */
31
+ export interface RegistrableTool {
32
+ /** The caller-facing tool name. */
33
+ readonly name: string;
34
+ /** The extension that owns it, as the HOST resolved it. */
35
+ readonly ownerExtension: string;
36
+ /** The contract it implements, when it declares one. */
37
+ readonly contractId?: string;
38
+ }
39
+ /** What the registrar needs from the host registry. */
40
+ export interface HostRegistrySurface {
41
+ /**
42
+ * Register one tool.
43
+ * @param tool - the tool, with identity already stamped by the host.
44
+ * @returns a disposer that removes it.
45
+ */
46
+ registerTool(tool: RegistrableTool): () => void;
47
+ /** Register one skill, returning a disposer. */
48
+ registerSkill?(skill: {
49
+ readonly name: string;
50
+ readonly ownerExtension: string;
51
+ }): () => void;
52
+ /**
53
+ * Register the CALLER-FACING tools of one declarative implementation (RCP-01).
54
+ *
55
+ * A declarative package declares implementations only — its manifest has no
56
+ * `tools` array — so the tool names and schemas come from the RESOLVED RECIPES,
57
+ * which only the host can turn into registry entries (the recipes need the
58
+ * deployment's harness provider to be served at all). The contribution arrives
59
+ * per implementation; the host resolves the package's recipes and registers the
60
+ * matching tool, returning its disposer. Absent (or a non-declarative package)
61
+ * keeps the earlier behavior: implementations publish nothing.
62
+ */
63
+ registerDeclarative?(contribution: {
64
+ readonly extensionId: string;
65
+ readonly name: string;
66
+ readonly contractId?: string;
67
+ }): () => void;
68
+ }
69
+ /** Raised when a contribution cannot be published. */
70
+ export declare class ContributionError extends Error {
71
+ readonly name = "ContributionError";
72
+ readonly code: 'name-collision' | 'unsupported-kind' | 'unknown-extension';
73
+ constructor(code: ContributionError['code'], message: string);
74
+ }
75
+ /**
76
+ * The published contributions, keyed by handle id.
77
+ *
78
+ * A Map rather than a field on the handle, so an extension that receives a handle cannot
79
+ * reach the disposer or another extension's entry through it.
80
+ */
81
+ export interface RegistrarOptions {
82
+ readonly registry: HostRegistrySurface;
83
+ /**
84
+ * The extensions the host has ACTIVATED.
85
+ *
86
+ * A contribution from an extension not in this set is refused: publishing is a privilege
87
+ * of activation, and without this check any code holding the registrar could register a
88
+ * tool under an extension that was never installed.
89
+ */
90
+ readonly activated: ReadonlySet<string>;
91
+ /** Called when a contribution is refused, so the reason is recorded rather than lost. */
92
+ readonly onRefused?: (contribution: Contribution, error: ContributionError) => void;
93
+ }
94
+ /**
95
+ * Create the registrar the lifecycle publishes through.
96
+ * @param options - the registry surface and the activated set.
97
+ * @returns the registrar.
98
+ */
99
+ export declare function createContributionRegistrar(options: RegistrarOptions): ContributionRegistrar;
100
+ //# sourceMappingURL=extension-registrar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-registrar.d.ts","sourceRoot":"","sources":["../src/extension-regist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AQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACvC,yFAAyF;IACzF,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA;CACpF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,GAAG,qBAAqB,CAkG5F"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * The host-side contribution registrar (EXT-21..EXT-30, ARCH-06).
3
+ *
4
+ * This is the bridge that was MISSING: `ExtensionLifecycle` could install, activate and
5
+ * publish contributions, and the SDK was fully tested doing so — but the HOST never
6
+ * mounted the lifecycle, so **no extension's tools ever reached the DSH registry**. An
7
+ * extension could be installed, activated and reported `observedActivation: 'active'` with
8
+ * its tool listed, and a caller still could not invoke it.
9
+ *
10
+ * The registrar is the other half: it turns a published contribution into a real registry
11
+ * entry, and withdraws it again on deactivation.
12
+ *
13
+ * Four rules, each of which has been a real defect somewhere:
14
+ *
15
+ * - **Handles are opaque and unguessable.** An extension must not be able to construct a
16
+ * handle and withdraw a contribution it does not own. A sequence number is guessable;
17
+ * the handle is a branded object the caller never sees the inside of.
18
+ * - **Withdrawing is idempotent.** A deactivation that runs twice must not throw the
19
+ * second time, and must not withdraw a DIFFERENT contribution that reused the handle.
20
+ * - **A name collision is refused, not silently overwritten.** Two extensions contributing
21
+ * `transcribe` is a configuration error; letting the second win would silently change
22
+ * what an existing caller reaches.
23
+ * - **The host stamps identity.** The contribution carries an extension id, but the HOST
24
+ * decides what that means; a package claiming another's id is refused rather than
25
+ * trusted.
26
+ *
27
+ * @module @try-works/dsh-model-as-tool/extension-registrar
28
+ */
29
+ /** Raised when a contribution cannot be published. */
30
+ export class ContributionError extends Error {
31
+ name = 'ContributionError';
32
+ code;
33
+ constructor(code, message) {
34
+ super(message);
35
+ this.code = code;
36
+ }
37
+ }
38
+ /**
39
+ * Create the registrar the lifecycle publishes through.
40
+ * @param options - the registry surface and the activated set.
41
+ * @returns the registrar.
42
+ */
43
+ export function createContributionRegistrar(options) {
44
+ const published = new Map();
45
+ /** Names currently taken, so a collision is detected rather than overwritten. */
46
+ const takenNames = new Map();
47
+ let nextId = 1;
48
+ const refuse = (contribution, error) => {
49
+ options.onRefused?.(contribution, error);
50
+ throw error;
51
+ };
52
+ return {
53
+ publish(contribution) {
54
+ // ACTIVATION IS A PRECONDITION. A contribution from a package that was never
55
+ // activated is refused rather than registered.
56
+ if (!options.activated.has(contribution.extensionId)) {
57
+ return refuse(contribution, new ContributionError('unknown-extension', `${contribution.extensionId} is not activated, so it cannot publish ${contribution.name}`));
58
+ }
59
+ /**
60
+ * A COLLISION IS REFUSED. Letting the second registration win would silently change
61
+ * what an existing caller reaches — the same name would resolve to a different tool
62
+ * with no signal.
63
+ */
64
+ const existing = takenNames.get(contribution.name);
65
+ if (existing !== undefined) {
66
+ return refuse(contribution, new ContributionError('name-collision', `${contribution.name} is already published by ${existing}; `
67
+ + `${contribution.extensionId} cannot take the name over`));
68
+ }
69
+ const handle = {
70
+ __contributionHandle: true,
71
+ id: nextId++,
72
+ extensionId: contribution.extensionId,
73
+ name: contribution.name,
74
+ };
75
+ let dispose;
76
+ if (contribution.kind === 'tool') {
77
+ dispose = options.registry.registerTool({
78
+ name: contribution.name,
79
+ // The HOST stamps the owner from the contribution it validated, so a package
80
+ // cannot claim another's provenance.
81
+ ownerExtension: contribution.extensionId,
82
+ ...contribution.contractId === undefined ? {} : { contractId: contribution.contractId },
83
+ });
84
+ }
85
+ else if (contribution.kind === 'skill' && options.registry.registerSkill !== undefined) {
86
+ dispose = options.registry.registerSkill({
87
+ name: contribution.name,
88
+ ownerExtension: contribution.extensionId,
89
+ });
90
+ }
91
+ else if (contribution.kind === 'implementation' && options.registry.registerDeclarative !== undefined) {
92
+ // An `implementation` of a MODULE package is not a caller-facing tool: the model
93
+ // catalogue binds it. An implementation of a DECLARATIVE package, however, IS the
94
+ // whole package: the host turns its resolved recipe into the caller-facing tool
95
+ // here (RCP-01), and the returned disposer is tracked like any other handle.
96
+ dispose = options.registry.registerDeclarative({
97
+ extensionId: contribution.extensionId,
98
+ name: contribution.name,
99
+ ...contribution.contractId === undefined ? {} : { contractId: contribution.contractId },
100
+ });
101
+ }
102
+ else {
103
+ dispose = () => { };
104
+ }
105
+ takenNames.set(contribution.name, contribution.extensionId);
106
+ published.set(handle.id, { handle, dispose });
107
+ // The SDK types the handle as a string; the runtime value is a branded object, which
108
+ // is what makes it unforgeable. The cast is the boundary between the two.
109
+ return handle;
110
+ },
111
+ withdraw(rawHandle) {
112
+ const handle = rawHandle;
113
+ // A handle that is not ours — a string, a number, a forged object — is ignored
114
+ // rather than treated as a lookup that might match something.
115
+ if (handle === null || typeof handle !== 'object' || handle.__contributionHandle !== true)
116
+ return;
117
+ const entry = published.get(handle.id);
118
+ if (entry === undefined) {
119
+ // IDEMPOTENT: withdrawing twice is not an error, and must not withdraw whatever
120
+ // might have reused the id.
121
+ return;
122
+ }
123
+ // The handle must be the SAME one that was issued, not merely an object with the
124
+ // right id, so a reconstructed handle cannot withdraw someone else's tool.
125
+ if (entry.handle !== handle)
126
+ return;
127
+ // Failed cleanup retains ownership and the handle for an explicit retry.
128
+ entry.dispose();
129
+ published.delete(handle.id);
130
+ takenNames.delete(handle.name);
131
+ },
132
+ };
133
+ }
134
+ //# sourceMappingURL=extension-registrar.js.map
@@ -0,0 +1,217 @@
1
+ /**
2
+ * The wire contract between the Settings page and the host for extension
3
+ * management (install / enable / disable).
4
+ *
5
+ * This module is the single source of truth both halves implement:
6
+ * - the host service (`extensions-service.ts`) produces these values;
7
+ * - the generated/registered Remote artifact exposes them as `remote.modelTools`;
8
+ * - the browser half calls them after installing its Install/Enable controls.
9
+ *
10
+ * Every method is deliberately explicit about what is UNKNOWN rather than
11
+ * inventing state: `store` is null when no extension store is configured, and a
12
+ * row's `integrity` is absent when nothing was ever installed.
13
+ *
14
+ * @module @try-works/dsh-model-as-tool/extensions-api
15
+ */
16
+ /** One extension, as the UI needs it. */
17
+ /** What kind of prerequisite an extension (or a model it serves) has. */
18
+ export type ExtensionRequirementKind = 'store' | 'source' | 'dependencies' | 'assets' | 'executable' | 'harness-model' | 'platform' | 'integrity' | 'activation';
19
+ /** The action that clears an unmet requirement, when the deployment supports it. */
20
+ export type ExtensionRequirementAction = 'install' | 'prepare' | 'enable' | 'config' | 'none';
21
+ /**
22
+ * ONE activation prerequisite, computed by the host BEFORE install/enable.
23
+ *
24
+ * The point of this list is that a user never discovers a deployment gap by
25
+ * clicking Enable and reading an EXTENSION_FAULT: `blocked` rows carry the exact
26
+ * requirement that is unmet and the action (if any) that would satisfy it. A
27
+ * requirement is reported even when satisfied, so the page can distinguish
28
+ * "nothing to do" from "we did not look".
29
+ */
30
+ export interface ExtensionRequirement {
31
+ readonly kind: ExtensionRequirementKind;
32
+ readonly satisfied: boolean;
33
+ /** Exact, actionable text; empty only when satisfied and self-evident. */
34
+ readonly reason: string;
35
+ readonly action: ExtensionRequirementAction;
36
+ }
37
+ export interface ExtensionState {
38
+ /** The extension's package identity, for example `@try-works/extension-laya`. */
39
+ readonly id: string;
40
+ /** The package name to install from, when the host knows one. */
41
+ readonly package: string | null;
42
+ /** Installed version, absent when the store does not hold it. */
43
+ readonly version: string | null;
44
+ /** Whether the store holds an installed copy. */
45
+ readonly installed: boolean;
46
+ /** Whether the host restored it on this load. */
47
+ readonly active: boolean;
48
+ /** Whether the operator disabled it (config `disabledExtensions`). */
49
+ readonly disabled: boolean;
50
+ /** Content verification of the installed copy. */
51
+ readonly integrity: 'unchanged' | 'changed' | 'unknown';
52
+ /** Tool names the extension exports once active. */
53
+ readonly tools: readonly string[];
54
+ /** Why the extension cannot install or activate, when known. */
55
+ readonly reason: string | null;
56
+ /** Every prerequisite this deployment checked, satisfied or not. */
57
+ readonly requirements: readonly ExtensionRequirement[];
58
+ /**
59
+ * Whether ANY unmet requirement blocks activation. Derived from
60
+ * `requirements`; carried explicitly so the page never has to re-derive it.
61
+ */
62
+ readonly blocked: boolean;
63
+ }
64
+ /** The state of the extension surface. */
65
+ export interface ExtensionsDescribeResult {
66
+ /** The configured extension store directory, or null when unconfigured. */
67
+ readonly store: string | null;
68
+ /** Whether the host can write to the store (install/enable/disable). */
69
+ readonly writable: boolean;
70
+ /** Where the host would install first-party extensions from, or null. */
71
+ readonly sourceDir: string | null;
72
+ /** One row per extension the host knows about. */
73
+ readonly extensions: readonly ExtensionState[];
74
+ }
75
+ /** The result of an install request. */
76
+ export interface ExtensionInstallResult {
77
+ readonly id: string;
78
+ readonly version: string;
79
+ /** Installation is not activation: `active` is false until it is enabled. */
80
+ readonly active: boolean;
81
+ }
82
+ /** The result of an enable/disable request. */
83
+ export interface ExtensionToggleResult {
84
+ readonly id: string;
85
+ readonly active: boolean;
86
+ readonly disabled: boolean;
87
+ }
88
+ /**
89
+ * The readiness vocabulary a preparation reports (EXT-25 / RES-04).
90
+ *
91
+ * Only `prepared-cold`, `loading`, `ready` and `busy` permit activation; the
92
+ * others name WHY they do not.
93
+ */
94
+ export type ExtensionModelReadiness = 'unavailable' | 'needs-preparation' | 'preparing' | 'prepared-cold' | 'loading' | 'ready' | 'busy' | 'failed';
95
+ /**
96
+ * Readiness for each DECLARED model deployment, keyed by the manifest's model id.
97
+ *
98
+ * Declared ids are the projection: a stale readiness entry for a deployment the
99
+ * current manifest no longer declares is not reported.
100
+ */
101
+ export type ExtensionReadinessMap = Readonly<Record<string, ExtensionModelReadiness>>;
102
+ /** One asset in the RES-02 preparation disclosure. */
103
+ export interface ExtensionPreparationAsset {
104
+ /** The stable asset id (`<group>/<asset>`). */
105
+ readonly assetId: string;
106
+ /** Download size in bytes. */
107
+ readonly bytes: number;
108
+ /** The pinned source the bytes come from. */
109
+ readonly source: string;
110
+ /** Whether the asset is executable, which needs the separate approval (RES-02). */
111
+ readonly executable: boolean;
112
+ }
113
+ /**
114
+ * The pre-approval disclosure of what a preparation downloads (RES-02).
115
+ *
116
+ * The same fields the management channel's `extensions-prepare-plan` action
117
+ * discloses; it travels with the result so the page can show bytes, storage,
118
+ * terms and the executable gate.
119
+ */
120
+ export interface ExtensionPreparationPlan {
121
+ /** The manifest model deployment the assets belong to. */
122
+ readonly modelId: string;
123
+ /** The pinned model revision. */
124
+ readonly modelRevision: string;
125
+ /** Every asset the preparation acquires. */
126
+ readonly assets: readonly ExtensionPreparationAsset[];
127
+ /** Total download bytes. */
128
+ readonly totalBytes: number;
129
+ /** Total bytes retained after installation (stated separately from download). */
130
+ readonly storageBytes: number;
131
+ /** Whether any asset is executable and therefore needs the separate approval. */
132
+ readonly requiresExecutableApproval: boolean;
133
+ /** The pinned license terms, surfaced before the download. */
134
+ readonly license: {
135
+ readonly name: string;
136
+ readonly url: string;
137
+ };
138
+ }
139
+ /** The result of a preparation request. */
140
+ export interface ExtensionPrepareResult {
141
+ readonly id: string;
142
+ /** Whether every declared asset was verified and the readiness was recorded. */
143
+ readonly prepared: boolean;
144
+ /** Why the preparation did not complete, when it did not; null on success. */
145
+ readonly reason: string | null;
146
+ /** The RES-02 disclosure this call executed, when a plan could be resolved. */
147
+ readonly plan: ExtensionPreparationPlan | null;
148
+ /** The readiness per DECLARED model deployment after the call. */
149
+ readonly readiness: ExtensionReadinessMap;
150
+ /** The prepared asset group ids (empty when nothing was prepared). */
151
+ readonly groups: readonly string[];
152
+ /**
153
+ * Whether no KNOWN blocker remains for activation: the installed bytes verify
154
+ * and every declared deployment is in a callable readiness state.
155
+ *
156
+ * This is the preparation question only; it does not promise that activation
157
+ * will publish (a schema or contribution refusal can still fail an enable).
158
+ */
159
+ readonly activationReady: boolean;
160
+ }
161
+ /** The methods the HOST service implements (raw values, in-process). */
162
+ export interface ModelToolsRemote {
163
+ /** Read the current state; the page calls this on mount and after each action. */
164
+ describe(signal?: AbortSignal): Promise<ExtensionsDescribeResult>;
165
+ /** Install one extension from `source`, or the configured first-party source. */
166
+ install(id: string, source?: string, signal?: AbortSignal): Promise<ExtensionInstallResult>;
167
+ /** Activate an installed extension (removes it from `disabledExtensions`). */
168
+ enable(id: string, signal?: AbortSignal): Promise<ExtensionToggleResult>;
169
+ /** Deactivate an extension (adds it to `disabledExtensions`). */
170
+ disable(id: string, signal?: AbortSignal): Promise<ExtensionToggleResult>;
171
+ /**
172
+ * Acquire and verify the installed extension's model assets, then record the
173
+ * resulting readiness so a following `enable` can activate it.
174
+ */
175
+ prepare(id: string, signal?: AbortSignal): Promise<ExtensionPrepareResult>;
176
+ }
177
+ /**
178
+ * The Remote wire result wrapper.
179
+ *
180
+ * A generated Remote call resolves a `RemoteResult`, never a bare value: the
181
+ * gateway answers `{ok:true,value}` or `{ok:false,error}`. Declared locally (not
182
+ * imported) so this package does not couple to the harness gateway types, and
183
+ * because the browser half is plain JS that reads `.ok` structurally.
184
+ */
185
+ export type RemoteResult<T> = {
186
+ readonly ok: true;
187
+ readonly value: T;
188
+ } | {
189
+ readonly ok: false;
190
+ readonly error: {
191
+ readonly code?: string;
192
+ readonly message: string;
193
+ };
194
+ };
195
+ /**
196
+ * The methods the BROWSER half calls, as `ctx.remote.modelTools`.
197
+ *
198
+ * Two wire facts a caller must respect:
199
+ * - `describe`/`enable`/`disable` resolve a {@link RemoteResult}, not a raw value.
200
+ * - The install method is named `installExtension`, not `install`: the harness
201
+ * client's RemoteNamespaceService owns a private method `install`, and the
202
+ * gateway rejects a descriptor method that collides with it
203
+ * ("client api: method ... conflicts with its namespace service"). The host
204
+ * service keeps `install`, and the descriptor maps the wire name to it.
205
+ */
206
+ export interface ModelToolsRemoteClient {
207
+ describe(signal?: AbortSignal): Promise<RemoteResult<ExtensionsDescribeResult>>;
208
+ installExtension(id: string, source?: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionInstallResult>>;
209
+ enable(id: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionToggleResult>>;
210
+ disable(id: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionToggleResult>>;
211
+ /**
212
+ * Acquire/verify the extension's model assets and record readiness. The wire
213
+ * name is `prepare` (no collision with the namespace service's members).
214
+ */
215
+ prepare(id: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionPrepareResult>>;
216
+ }
217
+ //# sourceMappingURL=extensions-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions-api.d.ts","sourceRoot":"","sources":["../src/extensions-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,yCAAyC;AACzC,yEAAyE;AACzE,MAAM,MAAM,wBAAwB,GAChC,OAAO,GACP,QAAQ,GACR,cAAc,GACd,QAAQ,GACR,YAAY,GACZ,eAAe,GACf,UAAU,GACV,WAAW,GACX,YAAY,CAAA;AAEhB,oFAAoF;AACpF,MAAM,MAAM,0BAA0B,GAClC,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,CAAA;AAEV;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAA;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,SA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CAAC,wBAAwB,CAAC,CAAC,CAAA;IAC/E,gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC,CAAA;IAChD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAAA;IACtF,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAAA;IACvF;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC,CAAA;CACzF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The wire contract between the Settings page and the host for extension
3
+ * management (install / enable / disable).
4
+ *
5
+ * This module is the single source of truth both halves implement:
6
+ * - the host service (`extensions-service.ts`) produces these values;
7
+ * - the generated/registered Remote artifact exposes them as `remote.modelTools`;
8
+ * - the browser half calls them after installing its Install/Enable controls.
9
+ *
10
+ * Every method is deliberately explicit about what is UNKNOWN rather than
11
+ * inventing state: `store` is null when no extension store is configured, and a
12
+ * row's `integrity` is absent when nothing was ever installed.
13
+ *
14
+ * @module @try-works/dsh-model-as-tool/extensions-api
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=extensions-api.js.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Host-side registration of the `modelTools` Remote namespace.
3
+ *
4
+ * The Host Gateway resolves each generated invocation through the Cordis
5
+ * service named by its descriptor (`modelTools`) and refuses a service without
6
+ * a visible `typertRemote` binding. The generated Host artifact
7
+ * (`remote/typert.host.mjs`, published as `./typert`) is registered
8
+ * automatically by `@deepseek-ai/dsh-typert-loader` for this package's Loader
9
+ * entry; this module supplies the other half: a bound, provided service object.
10
+ *
11
+ * Keeping both facts in one helper makes a half-wired composition fail loudly
12
+ * at apply time instead of on the first Remote call.
13
+ *
14
+ * The browser half is `remote/spec.mjs` + `client/client.model-tools.js`; the
15
+ * method-name split between the wire (`installExtension`) and the Host service
16
+ * (`install`) is documented in `./extensions-api.ts`.
17
+ *
18
+ * @module @try-works/dsh-model-as-tool/extensions-remote
19
+ */
20
+ import type { Context } from '@deepseek-ai/cordis';
21
+ import type { ModelToolsRemote } from './extensions-api.ts';
22
+ /** Cordis service key the Host dispatch resolves through the descriptor. */
23
+ export declare const MODEL_TOOLS_SERVICE = "modelTools";
24
+ /** Wire namespace the Client mounts as `ctx.remote.modelTools`. */
25
+ export declare const MODEL_TOOLS_NAMESPACE = "modelTools";
26
+ /**
27
+ * The binding shape the Gateway reads from a service object.
28
+ * Mirrors the protocol's `TypertGatewayBinding` without importing the harness.
29
+ */
30
+ export interface ModelToolsBinding {
31
+ readonly service: object;
32
+ readonly serviceKey: string;
33
+ readonly namespace: string;
34
+ }
35
+ /**
36
+ * Attach the Gateway's `typertRemote` binding to a prepared service object.
37
+ * @param service - the implementation of {@link ModelToolsRemote}.
38
+ * @returns the same service, now bindable to the `modelTools` namespace.
39
+ * @throws TypeError when a required method is missing.
40
+ */
41
+ export declare function bindModelToolsRemote<T extends ModelToolsRemote>(service: T): T;
42
+ /**
43
+ * Provide the bound extension service as the `modelTools` Cordis service.
44
+ *
45
+ * The Host artifact registers strict descriptors for:
46
+ * `describe`, `installExtension` (dispatching to the service's `install`),
47
+ * `enable`, `disable`, and `prepare`.
48
+ *
49
+ * @param ctx - the plugin's Cordis context that should own the service.
50
+ * @param service - the prepared {@link ModelToolsRemote} implementation.
51
+ * @throws TypeError when the service cannot satisfy the wire contract.
52
+ */
53
+ export declare function provideModelToolsService(ctx: Context, service: ModelToolsRemote): void;
54
+ //# sourceMappingURL=extensions-remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions-remote.d.ts","sourceRoot":"","sources":["../src/extensions-remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAC/C,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,eAAe,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAKD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAoB9E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAEtF"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Host-side registration of the `modelTools` Remote namespace.
3
+ *
4
+ * The Host Gateway resolves each generated invocation through the Cordis
5
+ * service named by its descriptor (`modelTools`) and refuses a service without
6
+ * a visible `typertRemote` binding. The generated Host artifact
7
+ * (`remote/typert.host.mjs`, published as `./typert`) is registered
8
+ * automatically by `@deepseek-ai/dsh-typert-loader` for this package's Loader
9
+ * entry; this module supplies the other half: a bound, provided service object.
10
+ *
11
+ * Keeping both facts in one helper makes a half-wired composition fail loudly
12
+ * at apply time instead of on the first Remote call.
13
+ *
14
+ * The browser half is `remote/spec.mjs` + `client/client.model-tools.js`; the
15
+ * method-name split between the wire (`installExtension`) and the Host service
16
+ * (`install`) is documented in `./extensions-api.ts`.
17
+ *
18
+ * @module @try-works/dsh-model-as-tool/extensions-remote
19
+ */
20
+ /** Cordis service key the Host dispatch resolves through the descriptor. */
21
+ export const MODEL_TOOLS_SERVICE = 'modelTools';
22
+ /** Wire namespace the Client mounts as `ctx.remote.modelTools`. */
23
+ export const MODEL_TOOLS_NAMESPACE = 'modelTools';
24
+ /** The public methods the Host service must expose for dispatch to work. */
25
+ const REQUIRED_METHODS = ['describe', 'install', 'enable', 'disable', 'prepare'];
26
+ /**
27
+ * Attach the Gateway's `typertRemote` binding to a prepared service object.
28
+ * @param service - the implementation of {@link ModelToolsRemote}.
29
+ * @returns the same service, now bindable to the `modelTools` namespace.
30
+ * @throws TypeError when a required method is missing.
31
+ */
32
+ export function bindModelToolsRemote(service) {
33
+ const missing = REQUIRED_METHODS.filter(method => service[method] === undefined);
34
+ if (missing.length > 0) {
35
+ throw new TypeError(`model-tools: the Remote service is missing ${missing.map(method => JSON.stringify(method)).join(', ')}; `
36
+ + 'the modelTools namespace cannot be dispatched');
37
+ }
38
+ if (Object.hasOwn(service, 'typertRemote'))
39
+ return service;
40
+ Object.defineProperty(service, 'typertRemote', {
41
+ value: Object.freeze({
42
+ service,
43
+ serviceKey: MODEL_TOOLS_SERVICE,
44
+ namespace: MODEL_TOOLS_NAMESPACE,
45
+ }),
46
+ enumerable: false,
47
+ configurable: false,
48
+ writable: false,
49
+ });
50
+ return service;
51
+ }
52
+ /**
53
+ * Provide the bound extension service as the `modelTools` Cordis service.
54
+ *
55
+ * The Host artifact registers strict descriptors for:
56
+ * `describe`, `installExtension` (dispatching to the service's `install`),
57
+ * `enable`, `disable`, and `prepare`.
58
+ *
59
+ * @param ctx - the plugin's Cordis context that should own the service.
60
+ * @param service - the prepared {@link ModelToolsRemote} implementation.
61
+ * @throws TypeError when the service cannot satisfy the wire contract.
62
+ */
63
+ export function provideModelToolsService(ctx, service) {
64
+ ctx.provide(MODEL_TOOLS_SERVICE, bindModelToolsRemote(service));
65
+ }
66
+ //# sourceMappingURL=extensions-remote.js.map