@nodetool-ai/protocol 0.7.0-rc.22 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (419) hide show
  1. package/README.md +56 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/ai-video-production.d.ts +249 -0
  4. package/dist/ai-video-production.d.ts.map +1 -0
  5. package/dist/ai-video-production.js +131 -0
  6. package/dist/ai-video-production.js.map +1 -0
  7. package/dist/api-schemas/agent-access.d.ts +134 -0
  8. package/dist/api-schemas/agent-access.d.ts.map +1 -0
  9. package/dist/api-schemas/agent-access.js +93 -0
  10. package/dist/api-schemas/agent-access.js.map +1 -0
  11. package/dist/api-schemas/api-error-code.d.ts +11 -1
  12. package/dist/api-schemas/api-error-code.d.ts.map +1 -1
  13. package/dist/api-schemas/api-error-code.js +10 -0
  14. package/dist/api-schemas/api-error-code.js.map +1 -1
  15. package/dist/api-schemas/applications.d.ts +1411 -0
  16. package/dist/api-schemas/applications.d.ts.map +1 -0
  17. package/dist/api-schemas/applications.js +333 -0
  18. package/dist/api-schemas/applications.js.map +1 -0
  19. package/dist/api-schemas/assets.d.ts +230 -0
  20. package/dist/api-schemas/assets.d.ts.map +1 -1
  21. package/dist/api-schemas/assets.js +131 -5
  22. package/dist/api-schemas/assets.js.map +1 -1
  23. package/dist/api-schemas/code-gen.d.ts +176 -0
  24. package/dist/api-schemas/code-gen.d.ts.map +1 -0
  25. package/dist/api-schemas/code-gen.js +205 -0
  26. package/dist/api-schemas/code-gen.js.map +1 -0
  27. package/dist/api-schemas/collections.d.ts.map +1 -1
  28. package/dist/api-schemas/collections.js +3 -4
  29. package/dist/api-schemas/collections.js.map +1 -1
  30. package/dist/api-schemas/costs.d.ts +179 -0
  31. package/dist/api-schemas/costs.d.ts.map +1 -1
  32. package/dist/api-schemas/costs.js +100 -4
  33. package/dist/api-schemas/costs.js.map +1 -1
  34. package/dist/api-schemas/credits.d.ts +42 -0
  35. package/dist/api-schemas/credits.d.ts.map +1 -0
  36. package/dist/api-schemas/credits.js +43 -0
  37. package/dist/api-schemas/credits.js.map +1 -0
  38. package/dist/api-schemas/documents.d.ts +163 -0
  39. package/dist/api-schemas/documents.d.ts.map +1 -0
  40. package/dist/api-schemas/documents.js +75 -0
  41. package/dist/api-schemas/documents.js.map +1 -0
  42. package/dist/api-schemas/files.d.ts +13 -0
  43. package/dist/api-schemas/files.d.ts.map +1 -1
  44. package/dist/api-schemas/files.js +8 -0
  45. package/dist/api-schemas/files.js.map +1 -1
  46. package/dist/api-schemas/fonts.d.ts +17 -1
  47. package/dist/api-schemas/fonts.d.ts.map +1 -1
  48. package/dist/api-schemas/fonts.js +19 -3
  49. package/dist/api-schemas/fonts.js.map +1 -1
  50. package/dist/api-schemas/index.d.ts +23 -1
  51. package/dist/api-schemas/index.d.ts.map +1 -1
  52. package/dist/api-schemas/index.js +23 -1
  53. package/dist/api-schemas/index.js.map +1 -1
  54. package/dist/api-schemas/jobs.d.ts +12 -0
  55. package/dist/api-schemas/jobs.d.ts.map +1 -1
  56. package/dist/api-schemas/jobs.js +12 -2
  57. package/dist/api-schemas/jobs.js.map +1 -1
  58. package/dist/api-schemas/js-scripts.d.ts +364 -0
  59. package/dist/api-schemas/js-scripts.d.ts.map +1 -0
  60. package/dist/api-schemas/js-scripts.js +333 -0
  61. package/dist/api-schemas/js-scripts.js.map +1 -0
  62. package/dist/api-schemas/mcp-config.d.ts.map +1 -1
  63. package/dist/api-schemas/mcp-config.js +3 -1
  64. package/dist/api-schemas/mcp-config.js.map +1 -1
  65. package/dist/api-schemas/memories.d.ts +84 -0
  66. package/dist/api-schemas/memories.d.ts.map +1 -0
  67. package/dist/api-schemas/memories.js +54 -0
  68. package/dist/api-schemas/memories.js.map +1 -0
  69. package/dist/api-schemas/messages.d.ts +1 -0
  70. package/dist/api-schemas/messages.d.ts.map +1 -1
  71. package/dist/api-schemas/messages.js +4 -4
  72. package/dist/api-schemas/messages.js.map +1 -1
  73. package/dist/api-schemas/models.d.ts +156 -0
  74. package/dist/api-schemas/models.d.ts.map +1 -1
  75. package/dist/api-schemas/models.js +51 -6
  76. package/dist/api-schemas/models.js.map +1 -1
  77. package/dist/api-schemas/nodes.d.ts +97 -0
  78. package/dist/api-schemas/nodes.d.ts.map +1 -1
  79. package/dist/api-schemas/nodes.js +89 -0
  80. package/dist/api-schemas/nodes.js.map +1 -1
  81. package/dist/api-schemas/projects.d.ts +427 -0
  82. package/dist/api-schemas/projects.d.ts.map +1 -0
  83. package/dist/api-schemas/projects.js +224 -0
  84. package/dist/api-schemas/projects.js.map +1 -0
  85. package/dist/api-schemas/recipes.d.ts +172 -0
  86. package/dist/api-schemas/recipes.d.ts.map +1 -0
  87. package/dist/api-schemas/recipes.js +144 -0
  88. package/dist/api-schemas/recipes.js.map +1 -0
  89. package/dist/api-schemas/resources.d.ts +112 -0
  90. package/dist/api-schemas/resources.d.ts.map +1 -0
  91. package/dist/api-schemas/resources.js +44 -0
  92. package/dist/api-schemas/resources.js.map +1 -0
  93. package/dist/api-schemas/scripts.d.ts +1571 -0
  94. package/dist/api-schemas/scripts.d.ts.map +1 -0
  95. package/dist/api-schemas/scripts.js +153 -0
  96. package/dist/api-schemas/scripts.js.map +1 -0
  97. package/dist/api-schemas/sdk-execution-v1.d.ts +467 -0
  98. package/dist/api-schemas/sdk-execution-v1.d.ts.map +1 -0
  99. package/dist/api-schemas/sdk-execution-v1.js +115 -0
  100. package/dist/api-schemas/sdk-execution-v1.js.map +1 -0
  101. package/dist/api-schemas/sdk-lifecycle-v1.d.ts +217 -0
  102. package/dist/api-schemas/sdk-lifecycle-v1.d.ts.map +1 -0
  103. package/dist/api-schemas/sdk-lifecycle-v1.js +117 -0
  104. package/dist/api-schemas/sdk-lifecycle-v1.js.map +1 -0
  105. package/dist/api-schemas/sdk-models-v1.d.ts +181 -0
  106. package/dist/api-schemas/sdk-models-v1.d.ts.map +1 -0
  107. package/dist/api-schemas/sdk-models-v1.js +108 -0
  108. package/dist/api-schemas/sdk-models-v1.js.map +1 -0
  109. package/dist/api-schemas/sdk-v1-http-operations.d.ts +941 -0
  110. package/dist/api-schemas/sdk-v1-http-operations.d.ts.map +1 -0
  111. package/dist/api-schemas/sdk-v1-http-operations.js +465 -0
  112. package/dist/api-schemas/sdk-v1-http-operations.js.map +1 -0
  113. package/dist/api-schemas/sdk-v1-operations.d.ts +151 -0
  114. package/dist/api-schemas/sdk-v1-operations.d.ts.map +1 -0
  115. package/dist/api-schemas/sdk-v1-operations.js +97 -0
  116. package/dist/api-schemas/sdk-v1-operations.js.map +1 -0
  117. package/dist/api-schemas/sdk-v1-websocket-operations.d.ts +97 -0
  118. package/dist/api-schemas/sdk-v1-websocket-operations.d.ts.map +1 -0
  119. package/dist/api-schemas/sdk-v1-websocket-operations.js +96 -0
  120. package/dist/api-schemas/sdk-v1-websocket-operations.js.map +1 -0
  121. package/dist/api-schemas/sdk-v1.d.ts +15 -0
  122. package/dist/api-schemas/sdk-v1.d.ts.map +1 -0
  123. package/dist/api-schemas/sdk-v1.js +22 -0
  124. package/dist/api-schemas/sdk-v1.js.map +1 -0
  125. package/dist/api-schemas/segmentation.d.ts +75 -0
  126. package/dist/api-schemas/segmentation.d.ts.map +1 -0
  127. package/dist/api-schemas/segmentation.js +54 -0
  128. package/dist/api-schemas/segmentation.js.map +1 -0
  129. package/dist/api-schemas/settings.d.ts +159 -0
  130. package/dist/api-schemas/settings.d.ts.map +1 -1
  131. package/dist/api-schemas/settings.js +70 -0
  132. package/dist/api-schemas/settings.js.map +1 -1
  133. package/dist/api-schemas/sketch.d.ts +847 -0
  134. package/dist/api-schemas/sketch.d.ts.map +1 -0
  135. package/dist/api-schemas/sketch.js +544 -0
  136. package/dist/api-schemas/sketch.js.map +1 -0
  137. package/dist/api-schemas/skills.d.ts +27 -14
  138. package/dist/api-schemas/skills.d.ts.map +1 -1
  139. package/dist/api-schemas/skills.js +64 -11
  140. package/dist/api-schemas/skills.js.map +1 -1
  141. package/dist/api-schemas/storage.d.ts +8 -0
  142. package/dist/api-schemas/storage.d.ts.map +1 -1
  143. package/dist/api-schemas/storage.js +7 -0
  144. package/dist/api-schemas/storage.js.map +1 -1
  145. package/dist/api-schemas/storyboards.d.ts +7026 -0
  146. package/dist/api-schemas/storyboards.d.ts.map +1 -0
  147. package/dist/api-schemas/storyboards.js +393 -0
  148. package/dist/api-schemas/storyboards.js.map +1 -0
  149. package/dist/api-schemas/threads.d.ts +12 -4
  150. package/dist/api-schemas/threads.d.ts.map +1 -1
  151. package/dist/api-schemas/threads.js +12 -4
  152. package/dist/api-schemas/threads.js.map +1 -1
  153. package/dist/api-schemas/timeline-tool-contracts.d.ts +1650 -0
  154. package/dist/api-schemas/timeline-tool-contracts.d.ts.map +1 -0
  155. package/dist/api-schemas/timeline-tool-contracts.js +725 -0
  156. package/dist/api-schemas/timeline-tool-contracts.js.map +1 -0
  157. package/dist/api-schemas/timeline-tool-params.d.ts +1237 -0
  158. package/dist/api-schemas/timeline-tool-params.d.ts.map +1 -0
  159. package/dist/api-schemas/timeline-tool-params.js +1518 -0
  160. package/dist/api-schemas/timeline-tool-params.js.map +1 -0
  161. package/dist/api-schemas/timeline.d.ts +12803 -0
  162. package/dist/api-schemas/timeline.d.ts.map +1 -0
  163. package/dist/api-schemas/timeline.js +1838 -0
  164. package/dist/api-schemas/timeline.js.map +1 -0
  165. package/dist/api-schemas/ui-tool-contract.d.ts +35 -0
  166. package/dist/api-schemas/ui-tool-contract.d.ts.map +1 -0
  167. package/dist/api-schemas/ui-tool-contract.js +31 -0
  168. package/dist/api-schemas/ui-tool-contract.js.map +1 -0
  169. package/dist/api-schemas/workflows.d.ts +852 -18
  170. package/dist/api-schemas/workflows.d.ts.map +1 -1
  171. package/dist/api-schemas/workflows.js +484 -6
  172. package/dist/api-schemas/workflows.js.map +1 -1
  173. package/dist/api-schemas/workspace.d.ts +45 -0
  174. package/dist/api-schemas/workspace.d.ts.map +1 -1
  175. package/dist/api-schemas/workspace.js +47 -1
  176. package/dist/api-schemas/workspace.js.map +1 -1
  177. package/dist/api-types.d.ts +621 -27
  178. package/dist/api-types.d.ts.map +1 -1
  179. package/dist/api-types.js +246 -1
  180. package/dist/api-types.js.map +1 -1
  181. package/dist/app-deployment.d.ts +37 -0
  182. package/dist/app-deployment.d.ts.map +1 -0
  183. package/dist/app-deployment.js +42 -0
  184. package/dist/app-deployment.js.map +1 -0
  185. package/dist/asset-generation.d.ts +58 -0
  186. package/dist/asset-generation.d.ts.map +1 -0
  187. package/dist/asset-generation.js +147 -0
  188. package/dist/asset-generation.js.map +1 -0
  189. package/dist/blend-modes.d.ts +20 -0
  190. package/dist/blend-modes.d.ts.map +1 -0
  191. package/dist/blend-modes.js +33 -0
  192. package/dist/blend-modes.js.map +1 -0
  193. package/dist/bridge-frames.d.ts +654 -0
  194. package/dist/bridge-frames.d.ts.map +1 -0
  195. package/dist/bridge-frames.js +448 -0
  196. package/dist/bridge-frames.js.map +1 -0
  197. package/dist/bridge-frames.schema.json +862 -0
  198. package/dist/bridge-protocol.d.ts +57 -20
  199. package/dist/bridge-protocol.d.ts.map +1 -1
  200. package/dist/bridge-protocol.js +57 -20
  201. package/dist/bridge-protocol.js.map +1 -1
  202. package/dist/builtin-packs.d.ts +45 -0
  203. package/dist/builtin-packs.d.ts.map +1 -0
  204. package/dist/builtin-packs.js +115 -0
  205. package/dist/builtin-packs.js.map +1 -0
  206. package/dist/caption-word.d.ts +15 -0
  207. package/dist/caption-word.d.ts.map +1 -0
  208. package/dist/caption-word.js +10 -0
  209. package/dist/caption-word.js.map +1 -0
  210. package/dist/cloud-profile.d.ts +187 -0
  211. package/dist/cloud-profile.d.ts.map +1 -0
  212. package/dist/cloud-profile.js +281 -0
  213. package/dist/cloud-profile.js.map +1 -0
  214. package/dist/creative.d.ts +486 -0
  215. package/dist/creative.d.ts.map +1 -0
  216. package/dist/creative.js +269 -0
  217. package/dist/creative.js.map +1 -0
  218. package/dist/custom-providers.d.ts +70 -0
  219. package/dist/custom-providers.d.ts.map +1 -0
  220. package/dist/custom-providers.js +125 -0
  221. package/dist/custom-providers.js.map +1 -0
  222. package/dist/document-ops.d.ts +15 -0
  223. package/dist/document-ops.d.ts.map +1 -0
  224. package/dist/document-ops.js +2 -0
  225. package/dist/document-ops.js.map +1 -0
  226. package/dist/game-assets.d.ts +344 -0
  227. package/dist/game-assets.d.ts.map +1 -0
  228. package/dist/game-assets.js +297 -0
  229. package/dist/game-assets.js.map +1 -0
  230. package/dist/game-design.d.ts +90 -0
  231. package/dist/game-design.d.ts.map +1 -0
  232. package/dist/game-design.js +417 -0
  233. package/dist/game-design.js.map +1 -0
  234. package/dist/game-flow-prompt.d.ts +68 -0
  235. package/dist/game-flow-prompt.d.ts.map +1 -0
  236. package/dist/game-flow-prompt.js +121 -0
  237. package/dist/game-flow-prompt.js.map +1 -0
  238. package/dist/game-graph.d.ts +96 -0
  239. package/dist/game-graph.d.ts.map +1 -0
  240. package/dist/game-graph.js +481 -0
  241. package/dist/game-graph.js.map +1 -0
  242. package/dist/game-migration.d.ts +4 -0
  243. package/dist/game-migration.d.ts.map +1 -0
  244. package/dist/game-migration.js +6 -0
  245. package/dist/game-migration.js.map +1 -0
  246. package/dist/game-slot-prompt.d.ts +90 -0
  247. package/dist/game-slot-prompt.d.ts.map +1 -0
  248. package/dist/game-slot-prompt.js +237 -0
  249. package/dist/game-slot-prompt.js.map +1 -0
  250. package/dist/game.d.ts +1663 -0
  251. package/dist/game.d.ts.map +1 -0
  252. package/dist/game.js +228 -0
  253. package/dist/game.js.map +1 -0
  254. package/dist/graph.d.ts +191 -5
  255. package/dist/graph.d.ts.map +1 -1
  256. package/dist/graph.js +497 -0
  257. package/dist/graph.js.map +1 -1
  258. package/dist/index.d.ts +47 -2
  259. package/dist/index.d.ts.map +1 -1
  260. package/dist/index.js +46 -2
  261. package/dist/index.js.map +1 -1
  262. package/dist/loop.d.ts +38 -0
  263. package/dist/loop.d.ts.map +1 -0
  264. package/dist/loop.js +69 -0
  265. package/dist/loop.js.map +1 -0
  266. package/dist/mcp-server-config.d.ts +113 -0
  267. package/dist/mcp-server-config.d.ts.map +1 -0
  268. package/dist/mcp-server-config.js +147 -0
  269. package/dist/mcp-server-config.js.map +1 -0
  270. package/dist/messages.d.ts +1565 -243
  271. package/dist/messages.d.ts.map +1 -1
  272. package/dist/messages.js +709 -22
  273. package/dist/messages.js.map +1 -1
  274. package/dist/model-selection.d.ts +20 -0
  275. package/dist/model-selection.d.ts.map +1 -0
  276. package/dist/model-selection.js +27 -0
  277. package/dist/model-selection.js.map +1 -0
  278. package/dist/nodetool-models.d.ts +71 -0
  279. package/dist/nodetool-models.d.ts.map +1 -0
  280. package/dist/nodetool-models.js +138 -0
  281. package/dist/nodetool-models.js.map +1 -0
  282. package/dist/package-assets.d.ts +39 -0
  283. package/dist/package-assets.d.ts.map +1 -0
  284. package/dist/package-assets.js +63 -0
  285. package/dist/package-assets.js.map +1 -0
  286. package/dist/platform.d.ts +66 -0
  287. package/dist/platform.d.ts.map +1 -0
  288. package/dist/platform.js +68 -0
  289. package/dist/platform.js.map +1 -0
  290. package/dist/predicates.d.ts +43 -0
  291. package/dist/predicates.d.ts.map +1 -0
  292. package/dist/predicates.js +65 -0
  293. package/dist/predicates.js.map +1 -0
  294. package/dist/processing-messages.schema.json +2525 -0
  295. package/dist/production-authoring.d.ts +757 -0
  296. package/dist/production-authoring.d.ts.map +1 -0
  297. package/dist/production-authoring.js +736 -0
  298. package/dist/production-authoring.js.map +1 -0
  299. package/dist/render-record.d.ts +86 -0
  300. package/dist/render-record.d.ts.map +1 -0
  301. package/dist/render-record.js +133 -0
  302. package/dist/render-record.js.map +1 -0
  303. package/dist/resource-id.d.ts +22 -0
  304. package/dist/resource-id.d.ts.map +1 -0
  305. package/dist/resource-id.js +32 -0
  306. package/dist/resource-id.js.map +1 -0
  307. package/dist/resource-uri.d.ts +15 -0
  308. package/dist/resource-uri.d.ts.map +1 -0
  309. package/dist/resource-uri.js +88 -0
  310. package/dist/resource-uri.js.map +1 -0
  311. package/dist/sandbox-capability.d.ts +86 -0
  312. package/dist/sandbox-capability.d.ts.map +1 -0
  313. package/dist/sandbox-capability.js +106 -0
  314. package/dist/sandbox-capability.js.map +1 -0
  315. package/dist/sandbox-host.d.ts +98 -0
  316. package/dist/sandbox-host.d.ts.map +1 -0
  317. package/dist/sandbox-host.js +311 -0
  318. package/dist/sandbox-host.js.map +1 -0
  319. package/dist/sandbox-package.d.ts +674 -0
  320. package/dist/sandbox-package.d.ts.map +1 -0
  321. package/dist/sandbox-package.js +622 -0
  322. package/dist/sandbox-package.js.map +1 -0
  323. package/dist/sandbox-wasm.d.ts +84 -0
  324. package/dist/sandbox-wasm.d.ts.map +1 -0
  325. package/dist/sandbox-wasm.js +139 -0
  326. package/dist/sandbox-wasm.js.map +1 -0
  327. package/dist/screenplay-authoring.d.ts +69 -0
  328. package/dist/screenplay-authoring.d.ts.map +1 -0
  329. package/dist/screenplay-authoring.js +351 -0
  330. package/dist/screenplay-authoring.js.map +1 -0
  331. package/dist/script-authoring.d.ts +161 -0
  332. package/dist/script-authoring.d.ts.map +1 -0
  333. package/dist/script-authoring.js +503 -0
  334. package/dist/script-authoring.js.map +1 -0
  335. package/dist/script-fill.d.ts +39 -0
  336. package/dist/script-fill.d.ts.map +1 -0
  337. package/dist/script-fill.js +67 -0
  338. package/dist/script-fill.js.map +1 -0
  339. package/dist/script-link.d.ts +110 -0
  340. package/dist/script-link.d.ts.map +1 -0
  341. package/dist/script-link.js +252 -0
  342. package/dist/script-link.js.map +1 -0
  343. package/dist/sha256.d.ts +11 -0
  344. package/dist/sha256.d.ts.map +1 -0
  345. package/dist/sha256.js +110 -0
  346. package/dist/sha256.js.map +1 -0
  347. package/dist/shot-prompt.d.ts +78 -0
  348. package/dist/shot-prompt.d.ts.map +1 -0
  349. package/dist/shot-prompt.js +120 -0
  350. package/dist/shot-prompt.js.map +1 -0
  351. package/dist/skill-document.d.ts +36 -0
  352. package/dist/skill-document.d.ts.map +1 -0
  353. package/dist/skill-document.js +137 -0
  354. package/dist/skill-document.js.map +1 -0
  355. package/dist/style-presets.d.ts +73 -0
  356. package/dist/style-presets.d.ts.map +1 -0
  357. package/dist/style-presets.js +147 -0
  358. package/dist/style-presets.js.map +1 -0
  359. package/dist/supervisor.d.ts +227 -0
  360. package/dist/supervisor.d.ts.map +1 -0
  361. package/dist/supervisor.js +116 -0
  362. package/dist/supervisor.js.map +1 -0
  363. package/dist/token-providers.d.ts +31 -0
  364. package/dist/token-providers.d.ts.map +1 -0
  365. package/dist/token-providers.js +52 -0
  366. package/dist/token-providers.js.map +1 -0
  367. package/dist/toolSchemas.d.ts +10 -14
  368. package/dist/toolSchemas.d.ts.map +1 -1
  369. package/dist/toolSchemas.js +13 -23
  370. package/dist/toolSchemas.js.map +1 -1
  371. package/dist/triggers.d.ts +41 -0
  372. package/dist/triggers.d.ts.map +1 -0
  373. package/dist/triggers.js +50 -0
  374. package/dist/triggers.js.map +1 -0
  375. package/dist/trpc-policy.d.ts +3 -0
  376. package/dist/trpc-policy.d.ts.map +1 -0
  377. package/dist/trpc-policy.js +3 -0
  378. package/dist/trpc-policy.js.map +1 -0
  379. package/dist/type-metadata.d.ts +5 -0
  380. package/dist/type-metadata.d.ts.map +1 -1
  381. package/dist/type-metadata.js +17 -8
  382. package/dist/type-metadata.js.map +1 -1
  383. package/dist/typecheck.d.ts.map +1 -1
  384. package/dist/typecheck.js +5 -4
  385. package/dist/typecheck.js.map +1 -1
  386. package/dist/wasm-binary.d.ts +61 -0
  387. package/dist/wasm-binary.d.ts.map +1 -0
  388. package/dist/wasm-binary.js +215 -0
  389. package/dist/wasm-binary.js.map +1 -0
  390. package/dist/workflow-plan.d.ts +197 -0
  391. package/dist/workflow-plan.d.ts.map +1 -0
  392. package/dist/workflow-plan.js +438 -0
  393. package/dist/workflow-plan.js.map +1 -0
  394. package/dist/wrap-primitives.d.ts +0 -11
  395. package/dist/wrap-primitives.d.ts.map +1 -1
  396. package/dist/wrap-primitives.js +3 -9
  397. package/dist/wrap-primitives.js.map +1 -1
  398. package/dist/ws-commands.d.ts +665 -0
  399. package/dist/ws-commands.d.ts.map +1 -0
  400. package/dist/ws-commands.js +610 -0
  401. package/dist/ws-commands.js.map +1 -0
  402. package/dist/zod-schema.d.ts +20 -0
  403. package/dist/zod-schema.d.ts.map +1 -0
  404. package/dist/zod-schema.js +298 -0
  405. package/dist/zod-schema.js.map +1 -0
  406. package/package.json +84 -7
  407. package/schema/sdk-v1.asyncapi.implemented.json +65 -0
  408. package/schema/sdk-v1.asyncapi.json +65 -0
  409. package/schema/sdk-v1.discovery.schema.json +1218 -0
  410. package/schema/sdk-v1.execution.schema.json +2792 -0
  411. package/schema/sdk-v1.lifecycle.schema.json +1031 -0
  412. package/schema/sdk-v1.manifest.json +71 -0
  413. package/schema/sdk-v1.openapi.implemented.json +730 -0
  414. package/schema/sdk-v1.openapi.json +730 -0
  415. package/schema/sdk-v1.operations.json +732 -0
  416. package/dist/agent-protocol.d.ts +0 -217
  417. package/dist/agent-protocol.d.ts.map +0 -1
  418. package/dist/agent-protocol.js +0 -85
  419. package/dist/agent-protocol.js.map +0 -1
