sandcovery 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as CreditCheckout, Ct as Sandbox, Dt as SandboxStatus, E as DetachedExecRequest, Et as SandboxList, F as ExecResult, I as FileEntry, K as Key, M as EstimateRequest, N as ExecEvent, P as ExecRequest, Q as Offer, R as FileList, Rt as UpdateKeyRequest, S as CredentialFields, T as DetachedExec, Y as KeyList, at as Provider, b as CreatedKey, ct as ProviderCatalog, dt as ProviderCredentialList, i as ActivityList, j as EstimateList, jt as Snapshot, nt as PortPreview, o as Billing, ot as ProviderBoard, st as ProviderBoardEntry, ut as ProviderCredential, v as CreateKeyRequest, w as CreditPurchaseRequest, y as CreateSandboxRequest, zt as Usage } from "./types-DMB8KnA3.mjs";
1
+ import { A as CreatedKey, Ct as ProviderCatalog, Et as ProviderCredentialList, G as ExecRequest, H as EstimateList, Ht as SandboxStatus, I as DetachedExec, K as ExecResult, Kt as Snapshot, L as DetachedExecRequest, M as CredentialFields, N as CreditCheckout, O as CreateKeyRequest, P as CreditPurchaseRequest, Rt as Sandbox, S as CiJobList, St as ProviderBoardEntry, Tt as ProviderCredential, U as EstimateRequest, Vt as SandboxList, W as ExecEvent, Y as FileList, Zt as Stats, _t as Pricing, b as CiJob, bt as Provider, ft as Offer, gt as PortPreview, i as ActivityList, k as CreateSandboxRequest, lt as LiveUsage, nn as UpdateKeyRequest, ot as KeyList, q as FileEntry, rn as Usage, rt as Key, s as Billing, sn as UsageTotals, xt as ProviderBoard, y as CiInstallationList } from "./types-ZqbGCXKy.mjs";
2
2
  interface RequestOptions {
3
3
  readonly signal?: AbortSignal;
4
4
  }
@@ -45,7 +45,9 @@ interface KeysApi {
45
45
  readonly update: (keyId: string, request: UpdateKeyRequest, options?: RequestOptions) => Promise<Key>;
46
46
  }
