codai-sdk 0.65.0 → 0.67.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
@@ -3036,6 +3036,10 @@ var VoiceRevocations = class {
3036
3036
 
3037
3037
  //#endregion
3038
3038
  //#region src/resources/vault.ts
3039
+ /** The UTF-8 message an unlock proof covers: `codai-vault/unlock/v1|<challenge>|<device_id or "passkey">`. */
3040
+ function vaultUnlockMessage(challenge, deviceIdOrPasskey) {
3041
+ return `codai-vault/unlock/v1|${challenge}|${deviceIdOrPasskey}`;
3042
+ }
3039
3043
  const seg = (base, id, suffix = "") => `${base}/${encodeURIComponent(id)}${suffix}`;
3040
3044
  /** `/v1/vault/devices/*` — hardware-backed device approval keys (public keys only; revocation is instant). */
3041
3045
  var VaultDevices = class {
@@ -3124,6 +3128,53 @@ var Vault = class {
3124
3128
  setDefaultTier(defaultTier, opts = {}) {
3125
3129
  return this.send("PATCH", "/v1/vault/settings", opts, { default_tier: defaultTier });
3126
3130
  }
3131
+ /**
3132
+ * `PATCH /v1/vault/settings` — `default_tier` and/or partial anomaly `guards` (merged over the current ones).
3133
+ * Answers the effective `{ default_tier, guards }`.
3134
+ */
3135
+ updateSettings(body, opts = {}) {
3136
+ if (body.default_tier === void 0 && body.guards === void 0) return Promise.reject(/* @__PURE__ */ new TypeError("updateSettings needs default_tier and/or guards"));
3137
+ return this.send("PATCH", "/v1/vault/settings", opts, { ...body });
3138
+ }
3139
+ /**
3140
+ * `POST /v1/vault/lock` — panic: revoke every live grant, deny every pending approval, lock the vault (agent uses
3141
+ * then answer `vault_locked`). Device keys stay enrolled. Idempotent.
3142
+ */
3143
+ lock(params = {}, opts = {}) {
3144
+ return this.send("POST", "/v1/vault/lock", opts, { via: params.via });
3145
+ }
3146
+ /** `POST /v1/vault/unlock/challenge` — single-use unlock challenge, valid 5 minutes. */
3147
+ unlockChallenge(opts = {}) {
3148
+ return this.send("POST", "/v1/vault/unlock/challenge", opts, {});
3149
+ }
3150
+ /**
3151
+ * `POST /v1/vault/unlock` — end a lock with a device-key proof over {@link vaultUnlockMessage} or a passkey whose
3152
+ * challenge is base64url(SHA-256(that message with `passkey`)). 403 `challenge_invalid`, `wear_t3_only`, …
3153
+ */
3154
+ unlock(body, opts = {}) {
3155
+ return this.send("POST", "/v1/vault/unlock", opts, { ...body });
3156
+ }
3157
+ /** `GET /v1/vault/limits` — per-handle usage caps on your items. */
3158
+ async limits(opts = {}) {
3159
+ return [...(await this.get("/v1/vault/limits", opts)).limits];
3160
+ }
3161
+ /**
3162
+ * `PUT /v1/vault/items/{id}/limits` — all three keys required; `null` removes a cap, all `null` removes the limits
3163
+ * (answers `null`). Over a cap the broker calls answer 429 `vault_rate_limited` with `Retry-After`.
3164
+ */
3165
+ async setLimits(id, limits, opts = {}) {
3166
+ return (await this.http.json(seg("/v1/vault/items", id, "/limits"), {
3167
+ method: "PUT",
3168
+ body: {
3169
+ per_minute: limits.per_minute,
3170
+ per_day: limits.per_day,
3171
+ units_per_day: limits.units_per_day
3172
+ },
3173
+ ext: opts.ext,
3174
+ signal: opts.signal,
3175
+ noRetry: true
3176
+ })).limits ?? null;
3177
+ }
3127
3178
  /** `GET /v1/vault/vaults` — vaults you belong to, with your role and sealed vault key. */
3128
3179
  vaults(opts = {}) {
3129
3180
  return this.get("/v1/vault/vaults", opts);
@@ -3174,6 +3225,10 @@ var Vault = class {
3174
3225
  revokeGrant(id, opts = {}) {
3175
3226
  return this.send("DELETE", seg("/v1/vault/grants", id), opts);
3176
3227
  }
3228
+ /** `POST /v1/vault/grants/revoke-task` — revoke every live grant of a task / session; answers `{ revoked }`. */
3229
+ revokeTaskGrants(task, opts = {}) {
3230
+ return this.send("POST", "/v1/vault/grants/revoke-task", opts, { task });
3231
+ }
3177
3232
  /** `GET /v1/vault/events` — append-only audit log (never contains secret values). */
3178
3233
  events(params = {}, opts = {}) {
3179
3234
  return this.get("/v1/vault/events", opts, { limit: params.limit });
@@ -4743,18 +4798,31 @@ var Notifications = class {
4743
4798
  //#region src/resources/prompts.ts
4744
4799
  /** `/v1/prompts/*` — pending prompts: ready-to-paste prompts left for a future chat (handoffs, follow-ups). */
4745
4800
  const one$3 = (id, suffix = "") => `/v1/prompts/${encodeURIComponent(id)}${suffix}`;
4801
+ function filterQuery(q) {
4802
+ const tag = Array.isArray(q.tag) ? q.tag.join(",") : q.tag;
4803
+ return {
4804
+ status: q.status,
4805
+ limit: q.limit,
4806
+ tag: tag || void 0,
4807
+ priority_min: q.priority_min,
4808
+ q: q.q,
4809
+ templates: q.templates,
4810
+ sort: q.sort,
4811
+ order: q.order
4812
+ };
4813
+ }
4746
4814
  var Prompts = class {
4747
4815
  http;
4748
4816
  constructor(http) {
4749
4817
  this.http = http;
4750
4818
  }
4751
- /** `GET /v1/prompts?status=&limit=` — default `open`; `due` = open and `not_before` empty or passed. */
4819
+ /**
4820
+ * `GET /v1/prompts?status=&limit=&tag=&priority_min=&q=&templates=&sort=&order=` — default `open`, templates
4821
+ * excluded; `due` = open and `not_before` empty or passed; several tags = AND.
4822
+ */
4752
4823
  list(query = {}, opts = {}) {
4753
4824
  return this.http.json("/v1/prompts", {
4754
- query: {
4755
- status: query.status,
4756
- limit: query.limit
4757
- },
4825
+ query: filterQuery(query),
4758
4826
  ext: opts.ext,
4759
4827
  signal: opts.signal
4760
4828
  });
@@ -4834,6 +4902,42 @@ var Prompts = class {
4834
4902
  noRetry: true
4835
4903
  });
4836
4904
  }
4905
+ /** `POST /v1/prompts/bulk` — one action over up to 200 of your prompts → `{ updated }`. */
4906
+ bulk(body, opts = {}) {
4907
+ return this.http.json("/v1/prompts/bulk", {
4908
+ method: "POST",
4909
+ body,
4910
+ ext: opts.ext,
4911
+ signal: opts.signal
4912
+ });
4913
+ }
4914
+ /** `GET /v1/prompts/{id}/events` — history, newest first (max 200). */
4915
+ events(id, opts = {}) {
4916
+ return this.http.json(one$3(id, "/events"), {
4917
+ ext: opts.ext,
4918
+ signal: opts.signal
4919
+ });
4920
+ }
4921
+ /** `POST /v1/prompts/{id}/instantiate` — open copy of a template (201). */
4922
+ instantiate(id, opts = {}) {
4923
+ return this.http.json(one$3(id, "/instantiate"), {
4924
+ method: "POST",
4925
+ ext: opts.ext,
4926
+ signal: opts.signal,
4927
+ noRetry: true
4928
+ });
4929
+ }
4930
+ /** `GET /v1/prompts/export?format=csv|md` — list filters apply (status defaults to `all`); returns the document text. */
4931
+ async exportPrompts(query = {}, opts = {}) {
4932
+ return (await this.http.request("/v1/prompts/export", {
4933
+ query: {
4934
+ ...filterQuery(query),
4935
+ format: query.format ?? "csv"
4936
+ },
4937
+ ext: opts.ext,
4938
+ signal: opts.signal
4939
+ })).text();
4940
+ }
4837
4941
  /** `GET /v1/prompts/stream` — live `prompt` events (keepalive comments are skipped). Closed by the server after 6 h. */
4838
4942
  async *stream(opts = {}) {
4839
4943
  const frames = this.http.sse("/v1/prompts/stream", {
@@ -6305,7 +6409,13 @@ const OPERATION_METHODS = {
6305
6409
  createVoiceRevocation: "voiceRevocations.create",
6306
6410
  getVaultAccount: "vault.account",
6307
6411
  putVaultAccount: "vault.putAccount",
6308
- patchVaultSettings: "vault.setDefaultTier",
6412
+ patchVaultSettings: "vault.updateSettings",
6413
+ lockVault: "vault.lock",
6414
+ createVaultUnlockChallenge: "vault.unlockChallenge",
6415
+ unlockVault: "vault.unlock",
6416
+ listVaultLimits: "vault.limits",
6417
+ setVaultItemLimits: "vault.setLimits",
6418
+ revokeVaultTaskGrants: "vault.revokeTaskGrants",
6309
6419
  listVaults: "vault.vaults",
6310
6420
  createVault: "vault.createVault",
6311
6421
  listVaultItems: "vault.items",
@@ -6399,6 +6509,10 @@ const OPERATION_METHODS = {
6399
6509
  verifyPrompt: "prompts.verify",
6400
6510
  verifyPrompts: "prompts.verifyMany",
6401
6511
  streamPrompts: "prompts.stream",
6512
+ exportPrompts: "prompts.exportPrompts",
6513
+ bulkPrompts: "prompts.bulk",
6514
+ listPromptEvents: "prompts.events",
6515
+ instantiatePrompt: "prompts.instantiate",
6402
6516
  listTranscripts: "transcripts.list",
6403
6517
  createTranscript: "transcripts.create",
6404
6518
  getTranscriptUsage: "transcripts.usage",
@@ -6816,6 +6930,7 @@ var CodaiApps = class {
6816
6930
  * client.voiceRevocations.create (public takedown ticket for a voice cloned in codai Studio; no key needed)
6817
6931
  * client.vault.account / .items / .putItem / .rules / .approvals / .decide / .catalog / .use / .httpCall / .resolve
6818
6932
  * client.vault.devices.challenge / .enroll / .list / .rename / .revoke (device approval keys, V-27)
6933
+ * client.vault.updateSettings / .lock / .unlockChallenge / .unlock / .limits / .setLimits / .revokeTaskGrants (guards, v4)
6819
6934
  * (zero-knowledge credentials vault: ciphertext only; the broker calls never return secret values)
6820
6935
  * client.abuseReports.create (public DSA notice about a codai Studio share / review link; no key needed)
6821
6936
  * client.provenance.check (public: which codai AI-provenance marks a file carries; no key needed)
@@ -7112,5 +7227,5 @@ function allKeys(obj) {
7112
7227
  }
7113
7228
 
7114
7229
  //#endregion
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 };
7230
+ 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, vaultUnlockMessage, verifyAttestationWithKeys, verifyResolveWebhook };
7116
7231
  //# sourceMappingURL=index.js.map