codai-sdk 0.63.0 → 0.65.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.js CHANGED
@@ -4450,6 +4450,34 @@ var Settings = class {
4450
4450
  }
4451
4451
  };
4452
4452
 
4453
+ //#endregion
4454
+ //#region src/resources/os-gate.ts
4455
+ var OsGate = class {
4456
+ http;
4457
+ constructor(http) {
4458
+ this.http = http;
4459
+ }
4460
+ /** `GET /v1/policy` — `{ os_gate: { allow_override } }` folded over every org of the caller (strictest wins). */
4461
+ policy(opts = {}) {
4462
+ return this.http.json("/v1/policy", {
4463
+ ext: opts.ext,
4464
+ signal: opts.signal
4465
+ });
4466
+ }
4467
+ /**
4468
+ * `POST /v1/os-gate/events` — record that the user granted or revoked an override of `checks` on `surface`.
4469
+ * The body is strict: unknown keys, unknown check ids or an empty `checks` list throw a 400 `CodaiError`.
4470
+ */
4471
+ recordEvent(event, opts = {}) {
4472
+ return this.http.json("/v1/os-gate/events", {
4473
+ method: "POST",
4474
+ body: event,
4475
+ ext: opts.ext,
4476
+ signal: opts.signal
4477
+ });
4478
+ }
4479
+ };
4480
+
4453
4481
  //#endregion
4454
4482
  //#region src/resources/sfx.ts