@@ -0,0 +1,84 @@
1
+ /**
2
+ * The scalar call contract for sandbox WASM modules, and the facade generator
3
+ * that expresses it as guest JavaScript.
4
+ *
5
+ * Everything here is pure and browser-safe. It sits in `protocol` because the
6
+ * same answers are needed in three places that must not disagree: `node-sdk`
7
+ * validates a pack's binary and folds the facade into the module digest,
8
+ * `agents` mounts the facade and validates every call, and any host that
9
+ * reports a skipped export quotes the reason from here.
10
+ */
11
+ import type { SandboxWasmContract } from "./sandbox-package.js";
12
+ import { type WasmExportEntry, type WasmSignature } from "./wasm-binary.js";
13
+ /**
14
+ * Budget ceilings for host WASM execution.
15
+ *
16
+ * Each number is both the default and the maximum: a pack manifest may lower
17
+ * any of them, never raise one. `workerPoolSize` is process-wide and is not
18
+ * manifest-configurable at all — it is a property of the host, not of a pack.
19
+ */
20
+ export declare const SANDBOX_WASM_BUDGETS: {
21
+ /** Workers shared by every invocation in the process. */
22
+ readonly workerPoolSize: 4;
23
+ /** Calls one invocation may have in flight at once. */
24
+ readonly callConcurrency: 2;
25
+ /** Calls one invocation may make in total. */
26
+ readonly callsPerInvocation: 256;
27
+ /** Aggregate WASM wall clock one invocation may spend, in milliseconds. */
28
+ readonly wallClockMs: 30000;
29
+ /** Wall clock one call may spend before its worker is killed, in milliseconds. */
30
+ readonly callTimeoutMs: 5000;
31
+ };
32
+ /** Longest parameter list the scalar contract accepts. */
33
+ export declare const SANDBOX_WASM_MAX_ARITY = 8;
34
+ /** Value types the scalar contract accepts, in argument and result position. */
35
+ export declare const SANDBOX_WASM_VALUE_TYPES: readonly number[];
36
+ /**
37
+ * Why an export falls outside the scalar contract, or `undefined` when it does
38
+ * not. The text completes the sentence "export `foo` …", so a caller reads
39
+ * `${specifier}: export ${name} ${reason}`.
40
+ */
41
+ export declare function wasmExportContractViolation(entry: WasmExportEntry | undefined, signature: WasmSignature | undefined): string | undefined;
42
+ /**
43
+ * The facade generator's version.
44
+ *
45
+ * It joins a WASM module's content digest, so a change to the generated guest
46
+ * surface invalidates a workflow's pinned digest the same way a change to the
47
+ * binary does. Bump it whenever {@link generateSandboxWasmFacade} or
48
+ * {@link SANDBOX_WASM_BRIDGE_SOURCE} changes what the guest sees.
49
+ */
50
+ export declare const SANDBOX_WASM_FACADE_VERSION = 1;
51
+ /**
52
+ * The guest-visible name the host parks the dispatcher on.
53
+ *
54
+ * It exists only between the init prelude and the entry module's first
55
+ * statement — long enough for the bridge module to capture it while the static
56
+ * graph evaluates, then deleted. The hiding is convenience; the dispatcher's
57
+ * own checks are the boundary.
58
+ */
59
+ export declare const SANDBOX_WASM_DISPATCH_GLOBAL = "__nodetoolWasmDispatch";
60
+ /**
61
+ * The private bridge module every facade imports.
62
+ *
63
+ * Guest code cannot import it: the loader refuses the specifier from any
64
+ * module that is not a generated facade, and the static analyzer refuses it in
65
+ * authored source.
66
+ */
67
+ export declare const SANDBOX_WASM_BRIDGE_SPECIFIER = "nodetool:wasm-bridge";
68
+ /**
69
+ * The bridge module's source.
70
+ *
71
+ * It reads the dispatcher once, at module-evaluation time — which happens
72
+ * while the entry module's static graph links, before the entry body deletes
73
+ * the binding.
74
+ */
75
+ export declare const SANDBOX_WASM_BRIDGE_SOURCE = "const __dispatch = globalThis.__nodetoolWasmDispatch;\nexport const __call = (moduleKey, exportName, args) => {\n if (typeof __dispatch !== \"function\") {\n throw new Error(\"the sandbox WASM bridge is unavailable in this run\");\n }\n return __dispatch(moduleKey, exportName, args);\n};\n";
76
+ /**
77
+ * Generate the ESM facade for one WASM module.
78
+ *
79
+ * One named async export per manifest export, under the export's JavaScript
80
+ * alias. Nothing else is exposed: no instance, no memory, no way to name a
81
+ * module other than this one.
82
+ */
83
+ export declare function generateSandboxWasmFacade(moduleKey: string, contract: SandboxWasmContract): string;
84
+ //# sourceMappingURL=sandbox-wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-wasm.d.ts","sourceRoot":"","sources":["../src/sandbox-wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;IAC/B,yDAAyD;aACzD,cAAc,EAAE,CAAC;IACjB,uDAAuD;aACvD,eAAe,EAAE,CAAC;IAClB,8CAA8C;aAC9C,kBAAkB,EAAE,GAAG;IACvB,2EAA2E;aAC3E,WAAW,EAAE,KAAM;IACnB,kFAAkF;aAClF,aAAa,EAAE,IAAK;CACZ,CAAC;AAEX,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAIrD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,SAAS,EAAE,aAAa,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAqBpB;AAcD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,2BAA2B,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,6SAOtC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,mBAAmB,GAC5B,MAAM,CAUR"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The scalar call contract for sandbox WASM modules, and the facade generator
3
+ * that expresses it as guest JavaScript.
4
+ *
5
+ * Everything here is pure and browser-safe. It sits in `protocol` because the
6
+ * same answers are needed in three places that must not disagree: `node-sdk`
7
+ * validates a pack's binary and folds the facade into the module digest,
8
+ * `agents` mounts the facade and validates every call, and any host that
9
+ * reports a skipped export quotes the reason from here.
10
+ */
11
+ import { WASM_EXPORT_KIND, WASM_VALUE_TYPE, wasmExportKindName, wasmValueTypeName } from "./wasm-binary.js";
12
+ /**
13
+ * Budget ceilings for host WASM execution.
14
+ *
15
+ * Each number is both the default and the maximum: a pack manifest may lower
16
+ * any of them, never raise one. `workerPoolSize` is process-wide and is not
17
+ * manifest-configurable at all — it is a property of the host, not of a pack.
18
+ */
19
+ export const SANDBOX_WASM_BUDGETS = {
20
+ /** Workers shared by every invocation in the process. */
21
+ workerPoolSize: 4,
22
+ /** Calls one invocation may have in flight at once. */
23
+ callConcurrency: 2,
24
+ /** Calls one invocation may make in total. */
25
+ callsPerInvocation: 256,
26
+ /** Aggregate WASM wall clock one invocation may spend, in milliseconds. */
27
+ wallClockMs: 30_000,
28
+ /** Wall clock one call may spend before its worker is killed, in milliseconds. */
29
+ callTimeoutMs: 5_000
30
+ };
31
+ /** Longest parameter list the scalar contract accepts. */
32
+ export const SANDBOX_WASM_MAX_ARITY = 8;
33
+ /** Value types the scalar contract accepts, in argument and result position. */
34
+ export const SANDBOX_WASM_VALUE_TYPES = [
35
+ WASM_VALUE_TYPE.I32,
36
+ WASM_VALUE_TYPE.F32,
37
+ WASM_VALUE_TYPE.F64
38
+ ];
39
+ /**
40
+ * Why an export falls outside the scalar contract, or `undefined` when it does
41
+ * not. The text completes the sentence "export `foo` …", so a caller reads
42
+ * `${specifier}: export ${name} ${reason}`.
43
+ */
44
+ export function wasmExportContractViolation(entry, signature) {
45
+ if (entry === undefined)
46
+ return "is missing from the binary";
47
+ if (entry.kind !== WASM_EXPORT_KIND.FUNCTION) {
48
+ return `is a ${wasmExportKindName(entry.kind)}, not a function`;
49
+ }
50
+ if (signature === undefined)
51
+ return "has no signature in the binary";
52
+ if (signature.parameters.length > SANDBOX_WASM_MAX_ARITY) {
53
+ return `takes ${signature.parameters.length} parameters, above the ${SANDBOX_WASM_MAX_ARITY} the scalar contract allows`;
54
+ }
55
+ if (signature.results.length > 1) {
56
+ return `returns ${signature.results.length} values (multi-value), and the scalar contract allows at most one`;
57
+ }
58
+ for (const [position, type] of signature.parameters.entries()) {
59
+ const reason = valueTypeViolation(type);
60
+ if (reason !== undefined)
61
+ return `takes parameter ${position} that ${reason}`;
62
+ }
63
+ for (const type of signature.results) {
64
+ const reason = valueTypeViolation(type);
65
+ if (reason !== undefined)
66
+ return `returns a value that ${reason}`;
67
+ }
68
+ return undefined;
69
+ }
70
+ function valueTypeViolation(type) {
71
+ if (SANDBOX_WASM_VALUE_TYPES.includes(type))
72
+ return undefined;
73
+ if (type === WASM_VALUE_TYPE.I64) {
74
+ return "uses i64, which maps to bigint rather than number";
75
+ }
76
+ if (type === WASM_VALUE_TYPE.V128)
77
+ return "uses v128, a vector type";
78
+ if (type === WASM_VALUE_TYPE.FUNCREF || type === WASM_VALUE_TYPE.EXTERNREF) {
79
+ return `uses the reference type ${wasmValueTypeName(type)}`;
80
+ }
81
+ return `uses ${wasmValueTypeName(type)}, which is not i32, f32, or f64`;
82
+ }
83
+ /**
84
+ * The facade generator's version.
85
+ *
86
+ * It joins a WASM module's content digest, so a change to the generated guest
87
+ * surface invalidates a workflow's pinned digest the same way a change to the
88
+ * binary does. Bump it whenever {@link generateSandboxWasmFacade} or
89
+ * {@link SANDBOX_WASM_BRIDGE_SOURCE} changes what the guest sees.
90
+ */
91
+ export const SANDBOX_WASM_FACADE_VERSION = 1;
92
+ /**
93
+ * The guest-visible name the host parks the dispatcher on.
94
+ *
95
+ * It exists only between the init prelude and the entry module's first
96
+ * statement — long enough for the bridge module to capture it while the static
97
+ * graph evaluates, then deleted. The hiding is convenience; the dispatcher's
98
+ * own checks are the boundary.
99
+ */
100
+ export const SANDBOX_WASM_DISPATCH_GLOBAL = "__nodetoolWasmDispatch";
101
+ /**
102
+ * The private bridge module every facade imports.
103
+ *
104
+ * Guest code cannot import it: the loader refuses the specifier from any
105
+ * module that is not a generated facade, and the static analyzer refuses it in
106
+ * authored source.
107
+ */
108
+ export const SANDBOX_WASM_BRIDGE_SPECIFIER = "nodetool:wasm-bridge";
109
+ /**
110
+ * The bridge module's source.
111
+ *
112
+ * It reads the dispatcher once, at module-evaluation time — which happens
113
+ * while the entry module's static graph links, before the entry body deletes
114
+ * the binding.
115
+ */
116
+ export const SANDBOX_WASM_BRIDGE_SOURCE = `const __dispatch = globalThis.${SANDBOX_WASM_DISPATCH_GLOBAL};
117
+ export const __call = (moduleKey, exportName, args) => {
118
+ if (typeof __dispatch !== "function") {
119
+ throw new Error("the sandbox WASM bridge is unavailable in this run");
120
+ }
121
+ return __dispatch(moduleKey, exportName, args);
122
+ };
123
+ `;
124
+ /**
125
+ * Generate the ESM facade for one WASM module.
126
+ *
127
+ * One named async export per manifest export, under the export's JavaScript
128
+ * alias. Nothing else is exposed: no instance, no memory, no way to name a
129
+ * module other than this one.
130
+ */
131
+ export function generateSandboxWasmFacade(moduleKey, contract) {
132
+ const body = contract.exports
133
+ .map((exported) => `export async function ${exported.as}(...args) {\n return __call(${JSON.stringify(moduleKey)}, ${JSON.stringify(exported.as)}, args);\n}`)
134
+ .join("\n");
135
+ return `import { __call } from ${JSON.stringify(SANDBOX_WASM_BRIDGE_SPECIFIER)};
136
+ ${body}
137
+ `;
138
+ }
139
+ //# sourceMappingURL=sandbox-wasm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-wasm.js","sourceRoot":"","sources":["../src/sandbox-wasm.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @nodetool-ai/protocol — Screenplay authoring rules
3
+ *
4
+ * What a Director asks a model for, and how its answer becomes a typed
5
+ * {@link Screenplay}: the system prompt, the brief-to-prompt shaping, the JSON
6
+ * schema the structured call is forced into, the parse that assigns ids and
7
+ * clamps the shot list, and the deterministic fallback.
8
+ *
9
+ * Pure, and shared: the `nodetool.creative.Director` node and the storyboard's
10
+ * own direct `generate_text` request both author through this, so a screenplay
11
+ * does not depend on which surface asked for it.
12
+ */
13
+ import type { Screenplay } from "./creative.js";
14
+ export declare const DIRECTOR_SYSTEM_PROMPT: string;
15
+ /** The tool a structured screenplay call is forced into. */
16
+ export declare const SCREENPLAY_TOOL_NAME = "screenplay";
17
+ export declare const SCREENPLAY_TOOL_DESCRIPTION = "Submit the finished screenplay with exactly the requested number of shots.";
18
+ /** Clamp a requested shot count to what the Director accepts (1–20). */
19
+ export declare function clampShotCount(value: unknown): number;
20
+ /**
21
+ * Coerce raw model output (a parsed object, a JSON string, or a fenced ```json
22
+ * block) into a validated {@link Screenplay}: assign ids, default missing
23
+ * fields, clamp the shot list to `shotCount`, and stamp every shot with
24
+ * `status: "planned"` and a sequential `index`.
25
+ */
26
+ export declare function parseScreenplay(raw: unknown, opts: {
27
+ shotCount: number;
28
+ title?: string;
29
+ aspectRatio?: string;
30
+ genre?: string;
31
+ }): Screenplay;
32
+ /**
33
+ * Deterministic screenplay used when the model returns no usable screenplay
34
+ * tool call (e.g. providers without tool support and the fake e2e provider).
35
+ * Mirrors DataGenerator's synthetic-rows fallback: the pipeline keeps flowing
36
+ * with placeholder shots derived from the brief instead of failing the run.
37
+ * Real provider errors still throw — this only covers an empty/unusable result.
38
+ */
39
+ export declare function fallbackScreenplay(opts: {
40
+ brief: string;
41
+ style: string;
42
+ shotCount: number;
43
+ aspectRatio: string;
44
+ }): Screenplay;
45
+ /** Coerce any screenplay-shaped input to a {@link Screenplay}, keeping its shots. */
46
+ export declare function toScreenplay(raw: unknown): Screenplay;
47
+ /**
48
+ * The JSON schema the screenplay tool call is validated against.
49
+ *
50
+ * The shot count is contracted, so `shots` is pinned to it. No scene count is,
51
+ * so `scenes` only has to be non-empty — how many scenes a brief wants is the
52
+ * director's call.
53
+ *
54
+ * One rule this cannot carry: that every `shot.scene_id` names a returned
55
+ * scene. JSON Schema has no cross-reference between sibling arrays, and the
56
+ * `$data` extension that would come closest is not accepted by the providers'
57
+ * structured-output validators. {@link parseScreenplay} enforces it instead.
58
+ */
59
+ export declare function buildScreenplaySchema(shotCount: number): Record<string, unknown>;
60
+ /**
61
+ * The user turn: the brief, the genre, the style, and what the shot list must
62
+ * contain.
63
+ *
64
+ * `genre` is a trailing optional argument rather than an options object because
65
+ * both call sites — the Director node and the storyboard's direct
66
+ * `generate_text` request — pass positionally and are owned elsewhere.
67
+ */
68
+ export declare function buildDirectorPrompt(brief: string, style: string, shotCount: number, aspectRatio: string, genre?: string): string;
69
+ //# sourceMappingURL=screenplay-authoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screenplay-authoring.d.ts","sourceRoot":"","sources":["../src/screenplay-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAA0B,UAAU,EAAQ,MAAM,eAAe,CAAC;AAG9E,eAAO,MAAM,sBAAsB,QAQxB,CAAC;AAEZ,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,2BAA2B,+EACsC,CAAC;AAyI/E,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,UAAU,CAgCZ;AAKD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,UAAU,CAkCb;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAIrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0DzB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAYR"}
@@ -0,0 +1,351 @@
1
+ /**
2
+ * @nodetool-ai/protocol — Screenplay authoring rules
3
+ *
4
+ * What a Director asks a model for, and how its answer becomes a typed
5
+ * {@link Screenplay}: the system prompt, the brief-to-prompt shaping, the JSON
6
+ * schema the structured call is forced into, the parse that assigns ids and
7
+ * clamps the shot list, and the deterministic fallback.
8
+ *
9
+ * Pure, and shared: the `nodetool.creative.Director` node and the storyboard's
10
+ * own direct `generate_text` request both author through this, so a screenplay
11
+ * does not depend on which surface asked for it.
12
+ */
13
+ import { isNumber, isRecord, isString } from "./predicates.js";
14
+ export const DIRECTOR_SYSTEM_PROMPT = [
15
+ "You are a film director. Turn the user's brief into a structured screenplay.",
16
+ "Break the piece into scenes. Give each a slugline in screenplay form",
17
+ "(INT./EXT. LOCATION — TIME) and a lighting note that holds for every shot in",
18
+ "it. Then write the shots, each with a concrete visual action, camera",
19
+ "direction, and the scene_id of exactly one scene you returned. Shots of the",
20
+ "same scene must be consecutive. Apply one consistent style across every",
21
+ "shot. Call the screenplay tool exactly once with the result."
22
+ ].join(" ");
23
+ /** The tool a structured screenplay call is forced into. */
24
+ export const SCREENPLAY_TOOL_NAME = "screenplay";
25
+ export const SCREENPLAY_TOOL_DESCRIPTION = "Submit the finished screenplay with exactly the requested number of shots.";
26
+ const str = (value) => (isString(value) ? value : "");
27
+ const optionalStr = (value) => {
28
+ const s = str(value).trim();
29
+ return s.length > 0 ? s : undefined;
30
+ };
31
+ const optionalNumber = (value) => {
32
+ const n = isNumber(value) ? value : Number(value);
33
+ return Number.isFinite(n) ? n : undefined;
34
+ };
35
+ /** Strip a leading/trailing ```json … ``` fence, if present. */
36
+ function stripFences(text) {
37
+ const trimmed = text.trim();
38
+ const match = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);
39
+ return match ? match[1].trim() : trimmed;
40
+ }
41
+ /** Coerce a parsed object, a JSON string, or a fenced JSON block to a record. */
42
+ function coerceObject(raw) {
43
+ if (isRecord(raw)) {
44
+ return raw;
45
+ }
46
+ if (isString(raw)) {
47
+ try {
48
+ const parsed = JSON.parse(stripFences(raw));
49
+ if (isRecord(parsed)) {
50
+ return parsed;
51
+ }
52
+ }
53
+ catch {
54
+ // Not valid JSON — fall through to an empty record.
55
+ }
56
+ }
57
+ return {};
58
+ }
59
+ function coerceCamera(raw) {
60
+ if (!isRecord(raw))
61
+ return undefined;
62
+ const camera = {};
63
+ const framing = optionalStr(raw.framing);
64
+ const lens = optionalStr(raw.lens);
65
+ const angle = optionalStr(raw.angle);
66
+ const movement = optionalStr(raw.movement);
67
+ const equipment = optionalStr(raw.equipment);
68
+ if (framing)
69
+ camera.framing = framing;
70
+ if (lens)
71
+ camera.lens = lens;
72
+ if (angle)
73
+ camera.angle = angle;
74
+ if (movement)
75
+ camera.movement = movement;
76
+ if (equipment)
77
+ camera.equipment = equipment;
78
+ return Object.keys(camera).length > 0 ? camera : undefined;
79
+ }
80
+ function coerceShot(raw, index) {
81
+ const obj = isRecord(raw) ? raw : {};
82
+ const shot = {
83
+ type: "shot",
84
+ id: `shot-${index}`,
85
+ index,
86
+ action: str(obj.action),
87
+ status: "planned"
88
+ };
89
+ const slug = optionalStr(obj.slug);
90
+ if (slug)
91
+ shot.slug = slug;
92
+ // The model's own scene id. parseScreenplay rewrites it to the assigned
93
+ // `scene-N`; nothing else calls coerceShot with a foreign id.
94
+ const sceneId = optionalStr(obj.scene_id);
95
+ if (sceneId)
96
+ shot.scene_id = sceneId;
97
+ const camera = coerceCamera(obj.camera);
98
+ if (camera)
99
+ shot.camera = camera;
100
+ const motion = optionalStr(obj.motion);
101
+ if (motion)
102
+ shot.motion = motion;
103
+ const dialogue = optionalStr(obj.dialogue);
104
+ if (dialogue)
105
+ shot.dialogue = dialogue;
106
+ const narration = optionalStr(obj.narration);
107
+ if (narration)
108
+ shot.narration = narration;
109
+ const duration = optionalNumber(obj.duration_seconds);
110
+ if (duration !== undefined)
111
+ shot.duration_seconds = duration;
112
+ return shot;
113
+ }
114
+ /**
115
+ * Coerce the returned scene list, assigning `scene-N` ids the way shots get
116
+ * `shot-N`, and report where each model-supplied id landed so the shots can be
117
+ * remapped onto it. Model ids never reach a stored document.
118
+ */
119
+ function coerceScenes(raw) {
120
+ const assigned = new Map();
121
+ if (!Array.isArray(raw))
122
+ return { scenes: [], assigned };
123
+ const scenes = raw.map((entry, index) => {
124
+ const obj = isRecord(entry) ? entry : {};
125
+ const id = `scene-${index}`;
126
+ const modelId = optionalStr(obj.id);
127
+ // First writer wins, so two scenes sharing one id cannot steal each
128
+ // other's shots.
129
+ if (modelId && !assigned.has(modelId))
130
+ assigned.set(modelId, id);
131
+ const scene = { type: "scene", id, slugline: str(obj.slugline) };
132
+ const lighting = optionalStr(obj.lighting);
133
+ if (lighting)
134
+ scene.lighting = lighting;
135
+ return scene;
136
+ });
137
+ return { scenes, assigned };
138
+ }
139
+ /**
140
+ * Rewrite each shot's model-supplied `scene_id` to the assigned `scene-N`.
141
+ *
142
+ * A shot naming a scene that was not returned inherits the scene of the shot
143
+ * before it (the first shot falls to the first returned scene) instead of
144
+ * losing its id. § 7.7.3 requires the shots of a scene to be contiguous in
145
+ * `index`: extending the run above keeps that, where an unscened shot in the
146
+ * middle would split its scene in two. With no scenes returned at all there is
147
+ * nothing to name, so the id is dropped and the shots read as legacy.
148
+ */
149
+ function resolveSceneIds(shots, scenes, assigned) {
150
+ let previous = scenes[0]?.id;
151
+ for (const shot of shots) {
152
+ const mapped = shot.scene_id ? assigned.get(shot.scene_id) : undefined;
153
+ const resolved = mapped ?? previous;
154
+ if (resolved) {
155
+ shot.scene_id = resolved;
156
+ previous = resolved;
157
+ }
158
+ else {
159
+ delete shot.scene_id;
160
+ }
161
+ }
162
+ }
163
+ /** Clamp a requested shot count to what the Director accepts (1–20). */
164
+ export function clampShotCount(value) {
165
+ const n = Math.floor(Number(value));
166
+ if (!Number.isFinite(n))
167
+ return 5;
168
+ return Math.max(1, Math.min(20, n));
169
+ }
170
+ /**
171
+ * Coerce raw model output (a parsed object, a JSON string, or a fenced ```json
172
+ * block) into a validated {@link Screenplay}: assign ids, default missing
173
+ * fields, clamp the shot list to `shotCount`, and stamp every shot with
174
+ * `status: "planned"` and a sequential `index`.
175
+ */
176
+ export function parseScreenplay(raw, opts) {
177
+ const obj = coerceObject(raw);
178
+ const shotCount = Math.max(0, Math.floor(opts.shotCount));
179
+ const rawShots = Array.isArray(obj.shots) ? obj.shots : [];
180
+ const shots = rawShots
181
+ .slice(0, shotCount)
182
+ .map((rawShot, i) => coerceShot(rawShot, i));
183
+ const { scenes, assigned } = coerceScenes(obj.scenes);
184
+ resolveSceneIds(shots, scenes, assigned);
185
+ const screenplay = {
186
+ type: "screenplay",
187
+ id: "screenplay-1",
188
+ title: optionalStr(obj.title) ?? opts.title ?? "Untitled Screenplay",
189
+ aspect_ratio: optionalStr(obj.aspect_ratio) ?? opts.aspectRatio ?? "16:9",
190
+ shots
191
+ };
192
+ const logline = optionalStr(obj.logline);
193
+ if (logline)
194
+ screenplay.logline = logline;
195
+ const styleBible = optionalStr(obj.style_bible);
196
+ if (styleBible)
197
+ screenplay.style_bible = styleBible;
198
+ const narration = optionalStr(obj.narration);
199
+ if (narration)
200
+ screenplay.narration = narration;
201
+ const musicPrompt = optionalStr(obj.music_prompt);
202
+ if (musicPrompt)
203
+ screenplay.music_prompt = musicPrompt;
204
+ // Genre is an input, so the caller's value stands unless the payload already
205
+ // carries one — which is the round-trip case (toScreenplay on a stored
206
+ // screenplay), not a Director answer.
207
+ const genre = optionalStr(obj.genre) ?? optionalStr(opts.genre);
208
+ if (genre)
209
+ screenplay.genre = genre;
210
+ if (scenes.length > 0)
211
+ screenplay.scenes = scenes;
212
+ return screenplay;
213
+ }
214
+ const FALLBACK_FRAMINGS = ["establishing wide", "medium", "close-up"];
215
+ const FALLBACK_SCENE_ID = "scene-0";
216
+ /**
217
+ * Deterministic screenplay used when the model returns no usable screenplay
218
+ * tool call (e.g. providers without tool support and the fake e2e provider).
219
+ * Mirrors DataGenerator's synthetic-rows fallback: the pipeline keeps flowing
220
+ * with placeholder shots derived from the brief instead of failing the run.
221
+ * Real provider errors still throw — this only covers an empty/unusable result.
222
+ */
223
+ export function fallbackScreenplay(opts) {
224
+ const brief = opts.brief.trim() || "Untitled film";
225
+ const style = opts.style.trim();
226
+ const shotCount = Math.max(1, Math.floor(opts.shotCount));
227
+ const shots = Array.from({ length: shotCount }, (_, i) => coerceShot({
228
+ slug: `Shot ${i + 1}`,
229
+ action: `${brief} — beat ${i + 1} of ${shotCount}`,
230
+ camera: { framing: FALLBACK_FRAMINGS[i % FALLBACK_FRAMINGS.length] },
231
+ motion: "slow push in",
232
+ scene_id: FALLBACK_SCENE_ID
233
+ }, i));
234
+ const title = brief.length > 60 ? `${brief.slice(0, 60)}…` : brief;
235
+ const screenplay = {
236
+ type: "screenplay",
237
+ id: "screenplay-1",
238
+ title,
239
+ aspect_ratio: opts.aspectRatio,
240
+ shots,
241
+ // One scene holding every shot, so the deterministic path satisfies the
242
+ // same contract as a parsed answer. The brief names no location, so the
243
+ // slugline names the piece rather than inventing an INT./EXT. line.
244
+ scenes: [{ type: "scene", id: FALLBACK_SCENE_ID, slugline: title }],
245
+ narration: brief
246
+ };
247
+ if (style) {
248
+ screenplay.style_bible = style;
249
+ screenplay.music_prompt = `instrumental score to match: ${style}`;
250
+ }
251
+ return screenplay;
252
+ }
253
+ /** Coerce any screenplay-shaped input to a {@link Screenplay}, keeping its shots. */
254
+ export function toScreenplay(raw) {
255
+ const obj = coerceObject(raw);
256
+ const shotCount = Array.isArray(obj.shots) ? obj.shots.length : 0;
257
+ return parseScreenplay(obj, { shotCount });
258
+ }
259
+ /**
260
+ * The JSON schema the screenplay tool call is validated against.
261
+ *
262
+ * The shot count is contracted, so `shots` is pinned to it. No scene count is,
263
+ * so `scenes` only has to be non-empty — how many scenes a brief wants is the
264
+ * director's call.
265
+ *
266
+ * One rule this cannot carry: that every `shot.scene_id` names a returned
267
+ * scene. JSON Schema has no cross-reference between sibling arrays, and the
268
+ * `$data` extension that would come closest is not accepted by the providers'
269
+ * structured-output validators. {@link parseScreenplay} enforces it instead.
270
+ */
271
+ export function buildScreenplaySchema(shotCount) {
272
+ return {
273
+ type: "object",
274
+ additionalProperties: false,
275
+ required: ["title", "scenes", "shots"],
276
+ properties: {
277
+ title: { type: "string" },
278
+ logline: { type: "string" },
279
+ style_bible: { type: "string" },
280
+ aspect_ratio: { type: "string" },
281
+ narration: { type: "string" },
282
+ music_prompt: { type: "string" },
283
+ scenes: {
284
+ type: "array",
285
+ minItems: 1,
286
+ items: {
287
+ type: "object",
288
+ additionalProperties: false,
289
+ required: ["id", "slugline"],
290
+ properties: {
291
+ id: { type: "string" },
292
+ slugline: { type: "string" },
293
+ lighting: { type: "string" }
294
+ }
295
+ }
296
+ },
297
+ shots: {
298
+ type: "array",
299
+ minItems: shotCount,
300
+ maxItems: shotCount,
301
+ items: {
302
+ type: "object",
303
+ additionalProperties: false,
304
+ required: ["scene_id", "action"],
305
+ properties: {
306
+ scene_id: { type: "string" },
307
+ slug: { type: "string" },
308
+ action: { type: "string" },
309
+ motion: { type: "string" },
310
+ dialogue: { type: "string" },
311
+ narration: { type: "string" },
312
+ duration_seconds: { type: "number" },
313
+ camera: {
314
+ type: "object",
315
+ additionalProperties: false,
316
+ properties: {
317
+ framing: { type: "string" },
318
+ lens: { type: "string" },
319
+ angle: { type: "string" },
320
+ movement: { type: "string" },
321
+ equipment: { type: "string" }
322
+ }
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
328
+ };
329
+ }
330
+ /**
331
+ * The user turn: the brief, the genre, the style, and what the shot list must
332
+ * contain.
333
+ *
334
+ * `genre` is a trailing optional argument rather than an options object because
335
+ * both call sites — the Director node and the storyboard's direct
336
+ * `generate_text` request — pass positionally and are owned elsewhere.
337
+ */
338
+ export function buildDirectorPrompt(brief, style, shotCount, aspectRatio, genre) {
339
+ const lines = [
340
+ `Brief:\n${brief}`,
341
+ genre?.trim()
342
+ ? `Genre:\n${genre.trim()} — let its tone, pacing and framing carry the piece.`
343
+ : "",
344
+ style.trim() ? `Style:\n${style}` : "",
345
+ `Produce exactly ${shotCount} shots for a ${aspectRatio} piece.`,
346
+ "Group them into scenes. Give each scene an id, a slugline and a lighting note, and give every shot the scene_id of the one scene it belongs to.",
347
+ "Give each shot a concrete visual action and camera direction, and set a style_bible describing the palette, light, lens, and texture applied to all shots."
348
+ ];
349
+ return lines.filter((line) => line.length > 0).join("\n\n");
350
+ }
351
+ //# sourceMappingURL=screenplay-authoring.js.map