nitrostack 1.0.72 → 1.0.74

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 (370) hide show
  1. package/dist/auth/__tests__/api-key.test.d.ts +2 -0
  2. package/dist/auth/__tests__/api-key.test.d.ts.map +1 -0
  3. package/dist/auth/__tests__/api-key.test.js +136 -0
  4. package/dist/auth/__tests__/api-key.test.js.map +1 -0
  5. package/dist/auth/__tests__/middleware.test.d.ts +2 -0
  6. package/dist/auth/__tests__/middleware.test.d.ts.map +1 -0
  7. package/dist/auth/__tests__/middleware.test.js +186 -0
  8. package/dist/auth/__tests__/middleware.test.js.map +1 -0
  9. package/dist/auth/__tests__/pkce.test.d.ts +2 -0
  10. package/dist/auth/__tests__/pkce.test.d.ts.map +1 -0
  11. package/dist/auth/__tests__/pkce.test.js +61 -0
  12. package/dist/auth/__tests__/pkce.test.js.map +1 -0
  13. package/dist/auth/__tests__/secure-secret.test.d.ts +2 -0
  14. package/dist/auth/__tests__/secure-secret.test.d.ts.map +1 -0
  15. package/dist/auth/__tests__/secure-secret.test.js +42 -0
  16. package/dist/auth/__tests__/secure-secret.test.js.map +1 -0
  17. package/dist/auth/__tests__/simple-jwt.test.d.ts +2 -0
  18. package/dist/auth/__tests__/simple-jwt.test.d.ts.map +1 -0
  19. package/dist/auth/__tests__/simple-jwt.test.js +68 -0
  20. package/dist/auth/__tests__/simple-jwt.test.js.map +1 -0
  21. package/dist/auth/__tests__/token-store.test.d.ts +2 -0
  22. package/dist/auth/__tests__/token-store.test.d.ts.map +1 -0
  23. package/dist/auth/__tests__/token-store.test.js +79 -0
  24. package/dist/auth/__tests__/token-store.test.js.map +1 -0
  25. package/dist/auth/__tests__/token-validation.test.d.ts +2 -0
  26. package/dist/auth/__tests__/token-validation.test.d.ts.map +1 -0
  27. package/dist/auth/__tests__/token-validation.test.js +23 -0
  28. package/dist/auth/__tests__/token-validation.test.js.map +1 -0
  29. package/dist/auth/api-key.js.map +1 -1
  30. package/dist/auth/client.js.map +1 -1
  31. package/dist/auth/index.d.ts +2 -1
  32. package/dist/auth/index.d.ts.map +1 -1
  33. package/dist/auth/index.js +3 -0
  34. package/dist/auth/index.js.map +1 -1
  35. package/dist/auth/middleware.d.ts +1 -1
  36. package/dist/auth/middleware.d.ts.map +1 -1
  37. package/dist/auth/middleware.js.map +1 -1
  38. package/dist/auth/secure-secret.d.ts +136 -0
  39. package/dist/auth/secure-secret.d.ts.map +1 -0
  40. package/dist/auth/secure-secret.js +182 -0
  41. package/dist/auth/secure-secret.js.map +1 -0
  42. package/dist/auth/server-metadata.d.ts.map +1 -1
  43. package/dist/auth/server-metadata.js.map +1 -1
  44. package/dist/auth/simple-jwt.d.ts +100 -14
  45. package/dist/auth/simple-jwt.d.ts.map +1 -1
  46. package/dist/auth/simple-jwt.js +19 -9
  47. package/dist/auth/simple-jwt.js.map +1 -1
  48. package/dist/auth/token-store.js +1 -1
  49. package/dist/auth/token-store.js.map +1 -1
  50. package/dist/auth/token-validation.js +1 -1
  51. package/dist/auth/token-validation.js.map +1 -1
  52. package/dist/cli/__tests__/cli-dev.test.d.ts +2 -0
  53. package/dist/cli/__tests__/cli-dev.test.d.ts.map +1 -0
  54. package/dist/cli/__tests__/cli-dev.test.js +83 -0
  55. package/dist/cli/__tests__/cli-dev.test.js.map +1 -0
  56. package/dist/cli/__tests__/cli-start.test.d.ts +2 -0
  57. package/dist/cli/__tests__/cli-start.test.d.ts.map +1 -0
  58. package/dist/cli/__tests__/cli-start.test.js +61 -0
  59. package/dist/cli/__tests__/cli-start.test.js.map +1 -0
  60. package/dist/cli/__tests__/cli.test.d.ts +2 -0
  61. package/dist/cli/__tests__/cli.test.d.ts.map +1 -0
  62. package/dist/cli/__tests__/cli.test.js +73 -0
  63. package/dist/cli/__tests__/cli.test.js.map +1 -0
  64. package/dist/cli/__tests__/commands.test.d.ts +2 -0
  65. package/dist/cli/__tests__/commands.test.d.ts.map +1 -0
  66. package/dist/cli/__tests__/commands.test.js +64 -0
  67. package/dist/cli/__tests__/commands.test.js.map +1 -0
  68. package/dist/cli/commands/build.js +1 -1
  69. package/dist/cli/commands/build.js.map +1 -1
  70. package/dist/cli/commands/generate-types.js +12 -12
  71. package/dist/cli/commands/generate-types.js.map +1 -1
  72. package/dist/cli/commands/generate.d.ts +8 -1
  73. package/dist/cli/commands/generate.d.ts.map +1 -1
  74. package/dist/cli/commands/generate.js +13 -12
  75. package/dist/cli/commands/generate.js.map +1 -1
  76. package/dist/cli/commands/init.js +1 -1
  77. package/dist/cli/commands/init.js.map +1 -1
  78. package/dist/cli/commands/upgrade.d.ts +10 -0
  79. package/dist/cli/commands/upgrade.d.ts.map +1 -0
  80. package/dist/cli/commands/upgrade.js +221 -0
  81. package/dist/cli/commands/upgrade.js.map +1 -0
  82. package/dist/cli/index.d.ts +2 -1
  83. package/dist/cli/index.d.ts.map +1 -1
  84. package/dist/cli/index.js +69 -39
  85. package/dist/cli/index.js.map +1 -1
  86. package/dist/core/__tests__/core-modules.test.d.ts +2 -0
  87. package/dist/core/__tests__/core-modules.test.d.ts.map +1 -0
  88. package/dist/core/__tests__/core-modules.test.js +36 -0
  89. package/dist/core/__tests__/core-modules.test.js.map +1 -0
  90. package/dist/core/__tests__/models.test.d.ts +2 -0
  91. package/dist/core/__tests__/models.test.d.ts.map +1 -0
  92. package/dist/core/__tests__/models.test.js +142 -0
  93. package/dist/core/__tests__/models.test.js.map +1 -0
  94. package/dist/core/__tests__/module.test.d.ts +2 -0
  95. package/dist/core/__tests__/module.test.d.ts.map +1 -0
  96. package/dist/core/__tests__/module.test.js +60 -0
  97. package/dist/core/__tests__/module.test.js.map +1 -0
  98. package/dist/core/__tests__/server.test.d.ts +2 -0
  99. package/dist/core/__tests__/server.test.d.ts.map +1 -0
  100. package/dist/core/__tests__/server.test.js +120 -0
  101. package/dist/core/__tests__/server.test.js.map +1 -0
  102. package/dist/core/__tests__/transports.test.d.ts +2 -0
  103. package/dist/core/__tests__/transports.test.d.ts.map +1 -0
  104. package/dist/core/__tests__/transports.test.js +12 -0
  105. package/dist/core/__tests__/transports.test.js.map +1 -0
  106. package/dist/core/app-decorator.d.ts +4 -3
  107. package/dist/core/app-decorator.d.ts.map +1 -1
  108. package/dist/core/app-decorator.js +67 -28
  109. package/dist/core/app-decorator.js.map +1 -1
  110. package/dist/core/builders.d.ts +19 -7
  111. package/dist/core/builders.d.ts.map +1 -1
  112. package/dist/core/builders.js +15 -8
  113. package/dist/core/builders.js.map +1 -1
  114. package/dist/core/component.d.ts +8 -8
  115. package/dist/core/component.d.ts.map +1 -1
  116. package/dist/core/component.js +3 -2
  117. package/dist/core/component.js.map +1 -1
  118. package/dist/core/config-module.d.ts +11 -4
  119. package/dist/core/config-module.d.ts.map +1 -1
  120. package/dist/core/config-module.js +1 -1
  121. package/dist/core/config-module.js.map +1 -1
  122. package/dist/core/decorators/__tests__/decorators.test.d.ts +2 -0
  123. package/dist/core/decorators/__tests__/decorators.test.d.ts.map +1 -0
  124. package/dist/core/decorators/__tests__/decorators.test.js +103 -0
  125. package/dist/core/decorators/__tests__/decorators.test.js.map +1 -0
  126. package/dist/core/decorators/__tests__/extended-decorators.test.d.ts +2 -0
  127. package/dist/core/decorators/__tests__/extended-decorators.test.d.ts.map +1 -0
  128. package/dist/core/decorators/__tests__/extended-decorators.test.js +194 -0
  129. package/dist/core/decorators/__tests__/extended-decorators.test.js.map +1 -0
  130. package/dist/core/decorators/cache.decorator.d.ts +9 -9
  131. package/dist/core/decorators/cache.decorator.d.ts.map +1 -1
  132. package/dist/core/decorators/cache.decorator.js +3 -3
  133. package/dist/core/decorators/cache.decorator.js.map +1 -1
  134. package/dist/core/decorators/health-check.decorator.d.ts +3 -3
  135. package/dist/core/decorators/health-check.decorator.d.ts.map +1 -1
  136. package/dist/core/decorators/health-check.decorator.js +2 -2
  137. package/dist/core/decorators/health-check.decorator.js.map +1 -1
  138. package/dist/core/decorators/rate-limit.decorator.d.ts +5 -4
  139. package/dist/core/decorators/rate-limit.decorator.d.ts.map +1 -1
  140. package/dist/core/decorators/rate-limit.decorator.js +3 -3
  141. package/dist/core/decorators/rate-limit.decorator.js.map +1 -1
  142. package/dist/core/decorators.d.ts +47 -29
  143. package/dist/core/decorators.d.ts.map +1 -1
  144. package/dist/core/decorators.js +9 -9
  145. package/dist/core/decorators.js.map +1 -1
  146. package/dist/core/di/__tests__/container.test.d.ts +2 -0
  147. package/dist/core/di/__tests__/container.test.d.ts.map +1 -0
  148. package/dist/core/di/__tests__/container.test.js +88 -0
  149. package/dist/core/di/__tests__/container.test.js.map +1 -0
  150. package/dist/core/di/container.d.ts +21 -4
  151. package/dist/core/di/container.d.ts.map +1 -1
  152. package/dist/core/di/container.js +11 -7
  153. package/dist/core/di/container.js.map +1 -1
  154. package/dist/core/di/injectable.decorator.d.ts +5 -3
  155. package/dist/core/di/injectable.decorator.d.ts.map +1 -1
  156. package/dist/core/di/injectable.decorator.js.map +1 -1
  157. package/dist/core/errors.d.ts +4 -4
  158. package/dist/core/errors.d.ts.map +1 -1
  159. package/dist/core/errors.js.map +1 -1
  160. package/dist/core/events/__tests__/events.test.d.ts +2 -0
  161. package/dist/core/events/__tests__/events.test.d.ts.map +1 -0
  162. package/dist/core/events/__tests__/events.test.js +177 -0
  163. package/dist/core/events/__tests__/events.test.js.map +1 -0
  164. package/dist/core/events/event-emitter.d.ts +3 -3
  165. package/dist/core/events/event-emitter.d.ts.map +1 -1
  166. package/dist/core/events/event-emitter.js.map +1 -1
  167. package/dist/core/events/event.decorator.d.ts +5 -5
  168. package/dist/core/events/event.decorator.d.ts.map +1 -1
  169. package/dist/core/events/event.decorator.js +10 -6
  170. package/dist/core/events/event.decorator.js.map +1 -1
  171. package/dist/core/events/log-emitter.d.ts +7 -1
  172. package/dist/core/events/log-emitter.d.ts.map +1 -1
  173. package/dist/core/events/log-emitter.js.map +1 -1
  174. package/dist/core/filters/__tests__/filters.test.d.ts +2 -0
  175. package/dist/core/filters/__tests__/filters.test.d.ts.map +1 -0
  176. package/dist/core/filters/__tests__/filters.test.js +72 -0
  177. package/dist/core/filters/__tests__/filters.test.js.map +1 -0
  178. package/dist/core/filters/exception-filter.decorator.d.ts +5 -5
  179. package/dist/core/filters/exception-filter.decorator.d.ts.map +1 -1
  180. package/dist/core/filters/exception-filter.decorator.js +3 -3
  181. package/dist/core/filters/exception-filter.decorator.js.map +1 -1
  182. package/dist/core/filters/exception-filter.interface.d.ts +14 -5
  183. package/dist/core/filters/exception-filter.interface.d.ts.map +1 -1
  184. package/dist/core/guards/__tests__/guards.test.d.ts +2 -0
  185. package/dist/core/guards/__tests__/guards.test.d.ts.map +1 -0
  186. package/dist/core/guards/__tests__/guards.test.js +55 -0
  187. package/dist/core/guards/__tests__/guards.test.js.map +1 -0
  188. package/dist/core/guards/apikey.guard.d.ts +1 -1
  189. package/dist/core/guards/apikey.guard.d.ts.map +1 -1
  190. package/dist/core/guards/guard.interface.d.ts +1 -1
  191. package/dist/core/guards/guard.interface.d.ts.map +1 -1
  192. package/dist/core/guards/jwt.guard.d.ts +1 -1
  193. package/dist/core/guards/jwt.guard.d.ts.map +1 -1
  194. package/dist/core/guards/oauth.guard.d.ts +1 -1
  195. package/dist/core/guards/oauth.guard.d.ts.map +1 -1
  196. package/dist/core/guards/use-guards.decorator.d.ts +3 -3
  197. package/dist/core/guards/use-guards.decorator.d.ts.map +1 -1
  198. package/dist/core/guards/use-guards.decorator.js +1 -1
  199. package/dist/core/guards/use-guards.decorator.js.map +1 -1
  200. package/dist/core/health/__tests__/health.test.d.ts +2 -0
  201. package/dist/core/health/__tests__/health.test.d.ts.map +1 -0
  202. package/dist/core/health/__tests__/health.test.js +31 -0
  203. package/dist/core/health/__tests__/health.test.js.map +1 -0
  204. package/dist/core/index.d.ts +2 -2
  205. package/dist/core/index.d.ts.map +1 -1
  206. package/dist/core/index.js.map +1 -1
  207. package/dist/core/interceptors/__tests__/interceptors.test.d.ts +2 -0
  208. package/dist/core/interceptors/__tests__/interceptors.test.d.ts.map +1 -0
  209. package/dist/core/interceptors/__tests__/interceptors.test.js +52 -0
  210. package/dist/core/interceptors/__tests__/interceptors.test.js.map +1 -0
  211. package/dist/core/interceptors/interceptor.decorator.d.ts +4 -4
  212. package/dist/core/interceptors/interceptor.decorator.d.ts.map +1 -1
  213. package/dist/core/interceptors/interceptor.decorator.js +2 -2
  214. package/dist/core/interceptors/interceptor.decorator.js.map +1 -1
  215. package/dist/core/interceptors/interceptor.interface.d.ts +3 -3
  216. package/dist/core/interceptors/interceptor.interface.d.ts.map +1 -1
  217. package/dist/core/logger.d.ts.map +1 -1
  218. package/dist/core/logger.js.map +1 -1
  219. package/dist/core/middleware/__tests__/middleware.test.d.ts +2 -0
  220. package/dist/core/middleware/__tests__/middleware.test.d.ts.map +1 -0
  221. package/dist/core/middleware/__tests__/middleware.test.js +105 -0
  222. package/dist/core/middleware/__tests__/middleware.test.js.map +1 -0
  223. package/dist/core/middleware/middleware.decorator.d.ts +4 -4
  224. package/dist/core/middleware/middleware.decorator.d.ts.map +1 -1
  225. package/dist/core/middleware/middleware.decorator.js +2 -2
  226. package/dist/core/middleware/middleware.decorator.js.map +1 -1
  227. package/dist/core/middleware/middleware.interface.d.ts +3 -3
  228. package/dist/core/middleware/middleware.interface.d.ts.map +1 -1
  229. package/dist/core/module.d.ts +33 -14
  230. package/dist/core/module.d.ts.map +1 -1
  231. package/dist/core/module.js +11 -6
  232. package/dist/core/module.js.map +1 -1
  233. package/dist/core/oauth-module.d.ts +9 -3
  234. package/dist/core/oauth-module.d.ts.map +1 -1
  235. package/dist/core/oauth-module.js +4 -3
  236. package/dist/core/oauth-module.js.map +1 -1
  237. package/dist/core/pipes/__tests__/pipes.test.d.ts +2 -0
  238. package/dist/core/pipes/__tests__/pipes.test.d.ts.map +1 -0
  239. package/dist/core/pipes/__tests__/pipes.test.js +52 -0
  240. package/dist/core/pipes/__tests__/pipes.test.js.map +1 -0
  241. package/dist/core/pipes/pipe.decorator.d.ts +14 -5
  242. package/dist/core/pipes/pipe.decorator.d.ts.map +1 -1
  243. package/dist/core/pipes/pipe.decorator.js +2 -2
  244. package/dist/core/pipes/pipe.decorator.js.map +1 -1
  245. package/dist/core/pipes/pipe.interface.d.ts +9 -4
  246. package/dist/core/pipes/pipe.interface.d.ts.map +1 -1
  247. package/dist/core/prompt.d.ts +13 -4
  248. package/dist/core/prompt.d.ts.map +1 -1
  249. package/dist/core/prompt.js +2 -2
  250. package/dist/core/prompt.js.map +1 -1
  251. package/dist/core/resource.d.ts +7 -2
  252. package/dist/core/resource.d.ts.map +1 -1
  253. package/dist/core/resource.js +2 -2
  254. package/dist/core/resource.js.map +1 -1
  255. package/dist/core/server.d.ts +49 -3
  256. package/dist/core/server.d.ts.map +1 -1
  257. package/dist/core/server.js +61 -34
  258. package/dist/core/server.js.map +1 -1
  259. package/dist/core/tool.d.ts +44 -16
  260. package/dist/core/tool.d.ts.map +1 -1
  261. package/dist/core/tool.js +19 -6
  262. package/dist/core/tool.js.map +1 -1
  263. package/dist/core/transports/__tests__/transports.test.d.ts +2 -0
  264. package/dist/core/transports/__tests__/transports.test.d.ts.map +1 -0
  265. package/dist/core/transports/__tests__/transports.test.js +249 -0
  266. package/dist/core/transports/__tests__/transports.test.js.map +1 -0
  267. package/dist/core/transports/discovery-http-server.d.ts +7 -1
  268. package/dist/core/transports/discovery-http-server.d.ts.map +1 -1
  269. package/dist/core/transports/discovery-http-server.js.map +1 -1
  270. package/dist/core/transports/http-server.d.ts +2 -2
  271. package/dist/core/transports/http-server.d.ts.map +1 -1
  272. package/dist/core/transports/http-server.js +1 -1
  273. package/dist/core/transports/http-server.js.map +1 -1
  274. package/dist/core/transports/streamable-http.d.ts +4 -4
  275. package/dist/core/transports/streamable-http.d.ts.map +1 -1
  276. package/dist/core/transports/streamable-http.js +1 -1
  277. package/dist/core/transports/streamable-http.js.map +1 -1
  278. package/dist/core/types.d.ts +87 -15
  279. package/dist/core/types.d.ts.map +1 -1
  280. package/dist/core/widgets/__tests__/registry.test.d.ts +2 -0
  281. package/dist/core/widgets/__tests__/registry.test.d.ts.map +1 -0
  282. package/dist/core/widgets/__tests__/registry.test.js +69 -0
  283. package/dist/core/widgets/__tests__/registry.test.js.map +1 -0
  284. package/dist/core/widgets/widget-registry.d.ts +2 -2
  285. package/dist/core/widgets/widget-registry.d.ts.map +1 -1
  286. package/dist/core/widgets/widget-registry.js +1 -1
  287. package/dist/core/widgets/widget-registry.js.map +1 -1
  288. package/dist/testing/__tests__/testing.test.d.ts +2 -0
  289. package/dist/testing/__tests__/testing.test.d.ts.map +1 -0
  290. package/dist/testing/__tests__/testing.test.js +167 -0
  291. package/dist/testing/__tests__/testing.test.js.map +1 -0
  292. package/dist/testing/index.d.ts +40 -19
  293. package/dist/testing/index.d.ts.map +1 -1
  294. package/dist/testing/index.js +5 -8
  295. package/dist/testing/index.js.map +1 -1
  296. package/dist/ui-next/__tests__/ui-next.test.d.ts +2 -0
  297. package/dist/ui-next/__tests__/ui-next.test.d.ts.map +1 -0
  298. package/dist/ui-next/__tests__/ui-next.test.js +74 -0
  299. package/dist/ui-next/__tests__/ui-next.test.js.map +1 -0
  300. package/dist/ui-next/index.d.ts +1 -1
  301. package/dist/ui-next/index.d.ts.map +1 -1
  302. package/dist/ui-next/index.js.map +1 -1
  303. package/dist/widgets/__tests__/utils.test.d.ts +2 -0
  304. package/dist/widgets/__tests__/utils.test.d.ts.map +1 -0
  305. package/dist/widgets/__tests__/utils.test.js +80 -0
  306. package/dist/widgets/__tests__/utils.test.js.map +1 -0
  307. package/dist/widgets/__tests__/widgets.test.d.ts +2 -0
  308. package/dist/widgets/__tests__/widgets.test.d.ts.map +1 -0
  309. package/dist/widgets/__tests__/widgets.test.js +245 -0
  310. package/dist/widgets/__tests__/widgets.test.js.map +1 -0
  311. package/dist/widgets/hooks/useWidgetSDK.d.ts +5 -5
  312. package/dist/widgets/runtime/WidgetLayout.js.map +1 -1
  313. package/dist/widgets/sdk.d.ts +5 -5
  314. package/dist/widgets/sdk.d.ts.map +1 -1
  315. package/dist/widgets/sdk.js.map +1 -1
  316. package/package.json +1 -1
  317. package/src/studio/app/api/auth/fetch-metadata/route.ts +3 -2
  318. package/src/studio/app/api/auth/register-client/route.ts +3 -2
  319. package/src/studio/app/api/chat/route.ts +31 -17
  320. package/src/studio/app/api/health/checks/route.ts +5 -4
  321. package/src/studio/app/api/init/route.ts +3 -2
  322. package/src/studio/app/api/ping/route.ts +3 -2
  323. package/src/studio/app/api/prompts/[name]/route.ts +4 -3
  324. package/src/studio/app/api/prompts/route.ts +3 -2
  325. package/src/studio/app/api/resources/[...uri]/route.ts +3 -2
  326. package/src/studio/app/api/resources/route.ts +3 -2
  327. package/src/studio/app/api/roots/route.ts +3 -2
  328. package/src/studio/app/api/sampling/route.ts +3 -2
  329. package/src/studio/app/api/tools/[name]/call/route.ts +3 -2
  330. package/src/studio/app/api/tools/route.ts +4 -3
  331. package/src/studio/app/api/widget-examples/route.ts +5 -4
  332. package/src/studio/app/auth/callback/page.tsx +3 -2
  333. package/src/studio/app/chat/page.tsx +481 -105
  334. package/src/studio/app/health/page.tsx +1 -1
  335. package/src/studio/app/logs/page.tsx +2 -2
  336. package/src/studio/app/page.tsx +5 -5
  337. package/src/studio/app/prompts/page.tsx +2 -2
  338. package/src/studio/app/settings/page.tsx +3 -2
  339. package/src/studio/app/tools/page.tsx +3 -3
  340. package/src/studio/components/LogMessage.tsx +1 -1
  341. package/src/studio/components/MarkdownRenderer.tsx +245 -348
  342. package/src/studio/components/Sidebar.tsx +18 -3
  343. package/src/studio/components/VoiceOrbOverlay.tsx +12 -6
  344. package/src/studio/components/WidgetErrorBoundary.tsx +49 -0
  345. package/src/studio/components/WidgetRenderer.tsx +168 -215
  346. package/src/studio/components/ops/OpsCanvas.tsx +748 -0
  347. package/src/studio/components/ops/OpsNodeDetailPanel.tsx +150 -0
  348. package/src/studio/components/ops/OpsSummaryBar.tsx +90 -0
  349. package/src/studio/components/ops/index.ts +6 -0
  350. package/src/studio/components/ops/nodes/BaseNode.tsx +65 -0
  351. package/src/studio/components/ops/nodes/LLMCallNode.tsx +34 -0
  352. package/src/studio/components/ops/nodes/LLMResponseNode.tsx +33 -0
  353. package/src/studio/components/ops/nodes/ToolCallNode.tsx +30 -0
  354. package/src/studio/components/ops/nodes/ToolResultNode.tsx +43 -0
  355. package/src/studio/components/ops/nodes/UserPromptNode.tsx +34 -0
  356. package/src/studio/components/ops/nodes/WidgetRenderNode.tsx +23 -0
  357. package/src/studio/components/ops/nodes/index.ts +9 -0
  358. package/src/studio/components/tools/ToolsCanvas.tsx +2 -2
  359. package/src/studio/lib/api.ts +61 -42
  360. package/src/studio/lib/http-client-transport.ts +2 -2
  361. package/src/studio/lib/llm-service.ts +126 -47
  362. package/src/studio/lib/mcp-client.ts +9 -6
  363. package/src/studio/lib/ops-store.ts +427 -0
  364. package/src/studio/lib/ops-tracker.ts +416 -0
  365. package/src/studio/lib/ops-types.ts +164 -0
  366. package/src/studio/lib/store.ts +8 -11
  367. package/src/studio/lib/types.ts +228 -38
  368. package/src/studio/lib/widget-loader.ts +2 -2
  369. package/templates/typescript-oauth/src/modules/flights/flights.prompts.ts +19 -22
  370. package/dist/cli/build-widgets.mjs +0 -165