4455
4483
  var Sfx = class {
@@ -5289,8 +5317,9 @@ var Memory = class {
5289
5317
  //#endregion
5290
5318
  //#region src/resources/sandboxes.ts
5291
5319
  /**
5292
- * `/v1/sandboxes` — agent sandboxes (beta): isolated gVisor containers with a persistent
5293
- * `/workspace`, no network by default, artifacts from `/workspace/out` as scanned, signed links.
5320
+ * `/v1/sandboxes` — agent sandboxes: isolated gVisor containers with a persistent `/workspace`, no network
5321
+ * by default, artifacts from `/workspace/out` as scanned, signed links. Backend `v2` (default) = long-lived
5322
+ * GKE pod with pause/resume, fork, a persistent kernel and preview URLs; `v1` = Cloud Run, on request.
5294
5323
  */
5295
5324
  const base = (id) => `/v1/sandboxes/${encodeURIComponent(id)}`;
5296
5325
  /** Encode each segment of a workspace path, keeping the slashes. */
@@ -5341,9 +5370,12 @@ var Sandboxes = class {
5341
5370
  this.files = new SandboxFiles(http);
5342
5371
  }
5343
5372
  /**
5344
- * `POST /v1/sandboxes` — start a sandbox (`ttl_seconds` 60–86400, default 3600; `egress` none by default).
5345
- * `backend: 'v2'` (closed canary) starts a long-lived pod with memory snapshots and accepts `template`
5346
- * `codai-base` | `brivio-acte` | `desktop`; its reply may carry `restored`.
5373
+ * `POST /v1/sandboxes` — start a sandbox (`ttl_seconds` default 3600, max 86400 on v1 / 604800 on v2;
5374
+ * `egress` none by default, or a `pypi`/`npm` preset / allowlist on both backends).
5375
+ * `backend` defaults to `'v2'`: a long-lived pod with memory snapshots, Node 24 + npm, `template`
5376
+ * `codai-base` | `brivio-acte` | `desktop`; its reply may carry `restored`. When `backend` is omitted and v2
5377
+ * is unavailable for the key the gateway falls back to `'v1'` (check `backend` on the reply).
5378
+ * Errors: 429 `sandbox_concurrency_limit` (3 per key, 5 running v2 per user), 503 `sandbox_capacity` (retry).
5347
5379
  */
5348
5380
  create(input = {}, opts = {}) {
5349
5381
  return this.http.json("/v1/sandboxes", {
@@ -5412,7 +5444,7 @@ var Sandboxes = class {
5412
5444
  signal: opts.signal
5413
5445
  });
5414
5446
  }
5415
- /** `POST /v1/sandboxes/{id}/snapshot` — store a compressed copy of the workspace. */
5447
+ /** `POST /v1/sandboxes/{id}/snapshot` (v1 only; v2 answers 409 `not_supported_on_v2`) — store a compressed copy of the workspace. */
5416
5448
  snapshot(id, input = {}, opts = {}) {
5417
5449
  return this.http.json(`${base(id)}/snapshot`, {
5418
5450
  method: "POST",
@@ -5446,7 +5478,10 @@ var Sandboxes = class {
5446
5478
  signal: opts.signal
5447
5479
  });
5448
5480
  }
5449
- /** `POST /v1/sandboxes/{id}/pause` (v2) — memory snapshot, then stop the pod (status `paused`). */
5481
+ /**
5482
+ * `POST /v1/sandboxes/{id}/pause` (v2) — memory snapshot, then stop the pod (status `paused`).
5483
+ * At most 10 paused v2 sandboxes per user (429 `sandbox_paused_limit`).
5484
+ */
5450
5485
  pause(id, opts = {}) {
5451
5486
  return this.http.json(`${base(id)}/pause`, {
5452
5487
  method: "POST",
@@ -6541,6 +6576,8 @@ const OPERATION_METHODS = {
6541
6576
  getReferrals: "referrals.get",
6542
6577
  getSettings: "settings.get",
6543
6578
  patchSettings: "settings.update",
6579
+ getPolicy: "osGate.policy",
6580
+ recordOsGateEvent: "osGate.recordEvent",
6544
6581
  getReceipt: "receipt.get",
6545
6582
  submitFeedback: "feedback.submit",
6546
6583
  listPhoneModels: "phoneModels.list"
@@ -6790,13 +6827,14 @@ var CodaiApps = class {
6790
6827
  * client.tasks.* client.sessions.* (events, controls, lease, shares, stream)
6791
6828
  * client.devices.* / client.hosts.* client.orgs.* / client.account / client.receipt
6792
6829
  * client.settings.get / .update (account-level settings shared by every device)
6830
+ * client.osGate.policy / .recordEvent (OS protection gate: org override policy + override audit events)
6793
6831
  * client.billing.get / .invoices / .watchBalance (READ-ONLY billing overview; never starts a payment)
6794
6832
  * client.referrals.get / .redeem / .setConsent (referral stats + invitees; mutations via PATCH /v1/account)
6795
6833
  * client.usage.get / client.keys.list / .setTags (own usage breakdown + API keys)
6796
6834
  * client.projects.* client.environments.* (members, ports, secrets)
6797
6835
  * client.sandboxes.create / .list / .retrieve / .exec / .execStream / .files.put / .files.get / .files.list
6798
- * / .artifacts / .snapshot / .delete / .run (agent sandboxes, beta: isolated gVisor workspaces, no network by default)
6799
- * / .runCode / .resetKernel / .pause / .resume / .fork / .preview (backend v2, closed canary)
6836
+ * / .artifacts / .snapshot / .delete / .run (agent sandboxes: isolated gVisor workspaces, no network by default)
6837
+ * / .runCode / .resetKernel / .pause / .resume / .fork / .preview (backend v2, the default; .snapshot is v1 only)
6800
6838
  * client.verify.agentOutputKey / .agentOutput (EXPERIMENTAL HIDE-signed agent outputs)
6801
6839
  * client.feedback / client.phoneModels
6802
6840
  * client.resolve.* (verified bug fixes on https://resolve.codai.ro — resolve.yaml; .list / .iterate page your jobs)
@@ -6890,13 +6928,15 @@ var Codai = class {
6890
6928
  orgs;
6891
6929
  projects;
6892
6930
  environments;
6893
- /** Agent sandboxes (beta) — isolated gVisor workspaces: `sandboxes.create/exec/execStream/files/artifacts/run`. */
6931
+ /** Agent sandboxes (backend v2 by default) — isolated gVisor workspaces: `sandboxes.create/exec/execStream/files/artifacts/run`. */
6894
6932
  sandboxes;
6895
6933
  /** EXPERIMENTAL (HIDE, unaudited): verify signed agent outputs. Provenance only. */
6896
6934
  verify;
6897
6935
  account;
6898
6936
  /** Account-level settings shared by every device (`settings.get()`, `settings.update(partial, { version })`). */
6899
6937
  settings;
6938
+ /** OS protection gate: `osGate.policy()` (org override policy) and `osGate.recordEvent(event)` (audit). */
6939
+ osGate;
6900
6940
  /** READ-ONLY billing: plan, wallet, invoices, `watchBalance` (pay via the returned links, never via the SDK). */
6901
6941
  billing;
6902
6942
  /** Referral stats and invitees; `redeem(code)` / `setConsent(bool)` go through `PATCH /v1/account`. */
@@ -6977,6 +7017,7 @@ var Codai = class {
6977
7017
  this.verify = new Verify(http);
6978
7018
  this.account = new Account(http);
6979
7019
  this.settings = new Settings(http);
7020
+ this.osGate = new OsGate(http);
6980
7021
  this.billing = new Billing(http);
6981
7022
  this.referrals = new Referrals(http);
6982
7023
  this.receipt = new Receipts(http);
@@ -7071,5 +7112,5 @@ function allKeys(obj) {
7071
7112
  }
7072
7113
 
7073
7114
  //#endregion
7074
- export { AbuseReports, Account, AgentRuns, Agents, Assets, Audio, Batches, Billing, BrandKits, Cards, Chat, ChatCompletions, Codai, Codai as default, CodaiApps, CodaiError, Creatives, Devices, Documents, Embeddings, EnvironmentFiles, EnvironmentJobs, EnvironmentMembers, EnvironmentPorts, EnvironmentSecrets, EnvironmentTasks, Environments, Exports, Feedback, Health, Heartbeats, Hosts, HttpClient, Images, Keys, Lists, Memory, Messages, Models, Music, Notifications, OPERATION_METHODS, OrgMembers, Orgs, PROVENANCE_MAX_BYTES, PhoneModels, Productions, Projects, Prompts, Provenance, RESOLVE_ATTESTATION_PAYLOAD_TYPE, RESOLVE_OPERATION_METHODS, RESOLVE_TERMINAL_STATUSES, Realtime, RealtimeSession, Receipts, Referrals, Renders, Research, Resolve, ResolveError, ResolveInsufficientFundsError, Responses, STREAMING_OPERATIONS, SandboxFiles, Sandboxes, ScheduleExecutor, SchedulerHosts, Schedules, SessionControls, SessionEvents, SessionLease, SessionShares, Sessions, Settings, Sfx, Shares, SystemOne, TUS_CHUNK_BYTES, Tasks, Templates, Tokens, Tools, Transcripts, Triggers, Usage, Vault, VaultDevices, Verify, Videos, VoiceRevocations, extensionHeaders, frameJson, isAssetDto, isProductionFinished, isResearchFinished, mergeToolCall, readSse, realtimeUrl, resolveAttestationStatement, settingsConflictCurrent, shareTokenFrom, uploadIdFromLocation, verifyAttestationWithKeys, verifyResolveWebhook };
7115
+ export { AbuseReports, Account, AgentRuns, Agents, Assets, Audio, Batches, Billing, BrandKits, Cards, Chat, ChatCompletions, Codai, Codai as default, CodaiApps, CodaiError, Creatives, Devices, Documents, Embeddings, EnvironmentFiles, EnvironmentJobs, EnvironmentMembers, EnvironmentPorts, EnvironmentSecrets, EnvironmentTasks, Environments, Exports, Feedback, Health, Heartbeats, Hosts, HttpClient, Images, Keys, Lists, Memory, Messages, Models, Music, Notifications, OPERATION_METHODS, OrgMembers, Orgs, OsGate, PROVENANCE_MAX_BYTES, PhoneModels, Productions, Projects, Prompts, Provenance, RESOLVE_ATTESTATION_PAYLOAD_TYPE, RESOLVE_OPERATION_METHODS, RESOLVE_TERMINAL_STATUSES, Realtime, RealtimeSession, Receipts, Referrals, Renders, Research, Resolve, ResolveError, ResolveInsufficientFundsError, Responses, STREAMING_OPERATIONS, SandboxFiles, Sandboxes, ScheduleExecutor, SchedulerHosts, Schedules, SessionControls, SessionEvents, SessionLease, SessionShares, Sessions, Settings, Sfx, Shares, SystemOne, TUS_CHUNK_BYTES, Tasks, Templates, Tokens, Tools, Transcripts, Triggers, Usage, Vault, VaultDevices, Verify, Videos, VoiceRevocations, extensionHeaders, frameJson, isAssetDto, isProductionFinished, isResearchFinished, mergeToolCall, readSse, realtimeUrl, resolveAttestationStatement, settingsConflictCurrent, shareTokenFrom, uploadIdFromLocation, verifyAttestationWithKeys, verifyResolveWebhook };
7075
7116
  //# sourceMappingURL=index.js.map