47
47
  interface CredentialsApi {
48
+ readonly add: (provider: Provider, fields: CredentialFields, options?: RequestOptions) => Promise<ProviderCredential>;
48
49
  readonly delete: (provider: Provider, options?: RequestOptions) => Promise<void>;
50
+ readonly deleteOne: (provider: Provider, credentialId: string, options?: RequestOptions) => Promise<void>;
49
51
  readonly list: (options?: RequestOptions) => Promise<ProviderCredentialList>;
50
52
  readonly offer: (options?: RequestOptions) => Promise<Offer>;
51
53
  readonly set: (provider: Provider, fields: CredentialFields, options?: RequestOptions) => Promise<ProviderCredential>;
@@ -57,14 +59,31 @@ interface BillingApi {
57
59
  readonly buyCredits: (request: CreditPurchaseRequest, options?: RequestOptions) => Promise<CreditCheckout>;
58
60
  readonly get: (options?: RequestOptions) => Promise<Billing>;
59
61
  }
62
+ interface CiApi {
63
+ readonly getJob: (jobId: string, options?: RequestOptions) => Promise<CiJob>;
64
+ readonly listInstallations: (options?: RequestOptions) => Promise<CiInstallationList>;
65
+ readonly listJobs: (query?: PageQuery, options?: RequestOptions) => Promise<CiJobList>;
66
+ readonly unlinkInstallation: (installationId: number, options?: RequestOptions) => Promise<void>;
67
+ }
68
+ interface PricingApi {
69
+ readonly get: (options?: RequestOptions) => Promise<Pricing>;
70
+ }
60
71
  interface ProvidersApi {
61
72
  readonly catalog: (options?: RequestOptions) => Promise<ProviderCatalog>;
62
73
  readonly get: (provider: Provider, options?: RequestOptions) => Promise<ProviderBoardEntry>;
63
74
  readonly list: (options?: RequestOptions) => Promise<ProviderBoard>;
64
75
  }
76
+ interface StatsApi {
77
+ readonly get: (options?: RequestOptions) => Promise<Stats>;
78
+ }
79
+ interface UsageKeyQuery {
80
+ readonly api_key_id?: string;
81
+ }
65
82
  interface UsageApi {
66
83
  readonly estimate: (request: EstimateRequest, options?: RequestOptions) => Promise<EstimateList>;
67
84
  readonly get: (query: UsageQuery, options?: RequestOptions) => Promise<Usage>;
85
+ readonly live: (query?: UsageKeyQuery, options?: RequestOptions) => Promise<LiveUsage>;
86
+ readonly totals: (query?: UsageKeyQuery, options?: RequestOptions) => Promise<UsageTotals>;
68
87
  }
69
88
  export interface SandcoveryOptions {
70
89
  readonly apiKey?: string;
@@ -74,10 +93,13 @@ export interface SandcoveryOptions {
74
93
  export declare class Sandcovery {
75
94
  readonly activity: ActivityApi;
76
95
  readonly billing: BillingApi;
96
+ readonly ci: CiApi;
77
97
  readonly credentials: CredentialsApi;
78
98
  readonly keys: KeysApi;
99
+ readonly pricing: PricingApi;
79
100
  readonly providers: ProvidersApi;
80
101
  readonly sandboxes: SandboxesApi;
102
+ readonly stats: StatsApi;
81
103
  readonly usage: UsageApi;
82
104
  constructor(options?: SandcoveryOptions);
83
105
  }
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { t as Sandcovery } from "./src-YrynO3hz.mjs";
1
+ export { t as Sandcovery } from "./src-zWk1RjrB.mjs";
@@ -1,4 +1,4 @@
1
- import { A as optionalKey, C as isBetween, D as isUUID, E as isMultipleOf, O as makeFilter, S as isBase64Url$1, T as isMaxLength, a as Int, c as Literals, d as NonEmptyString, f as NullOr, g as Union, h as Struct, l as Natural, m as String$1, n as Boolean, p as Record, s as Literal, t as ArraySchema, u as NonEmptyArray, w as isGreaterThanOrEqualTo, x as is } from "./Schema-DiSfJzMf.mjs";
1
+ import { D as is, I as isUUID, L as makeFilter, M as isMaxLength, N as isMinLength, O as isBase64Url$1, P as isMultipleOf, _ as Struct, d as Natural, f as NonEmptyArray, g as String$1, h as Record, j as isGreaterThanOrEqualTo, k as isBetween, l as Literal, m as NullOr, n as Boolean, p as NonEmptyString, s as Int, t as ArraySchema, u as Literals, v as Union, z as optionalKey } from "./Schema-fLas6rbA.mjs";
2
2
  // ../sandcovery-contract/src/primitives.ts
3
3
  const PROVIDERS = [
4
4
  "daytona",
@@ -8,8 +8,8 @@ const PROVIDERS = [
8
8
  ];
9
9
  const PROVIDER_EXAMPLES = new Intl.ListFormat("en", { type: "disjunction" }).format(PROVIDERS.map((provider) => `\`${provider}\``));
10
10
  const SLUG_CHARACTERS = /* @__PURE__ */ new Set("abcdefghijklmnopqrstuvwxyz0123456789-");
11
- const isSlug = (value) => value !== "" && value.split("").every((character) => SLUG_CHARACTERS.has(character));
12
- const Provider = String$1.check(makeFilter(isSlug, {
11
+ const isProviderName = (value) => value !== "" && value.split("").every((character) => SLUG_CHARACTERS.has(character));
12
+ const Provider = String$1.check(makeFilter(isProviderName, {
13
13
  expected: "a provider name of lowercase letters, digits, and hyphens",
14
14
  toJsonSchema: () => ({ minLength: 1 })
15
15
  })).annotate({
@@ -57,6 +57,8 @@ const prefixedId = (prefix, noun) => String$1.check(makeFilter((value) => hasPre
57
57
  })).annotate({ description: `${noun} ID: \`${prefix}\` followed by a UUID v7.` });
58
58
  const SandboxId = prefixedId("sbx_", "Sandbox");
59
59
  const SnapshotId = prefixedId("snap_", "Snapshot");
60
+ const CiJobId = prefixedId("cij_", "CI job");
61
+ const CredentialId = prefixedId("cred_", "Provider credential");
60
62
  const API_KEY_ID_PREFIX = "key_";
61
63
  const MANAGEMENT_KEY_ID_PREFIX = "mkey_";
62
64
  const ApiKeyId = prefixedId(API_KEY_ID_PREFIX, "API key");
@@ -77,6 +79,12 @@ const MICRO_USD_PER_DOLLAR = 1e6;
77
79
  const CREDIT_PURCHASE_MIN_MICRO_USD = 25 * MICRO_USD_PER_DOLLAR;
78
80
  const CREDIT_PURCHASE_MAX_MICRO_USD = 1e3 * MICRO_USD_PER_DOLLAR;
79
81
  const CARD_FEE_TERMS = "2.9% plus 30 cents";
82
+ const NO_MARKUP_TERMS = [
83
+ "Sandbox usage carries no markup.",
84
+ "On your own provider keys, each provider bills you at its own prices, and Sandcovery charges nothing for that usage.",
85
+ `Credits pay each provider's list price for a sandbox's size, from its start until it ends, and a card processing fee of ${CARD_FEE_TERMS} comes out of each credit purchase.`,
86
+ "Beyond list prices and that fee, Sandcovery charges only for Pro, a fixed fee for each organization."
87
+ ].join(" ");
80
88
  const Plan = Literals(["free", "pro"]).annotate({
81
89
  description: "The organization plan: `pro` while its Pro subscription is active, trialing, or past due, otherwise `free`.",
82
90
  identifier: "Plan"
@@ -99,40 +107,55 @@ const ProPrice = Struct({
99
107
  });
100
108
  const Billing = Struct({
101
109
  credit_balance_micro_usd: Int.annotate({ description: "Credits bought, less refunds and open disputes. A refund after use can take it below zero." }),
110
+ credits_on_sale: Boolean.annotate({ description: "Whether a credit purchase is open. Credits go on sale from the moment the latest price notice states." }),
102
111
  plan: Plan,
103
112
  pro_price: NullOr(ProPrice).annotate({ description: "The Pro price, or null while Pro is not on sale." })
104
113
  }).annotate({ identifier: "Billing" });
114
+ const CreditTerms = Struct({
115
+ fee_fixed_micro_usd: MicroUsd.annotate({ description: "The fixed part of the processing fee that comes out of each credit purchase." }),
116
+ fee_rate_basis_points: Natural.annotate({ description: "The part of the processing fee that grows with the payment, in basis points of it, rounded to the cent: 290 is 2.9%." }),
117
+ max_micro_usd: MicroUsd.annotate({ description: "The largest credit purchase, in whole US dollars." }),
118
+ min_micro_usd: MicroUsd.annotate({ description: "The smallest credit purchase, in whole US dollars." })
119
+ }).annotate({
120
+ description: "How credits are bought: a payment in whole US dollars between the two bounds adds credit equal to the payment less the processing fee, spent at each provider list price.",
121
+ identifier: "CreditTerms"
122
+ });
123
+ const Pricing = Struct({
124
+ credits: CreditTerms,
125
+ pro_price: NullOr(ProPrice).annotate({ description: "The Pro price, or null while Pro is not on sale." })
126
+ }).annotate({
127
+ description: "The public prices: the Pro price for one organization and the terms of a credit purchase.",
128
+ identifier: "Pricing"
129
+ });
105
130
  Struct({ amount_micro_usd: MicroUsd.check(isMultipleOf(MICRO_USD_PER_DOLLAR), isBetween({
106
131
  maximum: CREDIT_PURCHASE_MAX_MICRO_USD,
107
132
  minimum: CREDIT_PURCHASE_MIN_MICRO_USD
108
133
  })).annotate({ description: `Whole US dollars charged to the card, from 25 to 1,000 USD. The credits granted are this amount less the processing fee of ${CARD_FEE_TERMS}, rounded to the cent.` }) }).annotate({ identifier: "CreditPurchaseRequest" });
109
134
  const CreditCheckout = Struct({ url: String$1.annotate({ description: "The Stripe Checkout page that takes the payment. The credits arrive once Stripe confirms it." }) }).annotate({ identifier: "CreditCheckout" });
110
- // ../sandcovery-contract/src/routing.ts
111
- const STANDARD_SIZES = [
112
- {
113
- memory_mib: 2048,
114
- name: "1x2",
115
- vcpu: 1
116
- },
117
- {
118
- memory_mib: 4096,
119
- name: "2x4",
120
- vcpu: 2
121
- },
122
- {
123
- memory_mib: 8192,
124
- name: "4x8",
125
- vcpu: 4
126
- },
127
- {
128
- memory_mib: 16384,
129
- name: "8x16",
130
- vcpu: 8
131
- }
132
- ];
133
135
  const StandardSize = NonEmptyString.annotate({
134
136
  description: "A standard size named `<vCPU>x<memory GiB>`, such as `1x2`, `2x4`, `4x8`, or `8x16`. The API adds sizes over time.",
135
- examples: STANDARD_SIZES.map(({ name }) => name),
137
+ examples: [
138
+ {
139
+ memory_mib: 2048,
140
+ name: "1x2",
141
+ vcpu: 1
142
+ },
143
+ {
144
+ memory_mib: 4096,
145
+ name: "2x4",
146
+ vcpu: 2
147
+ },
148
+ {
149
+ memory_mib: 8192,
150
+ name: "4x8",
151
+ vcpu: 4
152
+ },
153
+ {
154
+ memory_mib: 16384,
155
+ name: "8x16",
156
+ vcpu: 8
157
+ }
158
+ ].map(({ name }) => name),
136
159
  identifier: "StandardSize"
137
160
  });
138
161
  const ProviderSort = Literals([
@@ -143,54 +166,64 @@ const ProviderSort = Literals([
143
166
  description: "Candidate order: `price` by list price, `latency` by measured create latency, and `uptime` by uptime over the last 15 minutes, or over a provider's own probe interval where it is probed less often.",
144
167
  identifier: "ProviderSort"
145
168
  });
146
- const ROUTING_SUFFIXES = [
147
- {
148
- sort: "price",
149
- suffix: "cheapest"
150
- },
151
- {
152
- sort: "latency",
153
- suffix: "fastest"
154
- },
155
- {
156
- sort: "uptime",
157
- suffix: "most-reliable"
158
- }
159
- ];
160
- const SIZE_NAMES = STANDARD_SIZES.flatMap((size) => [{
161
- name: size.name,
162
- size,
163
- sort: null
164
- }, ...ROUTING_SUFFIXES.map(({ sort, suffix }) => ({
165
- name: `${size.name}:${suffix}`,
166
- size,
167
- sort
168
- }))]);
169
- const isPositiveInteger = (text) => {
169
+ const ROUTER = "sandcovery";
170
+ const DEFAULT_SLUG = `${ROUTER}/2x4`;
171
+ const MIB_PER_GIB = 1024;
172
+ const ANY = "n";
173
+ const vcpusOf = (text) => {
174
+ if (text === ANY) return null;
175
+ const value = Number(text);
176
+ return Number.isSafeInteger(value) && value > 0 && String(value) === text ? value : void 0;
177
+ };
178
+ const memoryGibOf = (text) => {
179
+ if (text === ANY) return null;
170
180
  const value = Number(text);
171
- return Number.isSafeInteger(value) && value > 0 && String(value) === text;
181
+ return String(value) === text && value > 0 && Number.isSafeInteger(value * MIB_PER_GIB) ? value : void 0;
172
182
  };
173
- const isSizeName = (name) => {
174
- const [dimensions = "", ...suffixes] = name.split(":");
175
- const counts = dimensions.split("x");
176
- return counts.length === 2 && counts.every(isPositiveInteger) && suffixes.length <= 1 && suffixes.every((suffix) => suffix !== "");
183
+ const parseSlug = (text) => {
184
+ const [provider = "", size = "", ...extraPaths] = text.split("/");
185
+ const [dimensions = "", suffix, ...extraSuffixes] = size.split(":");
186
+ const [vcpuText = "", memoryText = "", ...extraParts] = dimensions.split("x");
187
+ if (extraPaths.length + extraSuffixes.length + extraParts.length > 0 || suffix === "" || !isProviderName(provider)) return;
188
+ const vcpus = vcpusOf(vcpuText);
189
+ const memoryGib = memoryGibOf(memoryText);
190
+ return vcpus === void 0 || memoryGib === void 0 ? void 0 : {
191
+ memoryGib,
192
+ provider,
193
+ suffix: suffix ?? null,
194
+ vcpus
195
+ };
177
196
  };
178
- const SizeName = String$1.check(makeFilter(isSizeName, {
179
- expected: "<vcpu>x<memory_gib>, optionally followed by a routing suffix",
197
+ const SLUG_EXAMPLES = [
198
+ `${ROUTER}/2x4`,
199
+ `${ROUTER}/2x4:cheapest`,
200
+ `${ROUTER}/nx16:cheapest`,
201
+ `${ROUTER}/2xn:fastest`,
202
+ `${ROUTER}/nxn:most-reliable`,
203
+ "boat/2x4",
204
+ "e2b/2x0.5"
205
+ ];
206
+ const Slug = String$1.check(makeFilter((text) => parseSlug(text) !== void 0, {
207
+ expected: "<provider>/<vcpu>x<memory_gib>, optionally followed by a routing suffix",
180
208
  toJsonSchema: () => ({ minLength: 1 })
181
209
  })).annotate({
182
- description: "A size named `<vcpu>x<memory_gib>`, such as `2x4` for 2 vCPU and 4 GiB, optionally followed by a routing suffix: `:cheapest` sorts candidates by list price, `:fastest` by measured create latency, and `:most-reliable` by uptime over the last 15 minutes, or over a provider's own probe interval where it is probed less often. A name with no suffix uses default routing, which balances price, latency, and uptime and spreads concurrent load across providers. A malformed name or an unknown suffix answers 400 `invalid_request`, and a size no candidate provider can run answers 422 `unsupported`, listing the sizes that would run as `options`.",
183
- examples: SIZE_NAMES.map(({ name }) => name),
184
- identifier: "SizeName"
210
+ description: `A provider and size, written \`<provider>/<vcpu>x<memory_gib>\` and optionally followed by a routing suffix, in the shape of OpenRouter model slugs. A provider name such as \`boat\` or \`e2b\` pins that provider, and \`${ROUTER}\` routes across every candidate provider. \`2x4\` is 2 vCPU and 4 GiB, and memory may be any whole number of MiB written in GiB, such as \`2x0.5\` or \`2x1.5\`. Either number may be \`n\`, meaning any value: \`nx16\` is any vCPU count with 16 GiB, \`2xn\` is 2 vCPU with any memory, and \`nxn\` is any size, and each provider then runs its cheapest size that matches. \`:cheapest\` sorts candidates by list price, \`:fastest\` by measured create latency, and \`:most-reliable\` by uptime over the last 15 minutes, or over a provider's own probe interval where it is probed less often. A slug with no suffix routes as \`:cheapest\`. A malformed slug or an unknown suffix answers 400 \`invalid_request\`, and a slug that no candidate provider can run answers 422 \`unsupported\`, listing slugs that would run as \`options\`.`,
211
+ examples: SLUG_EXAMPLES,
212
+ identifier: "Slug"
185
213
  });
214
+ const ROUTING_FIELDS_TEXT = `\`slug\` is the provider and size to run, as OpenRouter takes \`model\`, and \`slugs\` lists slugs to try in order, as OpenRouter takes \`models\`. With both, \`slug\` is tried first. With neither, the slug is \`${DEFAULT_SLUG}\`.`;
215
+ const RoutingFields = {
216
+ slug: optionalKey(Slug),
217
+ slugs: optionalKey(ArraySchema(Slug).check(isMinLength(1), isMaxLength(8)).annotate({ description: `Slugs to try in order, from 1 to ${String(8)}, as OpenRouter takes \`models\`. Within a \`${ROUTER}/\` slug, a failed create (capacity, quota, a provider 5xx, or a timeout) first falls back across that slug's candidates, then the create moves to the next slug. A provider is tried at most once a create, at the size of the first slug that reaches it.` }))
218
+ };
186
219
  const ProviderPreferences = Struct({
187
- allow_fallbacks: optionalKey(Boolean.annotate({ description: "Whether a failed create (capacity, quota, a provider 5xx, or a timeout) moves to the next candidate. Defaults to true." })),
220
+ allow_fallbacks: optionalKey(Boolean.annotate({ description: "Whether a failed create (capacity, quota, a provider 5xx, or a timeout) moves to the next candidate of the same slug. Defaults to true. With false, each slug tries only its first candidate, and the create still moves on to the next slug." })),
188
221
  ignore: optionalKey(ArraySchema(Provider).annotate({ description: "Providers never to route to." })),
189
222
  only: optionalKey(ArraySchema(Provider).annotate({ description: "The only providers to route to." })),
190
- order: optionalKey(ArraySchema(Provider).annotate({ description: "Providers to try first, in this order, before the remaining candidates in sorted order." })),
223
+ order: optionalKey(ArraySchema(Provider).annotate({ description: `Providers a \`${ROUTER}/\` slug tries first, in this order, before its remaining candidates in sorted order.` })),
191
224
  sort: optionalKey(ProviderSort)
192
225
  }).annotate({
193
- description: "Routing preferences in the shape of OpenRouter provider preferences. A size suffix sets `sort`, and a request whose suffix and `sort` disagree answers 400 `invalid_request`.",
226
+ description: `Routing preferences in the shape of OpenRouter provider preferences, applied to every slug: \`only\`, \`ignore\`, and the API key's provider allowlist filter each slug's candidates. A slug's suffix sets \`sort\` for that slug, and a slug whose suffix disagrees with \`sort\` answers 400 \`invalid_request\`.`,
194
227
  identifier: "ProviderPreferences"
195
228
  });
196
229
  // ../sandcovery-contract/src/sandbox.ts
@@ -229,19 +262,17 @@ const SandboxSpec = Struct({
229
262
  gpu: optionalKey(Gpu),
230
263
  idle_timeout_seconds: optionalKey(Int.check(isGreaterThanOrEqualTo(60)).annotate({ description: "Seconds without a running command after which the provider pauses the sandbox. Unset means no idle timeout." })),
231
264
  image: optionalKey(NonEmptyString.annotate({ description: "An OCI image reference. Unset means the provider's default Linux image." })),
232
- memory_mib: optionalKey(Int.check(isGreaterThanOrEqualTo(256)).annotate({ description: "Memory in MiB. Set with `vcpu`, and never with `size`." })),
233
265
  ports: optionalKey(ArraySchema(Port).check(isMaxLength(MAX_PORTS)).annotate({ description: "Ports to expose for preview URLs. Some providers expose only ports declared at create." })),
234
266
  region: optionalKey(Region),
235
- size: optionalKey(SizeName),
236
- ttl_seconds: optionalKey(between(60, MAX_TTL_SECONDS).annotate({ description: "Seconds from creation after which Sandcovery destroys the sandbox, even when the client is gone. Defaults to 3600, and the API key may cap it lower." })),
237
- vcpu: optionalKey(between(1, 64).annotate({ description: "vCPU count. Set with `memory_mib`, and never with `size`." }))
267
+ ttl_seconds: optionalKey(between(60, MAX_TTL_SECONDS).annotate({ description: "Seconds from creation after which Sandcovery destroys the sandbox, even when the client is gone. Defaults to 3600, and the API key may cap it lower." }))
238
268
  });
239
269
  const CreateSandboxRequest = Struct({
240
270
  ...SandboxSpec.fields,
271
+ ...RoutingFields,
241
272
  provider: optionalKey(ProviderPreferences),
242
273
  snapshot_id: optionalKey(SnapshotId.annotate({ description: "A snapshot to start from. The sandbox runs on the snapshot's provider." }))
243
274
  }).annotate({
244
- description: "A sandbox spec plus routing preferences. Give either `size` or both `vcpu` and `memory_mib`; with neither, the size is `2x4`. A spec option that no candidate provider can enforce answers 422 `unsupported` and is never ignored.",
275
+ description: `A sandbox spec, the slug or slugs to run it on, and routing preferences. ${ROUTING_FIELDS_TEXT} A spec option that no candidate provider can enforce answers 422 \`unsupported\` and is never ignored.`,
245
276
  identifier: "CreateSandboxRequest"
246
277
  });
247
278
  const CreateAttempt = Struct({
@@ -288,7 +319,7 @@ const SandboxCost = Struct({
288
319
  identifier: "SandboxCost"
289
320
  });
290
321
  const Sandbox = Struct({
291
- api_key_id: ApiKeyId.annotate({ description: "The API key that created the sandbox." }),
322
+ api_key_id: NullOr(ApiKeyId).annotate({ description: "The API key that created the sandbox, or null when an organization owner or admin created it while signed in, or their agent did on their session." }),
292
323
  attempts: ArraySchema(CreateAttempt),
293
324
  cost: SandboxCost,
294
325
  created_at: Timestamp,
@@ -301,16 +332,16 @@ const Sandbox = Struct({
301
332
  id: SandboxId,
302
333
  idle_timeout_seconds: NullOr(Natural),
303
334
  image: NullOr(String$1),
304
- memory_mib: Natural,
335
+ memory_mib: Natural.annotate({ description: "Memory of the bound size, or of the first candidate's size while the sandbox is creating or after every create attempt failed." }),
305
336
  ports: ArraySchema(Port),
306
337
  provider: NullOr(Provider).annotate({ description: "The provider the sandbox is bound to, or null while it is creating or when every create attempt failed." }),
307
338
  provider_sandbox_id: NullOr(String$1),
308
339
  region: NullOr(Region),
309
- size: NullOr(SizeName),
340
+ slug: NullOr(Slug).annotate({ description: "The provider and size the sandbox runs on, such as `boat/2x4`, as OpenRouter answers the `model` it used, or null while it is creating or when every create attempt failed." }),
310
341
  started_at: NullOr(Timestamp).annotate({ description: "When the provider reported the sandbox running." }),
311
342
  status: SandboxStatus,
312
343
  ttl_seconds: Natural,
313
- vcpu: Natural
344
+ vcpu: Natural.annotate({ description: "vCPU count of the bound size, or of the first candidate's size while the sandbox is creating or after every create attempt failed." })
314
345
  }).annotate({
315
346
  description: "A sandbox, bound to the provider that created it. `expires_at` is when Sandcovery destroys it, and pausing does not move it. `ended_at` and `end_reason` are set once it ends.",
316
347
  identifier: "Sandbox"
@@ -410,4 +441,4 @@ const CreatedKey = Struct({
410
441
  // ../sandcovery-contract/src/origin.ts
411
442
  const SANDCOVERY_ORIGIN = "https://www.sandcovery.com";
412
443
  const API_PREFIX = "/api/v1";
413
- export { KeyId as A, CARD_FEE_TERMS as C, MICRO_USD_PER_DOLLAR as D, CreditCheckout as E, SandboxId as F, Timestamp as I, MicroUsd as M, Provider as N, ApiKeyId as O, Region as P, Billing as S, CREDIT_PURCHASE_MIN_MICRO_USD as T, SandboxStatus as _, Key as a, ProviderSort as b, SpendLimit as c, CreateSandboxRequest as d, Port as f, SandboxSpec as g, SandboxList as h, CreatedKey as i, KeySecret as j, GpuType as k, UpdateKeyRequest as l, Sandbox as m, SANDCOVERY_ORIGIN as n, KeyKind as o, PortPreview as p, CreateKeyRequest as r, KeyList as s, API_PREFIX as t, CreateAttempt as u, Snapshot as v, CREDIT_PURCHASE_MAX_MICRO_USD as w, StandardSize as x, ProviderPreferences as y };
444
+ export { CreditCheckout as A, MicroUsd as B, RoutingFields as C, CARD_FEE_TERMS as D, Billing as E, CiJobId as F, Region as H, CredentialId as I, GpuType as L, NO_MARKUP_TERMS as M, Pricing as N, CREDIT_PURCHASE_MAX_MICRO_USD as O, ApiKeyId as P, KeyId as R, ROUTING_FIELDS_TEXT as S, StandardSize as T, SandboxId as U, Provider as V, Timestamp as W, SandboxStatus as _, Key as a, ProviderPreferences as b, SpendLimit as c, CreateSandboxRequest as d, Port as f, SandboxSpec as g, SandboxList as h, CreatedKey as i, MICRO_USD_PER_DOLLAR as j, CREDIT_PURCHASE_MIN_MICRO_USD as k, UpdateKeyRequest as l, Sandbox as m, SANDCOVERY_ORIGIN as n, KeyKind as o, PortPreview as p, CreateKeyRequest as r, KeyList as s, API_PREFIX as t, CreateAttempt as u, Snapshot as v, Slug as w, ProviderSort as x, DEFAULT_SLUG as y, KeySecret as z };