@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,351 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ /** Managed process bridge. No filesystem authority is implied by process isolation. */
10
+ import { pathToFileURL } from 'node:url';
11
+ import { readFileSync, readSync, statSync, existsSync } from 'node:fs';
12
+ import { dirname, resolve, sep } from 'node:path';
13
+ import { isWorkerObject, workerWire, workerFrame, workerId } from "../worker.js";
14
+ function argument(flag) {
15
+ const index = process.argv.indexOf(flag);
16
+ const value = process.argv[index + 1];
17
+ if (index === -1 || value === undefined)
18
+ throw new Error(`missing ${flag}`);
19
+ return value;
20
+ }
21
+ function bound(flag) {
22
+ const value = Number(argument(flag));
23
+ if (!Number.isSafeInteger(value) || value <= 0)
24
+ throw new Error(`invalid ${flag}`);
25
+ return value;
26
+ }
27
+ const maxLine = bound('--max-line-bytes');
28
+ const maxInput = bound('--max-input-bytes');
29
+ const pathTimeout = bound('--resolve-path-timeout-ms');
30
+ let diagnosticBytes = 0;
31
+ function diagnostic(message) {
32
+ const remaining = 64 * 1024 - diagnosticBytes;
33
+ if (remaining <= 0)
34
+ return;
35
+ const line = Buffer.from(message).subarray(0, Math.min(4096, remaining)).toString('utf8');
36
+ diagnosticBytes += Buffer.byteLength(line);
37
+ process.stderr.write(`${line}\n`);
38
+ }
39
+ function send(message) {
40
+ const line = JSON.stringify(message);
41
+ if (Buffer.byteLength(line, 'utf8') > maxLine) {
42
+ diagnostic('worker result protocol line exceeded byte limit');
43
+ process.exit(1);
44
+ }
45
+ process.stdout.write(`${line}\n`);
46
+ }
47
+ function fatal(message) {
48
+ try {
49
+ send({ kind: 'fault', message: message.slice(0, 4096) });
50
+ }
51
+ finally {
52
+ process.exit(1);
53
+ }
54
+ }
55
+ function readObject(path) {
56
+ if (statSync(path).size > 512 * 1024)
57
+ throw new Error('manifest metadata exceeds byte limit');
58
+ const value = JSON.parse(readFileSync(path, 'utf8'));
59
+ if (!isWorkerObject(value))
60
+ throw new Error('manifest metadata must be an object');
61
+ return value;
62
+ }
63
+ /** Manifest model IDs, including models that have no implementation. */
64
+ function modelMapping(entry, extensionId) {
65
+ let root = dirname(entry);
66
+ while (!existsSync(resolve(root, 'package.json'))) {
67
+ const parent = dirname(root);
68
+ if (parent === root)
69
+ throw new Error('entry has no owning package.json');
70
+ root = parent;
71
+ }
72
+ const pkg = readObject(resolve(root, 'package.json'));
73
+ if (!isWorkerObject(pkg['toolMode']) || typeof pkg['toolMode']['manifest'] !== 'string')
74
+ throw new Error('package has no toolMode.manifest');
75
+ const path = resolve(root, pkg['toolMode']['manifest']);
76
+ if (!path.startsWith(root + sep))
77
+ throw new Error('manifest must be inside owning package');
78
+ const manifest = readObject(path);
79
+ if (manifest['id'] !== extensionId || !Array.isArray(manifest['implementations']) || !Array.isArray(manifest['models']))
80
+ throw new Error('invalid extension manifest identity or mapping');
81
+ const models = new Set();
82
+ for (const model of manifest['models']) {
83
+ if (!isWorkerObject(model) || !workerId(model['id']) || models.has(model['id']))
84
+ throw new Error('invalid or duplicate manifest model');
85
+ models.add(model['id']);
86
+ }
87
+ const implementations = new Map();
88
+ for (const item of manifest['implementations']) {
89
+ if (!isWorkerObject(item) || !workerId(item['id']) || !workerId(item['modelId'])
90
+ || !models.has(item['modelId']) || implementations.has(item['id']))
91
+ throw new Error('invalid or duplicate implementation model mapping');
92
+ implementations.set(item['id'], item['modelId']);
93
+ }
94
+ return { implementations, models };
95
+ }
96
+ function bridgeContext(extensionId, generation, signal) {
97
+ const memory = new Map();
98
+ return {
99
+ extensionId, extensionVersion: '0.0.0-worker', activationGeneration: generation,
100
+ storage: {
101
+ async read(key) { return memory.get(key); },
102
+ async write(key, value) { memory.set(key, value); }, directory: '',
103
+ },
104
+ logger: { log(level, message, fields) {
105
+ if (diagnosticBytes >= 64 * 1024)
106
+ return;
107
+ // Serialize bounded structure only; do not stringify arbitrary huge diagnostics.
108
+ let detail = '';
109
+ try {
110
+ if (fields !== undefined) {
111
+ const encoded = workerWire(fields, 'encode', 4096);
112
+ detail = JSON.stringify(encoded).slice(0, 2048);
113
+ }
114
+ }
115
+ catch {
116
+ detail = '[diagnostic fields omitted]';
117
+ }
118
+ diagnostic(`${level}: ${String(message).slice(0, 2048)} ${detail}`);
119
+ } },
120
+ signal, configuration: {},
121
+ };
122
+ }
123
+ let pathSequence = 0;
124
+ /** fd3 is a host-only reply channel, never caller grants or unrestricted fs. */
125
+ function resolveHostPath(invokeId, candidate, signal) {
126
+ if (typeof candidate !== 'string' || Buffer.byteLength(candidate) > 16 * 1024 || signal.aborted)
127
+ throw new Error('path access denied: invalid or aborted path request');
128
+ const id = `path-${++pathSequence}`;
129
+ send({ kind: 'resolvePath', id, invokeId, candidate });
130
+ const deadline = Date.now() + pathTimeout + 250;
131
+ const chunks = [];
132
+ let bytes = 0;
133
+ // Read one byte at a time to avoid consuming a subsequent synchronous reply.
134
+ const byte = Buffer.alloc(1);
135
+ while (true) {
136
+ if (Date.now() >= deadline)
137
+ throw new Error('path access denied: host path broker deadline elapsed');
138
+ let count;
139
+ try {
140
+ count = readSync(3, byte, 0, 1, null);
141
+ }
142
+ catch (error) {
143
+ if (error.code === 'EAGAIN') {
144
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 5);
145
+ continue;
146
+ }
147
+ throw new Error(`path access denied: broker unavailable: ${String(error)}`);
148
+ }
149
+ if (count === 0)
150
+ throw new Error('path access denied: broker closed');
151
+ if (byte[0] === 10)
152
+ break;
153
+ if (++bytes > maxLine)
154
+ fatal('path response exceeded byte limit');
155
+ chunks.push(Buffer.from(byte));
156
+ }
157
+ const response = JSON.parse(Buffer.concat(chunks).toString('utf8'));
158
+ workerFrame(response, ['kind', 'id', 'invokeId', 'path', 'error']);
159
+ if (response['kind'] !== 'resolvePathResult' || response['id'] !== id || response['invokeId'] !== invokeId
160
+ || (Object.hasOwn(response, 'path') === Object.hasOwn(response, 'error')))
161
+ fatal('malformed host path response');
162
+ if (typeof response['error'] === 'string')
163
+ throw new Error(response['error']);
164
+ if (typeof response['path'] !== 'string' || response['path'].length === 0 || Buffer.byteLength(response['path']) > 16 * 1024)
165
+ fatal('malformed canonical host path');
166
+ return response['path'];
167
+ }
168
+ function invocationContext(invocationId, signal) {
169
+ return {
170
+ invocationId, signal,
171
+ limits: { maxInputBytes: maxInput, maxAudioSeconds: 300, maxResultBytes: maxLine },
172
+ resolvePath(candidate) { return resolveHostPath(invocationId, candidate, signal); },
173
+ };
174
+ }
175
+ /** Stable keys mean semantically identical explicit JSON configs share a provider. */
176
+ function canonical(value) {
177
+ if (Array.isArray(value))
178
+ return `[${value.map(canonical).join(',')}]`;
179
+ if (isWorkerObject(value))
180
+ return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonical(value[key])}`).join(',')}}`;
181
+ return JSON.stringify(value);
182
+ }
183
+ async function main() {
184
+ const entry = argument('--entry');
185
+ const extensionId = argument('--extension-id');
186
+ const generation = Number(argument('--generation'));
187
+ if (!Number.isSafeInteger(generation) || generation < 0)
188
+ throw new Error('invalid generation');
189
+ const disposed = new AbortController();
190
+ const providers = new Map();
191
+ const selected = new Map();
192
+ const inFlight = new Map();
193
+ let extension;
194
+ let mapping;
195
+ try {
196
+ mapping = modelMapping(entry, extensionId);
197
+ const module = await import(__rewriteRelativeImportExtension(pathToFileURL(entry).href));
198
+ const declared = module.default;
199
+ if (declared === null || typeof declared !== 'object' || declared.apiVersion !== 1 || typeof declared.create !== 'function')
200
+ throw new Error('entry must export ToolModeExtensionV1');
201
+ extension = await declared.create(bridgeContext(extensionId, generation, disposed.signal));
202
+ }
203
+ catch (error) {
204
+ fatal(`extension activation failed: ${String(error)}`);
205
+ }
206
+ send({ kind: 'ready' });
207
+ const providerFor = (modelId, configuration) => {
208
+ if (!mapping.models.has(modelId))
209
+ throw new Error(`unknown model ${modelId}`);
210
+ const config = configuration === undefined ? undefined : canonical(configuration);
211
+ const key = config === undefined ? selected.get(modelId) ?? JSON.stringify([modelId, '{}']) : JSON.stringify([modelId, config]);
212
+ let created = providers.get(key);
213
+ if (created === undefined) {
214
+ if (providers.size >= 128)
215
+ throw new Error('worker provider limit exceeded');
216
+ created = Promise.resolve().then(() => extension.createProvider({ modelId, configuration: configuration ?? {} }));
217
+ providers.set(key, created);
218
+ }
219
+ selected.set(modelId, key);
220
+ return created;
221
+ };
222
+ const serve = async (message, controller) => {
223
+ const id = message['id'];
224
+ const kind = message['kind'];
225
+ try {
226
+ const implementationId = message['implementationId'];
227
+ const modelId = kind === 'invoke' ? mapping.implementations.get(implementationId) : message['modelId'];
228
+ if (modelId === undefined)
229
+ throw new Error(`unknown implementation ${implementationId}`);
230
+ const provider = await providerFor(modelId, message['configuration']);
231
+ let result;
232
+ if (kind === 'inspect') {
233
+ result = { type: 'inspect', inspection: await provider.inspect(controller.signal) };
234
+ }
235
+ else if (kind === 'load') {
236
+ const handles = new Map(message['assets'].map(asset => [asset.id, { path: asset.path, digest: asset.digest }]));
237
+ await provider.load({ assets: { assetIds: [...handles.keys()], get(assetId) { return handles.get(assetId); } }, signal: controller.signal });
238
+ result = { type: 'load' };
239
+ }
240
+ else if (kind === 'unload') {
241
+ await provider.unload(controller.signal);
242
+ result = { type: 'unload' };
243
+ }
244
+ else {
245
+ const value = await provider.invoke({ implementationId, input: message['input'], context: invocationContext(id, controller.signal) });
246
+ if (!isWorkerObject(value) || ArrayBuffer.isView(value))
247
+ throw new Error('worker result must be an object');
248
+ result = { type: 'invoke', value };
249
+ }
250
+ send({ id, kind: 'result', result: workerWire(result, 'encode', maxLine) });
251
+ }
252
+ catch (error) {
253
+ send({ id, kind: 'error', message: controller.signal.aborted ? 'the invocation was cancelled' : String(error).slice(0, 4096) });
254
+ }
255
+ finally {
256
+ inFlight.delete(id);
257
+ }
258
+ };
259
+ let shuttingDown;
260
+ const shutdown = () => {
261
+ if (shuttingDown !== undefined)
262
+ return shuttingDown;
263
+ disposed.abort('shutdown');
264
+ for (const { controller } of inFlight.values())
265
+ controller.abort('shutdown');
266
+ shuttingDown = (async () => {
267
+ await Promise.allSettled([...inFlight.values()].map(item => item.task));
268
+ await Promise.allSettled([...providers.values()].map(async (created) => {
269
+ const provider = await created;
270
+ try {
271
+ await provider.unload(disposed.signal);
272
+ }
273
+ finally {
274
+ await provider.dispose();
275
+ }
276
+ }));
277
+ await extension.dispose('shutdown');
278
+ process.exit(0);
279
+ })();
280
+ return shuttingDown;
281
+ };
282
+ const handle = async (line) => {
283
+ const parsed = JSON.parse(line);
284
+ if (!isWorkerObject(parsed) || typeof parsed['kind'] !== 'string')
285
+ throw new Error('protocol frame must be an object with string kind');
286
+ const kind = parsed['kind'];
287
+ switch (kind) {
288
+ case 'inspect':
289
+ case 'load':
290
+ case 'unload':
291
+ case 'invoke': {
292
+ workerFrame(parsed, ['kind', 'id', ...(kind === 'invoke' ? ['implementationId', 'input'] : ['modelId']), 'configuration', ...(kind === 'load' ? ['assets'] : [])]);
293
+ if (disposed.signal.aborted || !workerId(parsed['id']) || inFlight.has(parsed['id']) || inFlight.size >= 1024
294
+ || !workerId(kind === 'invoke' ? parsed['implementationId'] : parsed['modelId']))
295
+ throw new Error('malformed request identity');
296
+ if (Buffer.byteLength(JSON.stringify(parsed), 'utf8') > maxInput)
297
+ throw new Error('input exceeds byte limit');
298
+ const message = workerWire(parsed, 'decode', maxInput);
299
+ if (message['configuration'] !== undefined && (!isWorkerObject(message['configuration']) || ArrayBuffer.isView(message['configuration'])))
300
+ throw new Error('configuration must be an object');
301
+ if (kind === 'invoke' && (!isWorkerObject(message['input']) || ArrayBuffer.isView(message['input'])))
302
+ throw new Error('input must be an object');
303
+ if (kind === 'load') {
304
+ const assets = message['assets'];
305
+ if (!Array.isArray(assets) || assets.length > 10_000 || !assets.every(asset => isWorkerObject(asset)
306
+ && Object.keys(asset).length === 3 && workerId(asset['id']) && typeof asset['path'] === 'string' && typeof asset['digest'] === 'string')
307
+ || new Set(assets.map(asset => asset['id'])).size !== assets.length)
308
+ throw new Error('malformed prepared assets');
309
+ }
310
+ const controller = new AbortController();
311
+ // Queue serve after registration: pre-aborted messages see the controller.
312
+ const task = Promise.resolve().then(() => serve(message, controller));
313
+ inFlight.set(parsed['id'], { controller, task });
314
+ void task.catch(error => fatal(String(error)));
315
+ break;
316
+ }
317
+ case 'cancel':
318
+ workerFrame(parsed, ['kind', 'invokeId']);
319
+ if (!workerId(parsed['invokeId']))
320
+ throw new Error('malformed cancel');
321
+ inFlight.get(parsed['invokeId'])?.controller.abort();
322
+ break;
323
+ case 'dispose':
324
+ workerFrame(parsed, ['kind', 'reason']);
325
+ if (parsed['reason'] !== 'shutdown')
326
+ throw new Error('malformed dispose');
327
+ await shutdown();
328
+ break;
329
+ default: throw new Error('unknown protocol kind');
330
+ }
331
+ };
332
+ let buffer = '';
333
+ process.stdin.setEncoding('utf8');
334
+ process.stdin.on('data', (chunk) => {
335
+ buffer += chunk;
336
+ let newline = buffer.indexOf('\n');
337
+ while (newline !== -1) {
338
+ const line = buffer.slice(0, newline);
339
+ buffer = buffer.slice(newline + 1);
340
+ if (Buffer.byteLength(line, 'utf8') > maxLine)
341
+ fatal('protocol line exceeded byte limit');
342
+ void handle(line).catch(error => fatal(`malformed host protocol: ${String(error)}`));
343
+ newline = buffer.indexOf('\n');
344
+ }
345
+ if (Buffer.byteLength(buffer, 'utf8') > maxLine)
346
+ fatal('protocol line exceeded byte limit');
347
+ });
348
+ process.stdin.on('end', () => { void shutdown().catch(error => fatal(String(error))); });
349
+ }
350
+ void main().catch(error => fatal(String(error)));
351
+ //# sourceMappingURL=worker-child.js.map
@@ -0,0 +1,150 @@
1
+ /**
2
+ * The managed extension worker (EXT-20, the SDK half).
3
+ *
4
+ * An extension's executable entry runs OUTSIDE the host, in a managed Node
5
+ * child process with a scrubbed startup environment and a bounded
6
+ * line-delimited JSON protocol. This module is the host-side of that bridge;
7
+ * {@link ./worker/worker-child.ts} is the child.
8
+ *
9
+ * What "managed" means here, concretely:
10
+ *
11
+ * - **Scrubbed environment.** The child env is built from an explicit
12
+ * ALLOWLIST (the platform basics a Node child needs: PATH, SystemRoot,
13
+ * TEMP/TMP, PATHEXT, COMSPEC, WINDIR) plus names the operator explicitly
14
+ * passed through — NEVER `process.env` wholesale, so a credential or a
15
+ * planted marker in the host environment does not leak into extension code.
16
+ * - **Bounded protocol.** One JSON message per line; lines over
17
+ * `maxLineBytes` and inputs over `maxInputBytes` are refused, and a child
18
+ * that violates the framing is killed and faulted rather than trusted.
19
+ * - **Timeouts on every phase.** Spawn must answer `ready` within
20
+ * `readyTimeoutMs`; a cancelled invoke must settle within `killTimeoutMs` or
21
+ * the child is killed; a dispose that outlives the grace is killed.
22
+ * - **One process per extension identity**, reused across invocations, with a
23
+ * restart-on-exit policy: a child that exits (crash or protocol violation)
24
+ * faults its in-flight calls and the NEXT invoke spawns a fresh one.
25
+ *
26
+ * **The boundary, documented:** a worker failure fails the CALL with the SDK's
27
+ * management-error vocabulary (EXTENSION_FAULT / INVALID_EXTENSION), never the
28
+ * host process — the extension runs in another process by design, and this
29
+ * module never lets a child's exit, hang or protocol violation propagate as an
30
+ * uncaught failure in the caller.
31
+ *
32
+ * Distinct process lifetime per extension generation is the caller's
33
+ * discipline (EXT-20): the host half disposes the old worker and creates a new
34
+ * one when the activation generation advances. `generation` is recorded here
35
+ * so diagnostics can name which generation a worker served.
36
+ *
37
+ * @module @try-works/tool-mode-extension-sdk/worker
38
+ */
39
+ import type { JsonObject, PreparedAssetMapV1, ProviderInspectionV1 } from './runtime.ts';
40
+ /** Default bounds; every one is overridable for a tighter deployment. */
41
+ export interface WorkerLimits {
42
+ /** Longest protocol line admitted, either direction. Default 1 MiB. */
43
+ readonly maxLineBytes?: number;
44
+ /** Largest serialized input admitted. Default 4 MiB. */
45
+ readonly maxInputBytes?: number;
46
+ /** How long spawn may take to answer `ready`. Default 30 s. */
47
+ readonly readyTimeoutMs?: number;
48
+ /** How long a cancelled or disposing child may outlive the request. Default 5 s. */
49
+ readonly killTimeoutMs?: number;
50
+ /** Deadline for one request-scoped path broker reply. Default 5 s. */
51
+ readonly resolvePathTimeoutMs?: number;
52
+ }
53
+ /** Options for {@link ManagedExtensionWorker.create}. */
54
+ export interface ManagedWorkerOptions {
55
+ /** The extension identity the worker serves; one process per identity. */
56
+ readonly extensionId: string;
57
+ /** Absolute path of the built `./tool-mode` entry (plain Node ESM). */
58
+ readonly entryPath: string;
59
+ /** The activation generation this worker serves (EXT-20 lifetime discipline). */
60
+ readonly generation: number;
61
+ /** Explicit environment names to pass through, on top of the allowlist. */
62
+ readonly envPassthrough?: readonly string[];
63
+ /** The Node executable; defaults to the caller's own. */
64
+ readonly nodePath?: string;
65
+ /** Bounds and deadlines. */
66
+ readonly limits?: WorkerLimits;
67
+ /** Where child stderr diagnostics go; defaults to stderr. */
68
+ readonly diagnostics?: (line: string) => void;
69
+ }
70
+ /**
71
+ * Build the scrubbed child environment (EXT-20).
72
+ *
73
+ * The allowlist is the platform's Node bootstrap minimum; the operator's
74
+ * explicit `passthrough` names are the only additions. Everything else the
75
+ * parent holds — credentials, markers, DSH internals — is absent in the child.
76
+ * @param env - the parent environment to scrub.
77
+ * @param passthrough - explicit names to carry over.
78
+ * @returns the child environment.
79
+ */
80
+ export declare function scrubbedEnv(env?: NodeJS.ProcessEnv, passthrough?: readonly string[]): Record<string, string>;
81
+ /** A protocol object is never null, an array, or a scalar. */
82
+ export declare function isWorkerObject(value: unknown): value is Record<string, unknown>;
83
+ /** Lossless bounded wire codec. Other non-JSON/typed values fail explicitly. */
84
+ export declare function workerWire(value: unknown, direction: 'encode' | 'decode', maxBytes: number): unknown;
85
+ /** Explicit host-selected, serialized configuration only; never pass grants or env. */
86
+ export interface WorkerRequestOptions {
87
+ readonly configuration?: Readonly<JsonObject>;
88
+ readonly signal?: AbortSignal;
89
+ }
90
+ /** Shared envelope guard; every protocol frame is bounded before this runs. */
91
+ export declare function workerFrame(value: unknown, fields: readonly string[]): asserts value is Record<string, unknown>;
92
+ export declare function workerId(value: unknown): value is string;
93
+ /**
94
+ * One managed extension worker process.
95
+ *
96
+ * Spawn is LAZY: the first invocation starts the child, and later invocations
97
+ * reuse it. A child that exits is replaced on the next invocation; the
98
+ * in-flight calls at exit time fault with EXTENSION_FAULT.
99
+ */
100
+ export declare class ManagedExtensionWorker {
101
+ #private;
102
+ readonly extensionId: string;
103
+ readonly generation: number;
104
+ private constructor();
105
+ /** Build a worker; nothing is spawned until the first invocation. */
106
+ static create(options: ManagedWorkerOptions): ManagedExtensionWorker;
107
+ /** Whether the worker process is currently alive. */
108
+ get alive(): boolean;
109
+ /** The worker's pid, when it has one. */
110
+ get pid(): number | undefined;
111
+ /** How many invocations are in flight. */
112
+ get inFlight(): number;
113
+ /**
114
+ * Run one invocation in the managed process.
115
+ *
116
+ * The caller's abort cancels the invocation BY MESSAGE; a child that does
117
+ * not settle within `killTimeoutMs` after cancellation is killed and the
118
+ * call fails with EXTENSION_FAULT — a hung extension can never hang the
119
+ * caller. There is no normal inference deadline here; a caller-owned request
120
+ * timeout can abort its signal. Killing this shared process also faults all
121
+ * noncancelled in-flight calls, without labelling them caller cancellations.
122
+ * Every failure here is a ManagementError with the SDK's own vocabulary;
123
+ * nothing propagates from the child as a raw throw.
124
+ * @param request - which deployment to call, with what input.
125
+ * @returns the extension's payload.
126
+ * @throws ManagementError on worker fault, timeout, protocol violation or a
127
+ * refused input.
128
+ */
129
+ invoke(request: {
130
+ readonly implementationId: string;
131
+ readonly input: JsonObject;
132
+ readonly signal?: AbortSignal;
133
+ readonly configuration?: Readonly<JsonObject>;
134
+ /** Trusted host authority for THIS request only. Omitted means deny. */
135
+ readonly resolvePath?: (candidate: string) => string | Promise<string>;
136
+ }): Promise<JsonObject>;
137
+ /** Inspect the exact manifest model, entirely in the managed process. */
138
+ inspect(modelId: string, options?: WorkerRequestOptions): Promise<ProviderInspectionV1>;
139
+ /** Load ONLY handles explicitly prepared and verified by the host. No auto-load. */
140
+ load(modelId: string, options: WorkerRequestOptions & {
141
+ readonly assets: Readonly<PreparedAssetMapV1>;
142
+ }): Promise<void>;
143
+ /** Release a selected model provider's loaded resources without disposing it. */
144
+ unload(modelId: string, options?: WorkerRequestOptions): Promise<void>;
145
+ /**
146
+ * Dispose the worker: ask the child to stop, then kill it after the grace.
147
+ */
148
+ dispose(): Promise<void>;
149
+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