@baochunli/flakes 0.0.5 → 0.0.6
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/dist/node_modules/@flakes/auth/package.json +1 -1
- package/dist/node_modules/@flakes/console/.output/nitro.json +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{DocumentationPage-CNPk8RVl.js → DocumentationPage-CGIcMKwf.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/ProjectsPage-ByTl4Kyy.js +1 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/RunPage-5MmbVpaE.js +3 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/{RunsPage-CJbycrqM.js → RunsPage-fbDKP9kM.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{SandboxesLens-BoLM52PY.js → SandboxesLens-DPG87mUE.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/SandboxesPage-DIpzR_Ef.js +1 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/TranscriptPage-mCgSqfv0.js +1 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/_-CM2hE2sZ.js +1 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/_runId-3ZZOAqUK.js +2 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/_taskId-cy4RxW8Y.js +2 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/{account-BoRurhrq.js → account-BWoGGXJw.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{account-forms-D4eVqOhW.js → account-forms-Dq70JDyg.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{auth-layout-DBnq_eif.js → auth-layout-BFusNq3W.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{bits-BOMPEHvv.js → bits-CTGNpp-v.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/device-BajR3eSF.js +1 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/documentation-6ao_Ux6x.js +1 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/{forgot-password-BSQ4TWpA.js → forgot-password-DOKn8_7P.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/main-DVO9gWzi.js +1215 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/{otp-verification-CussJQT1.js → otp-verification-qolVtiom.js} +2 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/projects-n5LSsNi3.js +2 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/{reset-password-DwWhVkEh.js → reset-password-D-OlZeHQ.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/runs-BB9ogobQ.js +2 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/sandboxes-BIimz5FI.js +2 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/{security-MjM55vIw.js → security-DdQNcp6k.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{signin-KbA1cD6o.js → signin-BoZiVxyq.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{signin-form-CBF-d8iK.js → signin-form-tTBWDjhi.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{signup-CbHsThKr.js → signup-CBSszmUC.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/styles-B8OXOvkO.css +2 -0
- package/dist/node_modules/@flakes/console/.output/server/{_-BULJ6utw.mjs → _-BGsKgsbF.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/{_-_ST9QYWn.mjs → _-DtPMXzt0.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/_chunks/ProjectsPage.mjs +1 -2
- package/dist/node_modules/@flakes/console/.output/server/_chunks/RunPage.mjs +1 -2
- package/dist/node_modules/@flakes/console/.output/server/_chunks/RunsPage.mjs +1 -2
- package/dist/node_modules/@flakes/console/.output/server/_chunks/SandboxesLens.mjs +1 -1
- package/dist/node_modules/@flakes/console/.output/server/_chunks/SandboxesPage.mjs +253 -18
- package/dist/node_modules/@flakes/console/.output/server/_chunks/TranscriptPage.mjs +1 -2
- package/dist/node_modules/@flakes/console/.output/server/_chunks/bits.mjs +1 -1
- package/dist/node_modules/@flakes/console/.output/server/_chunks/button.mjs +461 -3
- package/dist/node_modules/@flakes/console/.output/server/_chunks/card.mjs +1 -1
- package/dist/node_modules/@flakes/console/.output/server/_chunks/router.mjs +3 -4
- package/dist/node_modules/@flakes/console/.output/server/_chunks/table.mjs +1 -1
- package/dist/node_modules/@flakes/console/.output/server/{_runId-WZmbo654.mjs → _runId-P1u-vfcm.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/{_runId-CmYWNL8A.mjs → _runId-vO4tlCOP.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{App-CUx8Ftit.mjs → App-C-XaVKoO.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{DocumentationPage-0I9oWWJT.mjs → DocumentationPage-BR2KosFz.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{ProjectsPage-CGj9V2Of.mjs → ProjectsPage-BUrep1wl.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{RunPage-B2vhVaj6.mjs → RunPage-BHs-v0LU.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{RunsPage-BifKogQE.mjs → RunsPage-iTNYVwL0.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/SandboxesPage-C1Z6dVce.mjs +423 -0
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{TranscriptPage-deSxVZaQ.mjs → TranscriptPage-BcomoTls.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{account-D5y9vkAc.mjs → account-Cp0s_IQK.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{documentation-C91gfyy0.mjs → documentation-BnxmM-Yo.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{documentation-C69e9_eF.mjs → documentation-Cgyr3VKK.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{hooks-DrgN35zn.mjs → hooks-CsVtQ1m-.mjs} +117 -51
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{projects-lJ2tIIPj.mjs → projects-R9sxR_t4.mjs} +1 -1
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{router-DHxFQ03L.mjs → router-CobdI6gO.mjs} +12 -12
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{runs-dnPfp9dt.mjs → runs-D8MHe3QU.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{runs-BWxEGKO_.mjs → runs-mTxbc_pm.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{sandboxes-v28LJQM3.mjs → sandboxes-B2z_9JyU.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{sandboxes-hxFINxDS.mjs → sandboxes-r0y6Ihg6.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/_ssr/ssr.mjs +2 -2
- package/dist/node_modules/@flakes/console/.output/server/{_tanstack-start-manifest_v-DfwuEzTr.mjs → _tanstack-start-manifest_v-DpAwCFK9.mjs} +32 -33
- package/dist/node_modules/@flakes/console/.output/server/{_taskId-CBo95z-s.mjs → _taskId-Cz9xwj5L.mjs} +2 -2
- package/dist/node_modules/@flakes/console/.output/server/{_taskId-Sil3-PKh.mjs → _taskId-wQsG2CQj.mjs} +3 -3
- package/dist/node_modules/@flakes/console/package.json +1 -1
- package/dist/node_modules/@flakes/control-plane/dist/host-credentials.d.ts +1 -1
- package/dist/node_modules/@flakes/control-plane/dist/host-credentials.d.ts.map +1 -1
- package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes.js +48 -3
- package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes.js.map +1 -1
- package/dist/node_modules/@flakes/control-plane/package.json +1 -1
- package/dist/node_modules/@flakes/core/package.json +1 -1
- package/dist/node_modules/@flakes/harness-agent/package.json +1 -1
- package/dist/node_modules/@flakes/harness-sdk/package.json +1 -1
- package/dist/node_modules/@flakes/pi-agent/package.json +1 -1
- package/dist/node_modules/@flakes/protocol/package.json +1 -1
- package/dist/node_modules/@flakes/sandbox-runtime/package.json +1 -1
- package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.d.ts +9 -1
- package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.d.ts.map +1 -1
- package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.js +407 -6
- package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.js.map +1 -1
- package/dist/node_modules/@flakes/store/dist/mappers.d.ts.map +1 -1
- package/dist/node_modules/@flakes/store/dist/mappers.js +1 -0
- package/dist/node_modules/@flakes/store/dist/mappers.js.map +1 -1
- package/dist/node_modules/@flakes/store/dist/types.d.ts +30 -1
- package/dist/node_modules/@flakes/store/dist/types.d.ts.map +1 -1
- package/dist/node_modules/@flakes/store/package.json +1 -1
- package/package.json +1 -1
- package/dist/node_modules/@flakes/auth/dist/better-auth-shape.d.ts +0 -10
- package/dist/node_modules/@flakes/auth/dist/better-auth-shape.d.ts.map +0 -1
- package/dist/node_modules/@flakes/auth/dist/better-auth-shape.js +0 -16
- package/dist/node_modules/@flakes/auth/dist/better-auth-shape.js.map +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/ProjectsPage-CKPR1nnu.js +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/RunPage-BdugbnA3.js +0 -3
- package/dist/node_modules/@flakes/console/.output/public/assets/SandboxesPage-6KHjMeaR.js +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/TranscriptPage-CHSq0_qN.js +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/_-CD1Voz9h.js +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/_runId-_0VPmGYe.js +0 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/_taskId-CPAKAp4X.js +0 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/device-FqII-S41.js +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/dist-BEfdrJTS.js +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/documentation-2C3ncAuV.js +0 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/main-LpSDdT-S.js +0 -1215
- package/dist/node_modules/@flakes/console/.output/public/assets/projects-CLgKBrCe.js +0 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/runs-CFYk2iRh.js +0 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/sandboxes-mGsOcVFL.js +0 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/styles-DtA2wbW8.css +0 -2
- package/dist/node_modules/@flakes/console/.output/server/_chunks/utils.mjs +0 -393
- package/dist/node_modules/@flakes/console/.output/server/_ssr/SandboxesPage-DGji_OdB.mjs +0 -187
- package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.d.ts +0 -71
- package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.d.ts.map +0 -1
- package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.js +0 -243
- package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.js.map +0 -1
- package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.d.ts +0 -3
- package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.d.ts.map +0 -1
- package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.js +0 -153
- package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.js.map +0 -1
- package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.d.ts +0 -19
- package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.d.ts.map +0 -1
- package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.js +0 -46
- package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.js.map +0 -1
- package/dist/node_modules/@flakes/store/dist/sqlite.d.ts +0 -4
- package/dist/node_modules/@flakes/store/dist/sqlite.d.ts.map +0 -1
- package/dist/node_modules/@flakes/store/dist/sqlite.js +0 -34
- package/dist/node_modules/@flakes/store/dist/sqlite.js.map +0 -1
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { c as require_jsx_runtime } from "../_libs/@radix-ui/react-arrow+[...].mjs";
|
|
2
|
-
import { g as useRuns, h as useRunTasks } from "./hooks-DrgN35zn.mjs";
|
|
3
|
-
import { t as cn } from "./utils-C_uf36nf.mjs";
|
|
4
|
-
import { n as CardContent, t as Card } from "./card-SXNbNwk5.mjs";
|
|
5
|
-
import { c as taskOrdinals, d as useClockTick, n as Skeleton, r as StateBadge, u as timeAgo } from "./bits-BIFjjEu8.mjs";
|
|
6
|
-
import { I as ExternalLink, J as Boxes, X as ArrowRight } from "../_libs/lucide-react.mjs";
|
|
7
|
-
import { t as SandboxesLens } from "./SandboxesLens-Bzc8NizP.mjs";
|
|
8
|
-
//#region node_modules/.nitro/vite/services/ssr/assets/SandboxesPage-DGji_OdB.js
|
|
9
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
10
|
-
function SandboxesPage(props) {
|
|
11
|
-
const runs = useRuns();
|
|
12
|
-
useClockTick();
|
|
13
|
-
const loadedRuns = (runs.data?.pages ?? []).flatMap((page) => page.runs);
|
|
14
|
-
const selectedRun = loadedRuns.find((run) => run.runId === props.selectedRunId) ?? loadedRuns[0];
|
|
15
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
16
|
-
className: "grid gap-5",
|
|
17
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
18
|
-
className: "text-lg font-semibold tracking-tight",
|
|
19
|
-
children: "Sandboxes"
|
|
20
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
21
|
-
className: "text-sm text-muted-foreground",
|
|
22
|
-
children: "Sandboxes used by your runs. This is task/session context, not global fleet capacity."
|
|
23
|
-
})] }), runs.isError ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
24
|
-
className: "text-sm text-destructive",
|
|
25
|
-
children: ["Cannot list runs: ", String(runs.error)]
|
|
26
|
-
}) : runs.isPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingLayout, {}) : loadedRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
27
|
-
className: "grid min-w-0 gap-4 lg:grid-cols-[20rem_minmax(0,1fr)]",
|
|
28
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunChooser, {
|
|
29
|
-
runs: loadedRuns,
|
|
30
|
-
selectedRunId: selectedRun?.runId,
|
|
31
|
-
hasMore: runs.hasNextPage,
|
|
32
|
-
loadingMore: runs.isFetchingNextPage,
|
|
33
|
-
onLoadMore: () => void runs.fetchNextPage(),
|
|
34
|
-
onSelect: props.onSelectRun
|
|
35
|
-
}), selectedRun ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectedRunSandboxes, {
|
|
36
|
-
run: selectedRun,
|
|
37
|
-
onOpenRun: props.onOpenRun,
|
|
38
|
-
onOpenTask: props.onOpenTask
|
|
39
|
-
}) : null]
|
|
40
|
-
})]
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function LoadingLayout() {
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
45
|
-
className: "grid gap-4 lg:grid-cols-[20rem_minmax(0,1fr)]",
|
|
46
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
47
|
-
className: "gap-2 p-3",
|
|
48
|
-
children: [
|
|
49
|
-
0,
|
|
50
|
-
1,
|
|
51
|
-
2
|
|
52
|
-
].map((row) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-12 w-full" }, row))
|
|
53
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
|
|
54
|
-
className: "p-4",
|
|
55
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-5 w-40" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "mt-4 h-32 w-full" })]
|
|
56
|
-
})]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function EmptyState() {
|
|
60
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
61
|
-
className: "rounded-lg border border-dashed py-12 text-center",
|
|
62
|
-
children: [
|
|
63
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Boxes, { className: "mx-auto size-5 text-muted-foreground" }),
|
|
64
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
65
|
-
className: "mt-3 console-callout",
|
|
66
|
-
children: "No runs yet"
|
|
67
|
-
}),
|
|
68
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
69
|
-
className: "mt-2 text-sm text-muted-foreground",
|
|
70
|
-
children: "Sandbox placement appears after your account has task runs."
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function RunChooser(props) {
|
|
76
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
|
|
77
|
-
className: "gap-2 p-2",
|
|
78
|
-
children: [
|
|
79
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
80
|
-
className: "px-2 py-1",
|
|
81
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
|
|
82
|
-
className: "console-callout",
|
|
83
|
-
children: "Recent runs"
|
|
84
|
-
})
|
|
85
|
-
}),
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87
|
-
className: "grid gap-1",
|
|
88
|
-
children: props.runs.map((run) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunChoice, {
|
|
89
|
-
run,
|
|
90
|
-
selected: run.runId === props.selectedRunId,
|
|
91
|
-
onSelect: props.onSelect
|
|
92
|
-
}, run.runId))
|
|
93
|
-
}),
|
|
94
|
-
props.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
95
|
-
type: "button",
|
|
96
|
-
disabled: props.loadingMore,
|
|
97
|
-
onClick: props.onLoadMore,
|
|
98
|
-
className: "mt-1 rounded-md px-2 py-1.5 text-left font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground transition-colors hover:bg-secondary/60 disabled:cursor-wait disabled:opacity-60",
|
|
99
|
-
children: props.loadingMore ? "Loading" : "Load more"
|
|
100
|
-
}) : null
|
|
101
|
-
]
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function RunChoice(props) {
|
|
105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
106
|
-
type: "button",
|
|
107
|
-
"aria-pressed": props.selected,
|
|
108
|
-
onClick: () => props.onSelect(props.run.runId),
|
|
109
|
-
className: cn("grid min-w-0 gap-1 rounded-md px-2 py-2 text-left transition-colors", props.selected ? "bg-secondary text-foreground" : "text-muted-foreground hover:bg-secondary/60 hover:text-foreground"),
|
|
110
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
111
|
-
className: "flex min-w-0 items-center gap-2",
|
|
112
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
113
|
-
className: "min-w-0 flex-1 truncate text-sm font-medium",
|
|
114
|
-
children: props.run.name
|
|
115
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateBadge, {
|
|
116
|
-
state: props.run.state,
|
|
117
|
-
id: props.run.runId
|
|
118
|
-
})]
|
|
119
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
120
|
-
className: "flex min-w-0 items-center gap-2 font-mono text-[11px]",
|
|
121
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
122
|
-
className: "truncate",
|
|
123
|
-
title: props.run.runId,
|
|
124
|
-
children: props.run.runId
|
|
125
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
126
|
-
className: "shrink-0",
|
|
127
|
-
title: props.run.updatedAt,
|
|
128
|
-
"data-num": true,
|
|
129
|
-
children: timeAgo(props.run.updatedAt)
|
|
130
|
-
})]
|
|
131
|
-
})]
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
function SelectedRunSandboxes(props) {
|
|
135
|
-
const tasks = useRunTasks(props.run.runId);
|
|
136
|
-
const taskList = tasks.data?.tasks ?? [];
|
|
137
|
-
const ordinals = taskOrdinals(taskList);
|
|
138
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
139
|
-
className: "grid min-w-0 gap-3",
|
|
140
|
-
children: [
|
|
141
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
142
|
-
className: "py-0",
|
|
143
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardContent, {
|
|
144
|
-
className: "flex min-w-0 flex-wrap items-center gap-3 p-4",
|
|
145
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
146
|
-
className: "min-w-0 flex-1",
|
|
147
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
148
|
-
className: "flex min-w-0 items-center gap-2",
|
|
149
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
|
|
150
|
-
className: "min-w-0 truncate text-base font-semibold",
|
|
151
|
-
children: props.run.name
|
|
152
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateBadge, {
|
|
153
|
-
state: props.run.state,
|
|
154
|
-
id: props.run.runId
|
|
155
|
-
})]
|
|
156
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
157
|
-
className: "mt-1 truncate font-mono text-xs text-muted-foreground",
|
|
158
|
-
children: props.run.runId
|
|
159
|
-
})]
|
|
160
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
161
|
-
type: "button",
|
|
162
|
-
onClick: () => props.onOpenRun(props.run.runId),
|
|
163
|
-
className: "flex items-center gap-1.5 rounded-md border px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground",
|
|
164
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExternalLink, { className: "size-3.5" }), "Open run"]
|
|
165
|
-
})]
|
|
166
|
-
})
|
|
167
|
-
}),
|
|
168
|
-
tasks.isError ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
169
|
-
className: "text-sm text-destructive",
|
|
170
|
-
children: ["Cannot load tasks: ", String(tasks.error)]
|
|
171
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SandboxesLens, {
|
|
172
|
-
tasks: taskList,
|
|
173
|
-
ordinals,
|
|
174
|
-
pending: tasks.isPending,
|
|
175
|
-
onSelect: (taskId) => props.onOpenTask(props.run.runId, taskId)
|
|
176
|
-
}),
|
|
177
|
-
!tasks.isPending && taskList.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
178
|
-
type: "button",
|
|
179
|
-
onClick: () => props.onOpenRun(props.run.runId),
|
|
180
|
-
className: "inline-flex w-fit items-center gap-1.5 rounded-md px-2 py-1 font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground",
|
|
181
|
-
children: ["Open run by sandbox", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowRight, { className: "size-3.5" })]
|
|
182
|
-
}) : null
|
|
183
|
-
]
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
|
-
export { SandboxesPage };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { type FliesSandboxConfig, type ManagedSandboxPoolConfig } from "@flies/core";
|
|
2
|
-
import type { DurableStore, StoreManagedSandboxInstance, StoreTask } from "@flies/store";
|
|
3
|
-
import type { SandboxStreamRegistry } from "./sandbox-stream-registry.js";
|
|
4
|
-
/** Input handed to a provider-specific managed sandbox starter. */
|
|
5
|
-
export interface StartManagedSandboxInput {
|
|
6
|
-
pool: ManagedSandboxPoolConfig;
|
|
7
|
-
instance: StoreManagedSandboxInstance;
|
|
8
|
-
sandboxConfig: FliesSandboxConfig;
|
|
9
|
-
}
|
|
10
|
-
/** Provider result after launching a managed sandbox daemon environment. */
|
|
11
|
-
export type StartManagedSandboxResult = {
|
|
12
|
-
status: "started";
|
|
13
|
-
providerResourceId?: string | undefined;
|
|
14
|
-
} | {
|
|
15
|
-
status: "ambiguous";
|
|
16
|
-
providerResourceId?: string | undefined;
|
|
17
|
-
lastError?: string | undefined;
|
|
18
|
-
};
|
|
19
|
-
/** Narrow provider boundary owned by control-plane provisioning. */
|
|
20
|
-
export interface ManagedSandboxStarter {
|
|
21
|
-
start(input: StartManagedSandboxInput): Promise<StartManagedSandboxResult>;
|
|
22
|
-
}
|
|
23
|
-
export interface ManagedSandboxProvisionerOptions {
|
|
24
|
-
store: DurableStore;
|
|
25
|
-
/** Live stream boundary used to distinguish truly schedulable live slots from durable rows. */
|
|
26
|
-
registry?: SandboxStreamRegistry | undefined;
|
|
27
|
-
pools: readonly ManagedSandboxPoolConfig[];
|
|
28
|
-
starter: ManagedSandboxStarter;
|
|
29
|
-
cleaner?: ManagedSandboxCleaner | undefined;
|
|
30
|
-
pollIntervalMs: number;
|
|
31
|
-
queuedTaskLimit?: number | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Registers a per-instance sandbox-pinned credential so the minted token is
|
|
34
|
-
* accepted by sandbox-pinned routes (e.g. pi-session). Without it the instance
|
|
35
|
-
* would have no pinned sandbox credential and those routes reject with 403.
|
|
36
|
-
*/
|
|
37
|
-
registerSandboxCredential?: ((credential: {
|
|
38
|
-
sandboxId: string;
|
|
39
|
-
token: string;
|
|
40
|
-
}) => void) | undefined;
|
|
41
|
-
}
|
|
42
|
-
/** Input handed to a provider-specific managed sandbox cleanup action. */
|
|
43
|
-
export interface StopManagedSandboxInput {
|
|
44
|
-
instance: StoreManagedSandboxInstance;
|
|
45
|
-
providerResourceId: string;
|
|
46
|
-
}
|
|
47
|
-
/** Narrow provider boundary used for managed sandbox cleanup. */
|
|
48
|
-
export interface ManagedSandboxCleaner {
|
|
49
|
-
stop(input: StopManagedSandboxInput): Promise<void>;
|
|
50
|
-
}
|
|
51
|
-
export interface StopManagedSandboxInstancesInput {
|
|
52
|
-
store: DurableStore;
|
|
53
|
-
cleaner: ManagedSandboxCleaner;
|
|
54
|
-
}
|
|
55
|
-
/** Periodically starts managed sandbox instances to satisfy queued compatible demand. */
|
|
56
|
-
export declare class ManagedSandboxProvisioner {
|
|
57
|
-
#private;
|
|
58
|
-
constructor(options: ManagedSandboxProvisionerOptions);
|
|
59
|
-
/** Runs one provisioning pass. At most one instance is started per pool. */
|
|
60
|
-
tick(): Promise<void>;
|
|
61
|
-
/** Starts background provisioning; repeated calls are no-ops. */
|
|
62
|
-
start(): void;
|
|
63
|
-
/** Stops background provisioning if active. */
|
|
64
|
-
stop(): void;
|
|
65
|
-
}
|
|
66
|
-
/** Best-effort stop for every nonterminal managed instance. */
|
|
67
|
-
export declare function stopManagedSandboxInstances(input: StopManagedSandboxInstancesInput): Promise<void>;
|
|
68
|
-
export declare function createManagedSandboxConfig(pool: ManagedSandboxPoolConfig, sandboxId: string, token: string): FliesSandboxConfig;
|
|
69
|
-
/** MVP pre-launch match: only target adapter and required capabilities. */
|
|
70
|
-
export declare function isPreLaunchCompatible(task: StoreTask, pool: ManagedSandboxPoolConfig): boolean;
|
|
71
|
-
//# sourceMappingURL=managed-sandbox-provisioner.d.ts.map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;;OAIG;IACH,yBAAyB,CAAC,EACtB,CAAC,CAAC,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAC5D,SAAS,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,iEAAiE;AACjE,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,gCAAgC;IAC/C,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,qBAAqB,CAAC;CAChC;AAoBD,yFAAyF;AACzF,qBAAa,yBAAyB;;gBAcxB,OAAO,EAAE,gCAAgC;IAWrD,4EAA4E;IAC5E,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrB,iEAAiE;IACjE,KAAK;IAUL,+CAA+C;IAC/C,IAAI;CA0KL;AAED,+DAA+D;AAC/D,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,gCAAgC,GACtC,OAAO,CAAC,IAAI,CAAC,CAcf;AAoBD,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,wBAAwB,EAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,kBAAkB,CAMpB;AASD,2EAA2E;AAC3E,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,wBAAwB,WAW/B"}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { randomBytes } from "node:crypto";
|
|
2
|
-
import { createManagedSandboxConfig as createCoreManagedSandboxConfig, } from "@flies/core";
|
|
3
|
-
import { toError } from "./utils.js";
|
|
4
|
-
const defaultQueuedTaskLimit = 100;
|
|
5
|
-
const capacityStatuses = [
|
|
6
|
-
"starting",
|
|
7
|
-
"live",
|
|
8
|
-
"draining",
|
|
9
|
-
];
|
|
10
|
-
/** Periodically starts managed sandbox instances to satisfy queued compatible demand. */
|
|
11
|
-
export class ManagedSandboxProvisioner {
|
|
12
|
-
#timer;
|
|
13
|
-
#tickInFlight;
|
|
14
|
-
#store;
|
|
15
|
-
#registry;
|
|
16
|
-
#pools;
|
|
17
|
-
#starter;
|
|
18
|
-
#cleaner;
|
|
19
|
-
#pollIntervalMs;
|
|
20
|
-
#queuedTaskLimit;
|
|
21
|
-
#registerSandboxCredential;
|
|
22
|
-
constructor(options) {
|
|
23
|
-
this.#store = options.store;
|
|
24
|
-
this.#registry = options.registry;
|
|
25
|
-
this.#pools = options.pools;
|
|
26
|
-
this.#starter = options.starter;
|
|
27
|
-
this.#cleaner = options.cleaner;
|
|
28
|
-
this.#pollIntervalMs = options.pollIntervalMs;
|
|
29
|
-
this.#queuedTaskLimit = options.queuedTaskLimit ?? defaultQueuedTaskLimit;
|
|
30
|
-
this.#registerSandboxCredential = options.registerSandboxCredential;
|
|
31
|
-
}
|
|
32
|
-
/** Runs one provisioning pass. At most one instance is started per pool. */
|
|
33
|
-
tick() {
|
|
34
|
-
if (this.#tickInFlight) {
|
|
35
|
-
return this.#tickInFlight;
|
|
36
|
-
}
|
|
37
|
-
this.#tickInFlight = this.#runTick().finally(() => {
|
|
38
|
-
this.#tickInFlight = undefined;
|
|
39
|
-
});
|
|
40
|
-
return this.#tickInFlight;
|
|
41
|
-
}
|
|
42
|
-
/** Starts background provisioning; repeated calls are no-ops. */
|
|
43
|
-
start() {
|
|
44
|
-
if (this.#timer) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
this.#timer = globalThis.setInterval(() => {
|
|
48
|
-
void this.tick().catch(() => undefined);
|
|
49
|
-
}, this.#pollIntervalMs);
|
|
50
|
-
}
|
|
51
|
-
/** Stops background provisioning if active. */
|
|
52
|
-
stop() {
|
|
53
|
-
if (!this.#timer) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
globalThis.clearInterval(this.#timer);
|
|
57
|
-
this.#timer = undefined;
|
|
58
|
-
}
|
|
59
|
-
async #runTick() {
|
|
60
|
-
const tasks = await this.#store.listQueuedTasks({
|
|
61
|
-
limit: this.#queuedTaskLimit,
|
|
62
|
-
});
|
|
63
|
-
for (const pool of this.#pools) {
|
|
64
|
-
const compatibleQueuedDemand = countCompatibleQueuedDemand(tasks, pool);
|
|
65
|
-
const capacity = await this.#poolCapacity(pool);
|
|
66
|
-
if (compatibleQueuedDemand === 0) {
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (compatibleQueuedDemand <=
|
|
70
|
-
capacity.liveAvailableSlots + capacity.startingSlots) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (capacity.activeInstances >= pool.maxInstances) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
await this.#startInstance(pool);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async #poolCapacity(pool) {
|
|
80
|
-
const instances = await this.#store.listManagedSandboxInstances({
|
|
81
|
-
poolId: pool.poolId,
|
|
82
|
-
statuses: capacityStatuses,
|
|
83
|
-
});
|
|
84
|
-
let liveAvailableSlots = 0;
|
|
85
|
-
let startingSlots = 0;
|
|
86
|
-
let activeInstances = 0;
|
|
87
|
-
for (const instance of instances) {
|
|
88
|
-
if (instance.status === "starting") {
|
|
89
|
-
activeInstances += 1;
|
|
90
|
-
startingSlots += pool.maxConcurrency;
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
if (instance.status === "draining") {
|
|
94
|
-
activeInstances += 1;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
const liveCapacity = await this.#liveCapacity(instance);
|
|
98
|
-
if (liveCapacity.activeInstance) {
|
|
99
|
-
activeInstances += 1;
|
|
100
|
-
}
|
|
101
|
-
liveAvailableSlots += liveCapacity.availableSlots;
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
liveAvailableSlots,
|
|
105
|
-
startingSlots,
|
|
106
|
-
activeInstances,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
async #liveCapacity(instance) {
|
|
110
|
-
const sandbox = await this.#store.getSandbox(instance.sandboxId);
|
|
111
|
-
if (!sandbox || sandbox.status === "offline") {
|
|
112
|
-
await this.#store.markManagedSandboxInstanceFailed({
|
|
113
|
-
instanceId: instance.instanceId,
|
|
114
|
-
lastError: sandbox
|
|
115
|
-
? "managed sandbox live instance is offline"
|
|
116
|
-
: "managed sandbox live instance has no sandbox record",
|
|
117
|
-
});
|
|
118
|
-
return { activeInstance: false, availableSlots: 0 };
|
|
119
|
-
}
|
|
120
|
-
if (sandbox.status !== "active" ||
|
|
121
|
-
sandbox.descriptor?.draining === true ||
|
|
122
|
-
(this.#registry && !this.#registry.latest(instance.sandboxId))) {
|
|
123
|
-
return { activeInstance: true, availableSlots: 0 };
|
|
124
|
-
}
|
|
125
|
-
const load = await this.#store.getSandboxLoad(instance.sandboxId);
|
|
126
|
-
return { activeInstance: true, availableSlots: load.availableCapacity };
|
|
127
|
-
}
|
|
128
|
-
async #startInstance(pool) {
|
|
129
|
-
// Mint a credential pinned to this instance's sandboxId so sandbox-pinned
|
|
130
|
-
// routes accept the daemon's token.
|
|
131
|
-
const sandboxToken = randomBytes(32).toString("hex");
|
|
132
|
-
const instance = await this.#store.createManagedSandboxInstance({
|
|
133
|
-
poolId: pool.poolId,
|
|
134
|
-
sandboxToken,
|
|
135
|
-
});
|
|
136
|
-
this.#registerSandboxCredential?.({
|
|
137
|
-
sandboxId: instance.sandboxId,
|
|
138
|
-
token: sandboxToken,
|
|
139
|
-
});
|
|
140
|
-
const sandboxConfig = createManagedSandboxConfig(pool, instance.sandboxId, sandboxToken);
|
|
141
|
-
try {
|
|
142
|
-
const result = await this.#starter.start({
|
|
143
|
-
pool,
|
|
144
|
-
instance,
|
|
145
|
-
sandboxConfig,
|
|
146
|
-
});
|
|
147
|
-
if (result.providerResourceId) {
|
|
148
|
-
await this.#store.setManagedSandboxProviderResource({
|
|
149
|
-
instanceId: instance.instanceId,
|
|
150
|
-
providerResourceId: result.providerResourceId,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
if (result.status === "ambiguous") {
|
|
154
|
-
const lastError = result.lastError ??
|
|
155
|
-
"managed sandbox starter returned ambiguous result";
|
|
156
|
-
if (result.providerResourceId && this.#cleaner) {
|
|
157
|
-
try {
|
|
158
|
-
await this.#cleaner.stop({
|
|
159
|
-
instance: {
|
|
160
|
-
...instance,
|
|
161
|
-
providerResourceId: result.providerResourceId,
|
|
162
|
-
},
|
|
163
|
-
providerResourceId: result.providerResourceId,
|
|
164
|
-
});
|
|
165
|
-
await this.#store.markManagedSandboxInstanceStopped({
|
|
166
|
-
instanceId: instance.instanceId,
|
|
167
|
-
lastError,
|
|
168
|
-
});
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
catch (error) {
|
|
172
|
-
await this.#store.markManagedSandboxInstanceFailed({
|
|
173
|
-
instanceId: instance.instanceId,
|
|
174
|
-
lastError: `${lastError}; cleanup failed: ${toError(error).message}`,
|
|
175
|
-
});
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
await this.#store.markManagedSandboxInstanceFailed({
|
|
180
|
-
instanceId: instance.instanceId,
|
|
181
|
-
lastError,
|
|
182
|
-
});
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
const lastError = toError(error).message;
|
|
188
|
-
await this.#store.markManagedSandboxInstanceFailed({
|
|
189
|
-
instanceId: instance.instanceId,
|
|
190
|
-
lastError,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/** Best-effort stop for every nonterminal managed instance. */
|
|
196
|
-
export async function stopManagedSandboxInstances(input) {
|
|
197
|
-
const instances = await input.store.listManagedSandboxInstances({
|
|
198
|
-
statuses: capacityStatuses,
|
|
199
|
-
});
|
|
200
|
-
for (const instance of instances) {
|
|
201
|
-
try {
|
|
202
|
-
await stopManagedSandboxInstance({ ...input, instance });
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
await input.store.markManagedSandboxInstanceFailed({
|
|
206
|
-
instanceId: instance.instanceId,
|
|
207
|
-
lastError: `managed sandbox cleanup failed: ${toError(error).message}`,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
async function stopManagedSandboxInstance(input) {
|
|
213
|
-
if (!input.instance.providerResourceId) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
await input.cleaner.stop({
|
|
217
|
-
instance: input.instance,
|
|
218
|
-
providerResourceId: input.instance.providerResourceId,
|
|
219
|
-
});
|
|
220
|
-
await input.store.markManagedSandboxInstanceStopped({
|
|
221
|
-
instanceId: input.instance.instanceId,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
export function createManagedSandboxConfig(pool, sandboxId, token) {
|
|
225
|
-
return createCoreManagedSandboxConfig({
|
|
226
|
-
pool,
|
|
227
|
-
sandboxId,
|
|
228
|
-
token,
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
function countCompatibleQueuedDemand(tasks, pool) {
|
|
232
|
-
return tasks.filter((task) => isPreLaunchCompatible(task, pool)).length;
|
|
233
|
-
}
|
|
234
|
-
/** MVP pre-launch match: only target adapter and required capabilities. */
|
|
235
|
-
export function isPreLaunchCompatible(task, pool) {
|
|
236
|
-
const targetAdapter = task.target?.adapter;
|
|
237
|
-
if (targetAdapter && targetAdapter !== pool.adapter) {
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
const poolCapabilities = new Set([pool.adapter]);
|
|
241
|
-
return task.requiredCapabilities.every((capability) => poolCapabilities.has(capability));
|
|
242
|
-
}
|
|
243
|
-
//# sourceMappingURL=managed-sandbox-provisioner.js.map
|
|
@@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