@kortix/sdk 0.9.98

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 (618) hide show
  1. package/README.md +313 -0
  2. package/dist/files/client.d.ts +96 -0
  3. package/dist/files/client.d.ts.map +1 -0
  4. package/dist/files/client.js +346 -0
  5. package/dist/files/client.js.map +1 -0
  6. package/dist/files/types.d.ts +82 -0
  7. package/dist/files/types.d.ts.map +1 -0
  8. package/dist/files/types.js +6 -0
  9. package/dist/files/types.js.map +1 -0
  10. package/dist/index.d.ts +119 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +93 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/kortix.d.ts +897 -0
  15. package/dist/kortix.d.ts.map +1 -0
  16. package/dist/kortix.js +772 -0
  17. package/dist/kortix.js.map +1 -0
  18. package/dist/opencode/client.d.ts +89 -0
  19. package/dist/opencode/client.d.ts.map +1 -0
  20. package/dist/opencode/client.js +191 -0
  21. package/dist/opencode/client.js.map +1 -0
  22. package/dist/opencode/env.d.ts +13 -0
  23. package/dist/opencode/env.d.ts.map +1 -0
  24. package/dist/opencode/env.js +63 -0
  25. package/dist/opencode/env.js.map +1 -0
  26. package/dist/opencode/kortix-master.d.ts +487 -0
  27. package/dist/opencode/kortix-master.d.ts.map +1 -0
  28. package/dist/opencode/kortix-master.js +313 -0
  29. package/dist/opencode/kortix-master.js.map +1 -0
  30. package/dist/opencode/triggers.d.ts +6 -0
  31. package/dist/opencode/triggers.d.ts.map +1 -0
  32. package/dist/opencode/triggers.js +34 -0
  33. package/dist/opencode/triggers.js.map +1 -0
  34. package/dist/platform/api/errors.d.ts +106 -0
  35. package/dist/platform/api/errors.d.ts.map +1 -0
  36. package/dist/platform/api/errors.js +137 -0
  37. package/dist/platform/api/errors.js.map +1 -0
  38. package/dist/platform/api-client.d.ts +35 -0
  39. package/dist/platform/api-client.d.ts.map +1 -0
  40. package/dist/platform/api-client.js +279 -0
  41. package/dist/platform/api-client.js.map +1 -0
  42. package/dist/platform/auth-core.d.ts +60 -0
  43. package/dist/platform/auth-core.d.ts.map +1 -0
  44. package/dist/platform/auth-core.js +104 -0
  45. package/dist/platform/auth-core.js.map +1 -0
  46. package/dist/platform/auth.d.ts +88 -0
  47. package/dist/platform/auth.d.ts.map +1 -0
  48. package/dist/platform/auth.js +161 -0
  49. package/dist/platform/auth.js.map +1 -0
  50. package/dist/platform/config-node.d.ts +33 -0
  51. package/dist/platform/config-node.d.ts.map +1 -0
  52. package/dist/platform/config-node.js +63 -0
  53. package/dist/platform/config-node.js.map +1 -0
  54. package/dist/platform/config.d.ts +77 -0
  55. package/dist/platform/config.d.ts.map +1 -0
  56. package/dist/platform/config.js +62 -0
  57. package/dist/platform/config.js.map +1 -0
  58. package/dist/platform/feature-flags.d.ts +25 -0
  59. package/dist/platform/feature-flags.d.ts.map +1 -0
  60. package/dist/platform/feature-flags.js +114 -0
  61. package/dist/platform/feature-flags.js.map +1 -0
  62. package/dist/platform/fresh-sessions.d.ts +4 -0
  63. package/dist/platform/fresh-sessions.d.ts.map +1 -0
  64. package/dist/platform/fresh-sessions.js +22 -0
  65. package/dist/platform/fresh-sessions.js.map +1 -0
  66. package/dist/platform/instance-routes.d.ts +17 -0
  67. package/dist/platform/instance-routes.d.ts.map +1 -0
  68. package/dist/platform/instance-routes.js +105 -0
  69. package/dist/platform/instance-routes.js.map +1 -0
  70. package/dist/platform/logger.d.ts +20 -0
  71. package/dist/platform/logger.d.ts.map +1 -0
  72. package/dist/platform/logger.js +44 -0
  73. package/dist/platform/logger.js.map +1 -0
  74. package/dist/platform/opencode-errors.d.ts +20 -0
  75. package/dist/platform/opencode-errors.d.ts.map +1 -0
  76. package/dist/platform/opencode-errors.js +71 -0
  77. package/dist/platform/opencode-errors.js.map +1 -0
  78. package/dist/platform/platform-client/backups.d.ts +22 -0
  79. package/dist/platform/platform-client/backups.d.ts.map +1 -0
  80. package/dist/platform/platform-client/backups.js +16 -0
  81. package/dist/platform/platform-client/backups.js.map +1 -0
  82. package/dist/platform/platform-client/index.d.ts +21 -0
  83. package/dist/platform/platform-client/index.d.ts.map +1 -0
  84. package/dist/platform/platform-client/index.js +21 -0
  85. package/dist/platform/platform-client/index.js.map +1 -0
  86. package/dist/platform/platform-client/instance-admin.d.ts +67 -0
  87. package/dist/platform/platform-client/instance-admin.d.ts.map +1 -0
  88. package/dist/platform/platform-client/instance-admin.js +59 -0
  89. package/dist/platform/platform-client/instance-admin.js.map +1 -0
  90. package/dist/platform/platform-client/invites.d.ts +35 -0
  91. package/dist/platform/platform-client/invites.d.ts.map +1 -0
  92. package/dist/platform/platform-client/invites.js +25 -0
  93. package/dist/platform/platform-client/invites.js.map +1 -0
  94. package/dist/platform/platform-client/lifecycle.d.ts +78 -0
  95. package/dist/platform/platform-client/lifecycle.d.ts.map +1 -0
  96. package/dist/platform/platform-client/lifecycle.js +151 -0
  97. package/dist/platform/platform-client/lifecycle.js.map +1 -0
  98. package/dist/platform/platform-client/members.d.ts +81 -0
  99. package/dist/platform/platform-client/members.d.ts.map +1 -0
  100. package/dist/platform/platform-client/members.js +59 -0
  101. package/dist/platform/platform-client/members.js.map +1 -0
  102. package/dist/platform/platform-client/shared.d.ts +44 -0
  103. package/dist/platform/platform-client/shared.d.ts.map +1 -0
  104. package/dist/platform/platform-client/shared.js +177 -0
  105. package/dist/platform/platform-client/shared.js.map +1 -0
  106. package/dist/platform/platform-client/ssh.d.ts +29 -0
  107. package/dist/platform/platform-client/ssh.d.ts.map +1 -0
  108. package/dist/platform/platform-client/ssh.js +14 -0
  109. package/dist/platform/platform-client/ssh.js.map +1 -0
  110. package/dist/platform/platform-client/types.d.ts +56 -0
  111. package/dist/platform/platform-client/types.d.ts.map +1 -0
  112. package/dist/platform/platform-client/types.js +19 -0
  113. package/dist/platform/platform-client/types.js.map +1 -0
  114. package/dist/platform/platform-client/updates.d.ts +117 -0
  115. package/dist/platform/platform-client/updates.d.ts.map +1 -0
  116. package/dist/platform/platform-client/updates.js +97 -0
  117. package/dist/platform/platform-client/updates.js.map +1 -0
  118. package/dist/platform/platform-client/urls.d.ts +18 -0
  119. package/dist/platform/platform-client/urls.d.ts.map +1 -0
  120. package/dist/platform/platform-client/urls.js +31 -0
  121. package/dist/platform/platform-client/urls.js.map +1 -0
  122. package/dist/platform/projects-client/access.d.ts +273 -0
  123. package/dist/platform/projects-client/access.d.ts.map +1 -0
  124. package/dist/platform/projects-client/access.js +89 -0
  125. package/dist/platform/projects-client/access.js.map +1 -0
  126. package/dist/platform/projects-client/accounts.d.ts +184 -0
  127. package/dist/platform/projects-client/accounts.d.ts.map +1 -0
  128. package/dist/platform/projects-client/accounts.js +78 -0
  129. package/dist/platform/projects-client/accounts.js.map +1 -0
  130. package/dist/platform/projects-client/agent-config.d.ts +58 -0
  131. package/dist/platform/projects-client/agent-config.d.ts.map +1 -0
  132. package/dist/platform/projects-client/agent-config.js +9 -0
  133. package/dist/platform/projects-client/agent-config.js.map +1 -0
  134. package/dist/platform/projects-client/agent-scope.d.ts +12 -0
  135. package/dist/platform/projects-client/agent-scope.d.ts.map +1 -0
  136. package/dist/platform/projects-client/agent-scope.js +6 -0
  137. package/dist/platform/projects-client/agent-scope.js.map +1 -0
  138. package/dist/platform/projects-client/apps.d.ts +98 -0
  139. package/dist/platform/projects-client/apps.d.ts.map +1 -0
  140. package/dist/platform/projects-client/apps.js +29 -0
  141. package/dist/platform/projects-client/apps.js.map +1 -0
  142. package/dist/platform/projects-client/audit.d.ts +85 -0
  143. package/dist/platform/projects-client/audit.d.ts.map +1 -0
  144. package/dist/platform/projects-client/audit.js +51 -0
  145. package/dist/platform/projects-client/audit.js.map +1 -0
  146. package/dist/platform/projects-client/billing.d.ts +336 -0
  147. package/dist/platform/projects-client/billing.d.ts.map +1 -0
  148. package/dist/platform/projects-client/billing.js +260 -0
  149. package/dist/platform/projects-client/billing.js.map +1 -0
  150. package/dist/platform/projects-client/change-requests.d.ts +119 -0
  151. package/dist/platform/projects-client/change-requests.d.ts.map +1 -0
  152. package/dist/platform/projects-client/change-requests.js +56 -0
  153. package/dist/platform/projects-client/change-requests.js.map +1 -0
  154. package/dist/platform/projects-client/channels.d.ts +135 -0
  155. package/dist/platform/projects-client/channels.d.ts.map +1 -0
  156. package/dist/platform/projects-client/channels.js +103 -0
  157. package/dist/platform/projects-client/channels.js.map +1 -0
  158. package/dist/platform/projects-client/connectors.d.ts +148 -0
  159. package/dist/platform/projects-client/connectors.d.ts.map +1 -0
  160. package/dist/platform/projects-client/connectors.js +66 -0
  161. package/dist/platform/projects-client/connectors.js.map +1 -0
  162. package/dist/platform/projects-client/files.d.ts +37 -0
  163. package/dist/platform/projects-client/files.d.ts.map +1 -0
  164. package/dist/platform/projects-client/files.js +58 -0
  165. package/dist/platform/projects-client/files.js.map +1 -0
  166. package/dist/platform/projects-client/gateway.d.ts +177 -0
  167. package/dist/platform/projects-client/gateway.d.ts.map +1 -0
  168. package/dist/platform/projects-client/gateway.js +59 -0
  169. package/dist/platform/projects-client/gateway.js.map +1 -0
  170. package/dist/platform/projects-client/git-history.d.ts +74 -0
  171. package/dist/platform/projects-client/git-history.d.ts.map +1 -0
  172. package/dist/platform/projects-client/git-history.js +40 -0
  173. package/dist/platform/projects-client/git-history.js.map +1 -0
  174. package/dist/platform/projects-client/github.d.ts +62 -0
  175. package/dist/platform/projects-client/github.d.ts.map +1 -0
  176. package/dist/platform/projects-client/github.js +30 -0
  177. package/dist/platform/projects-client/github.js.map +1 -0
  178. package/dist/platform/projects-client/index.d.ts +32 -0
  179. package/dist/platform/projects-client/index.d.ts.map +1 -0
  180. package/dist/platform/projects-client/index.js +34 -0
  181. package/dist/platform/projects-client/index.js.map +1 -0
  182. package/dist/platform/projects-client/marketplace-catalog.d.ts +76 -0
  183. package/dist/platform/projects-client/marketplace-catalog.d.ts.map +1 -0
  184. package/dist/platform/projects-client/marketplace-catalog.js +48 -0
  185. package/dist/platform/projects-client/marketplace-catalog.js.map +1 -0
  186. package/dist/platform/projects-client/marketplace.d.ts +80 -0
  187. package/dist/platform/projects-client/marketplace.d.ts.map +1 -0
  188. package/dist/platform/projects-client/marketplace.js +52 -0
  189. package/dist/platform/projects-client/marketplace.js.map +1 -0
  190. package/dist/platform/projects-client/model-defaults.d.ts +36 -0
  191. package/dist/platform/projects-client/model-defaults.d.ts.map +1 -0
  192. package/dist/platform/projects-client/model-defaults.js +16 -0
  193. package/dist/platform/projects-client/model-defaults.js.map +1 -0
  194. package/dist/platform/projects-client/policies.d.ts +21 -0
  195. package/dist/platform/projects-client/policies.d.ts.map +1 -0
  196. package/dist/platform/projects-client/policies.js +10 -0
  197. package/dist/platform/projects-client/policies.js.map +1 -0
  198. package/dist/platform/projects-client/projects.d.ts +235 -0
  199. package/dist/platform/projects-client/projects.d.ts.map +1 -0
  200. package/dist/platform/projects-client/projects.js +161 -0
  201. package/dist/platform/projects-client/projects.js.map +1 -0
  202. package/dist/platform/projects-client/public-session-shares.d.ts +52 -0
  203. package/dist/platform/projects-client/public-session-shares.d.ts.map +1 -0
  204. package/dist/platform/projects-client/public-session-shares.js +54 -0
  205. package/dist/platform/projects-client/public-session-shares.js.map +1 -0
  206. package/dist/platform/projects-client/review.d.ts +57 -0
  207. package/dist/platform/projects-client/review.d.ts.map +1 -0
  208. package/dist/platform/projects-client/review.js +28 -0
  209. package/dist/platform/projects-client/review.js.map +1 -0
  210. package/dist/platform/projects-client/sandbox-shares.d.ts +25 -0
  211. package/dist/platform/projects-client/sandbox-shares.d.ts.map +1 -0
  212. package/dist/platform/projects-client/sandbox-shares.js +29 -0
  213. package/dist/platform/projects-client/sandbox-shares.js.map +1 -0
  214. package/dist/platform/projects-client/sandbox.d.ts +123 -0
  215. package/dist/platform/projects-client/sandbox.d.ts.map +1 -0
  216. package/dist/platform/projects-client/sandbox.js +45 -0
  217. package/dist/platform/projects-client/sandbox.js.map +1 -0
  218. package/dist/platform/projects-client/secrets.d.ts +122 -0
  219. package/dist/platform/projects-client/secrets.d.ts.map +1 -0
  220. package/dist/platform/projects-client/secrets.js +34 -0
  221. package/dist/platform/projects-client/secrets.js.map +1 -0
  222. package/dist/platform/projects-client/session-sandbox.d.ts +61 -0
  223. package/dist/platform/projects-client/session-sandbox.d.ts.map +1 -0
  224. package/dist/platform/projects-client/session-sandbox.js +82 -0
  225. package/dist/platform/projects-client/session-sandbox.js.map +1 -0
  226. package/dist/platform/projects-client/sessions.d.ts +216 -0
  227. package/dist/platform/projects-client/sessions.d.ts.map +1 -0
  228. package/dist/platform/projects-client/sessions.js +74 -0
  229. package/dist/platform/projects-client/sessions.js.map +1 -0
  230. package/dist/platform/projects-client/setup-links.d.ts +35 -0
  231. package/dist/platform/projects-client/setup-links.d.ts.map +1 -0
  232. package/dist/platform/projects-client/setup-links.js +24 -0
  233. package/dist/platform/projects-client/setup-links.js.map +1 -0
  234. package/dist/platform/projects-client/shared.d.ts +66 -0
  235. package/dist/platform/projects-client/shared.d.ts.map +1 -0
  236. package/dist/platform/projects-client/shared.js +44 -0
  237. package/dist/platform/projects-client/shared.js.map +1 -0
  238. package/dist/platform/projects-client/tokens.d.ts +77 -0
  239. package/dist/platform/projects-client/tokens.d.ts.map +1 -0
  240. package/dist/platform/projects-client/tokens.js +43 -0
  241. package/dist/platform/projects-client/tokens.js.map +1 -0
  242. package/dist/platform/projects-client/transcription.d.ts +5 -0
  243. package/dist/platform/projects-client/transcription.d.ts.map +1 -0
  244. package/dist/platform/projects-client/transcription.js +14 -0
  245. package/dist/platform/projects-client/transcription.js.map +1 -0
  246. package/dist/platform/projects-client/triggers.d.ts +102 -0
  247. package/dist/platform/projects-client/triggers.d.ts.map +1 -0
  248. package/dist/platform/projects-client/triggers.js +27 -0
  249. package/dist/platform/projects-client/triggers.js.map +1 -0
  250. package/dist/platform/session-id.d.ts +9 -0
  251. package/dist/platform/session-id.d.ts.map +1 -0
  252. package/dist/platform/session-id.js +23 -0
  253. package/dist/platform/session-id.js.map +1 -0
  254. package/dist/platform/storage/managed-storage.d.ts +97 -0
  255. package/dist/platform/storage/managed-storage.d.ts.map +1 -0
  256. package/dist/platform/storage/managed-storage.js +271 -0
  257. package/dist/platform/storage/managed-storage.js.map +1 -0
  258. package/dist/platform/strings.d.ts +12 -0
  259. package/dist/platform/strings.d.ts.map +1 -0
  260. package/dist/platform/strings.js +17 -0
  261. package/dist/platform/strings.js.map +1 -0
  262. package/dist/platform/ui.d.ts +11 -0
  263. package/dist/platform/ui.d.ts.map +1 -0
  264. package/dist/platform/ui.js +22 -0
  265. package/dist/platform/ui.js.map +1 -0
  266. package/dist/react/chat/index.d.ts +3 -0
  267. package/dist/react/chat/index.d.ts.map +1 -0
  268. package/dist/react/chat/index.js +7 -0
  269. package/dist/react/chat/index.js.map +1 -0
  270. package/dist/react/chat/render-parts.d.ts +39 -0
  271. package/dist/react/chat/render-parts.d.ts.map +1 -0
  272. package/dist/react/chat/render-parts.js +34 -0
  273. package/dist/react/chat/render-parts.js.map +1 -0
  274. package/dist/react/chat/use-chat-turns.d.ts +19 -0
  275. package/dist/react/chat/use-chat-turns.d.ts.map +1 -0
  276. package/dist/react/chat/use-chat-turns.js +27 -0
  277. package/dist/react/chat/use-chat-turns.js.map +1 -0
  278. package/dist/react/file-keys.d.ts +18 -0
  279. package/dist/react/file-keys.d.ts.map +1 -0
  280. package/dist/react/file-keys.js +18 -0
  281. package/dist/react/file-keys.js.map +1 -0
  282. package/dist/react/index.d.ts +12 -0
  283. package/dist/react/index.d.ts.map +1 -0
  284. package/dist/react/index.js +49 -0
  285. package/dist/react/index.js.map +1 -0
  286. package/dist/react/model-flatten.d.ts +33 -0
  287. package/dist/react/model-flatten.d.ts.map +1 -0
  288. package/dist/react/model-flatten.js +59 -0
  289. package/dist/react/model-flatten.js.map +1 -0
  290. package/dist/react/opencode.d.ts +43 -0
  291. package/dist/react/opencode.d.ts.map +1 -0
  292. package/dist/react/opencode.js +100 -0
  293. package/dist/react/opencode.js.map +1 -0
  294. package/dist/react/prefetch-session-start.d.ts +10 -0
  295. package/dist/react/prefetch-session-start.d.ts.map +1 -0
  296. package/dist/react/prefetch-session-start.js +17 -0
  297. package/dist/react/prefetch-session-start.js.map +1 -0
  298. package/dist/react/provider-refresh.d.ts +7 -0
  299. package/dist/react/provider-refresh.d.ts.map +1 -0
  300. package/dist/react/provider-refresh.js +28 -0
  301. package/dist/react/provider-refresh.js.map +1 -0
  302. package/dist/react/provider-selection.d.ts +31 -0
  303. package/dist/react/provider-selection.d.ts.map +1 -0
  304. package/dist/react/provider-selection.js +135 -0
  305. package/dist/react/provider-selection.js.map +1 -0
  306. package/dist/react/route-project.d.ts +7 -0
  307. package/dist/react/route-project.d.ts.map +1 -0
  308. package/dist/react/route-project.js +19 -0
  309. package/dist/react/route-project.js.map +1 -0
  310. package/dist/react/session-start-stash.d.ts +56 -0
  311. package/dist/react/session-start-stash.d.ts.map +1 -0
  312. package/dist/react/session-start-stash.js +202 -0
  313. package/dist/react/session-start-stash.js.map +1 -0
  314. package/dist/react/use-canonical-opencode-session.d.ts +35 -0
  315. package/dist/react/use-canonical-opencode-session.d.ts.map +1 -0
  316. package/dist/react/use-canonical-opencode-session.js +52 -0
  317. package/dist/react/use-canonical-opencode-session.js.map +1 -0
  318. package/dist/react/use-change-requests.d.ts +321 -0
  319. package/dist/react/use-change-requests.d.ts.map +1 -0
  320. package/dist/react/use-change-requests.js +43 -0
  321. package/dist/react/use-change-requests.js.map +1 -0
  322. package/dist/react/use-current-runtime.d.ts +8 -0
  323. package/dist/react/use-current-runtime.d.ts.map +1 -0
  324. package/dist/react/use-current-runtime.js +12 -0
  325. package/dist/react/use-current-runtime.js.map +1 -0
  326. package/dist/react/use-gateway-catalog-sync.d.ts +2 -0
  327. package/dist/react/use-gateway-catalog-sync.d.ts.map +1 -0
  328. package/dist/react/use-gateway-catalog-sync.js +39 -0
  329. package/dist/react/use-gateway-catalog-sync.js.map +1 -0
  330. package/dist/react/use-kortix-master.d.ts +384 -0
  331. package/dist/react/use-kortix-master.d.ts.map +1 -0
  332. package/dist/react/use-kortix-master.js +958 -0
  333. package/dist/react/use-kortix-master.js.map +1 -0
  334. package/dist/react/use-model-store.d.ts +71 -0
  335. package/dist/react/use-model-store.d.ts.map +1 -0
  336. package/dist/react/use-model-store.js +411 -0
  337. package/dist/react/use-model-store.js.map +1 -0
  338. package/dist/react/use-opencode-config.d.ts +15 -0
  339. package/dist/react/use-opencode-config.d.ts.map +1 -0
  340. package/dist/react/use-opencode-config.js +79 -0
  341. package/dist/react/use-opencode-config.js.map +1 -0
  342. package/dist/react/use-opencode-events/diagnostics.d.ts +11 -0
  343. package/dist/react/use-opencode-events/diagnostics.d.ts.map +1 -0
  344. package/dist/react/use-opencode-events/diagnostics.js +58 -0
  345. package/dist/react/use-opencode-events/diagnostics.js.map +1 -0
  346. package/dist/react/use-opencode-events/handle-event.d.ts +20 -0
  347. package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -0
  348. package/dist/react/use-opencode-events/handle-event.js +450 -0
  349. package/dist/react/use-opencode-events/handle-event.js.map +1 -0
  350. package/dist/react/use-opencode-events/helpers.d.ts +30 -0
  351. package/dist/react/use-opencode-events/helpers.d.ts.map +1 -0
  352. package/dist/react/use-opencode-events/helpers.js +93 -0
  353. package/dist/react/use-opencode-events/helpers.js.map +1 -0
  354. package/dist/react/use-opencode-events/index.d.ts +25 -0
  355. package/dist/react/use-opencode-events/index.d.ts.map +1 -0
  356. package/dist/react/use-opencode-events/index.js +242 -0
  357. package/dist/react/use-opencode-events/index.js.map +1 -0
  358. package/dist/react/use-opencode-events/types.d.ts +10 -0
  359. package/dist/react/use-opencode-events/types.d.ts.map +1 -0
  360. package/dist/react/use-opencode-events/types.js +2 -0
  361. package/dist/react/use-opencode-events/types.js.map +1 -0
  362. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts +22 -0
  363. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts.map +1 -0
  364. package/dist/react/use-opencode-events/use-event-stream-refs.js +158 -0
  365. package/dist/react/use-opencode-events/use-event-stream-refs.js.map +1 -0
  366. package/dist/react/use-opencode-local.d.ts +139 -0
  367. package/dist/react/use-opencode-local.d.ts.map +1 -0
  368. package/dist/react/use-opencode-local.js +484 -0
  369. package/dist/react/use-opencode-local.js.map +1 -0
  370. package/dist/react/use-opencode-mcp.d.ts +34 -0
  371. package/dist/react/use-opencode-mcp.d.ts.map +1 -0
  372. package/dist/react/use-opencode-mcp.js +190 -0
  373. package/dist/react/use-opencode-mcp.js.map +1 -0
  374. package/dist/react/use-opencode-pty.d.ts +30 -0
  375. package/dist/react/use-opencode-pty.d.ts.map +1 -0
  376. package/dist/react/use-opencode-pty.js +126 -0
  377. package/dist/react/use-opencode-pty.js.map +1 -0
  378. package/dist/react/use-opencode-sessions/agents.d.ts +14 -0
  379. package/dist/react/use-opencode-sessions/agents.d.ts.map +1 -0
  380. package/dist/react/use-opencode-sessions/agents.js +82 -0
  381. package/dist/react/use-opencode-sessions/agents.js.map +1 -0
  382. package/dist/react/use-opencode-sessions/commands.d.ts +8 -0
  383. package/dist/react/use-opencode-sessions/commands.d.ts.map +1 -0
  384. package/dist/react/use-opencode-sessions/commands.js +46 -0
  385. package/dist/react/use-opencode-sessions/commands.js.map +1 -0
  386. package/dist/react/use-opencode-sessions/files.d.ts +2 -0
  387. package/dist/react/use-opencode-sessions/files.d.ts.map +1 -0
  388. package/dist/react/use-opencode-sessions/files.js +181 -0
  389. package/dist/react/use-opencode-sessions/files.js.map +1 -0
  390. package/dist/react/use-opencode-sessions/index.d.ts +15 -0
  391. package/dist/react/use-opencode-sessions/index.d.ts.map +1 -0
  392. package/dist/react/use-opencode-sessions/index.js +21 -0
  393. package/dist/react/use-opencode-sessions/index.js.map +1 -0
  394. package/dist/react/use-opencode-sessions/keys.d.ts +94 -0
  395. package/dist/react/use-opencode-sessions/keys.d.ts.map +1 -0
  396. package/dist/react/use-opencode-sessions/keys.js +39 -0
  397. package/dist/react/use-opencode-sessions/keys.js.map +1 -0
  398. package/dist/react/use-opencode-sessions/mcp.d.ts +3 -0
  399. package/dist/react/use-opencode-sessions/mcp.d.ts.map +1 -0
  400. package/dist/react/use-opencode-sessions/mcp.js +23 -0
  401. package/dist/react/use-opencode-sessions/mcp.js.map +1 -0
  402. package/dist/react/use-opencode-sessions/messages.d.ts +75 -0
  403. package/dist/react/use-opencode-sessions/messages.d.ts.map +1 -0
  404. package/dist/react/use-opencode-sessions/messages.js +319 -0
  405. package/dist/react/use-opencode-sessions/messages.js.map +1 -0
  406. package/dist/react/use-opencode-sessions/parts.d.ts +23 -0
  407. package/dist/react/use-opencode-sessions/parts.d.ts.map +1 -0
  408. package/dist/react/use-opencode-sessions/parts.js +49 -0
  409. package/dist/react/use-opencode-sessions/parts.js.map +1 -0
  410. package/dist/react/use-opencode-sessions/permissions.d.ts +17 -0
  411. package/dist/react/use-opencode-sessions/permissions.d.ts.map +1 -0
  412. package/dist/react/use-opencode-sessions/permissions.js +66 -0
  413. package/dist/react/use-opencode-sessions/permissions.js.map +1 -0
  414. package/dist/react/use-opencode-sessions/projects.d.ts +5 -0
  415. package/dist/react/use-opencode-sessions/projects.d.ts.map +1 -0
  416. package/dist/react/use-opencode-sessions/projects.js +54 -0
  417. package/dist/react/use-opencode-sessions/projects.js.map +1 -0
  418. package/dist/react/use-opencode-sessions/providers.d.ts +10 -0
  419. package/dist/react/use-opencode-sessions/providers.d.ts.map +1 -0
  420. package/dist/react/use-opencode-sessions/providers.js +98 -0
  421. package/dist/react/use-opencode-sessions/providers.js.map +1 -0
  422. package/dist/react/use-opencode-sessions/sessions.d.ts +35 -0
  423. package/dist/react/use-opencode-sessions/sessions.d.ts.map +1 -0
  424. package/dist/react/use-opencode-sessions/sessions.js +380 -0
  425. package/dist/react/use-opencode-sessions/sessions.js.map +1 -0
  426. package/dist/react/use-opencode-sessions/shared.d.ts +43 -0
  427. package/dist/react/use-opencode-sessions/shared.d.ts.map +1 -0
  428. package/dist/react/use-opencode-sessions/shared.js +109 -0
  429. package/dist/react/use-opencode-sessions/shared.js.map +1 -0
  430. package/dist/react/use-opencode-sessions/sharing.d.ts +4 -0
  431. package/dist/react/use-opencode-sessions/sharing.d.ts.map +1 -0
  432. package/dist/react/use-opencode-sessions/sharing.js +57 -0
  433. package/dist/react/use-opencode-sessions/sharing.js.map +1 -0
  434. package/dist/react/use-opencode-sessions/tools.d.ts +5 -0
  435. package/dist/react/use-opencode-sessions/tools.d.ts.map +1 -0
  436. package/dist/react/use-opencode-sessions/tools.js +54 -0
  437. package/dist/react/use-opencode-sessions/tools.js.map +1 -0
  438. package/dist/react/use-permission-self-heal.d.ts +45 -0
  439. package/dist/react/use-permission-self-heal.d.ts.map +1 -0
  440. package/dist/react/use-permission-self-heal.js +144 -0
  441. package/dist/react/use-permission-self-heal.js.map +1 -0
  442. package/dist/react/use-project-config.d.ts +11 -0
  443. package/dist/react/use-project-config.d.ts.map +1 -0
  444. package/dist/react/use-project-config.js +22 -0
  445. package/dist/react/use-project-config.js.map +1 -0
  446. package/dist/react/use-project-models.d.ts +11 -0
  447. package/dist/react/use-project-models.d.ts.map +1 -0
  448. package/dist/react/use-project-models.js +25 -0
  449. package/dist/react/use-project-models.js.map +1 -0
  450. package/dist/react/use-project-secrets.d.ts +265 -0
  451. package/dist/react/use-project-secrets.d.ts.map +1 -0
  452. package/dist/react/use-project-secrets.js +41 -0
  453. package/dist/react/use-project-secrets.js.map +1 -0
  454. package/dist/react/use-project-triggers.d.ts +228 -0
  455. package/dist/react/use-project-triggers.d.ts.map +1 -0
  456. package/dist/react/use-project-triggers.js +42 -0
  457. package/dist/react/use-project-triggers.js.map +1 -0
  458. package/dist/react/use-question-self-heal.d.ts +36 -0
  459. package/dist/react/use-question-self-heal.d.ts.map +1 -0
  460. package/dist/react/use-question-self-heal.js +95 -0
  461. package/dist/react/use-question-self-heal.js.map +1 -0
  462. package/dist/react/use-runtime-phase.d.ts +9 -0
  463. package/dist/react/use-runtime-phase.d.ts.map +1 -0
  464. package/dist/react/use-runtime-phase.js +20 -0
  465. package/dist/react/use-runtime-phase.js.map +1 -0
  466. package/dist/react/use-runtime-reconnect.d.ts +90 -0
  467. package/dist/react/use-runtime-reconnect.d.ts.map +1 -0
  468. package/dist/react/use-runtime-reconnect.js +234 -0
  469. package/dist/react/use-runtime-reconnect.js.map +1 -0
  470. package/dist/react/use-session-picks.d.ts +17 -0
  471. package/dist/react/use-session-picks.d.ts.map +1 -0
  472. package/dist/react/use-session-picks.js +36 -0
  473. package/dist/react/use-session-picks.js.map +1 -0
  474. package/dist/react/use-session-prefetch.d.ts +18 -0
  475. package/dist/react/use-session-prefetch.d.ts.map +1 -0
  476. package/dist/react/use-session-prefetch.js +84 -0
  477. package/dist/react/use-session-prefetch.js.map +1 -0
  478. package/dist/react/use-session-send.d.ts +183 -0
  479. package/dist/react/use-session-send.d.ts.map +1 -0
  480. package/dist/react/use-session-send.js +287 -0
  481. package/dist/react/use-session-send.js.map +1 -0
  482. package/dist/react/use-session-sync.d.ts +24 -0
  483. package/dist/react/use-session-sync.d.ts.map +1 -0
  484. package/dist/react/use-session-sync.js +375 -0
  485. package/dist/react/use-session-sync.js.map +1 -0
  486. package/dist/react/use-session.d.ts +171 -0
  487. package/dist/react/use-session.d.ts.map +1 -0
  488. package/dist/react/use-session.js +396 -0
  489. package/dist/react/use-session.js.map +1 -0
  490. package/dist/react/use-visible-agents.d.ts +22 -0
  491. package/dist/react/use-visible-agents.d.ts.map +1 -0
  492. package/dist/react/use-visible-agents.js +45 -0
  493. package/dist/react/use-visible-agents.js.map +1 -0
  494. package/dist/server.d.ts +55 -0
  495. package/dist/server.d.ts.map +1 -0
  496. package/dist/server.js +122 -0
  497. package/dist/server.js.map +1 -0
  498. package/dist/session/health.d.ts +49 -0
  499. package/dist/session/health.d.ts.map +1 -0
  500. package/dist/session/health.js +57 -0
  501. package/dist/session/health.js.map +1 -0
  502. package/dist/session/index.d.ts +19 -0
  503. package/dist/session/index.d.ts.map +1 -0
  504. package/dist/session/index.js +19 -0
  505. package/dist/session/index.js.map +1 -0
  506. package/dist/session/preview.d.ts +24 -0
  507. package/dist/session/preview.d.ts.map +1 -0
  508. package/dist/session/preview.js +85 -0
  509. package/dist/session/preview.js.map +1 -0
  510. package/dist/session/url.d.ts +160 -0
  511. package/dist/session/url.d.ts.map +1 -0
  512. package/dist/session/url.js +522 -0
  513. package/dist/session/url.js.map +1 -0
  514. package/dist/state/chat-events.d.ts +141 -0
  515. package/dist/state/chat-events.d.ts.map +1 -0
  516. package/dist/state/chat-events.js +135 -0
  517. package/dist/state/chat-events.js.map +1 -0
  518. package/dist/state/current-runtime.d.ts +44 -0
  519. package/dist/state/current-runtime.d.ts.map +1 -0
  520. package/dist/state/current-runtime.js +44 -0
  521. package/dist/state/current-runtime.js.map +1 -0
  522. package/dist/state/diagnostics-store.d.ts +114 -0
  523. package/dist/state/diagnostics-store.d.ts.map +1 -0
  524. package/dist/state/diagnostics-store.js +319 -0
  525. package/dist/state/diagnostics-store.js.map +1 -0
  526. package/dist/state/event-stream.d.ts +134 -0
  527. package/dist/state/event-stream.d.ts.map +1 -0
  528. package/dist/state/event-stream.js +424 -0
  529. package/dist/state/event-stream.js.map +1 -0
  530. package/dist/state/idb-sync-cache.d.ts +18 -0
  531. package/dist/state/idb-sync-cache.d.ts.map +1 -0
  532. package/dist/state/idb-sync-cache.js +209 -0
  533. package/dist/state/idb-sync-cache.js.map +1 -0
  534. package/dist/state/opencode-compaction-store.d.ts +10 -0
  535. package/dist/state/opencode-compaction-store.d.ts.map +1 -0
  536. package/dist/state/opencode-compaction-store.js +32 -0
  537. package/dist/state/opencode-compaction-store.js.map +1 -0
  538. package/dist/state/opencode-pending-store.d.ts +19 -0
  539. package/dist/state/opencode-pending-store.d.ts.map +1 -0
  540. package/dist/state/opencode-pending-store.js +76 -0
  541. package/dist/state/opencode-pending-store.js.map +1 -0
  542. package/dist/state/sandbox-connection-store.d.ts +62 -0
  543. package/dist/state/sandbox-connection-store.d.ts.map +1 -0
  544. package/dist/state/sandbox-connection-store.js +290 -0
  545. package/dist/state/sandbox-connection-store.js.map +1 -0
  546. package/dist/state/server-store/active.d.ts +49 -0
  547. package/dist/state/server-store/active.d.ts.map +1 -0
  548. package/dist/state/server-store/active.js +76 -0
  549. package/dist/state/server-store/active.js.map +1 -0
  550. package/dist/state/server-store/types.d.ts +12 -0
  551. package/dist/state/server-store/types.d.ts.map +1 -0
  552. package/dist/state/server-store/types.js +2 -0
  553. package/dist/state/server-store/types.js.map +1 -0
  554. package/dist/state/server-store/url-helpers.d.ts +33 -0
  555. package/dist/state/server-store/url-helpers.d.ts.map +1 -0
  556. package/dist/state/server-store/url-helpers.js +55 -0
  557. package/dist/state/server-store/url-helpers.js.map +1 -0
  558. package/dist/state/server-store.d.ts +18 -0
  559. package/dist/state/server-store.d.ts.map +1 -0
  560. package/dist/state/server-store.js +23 -0
  561. package/dist/state/server-store.js.map +1 -0
  562. package/dist/state/session-runtime-registry.d.ts +49 -0
  563. package/dist/state/session-runtime-registry.d.ts.map +1 -0
  564. package/dist/state/session-runtime-registry.js +85 -0
  565. package/dist/state/session-runtime-registry.js.map +1 -0
  566. package/dist/state/sync-store/ascending-id.d.ts +2 -0
  567. package/dist/state/sync-store/ascending-id.d.ts.map +1 -0
  568. package/dist/state/sync-store/ascending-id.js +21 -0
  569. package/dist/state/sync-store/ascending-id.js.map +1 -0
  570. package/dist/state/sync-store/binary.d.ts +7 -0
  571. package/dist/state/sync-store/binary.d.ts.map +1 -0
  572. package/dist/state/sync-store/binary.js +21 -0
  573. package/dist/state/sync-store/binary.js.map +1 -0
  574. package/dist/state/sync-store/stream-cache.d.ts +2 -0
  575. package/dist/state/sync-store/stream-cache.d.ts.map +1 -0
  576. package/dist/state/sync-store/stream-cache.js +29 -0
  577. package/dist/state/sync-store/stream-cache.js.map +1 -0
  578. package/dist/state/sync-store/types.d.ts +29 -0
  579. package/dist/state/sync-store/types.d.ts.map +1 -0
  580. package/dist/state/sync-store/types.js +2 -0
  581. package/dist/state/sync-store/types.js.map +1 -0
  582. package/dist/state/sync-store.d.ts +39 -0
  583. package/dist/state/sync-store.d.ts.map +1 -0
  584. package/dist/state/sync-store.js +692 -0
  585. package/dist/state/sync-store.js.map +1 -0
  586. package/dist/state/tab-store.d.ts +91 -0
  587. package/dist/state/tab-store.d.ts.map +1 -0
  588. package/dist/state/tab-store.js +369 -0
  589. package/dist/state/tab-store.js.map +1 -0
  590. package/dist/transcript.d.ts +40 -0
  591. package/dist/transcript.d.ts.map +1 -0
  592. package/dist/transcript.js +126 -0
  593. package/dist/transcript.js.map +1 -0
  594. package/dist/turns/classify.d.ts +166 -0
  595. package/dist/turns/classify.d.ts.map +1 -0
  596. package/dist/turns/classify.js +259 -0
  597. package/dist/turns/classify.js.map +1 -0
  598. package/dist/turns/errors.d.ts +11 -0
  599. package/dist/turns/errors.d.ts.map +1 -0
  600. package/dist/turns/errors.js +85 -0
  601. package/dist/turns/errors.js.map +1 -0
  602. package/dist/turns/index.d.ts +264 -0
  603. package/dist/turns/index.d.ts.map +1 -0
  604. package/dist/turns/index.js +1243 -0
  605. package/dist/turns/index.js.map +1 -0
  606. package/dist/turns/tool-registry.d.ts +33 -0
  607. package/dist/turns/tool-registry.d.ts.map +1 -0
  608. package/dist/turns/tool-registry.js +108 -0
  609. package/dist/turns/tool-registry.js.map +1 -0
  610. package/dist/turns/types.d.ts +125 -0
  611. package/dist/turns/types.d.ts.map +1 -0
  612. package/dist/turns/types.js +12 -0
  613. package/dist/turns/types.js.map +1 -0
  614. package/dist/turns/view-model.d.ts +127 -0
  615. package/dist/turns/view-model.d.ts.map +1 -0
  616. package/dist/turns/view-model.js +401 -0
  617. package/dist/turns/view-model.js.map +1 -0
  618. package/package.json +155 -0
