@oxy.so/core 4.2.0 → 4.3.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.
@@ -395,6 +395,17 @@ class OxyInferenceClient {
395
395
  const body = await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_request).call(this, 'GET', `/v1/generations/${encodeURIComponent(id)}`, options);
396
396
  return body.data;
397
397
  }
398
+ /**
399
+ * Recover the existing record using the original credential and key. This
400
+ * performs only GET; 404 is unknown/pending, never proof of zero cost and
401
+ * never an instruction to repeat decide(). Lost answers are not retained.
402
+ */
403
+ async getGenerationRecordByIdempotencyKey(key, options = {}) {
404
+ if (key.length === 0 || key.length > 128)
405
+ throw new Error('Invalid original idempotency key.');
406
+ const body = await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_request).call(this, 'GET', '/v1/generations/by-idempotency-key', { ...options, idempotencyKey: key });
407
+ return body.data;
408
+ }
398
409
  }
399
410
  exports.OxyInferenceClient = OxyInferenceClient;
400
411
  _OxyInferenceClient_baseURL = new WeakMap(), _OxyInferenceClient_credential = new WeakMap(), _OxyInferenceClient_fetch = new WeakMap(), _OxyInferenceClient_instances = new WeakSet(), _OxyInferenceClient_bearer =
@@ -390,6 +390,17 @@ export class OxyInferenceClient {
390
390
  const body = await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_request).call(this, 'GET', `/v1/generations/${encodeURIComponent(id)}`, options);
391
391
  return body.data;
392
392
  }
393
+ /**
394
+ * Recover the existing record using the original credential and key. This
395
+ * performs only GET; 404 is unknown/pending, never proof of zero cost and
396
+ * never an instruction to repeat decide(). Lost answers are not retained.
397
+ */
398
+ async getGenerationRecordByIdempotencyKey(key, options = {}) {
399
+ if (key.length === 0 || key.length > 128)
400
+ throw new Error('Invalid original idempotency key.');
401
+ const body = await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_request).call(this, 'GET', '/v1/generations/by-idempotency-key', { ...options, idempotencyKey: key });
402
+ return body.data;
403
+ }
393
404
  }
394
405
  _OxyInferenceClient_baseURL = new WeakMap(), _OxyInferenceClient_credential = new WeakMap(), _OxyInferenceClient_fetch = new WeakMap(), _OxyInferenceClient_instances = new WeakSet(), _OxyInferenceClient_bearer =
395
406
  /** The bearer for this request, from whichever lane was configured. */
@@ -382,4 +382,13 @@ export declare class OxyInferenceClient {
382
382
  signal?: AbortSignal;
383
383
  delegatedUserId?: string;
384
384
  }): Promise<OxyGenerationRecord>;
385
+ /**
386
+ * Recover the existing record using the original credential and key. This
387
+ * performs only GET; 404 is unknown/pending, never proof of zero cost and
388
+ * never an instruction to repeat decide(). Lost answers are not retained.
389
+ */
390
+ getGenerationRecordByIdempotencyKey(key: string, options?: {
391
+ signal?: AbortSignal;
392
+ delegatedUserId?: string;
393
+ }): Promise<OxyGenerationRecord>;
385
394
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/core",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -179,7 +179,7 @@
179
179
  "@oxy.so/telemetry": "^1.2.0",
180
180
  "@noble/ciphers": "^1.3.0",
181
181
  "@noble/hashes": "^1.8.0",
182
- "@oxy.so/contracts": "^4.9.0",
182
+ "@oxy.so/contracts": "^4.9.1",
183
183
  "@oxy.so/protocol": "^1.2.2",
184
184
  "@scure/bip39": "^1.6.0",
185
185
  "buffer": "^6.0.3",
@@ -712,6 +712,22 @@ export class OxyInferenceClient {
712
712
  return body.data;
713
713
  }
714
714
 
715
+ /**
716
+ * Recover the existing record using the original credential and key. This
717
+ * performs only GET; 404 is unknown/pending, never proof of zero cost and
718
+ * never an instruction to repeat decide(). Lost answers are not retained.
719
+ */
720
+ async getGenerationRecordByIdempotencyKey(
721
+ key: string,
722
+ options: { signal?: AbortSignal; delegatedUserId?: string } = {},
723
+ ): Promise<OxyGenerationRecord> {
724
+ if (key.length === 0 || key.length > 128) throw new Error('Invalid original idempotency key.');
725
+ const body = await this.#request<{ data: OxyGenerationRecord }>(
726
+ 'GET', '/v1/generations/by-idempotency-key', { ...options, idempotencyKey: key },
727
+ );
728
+ return body.data;
729
+ }
730
+
715
731
  /** The bearer for this request, from whichever lane was configured. */
716
732
  async #bearer(): Promise<string> {
717
733
  const value =