@hanzo/dev 4.0.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (371) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
  3. package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
  4. package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
  5. package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
  6. package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
  7. package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
  8. package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
  9. package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
  10. package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
  11. package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
  12. package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
  13. package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
  14. package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
  15. package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
  16. package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
  17. package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
  18. package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
  19. package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
  20. package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
  21. package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
  22. package/dist/builder/activity.d.ts +16 -0
  23. package/dist/builder/activity.js +51 -0
  24. package/dist/builder/address.d.ts +11 -0
  25. package/dist/builder/address.js +50 -0
  26. package/dist/builder/ago.d.ts +2 -0
  27. package/dist/builder/ago.js +18 -0
  28. package/dist/builder/api/agents.d.ts +139 -0
  29. package/dist/builder/api/agents.js +253 -0
  30. package/dist/builder/api/auto.d.ts +166 -0
  31. package/dist/builder/api/auto.js +300 -0
  32. package/dist/builder/api/billing.d.ts +263 -0
  33. package/dist/builder/api/billing.js +401 -0
  34. package/dist/builder/api/call.d.ts +53 -0
  35. package/dist/builder/api/call.js +123 -0
  36. package/dist/builder/api/capabilities.d.ts +14 -0
  37. package/dist/builder/api/capabilities.js +41 -0
  38. package/dist/builder/api/changes.d.ts +74 -0
  39. package/dist/builder/api/changes.js +75 -0
  40. package/dist/builder/api/chat.d.ts +12 -0
  41. package/dist/builder/api/chat.js +28 -0
  42. package/dist/builder/api/cli.d.ts +59 -0
  43. package/dist/builder/api/cli.js +133 -0
  44. package/dist/builder/api/codebases.d.ts +46 -0
  45. package/dist/builder/api/codebases.js +100 -0
  46. package/dist/builder/api/coding.d.ts +117 -0
  47. package/dist/builder/api/coding.js +222 -0
  48. package/dist/builder/api/connectors.d.ts +76 -0
  49. package/dist/builder/api/connectors.js +111 -0
  50. package/dist/builder/api/consent.d.ts +22 -0
  51. package/dist/builder/api/consent.js +28 -0
  52. package/dist/builder/api/conversations.d.ts +20 -0
  53. package/dist/builder/api/conversations.js +23 -0
  54. package/dist/builder/api/draft.d.ts +38 -0
  55. package/dist/builder/api/draft.js +87 -0
  56. package/dist/builder/api/environment.d.ts +55 -0
  57. package/dist/builder/api/environment.js +126 -0
  58. package/dist/builder/api/gallery.d.ts +32 -0
  59. package/dist/builder/api/gallery.js +85 -0
  60. package/dist/builder/api/git.d.ts +59 -0
  61. package/dist/builder/api/git.js +117 -0
  62. package/dist/builder/api/github.d.ts +230 -0
  63. package/dist/builder/api/github.js +373 -0
  64. package/dist/builder/api/keys.d.ts +35 -0
  65. package/dist/builder/api/keys.js +72 -0
  66. package/dist/builder/api/library.d.ts +116 -0
  67. package/dist/builder/api/library.js +214 -0
  68. package/dist/builder/api/limits.d.ts +69 -0
  69. package/dist/builder/api/limits.js +86 -0
  70. package/dist/builder/api/links.d.ts +51 -0
  71. package/dist/builder/api/links.js +75 -0
  72. package/dist/builder/api/machines.d.ts +122 -0
  73. package/dist/builder/api/machines.js +238 -0
  74. package/dist/builder/api/mcp.d.ts +10 -0
  75. package/dist/builder/api/mcp.js +47 -0
  76. package/dist/builder/api/members.d.ts +35 -0
  77. package/dist/builder/api/members.js +95 -0
  78. package/dist/builder/api/memory.d.ts +14 -0
  79. package/dist/builder/api/memory.js +35 -0
  80. package/dist/builder/api/models.d.ts +17 -0
  81. package/dist/builder/api/models.js +20 -0
  82. package/dist/builder/api/places.d.ts +32 -0
  83. package/dist/builder/api/places.js +29 -0
  84. package/dist/builder/api/platform.d.ts +68 -0
  85. package/dist/builder/api/platform.js +87 -0
  86. package/dist/builder/api/plugins.d.ts +42 -0
  87. package/dist/builder/api/plugins.js +175 -0
  88. package/dist/builder/api/pref.d.ts +77 -0
  89. package/dist/builder/api/pref.js +93 -0
  90. package/dist/builder/api/profile.d.ts +11 -0
  91. package/dist/builder/api/profile.js +41 -0
  92. package/dist/builder/api/projects.d.ts +99 -0
  93. package/dist/builder/api/projects.js +166 -0
  94. package/dist/builder/api/provider.d.ts +49 -0
  95. package/dist/builder/api/provider.js +96 -0
  96. package/dist/builder/api/sandbox.d.ts +90 -0
  97. package/dist/builder/api/sandbox.js +223 -0
  98. package/dist/builder/api/sessions.d.ts +123 -0
  99. package/dist/builder/api/sessions.js +255 -0
  100. package/dist/builder/api/skills.d.ts +82 -0
  101. package/dist/builder/api/skills.js +117 -0
  102. package/dist/builder/api/sse.d.ts +24 -0
  103. package/dist/builder/api/sse.js +68 -0
  104. package/dist/builder/api/studio.d.ts +59 -0
  105. package/dist/builder/api/studio.js +91 -0
  106. package/dist/builder/api/talk.d.ts +48 -0
  107. package/dist/builder/api/talk.js +81 -0
  108. package/dist/builder/api/tools.d.ts +34 -0
  109. package/dist/builder/api/tools.js +37 -0
  110. package/dist/builder/api/turn.d.ts +202 -0
  111. package/dist/builder/api/turn.js +772 -0
  112. package/dist/builder/api/verdict.d.ts +3 -0
  113. package/dist/builder/api/verdict.js +21 -0
  114. package/dist/builder/api/webhooks.d.ts +47 -0
  115. package/dist/builder/api/webhooks.js +82 -0
  116. package/dist/builder/api/work.d.ts +110 -0
  117. package/dist/builder/api/work.js +218 -0
  118. package/dist/builder/ask.d.ts +51 -0
  119. package/dist/builder/ask.js +147 -0
  120. package/dist/builder/automations.d.ts +33 -0
  121. package/dist/builder/automations.js +453 -0
  122. package/dist/builder/awake.d.ts +24 -0
  123. package/dist/builder/awake.js +68 -0
  124. package/dist/builder/back.d.ts +30 -0
  125. package/dist/builder/back.js +105 -0
  126. package/dist/builder/builder.d.ts +12 -0
  127. package/dist/builder/builder.js +162 -0
  128. package/dist/builder/carry.d.ts +48 -0
  129. package/dist/builder/carry.js +278 -0
  130. package/dist/builder/choice.d.ts +134 -0
  131. package/dist/builder/choice.js +152 -0
  132. package/dist/builder/claims.d.ts +13 -0
  133. package/dist/builder/claims.js +35 -0
  134. package/dist/builder/clipboard.d.ts +2 -0
  135. package/dist/builder/clipboard.js +10 -0
  136. package/dist/builder/customize/agents.d.ts +11 -0
  137. package/dist/builder/customize/agents.js +513 -0
  138. package/dist/builder/customize/connectors.d.ts +2 -0
  139. package/dist/builder/customize/connectors.js +319 -0
  140. package/dist/builder/customize/drafted.d.ts +4 -0
  141. package/dist/builder/customize/drafted.js +92 -0
  142. package/dist/builder/customize/index.d.ts +8 -0
  143. package/dist/builder/customize/index.js +127 -0
  144. package/dist/builder/customize/inventory.d.ts +14 -0
  145. package/dist/builder/customize/inventory.js +127 -0
  146. package/dist/builder/customize/load.d.ts +9 -0
  147. package/dist/builder/customize/load.js +22 -0
  148. package/dist/builder/customize/ocean.d.ts +41 -0
  149. package/dist/builder/customize/ocean.js +332 -0
  150. package/dist/builder/customize/plugins.d.ts +2 -0
  151. package/dist/builder/customize/plugins.js +136 -0
  152. package/dist/builder/customize/roles.d.ts +4 -0
  153. package/dist/builder/customize/roles.js +105 -0
  154. package/dist/builder/customize/say.d.ts +13 -0
  155. package/dist/builder/customize/say.js +32 -0
  156. package/dist/builder/customize/skills.d.ts +2 -0
  157. package/dist/builder/customize/skills.js +208 -0
  158. package/dist/builder/customize/ui.d.ts +152 -0
  159. package/dist/builder/customize/ui.js +208 -0
  160. package/dist/builder/data.d.ts +57 -0
  161. package/dist/builder/data.js +322 -0
  162. package/dist/builder/design.d.ts +140 -0
  163. package/dist/builder/design.js +175 -0
  164. package/dist/builder/desk.d.ts +48 -0
  165. package/dist/builder/desk.js +449 -0
  166. package/dist/builder/dev-mode.d.ts +43 -0
  167. package/dist/builder/dev-mode.js +120 -0
  168. package/dist/builder/door.d.ts +11 -0
  169. package/dist/builder/door.js +126 -0
  170. package/dist/builder/environment.d.ts +23 -0
  171. package/dist/builder/environment.js +193 -0
  172. package/dist/builder/files.d.ts +23 -0
  173. package/dist/builder/files.js +175 -0
  174. package/dist/builder/find.d.ts +7 -0
  175. package/dist/builder/find.js +80 -0
  176. package/dist/builder/foot.d.ts +30 -0
  177. package/dist/builder/foot.js +79 -0
  178. package/dist/builder/forge.d.ts +4 -0
  179. package/dist/builder/forge.js +639 -0
  180. package/dist/builder/gear.d.ts +60 -0
  181. package/dist/builder/gear.js +180 -0
  182. package/dist/builder/git.d.ts +21 -0
  183. package/dist/builder/git.js +118 -0
  184. package/dist/builder/github-sync.d.ts +70 -0
  185. package/dist/builder/github-sync.js +435 -0
  186. package/dist/builder/gutter.d.ts +17 -0
  187. package/dist/builder/gutter.js +25 -0
  188. package/dist/builder/handoff.d.ts +8 -0
  189. package/dist/builder/handoff.js +22 -0
  190. package/dist/builder/host.d.ts +189 -0
  191. package/dist/builder/host.js +46 -0
  192. package/dist/builder/index.d.ts +108 -0
  193. package/dist/builder/index.js +99 -0
  194. package/dist/builder/landing.d.ts +34 -0
  195. package/dist/builder/landing.js +725 -0
  196. package/dist/builder/library.d.ts +21 -0
  197. package/dist/builder/library.js +526 -0
  198. package/dist/builder/local.d.ts +80 -0
  199. package/dist/builder/local.js +124 -0
  200. package/dist/builder/make.d.ts +10 -0
  201. package/dist/builder/make.js +120 -0
  202. package/dist/builder/markdown.d.ts +49 -0
  203. package/dist/builder/markdown.js +125 -0
  204. package/dist/builder/marks.d.ts +15 -0
  205. package/dist/builder/marks.js +18 -0
  206. package/dist/builder/merge.d.ts +223 -0
  207. package/dist/builder/merge.js +380 -0
  208. package/dist/builder/meter.d.ts +31 -0
  209. package/dist/builder/meter.js +54 -0
  210. package/dist/builder/mind.d.ts +107 -0
  211. package/dist/builder/mind.js +335 -0
  212. package/dist/builder/names.d.ts +40 -0
  213. package/dist/builder/names.js +189 -0
  214. package/dist/builder/nav.d.ts +28 -0
  215. package/dist/builder/nav.js +218 -0
  216. package/dist/builder/out.d.ts +16 -0
  217. package/dist/builder/out.js +24 -0
  218. package/dist/builder/page.d.ts +55 -0
  219. package/dist/builder/page.js +217 -0
  220. package/dist/builder/pane.d.ts +30 -0
  221. package/dist/builder/pane.js +21 -0
  222. package/dist/builder/panel.d.ts +101 -0
  223. package/dist/builder/panel.js +408 -0
  224. package/dist/builder/pdf.d.ts +139 -0
  225. package/dist/builder/pdf.js +847 -0
  226. package/dist/builder/pick.d.ts +10 -0
  227. package/dist/builder/pick.js +38 -0
  228. package/dist/builder/plain.d.ts +59 -0
  229. package/dist/builder/plain.js +209 -0
  230. package/dist/builder/plan.d.ts +63 -0
  231. package/dist/builder/plan.js +155 -0
  232. package/dist/builder/plans.d.ts +1 -0
  233. package/dist/builder/plans.js +157 -0
  234. package/dist/builder/plugin.d.ts +60 -0
  235. package/dist/builder/plugin.js +1 -0
  236. package/dist/builder/plugins/design.d.ts +8 -0
  237. package/dist/builder/plugins/design.js +71 -0
  238. package/dist/builder/plugins/index.d.ts +46 -0
  239. package/dist/builder/plugins/index.js +117 -0
  240. package/dist/builder/plugins/pdf.d.ts +18 -0
  241. package/dist/builder/plugins/pdf.js +83 -0
  242. package/dist/builder/plugins/project.d.ts +5 -0
  243. package/dist/builder/plugins/project.js +68 -0
  244. package/dist/builder/plugins/research.d.ts +24 -0
  245. package/dist/builder/plugins/research.js +147 -0
  246. package/dist/builder/plugins/sketch.d.ts +9 -0
  247. package/dist/builder/plugins/sketch.js +101 -0
  248. package/dist/builder/plugins/slides.d.ts +14 -0
  249. package/dist/builder/plugins/slides.js +55 -0
  250. package/dist/builder/plugins/template.d.ts +13 -0
  251. package/dist/builder/plugins/template.js +95 -0
  252. package/dist/builder/prefs.d.ts +29 -0
  253. package/dist/builder/prefs.js +91 -0
  254. package/dist/builder/preview-url.d.ts +47 -0
  255. package/dist/builder/preview-url.js +107 -0
  256. package/dist/builder/project.d.ts +18 -0
  257. package/dist/builder/project.js +604 -0
  258. package/dist/builder/prose.d.ts +4 -0
  259. package/dist/builder/prose.js +57 -0
  260. package/dist/builder/publish.d.ts +18 -0
  261. package/dist/builder/publish.js +141 -0
  262. package/dist/builder/question.d.ts +33 -0
  263. package/dist/builder/question.js +64 -0
  264. package/dist/builder/redesign.d.ts +32 -0
  265. package/dist/builder/redesign.js +117 -0
  266. package/dist/builder/removal.d.ts +71 -0
  267. package/dist/builder/removal.js +73 -0
  268. package/dist/builder/reply.d.ts +50 -0
  269. package/dist/builder/reply.js +196 -0
  270. package/dist/builder/roles.d.ts +10 -0
  271. package/dist/builder/roles.js +28 -0
  272. package/dist/builder/route.d.ts +85 -0
  273. package/dist/builder/route.js +126 -0
  274. package/dist/builder/run.d.ts +4 -0
  275. package/dist/builder/run.js +804 -0
  276. package/dist/builder/runmeta.d.ts +16 -0
  277. package/dist/builder/runmeta.js +69 -0
  278. package/dist/builder/say.d.ts +2 -0
  279. package/dist/builder/say.js +7 -0
  280. package/dist/builder/scheduled.d.ts +3 -0
  281. package/dist/builder/scheduled.js +328 -0
  282. package/dist/builder/section.d.ts +27 -0
  283. package/dist/builder/section.js +60 -0
  284. package/dist/builder/settings/account.d.ts +1 -0
  285. package/dist/builder/settings/account.js +111 -0
  286. package/dist/builder/settings/billing.d.ts +1 -0
  287. package/dist/builder/settings/billing.js +210 -0
  288. package/dist/builder/settings/capabilities.d.ts +1 -0
  289. package/dist/builder/settings/capabilities.js +66 -0
  290. package/dist/builder/settings/card.d.ts +31 -0
  291. package/dist/builder/settings/card.js +140 -0
  292. package/dist/builder/settings/code.d.ts +1 -0
  293. package/dist/builder/settings/code.js +70 -0
  294. package/dist/builder/settings/credits.d.ts +10 -0
  295. package/dist/builder/settings/credits.js +123 -0
  296. package/dist/builder/settings/environments.d.ts +1 -0
  297. package/dist/builder/settings/environments.js +60 -0
  298. package/dist/builder/settings/general.d.ts +1 -0
  299. package/dist/builder/settings/general.js +58 -0
  300. package/dist/builder/settings/index.d.ts +4 -0
  301. package/dist/builder/settings/index.js +25 -0
  302. package/dist/builder/settings/integrations.d.ts +8 -0
  303. package/dist/builder/settings/integrations.js +138 -0
  304. package/dist/builder/settings/keys.d.ts +1 -0
  305. package/dist/builder/settings/keys.js +114 -0
  306. package/dist/builder/settings/list.d.ts +10 -0
  307. package/dist/builder/settings/list.js +28 -0
  308. package/dist/builder/settings/machines.d.ts +4 -0
  309. package/dist/builder/settings/machines.js +243 -0
  310. package/dist/builder/settings/members.d.ts +1 -0
  311. package/dist/builder/settings/members.js +77 -0
  312. package/dist/builder/settings/memory.d.ts +1 -0
  313. package/dist/builder/settings/memory.js +62 -0
  314. package/dist/builder/settings/notifications.d.ts +1 -0
  315. package/dist/builder/settings/notifications.js +111 -0
  316. package/dist/builder/settings/plan.d.ts +17 -0
  317. package/dist/builder/settings/plan.js +131 -0
  318. package/dist/builder/settings/privacy.d.ts +1 -0
  319. package/dist/builder/settings/privacy.js +76 -0
  320. package/dist/builder/settings/sections.d.ts +16 -0
  321. package/dist/builder/settings/sections.js +34 -0
  322. package/dist/builder/settings/shared.d.ts +6 -0
  323. package/dist/builder/settings/shared.js +58 -0
  324. package/dist/builder/settings/ui.d.ts +50 -0
  325. package/dist/builder/settings/ui.js +53 -0
  326. package/dist/builder/settings/usage.d.ts +1 -0
  327. package/dist/builder/settings/usage.js +24 -0
  328. package/dist/builder/shared.d.ts +26 -0
  329. package/dist/builder/shared.js +15 -0
  330. package/dist/builder/shelf.d.ts +16 -0
  331. package/dist/builder/shelf.js +219 -0
  332. package/dist/builder/side.d.ts +40 -0
  333. package/dist/builder/side.js +208 -0
  334. package/dist/builder/site.d.ts +75 -0
  335. package/dist/builder/site.js +138 -0
  336. package/dist/builder/spend.d.ts +21 -0
  337. package/dist/builder/spend.js +80 -0
  338. package/dist/builder/standing.d.ts +36 -0
  339. package/dist/builder/standing.js +66 -0
  340. package/dist/builder/suggest.d.ts +238 -0
  341. package/dist/builder/suggest.js +463 -0
  342. package/dist/builder/suggestions.d.ts +49 -0
  343. package/dist/builder/suggestions.js +260 -0
  344. package/dist/builder/summary.d.ts +60 -0
  345. package/dist/builder/summary.js +81 -0
  346. package/dist/builder/sync.d.ts +1 -0
  347. package/dist/builder/sync.js +187 -0
  348. package/dist/builder/tabs.d.ts +85 -0
  349. package/dist/builder/tabs.js +288 -0
  350. package/dist/builder/talk.d.ts +5 -0
  351. package/dist/builder/talk.js +108 -0
  352. package/dist/builder/thread.d.ts +60 -0
  353. package/dist/builder/thread.js +302 -0
  354. package/dist/builder/tools.d.ts +22 -0
  355. package/dist/builder/tools.js +52 -0
  356. package/dist/builder/transcript.d.ts +47 -0
  357. package/dist/builder/transcript.js +108 -0
  358. package/dist/builder/voice.d.ts +8 -0
  359. package/dist/builder/voice.js +24 -0
  360. package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
  361. package/dist/core.js +1 -0
  362. package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
  363. package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
  364. package/dist/index.d.ts +2 -0
  365. package/dist/index.js +2 -1
  366. package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
  367. package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
  368. package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
  369. package/package.json +101 -11
  370. /package/{index.d.ts → dist/core.d.ts} +0 -0
  371. /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * A person's API keys, each its own credential: as many as they like, of either
