@madarco/agentbox 0.27.1 → 0.28.0-nightly.202607251721
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.
- package/CHANGELOG.md +87 -4
- package/README.md +7 -3
- package/dist/_cloud-attach-XZYF324R.js +26 -0
- package/dist/admin-client-NOZ5CCAH.js +15 -0
- package/dist/chunk-2VW37PW4.js +1694 -0
- package/dist/chunk-2VW37PW4.js.map +1 -0
- package/dist/{chunk-HR7NHH5J.js → chunk-3UMM4VJH.js} +808 -57
- package/dist/chunk-3UMM4VJH.js.map +1 -0
- package/dist/chunk-5U5QOFL5.js +20 -0
- package/dist/chunk-5U5QOFL5.js.map +1 -0
- package/dist/chunk-6P6D77QP.js +285 -0
- package/dist/chunk-6P6D77QP.js.map +1 -0
- package/dist/chunk-6V366IZC.js +2892 -0
- package/dist/chunk-6V366IZC.js.map +1 -0
- package/dist/{chunk-KWOEUFVA.js → chunk-7J6G526Q.js} +6 -14
- package/dist/{chunk-KWOEUFVA.js.map → chunk-7J6G526Q.js.map} +1 -1
- package/dist/{chunk-IDH5A4RR.js → chunk-AYPAYY5R.js} +17 -4
- package/dist/chunk-AYPAYY5R.js.map +1 -0
- package/dist/{chunk-JGZSA5ZI.js → chunk-BHJCMTHP.js} +58 -15
- package/dist/chunk-BHJCMTHP.js.map +1 -0
- package/dist/{chunk-26IKZRTT.js → chunk-BLWAWGFX.js} +297 -1217
- package/dist/chunk-BLWAWGFX.js.map +1 -0
- package/dist/chunk-CGPUFXET.js +95 -0
- package/dist/chunk-CGPUFXET.js.map +1 -0
- package/dist/{chunk-SJ75AIA2.js → chunk-D6AODRNA.js} +12 -9
- package/dist/{chunk-SJ75AIA2.js.map → chunk-D6AODRNA.js.map} +1 -1
- package/dist/chunk-DPJMEG7U.js +11 -0
- package/dist/chunk-DPJMEG7U.js.map +1 -0
- package/dist/chunk-E2ITEZAQ.js +148 -0
- package/dist/chunk-E2ITEZAQ.js.map +1 -0
- package/dist/{chunk-JE6UI5YR.js → chunk-NKVCIH6N.js} +89 -223
- package/dist/chunk-NKVCIH6N.js.map +1 -0
- package/dist/chunk-OEYAVBA6.js +120 -0
- package/dist/chunk-OEYAVBA6.js.map +1 -0
- package/dist/{chunk-UJEH2NJT.js → chunk-PXYPQ5BO.js} +64 -264
- package/dist/chunk-PXYPQ5BO.js.map +1 -0
- package/dist/chunk-QESXSSO6.js +670 -0
- package/dist/chunk-QESXSSO6.js.map +1 -0
- package/dist/{chunk-NEF6MDJO.js → chunk-QJCK2AFX.js} +128 -26
- package/dist/chunk-QJCK2AFX.js.map +1 -0
- package/dist/chunk-RUJJY23M.js +84 -0
- package/dist/chunk-RUJJY23M.js.map +1 -0
- package/dist/{chunk-LL7NCMUU.js → chunk-SKNJRYM5.js} +7 -13
- package/dist/chunk-SKNJRYM5.js.map +1 -0
- package/dist/chunk-WFGAMJ5Q.js +689 -0
- package/dist/chunk-WFGAMJ5Q.js.map +1 -0
- package/dist/chunk-ZJL56TJD.js +1444 -0
- package/dist/chunk-ZJL56TJD.js.map +1 -0
- package/dist/{chunk-V5XXJH63.js → chunk-ZXOP4LBG.js} +5 -8
- package/dist/chunk-ZXOP4LBG.js.map +1 -0
- package/dist/control-plane-2VEM2KCL.js +31 -0
- package/dist/custody-client-P6XIXHRG.js +16 -0
- package/dist/{dist-TSFVB7AI.js → dist-2SYQI5S2.js} +11 -7
- package/dist/dist-2SYQI5S2.js.map +1 -0
- package/dist/{dist-KQTMCVME.js → dist-6QZMZEL7.js} +18 -11
- package/dist/dist-6QZMZEL7.js.map +1 -0
- package/dist/{dist-FTKS2GI4.js → dist-JHMILJUT.js} +10 -6
- package/dist/{dist-OO52HARR.js → dist-JOFZOZCY.js} +41 -25
- package/dist/{dist-O3LKOIE7.js → dist-KZ2GEEEX.js} +11 -7
- package/dist/dist-KZ2GEEEX.js.map +1 -0
- package/dist/{dist-Z6L5MM5D.js → dist-Q5NY4CF6.js} +10 -6
- package/dist/{dist-U2SVLJUQ.js → dist-SKMNEDVW.js} +8 -2
- package/dist/dist-SKMNEDVW.js.map +1 -0
- package/dist/dist-SRCKO7ZV.js +197 -0
- package/dist/dist-SRCKO7ZV.js.map +1 -0
- package/dist/{dist-WVYAURMF.js → dist-UXZQWKY6.js} +10 -6
- package/dist/dist-UXZQWKY6.js.map +1 -0
- package/dist/env-file-UDUDQMP4.js +11 -0
- package/dist/env-file-UDUDQMP4.js.map +1 -0
- package/dist/hub-adopt-ZS5CREYF.js +21 -0
- package/dist/hub-adopt-ZS5CREYF.js.map +1 -0
- package/dist/index.js +2461 -1905
- package/dist/index.js.map +1 -1
- package/dist/node-postgres-6JUOVUN5.js +3584 -0
- package/dist/node-postgres-6JUOVUN5.js.map +1 -0
- package/dist/{prepared-state-75DIZ55S-TNJXWMXV.js → prepared-state-75DIZ55S-P6LE4N64.js} +3 -2
- package/dist/prepared-state-75DIZ55S-P6LE4N64.js.map +1 -0
- package/dist/remote-hub-SJ4XWBA5.js +9 -0
- package/dist/remote-hub-SJ4XWBA5.js.map +1 -0
- package/dist/sqlite-proxy-53E5D2VM.js +2882 -0
- package/dist/sqlite-proxy-53E5D2VM.js.map +1 -0
- package/package.json +1 -1
- package/runtime/_shared/ctl.cjs +29199 -16813
- package/runtime/digitalocean/ctl.cjs +29199 -16813
- package/runtime/docker/packages/ctl/dist/bin.cjs +29199 -16813
- package/runtime/e2b/ctl.cjs +29199 -16813
- package/runtime/hetzner/ctl.cjs +29199 -16813
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +5 -5
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js +4 -4
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js +2 -2
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js +4 -2
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1w4z_drizzle-orm_0gvv4ct._.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1w4z_drizzle-orm_0pn9b49._.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1w4z_drizzle-orm_145bz8z._.js +9 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1w4z_drizzle-orm_14y990b._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1w4z_drizzle-orm_1nl4l3q._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1w4z_drizzle-orm_sqlite-proxy_index_05v_j5r.js +15 -0
- package/runtime/hub/apps/hub/.next/server/chunks/{[externals]__12m3qoa._.js → [externals]__0f3aqcx._.js} +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0-9g1s8._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0-pvfxg._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__01amzh6._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__02q799_._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__03k22rl._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04tqk-j._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__05ovf1y._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__05s-_x7._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07dnyfi._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07zk6qo._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0_59yi6._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ajlo3d._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0b5s54n._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0c4fiez._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0c9iff1._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +5 -5
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0dh6lzr._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ey83ai._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0h6vdvr._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0lup7p4._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0luxuu4._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0nl2u6u._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0nonp-6._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0oplozy._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0p-6wgd._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0rcnwbw._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0tuz1am._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__10ry4ss._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__11hv164._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__154_i13._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__17676rc._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bg1alc._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1cvqb1d._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1d60gbz._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dm0jmw._.js +6 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dv_b1t._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1fzxip4._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4oj-e._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1i4gq_2._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v1p7in._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9_her._.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1x1jkpb._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1yd8n5l._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__20t_rs8._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_033w048._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/{_0760z6y._.js → _0907rw0._.js} +15 -15
- package/runtime/hub/apps/hub/.next/server/chunks/_0f3molr._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0lgs9kd._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0pyhcqe._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_1-42ili._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_11__3wi._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_12flzuh._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_1bng7w9._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_1rpkqst._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_1wt72m1._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_1x3l5t8._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/packages_relay_dist_control-plane_03a-9aj.js +62 -31
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0xy-j7z._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_1uccfbf._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_010858m.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_04zwxnx.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_06exuc7.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2ldrt.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2tzep.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_116nh32.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_11dyjcb.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_1_4knli.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/1w4z_drizzle-orm_0ebuy19._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/1w4z_drizzle-orm_0wxhi0-._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/1w4z_drizzle-orm_0xe4ick._.js +9 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/1w4z_drizzle-orm_14oaveu._.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/1w4z_drizzle-orm_sqlite-proxy_index_1a6wfdg.js +15 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0-pm2yl._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__08-1wwu._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0c9mbcn._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0gdfxj4._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0kc-hwp._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0lu73p6._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0m1yf2b._.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0wv-3zo._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__10bfmwi._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__18qvdzb._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1l2urlw._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/{_0ro6vh6._.js → _0r2xlss._.js} +3 -3
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_components_1z1p98f._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/packages_relay_dist_control-plane_0ve-wz4.js +2 -25
- package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
- package/runtime/hub/apps/hub/.next/server/middleware.js +1 -1
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/{2xc1sm79a6tsb.js → 2gsrna76i1d80.js} +1 -1
- package/runtime/hub/apps/hub/attach-helper.cjs +191 -0
- package/runtime/hub/apps/hub/{auth-DC44GQZY.js → auth-IRNNO3IK.js} +2 -2
- package/runtime/hub/apps/hub/{auth-config-LALRDYDO.js → auth-config-WJHIMGUE.js} +4 -2
- package/runtime/hub/apps/hub/{chunk-YJ5MJOXK.js → chunk-4LYVBRBC.js} +2094 -220
- package/runtime/hub/apps/hub/chunk-6AVSKCZJ.js +669 -0
- package/runtime/hub/apps/hub/{chunk-QSMPSV5Z.js → chunk-A5Y7LJMU.js} +57 -14
- package/runtime/hub/apps/hub/chunk-EDRFXO2M.js +35 -0
- package/runtime/hub/apps/hub/chunk-F2JI4GMX.js +2891 -0
- package/runtime/hub/apps/hub/{chunk-EHBJKZCL.js → chunk-O3K3ZGFF.js} +500 -35
- package/runtime/hub/apps/hub/chunk-RII6IKNJ.js +688 -0
- package/runtime/hub/apps/hub/{chunk-RXYOWSSN.js → chunk-RMEUA6PA.js} +120 -14
- package/runtime/hub/apps/hub/{chunk-3FJNKSNZ.js → chunk-SCHQR5KR.js} +3 -1
- package/runtime/hub/apps/hub/{dist-6FPPUSWZ.js → dist-2GEAA7QA.js} +15 -3
- package/runtime/hub/apps/hub/{dist-JG45OFT2.js → dist-36O6F6M3.js} +39 -24
- package/runtime/hub/apps/hub/{dist-3I7KUI6W.js → dist-IWLEL2TO.js} +21 -24
- package/runtime/hub/apps/hub/{dist-G6TXUSPZ.js → dist-NYKIT5W5.js} +10 -11
- package/runtime/hub/apps/hub/{dist-EQV4L7KP.js → dist-QB2IJ7OD.js} +7 -1
- package/runtime/hub/apps/hub/{dist-LYDHYTP2.js → dist-RBBXXGLI.js} +129 -26
- package/runtime/hub/apps/hub/{dist-GTVVXCBP.js → dist-RRJN2U5P.js} +10 -14
- package/runtime/hub/apps/hub/{dist-DX6IYMAH.js → dist-UWXGDCK4.js} +14 -11
- package/runtime/hub/apps/hub/{hub-token-COBZGSLS.js → hub-token-6USIMBPQ.js} +2 -2
- package/runtime/hub/apps/hub/hub-worker-SOFWVTWU.js +215 -0
- package/runtime/hub/apps/hub/node-postgres-DIU2H5VP.js +3583 -0
- package/runtime/hub/apps/hub/package.json +5 -2
- package/runtime/hub/apps/hub/{prepared-state-75DIZ55S-2IFNUHHM.js → prepared-state-75DIZ55S-P5FHEORG.js} +1 -1
- package/runtime/hub/apps/hub/server.js +247 -66
- package/runtime/hub/apps/hub/sqlite-proxy-VJS3HIOV.js +2881 -0
- package/runtime/relay/bin.cjs +694 -13
- package/runtime/vercel/ctl.cjs +29199 -16813
- package/dist/_cloud-attach-WDGM6FL5.js +0 -19
- package/dist/chunk-26IKZRTT.js.map +0 -1
- package/dist/chunk-HR7NHH5J.js.map +0 -1
- package/dist/chunk-IDH5A4RR.js.map +0 -1
- package/dist/chunk-JE6UI5YR.js.map +0 -1
- package/dist/chunk-JGZSA5ZI.js.map +0 -1
- package/dist/chunk-LL7NCMUU.js.map +0 -1
- package/dist/chunk-NEF6MDJO.js.map +0 -1
- package/dist/chunk-UJEH2NJT.js.map +0 -1
- package/dist/chunk-V5XXJH63.js.map +0 -1
- package/dist/dist-KQTMCVME.js.map +0 -1
- package/dist/dist-O3LKOIE7.js.map +0 -1
- package/dist/dist-TSFVB7AI.js.map +0 -1
- package/runtime/hub/apps/hub/.next/server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04h15ml._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04jgk9x._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07ednlo._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0a7djvw._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ig1bot._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ql4fjo._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0szd4sh._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0t7o5ed._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vs8fma._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0w9ud8u._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0xh14bo._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0yhb0gc._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-0flwc._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13ioh5z._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13jwk_k._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16_uteg._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16p2m-g._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__19pc87s._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1_gu2yk._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1a50b07._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ai-945._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bu2zio._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ctczev._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1d6mtlk._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dn_3i1._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1e4z_-v._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f2sueq._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f9zctr._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4xycg._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1js2jdv._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1md9kdw._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1mttufy._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1nepkp-._.js +0 -6
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1pp5oib._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1q5bqse._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qwhzmi._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1thipug._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9om6g._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1xeczo7._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__20503l7._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[externals]_pg_20c820g._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0j0tjwn._.js +0 -3
- /package/dist/{_cloud-attach-WDGM6FL5.js.map → _cloud-attach-XZYF324R.js.map} +0 -0
- /package/dist/{dist-FTKS2GI4.js.map → admin-client-NOZ5CCAH.js.map} +0 -0
- /package/dist/{dist-OO52HARR.js.map → control-plane-2VEM2KCL.js.map} +0 -0
- /package/dist/{dist-U2SVLJUQ.js.map → custody-client-P6XIXHRG.js.map} +0 -0
- /package/dist/{dist-WVYAURMF.js.map → dist-JHMILJUT.js.map} +0 -0
- /package/dist/{dist-Z6L5MM5D.js.map → dist-JOFZOZCY.js.map} +0 -0
- /package/dist/{prepared-state-75DIZ55S-TNJXWMXV.js.map → dist-Q5NY4CF6.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{PWF2iHQOg9-rRyfqVDLrh → B4bEtdig9I9joQFHDOjX3}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{PWF2iHQOg9-rRyfqVDLrh → B4bEtdig9I9joQFHDOjX3}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{PWF2iHQOg9-rRyfqVDLrh → B4bEtdig9I9joQFHDOjX3}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,1444 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
BUILT_IN_DEFAULTS,
|
|
4
|
+
GLOBAL_CONFIG_FILE,
|
|
5
|
+
STATE_DIR,
|
|
6
|
+
parseUserConfig
|
|
7
|
+
} from "./chunk-BHJCMTHP.js";
|
|
8
|
+
import {
|
|
9
|
+
STATE_DIR as STATE_DIR2,
|
|
10
|
+
STATE_FILE,
|
|
11
|
+
boxSshDirForProvider,
|
|
12
|
+
readState
|
|
13
|
+
} from "./chunk-PXYPQ5BO.js";
|
|
14
|
+
import {
|
|
15
|
+
index,
|
|
16
|
+
integer as integer2,
|
|
17
|
+
sqliteTable,
|
|
18
|
+
text as text2
|
|
19
|
+
} from "./chunk-QESXSSO6.js";
|
|
20
|
+
import {
|
|
21
|
+
and,
|
|
22
|
+
asc,
|
|
23
|
+
bigint,
|
|
24
|
+
boolean,
|
|
25
|
+
desc,
|
|
26
|
+
eq,
|
|
27
|
+
gt,
|
|
28
|
+
inArray,
|
|
29
|
+
integer,
|
|
30
|
+
isNotNull,
|
|
31
|
+
jsonb,
|
|
32
|
+
lt,
|
|
33
|
+
lte,
|
|
34
|
+
or,
|
|
35
|
+
pgTable,
|
|
36
|
+
text,
|
|
37
|
+
timestamp
|
|
38
|
+
} from "./chunk-6V366IZC.js";
|
|
39
|
+
|
|
40
|
+
// ../../packages/relay/dist/chunk-WVMWNSZY.js
|
|
41
|
+
import { createSign } from "crypto";
|
|
42
|
+
var DEFAULT_RELAY_PORT = 8787;
|
|
43
|
+
var RELAY_CONTAINER_NAME = "agentbox-relay";
|
|
44
|
+
var RELAY_NETWORK_NAME = "agentbox-net";
|
|
45
|
+
var RELAY_IMAGE_REF = "agentbox/relay:dev";
|
|
46
|
+
var RELAY_EVENT_RING_SIZE = 1e3;
|
|
47
|
+
function parseGitRemote(origin) {
|
|
48
|
+
const trimmed = origin.trim();
|
|
49
|
+
if (trimmed.length === 0) throw new Error("empty git remote URL");
|
|
50
|
+
const urlForm = /^[a-z][a-z0-9+.-]*:\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/i.exec(trimmed);
|
|
51
|
+
const scpForm = /^(?:[^@/]+@)?([^/:]+):(.+)$/.exec(trimmed);
|
|
52
|
+
let host;
|
|
53
|
+
let path;
|
|
54
|
+
if (urlForm) {
|
|
55
|
+
host = urlForm[1];
|
|
56
|
+
path = urlForm[2];
|
|
57
|
+
} else if (scpForm && !/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) {
|
|
58
|
+
host = scpForm[1];
|
|
59
|
+
path = scpForm[2];
|
|
60
|
+
} else {
|
|
61
|
+
throw new Error(`unrecognized git remote URL: ${origin}`);
|
|
62
|
+
}
|
|
63
|
+
return { host, path: path.replace(/^\/+/, "") };
|
|
64
|
+
}
|
|
65
|
+
function toAuthedHttpsUrl(origin, token) {
|
|
66
|
+
const { host, path } = parseGitRemote(origin);
|
|
67
|
+
return `https://x-access-token:${token}@${host}/${path}`;
|
|
68
|
+
}
|
|
69
|
+
function loadGitHubAppConfig() {
|
|
70
|
+
const appId = process.env.GITHUB_APP_ID;
|
|
71
|
+
let key = process.env.GITHUB_APP_PRIVATE_KEY;
|
|
72
|
+
if (!appId || !key) return null;
|
|
73
|
+
if (!key.includes("BEGIN")) {
|
|
74
|
+
try {
|
|
75
|
+
key = Buffer.from(key, "base64").toString("utf8");
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const apiBaseUrl = process.env.GITHUB_API_URL || void 0;
|
|
81
|
+
return { appId, privateKeyPem: key, apiBaseUrl };
|
|
82
|
+
}
|
|
83
|
+
function b64url(input) {
|
|
84
|
+
return Buffer.from(input).toString("base64url");
|
|
85
|
+
}
|
|
86
|
+
function appJwt(cfg, nowMs = Date.now()) {
|
|
87
|
+
const now = Math.floor(nowMs / 1e3);
|
|
88
|
+
const header = b64url(JSON.stringify({ alg: "RS256", typ: "JWT" }));
|
|
89
|
+
const payload = b64url(JSON.stringify({ iat: now - 60, exp: now + 540, iss: cfg.appId }));
|
|
90
|
+
const signingInput = `${header}.${payload}`;
|
|
91
|
+
const signature = createSign("RSA-SHA256").update(signingInput).sign(cfg.privateKeyPem);
|
|
92
|
+
return `${signingInput}.${b64url(signature)}`;
|
|
93
|
+
}
|
|
94
|
+
var RENEW_BEFORE_MS = 5 * 60 * 1e3;
|
|
95
|
+
var GitHubAppLeaser = class {
|
|
96
|
+
cfg;
|
|
97
|
+
fetchImpl;
|
|
98
|
+
now;
|
|
99
|
+
apiBase;
|
|
100
|
+
cache = /* @__PURE__ */ new Map();
|
|
101
|
+
installationIds = /* @__PURE__ */ new Map();
|
|
102
|
+
constructor(cfg, opts = {}) {
|
|
103
|
+
this.cfg = cfg;
|
|
104
|
+
this.fetchImpl = opts.fetchImpl ?? fetch;
|
|
105
|
+
this.now = opts.now ?? Date.now;
|
|
106
|
+
this.apiBase = (cfg.apiBaseUrl ?? "https://api.github.com").replace(/\/$/, "");
|
|
107
|
+
}
|
|
108
|
+
headers(jwt) {
|
|
109
|
+
return {
|
|
110
|
+
Authorization: `Bearer ${jwt}`,
|
|
111
|
+
Accept: "application/vnd.github+json",
|
|
112
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
113
|
+
"User-Agent": "agentbox-relay"
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Resolve the installation id for `owner/repo`, or null when the App is not
|
|
118
|
+
* installed on it (404). Caches positive lookups. Non-404 errors throw.
|
|
119
|
+
*/
|
|
120
|
+
async lookupInstallationId(owner, repo) {
|
|
121
|
+
const key = `${owner}/${repo}`;
|
|
122
|
+
const cached = this.installationIds.get(key);
|
|
123
|
+
if (cached !== void 0) return cached;
|
|
124
|
+
const jwt = appJwt(this.cfg, this.now());
|
|
125
|
+
const res = await this.fetchImpl(`${this.apiBase}/repos/${owner}/${repo}/installation`, {
|
|
126
|
+
headers: this.headers(jwt)
|
|
127
|
+
});
|
|
128
|
+
if (res.status === 404) return null;
|
|
129
|
+
if (!res.ok) {
|
|
130
|
+
throw new Error(`GET installation for ${key} \u2192 ${String(res.status)}`);
|
|
131
|
+
}
|
|
132
|
+
const body = await res.json();
|
|
133
|
+
if (typeof body.id !== "number") throw new Error("installation response missing id");
|
|
134
|
+
this.installationIds.set(key, body.id);
|
|
135
|
+
return body.id;
|
|
136
|
+
}
|
|
137
|
+
async installationId(owner, repo) {
|
|
138
|
+
const id = await this.lookupInstallationId(owner, repo);
|
|
139
|
+
if (id === null) throw new Error(`GitHub App is not installed on ${owner}/${repo}`);
|
|
140
|
+
return id;
|
|
141
|
+
}
|
|
142
|
+
/** Whether the App is installed on `owner/repo` — no token is minted. */
|
|
143
|
+
async isRepoInstalled(owner, repo) {
|
|
144
|
+
return await this.lookupInstallationId(owner, repo) !== null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Mint (or return a cached) installation token scoped to the single repo with
|
|
148
|
+
* `contents: write` + `pull_requests: write`. Throws on any GitHub error.
|
|
149
|
+
*/
|
|
150
|
+
async leaseRepoToken(owner, repo) {
|
|
151
|
+
const key = `${owner}/${repo}`;
|
|
152
|
+
const cached = this.cache.get(key);
|
|
153
|
+
if (cached && cached.expiresAtMs - this.now() > RENEW_BEFORE_MS) {
|
|
154
|
+
return { token: cached.token, expiresAt: cached.expiresAt };
|
|
155
|
+
}
|
|
156
|
+
const id = await this.installationId(owner, repo);
|
|
157
|
+
const jwt = appJwt(this.cfg, this.now());
|
|
158
|
+
const res = await this.fetchImpl(`${this.apiBase}/app/installations/${String(id)}/access_tokens`, {
|
|
159
|
+
method: "POST",
|
|
160
|
+
headers: { ...this.headers(jwt), "Content-Type": "application/json" },
|
|
161
|
+
body: JSON.stringify({
|
|
162
|
+
repositories: [repo],
|
|
163
|
+
permissions: { contents: "write", pull_requests: "write" }
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
if (!res.ok) {
|
|
167
|
+
throw new Error(`failed to mint installation token for ${key} (\u2192 ${String(res.status)})`);
|
|
168
|
+
}
|
|
169
|
+
const body = await res.json();
|
|
170
|
+
if (!body.token || !body.expires_at) throw new Error("access_tokens response missing token/expires_at");
|
|
171
|
+
this.cache.set(key, {
|
|
172
|
+
token: body.token,
|
|
173
|
+
expiresAt: body.expires_at,
|
|
174
|
+
expiresAtMs: Date.parse(body.expires_at)
|
|
175
|
+
});
|
|
176
|
+
return { token: body.token, expiresAt: body.expires_at };
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// ../../packages/relay/dist/chunk-ATOI6ZPE.js
|
|
181
|
+
import { dirname, join } from "path";
|
|
182
|
+
import { dirname as dirname2, join as join2, relative, sep } from "path";
|
|
183
|
+
function lfsEndpointFor(cloneUrl) {
|
|
184
|
+
return `${cloneUrl.replace(/\.git$/, "")}.git/info/lfs`;
|
|
185
|
+
}
|
|
186
|
+
async function cloneRepoWithLfs(runGit, authedUrl, repoUrl, dest, branch, log = () => {
|
|
187
|
+
}) {
|
|
188
|
+
await runGit(branch ? ["clone", "--branch", branch, authedUrl, dest] : ["clone", authedUrl, dest], {
|
|
189
|
+
GIT_LFS_SKIP_SMUDGE: "1"
|
|
190
|
+
});
|
|
191
|
+
try {
|
|
192
|
+
await runGit(
|
|
193
|
+
["-C", dest, "-c", `lfs.url=${lfsEndpointFor(authedUrl)}`, "lfs", "pull"],
|
|
194
|
+
{ GIT_TERMINAL_PROMPT: "0", GIT_SSH_COMMAND: "ssh -o BatchMode=yes -o StrictHostKeyChecking=no" },
|
|
195
|
+
12e4
|
|
196
|
+
);
|
|
197
|
+
} catch (err2) {
|
|
198
|
+
log(`git-lfs objects left as pointers (fetch failed): ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
199
|
+
}
|
|
200
|
+
await runGit(["-C", dest, "remote", "set-url", "origin", repoUrl]);
|
|
201
|
+
}
|
|
202
|
+
function makeControlPlaneCreateBox(deps) {
|
|
203
|
+
return async (request, jobId) => {
|
|
204
|
+
const log = deps.log ?? (() => {
|
|
205
|
+
});
|
|
206
|
+
const dir = deps.tmpDir(jobId);
|
|
207
|
+
try {
|
|
208
|
+
log(`leasing a push token for ${request.repoUrl}`);
|
|
209
|
+
const authedUrl = await deps.leaseRemoteUrl(request.repoUrl);
|
|
210
|
+
log(`cloning ${request.repoUrl}${request.branch ? `@${request.branch}` : ""} into ${dir}`);
|
|
211
|
+
await deps.cloneRepo(authedUrl, request.repoUrl, dir, request.branch);
|
|
212
|
+
if (deps.fetchSeedMaterial) {
|
|
213
|
+
try {
|
|
214
|
+
const seed = await deps.fetchSeedMaterial(request.repoUrl, dir);
|
|
215
|
+
if (seed && seed.files > 0) {
|
|
216
|
+
const from = [
|
|
217
|
+
seed.repoHeadSha ? `at ${seed.repoHeadSha.slice(0, 8)}` : null,
|
|
218
|
+
seed.capturedAt ? `captured ${seed.capturedAt}` : null
|
|
219
|
+
].filter(Boolean).join(", ");
|
|
220
|
+
log(`applied ${String(seed.files)} seed file(s) from custody${from ? ` (${from})` : ""}`);
|
|
221
|
+
}
|
|
222
|
+
} catch (err2) {
|
|
223
|
+
log(
|
|
224
|
+
`seed material unavailable (continuing with a bare clone): ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
log(`provisioning ${request.provider} box from the clone`);
|
|
229
|
+
const box = await deps.createBox({
|
|
230
|
+
workspacePath: dir,
|
|
231
|
+
name: request.name,
|
|
232
|
+
provider: request.provider,
|
|
233
|
+
// Carry the job's agent through to the box record + its plane
|
|
234
|
+
// registration, so an adopting PC relaunches the right agent instead of
|
|
235
|
+
// guessing. Without this a hub-created box adopts with no `lastAgent`.
|
|
236
|
+
agent: request.agent,
|
|
237
|
+
// A background `-i` run seeds a prompt: the worker starts the agent
|
|
238
|
+
// in-box with these. Absent ⇒ a "cold" create (create --via-hub /
|
|
239
|
+
// foreground) that the PC attaches later.
|
|
240
|
+
prompt: request.prompt,
|
|
241
|
+
agentArgs: request.agentArgs,
|
|
242
|
+
onLog: deps.log
|
|
243
|
+
});
|
|
244
|
+
log(`created box ${box.id}`);
|
|
245
|
+
return { boxId: box.id, agentStartError: box.agentStartError };
|
|
246
|
+
} finally {
|
|
247
|
+
await deps.cleanup(dir);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
async function drainOneCreateJob(store, createBox, workerId) {
|
|
252
|
+
if (!store.claimNextCreateJob || !store.completeCreateJob) return null;
|
|
253
|
+
const job = await store.claimNextCreateJob(workerId);
|
|
254
|
+
if (!job) return null;
|
|
255
|
+
try {
|
|
256
|
+
const { boxId, agentStartError } = await createBox(job.request, job.id);
|
|
257
|
+
if (agentStartError) {
|
|
258
|
+
await store.completeCreateJob(job.id, "failed", { boxId, error: agentStartError });
|
|
259
|
+
} else {
|
|
260
|
+
await store.completeCreateJob(job.id, "done", { boxId });
|
|
261
|
+
}
|
|
262
|
+
} catch (err2) {
|
|
263
|
+
await store.completeCreateJob(job.id, "failed", {
|
|
264
|
+
error: err2 instanceof Error ? err2.message : String(err2)
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return job.id;
|
|
268
|
+
}
|
|
269
|
+
async function drainCreateJobs(store, createBox, workerId, max = 10) {
|
|
270
|
+
let processed = 0;
|
|
271
|
+
while (processed < max) {
|
|
272
|
+
const id = await drainOneCreateJob(store, createBox, workerId);
|
|
273
|
+
if (!id) break;
|
|
274
|
+
processed++;
|
|
275
|
+
}
|
|
276
|
+
return processed;
|
|
277
|
+
}
|
|
278
|
+
var pgBoxes = pgTable("boxes", {
|
|
279
|
+
boxId: text("box_id").primaryKey(),
|
|
280
|
+
token: text("token").notNull(),
|
|
281
|
+
originUrl: text("origin_url"),
|
|
282
|
+
data: jsonb("data").$type().notNull(),
|
|
283
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull()
|
|
284
|
+
});
|
|
285
|
+
var pgEvents = pgTable("events", {
|
|
286
|
+
id: bigint("id", { mode: "number" }).generatedAlwaysAsIdentity().primaryKey(),
|
|
287
|
+
boxId: text("box_id").notNull(),
|
|
288
|
+
type: text("type").notNull(),
|
|
289
|
+
ts: text("ts"),
|
|
290
|
+
payload: jsonb("payload"),
|
|
291
|
+
receivedAt: timestamp("received_at", { withTimezone: true }).notNull()
|
|
292
|
+
});
|
|
293
|
+
var pgBoxStatus = pgTable("box_status", {
|
|
294
|
+
boxId: text("box_id").primaryKey(),
|
|
295
|
+
name: text("name"),
|
|
296
|
+
projectIndex: integer("project_index"),
|
|
297
|
+
status: jsonb("status").$type().notNull(),
|
|
298
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
299
|
+
});
|
|
300
|
+
var pgPrompts = pgTable("prompts", {
|
|
301
|
+
id: text("id").primaryKey(),
|
|
302
|
+
boxId: text("box_id").notNull(),
|
|
303
|
+
ev: jsonb("ev").$type().notNull(),
|
|
304
|
+
method: text("method").notNull(),
|
|
305
|
+
params: jsonb("params"),
|
|
306
|
+
status: text("status").$type().notNull(),
|
|
307
|
+
answer: text("answer").$type(),
|
|
308
|
+
cancelled: boolean("cancelled"),
|
|
309
|
+
result: jsonb("result").$type(),
|
|
310
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
311
|
+
expiresAt: timestamp("expires_at", { withTimezone: true })
|
|
312
|
+
});
|
|
313
|
+
var pgCreateJobs = pgTable("create_jobs", {
|
|
314
|
+
id: text("id").primaryKey(),
|
|
315
|
+
status: text("status").$type().notNull(),
|
|
316
|
+
request: jsonb("request").$type().notNull(),
|
|
317
|
+
result: jsonb("result").$type(),
|
|
318
|
+
claimedBy: text("claimed_by"),
|
|
319
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
320
|
+
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
321
|
+
finishedAt: timestamp("finished_at", { withTimezone: true })
|
|
322
|
+
});
|
|
323
|
+
var PG_SCHEMA_SQL = `
|
|
324
|
+
CREATE TABLE IF NOT EXISTS boxes (
|
|
325
|
+
box_id text PRIMARY KEY,
|
|
326
|
+
token text NOT NULL,
|
|
327
|
+
origin_url text,
|
|
328
|
+
data jsonb NOT NULL,
|
|
329
|
+
registered_at timestamptz NOT NULL DEFAULT now()
|
|
330
|
+
);
|
|
331
|
+
CREATE INDEX IF NOT EXISTS boxes_token_idx ON boxes (token);
|
|
332
|
+
|
|
333
|
+
CREATE TABLE IF NOT EXISTS events (
|
|
334
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
335
|
+
box_id text NOT NULL,
|
|
336
|
+
type text NOT NULL,
|
|
337
|
+
ts text,
|
|
338
|
+
payload jsonb,
|
|
339
|
+
received_at timestamptz NOT NULL DEFAULT now()
|
|
340
|
+
);
|
|
341
|
+
CREATE INDEX IF NOT EXISTS events_box_idx ON events (box_id, id);
|
|
342
|
+
|
|
343
|
+
CREATE TABLE IF NOT EXISTS box_status (
|
|
344
|
+
box_id text PRIMARY KEY,
|
|
345
|
+
name text,
|
|
346
|
+
project_index int,
|
|
347
|
+
status jsonb NOT NULL,
|
|
348
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
CREATE TABLE IF NOT EXISTS prompts (
|
|
352
|
+
id text PRIMARY KEY,
|
|
353
|
+
box_id text NOT NULL,
|
|
354
|
+
ev jsonb NOT NULL,
|
|
355
|
+
method text NOT NULL,
|
|
356
|
+
params jsonb,
|
|
357
|
+
status text NOT NULL DEFAULT 'pending',
|
|
358
|
+
answer text,
|
|
359
|
+
cancelled boolean,
|
|
360
|
+
result jsonb,
|
|
361
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
362
|
+
expires_at timestamptz
|
|
363
|
+
);
|
|
364
|
+
CREATE INDEX IF NOT EXISTS prompts_box_pending_idx ON prompts (box_id) WHERE status = 'pending';
|
|
365
|
+
|
|
366
|
+
CREATE TABLE IF NOT EXISTS create_jobs (
|
|
367
|
+
id text PRIMARY KEY,
|
|
368
|
+
status text NOT NULL DEFAULT 'queued',
|
|
369
|
+
request jsonb NOT NULL,
|
|
370
|
+
result jsonb,
|
|
371
|
+
claimed_by text,
|
|
372
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
373
|
+
started_at timestamptz,
|
|
374
|
+
finished_at timestamptz
|
|
375
|
+
);
|
|
376
|
+
CREATE INDEX IF NOT EXISTS create_jobs_queued_idx ON create_jobs (created_at) WHERE status = 'queued';
|
|
377
|
+
`;
|
|
378
|
+
var sqliteBoxes = sqliteTable(
|
|
379
|
+
"boxes",
|
|
380
|
+
{
|
|
381
|
+
boxId: text2("box_id").primaryKey(),
|
|
382
|
+
token: text2("token").notNull(),
|
|
383
|
+
originUrl: text2("origin_url"),
|
|
384
|
+
data: text2("data", { mode: "json" }).$type().notNull(),
|
|
385
|
+
registeredAt: text2("registered_at").notNull()
|
|
386
|
+
},
|
|
387
|
+
(t) => [index("boxes_token_idx").on(t.token)]
|
|
388
|
+
);
|
|
389
|
+
var sqliteEvents = sqliteTable(
|
|
390
|
+
"events",
|
|
391
|
+
{
|
|
392
|
+
id: integer2("id").primaryKey({ autoIncrement: true }),
|
|
393
|
+
boxId: text2("box_id").notNull(),
|
|
394
|
+
type: text2("type").notNull(),
|
|
395
|
+
ts: text2("ts"),
|
|
396
|
+
payload: text2("payload", { mode: "json" }),
|
|
397
|
+
receivedAt: text2("received_at").notNull()
|
|
398
|
+
},
|
|
399
|
+
(t) => [index("events_box_idx").on(t.boxId, t.id)]
|
|
400
|
+
);
|
|
401
|
+
var sqliteBoxStatus = sqliteTable("box_status", {
|
|
402
|
+
boxId: text2("box_id").primaryKey(),
|
|
403
|
+
name: text2("name"),
|
|
404
|
+
projectIndex: integer2("project_index"),
|
|
405
|
+
status: text2("status", { mode: "json" }).$type().notNull(),
|
|
406
|
+
updatedAt: text2("updated_at").notNull()
|
|
407
|
+
});
|
|
408
|
+
var sqlitePrompts = sqliteTable(
|
|
409
|
+
"prompts",
|
|
410
|
+
{
|
|
411
|
+
id: text2("id").primaryKey(),
|
|
412
|
+
boxId: text2("box_id").notNull(),
|
|
413
|
+
ev: text2("ev", { mode: "json" }).$type().notNull(),
|
|
414
|
+
method: text2("method").notNull(),
|
|
415
|
+
params: text2("params", { mode: "json" }),
|
|
416
|
+
status: text2("status").$type().notNull(),
|
|
417
|
+
answer: text2("answer").$type(),
|
|
418
|
+
cancelled: integer2("cancelled", { mode: "boolean" }),
|
|
419
|
+
result: text2("result", { mode: "json" }).$type(),
|
|
420
|
+
createdAt: text2("created_at").notNull(),
|
|
421
|
+
expiresAt: text2("expires_at")
|
|
422
|
+
},
|
|
423
|
+
(t) => [index("prompts_box_status_idx").on(t.boxId, t.status)]
|
|
424
|
+
);
|
|
425
|
+
var sqliteCreateJobs = sqliteTable(
|
|
426
|
+
"create_jobs",
|
|
427
|
+
{
|
|
428
|
+
id: text2("id").primaryKey(),
|
|
429
|
+
status: text2("status").$type().notNull(),
|
|
430
|
+
request: text2("request", { mode: "json" }).$type().notNull(),
|
|
431
|
+
result: text2("result", { mode: "json" }).$type(),
|
|
432
|
+
claimedBy: text2("claimed_by"),
|
|
433
|
+
createdAt: text2("created_at").notNull(),
|
|
434
|
+
startedAt: text2("started_at"),
|
|
435
|
+
finishedAt: text2("finished_at")
|
|
436
|
+
},
|
|
437
|
+
(t) => [index("create_jobs_status_idx").on(t.status, t.createdAt)]
|
|
438
|
+
);
|
|
439
|
+
function toIso(value) {
|
|
440
|
+
return value instanceof Date ? value.toISOString() : new Date(value).toISOString();
|
|
441
|
+
}
|
|
442
|
+
function toIsoOrUndefined(value) {
|
|
443
|
+
return value === null ? void 0 : toIso(value);
|
|
444
|
+
}
|
|
445
|
+
function rowToEvent(r) {
|
|
446
|
+
return {
|
|
447
|
+
id: Number(r.id),
|
|
448
|
+
boxId: r.boxId,
|
|
449
|
+
type: r.type,
|
|
450
|
+
ts: r.ts ?? void 0,
|
|
451
|
+
payload: r.payload ?? void 0,
|
|
452
|
+
receivedAt: toIso(r.receivedAt)
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function rowToPrompt(r) {
|
|
456
|
+
return {
|
|
457
|
+
id: r.id,
|
|
458
|
+
boxId: r.boxId,
|
|
459
|
+
ev: r.ev,
|
|
460
|
+
method: r.method,
|
|
461
|
+
params: r.params ?? void 0,
|
|
462
|
+
status: r.status,
|
|
463
|
+
answer: r.answer ?? void 0,
|
|
464
|
+
cancelled: r.cancelled ?? void 0,
|
|
465
|
+
result: r.result ?? void 0,
|
|
466
|
+
createdAt: toIso(r.createdAt),
|
|
467
|
+
expiresAt: toIsoOrUndefined(r.expiresAt)
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function rowToJob(r) {
|
|
471
|
+
return {
|
|
472
|
+
id: r.id,
|
|
473
|
+
status: r.status,
|
|
474
|
+
request: r.request,
|
|
475
|
+
result: r.result ?? void 0,
|
|
476
|
+
claimedBy: r.claimedBy ?? void 0,
|
|
477
|
+
createdAt: toIso(r.createdAt),
|
|
478
|
+
startedAt: toIsoOrUndefined(r.startedAt),
|
|
479
|
+
finishedAt: toIsoOrUndefined(r.finishedAt)
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
var DEFAULT_EVENT_CAP = RELAY_EVENT_RING_SIZE;
|
|
483
|
+
var PostgresStore = class {
|
|
484
|
+
eventCap;
|
|
485
|
+
connectionString;
|
|
486
|
+
injectedPool;
|
|
487
|
+
poolPromise = null;
|
|
488
|
+
dbPromise = null;
|
|
489
|
+
constructor(opts = {}) {
|
|
490
|
+
this.connectionString = opts.connectionString;
|
|
491
|
+
this.injectedPool = opts.pool;
|
|
492
|
+
this.eventCap = opts.eventCap ?? DEFAULT_EVENT_CAP;
|
|
493
|
+
}
|
|
494
|
+
/** Lazily build (or reuse) the pg Pool. `pg` is imported on first use only. */
|
|
495
|
+
pool() {
|
|
496
|
+
if (this.injectedPool) return Promise.resolve(this.injectedPool);
|
|
497
|
+
this.poolPromise ??= import("pg").then(
|
|
498
|
+
({ default: pg2 }) => new pg2.Pool({ connectionString: this.connectionString })
|
|
499
|
+
);
|
|
500
|
+
return this.poolPromise;
|
|
501
|
+
}
|
|
502
|
+
db() {
|
|
503
|
+
this.dbPromise ??= (async () => {
|
|
504
|
+
const pool = await this.pool();
|
|
505
|
+
const { drizzle } = await import("./node-postgres-6JUOVUN5.js");
|
|
506
|
+
return drizzle(pool);
|
|
507
|
+
})();
|
|
508
|
+
return this.dbPromise;
|
|
509
|
+
}
|
|
510
|
+
/** Create the tables if absent. Call once on boot (idempotent). */
|
|
511
|
+
async migrate() {
|
|
512
|
+
const pool = await this.pool();
|
|
513
|
+
await pool.query(PG_SCHEMA_SQL);
|
|
514
|
+
}
|
|
515
|
+
/** Release the pool (tests / graceful shutdown). No-op for an injected pool. */
|
|
516
|
+
async close() {
|
|
517
|
+
if (this.injectedPool) return;
|
|
518
|
+
if (this.poolPromise) {
|
|
519
|
+
const pool = await this.poolPromise;
|
|
520
|
+
await pool.end();
|
|
521
|
+
this.poolPromise = null;
|
|
522
|
+
this.dbPromise = null;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
// --- boxes ---
|
|
526
|
+
async registerBox(reg) {
|
|
527
|
+
const db = await this.db();
|
|
528
|
+
await db.insert(pgBoxes).values({
|
|
529
|
+
boxId: reg.boxId,
|
|
530
|
+
token: reg.token,
|
|
531
|
+
originUrl: reg.originUrl ?? null,
|
|
532
|
+
data: reg,
|
|
533
|
+
registeredAt: new Date(reg.registeredAt)
|
|
534
|
+
}).onConflictDoUpdate({
|
|
535
|
+
target: pgBoxes.boxId,
|
|
536
|
+
set: { token: reg.token, originUrl: reg.originUrl ?? null, data: reg }
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
async getBox(boxId) {
|
|
540
|
+
const db = await this.db();
|
|
541
|
+
const rows = await db.select({ data: pgBoxes.data }).from(pgBoxes).where(eq(pgBoxes.boxId, boxId));
|
|
542
|
+
return rows[0]?.data;
|
|
543
|
+
}
|
|
544
|
+
async authenticateBox(token) {
|
|
545
|
+
if (token.length === 0) return null;
|
|
546
|
+
const db = await this.db();
|
|
547
|
+
const rows = await db.select({ data: pgBoxes.data }).from(pgBoxes).where(eq(pgBoxes.token, token)).limit(1);
|
|
548
|
+
return rows[0]?.data ?? null;
|
|
549
|
+
}
|
|
550
|
+
async listBoxes() {
|
|
551
|
+
const db = await this.db();
|
|
552
|
+
const rows = await db.select({ data: pgBoxes.data }).from(pgBoxes).orderBy(asc(pgBoxes.registeredAt));
|
|
553
|
+
return rows.map((r) => r.data);
|
|
554
|
+
}
|
|
555
|
+
async forgetBox(boxId) {
|
|
556
|
+
const db = await this.db();
|
|
557
|
+
const rows = await db.delete(pgBoxes).where(eq(pgBoxes.boxId, boxId)).returning({ boxId: pgBoxes.boxId });
|
|
558
|
+
return rows.length > 0;
|
|
559
|
+
}
|
|
560
|
+
async countBoxes() {
|
|
561
|
+
const db = await this.db();
|
|
562
|
+
return db.$count(pgBoxes);
|
|
563
|
+
}
|
|
564
|
+
// --- events ---
|
|
565
|
+
async appendEvent(input) {
|
|
566
|
+
const db = await this.db();
|
|
567
|
+
const rows = await db.insert(pgEvents).values({
|
|
568
|
+
boxId: input.boxId,
|
|
569
|
+
type: input.type,
|
|
570
|
+
ts: input.ts ?? null,
|
|
571
|
+
payload: input.payload ?? null,
|
|
572
|
+
receivedAt: /* @__PURE__ */ new Date()
|
|
573
|
+
}).returning({ id: pgEvents.id, receivedAt: pgEvents.receivedAt });
|
|
574
|
+
const row = rows[0];
|
|
575
|
+
if (this.eventCap > 0) {
|
|
576
|
+
await db.delete(pgEvents).where(lte(pgEvents.id, row.id - this.eventCap));
|
|
577
|
+
}
|
|
578
|
+
return {
|
|
579
|
+
id: row.id,
|
|
580
|
+
boxId: input.boxId,
|
|
581
|
+
type: input.type,
|
|
582
|
+
ts: input.ts,
|
|
583
|
+
payload: input.payload,
|
|
584
|
+
receivedAt: row.receivedAt.toISOString()
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
async listEvents(since, boxId) {
|
|
588
|
+
const db = await this.db();
|
|
589
|
+
const where = boxId === void 0 ? gt(pgEvents.id, since) : and(gt(pgEvents.id, since), eq(pgEvents.boxId, boxId));
|
|
590
|
+
const rows = await db.select().from(pgEvents).where(where).orderBy(asc(pgEvents.id));
|
|
591
|
+
return rows.map(rowToEvent);
|
|
592
|
+
}
|
|
593
|
+
async countEvents() {
|
|
594
|
+
const db = await this.db();
|
|
595
|
+
return db.$count(pgEvents);
|
|
596
|
+
}
|
|
597
|
+
// --- status ---
|
|
598
|
+
async setStatus(boxId, name, projectIndex, status) {
|
|
599
|
+
const db = await this.db();
|
|
600
|
+
const updatedAt = /* @__PURE__ */ new Date();
|
|
601
|
+
await db.insert(pgBoxStatus).values({ boxId, name, projectIndex: projectIndex ?? null, status, updatedAt }).onConflictDoUpdate({
|
|
602
|
+
target: pgBoxStatus.boxId,
|
|
603
|
+
set: { name, projectIndex: projectIndex ?? null, status, updatedAt }
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
async getStatus(boxId) {
|
|
607
|
+
const db = await this.db();
|
|
608
|
+
const rows = await db.select({ status: pgBoxStatus.status }).from(pgBoxStatus).where(eq(pgBoxStatus.boxId, boxId));
|
|
609
|
+
return rows[0]?.status;
|
|
610
|
+
}
|
|
611
|
+
async deleteStatus(boxId) {
|
|
612
|
+
const db = await this.db();
|
|
613
|
+
await db.delete(pgBoxStatus).where(eq(pgBoxStatus.boxId, boxId));
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* All box status snapshots in one query (avoids N+1 over listBoxes +
|
|
617
|
+
* per-box getStatus). Used by the hosted hub UI to render every box's live
|
|
618
|
+
* status. Not on the Store interface — only the hosted stores need it.
|
|
619
|
+
*/
|
|
620
|
+
async listStatuses() {
|
|
621
|
+
const db = await this.db();
|
|
622
|
+
return db.select({ boxId: pgBoxStatus.boxId, status: pgBoxStatus.status }).from(pgBoxStatus);
|
|
623
|
+
}
|
|
624
|
+
// --- prompt mailbox ---
|
|
625
|
+
async createPrompt(row) {
|
|
626
|
+
const db = await this.db();
|
|
627
|
+
await db.insert(pgPrompts).values({
|
|
628
|
+
id: row.id,
|
|
629
|
+
boxId: row.boxId,
|
|
630
|
+
ev: row.ev,
|
|
631
|
+
method: row.method,
|
|
632
|
+
params: row.params ?? null,
|
|
633
|
+
status: row.status,
|
|
634
|
+
answer: row.answer ?? null,
|
|
635
|
+
cancelled: row.cancelled ?? null,
|
|
636
|
+
result: row.result ?? null,
|
|
637
|
+
createdAt: new Date(row.createdAt),
|
|
638
|
+
expiresAt: row.expiresAt ? new Date(row.expiresAt) : null
|
|
639
|
+
}).onConflictDoNothing({ target: pgPrompts.id });
|
|
640
|
+
}
|
|
641
|
+
async getPrompt(promptId) {
|
|
642
|
+
const db = await this.db();
|
|
643
|
+
const rows = await db.select().from(pgPrompts).where(eq(pgPrompts.id, promptId));
|
|
644
|
+
return rows[0] ? rowToPrompt(rows[0]) : null;
|
|
645
|
+
}
|
|
646
|
+
async answerPrompt(promptId, answer, cancelled) {
|
|
647
|
+
const db = await this.db();
|
|
648
|
+
const rows = await db.update(pgPrompts).set({ status: "answered", answer, cancelled: cancelled ?? null }).where(and(eq(pgPrompts.id, promptId), eq(pgPrompts.status, "pending"))).returning({ id: pgPrompts.id });
|
|
649
|
+
return rows.length > 0;
|
|
650
|
+
}
|
|
651
|
+
async listPendingPrompts(boxId) {
|
|
652
|
+
const db = await this.db();
|
|
653
|
+
const rows = await db.select().from(pgPrompts).where(and(eq(pgPrompts.boxId, boxId), eq(pgPrompts.status, "pending"))).orderBy(asc(pgPrompts.createdAt));
|
|
654
|
+
return rows.map(rowToPrompt);
|
|
655
|
+
}
|
|
656
|
+
async setPromptResult(promptId, result) {
|
|
657
|
+
const db = await this.db();
|
|
658
|
+
await db.update(pgPrompts).set({ result }).where(eq(pgPrompts.id, promptId));
|
|
659
|
+
}
|
|
660
|
+
// --- box-create job queue ---
|
|
661
|
+
async enqueueCreateJob(job) {
|
|
662
|
+
const db = await this.db();
|
|
663
|
+
await db.insert(pgCreateJobs).values({
|
|
664
|
+
id: job.id,
|
|
665
|
+
status: job.status,
|
|
666
|
+
request: job.request,
|
|
667
|
+
result: job.result ?? null,
|
|
668
|
+
claimedBy: job.claimedBy ?? null,
|
|
669
|
+
createdAt: new Date(job.createdAt),
|
|
670
|
+
startedAt: job.startedAt ? new Date(job.startedAt) : null,
|
|
671
|
+
finishedAt: job.finishedAt ? new Date(job.finishedAt) : null
|
|
672
|
+
}).onConflictDoNothing({ target: pgCreateJobs.id });
|
|
673
|
+
}
|
|
674
|
+
async getCreateJob(id) {
|
|
675
|
+
const db = await this.db();
|
|
676
|
+
const rows = await db.select().from(pgCreateJobs).where(eq(pgCreateJobs.id, id));
|
|
677
|
+
return rows[0] ? rowToJob(rows[0]) : null;
|
|
678
|
+
}
|
|
679
|
+
async listCreateJobs(opts) {
|
|
680
|
+
const db = await this.db();
|
|
681
|
+
const base = db.select().from(pgCreateJobs);
|
|
682
|
+
const filtered = opts?.status?.length ? base.where(inArray(pgCreateJobs.status, opts.status)) : base;
|
|
683
|
+
const rows = await filtered.orderBy(desc(pgCreateJobs.createdAt)).limit(opts?.limit ?? 100);
|
|
684
|
+
return rows.map(rowToJob);
|
|
685
|
+
}
|
|
686
|
+
async claimNextCreateJob(workerId) {
|
|
687
|
+
const db = await this.db();
|
|
688
|
+
const oldestQueued = db.select({ id: pgCreateJobs.id }).from(pgCreateJobs).where(eq(pgCreateJobs.status, "queued")).orderBy(asc(pgCreateJobs.createdAt)).limit(1).for("update", { skipLocked: true });
|
|
689
|
+
const rows = await db.update(pgCreateJobs).set({ status: "running", claimedBy: workerId, startedAt: /* @__PURE__ */ new Date() }).where(inArray(pgCreateJobs.id, oldestQueued)).returning();
|
|
690
|
+
return rows[0] ? rowToJob(rows[0]) : null;
|
|
691
|
+
}
|
|
692
|
+
async completeCreateJob(id, status, result) {
|
|
693
|
+
const db = await this.db();
|
|
694
|
+
await db.update(pgCreateJobs).set({ status, result, finishedAt: /* @__PURE__ */ new Date() }).where(eq(pgCreateJobs.id, id));
|
|
695
|
+
}
|
|
696
|
+
// --- retention (timestamptz columns compare against a Date) ---
|
|
697
|
+
async prunePrompts(beforeIso) {
|
|
698
|
+
const db = await this.db();
|
|
699
|
+
const before = new Date(beforeIso);
|
|
700
|
+
const rows = await db.delete(pgPrompts).where(
|
|
701
|
+
or(
|
|
702
|
+
and(eq(pgPrompts.status, "answered"), lt(pgPrompts.createdAt, before)),
|
|
703
|
+
and(isNotNull(pgPrompts.expiresAt), lt(pgPrompts.expiresAt, before))
|
|
704
|
+
)
|
|
705
|
+
).returning({ id: pgPrompts.id });
|
|
706
|
+
return rows.length;
|
|
707
|
+
}
|
|
708
|
+
async pruneCreateJobs(beforeIso) {
|
|
709
|
+
const db = await this.db();
|
|
710
|
+
const before = new Date(beforeIso);
|
|
711
|
+
const rows = await db.delete(pgCreateJobs).where(
|
|
712
|
+
and(
|
|
713
|
+
inArray(pgCreateJobs.status, ["done", "failed"]),
|
|
714
|
+
isNotNull(pgCreateJobs.finishedAt),
|
|
715
|
+
lt(pgCreateJobs.finishedAt, before)
|
|
716
|
+
)
|
|
717
|
+
).returning({ id: pgCreateJobs.id });
|
|
718
|
+
return rows.length;
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
var DEFAULT_SQLITE_STORE_PATH = join(STATE_DIR, "hub", "store.db");
|
|
722
|
+
var DEFAULT_CUSTODY_DIR = join2(STATE_DIR, "hub", "custody");
|
|
723
|
+
|
|
724
|
+
// ../../packages/relay/dist/chunk-4ZINSJOP.js
|
|
725
|
+
import { execa } from "execa";
|
|
726
|
+
import { createHash, randomBytes } from "crypto";
|
|
727
|
+
|
|
728
|
+
// ../../packages/integrations/dist/index.js
|
|
729
|
+
var linearConnector = {
|
|
730
|
+
service: "linear",
|
|
731
|
+
hostBin: "linear",
|
|
732
|
+
detect: {
|
|
733
|
+
versionArgs: ["--version"],
|
|
734
|
+
authArgs: ["auth", "whoami"],
|
|
735
|
+
installHint: "install @schpet/linear-cli: npm i -g @schpet/linear-cli",
|
|
736
|
+
loginHint: "linear auth login"
|
|
737
|
+
},
|
|
738
|
+
ops: {
|
|
739
|
+
whoami: {
|
|
740
|
+
write: false,
|
|
741
|
+
buildArgv: (args) => ["auth", "whoami", ...args]
|
|
742
|
+
},
|
|
743
|
+
"issue.list": {
|
|
744
|
+
write: false,
|
|
745
|
+
buildArgv: (args) => ["issue", "list", ...args]
|
|
746
|
+
},
|
|
747
|
+
"issue.mine": {
|
|
748
|
+
// The v2-native read for "issues assigned to me" — the README directs
|
|
749
|
+
// users here in place of the older `issue list --me`. Listed as a
|
|
750
|
+
// separate op so the shim doesn't reject the canonical form.
|
|
751
|
+
write: false,
|
|
752
|
+
buildArgv: (args) => ["issue", "mine", ...args]
|
|
753
|
+
},
|
|
754
|
+
"issue.view": {
|
|
755
|
+
write: false,
|
|
756
|
+
buildArgv: (args) => ["issue", "view", ...args]
|
|
757
|
+
},
|
|
758
|
+
"issue.query": {
|
|
759
|
+
write: false,
|
|
760
|
+
buildArgv: (args) => ["issue", "query", ...args]
|
|
761
|
+
},
|
|
762
|
+
"team.list": {
|
|
763
|
+
write: false,
|
|
764
|
+
buildArgv: (args) => ["team", "list", ...args]
|
|
765
|
+
},
|
|
766
|
+
api: {
|
|
767
|
+
write: false,
|
|
768
|
+
buildArgv: (args) => ["api", ...args],
|
|
769
|
+
refuseCall: refuseGraphqlNonQuery
|
|
770
|
+
},
|
|
771
|
+
"issue.create": {
|
|
772
|
+
write: true,
|
|
773
|
+
buildArgv: (args) => ["issue", "create", ...args]
|
|
774
|
+
},
|
|
775
|
+
"issue.update": {
|
|
776
|
+
write: true,
|
|
777
|
+
buildArgv: (args) => ["issue", "update", ...args]
|
|
778
|
+
},
|
|
779
|
+
"issue.comment": {
|
|
780
|
+
// Maps to `linear issue comment add` — `@schpet/linear-cli` v2 uses
|
|
781
|
+
// `add` (not `create`); `add`'s sibling subcommands are `list`,
|
|
782
|
+
// `update`, `delete`.
|
|
783
|
+
write: true,
|
|
784
|
+
buildArgv: (args) => ["issue", "comment", "add", ...args]
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
function refuseGraphqlNonQuery(args) {
|
|
789
|
+
const refuse = (reason) => ({
|
|
790
|
+
exitCode: 65,
|
|
791
|
+
stderr: `linear api: ${reason}
|
|
792
|
+
`
|
|
793
|
+
});
|
|
794
|
+
for (let i = 0; i < args.length; i++) {
|
|
795
|
+
const arg = args[i] ?? "";
|
|
796
|
+
if (arg === "--input" || arg.startsWith("--input=")) {
|
|
797
|
+
return refuse("'--input' (stdin/file body) isn't supported through the relay");
|
|
798
|
+
}
|
|
799
|
+
if (arg === "--variable") {
|
|
800
|
+
const next = args[i + 1] ?? "";
|
|
801
|
+
if (variableValueIsFileLoad(next)) {
|
|
802
|
+
return refuse(
|
|
803
|
+
"'--variable key=@<path>' (host-file load) isn't supported through the relay"
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
if (!next.startsWith("--")) i++;
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
if (arg.startsWith("--variable=")) {
|
|
810
|
+
if (variableValueIsFileLoad(arg.slice("--variable=".length))) {
|
|
811
|
+
return refuse(
|
|
812
|
+
"'--variable=key=@<path>' (host-file load) isn't supported through the relay"
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
if (arg === "--variables-json") {
|
|
818
|
+
const next = args[i + 1] ?? "";
|
|
819
|
+
if (!next.startsWith("--")) i++;
|
|
820
|
+
continue;
|
|
821
|
+
}
|
|
822
|
+
if (arg.startsWith("--variables-json=")) {
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
if (arg.startsWith("--")) continue;
|
|
826
|
+
const op = firstGraphqlOperationKeyword(arg);
|
|
827
|
+
if (op === "mutation" || op === "subscription") {
|
|
828
|
+
return refuse(
|
|
829
|
+
`only GraphQL queries are proxied (use issue.create / issue.update / issue.comment for writes); detected operation '${op}'`
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
if (op === "unparseable") {
|
|
833
|
+
return refuse(
|
|
834
|
+
`couldn't classify positional argv ${JSON.stringify(arg)} as a GraphQL operation (expected 'query', 'mutation', 'subscription', or '{')`
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return null;
|
|
839
|
+
}
|
|
840
|
+
function variableValueIsFileLoad(value) {
|
|
841
|
+
if (value.startsWith("@")) return true;
|
|
842
|
+
return value.includes("=@");
|
|
843
|
+
}
|
|
844
|
+
function firstGraphqlOperationKeyword(source) {
|
|
845
|
+
let i = 0;
|
|
846
|
+
const n = source.length;
|
|
847
|
+
while (i < n) {
|
|
848
|
+
const c = source[i];
|
|
849
|
+
if (/\s/.test(c) || c === "," || c === "\uFEFF") {
|
|
850
|
+
i++;
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
if (c === "#") {
|
|
854
|
+
while (i < n && source[i] !== "\n") i++;
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
if (i >= n) return null;
|
|
860
|
+
if (source[i] === "{") return "anonymous";
|
|
861
|
+
let j = i;
|
|
862
|
+
while (j < n) {
|
|
863
|
+
const c = source[j];
|
|
864
|
+
if (c >= "a" && c <= "z" || c >= "A" && c <= "Z") {
|
|
865
|
+
j++;
|
|
866
|
+
} else {
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
if (j === i) return "unparseable";
|
|
871
|
+
return source.slice(i, j).toLowerCase();
|
|
872
|
+
}
|
|
873
|
+
var notionConnector = {
|
|
874
|
+
service: "notion",
|
|
875
|
+
hostBin: "ntn",
|
|
876
|
+
detect: {
|
|
877
|
+
versionArgs: ["--version"],
|
|
878
|
+
authArgs: ["api", "v1/users/me"],
|
|
879
|
+
installHint: "install ntn: https://developers.notion.com/reference/notion-cli",
|
|
880
|
+
loginHint: "ntn login"
|
|
881
|
+
},
|
|
882
|
+
ops: {
|
|
883
|
+
whoami: {
|
|
884
|
+
write: false,
|
|
885
|
+
buildArgv: (args) => ["whoami", ...args]
|
|
886
|
+
},
|
|
887
|
+
api: {
|
|
888
|
+
write: false,
|
|
889
|
+
buildArgv: (args) => ["api", ...args],
|
|
890
|
+
refuseCall: refuseUnsafeApiCall
|
|
891
|
+
},
|
|
892
|
+
"page.create": {
|
|
893
|
+
write: true,
|
|
894
|
+
buildArgv: (args) => ["pages", "create", ...args]
|
|
895
|
+
},
|
|
896
|
+
"page.update": {
|
|
897
|
+
write: true,
|
|
898
|
+
buildArgv: (args) => ["pages", "update", ...args]
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
var READ_POST_ENDPOINTS = [
|
|
903
|
+
/^\/?v1\/search$/,
|
|
904
|
+
/^\/?v1\/databases\/[^/?]+\/query$/,
|
|
905
|
+
/^\/?v1\/data_sources\/[^/?]+\/query$/
|
|
906
|
+
];
|
|
907
|
+
var SAFE_API_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
908
|
+
"--spec",
|
|
909
|
+
"--docs",
|
|
910
|
+
"-h",
|
|
911
|
+
"--help",
|
|
912
|
+
"-v",
|
|
913
|
+
"--verbose",
|
|
914
|
+
"-V",
|
|
915
|
+
"--version"
|
|
916
|
+
]);
|
|
917
|
+
function refuseUnsafeApiCall(args) {
|
|
918
|
+
const refuse = (reason) => ({
|
|
919
|
+
exitCode: 65,
|
|
920
|
+
stderr: `notion api: ${reason}
|
|
921
|
+
`
|
|
922
|
+
});
|
|
923
|
+
let explicitMethod = null;
|
|
924
|
+
let hasBody = false;
|
|
925
|
+
let endpoint = null;
|
|
926
|
+
for (let i = 0; i < args.length; i++) {
|
|
927
|
+
const arg = args[i] ?? "";
|
|
928
|
+
if (arg === "-X" || arg === "--method") {
|
|
929
|
+
explicitMethod = args[i + 1] ?? "";
|
|
930
|
+
i++;
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
if (arg.startsWith("--method=")) {
|
|
934
|
+
explicitMethod = arg.slice("--method=".length);
|
|
935
|
+
continue;
|
|
936
|
+
}
|
|
937
|
+
if (arg.startsWith("-X") && arg.length > 2) {
|
|
938
|
+
explicitMethod = arg.slice(2).replace(/^=/, "");
|
|
939
|
+
continue;
|
|
940
|
+
}
|
|
941
|
+
if (arg === "-d" || arg === "--data") {
|
|
942
|
+
hasBody = true;
|
|
943
|
+
i++;
|
|
944
|
+
continue;
|
|
945
|
+
}
|
|
946
|
+
if (arg.startsWith("--data=") || arg.startsWith("-d") && arg.length > 2) {
|
|
947
|
+
hasBody = true;
|
|
948
|
+
continue;
|
|
949
|
+
}
|
|
950
|
+
if (arg === "--file" || arg.startsWith("--file=")) {
|
|
951
|
+
return refuse("'--file' (host-file upload) isn't supported through the relay");
|
|
952
|
+
}
|
|
953
|
+
if (arg === "--input" || arg.startsWith("--input=")) {
|
|
954
|
+
return refuse("'--input' (stdin/file body) isn't supported through the relay; use -d <JSON>");
|
|
955
|
+
}
|
|
956
|
+
if (arg === "--notion-version") {
|
|
957
|
+
i++;
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
if (arg.startsWith("--notion-version=")) continue;
|
|
961
|
+
if (arg.startsWith("-")) {
|
|
962
|
+
if (SAFE_API_BOOLEAN_FLAGS.has(arg)) continue;
|
|
963
|
+
return refuse(
|
|
964
|
+
`unsupported option '${arg}' (read-only api accepts a path, inline inputs, -d <JSON>, -X GET/POST, --notion-version, --spec, --docs)`
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
if (endpoint === null) {
|
|
968
|
+
endpoint = arg;
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
if (isBodyAssignment(arg)) hasBody = true;
|
|
972
|
+
}
|
|
973
|
+
const method = (explicitMethod && explicitMethod.length > 0 ? explicitMethod : hasBody ? "POST" : "GET").toUpperCase();
|
|
974
|
+
if (method === "GET") return null;
|
|
975
|
+
if (method !== "POST") {
|
|
976
|
+
return refuse(
|
|
977
|
+
`only GET and read-only POST are proxied (use page.create / page.update for writes); detected method '${method}'`
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
if (endpoint === null) {
|
|
981
|
+
return refuse("could not determine the API endpoint for a non-GET call");
|
|
982
|
+
}
|
|
983
|
+
if (endpoint.split("/").some((seg) => seg === "." || seg === "..")) {
|
|
984
|
+
return refuse(`path traversal segments ('.' / '..') are not allowed in '${endpoint}'`);
|
|
985
|
+
}
|
|
986
|
+
if (READ_POST_ENDPOINTS.some((re) => re.test(endpoint))) return null;
|
|
987
|
+
return refuse(
|
|
988
|
+
`POST is only proxied for read endpoints (v1/search, v1/databases/{id}/query, v1/data_sources/{id}/query); '${endpoint}' is not one (use page.create / page.update for writes)`
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
function isBodyAssignment(token) {
|
|
992
|
+
if (token.includes(":=")) return true;
|
|
993
|
+
if (token.includes("==")) return false;
|
|
994
|
+
return token.includes("=");
|
|
995
|
+
}
|
|
996
|
+
var ALL_CONNECTORS = [notionConnector, linearConnector];
|
|
997
|
+
|
|
998
|
+
// ../../packages/relay/dist/chunk-4ZINSJOP.js
|
|
999
|
+
import { execa as execa2 } from "execa";
|
|
1000
|
+
import { spawn as spawn4 } from "child_process";
|
|
1001
|
+
import { randomBytes as randomBytes2 } from "crypto";
|
|
1002
|
+
import {
|
|
1003
|
+
mkdir,
|
|
1004
|
+
readdir,
|
|
1005
|
+
readFile,
|
|
1006
|
+
rename,
|
|
1007
|
+
unlink,
|
|
1008
|
+
writeFile
|
|
1009
|
+
} from "fs/promises";
|
|
1010
|
+
import { join as join22 } from "path";
|
|
1011
|
+
var GH_PR_OPS = [
|
|
1012
|
+
"create",
|
|
1013
|
+
"view",
|
|
1014
|
+
"list",
|
|
1015
|
+
"diff",
|
|
1016
|
+
"checks",
|
|
1017
|
+
"comment",
|
|
1018
|
+
"review",
|
|
1019
|
+
"merge",
|
|
1020
|
+
"checkout",
|
|
1021
|
+
"close",
|
|
1022
|
+
"reopen"
|
|
1023
|
+
];
|
|
1024
|
+
var PR_REVIEW_COMMENT = /^repos\/[^/]+\/[^/]+\/pulls\/\d+\/comments(\?.*)?$/;
|
|
1025
|
+
var PR_REVIEW_COMMENT_REPLY = /^repos\/[^/]+\/[^/]+\/pulls\/\d+\/comments\/\d+\/replies(\?.*)?$/;
|
|
1026
|
+
var GH_API_WRITE_ALLOWED_ENDPOINTS = [
|
|
1027
|
+
PR_REVIEW_COMMENT,
|
|
1028
|
+
PR_REVIEW_COMMENT_REPLY
|
|
1029
|
+
];
|
|
1030
|
+
var GH_API_ALLOWED_ENDPOINTS = [...GH_API_WRITE_ALLOWED_ENDPOINTS];
|
|
1031
|
+
function injectPrCreateHead(op, branch, args) {
|
|
1032
|
+
if (op !== "create") return args;
|
|
1033
|
+
if (!branch || branch === "HEAD") return args;
|
|
1034
|
+
if (hasHeadArg(args)) return args;
|
|
1035
|
+
return ["--head", branch, ...args];
|
|
1036
|
+
}
|
|
1037
|
+
function hasHeadArg(args) {
|
|
1038
|
+
return args.some((a) => a === "--head" || a.startsWith("--head=") || a.startsWith("-H"));
|
|
1039
|
+
}
|
|
1040
|
+
function hashRpcParams(params) {
|
|
1041
|
+
return createHash("sha256").update(canonicalJson(params)).digest("hex");
|
|
1042
|
+
}
|
|
1043
|
+
function canonicalJson(v) {
|
|
1044
|
+
if (v === null) return "null";
|
|
1045
|
+
if (typeof v === "undefined") return "null";
|
|
1046
|
+
if (typeof v === "number") return Number.isFinite(v) ? String(v) : "null";
|
|
1047
|
+
if (typeof v === "boolean") return v ? "true" : "false";
|
|
1048
|
+
if (typeof v === "string") return JSON.stringify(v);
|
|
1049
|
+
if (Array.isArray(v)) return "[" + v.map(canonicalJson).join(",") + "]";
|
|
1050
|
+
if (typeof v === "object") {
|
|
1051
|
+
const entries = Object.entries(v).filter(([k]) => k !== "hostInitiated").filter(([, val]) => val !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1052
|
+
return "{" + entries.map(([k, val]) => JSON.stringify(k) + ":" + canonicalJson(val)).join(",") + "}";
|
|
1053
|
+
}
|
|
1054
|
+
return "null";
|
|
1055
|
+
}
|
|
1056
|
+
var DEFAULT_HOST_ACTION_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
1057
|
+
var MAX_BODY_BYTES = 1024 * 1024;
|
|
1058
|
+
var DEFAULT_CUSTODY_MAX_BODY_BYTES = 32 * 1024 * 1024;
|
|
1059
|
+
var QUEUE_DIR = join22(STATE_DIR2, "queue");
|
|
1060
|
+
async function loadQueueConfig() {
|
|
1061
|
+
const d = BUILT_IN_DEFAULTS.queue;
|
|
1062
|
+
let global = {};
|
|
1063
|
+
try {
|
|
1064
|
+
global = parseUserConfig(await readFile(GLOBAL_CONFIG_FILE, "utf8"), GLOBAL_CONFIG_FILE);
|
|
1065
|
+
} catch {
|
|
1066
|
+
}
|
|
1067
|
+
const q = global.queue ?? {};
|
|
1068
|
+
return {
|
|
1069
|
+
enabled: q.enabled ?? d.enabled,
|
|
1070
|
+
maxConcurrent: q.maxConcurrent ?? d.maxConcurrent,
|
|
1071
|
+
maxWorking: q.maxWorking ?? d.maxWorking,
|
|
1072
|
+
idleGraceMs: (q.idleGraceSeconds ?? d.idleGraceSeconds) * 1e3
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
async function writeJob(job) {
|
|
1076
|
+
await mkdir(QUEUE_DIR, { recursive: true });
|
|
1077
|
+
const final = join22(QUEUE_DIR, `${job.id}.json`);
|
|
1078
|
+
const tmp = `${final}.tmp.${String(process.pid)}.${String(Date.now())}`;
|
|
1079
|
+
await writeFile(tmp, JSON.stringify(job, null, 2) + "\n", "utf8");
|
|
1080
|
+
await rename(tmp, final);
|
|
1081
|
+
}
|
|
1082
|
+
async function enqueueQueueJob(input) {
|
|
1083
|
+
const cfg = await loadQueueConfig();
|
|
1084
|
+
const ceiling = typeof input.maxRunningOverride === "number" && input.maxRunningOverride > 0 ? input.maxRunningOverride : cfg.maxConcurrent;
|
|
1085
|
+
const maxWorking = typeof input.maxWorkingOverride === "number" && input.maxWorkingOverride > 0 ? input.maxWorkingOverride : void 0;
|
|
1086
|
+
const id = randomBytes2(9).toString("hex");
|
|
1087
|
+
const job = {
|
|
1088
|
+
id,
|
|
1089
|
+
agent: input.agent,
|
|
1090
|
+
status: "queued",
|
|
1091
|
+
boxName: input.boxName,
|
|
1092
|
+
providerName: input.providerName,
|
|
1093
|
+
prompt: input.prompt,
|
|
1094
|
+
agentArgs: input.agentArgs,
|
|
1095
|
+
...input.noAgent ? { noAgent: true } : {},
|
|
1096
|
+
...input.setupWizard ? { setupWizard: true } : {},
|
|
1097
|
+
createOpts: input.createOpts,
|
|
1098
|
+
maxConcurrent: ceiling,
|
|
1099
|
+
...maxWorking !== void 0 ? { maxWorking } : {},
|
|
1100
|
+
...input.openTerminal !== void 0 ? { openTerminal: input.openTerminal } : {},
|
|
1101
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1102
|
+
logPath: queueLogPath(id)
|
|
1103
|
+
};
|
|
1104
|
+
await writeJob(job);
|
|
1105
|
+
let runningCount = 0;
|
|
1106
|
+
try {
|
|
1107
|
+
runningCount = await defaultCountRunningBoxes();
|
|
1108
|
+
} catch {
|
|
1109
|
+
runningCount = 0;
|
|
1110
|
+
}
|
|
1111
|
+
return { job, runningCount, maxConcurrent: ceiling };
|
|
1112
|
+
}
|
|
1113
|
+
async function readJob(id) {
|
|
1114
|
+
try {
|
|
1115
|
+
const raw = await readFile(join22(QUEUE_DIR, `${id}.json`), "utf8");
|
|
1116
|
+
return JSON.parse(raw);
|
|
1117
|
+
} catch (err) {
|
|
1118
|
+
if (err.code === "ENOENT") return null;
|
|
1119
|
+
throw err;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
async function deleteJob(id) {
|
|
1123
|
+
try {
|
|
1124
|
+
await unlink(join22(QUEUE_DIR, `${id}.json`));
|
|
1125
|
+
} catch (err) {
|
|
1126
|
+
if (err.code !== "ENOENT") throw err;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
async function loadQueue() {
|
|
1130
|
+
let entries;
|
|
1131
|
+
try {
|
|
1132
|
+
entries = await readdir(QUEUE_DIR);
|
|
1133
|
+
} catch (err) {
|
|
1134
|
+
if (err.code === "ENOENT") return [];
|
|
1135
|
+
throw err;
|
|
1136
|
+
}
|
|
1137
|
+
const out = [];
|
|
1138
|
+
for (const name of entries) {
|
|
1139
|
+
if (!name.endsWith(".json")) continue;
|
|
1140
|
+
try {
|
|
1141
|
+
const raw = await readFile(join22(QUEUE_DIR, name), "utf8");
|
|
1142
|
+
out.push(JSON.parse(raw));
|
|
1143
|
+
} catch {
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
out.sort((a, b) => a.createdAt < b.createdAt ? -1 : a.createdAt > b.createdAt ? 1 : 0);
|
|
1147
|
+
return out;
|
|
1148
|
+
}
|
|
1149
|
+
var TERMINAL_RETENTION_MS = 60 * 60 * 1e3;
|
|
1150
|
+
var SWEEP_INTERVAL_MS = 60 * 1e3;
|
|
1151
|
+
function processAlive(pid) {
|
|
1152
|
+
try {
|
|
1153
|
+
process.kill(pid, 0);
|
|
1154
|
+
return true;
|
|
1155
|
+
} catch {
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function countInFlightCreateJobs(jobs, accountedBoxIds) {
|
|
1160
|
+
let n = 0;
|
|
1161
|
+
for (const j of jobs) {
|
|
1162
|
+
if (j.kind === "prepare") continue;
|
|
1163
|
+
if (j.status !== "running") continue;
|
|
1164
|
+
if (j.boxId && accountedBoxIds.has(j.boxId)) continue;
|
|
1165
|
+
if (typeof j.pid === "number" && !processAlive(j.pid)) continue;
|
|
1166
|
+
n += 1;
|
|
1167
|
+
}
|
|
1168
|
+
return n;
|
|
1169
|
+
}
|
|
1170
|
+
var RUNNING_COUNT_CACHE_MS = 3e3;
|
|
1171
|
+
var boxStateCache = null;
|
|
1172
|
+
async function defaultCountRunningBoxes() {
|
|
1173
|
+
const { boxCount, stateIds } = await cachedBoxState();
|
|
1174
|
+
let jobs;
|
|
1175
|
+
try {
|
|
1176
|
+
jobs = await loadQueue();
|
|
1177
|
+
} catch {
|
|
1178
|
+
return boxCount;
|
|
1179
|
+
}
|
|
1180
|
+
return boxCount + countInFlightCreateJobs(jobs, stateIds);
|
|
1181
|
+
}
|
|
1182
|
+
async function cachedBoxState() {
|
|
1183
|
+
const now = Date.now();
|
|
1184
|
+
if (boxStateCache && boxStateCache.expiresAt > now) {
|
|
1185
|
+
return { boxCount: boxStateCache.boxCount, stateIds: boxStateCache.stateIds };
|
|
1186
|
+
}
|
|
1187
|
+
const fresh = await uncachedBoxStateCount();
|
|
1188
|
+
boxStateCache = { ...fresh, expiresAt: now + RUNNING_COUNT_CACHE_MS };
|
|
1189
|
+
return fresh;
|
|
1190
|
+
}
|
|
1191
|
+
async function uncachedBoxStateCount() {
|
|
1192
|
+
let boxes;
|
|
1193
|
+
try {
|
|
1194
|
+
boxes = (await readState(STATE_FILE)).boxes;
|
|
1195
|
+
} catch {
|
|
1196
|
+
return { boxCount: 0, stateIds: /* @__PURE__ */ new Set() };
|
|
1197
|
+
}
|
|
1198
|
+
const stateIds = new Set(boxes.map((b) => b.id));
|
|
1199
|
+
if (boxes.length === 0) return { boxCount: 0, stateIds };
|
|
1200
|
+
let boxCount = 0;
|
|
1201
|
+
const dockerBoxes = [];
|
|
1202
|
+
for (const b of boxes) {
|
|
1203
|
+
const provider = b.provider ?? "docker";
|
|
1204
|
+
if (provider === "docker") {
|
|
1205
|
+
dockerBoxes.push(b);
|
|
1206
|
+
} else {
|
|
1207
|
+
boxCount += 1;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
if (dockerBoxes.length > 0) {
|
|
1211
|
+
const states = await Promise.all(dockerBoxes.map((b) => inspectDockerState(b.container)));
|
|
1212
|
+
for (const s of states) {
|
|
1213
|
+
if (s === "running") boxCount += 1;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
return { boxCount, stateIds };
|
|
1217
|
+
}
|
|
1218
|
+
function inspectDockerState(containerName) {
|
|
1219
|
+
return new Promise((resolveP) => {
|
|
1220
|
+
const child = spawn4("docker", ["inspect", "--format", "{{.State.Status}}", containerName], {
|
|
1221
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
1222
|
+
});
|
|
1223
|
+
let out = "";
|
|
1224
|
+
let settled = false;
|
|
1225
|
+
const finish = (state) => {
|
|
1226
|
+
if (settled) return;
|
|
1227
|
+
settled = true;
|
|
1228
|
+
resolveP(state);
|
|
1229
|
+
};
|
|
1230
|
+
const timer = setTimeout(() => {
|
|
1231
|
+
child.kill("SIGTERM");
|
|
1232
|
+
finish("other");
|
|
1233
|
+
}, 1e4);
|
|
1234
|
+
child.stdout?.on("data", (c) => {
|
|
1235
|
+
out += c.toString("utf8");
|
|
1236
|
+
});
|
|
1237
|
+
child.on("error", () => {
|
|
1238
|
+
clearTimeout(timer);
|
|
1239
|
+
finish("other");
|
|
1240
|
+
});
|
|
1241
|
+
child.on("close", () => {
|
|
1242
|
+
clearTimeout(timer);
|
|
1243
|
+
finish(out.trim() === "running" ? "running" : "other");
|
|
1244
|
+
});
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
var QUEUE_LOGS_DIR = join22(STATE_DIR2, "logs");
|
|
1248
|
+
function queueLogPath(id) {
|
|
1249
|
+
return join22(QUEUE_LOGS_DIR, `queue-${id}.log`);
|
|
1250
|
+
}
|
|
1251
|
+
function queueLoginCodePath(id) {
|
|
1252
|
+
return join22(QUEUE_DIR, `${id}.login-code`);
|
|
1253
|
+
}
|
|
1254
|
+
async function takeQueueLoginCode(id) {
|
|
1255
|
+
try {
|
|
1256
|
+
const code = (await readFile(queueLoginCodePath(id), "utf8")).trim();
|
|
1257
|
+
await unlink(queueLoginCodePath(id)).catch(() => {
|
|
1258
|
+
});
|
|
1259
|
+
return code.length > 0 ? code : null;
|
|
1260
|
+
} catch {
|
|
1261
|
+
return null;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
var FAILURE_BACKOFF_MS = 5 * 6e4;
|
|
1265
|
+
var DEFAULT_RETENTION_MS = 24 * 60 * 6e4;
|
|
1266
|
+
var DEFAULT_INTERVAL_MS4 = 60 * 6e4;
|
|
1267
|
+
|
|
1268
|
+
// ../../packages/relay/dist/index.js
|
|
1269
|
+
var BOX_SSH_USER = "vscode";
|
|
1270
|
+
function normalizeRegistrationAgent(agent) {
|
|
1271
|
+
return agent === "claude" || agent === "codex" || agent === "opencode" ? agent : void 0;
|
|
1272
|
+
}
|
|
1273
|
+
function buildSshTarget(provider, sandboxId, publicHost) {
|
|
1274
|
+
if (!publicHost) return void 0;
|
|
1275
|
+
const dir = boxSshDirForProvider(provider, sandboxId);
|
|
1276
|
+
return {
|
|
1277
|
+
host: publicHost,
|
|
1278
|
+
user: BOX_SSH_USER,
|
|
1279
|
+
...dir ? { identityFile: `${dir}/id_ed25519` } : {}
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
function registrationToBoxRecord(reg, opts) {
|
|
1283
|
+
const provider = reg.backend ?? "docker";
|
|
1284
|
+
const sandboxId = reg.sandboxId ?? reg.boxId;
|
|
1285
|
+
const { existing, projectRoot, projectIndex, controlPlaneUrl, freshToken } = opts;
|
|
1286
|
+
const branch = reg.worktrees?.[0]?.branch ?? `agentbox/${reg.name}`;
|
|
1287
|
+
const sanctionedBranch = reg.worktrees?.[0]?.sanctionedBranch ?? branch;
|
|
1288
|
+
const gitWorktrees = projectRoot ? [
|
|
1289
|
+
{
|
|
1290
|
+
kind: "root",
|
|
1291
|
+
branch,
|
|
1292
|
+
sanctionedBranch,
|
|
1293
|
+
containerPath: "/workspace",
|
|
1294
|
+
hostMainRepo: projectRoot,
|
|
1295
|
+
gitWorktreePath: "",
|
|
1296
|
+
relPathFromWorkspace: ""
|
|
1297
|
+
}
|
|
1298
|
+
] : void 0;
|
|
1299
|
+
return {
|
|
1300
|
+
id: existing?.id ?? reg.boxId,
|
|
1301
|
+
name: reg.name,
|
|
1302
|
+
displayName: existing?.displayName,
|
|
1303
|
+
provider,
|
|
1304
|
+
container: `cloud:${sandboxId}`,
|
|
1305
|
+
image: reg.image ?? existing?.image ?? "",
|
|
1306
|
+
workspacePath: projectRoot ?? existing?.workspacePath ?? "/workspace",
|
|
1307
|
+
projectRoot,
|
|
1308
|
+
projectIndex,
|
|
1309
|
+
// Tokens are regenerated only for a fresh adoption; a re-adopt keeps the
|
|
1310
|
+
// box's live tokens (already injected in the running box).
|
|
1311
|
+
relayToken: existing?.relayToken ?? reg.token ?? freshToken(),
|
|
1312
|
+
lastAgent: normalizeRegistrationAgent(reg.agent) ?? existing?.lastAgent,
|
|
1313
|
+
gitWorktrees,
|
|
1314
|
+
createdAt: reg.createdAt ?? existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
1315
|
+
ssh: buildSshTarget(provider, sandboxId, reg.publicHost) ?? existing?.ssh,
|
|
1316
|
+
cloud: {
|
|
1317
|
+
...existing?.cloud,
|
|
1318
|
+
backend: provider,
|
|
1319
|
+
sandboxId,
|
|
1320
|
+
image: reg.image ?? existing?.cloud?.image,
|
|
1321
|
+
webPort: reg.webPort ?? existing?.cloud?.webPort,
|
|
1322
|
+
publicHost: reg.publicHost ?? existing?.cloud?.publicHost,
|
|
1323
|
+
bridgeToken: reg.bridgeToken ?? existing?.cloud?.bridgeToken ?? freshToken(),
|
|
1324
|
+
relayPreviewUrl: reg.previewUrl ?? existing?.cloud?.relayPreviewUrl,
|
|
1325
|
+
relayPreviewToken: reg.previewToken ?? existing?.cloud?.relayPreviewToken,
|
|
1326
|
+
workspaceBranch: branch,
|
|
1327
|
+
sanctionedBranch,
|
|
1328
|
+
lastState: existing?.cloud?.lastState ?? "running",
|
|
1329
|
+
topology: "control-plane",
|
|
1330
|
+
controlPlaneUrl,
|
|
1331
|
+
// A hub-created box clones in-box from a leased URL — it shares no fork
|
|
1332
|
+
// base with a PC, so the session-start live resync must skip it.
|
|
1333
|
+
hostSeeded: void 0
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
var RemoteStore = class {
|
|
1338
|
+
url;
|
|
1339
|
+
token;
|
|
1340
|
+
fetchImpl;
|
|
1341
|
+
constructor(opts) {
|
|
1342
|
+
this.url = `${opts.baseUrl.replace(/\/$/, "")}/admin/store`;
|
|
1343
|
+
this.token = opts.adminToken;
|
|
1344
|
+
this.fetchImpl = opts.fetchImpl ?? fetch;
|
|
1345
|
+
}
|
|
1346
|
+
async call(method, args) {
|
|
1347
|
+
const res = await this.fetchImpl(this.url, {
|
|
1348
|
+
method: "POST",
|
|
1349
|
+
headers: {
|
|
1350
|
+
"Content-Type": "application/json",
|
|
1351
|
+
Authorization: `Bearer ${this.token}`
|
|
1352
|
+
},
|
|
1353
|
+
body: JSON.stringify({ method, args })
|
|
1354
|
+
});
|
|
1355
|
+
if (!res.ok) {
|
|
1356
|
+
throw new Error(`remote store ${method} \u2192 ${String(res.status)}`);
|
|
1357
|
+
}
|
|
1358
|
+
const body = await res.json();
|
|
1359
|
+
return body.result;
|
|
1360
|
+
}
|
|
1361
|
+
registerBox(reg) {
|
|
1362
|
+
return this.call("registerBox", [reg]);
|
|
1363
|
+
}
|
|
1364
|
+
getBox(boxId) {
|
|
1365
|
+
return this.call("getBox", [boxId]).then((r) => r ?? void 0);
|
|
1366
|
+
}
|
|
1367
|
+
authenticateBox(token) {
|
|
1368
|
+
return this.call("authenticateBox", [token]);
|
|
1369
|
+
}
|
|
1370
|
+
listBoxes() {
|
|
1371
|
+
return this.call("listBoxes", []);
|
|
1372
|
+
}
|
|
1373
|
+
forgetBox(boxId) {
|
|
1374
|
+
return this.call("forgetBox", [boxId]);
|
|
1375
|
+
}
|
|
1376
|
+
countBoxes() {
|
|
1377
|
+
return this.call("countBoxes", []);
|
|
1378
|
+
}
|
|
1379
|
+
appendEvent(input) {
|
|
1380
|
+
return this.call("appendEvent", [input]);
|
|
1381
|
+
}
|
|
1382
|
+
listEvents(since, boxId) {
|
|
1383
|
+
return this.call("listEvents", [since, boxId]);
|
|
1384
|
+
}
|
|
1385
|
+
countEvents() {
|
|
1386
|
+
return this.call("countEvents", []);
|
|
1387
|
+
}
|
|
1388
|
+
setStatus(boxId, name, projectIndex, status) {
|
|
1389
|
+
return this.call("setStatus", [boxId, name, projectIndex, status]);
|
|
1390
|
+
}
|
|
1391
|
+
getStatus(boxId) {
|
|
1392
|
+
return this.call("getStatus", [boxId]).then((r) => r ?? void 0);
|
|
1393
|
+
}
|
|
1394
|
+
deleteStatus(boxId) {
|
|
1395
|
+
return this.call("deleteStatus", [boxId]);
|
|
1396
|
+
}
|
|
1397
|
+
listStatuses() {
|
|
1398
|
+
return this.call("listStatuses", []);
|
|
1399
|
+
}
|
|
1400
|
+
createPrompt(row) {
|
|
1401
|
+
return this.call("createPrompt", [row]);
|
|
1402
|
+
}
|
|
1403
|
+
getPrompt(promptId) {
|
|
1404
|
+
return this.call("getPrompt", [promptId]);
|
|
1405
|
+
}
|
|
1406
|
+
answerPrompt(promptId, answer, cancelled) {
|
|
1407
|
+
return this.call("answerPrompt", [promptId, answer, cancelled]);
|
|
1408
|
+
}
|
|
1409
|
+
listPendingPrompts(boxId) {
|
|
1410
|
+
return this.call("listPendingPrompts", [boxId]);
|
|
1411
|
+
}
|
|
1412
|
+
setPromptResult(promptId, result) {
|
|
1413
|
+
return this.call("setPromptResult", [promptId, result]);
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1417
|
+
export {
|
|
1418
|
+
DEFAULT_RELAY_PORT,
|
|
1419
|
+
RELAY_CONTAINER_NAME,
|
|
1420
|
+
RELAY_NETWORK_NAME,
|
|
1421
|
+
RELAY_IMAGE_REF,
|
|
1422
|
+
parseGitRemote,
|
|
1423
|
+
toAuthedHttpsUrl,
|
|
1424
|
+
loadGitHubAppConfig,
|
|
1425
|
+
GitHubAppLeaser,
|
|
1426
|
+
cloneRepoWithLfs,
|
|
1427
|
+
makeControlPlaneCreateBox,
|
|
1428
|
+
drainCreateJobs,
|
|
1429
|
+
PostgresStore,
|
|
1430
|
+
ALL_CONNECTORS,
|
|
1431
|
+
GH_PR_OPS,
|
|
1432
|
+
injectPrCreateHead,
|
|
1433
|
+
hashRpcParams,
|
|
1434
|
+
loadQueueConfig,
|
|
1435
|
+
writeJob,
|
|
1436
|
+
enqueueQueueJob,
|
|
1437
|
+
readJob,
|
|
1438
|
+
deleteJob,
|
|
1439
|
+
loadQueue,
|
|
1440
|
+
takeQueueLoginCode,
|
|
1441
|
+
registrationToBoxRecord,
|
|
1442
|
+
RemoteStore
|
|
1443
|
+
};
|
|
1444
|
+
//# sourceMappingURL=chunk-ZJL56TJD.js.map
|