@@ -1,26 +1,108 @@
1
1
  // NitroStack Studio Type Definitions
2
2
 
3
+ // ============================================================================
4
+ // JSON Types - For safe handling of arbitrary JSON data
5
+ // ============================================================================
6
+
7
+ /**
8
+ * Primitive JSON values
9
+ */
10
+ export type JsonPrimitive = string | number | boolean | null;
11
+
12
+ /**
13
+ * JSON array type
14
+ */
15
+ export type JsonArray = JsonValue[];
16
+
17
+ /**
18
+ * JSON object type
19
+ */
20
+ export type JsonObject = { [key: string]: JsonValue };
21
+
22
+ /**
23
+ * Any valid JSON value
24
+ */
25
+ export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
26
+
27
+ // ============================================================================
28
+ // Schema Types
29
+ // ============================================================================
30
+
31
+ /**
32
+ * JSON Schema property definition
33
+ */
34
+ export interface JsonSchemaProperty {
35
+ type?: string;
36
+ description?: string;
37
+ enum?: JsonValue[];
38
+ default?: JsonValue;
39
+ items?: JsonSchemaProperty;
40
+ properties?: Record<string, JsonSchemaProperty>;
41
+ required?: string[];
42
+ additionalProperties?: boolean | JsonSchemaProperty;
43
+ format?: string;
44
+ minimum?: number;
45
+ maximum?: number;
46
+ minLength?: number;
47
+ maxLength?: number;
48
+ pattern?: string;
49
+ [key: string]: JsonValue | undefined;
50
+ }
51
+
52
+ /**
53
+ * Tool input schema (JSON Schema format)
54
+ */
55
+ export interface ToolInputSchema {
56
+ type: string;
57
+ properties?: Record<string, JsonSchemaProperty>;
58
+ required?: string[];
59
+ additionalProperties?: boolean;
60
+ }
61
+
62
+ // ============================================================================
63
+ // Tool Types
64
+ // ============================================================================
65
+
66
+ /**
67
+ * Tool metadata
68
+ */
69
+ export interface ToolMeta {
70
+ 'openai/outputTemplate'?: string;
71
+ 'ui/template'?: string;
72
+ 'tool/initial'?: boolean;
73
+ 'tool/examples'?: JsonValue;
74
+ [key: string]: JsonValue | undefined;
75
+ }
76
+
77
+ /**
78
+ * Tool examples
79
+ */
80
+ export interface ToolExamples {
81
+ request?: JsonValue;
82
+ response?: JsonValue;
83
+ }
84
+
3
85
  export interface Tool {
4
86
  name: string;
5
87
  description?: string;
6
- inputSchema?: {
7
- type: string;
8
- properties?: Record<string, any>;
9
- required?: string[];
10
- };
11
- examples?: {
12
- request?: any;
13
- response?: any;
14
- };
88
+ inputSchema?: ToolInputSchema;
89
+ examples?: ToolExamples;
15
90
  widget?: {
16
91
  route: string;
17
92
  };
18
93
  outputTemplate?: string;
19
- _meta?: {
20
- 'openai/outputTemplate'?: string;
21
- 'ui/template'?: string;
22
- [key: string]: any;
23
- };
94
+ _meta?: ToolMeta;
95
+ }
96
+
97
+ // ============================================================================
98
+ // Resource Types
99
+ // ============================================================================
100
+
101
+ /**
102
+ * Resource examples
103
+ */
104
+ export interface ResourceExamples {
105
+ response?: JsonValue;
24
106
  }