@@ -0,0 +1,522 @@
1
+ /**
2
+ * Sandbox URL detection and rewriting utilities.
3
+ *
4
+ * Detects localhost URLs in agent output (e.g. "Website is live at http://localhost:8080")
5
+ * and rewrites them to subdomain-based preview URLs (like ngrok):
6
+ *
7
+ * http://p{port}-{sandboxId}.localhost:{backendPort}/{path}
8
+ *
9
+ * The subdomain scheme means the proxied app thinks it's at root `/` — absolute
10
+ * paths, Service Workers, WebSocket connections all work without any rewriting.
11
+ * Auth is handled via a cookie set on the first `?token=` authenticated request.
12
+ */
13
+ import { SANDBOX_PORTS } from '../platform/platform-client/types.js';
14
+ // ── Constants ────────────────────────────────────────────────────────────────
15
+ /**
16
+ * Regex to detect localhost URLs in text.
17
+ * Matches: http://localhost:PORT, http://127.0.0.1:PORT, https://localhost:PORT
18
+ * Captures optional path, query string, and fragment.
19
+ * Does NOT match bare localhost without a port (too ambiguous).
20
+ */
21
+ const LOCALHOST_URL_REGEX = /https?:\/\/(?:localhost|127\.0\.0\.1):\d{1,5}[^\s)"'<>]*/g;
22
+ /**
23
+ * Regex to parse subdomain preview URLs.
24
+ * Matches: http://p{port}-{sandboxId}.localhost:{backendPort}/{path}
25
+ */
26
+ const SUBDOMAIN_URL_REGEX = /^https?:\/\/p(\d+)-([^.]+)\.localhost(?::(\d+))?(\/.*)?$/;
27
+ /**
28
+ * Ports that should NOT be rewritten — they're already exposed/handled natively
29
+ * by the sandbox infrastructure (VNC, OpenCode Web, presentation viewer, etc.)
30
+ */
31
+ const EXCLUDED_PORTS = new Set([
32
+ 22, // SSH daemon — never preview/probe as HTTP
33
+ 4096, // OpenCode API (proxied by Kortix Master)
34
+ parseInt(SANDBOX_PORTS.KORTIX_MASTER, 10), // Kortix Master itself
35
+ ]);
36
+ // ── Internal helpers ─────────────────────────────────────────────────────────
37
+ /**
38
+ * Check if a URL is a subdomain preview URL (p{port}-{sandboxId}.localhost).
39
+ */
40
+ function isSubdomainUrl(url) {
41
+ return SUBDOMAIN_URL_REGEX.test(url);
42
+ }
43
+ function normalizePath(path) {
44
+ if (!path)
45
+ return '/';
46
+ let normalized = path;
47
+ // Guard against markdown-link artifacts leaking into URL paths.
48
+ const markdownBoundary = normalized.indexOf('](');
49
+ if (markdownBoundary !== -1) {
50
+ normalized = normalized.slice(0, markdownBoundary);
51
+ }
52
+ // Same guard after browser-encoding (`]` -> `%5D`).
53
+ const encodedBoundary = normalized.toLowerCase().indexOf('%5d(');
54
+ if (encodedBoundary !== -1) {
55
+ normalized = normalized.slice(0, encodedBoundary);
56
+ }
57
+ if (!normalized)
58
+ return '/';
59
+ return normalized.startsWith('/') ? normalized : `/${normalized}`;
60
+ }
61
+ /**
62
+ * Markdown/plain-text extraction can include trailing markdown syntax when the
63
+ * link label is itself a URL, e.g.:
64
+ * [http://localhost:3210/viewer.html](http://localhost:3210/viewer.html)
65
+ * Trim that markdown boundary before URL parsing.
66
+ */
67
+ function stripMarkdownArtifacts(url) {
68
+ const markerIndex = url.indexOf('](');
69
+ if (markerIndex === -1)
70
+ return url;
71
+ return url.slice(0, markerIndex);
72
+ }
73
+ const LEADING_WRAPPERS = new Set(["'", '"', '`', '<', '(', '[']);
74
+ const TRAILING_WRAPPERS = new Set(['>', "'", '"', '`', ')', ']', ',', ';', '.', '!', '?']);
75
+ function stripUrlWrappers(url) {
76
+ let start = 0;
77
+ let end = url.length;
78
+ while (start < end && (url[start] === ' ' || url[start] === '\t'))
79
+ start++;
80
+ while (end > start && (url[end - 1] === ' ' || url[end - 1] === '\t'))
81
+ end--;
82
+ while (start < end && LEADING_WRAPPERS.has(url[start]))
83
+ start++;
84
+ while (end > start && TRAILING_WRAPPERS.has(url[end - 1]))
85
+ end--;
86
+ return url.slice(start, end);
87
+ }
88
+ function extractLocalhostCandidate(text) {
89
+ const match = text.match(/https?:\/\/(?:localhost|127\.0\.0\.1):\d{1,5}[^\s"'<>)]*/i);
90
+ return match?.[0] ?? null;
91
+ }
92
+ // ── Public API ───────────────────────────────────────────────────────────────
93
+ /**
94
+ * Regex to detect Kortix Master proxy URLs: localhost:8000/proxy/{port}/...
95
+ * The agent inside the sandbox sees these URLs; the frontend needs to
96
+ * extract the real service port and remaining path.
97
+ */
98
+ const KORTIX_MASTER_PROXY_REGEX = /^\/proxy\/(\d{1,5})(\/.*)?$/;
99
+ /**
100
+ * Known frontend app route prefixes. URLs with these pathnames on
101
+ * localhost/127.0.0.1 are same-app navigations, NOT sandbox services
102
+ * to proxy. They should render as plain clickable links.
103
+ */
104
+ const APP_ROUTE_PREFIXES = /^\/(connectors|settings|dashboard|projects|agents|skills|tools|commands|deployments|support|changelog|files|p|browser|desktop|terminal|sessions|services|workspace|channels|scheduled-tasks|marketplace|templates|tunnel|admin|auth)(\/|$|\?)/;
105
+ export function isAppRouteUrl(rawUrl) {
106
+ if (!rawUrl)
107
+ return false;
108
+ try {
109
+ const parsed = new URL(rawUrl);
110
+ if (parsed.hostname !== 'localhost' && parsed.hostname !== '127.0.0.1')
111
+ return false;
112
+ return APP_ROUTE_PREFIXES.test(parsed.pathname);
113
+ }
114
+ catch {
115
+ return false;
116
+ }
117
+ }
118
+ /**
119
+ * Parse a localhost URL in one place so all consumers share identical rules.
120
+ *
121
+ * Handles a special case: `http://localhost:8000/proxy/{port}/{path}` URLs
122
+ * from inside the sandbox (Kortix Master). These are rewritten to appear as
123
+ * `localhost:{port}/{path}` so they get proxied correctly.
124
+ */
125
+ export function parseLocalhostUrl(rawUrl) {
126
+ if (!rawUrl)
127
+ return null;
128
+ const candidate = stripUrlWrappers(stripMarkdownArtifacts(rawUrl.trim()));
129
+ // Already-proxied subdomain preview URL:
130
+ // http://p{port}-{sandboxId}.localhost:{backendPort}/{path}
131
+ // Treat as an internal localhost URL so callers can render it like any
132
+ // other live service URL.
133
+ const subdomain = parseSubdomainUrl(candidate);
134
+ if (subdomain) {
135
+ const path = normalizePath(subdomain.path || '/');
136
+ return {
137
+ originalUrl: `http://localhost:${subdomain.port}${path}`,
138
+ port: subdomain.port,
139
+ path,
140
+ };
141
+ }
142
+ try {
143
+ const parsed = new URL(candidate);
144
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
145
+ return null;
146
+ if (parsed.hostname !== 'localhost' && parsed.hostname !== '127.0.0.1')
147
+ return null;
148
+ if (!parsed.port)
149
+ return null;
150
+ let port = parseInt(parsed.port, 10);
151
+ if (!Number.isInteger(port) || port < 1 || port > 65535)
152
+ return null;
153
+ let pathStr = `${parsed.pathname || '/'}${parsed.search}${parsed.hash}`;
154
+ // Special case: localhost:8000/proxy/{port}/... (Kortix Master proxy URL).
155
+ // Extract the real port and remaining path so detection/rewriting works.
156
+ const kortixMasterPort = parseInt(SANDBOX_PORTS.KORTIX_MASTER, 10);
157
+ if (port === kortixMasterPort) {
158
+ const proxyMatch = parsed.pathname.match(KORTIX_MASTER_PROXY_REGEX);
159
+ if (proxyMatch) {
160
+ const realPort = parseInt(proxyMatch[1], 10);
161
+ if (realPort >= 1 && realPort <= 65535) {
162
+ port = realPort;
163
+ pathStr = normalizePath(`${proxyMatch[2] || '/'}${parsed.search}${parsed.hash}`);
164
+ return {
165
+ originalUrl: `http://localhost:${port}${pathStr}`,
166
+ port,
167
+ path: pathStr,
168
+ };
169
+ }
170
+ }
171
+ }
172
+ const path = normalizePath(pathStr);
173
+ return {
174
+ originalUrl: `${parsed.protocol}//${parsed.hostname}:${port}${path}`,
175
+ port,
176
+ path,
177
+ };
178
+ }
179
+ catch {
180
+ // Fallback: some tool outputs embed the localhost URL inside additional
181
+ // prose. Extract the first localhost URL and parse it.
182
+ const extracted = extractLocalhostCandidate(rawUrl);
183
+ if (extracted && extracted !== rawUrl) {
184
+ return parseLocalhostUrl(extracted);
185
+ }
186
+ return null;
187
+ }
188
+ }
189
+ /**
190
+ * Build a sorted array of [start, end] ranges covering all fenced code blocks
191
+ * (```...```) and inline code spans (`...`) in the markdown text.
192
+ * Used to exclude URLs that appear inside code from generating preview cards.
193
+ */
194
+ function getCodeRanges(text) {
195
+ const ranges = [];
196
+ // Fenced code blocks: ```...``` (may have language specifier on opening line)
197
+ const fencedRegex = /```[\s\S]*?```/g;
198
+ let m;
199
+ while ((m = fencedRegex.exec(text)) !== null) {
200
+ ranges.push([m.index, m.index + m[0].length]);
201
+ }
202
+ // Inline code spans: `...` (but not inside already-found fenced blocks)
203
+ const inlineRegex = /`[^`\n]+`/g;
204
+ while ((m = inlineRegex.exec(text)) !== null) {
205
+ const start = m.index;
206
+ const end = start + m[0].length;
207
+ // Only add if not already inside a fenced block range
208
+ const insideFenced = ranges.some(([rs, re]) => start >= rs && end <= re);
209
+ if (!insideFenced) {
210
+ ranges.push([start, end]);
211
+ }
212
+ }
213
+ return ranges;
214
+ }
215
+ /**
216
+ * Check if an index falls inside any of the given ranges.
217
+ */
218
+ function isInsideCodeBlock(index, ranges) {
219
+ return ranges.some(([start, end]) => index >= start && index < end);
220
+ }
221
+ /**
222
+ * Detect all localhost URLs in a text string.
223
+ * Tags each result with `inCodeBlock` so consumers can render URLs found
224
+ * inside markdown code blocks / inline code differently (e.g. compact chips
225
+ * instead of full preview cards with iframes).
226
+ */
227
+ export function detectLocalhostUrls(text) {
228
+ const results = [];
229
+ const seen = new Set();
230
+ const codeRanges = getCodeRanges(text);
231
+ // Reset regex state
232
+ LOCALHOST_URL_REGEX.lastIndex = 0;
233
+ let match;
234
+ while ((match = LOCALHOST_URL_REGEX.exec(text)) !== null) {
235
+ const parsed = parseLocalhostUrl(match[0]);
236
+ if (!parsed)
237
+ continue;
238
+ const { originalUrl, port, path } = parsed;
239
+ // Skip invalid ports or excluded infrastructure ports
240
+ if (port < 1 || port > 65535 || EXCLUDED_PORTS.has(port))
241
+ continue;
242
+ // Deduplicate
243
+ if (seen.has(originalUrl))
244
+ continue;
245
+ seen.add(originalUrl);
246
+ results.push({
247
+ originalUrl,
248
+ port,
249
+ path,
250
+ startIndex: match.index,
251
+ endIndex: match.index + originalUrl.length,
252
+ inCodeBlock: isInsideCodeBlock(match.index, codeRanges),
253
+ });
254
+ }
255
+ return results;
256
+ }
257
+ /**
258
+ * Check if a string contains any localhost URLs worth rewriting.
259
+ */
260
+ export function hasLocalhostUrls(text) {
261
+ return detectLocalhostUrls(text).length > 0;
262
+ }
263
+ /**
264
+ * Detect whether the kortix-api backend is on the user's own machine
265
+ * (i.e. apiBaseUrl hostname is localhost/127.0.0.1).
266
+ *
267
+ * This — NOT where the browser is running — is the correct trigger for picking
268
+ * between subdomain and path-based proxy. The subdomain proxy works by having
269
+ * `*.localhost:{backendPort}` resolve to 127.0.0.1 on the user's machine. That
270
+ * only reaches kortix-api if kortix-api is ALSO running on the user's machine.
271
+ * If the backend lives remotely, *.localhost:8008 points at whatever the user
272
+ * happens to have running locally — which is exactly the "internal browser
273
+ * literally loads localhost" bug.
274
+ */
275
+ function isBackendOnLocalhost(apiBaseUrl) {
276
+ try {
277
+ const { hostname } = new URL(apiBaseUrl);
278
+ return hostname === 'localhost' || hostname === '127.0.0.1';
279
+ }
280
+ catch {
281
+ return false;
282
+ }
283
+ }
284
+ /**
285
+ * Build a preview proxy URL for a sandbox service port.
286
+ *
287
+ * Both modes are proxy URLs — neither connects to the user's raw localhost.
288
+ * The provider is irrelevant; the only thing that matters is whether kortix-api
289
+ * is running on the user's local machine, because that determines whether
290
+ * *.localhost DNS can reach it.
291
+ *
292
+ * - **Subdomain** (backend local): `http://p{port}-{sandboxId}.localhost:{backendPort}/{path}`
293
+ * Transparent mode — the proxied app thinks it's at root `/`. Only works
294
+ * when kortix-api is on 127.0.0.1.
295
+ *
296
+ * - **Path-based** (backend remote): `{apiBaseUrl}/p/{sandboxId}/{port}/{path}`
297
+ * Goes through Caddy → API → sandbox. Used for all deployed setups.
298
+ *
299
+ * @example
300
+ * // Local dev: → 'http://p3210-sb-abc123.localhost:8008/viewer.html'
301
+ * // Deployed back: → 'https://e2e-test.kortix.cloud/v1/p/sb-abc123/3210/viewer.html'
302
+ */
303
+ export function rewriteLocalhostUrl(port, path, subdomainOpts) {
304
+ const safePath = normalizePath(path);
305
+ // Path-based proxy whenever the backend is NOT on the user's machine.
306
+ // The subdomain scheme below relies on *.localhost DNS pointing at 127.0.0.1
307
+ // (browser-native) to reach kortix-api. That only works when kortix-api is
308
+ // actually on the user's box. Otherwise we always go path-based through the
309
+ // public API base URL (which terminates at whichever ingress fronts the API).
310
+ if (!isBackendOnLocalhost(subdomainOpts.apiBaseUrl)) {
311
+ // Linear trailing-slash strip — the regex form (/\/+$/) backtracks
312
+ // quadratically on adversarial input (CodeQL js/polynomial-redos).
313
+ let baseEnd = subdomainOpts.apiBaseUrl.length;
314
+ while (baseEnd > 0 && subdomainOpts.apiBaseUrl.charCodeAt(baseEnd - 1) === 47 /* '/' */)
315
+ baseEnd--;
316
+ const base = subdomainOpts.apiBaseUrl.slice(0, baseEnd);
317
+ return `${base}/p/${subdomainOpts.sandboxId}/${port}${safePath}`;
318
+ }
319
+ // Subdomain proxy — true HTTP passthrough.
320
+ //
321
+ // The proxied app sees itself at root `/`, so absolute paths, redirects
322
+ // (Location: /foo), service workers, WebSockets, and any framework that
323
+ // assumes root-mounting all work natively. The API has a top-level Bun
324
+ // fetch handler (apps/api/src/sandbox-proxy/subdomain.ts) that matches
325
+ // this hostname pattern, validates first-request auth, and forwards.
326
+ return `http://p${port}-${subdomainOpts.sandboxId}.localhost:${subdomainOpts.backendPort}${safePath}`;
327
+ }
328
+ /**
329
+ * Build the proxy base URL for a given port (without path).
330
+ * Used for opening preview tabs.
331
+ */
332
+ export function getProxyBaseUrl(port, subdomainOpts) {
333
+ return rewriteLocalhostUrl(port, '/', subdomainOpts);
334
+ }
335
+ /**
336
+ * Check if a URL is a localhost URL that we can proxy.
337
+ * Excludes infrastructure ports AND the current app's own port so we never
338
+ * rewrite the frontend's own navigation links.
339
+ * Also excludes URLs that are already subdomain preview URLs.
340
+ */
341
+ export function isProxiableLocalhostUrl(url) {
342
+ const parsed = parseLocalhostUrl(url);
343
+ if (!parsed)
344
+ return false;
345
+ if (EXCLUDED_PORTS.has(parsed.port))
346
+ return false;
347
+ // If the URL is a known frontend app route (e.g. /settings or /dashboard) it must NOT be proxied — it is a navigation link to
348
+ // the local frontend, not a sandbox service.
349
+ if (isAppRouteUrl(url))
350
+ return false;
351
+ return true;
352
+ }
353
+ /**
354
+ * If the given URL points to localhost:PORT, rewrite it through the sandbox
355
+ * proxy layer. Returns the original URL unchanged when it doesn't match or
356
+ * targets an excluded infrastructure port.
357
+ *
358
+ * This is the catch-all intended for use inside markdown renderers so that
359
+ * every `<a href>`, `<img src>`, etc. that references a sandbox service
360
+ * automatically gets proxied.
361
+ */
362
+ export function proxyLocalhostUrl(url, subdomainOpts) {
363
+ if (!url)
364
+ return url;
365
+ const parsed = parseLocalhostUrl(url);
366
+ if (!parsed)
367
+ return url;
368
+ // Don't rewrite URLs pointing at the app itself or already-proxied URLs
369
+ if (!isProxiableLocalhostUrl(parsed.originalUrl))
370
+ return parsed.originalUrl;
371
+ return rewriteLocalhostUrl(parsed.port, parsed.path, subdomainOpts);
372
+ }
373
+ /**
374
+ * Build the internal (container-side) localhost URL for a given port + path.
375
+ * This is what the user sees as the "real" address inside the sandbox.
376
+ *
377
+ * @example toInternalUrl(8080, '/api/docs') → 'http://localhost:8080/api/docs'
378
+ */
379
+ export function toInternalUrl(port, path = '/') {
380
+ return `http://localhost:${port}${path}`;
381
+ }
382
+ /**
383
+ * Regex to detect path-based proxy URLs:
384
+ * https://domain/v1/p/{sandboxId}/{port}/{path}
385
+ */
386
+ const PATH_PROXY_URL_REGEX = /^https?:\/\/[^/]+\/v1\/p\/([^/]+)\/(\d+)(\/.*)?$/;
387
+ /**
388
+ * Parse a preview proxy URL back to its components.
389
+ * Handles both subdomain and path-based formats:
390
+ *
391
+ * Subdomain: http://p3210-sb-abc123.localhost:8008/viewer.html
392
+ * Path: https://e2e-test.kortix.cloud/v1/p/sb-abc123/3210/viewer.html
393
+ */
394
+ export function parseSubdomainUrl(url) {
395
+ // Try subdomain format first
396
+ const subMatch = url.match(SUBDOMAIN_URL_REGEX);
397
+ if (subMatch) {
398
+ return {
399
+ port: parseInt(subMatch[1], 10),
400
+ sandboxId: subMatch[2],
401
+ backendPort: subMatch[3] ? parseInt(subMatch[3], 10) : 80,
402
+ path: subMatch[4] || '/',
403
+ };
404
+ }
405
+ // Try path-based format: /v1/p/{sandboxId}/{port}/{path}
406
+ const pathMatch = url.match(PATH_PROXY_URL_REGEX);
407
+ if (pathMatch) {
408
+ try {
409
+ const parsed = new URL(url);
410
+ return {
411
+ port: parseInt(pathMatch[2], 10),
412
+ sandboxId: pathMatch[1],
413
+ backendPort: parseInt(parsed.port, 10) || (parsed.protocol === 'https:' ? 443 : 80),
414
+ path: pathMatch[3] || '/',
415
+ };
416
+ }
417
+ catch {
418
+ return null;
419
+ }
420
+ }
421
+ return null;
422
+ }
423
+ /**
424
+ * Try to reverse-map a proxy URL back to its internal localhost equivalent.
425
+ *
426
+ * Handles `http://p{port}-{sandboxId}.localhost:{backendPort}/{path}` →
427
+ * `http://localhost:{port}{path}`.
428
+ *
429
+ * Returns null if the URL can't be reverse-mapped.
430
+ */
431
+ export function proxyUrlToInternal(proxyUrl) {
432
+ try {
433
+ // Subdomain URL — http://p{port}-{sandboxId}.localhost:{backendPort}/{path}
434
+ const subdomain = parseSubdomainUrl(proxyUrl);
435
+ if (subdomain) {
436
+ return `http://localhost:${subdomain.port}${subdomain.path}`;
437
+ }
438
+ return null;
439
+ }
440
+ catch {
441
+ return null;
442
+ }
443
+ }
444
+ /**
445
+ * Check if a URL is already a preview proxy URL (subdomain or path-based).
446
+ * Use this to prevent double-proxying.
447
+ */
448
+ export function isPreviewUrl(url) {
449
+ return isSubdomainUrl(url) || PATH_PROXY_URL_REGEX.test(url);
450
+ }
451
+ // ── Web Forward Proxy Utilities ─────────────────────────────────────────────
452
+ const WEB_PROXY_PATH_PREFIX = '/web-proxy/';
453
+ /**
454
+ * Build a web proxy URL that routes through the Kortix Master (port 8000)
455
+ * which hosts the /web-proxy/ forward proxy.
456
+ *
457
+ * The web proxy lives on Kortix Master, NOT the OpenCode server, so we
458
+ * construct a URL targeting port 8000 via the standard sandbox preview proxy.
459
+ */
460
+ export function buildWebProxyUrl(targetUrl, subdomainOpts) {
461
+ try {
462
+ const parsed = new URL(targetUrl);
463
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
464
+ return null;
465
+ const scheme = parsed.protocol.replace(':', '');
466
+ const proxyPath = `${WEB_PROXY_PATH_PREFIX}${scheme}/${parsed.host}${parsed.pathname}${parsed.search}${parsed.hash}`;
467
+ const kmPort = parseInt(SANDBOX_PORTS.KORTIX_MASTER, 10); // 8000
468
+ const baseUrl = rewriteLocalhostUrl(kmPort, '/', subdomainOpts);
469
+ return `${baseUrl.replace(/\/$/, '')}${proxyPath}`;
470
+ }
471
+ catch {
472
+ return null;
473
+ }
474
+ }
475
+ export function parseWebProxyUrl(proxyUrl) {
476
+ try {
477
+ const url = new URL(proxyUrl);
478
+ const wpIdx = url.pathname.indexOf(WEB_PROXY_PATH_PREFIX);
479
+ if (wpIdx === -1)
480
+ return null;
481
+ const remainder = url.pathname.slice(wpIdx + WEB_PROXY_PATH_PREFIX.length);
482
+ const match = remainder.match(/^(https?)\/([\w.\-]+(?::\d+)?)(\/.*)?$/);
483
+ if (!match)
484
+ return null;
485
+ const scheme = match[1];
486
+ const host = match[2];
487
+ const path = match[3] || '/';
488
+ return `${scheme}://${host}${path}${url.search}${url.hash}`;
489
+ }
490
+ catch {
491
+ return null;
492
+ }
493
+ }
494
+ export function isWebProxyUrl(url) {
495
+ try {
496
+ return new URL(url).pathname.includes(WEB_PROXY_PATH_PREFIX);
497
+ }
498
+ catch {
499
+ return url.includes(WEB_PROXY_PATH_PREFIX);
500
+ }
501
+ }
502
+ export function isExternalUrl(rawUrl) {
503
+ if (!rawUrl)
504
+ return false;
505
+ const trimmed = rawUrl.trim();
506
+ if (/^https?:\/\/(?!localhost|127\.0\.0\.1)/i.test(trimmed))
507
+ return true;
508
+ if (/^[a-z0-9][\w.-]*\.[a-z]{2,}/i.test(trimmed))
509
+ return true;
510
+ return false;
511
+ }
512
+ export function normalizeExternalInput(input) {
513
+ const trimmed = input.trim();
514
+ if (!trimmed)
515
+ return null;
516
+ if (/^https?:\/\//i.test(trimmed))
517
+ return trimmed;
518
+ if (/^[a-z0-9][\w.-]*\.[a-z]{2,}/i.test(trimmed))
519
+ return `https://${trimmed}`;
520
+ return null;
521
+ }
522
+ //# s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