3
+ * type — secret (sk-, it belongs on a server) or publishable (pk-, safe in a
4
+ * page's source).
5
+ *
6
+ * GET /v1/account/keys {keys: [{id, name, type, prefix, key?, status, limit?, created, …}]}
7
+ * POST /v1/account/keys {name, type, limit?} → the key, its secret answered once
8
+ * DELETE /v1/account/keys/{id} revoke exactly that one; it stays listed as revoked
9
+ *
10
+ * Creating a key never touches another. A secret key is answered once and by its
11
+ * prefix after; a publishable key is public by construction and always comes back
12
+ * whole. A limit only narrows what a key may reach — `model:zen5`,
13
+ * `project:acme`, `product:train`, `read:*`.
14
+ */
15
+ import { phrase } from '@hanzo/i18n';
16
+ import { call, Sentence } from './call.js';
17
+ export const KINDS = ['secret', 'publishable'];
18
+ const str = (v) => (typeof v === 'string' ? v : '');
19
+ const list = (v) => (Array.isArray(v) ? v.filter((s) => typeof s === 'string' && s !== '') : []);
20
+ const kind = (v) => (KINDS.includes(v) ? v : null);
21
+ export async function keys(t) {
22
+ const r = await call(t, 'GET', '/v1/account/keys');
23
+ const rows = Array.isArray(r?.keys) ? r.keys : [];
24
+ const out = [];
25
+ for (const raw of rows) {
26
+ const o = (raw && typeof raw === 'object' ? raw : {});
27
+ const type = kind(o.type);
28
+ if (!type || !str(o.id))
29
+ continue;
30
+ out.push({
31
+ id: str(o.id),
32
+ name: str(o.name),
33
+ type,
34
+ prefix: str(o.prefix),
35
+ key: str(o.key),
36
+ status: str(o.status) || 'active',
37
+ limit: list(o.limit),
38
+ created: str(o.created),
39
+ });
40
+ }
41
+ return out;
42
+ }
43
+ /** A `kind:name` limit: a lowercase kind, a colon, and a name or `*`. */
44
+ export const LIMIT = /^[a-z][a-z0-9-]*:[^\s,:]+$/;
45
+ /** The limits a person typed, split on commas and spaces; throws on the first that is not one. */
46
+ export function limits(raw) {
47
+ const out = raw
48
+ .split(/[\s,]+/)
49
+ .map((s) => s.trim())
50
+ .filter(Boolean);
51
+ const bad = out.find((s) => !LIMIT.test(s));
52
+ if (bad)
53
+ throw new Sentence(phrase('{limit} is not a limit — write it as kind:name, like model:zen5'), { limit: bad });
54
+ return out;
55
+ }
56
+ /** Create a new key beside the ones held. The answer is the only time a secret key is shown. */
57
+ export async function mint(t, type, name = '', limit = []) {
58
+ const body = { type };
59
+ if (name.trim())
60
+ body.name = name.trim();
61
+ if (limit.length)
62
+ body.limit = limit;
63
+ const r = await call(t, 'POST', '/v1/account/keys', body);
64
+ const key = str(r?.key);
65
+ if (!key)
66
+ throw new Error(phrase('The platform answered no key'));
67
+ return { id: str(r?.id), name: str(r?.name), type: kind(r?.type) ?? type, key, limit: list(r?.limit) };
68
+ }
69
+ /** Revoke exactly one key, by id. Every other key keeps working. */
70
+ export async function revoke(t, id) {
71
+ await call(t, 'DELETE', `/v1/account/keys/${encodeURIComponent(id)}`);
72
+ }
@@ -0,0 +1,116 @@
1
+ import { type Target } from './call.ts';
2
+ export declare const KIND_IDS: readonly ['image', 'video', 'audio', 'document', 'slides', 'type', 'model', 'code', 'file'];
3
+ export type Kind = (typeof KIND_IDS)[number];
4
+ /** The kinds a reader narrows to, in the order the Library lists them, '' being all; each label English and marked (`phrase`), drawn through `t`. */
5
+ export declare const KINDS: readonly {
6
+ id: Kind | '';
7
+ label: string;
8
+ }[];
9
+ export declare const SOURCES: readonly ['chat', 'dev', 'studio', 'workflow'];
10
+ export type Source = (typeof SOURCES)[number];
11
+ export type Scope = 'all' | 'mine' | 'shared';
12
+ /** A product, as a person names it: Chat, Dev and Studio are names, and Workflow a word, marked (`phrase`). */
13
+ export declare const SOURCE: Record<Source, string>;
14
+ export interface Item {
15
+ id: string;
16
+ kind: Kind;
17
+ source: Source;
18
+ name: string;
19
+ mime: string;
20
+ bytes: number;
21
+ width: number;
22
+ height: number;
23
+ seconds: number;
24
+ pages: number;
25
+ /** The subject that made it. */
26
+ owner: string;
27
+ /** The reader made it. */
28
+ mine: boolean;
29
+ /** Its owner shared it with the org. */
30
+ shared: boolean;
31
+ project: string;
32
+ /** What made it: a conversation, a Dev run, a Studio run, an automation's run. */
33
+ ref: string;
34
+ /** The app path back to what made it, or '' for none. */
35
+ origin: string;
36
+ /** The original, to open in place. */
37
+ url: string;
38
+ /** The original, as a download. */
39
+ download: string;
40
+ /** A still that shows it, or ''. An image is its own. */
41
+ preview: string;
42
+ expires: string;
43
+ created: string;
44
+ updated: string;
45
+ }
46
+ /** What a list is narrowed to. */
47
+ export interface Filter {
48
+ kind?: Kind | '';
49
+ source?: Source | '';
50
+ ref?: string;
51
+ project?: string;
52
+ q?: string;
53
+ /** RFC 3339 bounds on when an item was made. */
54
+ since?: string;
55
+ until?: string;
56
+ scope?: Scope;
57
+ limit?: number;
58
+ cursor?: string;
59
+ }
60
+ export interface Page {
61
+ data: Item[];
62
+ /** The cursor of the next page, or '' at the end. */
63
+ next: string;
64
+ }
65
+ /** An app path back to what made an item: under this origin, never another's. */
66
+ export declare const inApp: (v: unknown) => string;
67
+ /** One item as the platform answers it, or null for a row with no id. */
68
+ export declare function item(raw: unknown): Item | null;
69
+ export declare function items(t: Target, f?: Filter, init?: {
70
+ signal?: AbortSignal;
71
+ }): Promise<Page>;
72
+ export declare function get(t: Target, id: string): Promise<Item>;
73
+ /** What an upload says about where a thing came from. */
74
+ export interface Made {
75
+ source: Source;
76
+ kind?: Kind;
77
+ ref?: string;
78
+ origin?: string;
79
+ project?: string;
80
+ /** The same owner, source and key answer the item already made. */
81
+ key?: string;
82
+ width?: number;
83
+ height?: number;
84
+ seconds?: number;
85
+ pages?: number;
86
+ }
87
+ /** The largest thing an inline upload carries; larger files up to `MAX` reserve a signed PUT. */
88
+ export declare const INLINE: number;
89
+ /** The largest thing one upload carries (2 GiB). */
90
+ export declare const MAX: number;
91
+ /** Bytes as base64, in chunks a call stack holds. */
92
+ export declare function base64(bytes: Uint8Array): string;
93
+ /** Keep a file in the Library. */
94
+ export declare function upload(t: Target, file: {
95
+ name: string;
96
+ type: string;
97
+ bytes?: Uint8Array;
98
+ blob?: Blob;
99
+ }, made: Made): Promise<Item>;
100
+ export interface Change {
101
+ name?: string;
102
+ shared?: boolean;
103
+ project?: string;
104
+ commit?: boolean;
105
+ }
106
+ export declare function change(t: Target, id: string, c: Change): Promise<Item>;
107
+ export declare function remove(t: Target, id: string): Promise<void>;
108
+ /** A size the way a person reads it. */
109
+ export declare function size(bytes: number): string;
110
+ /** The day an instant falls on, as a section of the Library: Today, Yesterday (English, marked), then the month. */
111
+ export declare function day(iso: string, now?: Date): string;
112
+ /** Items under the day each was made, in the order given (newest first). */
113
+ export declare function days(list: Item[], now?: Date): {
114
+ label: string;
115
+ rows: Item[];
116
+ }[];
@@ -0,0 +1,214 @@
1
+ /**
2
+ * The Library: everything a person made, in Chat, Dev, Studio and workflows, in
3
+ * one index.
4
+ *
5
+ * GET /v1/library {data: [item], next} newest first, filtered
6
+ * GET /v1/library/{id} one item, with fresh signed URLs
7
+ * POST /v1/library keep one: its bytes as base64, at most 10 MiB
8
+ * PATCH /v1/library/{id} rename, share with the org, move to a project
9
+ * DELETE /v1/library/{id} its row and its bytes
10
+ *
11
+ * An item is its owner's; another member of the org reads it only once its owner
12
+ * shares it, and changes it never. Its `url`, `download` and `preview` are
13
+ * signed and stop working at `expires`: read the item again for fresh ones.
14
+ */
15
+ import { phrase } from '@hanzo/i18n';
16
+ import { call, query, seg, Sentence } from './call.js';
17
+ export const KIND_IDS = ['image', 'video', 'audio', 'document', 'slides', 'type', 'model', 'code', 'file'];
18
+ /** The kinds a reader narrows to, in the order the Library lists them, '' being all; each label English and marked (`phrase`), drawn through `t`. */
19
+ export const KINDS = [
20
+ { id: '', label: phrase('All') },
21
+ { id: 'image', label: phrase('Images') },
22
+ { id: 'video', label: phrase('Videos') },
23
+ { id: 'audio', label: phrase('Audio') },
24
+ { id: 'document', label: phrase('Documents') },
25
+ { id: 'slides', label: phrase('Slides') },
26
+ { id: 'model', label: phrase('3D') },
27
+ { id: 'code', label: phrase('Code') },
28
+ { id: 'file', label: phrase('Files') },
29
+ ];
30
+ export const SOURCES = ['chat', 'dev', 'studio', 'workflow'];
31
+ /** A product, as a person names it: Chat, Dev and Studio are names, and Workflow a word, marked (`phrase`). */
32
+ export const SOURCE = { chat: 'Chat', dev: 'Dev', studio: 'Studio', workflow: phrase('Workflow') };
33
+ const str = (v) => (typeof v === 'string' ? v : '');
34
+ const num = (v) => (typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : 0);
35
+ const obj = (v) => (v && typeof v === 'object' ? v : {});
36
+ /** A signed address: https, and nothing a link could be made to run. */
37
+ const signed = (v) => (/^https:\/\//.test(str(v)) ? str(v) : '');
38
+ /** An app path back to what made an item: under this origin, never another's. */
39
+ export const inApp = (v) => {
40
+ const s = str(v);
41
+ return s.startsWith('/') && !s.startsWith('//') && !s.startsWith('/\\') ? s : '';
42
+ };
43
+ /** One item as the platform answers it, or null for a row with no id. */
44
+ export function item(raw) {
45
+ const o = obj(raw);
46
+ const id = str(o.id);
47
+ if (!id)
48
+ return null;
49
+ const kind = KIND_IDS.includes(str(o.kind)) ? o.kind : 'file';
50
+ const source = SOURCES.includes(str(o.source)) ? o.source : 'dev';
51
+ return {
52
+ id,
53
+ kind,
54
+ source,
55
+ name: str(o.name) || id,
56
+ mime: str(o.mime),
57
+ bytes: num(o.bytes),
58
+ width: num(o.width),
59
+ height: num(o.height),
60
+ seconds: num(o.seconds),
61
+ pages: num(o.pages),
62
+ owner: str(o.owner),
63
+ mine: o.mine === true,
64
+ shared: o.shared === true,
65
+ project: str(o.project),
66
+ ref: str(o.ref),
67
+ origin: inApp(o.origin),
68
+ url: signed(o.url),
69
+ download: signed(o.download),
70
+ preview: signed(o.preview),
71
+ expires: str(o.expires),
72
+ created: str(o.created),
73
+ updated: str(o.updated),
74
+ };
75
+ }
76
+ export async function items(t, f = {}, init) {
77
+ const raw = obj(await call(t, 'GET', `/v1/library${query({
78
+ kind: f.kind,
79
+ source: f.source,
80
+ ref: f.ref,
81
+ project: f.project,
82
+ q: f.q?.trim(),
83
+ since: f.since,
84
+ until: f.until,
85
+ scope: f.scope === 'all' ? undefined : f.scope,
86
+ limit: f.limit,
87
+ cursor: f.cursor,
88
+ })}`, undefined, init));
89
+ const data = (Array.isArray(raw.data) ? raw.data : []).map(item).filter((x) => x !== null);
90
+ return { data, next: str(raw.next) };
91
+ }
92
+ export async function get(t, id) {
93
+ const x = item(await call(t, 'GET', `/v1/library/${seg(id)}`));
94
+ if (!x)
95
+ throw new Error(phrase('The item came back without an id'));
96
+ return x;
97
+ }
98
+ /** The largest thing an inline upload carries; larger files up to `MAX` reserve a signed PUT. */
99
+ export const INLINE = 10 << 20;
100
+ /** The largest thing one upload carries (2 GiB). */
101
+ export const MAX = 2 * 1024 * 1024 * 1024;
102
+ /** Bytes as base64, in chunks a call stack holds. */
103
+ export function base64(bytes) {
104
+ let s = '';
105
+ for (let i = 0; i < bytes.length; i += 0x8000)
106
+ s += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
107
+ return btoa(s);
108
+ }
109
+ /** Keep a file in the Library. */
110
+ export async function upload(t, file, made) {
111
+ const len = file.blob ? file.blob.size : (file.bytes?.length ?? 0);
112
+ if (!len)
113
+ throw new Sentence(phrase('{name} is empty'), { name: file.name });
114
+ if (len > MAX)
115
+ throw new Sentence(phrase('{name} is larger than 2 GB'), { name: file.name });
116
+ const mime = file.type || 'application/octet-stream';
117
+ if (len > INLINE) {
118
+ const reserved = obj(await call(t, 'POST', '/v1/library', {
119
+ name: file.name,
120
+ mime,
121
+ bytes: len,
122
+ ...made,
123
+ }));
124
+ const id = str(reserved.id);
125
+ const up = obj(reserved.upload);
126
+ const putUrl = signed(up.url);
127
+ if (!id)
128
+ throw new Error(phrase('The item was kept and came back without an id'));
129
+ if (!putUrl) {
130
+ const x = item(reserved);
131
+ if (!x)
132
+ throw new Error(phrase('The item was kept and came back without an id'));
133
+ return x;
134
+ }
135
+ const headers = {};
136
+ if (Array.isArray(up.headers)) {
137
+ for (const h of up.headers) {
138
+ const ho = obj(h);
139
+ const hn = str(ho.name);
140
+ if (hn)
141
+ headers[hn] = str(ho.value);
142
+ }
143
+ }
144
+ const res = await fetch(putUrl, {
145
+ method: 'PUT',
146
+ headers,
147
+ body: (file.blob ?? file.bytes),
148
+ });
149
+ if (!res.ok)
150
+ throw new Sentence(phrase('{name} was not kept'), { name: file.name });
151
+ const done = item(await call(t, 'PATCH', `/v1/library/${seg(id)}`, { commit: true }));
152
+ if (!done)
153
+ throw new Error(phrase('The item was kept and came back without an id'));
154
+ return done;
155
+ }
156
+ const bytes = file.bytes ?? new Uint8Array(await file.blob.arrayBuffer());
157
+ const x = item(await call(t, 'POST', '/v1/library', {
158
+ name: file.name,
159
+ mime,
160
+ data: base64(bytes),
161
+ ...made,
162
+ }));
163
+ if (!x)
164
+ throw new Error(phrase('The item was kept and came back without an id'));
165
+ return x;
166
+ }
167
+ export async function change(t, id, c) {
168
+ const x = item(await call(t, 'PATCH', `/v1/library/${seg(id)}`, c));
169
+ if (!x)
170
+ throw new Error(phrase('The item was changed and came back without an id'));
171
+ return x;
172
+ }
173
+ export async function remove(t, id) {
174
+ await call(t, 'DELETE', `/v1/library/${seg(id)}`);
175
+ }
176
+ /** A size the way a person reads it. */
177
+ export function size(bytes) {
178
+ if (bytes < 1024)
179
+ return `${bytes} B`;
180
+ const units = ['KB', 'MB', 'GB'];
181
+ let n = bytes / 1024;
182
+ let u = 0;
183
+ while (n >= 1024 && u < units.length - 1) {
184
+ n /= 1024;
185
+ u++;
186
+ }
187
+ return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${units[u]}`;
188
+ }
189
+ /** The day an instant falls on, as a section of the Library: Today, Yesterday (English, marked), then the month. */
190
+ export function day(iso, now = new Date()) {
191
+ const d = new Date(iso);
192
+ if (Number.isNaN(d.getTime()))
193
+ return phrase('Earlier');
194
+ const start = (x) => new Date(x.getFullYear(), x.getMonth(), x.getDate()).getTime();
195
+ const days = Math.round((start(now) - start(d)) / 86_400_000);
196
+ if (days <= 0)
197
+ return phrase('Today');
198
+ if (days === 1)
199
+ return phrase('Yesterday');
200
+ return d.toLocaleDateString(undefined, d.getFullYear() === now.getFullYear() ? { month: 'long' } : { month: 'long', year: 'numeric' });
201
+ }
202
+ /** Items under the day each was made, in the order given (newest first). */
203
+ export function days(list, now = new Date()) {
204
+ const out = [];
205
+ for (const x of list) {
206
+ const label = day(x.created, now);
207
+ const last = out[out.length - 1];
208
+ if (last && last.label === label)
209
+ last.rows.push(x);
210
+ else
211
+ out.push({ label, rows: [x] });
212
+ }
213
+ return out;
214
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The plan's usage, as the gate counts it.
3
+ *
4
+ * GET /v1/ai/limits the plan, its request windows and each class it includes, as shares
5
+ * PUT /v1/ai/limits {creditsAfterAllowance}: keep using a model on credits once the
6
+ * plan's included usage of it is spent; answers the limits after it
7
+ *
8
+ * The shape is cloud's `aiLimits` (apps/ai/limits_ops.go): `plan` is the rung the
9
+ * caller is served as, `free` with none; `session` and `day` bound every request
10
+ * the plan covers; `classes.premium` (third-party frontier models) and
11
+ * `classes.ours` (Hanzo's) are each the billing period's share used, with a
12
+ * shorter `window` where the plan sets one. Never a dollar, a count or a cap.
13
+ *
14
+ * Only an org admin may change how a pooled org wallet pays (403 otherwise).
15
+ */
16
+ import { type Share, type State } from '../plan.ts';
17
+ import { type Target } from './call.ts';
18
+ export type Class = 'premium' | 'ours';
19
+ export declare const CLASSES: readonly Class[];
20
+ /** A class's billing period, who pays for its next request, and its short window. */
21
+ export interface Allowance extends Share {
22
+ /** plan, prepaid, credits, or none. */
23
+ paying: string;
24
+ window: Share | null;
25
+ }
26
+ /** A way past a limit, in the order the server sends them. */
27
+ export interface Action {
28
+ /** upgrade and topup are pages (`url`); credits is the choice above; switch names a model. */
29
+ kind: 'upgrade' | 'topup' | 'credits' | 'switch';
30
+ label: string;
31
+ url: string;
32
+ plan: string;
33
+ model: string;
34
+ }
35
+ /** One model whose share of the plan is used for now, answered by its fallback in chat. */
36
+ export interface Paused {
37
+ model: string;
38
+ fallback: string;
39
+ resets: string;
40
+ }
41
+ export interface Limits {
42
+ /** The rung served (`max-20x`); `free` where no plan counts. */
43
+ plan: string;
44
+ /** The billing period, RFC 3339; '' with no plan. */
45
+ start: string;
46
+ end: string;
47
+ /** The worst class's state. */
48
+ state: State;
49
+ session: Share | null;
50
+ day: Share | null;
51
+ classes: Partial<Record<Class, Allowance>>;
52
+ /** Present in limited mode: why, and in which classes. */
53
+ limited: {
54
+ reason: string;
55
+ classes: Class[];
56
+ message: string;
57
+ } | null;
58
+ actions: Action[];
59
+ /** The plan that raises these limits, '' at the top. */
60
+ upgrade: string;
61
+ /** Whether the payer keeps using a model on credits once the plan's usage of it is spent. */
62
+ credits: boolean;
63
+ paused: Paused[];
64
+ }
65
+ /** The body of `GET /v1/ai/limits`, read field by field: what is not there is not drawn. */
66
+ export declare function parse(raw: unknown): Limits;
67
+ export declare function limits(t: Target): Promise<Limits>;
68
+ /** Turn on or off paying from credits once the plan's included usage runs out; answers the limits after. */
69
+ export declare function allow(t: Target, on: boolean): Promise<Limits>;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The plan's usage, as the gate counts it.
3
+ *
4
+ * GET /v1/ai/limits the plan, its request windows and each class it includes, as shares
5
+ * PUT /v1/ai/limits {creditsAfterAllowance}: keep using a model on credits once the
6
+ * plan's included usage of it is spent; answers the limits after it
7
+ *
8
+ * The shape is cloud's `aiLimits` (apps/ai/limits_ops.go): `plan` is the rung the
9
+ * caller is served as, `free` with none; `session` and `day` bound every request
10
+ * the plan covers; `classes.premium` (third-party frontier models) and
11
+ * `classes.ours` (Hanzo's) are each the billing period's share used, with a
12
+ * shorter `window` where the plan sets one. Never a dollar, a count or a cap.
13
+ *
14
+ * Only an org admin may change how a pooled org wallet pays (403 otherwise).
15
+ */
16
+ import { share } from '../plan.js';
17
+ import { call } from './call.js';
18
+ export const CLASSES = ['premium', 'ours'];
19
+ const str = (v) => (typeof v === 'string' ? v : '');
20
+ const obj = (v) => (v && typeof v === 'object' && !Array.isArray(v) ? v : {});
21
+ const arr = (v) => (Array.isArray(v) ? v : []);
22
+ const KINDS = ['upgrade', 'topup', 'credits', 'switch'];
23
+ const STATES = ['ok', 'near', 'limited'];
24
+ /** A class off the wire: its period always carries a state, so one without is not a class. */
25
+ function allowance(v) {
26
+ const w = share(v);
27
+ if (!w)
28
+ return null;
29
+ const o = obj(v);
30
+ return { ...w, paying: str(o.paying) || 'none', window: share(o.window) };
31
+ }
32
+ /** The body of `GET /v1/ai/limits`, read field by field: what is not there is not drawn. */
33
+ export function parse(raw) {
34
+ const r = obj(raw);
35
+ const classes = {};
36
+ for (const c of CLASSES) {
37
+ const got = allowance(obj(r.classes)[c]);
38
+ if (got)
39
+ classes[c] = got;
40
+ }
41
+ const lim = r.limited ? obj(r.limited) : null;
42
+ return {
43
+ plan: str(r.plan) || 'free',
44
+ start: str(r.period_start),
45
+ end: str(r.period_end),
46
+ state: STATES.find((s) => s === r.state) ?? 'ok',
47
+ session: share(r.session),
48
+ day: share(r.day),
49
+ classes,
50
+ limited: lim
51
+ ? {
52
+ reason: str(lim.reason),
53
+ classes: arr(lim.classes).filter((c) => CLASSES.includes(c)),
54
+ message: str(lim.message),
55
+ }
56
+ : null,
57
+ actions: arr(r.actions)
58
+ .map(obj)
59
+ .flatMap((a) => {
60
+ const kind = KINDS.find((k) => k === a.kind);
61
+ if (!kind)
62
+ return [];
63
+ const url = str(a.url);
64
+ const model = str(a.model);
65
+ // A page with no address, or a switch to no model, is not a way past anything.
66
+ if ((kind === 'upgrade' || kind === 'topup') && !url)
67
+ return [];
68
+ if (kind === 'switch' && !model)
69
+ return [];
70
+ return [{ kind, label: str(a.label), url, plan: str(a.plan), model }];
71
+ }),
72
+ upgrade: str(r.upgrade),
73
+ credits: r.credits_after_allowance === true,
74
+ paused: arr(r.paused)
75
+ .map(obj)
76
+ .filter((p) => str(p.model))
77
+ .map((p) => ({ model: str(p.model), fallback: str(p.fallback), resets: str(p.resets_at) })),
78
+ };
79
+ }
80
+ export async function limits(t) {
81
+ return parse(await call(t, 'GET', '/v1/ai/limits'));
82
+ }
83
+ /** Turn on or off paying from credits once the plan's included usage runs out; answers the limits after. */
84
+ export async function allow(t, on) {
85
+ return parse(await call(t, 'PUT', '/v1/ai/limits', { creditsAfterAllowance: on }));
86
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The repositories an organization has linked from GitHub, as the sync app
3
+ * holds them: one link per repository (an account link declares one for every
4
+ * repository its account holds), each with its copy on the forge.
5
+ *
6
+ * GET /v1/sync {data: [syncView]} apps/sync sync_api.go
7
+ * DELETE /v1/sync/{id} drop one link
8
+ *
9
+ * A repository link's source is GitHub's https clone address; its target is the
10
+ * forge, by the bare name the copy has there. `updatedAt` is bumped by every
11
+ * reconcile, so it reads as the last time the link synced. `native` is the
12
+ * forge copy: its page, its default branch and how it stands — `synced`,
13
+ * `conflict`, `pending` (not on the forge yet) or `paused` — and is absent when
14
+ * the forge could not be read, which is not reported as healthy.
15
+ *
16
+ * Every link the sync app holds is also a row of GET /v1/project (apps/sync
17
+ * project.go), so this list is the org's linked projects and not a copy of them.
18
+ *
19
+ * Dropping a link stops the sync both ways: the sync app withdraws the push
20
+ * back to GitHub as it deletes the link. The copy on the forge and the project
21
+ * are left as they are, so a removal that wants them gone asks for each.
22
+ */
23
+ import { type Target } from './call.ts';
24
+ export interface Link {
25
+ /** The link's handle, which dropping it takes. */
26
+ id: string;
27
+ /** The GitHub account. */
28
+ owner: string;
29
+ /** The repository; '' for an account link. */
30
+ name: string;
31
+ /** The forge copy's name, which a run and an environment address; ''. */
32
+ forge: string;
33
+ /** RFC 3339: when it last synced, or ''. */
34
+ synced: string;
35
+ /** `synced`, `conflict`, `pending`, `paused`, or '' when the forge could not be read. */
36
+ status: string;
37
+ /** The forge copy's default branch, or ''. */
38
+ branch: string;
39
+ /** `both`, `pull`, `push` or `off`. */
40
+ direction: string;
41
+ }
42
+ /** `owner` and `name` of a GitHub https address, `name` '' for an account; null for any other host. */
43
+ export declare function github(locator: string): {
44
+ owner: string;
45
+ name: string;
46
+ } | null;
47
+ export declare function link(raw: unknown): Link | null;
48
+ /** Every repository link the org has; account links are left out, as each declares its repositories' own. */
49
+ export declare function links(t: Target, signal?: AbortSignal): Promise<Link[]>;
50
+ /** Drop one link: GitHub stops syncing into its copy, and its copy stops pushing back. */
51
+ export declare function unlink(t: Target, id: string): Promise<void>;