codai-sdk 0.64.0 → 0.66.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
@@ -4743,18 +4743,31 @@ var Notifications = class {
4743
4743
  //#region src/resources/prompts.ts
4744
4744
  /** `/v1/prompts/*` — pending prompts: ready-to-paste prompts left for a future chat (handoffs, follow-ups). */
4745
4745
  const one$3 = (id, suffix = "") => `/v1/prompts/${encodeURIComponent(id)}${suffix}`;
4746
+ function filterQuery(q) {
4747
+ const tag = Array.isArray(q.tag) ? q.tag.join(",") : q.tag;
4748
+ return {
4749
+ status: q.status,
4750
+ limit: q.limit,
4751
+ tag: tag || void 0,
4752
+ priority_min: q.priority_min,
4753
+ q: q.q,
4754
+ templates: q.templates,
4755
+ sort: q.sort,
4756
+ order: q.order
4757
+ };
4758
+ }
4746
4759
  var Prompts = class {
4747
4760
  http;
4748
4761
  constructor(http) {
4749
4762
  this.http = http;
4750
4763
  }
4751
- /** `GET /v1/prompts?status=&limit=` — default `open`; `due` = open and `not_before` empty or passed. */
4764
+ /**
4765
+ * `GET /v1/prompts?status=&limit=&tag=&priority_min=&q=&templates=&sort=&order=` — default `open`, templates
4766
+ * excluded; `due` = open and `not_before` empty or passed; several tags = AND.
4767
+ */
4752
4768
  list(query = {}, opts = {}) {
4753
4769
  return this.http.json("/v1/prompts", {
4754
- query: {
4755
- status: query.status,
4756
- limit: query.limit
4757
- },
4770
+ query: filterQuery(query),
4758
4771
  ext: opts.ext,
4759
4772
  signal: opts.signal
4760
4773
  });
@@ -4834,6 +4847,42 @@ var Prompts = class {
4834
4847
  noRetry: true
4835
4848
  });
4836
4849
  }
4850
+ /** `POST /v1/prompts/bulk` — one action over up to 200 of your prompts → `{ updated }`. */
4851
+ bulk(body, opts = {}) {
4852
+ return this.http.json("/v1/prompts/bulk", {
4853
+ method: "POST",
4854
+ body,
4855
+ ext: opts.ext,
4856
+ signal: opts.signal
4857
+ });
4858
+ }
4859
+ /** `GET /v1/prompts/{id}/events` — history, newest first (max 200). */
4860
+ events(id, opts = {}) {
4861
+ return this.http.json(one$3(id, "/events"), {
4862
+ ext: opts.ext,
4863
+ signal: opts.signal
4864
+ });
4865
+ }
4866
+ /** `POST /v1/prompts/{id}/instantiate` — open copy of a template (201). */
4867
+ instantiate(id, opts = {}) {
4868
+ return this.http.json(one$3(id, "/instantiate"), {
4869
+ method: "POST",
4870
+ ext: opts.ext,
4871
+ signal: opts.signal,
4872
+ noRetry: true
4873
+ });
4874
+ }
4875
+ /** `GET /v1/prompts/export?format=csv|md` — list filters apply (status defaults to `all`); returns the document text. */
4876
+ async exportPrompts(query = {}, opts = {}) {
4877
+ return (await this.http.request("/v1/prompts/export", {
4878
+ query: {
4879
+ ...filterQuery(query),
4880
+ format: query.format ?? "csv"
4881
+ },
4882
+ ext: opts.ext,
4883
+ signal: opts.signal
4884
+ })).text();
4885
+ }
4837
4886
  /** `GET /v1/prompts/stream` — live `prompt` events (keepalive comments are skipped). Closed by the server after 6 h. */
4838
4887
  async *stream(opts = {}) {
4839
4888
  const frames = this.http.sse("/v1/prompts/stream", {
@@ -5317,8 +5366,9 @@ var Memory = class {
5317
5366
  //#endregion
5318
5367
  //#region src/resources/sandboxes.ts
5319
5368
  /**
5320
- * `/v1/sandboxes` — agent sandboxes (beta): isolated gVisor containers with a persistent
5321
- * `/workspace`, no network by default, artifacts from `/workspace/out` as scanned, signed links.
5369
+ * `/v1/sandboxes` — agent sandboxes: isolated gVisor containers with a persistent `/workspace`, no network
5370
+ * by default, artifacts from `/workspace/out` as scanned, signed links. Backend `v2` (default) = long-lived
5371
+ * GKE pod with pause/resume, fork, a persistent kernel and preview URLs; `v1` = Cloud Run, on request.
5322
5372
  */
5323
5373
  const base = (id) => `/v1/sandboxes/${encodeURIComponent(id)}`;
5324
5374
  /** Encode each segment of a workspace path, keeping the slashes. */
@@ -5369,9 +5419,12 @@ var Sandboxes = class {
5369
5419
  this.files = new SandboxFiles(http);
5370
5420
  }
5371
5421
  /**
5372
- * `POST /v1/sandboxes` — start a sandbox (`ttl_seconds` 60–86400, default 3600; `egress` none by default).
5373
- * `backend: 'v2'` (closed canary) starts a long-lived pod with memory snapshots and accepts `template`
5374
- * `codai-base` | `brivio-acte` | `desktop`; its reply may carry `restored`.
5422
+ * `POST /v1/sandboxes` — start a sandbox (`ttl_seconds` default 3600, max 86400 on v1 / 604800 on v2;
5423
+ * `egress` none by default, or a `pypi`/`npm` preset / allowlist on both backends).
5424
+ * `backend` defaults to `'v2'`: a long-lived pod with memory snapshots, Node 24 + npm, `template`
5425
+ * `codai-base` | `brivio-acte` | `desktop`; its reply may carry `restored`. When `backend` is omitted and v2
5426
+ * is unavailable for the key the gateway falls back to `'v1'` (check `backend` on the reply).
5427
+ * Errors: 429 `sandbox_concurrency_limit` (3 per key, 5 running v2 per user), 503 `sandbox_capacity` (retry).
5375
5428
  */
5376
5429
  create(input = {}, opts = {}) {
5377
5430
  return this.http.json("/v1/sandboxes", {
@@ -5440,7 +5493,7 @@ var Sandboxes = class {
5440
5493
  signal: opts.signal
5441
5494
  });
5442
5495
  }
5443
- /** `POST /v1/sandboxes/{id}/snapshot` — store a compressed copy of the workspace. */
5496
+ /** `POST /v1/sandboxes/{id}/snapshot` (v1 only; v2 answers 409 `not_supported_on_v2`) — store a compressed copy of the workspace. */
5444
5497
  snapshot(id, input = {}, opts = {}) {
5445
5498
  return this.http.json(`${base(id)}/snapshot`, {
5446
5499
  method: "POST",
@@ -5474,7 +5527,10 @@ var Sandboxes = class {
5474
5527
  signal: opts.signal
5475
5528
  });
5476
5529
  }
5477
- /** `POST /v1/sandboxes/{id}/pause` (v2) — memory snapshot, then stop the pod (status `paused`). */
5530
+ /**
5531
+ * `POST /v1/sandboxes/{id}/pause` (v2) — memory snapshot, then stop the pod (status `paused`).
5532
+ * At most 10 paused v2 sandboxes per user (429 `sandbox_paused_limit`).
5533
+ */
5478
5534
  pause(id, opts = {}) {
5479
5535
  return this.http.json(`${base(id)}/pause`, {
5480
5536
  method: "POST",
@@ -6392,6 +6448,10 @@ const OPERATION_METHODS = {
6392
6448
  verifyPrompt: "prompts.verify",
6393
6449
  verifyPrompts: "prompts.verifyMany",
6394
6450
  streamPrompts: "prompts.stream",
6451
+ exportPrompts: "prompts.exportPrompts",
6452
+ bulkPrompts: "prompts.bulk",
6453
+ listPromptEvents: "prompts.events",
6454
+ instantiatePrompt: "prompts.instantiate",
6395
6455
  listTranscripts: "transcripts.list",
6396
6456
  createTranscript: "transcripts.create",
6397
6457
  getTranscriptUsage: "transcripts.usage",
@@ -6826,8 +6886,8 @@ var CodaiApps = class {
6826
6886
  * client.usage.get / client.keys.list / .setTags (own usage breakdown + API keys)
6827
6887
  * client.projects.* client.environments.* (members, ports, secrets)
6828
6888
  * client.sandboxes.create / .list / .retrieve / .exec / .execStream / .files.put / .files.get / .files.list
6829
- * / .artifacts / .snapshot / .delete / .run (agent sandboxes, beta: isolated gVisor workspaces, no network by default)
6830
- * / .runCode / .resetKernel / .pause / .resume / .fork / .preview (backend v2, closed canary)
6889
+ * / .artifacts / .snapshot / .delete / .run (agent sandboxes: isolated gVisor workspaces, no network by default)
6890
+ * / .runCode / .resetKernel / .pause / .resume / .fork / .preview (backend v2, the default; .snapshot is v1 only)
6831
6891
  * client.verify.agentOutputKey / .agentOutput (EXPERIMENTAL HIDE-signed agent outputs)
6832
6892
  * client.feedback / client.phoneModels
6833
6893
  * client.resolve.* (verified bug fixes on https://resolve.codai.ro — resolve.yaml; .list / .iterate page your jobs)
@@ -6921,7 +6981,7 @@ var Codai = class {
6921
6981
  orgs;
6922
6982
  projects;
6923
6983
  environments;
6924
- /** Agent sandboxes (beta) — isolated gVisor workspaces: `sandboxes.create/exec/execStream/files/artifacts/run`. */
6984
+ /** Agent sandboxes (backend v2 by default) — isolated gVisor workspaces: `sandboxes.create/exec/execStream/files/artifacts/run`. */
6925
6985
  sandboxes;
6926
6986
  /** EXPERIMENTAL (HIDE, unaudited): verify signed agent outputs. Provenance only. */
6927
6987
  verify;