25
107
 
26
108
  export interface Resource {
@@ -28,45 +110,69 @@ export interface Resource {
28
110
  uri: string;
29
111
  description?: string;
30
112
  mimeType?: string;
31
- examples?: {
32
- response?: any;
33
- };
34
- _meta?: Record<string, any>;
113
+ examples?: ResourceExamples;
114
+ _meta?: Record<string, JsonValue>;
115
+ }
116
+
117
+ // ============================================================================
118
+ // Prompt Types
119
+ // ============================================================================
120
+
121
+ export interface PromptArgument {
122
+ name: string;
123
+ description?: string;
124
+ required?: boolean;
35
125
  }
36
126
 
37
127
  export interface Prompt {
38
128
  name: string;
39
129
  description?: string;
40
- arguments?: Array<{
41
- name: string;
42
- description?: string;
43
- required?: boolean;
44
- }>;
130
+ arguments?: PromptArgument[];
45
131
  }
46
132
 
133
+ // ============================================================================
134
+ // Root Types
135
+ // ============================================================================
136
+
47
137
  export interface Root {
48
138
  uri: string;
49
139
  name?: string;
50
140
  }
51
141
 
142
+ // ============================================================================
143
+ // Chat Types
144
+ // ============================================================================
145
+
146
+ /**
147
+ * Tool call in a chat message
148
+ */
149
+ export interface ToolCall {
150
+ id: string;
151
+ name: string;
152
+ arguments: JsonValue;
153
+ result?: JsonValue;
154
+ }
155
+
156
+ /**
157
+ * File attachment in a chat message
158
+ */
159
+ export interface ChatFile {
160
+ data: string;
161
+ type: string;
162
+ name: string;
163
+ }
164
+
52
165
  export interface ChatMessage {
53
166
  role: 'user' | 'assistant' | 'tool' | 'system';
54
167
  content: string;
55
168
  toolCalls?: ToolCall[];
56
169
  toolCallId?: string;
57
- file?: {
58
- data: string;
59
- type: string;
60
- name: string;
61
- };
170
+ file?: ChatFile;
62
171
  }
63
172
 
64
- export interface ToolCall {
65
- id: string;
66
- name: string;
67
- arguments: any;
68
- result?: any;
69
- }
173
+ // ============================================================================
174
+ // Connection & Health Types
175
+ // ============================================================================
70
176
 
71
177
  export interface PingResult {
72
178
  time: Date;
@@ -83,17 +189,92 @@ export interface HealthCheck {
83
189
  status: 'up' | 'down' | 'degraded';
84
190
  lastCheck: Date;
85
191
  message?: string;
192
+ details?: JsonObject;
86
193
  }
87
194
 
195
+ // ============================================================================
196
+ // OAuth Types
197
+ // ============================================================================
198
+
199
+ /**
200
+ * OAuth Resource Metadata (RFC 9728)
201
+ */
202
+ export interface ResourceMetadata {
203
+ resource: string;
204
+ authorization_servers: string[];
205
+ scopes_supported?: string[];
206
+ bearer_methods_supported?: string[];
207
+ [key: string]: JsonValue | undefined;
208
+ }
209
+
210
+ /**
211
+ * OAuth Authorization Server Metadata (RFC 8414)
212
+ */
213
+ export interface AuthServerMetadata {
214
+ issuer: string;
215
+ authorization_endpoint: string;
216
+ token_endpoint: string;
217
+ registration_endpoint?: string;
218
+ revocation_endpoint?: string;
219
+ introspection_endpoint?: string;
220
+ scopes_supported?: string[];
221
+ response_types_supported?: string[];
222
+ grant_types_supported?: string[];
223
+ code_challenge_methods_supported?: string[];
224
+ [key: string]: JsonValue | undefined;
225
+ }
226
+
227
+ /**
228
+ * OAuth Client Registration
229
+ */
230
+ export interface ClientRegistration {
231
+ client_id: string;
232
+ client_secret?: string;
233
+ redirect_uris: string[];
234
+ token_endpoint_auth_method?: string;
235
+ grant_types?: string[];
236
+ response_types?: string[];
237
+ [key: string]: JsonValue | undefined;
238
+ }
239
+
240
+ /**
241
+ * OAuth Token
242
+ */
243
+ export interface OAuthToken {
244
+ access_token: string;
245
+ token_type: string;
246
+ expires_in?: number;
247
+ refresh_token?: string;
248
+ scope?: string;
249
+ [key: string]: JsonValue | undefined;
250
+ }
251
+
252
+ /**
253
+ * OAuth state for the studio
254
+ */
88
255
  export interface OAuthState {
89
256
  authServerUrl: string | null;
90
- resourceMetadata: any;
91
- authServerMetadata: any;
92
- clientRegistration: any;
257
+ resourceMetadata: ResourceMetadata | null;
258
+ authServerMetadata: AuthServerMetadata | null;
259
+ clientRegistration: ClientRegistration | null;
93
260
  selectedScopes: string[];
94
- currentToken: any;
261
+ currentToken: OAuthToken | null;
262
+ }
263
+
264
+ // ============================================================================
265
+ // PKCE Types
266
+ // ============================================================================
267
+
268
+ export interface PKCEParams {
269
+ code_verifier: string;
270
+ code_challenge: string;
271
+ code_challenge_method: 'S256' | 'plain';
95
272
  }
96
273
 
274
+ // ============================================================================
275
+ // UI Types
276
+ // ============================================================================
277
+
97
278
  export type TabType =
98
279
  | 'tools'
99
280
  | 'chat'
@@ -105,3 +286,12 @@ export type TabType =
105
286
  | 'sampling'
106
287
  | 'roots';
107
288
 
289
+ /**
290
+ * Enlarge modal state
291
+ */
292
+ export interface EnlargeModalState {
293
+ open: boolean;
294
+ type: 'tool' | 'resource' | null;
295
+ item: Tool | Resource | null;
296
+ }
297
+
@@ -46,7 +46,7 @@ export async function loadWidget(uri: string): Promise<{ html: string; isDevMode
46
46
  }
47
47
  }
48
48
 
49
- export function createWidgetHTML(html: string, data: any): string {
49
+ export function createWidgetHTML(html: string, data: unknown): string {
50
50
  const htmlParts = [
51
51
  '<!DOCTYPE html>',
52
52
  '<html>',
@@ -70,7 +70,7 @@ export function createWidgetHTML(html: string, data: any): string {
70
70
  return htmlParts.join('\n');
71
71
  }
72
72
 
73
- export function postMessageToWidget(iframe: HTMLIFrameElement, data: any, delay: number = 500) {
73
+ export function postMessageToWidget(iframe: HTMLIFrameElement, data: unknown, delay: number = 500): void {
74
74
  iframe.onload = () => {
75
75
  setTimeout(() => {
76
76
  try {
@@ -22,33 +22,30 @@ export class FlightPrompts {
22
22
  ]
23
23
  })
24
24
  async flightSearchAssistant(input: any, ctx: ExecutionContext) {
25
- const systemPrompt = `You are a professional flight booking assistant with expertise in helping travelers find the best flight options.
25
+ const systemPrompt = `You are a professional flight booking assistant with expertise in helping travelers find flight information.
26
+
27
+ āš ļø CRITICAL: Only do what the user specifically asks. Do NOT assume additional steps.
26
28
 
27
29
  Your capabilities:
30
+ - Search for airports using search_airports tool
28
31
  - Search for flights using the search_flights tool
29
32
  - Get detailed flight information using get_flight_details tool
30
- - Search for airports using search_airports tool
31
- - Explain flight options, pricing, and conditions
32
- - Help users compare different flight options
33
- - Provide recommendations based on user preferences
34
- - Guide users through the booking process
35
-
36
- Guidelines:
37
- 1. Always confirm the origin, destination, and dates before searching
38
- 2. Ask about passenger count and cabin class preferences
39
- 3. Explain the differences between flight options clearly
40
- 4. Highlight important details like layovers, total duration, and baggage allowance
41
- 5. Inform users about refund and change policies
42
- 6. Help users understand pricing and what's included
43
- 7. Be proactive in suggesting alternatives if initial search has limited results
44
-
45
- BOOKING WORKFLOW:
46
- When a user wants to book a flight:
33
+ - Help book flights when explicitly requested
34
+
35
+ **IMPORTANT RULES:**
36
+ 1. If user asks about airports, ONLY search airports - do NOT search for flights
37
+ 2. If user asks about flights, ONLY search flights - do NOT automatically book
38
+ 3. If user asks to book, ONLY then proceed with booking workflow
39
+ 4. NEVER chain operations unless user explicitly requests it
40
+
41
+ **EXAMPLES:**
42
+ - "show me airports in London" → search_airports("London") → show results → STOP
43
+ - "find flights from NYC to LAX" → search_flights → show results → STOP
44
+ - "book this flight" → THEN start booking workflow
45
+
46
+ BOOKING WORKFLOW (only when user explicitly wants to book):
47
47
  1. FIRST, collect ALL passenger information (name, title, gender, date of birth, email, phone)
48
48
  2. THEN, call create_order tool with complete passenger details
49
- - The system will automatically create a HOLD order (no payment required)
50
- - The system will automatically handle passenger ID creation with Duffel
51
- - You just need to provide the passenger details in the correct format
52
49
  āš ļø NEVER call create_order without collecting passenger information first!
53
50
  āš ļø All bookings are automatically held - no payment is required at booking time
54
51
 
@@ -56,7 +53,7 @@ Current user query: ${input.userQuery}
56
53
 
57
54
  ${input.context?.previousSearches?.length ? `Previous searches in this conversation:\n${JSON.stringify(input.context.previousSearches, null, 2)}` : ''}
58
55
 
59
- Respond naturally and helpfully to assist the user with their flight booking needs.`;
56
+ Respond to EXACTLY what the user asked - nothing more.`;
60
57
 
61
58
  return {
62
59
  role: 'assistant',
@@ -1,165 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Custom widget bundler for NitroStack
5
- *
6
- * This script bundles Next.js widget pages into single-file HTML documents
7
- * with all JavaScript and CSS inlined, following OpenAI's widget spec.
8
- *
9
- * Unlike Next.js static export which creates multiple chunk files,
10
- * this creates truly self-contained single-file widgets.
11
- */
12
-
13
- import * as esbuild from 'esbuild';
14
- import * as fs from 'fs';
15
- import * as path from 'path';
16
-
17
- const WIDGETS_DIR = path.resolve(process.cwd(), 'src/widgets');
18
- const APP_DIR = path.join(WIDGETS_DIR, 'app');
19
- const OUT_DIR = path.join(WIDGETS_DIR, 'out');
20
-
21
- console.log('šŸŽØ Building widgets with esbuild...\n');
22
-
23
- // Clean output directory
24
- if (fs.existsSync(OUT_DIR)) {
25
- fs.rmSync(OUT_DIR, { recursive: true });
26
- }
27
- fs.mkdirSync(OUT_DIR, { recursive: true });
28
-
29
- // Find all widget pages
30
- const widgetPages = [];
31
-
32
- function findWidgetPages(dir, basePath = '') {
33
- const entries = fs.readdirSync(dir, { withFileTypes: true });
34
-
35
- for (const entry of entries) {
36
- const fullPath = path.join(dir, entry.name);
37
- const relativePath = path.join(basePath, entry.name);
38
-
39
- if (entry.isDirectory()) {
40
- findWidgetPages(fullPath, relativePath);
41
- } else if (entry.name === 'page.tsx' || entry.name === 'page.jsx') {
42
- const widgetName = basePath || 'index';
43
- widgetPages.push({
44
- name: widgetName,
45
- entryPoint: fullPath,
46
- outputName: widgetName.replace(/\//g, '-')
47
- });
48
- }
49
- }
50
- }
51
-
52
- if (fs.existsSync(APP_DIR)) {
53
- findWidgetPages(APP_DIR);
54
- }
55
-
56
- console.log(`Found ${widgetPages.length} widget(s):`);
57
- widgetPages.forEach(w => console.log(` - ${w.name}`));
58
- console.log('');
59
-
60
- // Bundle each widget
61
- for (const widget of widgetPages) {
62
- console.log(`šŸ“¦ Bundling ${widget.name}...`);
63
-
64
- const tempEntry = path.join(OUT_DIR, `_temp_${widget.outputName}.jsx`);
65
- const jsOutput = path.join(OUT_DIR, `${widget.outputName}.js`);
66
- const htmlOutput = path.join(OUT_DIR, `${widget.outputName}.html`);
67
-
68
- // Create a temporary entry file that renders the widget
69
- const entryCode = `
70
- import React from 'react';
71
- import { createRoot } from 'react-dom/client';
72
- import WidgetPage from '${widget.entryPoint.replace(/\\/g, '/')}';
73
-
74
- // Wait for DOM to be ready
75
- if (document.readyState === 'loading') {
76
- document.addEventListener('DOMContentLoaded', init);
77
- } else {
78
- init();
79
- }
80
-
81
- function init() {
82
- // Get data from window.openai if available
83
- const data = window.openai?.toolOutput || {};
84
-
85
- // Find or create root element
86
- let root = document.getElementById('widget-root');
87
- if (!root) {
88
- root = document.createElement('div');
89
- root.id = 'widget-root';
90
- document.body.appendChild(root);
91
- }
92
-
93
- // Render the widget
94
- const reactRoot = createRoot(root);
95
- reactRoot.render(React.createElement(WidgetPage, { data }));
96
- }
97
- `;
98
-
99
- fs.writeFileSync(tempEntry, entryCode);
100
-
101
- try {
102
- // Bundle with esbuild
103
- await esbuild.build({
104
- entryPoints: [tempEntry],
105
- bundle: true,
106
- format: 'iife',
107
- outfile: jsOutput,
108
- platform: 'browser',
109
- target: ['es2020'],
110
- minify: true,
111
- jsx: 'automatic',
112
- jsxImportSource: 'react',
113
- // Don't bundle React - it should come from widgets/node_modules
114
- external: [],
115
- // Resolve modules from the widgets directory
116
- nodePaths: [path.join(WIDGETS_DIR, 'node_modules')],
117
- define: {
118
- 'process.env.NODE_ENV': '"production"'
119
- },
120
- logLevel: 'warning'
121
- });
122
-
123
- // Read the bundled JavaScript
124
- const bundledJs = fs.readFileSync(jsOutput, 'utf-8');
125
-
126
- // Create the HTML file with inlined JavaScript
127
- const html = `<!DOCTYPE html>
128
- <html lang="en">
129
- <head>
130
- <meta charset="utf-8">
131
- <meta name="viewport" content="width=device-width, initial-scale=1">
132
- <style>
133
- * { box-sizing: border-box; }
134
- body {
135
- margin: 0;
136
- padding: 0;
137
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
138
- }
139
- #widget-root {
140
- width: 100%;
141
- min-height: 100vh;
142
- }
143
- </style>
144
- </head>
145
- <body>
146
- <div id="widget-root"></div>
147
- <script>${bundledJs}</script>
148
- </body>
149
- </html>`;
150
-
151
- fs.writeFileSync(htmlOutput, html);
152
-
153
- // Clean up temporary files
154
- fs.unlinkSync(tempEntry);
155
- fs.unlinkSync(jsOutput);
156
-
157
- console.log(` āœ“ ${widget.outputName}.html`);
158
-
159
- } catch (error) {
160
- console.error(` āœ— Failed to bundle ${widget.name}:`, error.message);
161
- process.exit(1);
162
- }
163
- }
164
-
165
- console.log(`\n✨ Successfully built ${widgetPages.length} widget(s) to ${OUT_DIR}\n`);