codai-sdk 0.73.0 → 0.74.1

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
@@ -3588,12 +3588,147 @@ var VaultDevices = class {
3588
3588
  });
3589
3589
  }
3590
3590
  };
3591
+ /** `/v1/vault/add-requests/*` — an agent asks the user to add a missing secret (V-17). */
3592
+ var VaultAddRequests = class {
3593
+ http;
3594
+ constructor(http) {
3595
+ this.http = http;
3596
+ }
3597
+ /** `POST /v1/vault/add-requests` — answers a hub `url` to show the user (null when a pending request was reused). */
3598
+ create(body, opts = {}) {
3599
+ return this.http.json("/v1/vault/add-requests", {
3600
+ method: "POST",
3601
+ body: stripUndefined({ ...body }),
3602
+ ext: opts.ext,
3603
+ signal: opts.signal,
3604
+ noRetry: true
3605
+ });
3606
+ }
3607
+ /** `GET /v1/vault/add-requests/{id}` — poll; once `completed`, `handle` is the new `{{vault:<slug>}}`. */
3608
+ get(id, opts = {}) {
3609
+ return this.http.json(seg("/v1/vault/add-requests", id), {
3610
+ ext: opts.ext,
3611
+ signal: opts.signal
3612
+ });
3613
+ }
3614
+ /** `DELETE /v1/vault/add-requests/{id}` — cancel a pending request. */
3615
+ cancel(id, opts = {}) {
3616
+ return this.http.json(seg("/v1/vault/add-requests", id), {
3617
+ method: "DELETE",
3618
+ ext: opts.ext,
3619
+ signal: opts.signal
3620
+ });
3621
+ }
3622
+ /** `POST /v1/vault/add-requests/lookup` — full request by link token, signed-in owner only (404 otherwise). */
3623
+ lookup(token, opts = {}) {
3624
+ return this.http.json("/v1/vault/add-requests/lookup", {
3625
+ method: "POST",
3626
+ body: { token },
3627
+ ext: opts.ext,
3628
+ signal: opts.signal,
3629
+ noRetry: true
3630
+ });
3631
+ }
3632
+ /** `POST /v1/vault/add-requests/{id}/complete` — link the item you added; idempotent for the same item. */
3633
+ complete(id, itemId, opts = {}) {
3634
+ return this.http.json(seg("/v1/vault/add-requests", id, "/complete"), {
3635
+ method: "POST",
3636
+ body: { item_id: itemId },
3637
+ ext: opts.ext,
3638
+ signal: opts.signal,
3639
+ noRetry: true
3640
+ });
3641
+ }
3642
+ };
3643
+ /** `/v1/vault/emergency/*` — emergency access (V-23): invite, seal vault keys, request, wait, release. */
3644
+ var VaultEmergency = class {
3645
+ http;
3646
+ constructor(http) {
3647
+ this.http = http;
3648
+ }
3649
+ post(path, opts, body) {
3650
+ return this.http.json(path, {
3651
+ method: "POST",
3652
+ ...body ? { body: stripUndefined(body) } : {},
3653
+ ext: opts.ext,
3654
+ signal: opts.signal,
3655
+ noRetry: true
3656
+ });
3657
+ }
3658
+ /** `GET /v1/vault/emergency` — `{ outgoing, incoming }` (revoked omitted). */
3659
+ list(opts = {}) {
3660
+ return this.http.json("/v1/vault/emergency", {
3661
+ ext: opts.ext,
3662
+ signal: opts.signal
3663
+ });
3664
+ }
3665
+ /** `POST /v1/vault/emergency` — always 202 `{ id }` (enumeration-safe). */
3666
+ invite(body, opts = {}) {
3667
+ return this.post("/v1/vault/emergency", opts, { ...body });
3668
+ }
3669
+ /** `POST /v1/vault/emergency/accept` — the contact accepts with the emailed token (needs a vault account). */
3670
+ accept(token, opts = {}) {
3671
+ return this.post("/v1/vault/emergency/accept", opts, { token });
3672
+ }
3673
+ /** `PUT /v1/vault/emergency/{id}/seal` — grantor uploads vault keys sealed client-side to the contact. */
3674
+ seal(id, body, opts = {}) {
3675
+ return this.http.json(seg("/v1/vault/emergency", id, "/seal"), {
3676
+ method: "PUT",
3677
+ body: { ...body },
3678
+ ext: opts.ext,
3679
+ signal: opts.signal,
3680
+ noRetry: true
3681
+ });
3682
+ }
3683
+ /** `PATCH /v1/vault/emergency/{id}` — change `delay_hours` and/or `vault_ids` (vaults change → re-seal). */
3684
+ update(id, body, opts = {}) {
3685
+ if (body.delay_hours === void 0 && body.vault_ids === void 0) return Promise.reject(/* @__PURE__ */ new TypeError("update needs delay_hours and/or vault_ids"));
3686
+ return this.http.json(seg("/v1/vault/emergency", id), {
3687
+ method: "PATCH",
3688
+ body: stripUndefined({ ...body }),
3689
+ ext: opts.ext,
3690
+ signal: opts.signal,
3691
+ noRetry: true
3692
+ });
3693
+ }
3694
+ /** `DELETE /v1/vault/emergency/{id}` — grantor revokes or the contact declines. */
3695
+ revoke(id, opts = {}) {
3696
+ return this.http.json(seg("/v1/vault/emergency", id), {
3697
+ method: "DELETE",
3698
+ ext: opts.ext,
3699
+ signal: opts.signal
3700
+ });
3701
+ }
3702
+ /** `POST /v1/vault/emergency/{id}/request` — contact starts the wait; released at `release_at` unless denied. */
3703
+ request(id, params = {}, opts = {}) {
3704
+ return this.post(seg("/v1/vault/emergency", id, "/request"), opts, { reason: params.reason });
3705
+ }
3706
+ /** `POST /v1/vault/emergency/{id}/deny` — grantor denies a pending request (back to `sealed`). */
3707
+ deny(id, opts = {}) {
3708
+ return this.post(seg("/v1/vault/emergency", id, "/deny"), opts, {});
3709
+ }
3710
+ /** `POST /v1/vault/emergency/{id}/approve` — grantor grants a pending request now. */
3711
+ approve(id, opts = {}) {
3712
+ return this.post(seg("/v1/vault/emergency", id, "/approve"), opts, {});
3713
+ }
3714
+ /** `GET /v1/vault/emergency/{id}/vault-data` — contact, status `granted`: sealed vault keys + item envelopes. */
3715
+ vaultData(id, opts = {}) {
3716
+ return this.http.json(seg("/v1/vault/emergency", id, "/vault-data"), {
3717
+ ext: opts.ext,
3718
+ signal: opts.signal
3719
+ });
3720
+ }
3721
+ };
3591
3722
  var Vault = class {
3592
3723
  http;
3593
3724
  devices;
3725
+ addRequests;
3726
+ emergency;
3594
3727
  constructor(http) {
3595
3728
  this.http = http;
3596
3729
  this.devices = new VaultDevices(http);
3730
+ this.addRequests = new VaultAddRequests(http);
3731
+ this.emergency = new VaultEmergency(http);
3597
3732
  }
3598
3733
  get(path, opts, query) {
3599
3734
  return this.http.json(path, {
@@ -3766,6 +3901,61 @@ var Vault = class {
3766
3901
  resolve(body, opts = {}) {
3767
3902
  return this.send("POST", "/v1/vault/resolve", opts, body);
3768
3903
  }
3904
+ /**
3905
+ * `GET /v1/vault/hibp/range/{prefix}` — padded HIBP range (`SUFFIX:COUNT` lines, text) for the first 5 hex chars of
3906
+ * a SHA-1; compare locally, the password never leaves the client. 300 calls per user per hour.
3907
+ */
3908
+ async hibpRange(prefix, opts = {}) {
3909
+ if (!/^[0-9A-Fa-f]{5}$/.test(prefix)) throw new TypeError("hibpRange prefix must be 5 hex characters");
3910
+ return (await this.http.request(`/v1/vault/hibp/range/${prefix.toUpperCase()}`, {
3911
+ ext: opts.ext,
3912
+ signal: opts.signal,
3913
+ headers: { accept: "text/plain" }
3914
+ })).text();
3915
+ }
3916
+ /** `GET /v1/vault/rotation` — rotation queue: breached, overdue, soonest due; unscheduled last. */
3917
+ async rotation(opts = {}) {
3918
+ return [...(await this.get("/v1/vault/rotation", opts)).items];
3919
+ }
3920
+ /** `PUT /v1/vault/items/{id}/rotation` — any of `interval_days`, `provider`, `snoozed_until`; `null` clears one. */
3921
+ setRotation(id, patch, opts = {}) {
3922
+ const body = Object.fromEntries(Object.entries(patch).filter(([, v]) => v !== void 0));
3923
+ if (Object.keys(body).length === 0) return Promise.reject(/* @__PURE__ */ new TypeError("setRotation needs interval_days, provider and/or snoozed_until"));
3924
+ return this.http.json(seg("/v1/vault/items", id, "/rotation"), {
3925
+ method: "PUT",
3926
+ body,
3927
+ ext: opts.ext,
3928
+ signal: opts.signal,
3929
+ noRetry: true
3930
+ });
3931
+ }
3932
+ /** `POST /v1/vault/items/{id}/rotated` — `rotated_at` = now, breach flag cleared. */
3933
+ markRotated(id, opts = {}) {
3934
+ return this.send("POST", seg("/v1/vault/items", id, "/rotated"), opts, {});
3935
+ }
3936
+ /** `POST /v1/vault/rotation/breach-report` — local HIBP results (`count` 0 = clean), up to 500 per call. */
3937
+ reportBreaches(results, opts = {}) {
3938
+ return this.send("POST", "/v1/vault/rotation/breach-report", opts, { results });
3939
+ }
3940
+ /** `GET /v1/vault/derivers` — derivers on items in your vaults (config only, never values). */
3941
+ async derivers(opts = {}) {
3942
+ return [...(await this.get("/v1/vault/derivers", opts)).derivers];
3943
+ }
3944
+ /** `PUT /v1/vault/items/{id}/deriver` — owner only; config validated per provider. */
3945
+ async setDeriver(id, body, opts = {}) {
3946
+ return (await this.send("PUT", seg("/v1/vault/items", id, "/deriver"), opts, { ...body })).deriver;
3947
+ }
3948
+ /** `DELETE /v1/vault/items/{id}/deriver` — owner only; 404 when there is none. */
3949
+ deleteDeriver(id, opts = {}) {
3950
+ return this.send("DELETE", seg("/v1/vault/items", id, "/deriver"), opts);
3951
+ }
3952
+ /**
3953
+ * `POST /v1/vault/derive` — codai local brokers only: a short-lived credential from a root item's deriver. Same
3954
+ * `proof` as {@link resolve} over `handles = [handle]`. A 202 (approval required) is returned, not thrown.
3955
+ */
3956
+ derive(body, opts = {}) {
3957
+ return this.send("POST", "/v1/vault/derive", opts, body);
3958
+ }
3769
3959
  };
3770
3960
 
3771
3961
  // src/resources/abuse-reports.ts
@@ -6916,6 +7106,30 @@ const OPERATION_METHODS = {
6916
7106
  vaultHttp: "vault.httpCall",
6917
7107
  vaultResolve: "vault.resolve",
6918
7108
  createVaultResolveChallenge: "vault.resolveChallenge",
7109
+ createVaultAddRequest: "vault.addRequests.create",
7110
+ getVaultAddRequest: "vault.addRequests.get",
7111
+ cancelVaultAddRequest: "vault.addRequests.cancel",
7112
+ lookupVaultAddRequest: "vault.addRequests.lookup",
7113
+ completeVaultAddRequest: "vault.addRequests.complete",
7114
+ listVaultEmergency: "vault.emergency.list",
7115
+ inviteVaultEmergency: "vault.emergency.invite",
7116
+ acceptVaultEmergency: "vault.emergency.accept",
7117
+ sealVaultEmergency: "vault.emergency.seal",
7118
+ updateVaultEmergency: "vault.emergency.update",
7119
+ revokeVaultEmergency: "vault.emergency.revoke",
7120
+ requestVaultEmergency: "vault.emergency.request",
7121
+ denyVaultEmergency: "vault.emergency.deny",
7122
+ approveVaultEmergency: "vault.emergency.approve",
7123
+ getVaultEmergencyData: "vault.emergency.vaultData",
7124
+ getVaultHibpRange: "vault.hibpRange",
7125
+ listVaultRotation: "vault.rotation",
7126
+ setVaultItemRotation: "vault.setRotation",
7127
+ markVaultItemRotated: "vault.markRotated",
7128
+ reportVaultBreaches: "vault.reportBreaches",
7129
+ listVaultDerivers: "vault.derivers",
7130
+ setVaultItemDeriver: "vault.setDeriver",
7131
+ deleteVaultItemDeriver: "vault.deleteDeriver",
7132
+ deriveVaultCredential: "vault.derive",
6919
7133
  createStudioAbuseReport: "abuseReports.create",
6920
7134
  checkProvenance: "provenance.check",
6921
7135
  createStudioBatch: "batches.create",
@@ -7431,6 +7645,8 @@ var CodaiApps = class {
7431
7645
  * client.vault.account / .items / .putItem / .rules / .approvals / .decide / .catalog / .use / .httpCall / .resolve
7432
7646
  * client.vault.devices.challenge / .enroll / .list / .rename / .revoke (device approval keys, V-27)
7433
7647
  * client.vault.updateSettings / .lock / .unlockChallenge / .unlock / .limits / .setLimits / .revokeTaskGrants (guards, v4)
7648
+ * client.vault.addRequests.* / .emergency.* / .hibpRange / .rotation / .setRotation / .markRotated / .reportBreaches
7649
+ * client.vault.derivers / .setDeriver / .deleteDeriver / .derive (wave 2: add requests, emergency access, rotation, JIT)
7434
7650
  * (zero-knowledge credentials vault: ciphertext only; the broker calls never return secret values)
7435
7651
  * client.abuseReports.create (public DSA notice about a codai Studio share / review link; no key needed)
7436
7652
  * client.provenance.check (public: which codai AI-provenance marks a file carries; no key needed)
@@ -7747,5 +7963,5 @@ function allKeys(obj) {
7747
7963
  return [...keys];
7748
7964
  }
7749
7965
 
7750
- 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, JAM_CLOSE_CODES, JAM_SCALES, JAM_SUBPROTOCOL, Jam, JamSession, Keys, Lists, LyricsResource, MediaOps, Memory, Messages, Models, Music, MusicRoom, 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, Voices, extensionHeaders, frameJson, isAssetDto, isMediaOpJob, isMediaOpJobFinished, isMusicRoomFinished, isPagedBuild, isProductionFinished, isResearchFinished, jamUrl, mergeToolCall, readSse, realtimeUrl, resolveAttestationStatement, settingsConflictCurrent, shareTokenFrom, uploadIdFromLocation, vaultResolveDigestInput, vaultResolveMessage, vaultUnlockMessage, verifyAttestationWithKeys, verifyResolveWebhook };
7966
+ 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, JAM_CLOSE_CODES, JAM_SCALES, JAM_SUBPROTOCOL, Jam, JamSession, Keys, Lists, LyricsResource, MediaOps, Memory, Messages, Models, Music, MusicRoom, 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, VaultAddRequests, VaultDevices, VaultEmergency, Verify, Videos, VoiceRevocations, Voices, extensionHeaders, frameJson, isAssetDto, isMediaOpJob, isMediaOpJobFinished, isMusicRoomFinished, isPagedBuild, isProductionFinished, isResearchFinished, jamUrl, mergeToolCall, readSse, realtimeUrl, resolveAttestationStatement, settingsConflictCurrent, shareTokenFrom, uploadIdFromLocation, vaultResolveDigestInput, vaultResolveMessage, vaultUnlockMessage, verifyAttestationWithKeys, verifyResolveWebhook };
7751
7967
  //# sourceMappingURL=index.js.map