@runinfra/sdk 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to `@runinfra/sdk` are documented here. This project follows
4
4
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [0.1.3] - 2026-05-23
7
+
8
+ ### Security
9
+ - Hardened browser credential safeguards by requiring
10
+ `dangerouslyAllowBrowser` to be an actual boolean and by failing closed in
11
+ browser worker runtimes unless explicitly allowed.
12
+ - Replaced trailing-slash URL regex normalization with a bounded loop to avoid
13
+ regex backtracking risk on adversarial base URLs.
14
+
15
+ ### Changed
16
+ - Pinned CI and publish build tooling with a TypeScript lockfile and Python
17
+ dev requirements file, and pinned workflow actions to immutable commits.
18
+ - Made real publish dispatch default to dry-run and require an exact version
19
+ confirmation on `main`.
20
+ - Extended package verification to scan shipped files for source maps, local
21
+ machine paths, package tokens, private keys, and registry config leaks.
22
+
6
23
  ## [0.1.2] - 2026-05-23
7
24
 
8
25
  ### Changed
package/README.md CHANGED
@@ -10,7 +10,7 @@ Requires Node.js 18 or newer.
10
10
  npm install @runinfra/sdk
11
11
  ```
12
12
 
13
- ## Modality status (v0.1.2)
13
+ ## Modality status (v0.1.3)
14
14
 
15
15
  This SDK is in **beta**. The surfaces below have different verification levels:
16
16
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const RUNINFRA_SDK_VERSION = "0.1.2";
1
+ export declare const RUNINFRA_SDK_VERSION = "0.1.3";
2
2
  export interface RunInfraOptions {
3
3
  apiKey: string;
4
4
  pipelineId?: string;
@@ -255,7 +255,7 @@ export declare class RunInfra {
255
255
  /**
256
256
  * Audio surfaces (text-to-speech + speech-to-text).
257
257
  *
258
- * @experimental As of v0.1.2, these methods have NOT been verified end-to-end
258
+ * @experimental As of v0.1.3, these methods have NOT been verified end-to-end
259
259
  * against a live deployed pipeline in our canary suite. The HTTP envelope
260
260
  * matches the OpenAI Audio API contract and the request/response shapes are
261
261
  * stable, but you should test against your own deployed model before using
@@ -276,7 +276,7 @@ export declare class RunInfra {
276
276
  /**
277
277
  * Image generation surface.
278
278
  *
279
- * @experimental As of v0.1.2, this method has NOT been verified end-to-end
279
+ * @experimental As of v0.1.3, this method has NOT been verified end-to-end
280
280
  * against a live deployed pipeline in our canary suite. The HTTP envelope
281
281
  * matches the OpenAI Images API contract, but you should test against your
282
282
  * own deployed model before using in production. Live-canary verification
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHmac, timingSafeEqual } from "node:crypto";
2
- export const RUNINFRA_SDK_VERSION = "0.1.2";
2
+ export const RUNINFRA_SDK_VERSION = "0.1.3";
3
3
  const MAX_AUTOMATIC_RETRY_AFTER_MS = 60_000;
4
4
  export class RunInfraError extends Error {
5
5
  status;
@@ -344,20 +344,27 @@ function baseUrlAlreadyHasPipelineId(baseURL, pipelineId) {
344
344
  const encodedPipelineId = encodeURIComponent(pipelineId);
345
345
  try {
346
346
  const parsed = new URL(baseURL);
347
- const lastSegment = parsed.pathname.replace(/\/+$/u, "").split("/").pop();
347
+ const lastSegment = stripTrailingSlashes(parsed.pathname).split("/").pop();
348
348
  return lastSegment === encodedPipelineId || decodeURIComponent(lastSegment ?? "") === pipelineId;
349
349
  }
350
350
  catch {
351
- const trimmed = baseURL.replace(/\/+$/u, "");
351
+ const trimmed = stripTrailingSlashes(baseURL);
352
352
  return (trimmed.endsWith(`/${encodedPipelineId}`) ||
353
353
  trimmed.endsWith(`/${pipelineId}`));
354
354
  }
355
355
  }
356
+ function stripTrailingSlashes(value) {
357
+ let end = value.length;
358
+ while (end > 0 && value.charCodeAt(end - 1) === 47) {
359
+ end -= 1;
360
+ }
361
+ return end === value.length ? value : value.slice(0, end);
362
+ }
356
363
  function validateBaseURL(baseURL) {
357
364
  if (typeof baseURL !== "string") {
358
365
  throw invalidRequestOption("baseURL must be a string");
359
366
  }
360
- const trimmed = baseURL.trim().replace(/\/+$/, "");
367
+ const trimmed = stripTrailingSlashes(baseURL.trim());
361
368
  try {
362
369
  const parsed = new URL(trimmed);
363
370
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
@@ -748,6 +755,10 @@ function validateRunInfraOptions(options) {
748
755
  throw invalidRequestOption(`Unknown RunInfra option: ${key}`);
749
756
  }
750
757
  }
758
+ if (options.dangerouslyAllowBrowser !== undefined &&
759
+ typeof options.dangerouslyAllowBrowser !== "boolean") {
760
+ throw invalidRequestOption("dangerouslyAllowBrowser must be a boolean");
761
+ }
751
762
  }
752
763
  function generatedClientRequestId() {
753
764
  const randomUUID = globalThis.crypto?.randomUUID;
@@ -756,7 +767,23 @@ function generatedClientRequestId() {
756
767
  return `runinfra-${Date.now()}-${Math.random().toString(16).slice(2)}`;
757
768
  }
758
769
  function isBrowserRuntime() {
759
- return typeof globalThis.window === "object" && typeof globalThis.document === "object";
770
+ const runtime = globalThis;
771
+ if (typeof runtime.window === "object" &&
772
+ runtime.window !== null &&
773
+ typeof runtime.document === "object" &&
774
+ runtime.document !== null) {
775
+ return true;
776
+ }
777
+ const workerGlobalScope = runtime.WorkerGlobalScope;
778
+ if (typeof workerGlobalScope !== "function" ||
779
+ typeof runtime.self !== "object" ||
780
+ runtime.self === null) {
781
+ return false;
782
+ }
783
+ const prototype = workerGlobalScope.prototype;
784
+ return typeof prototype === "object" &&
785
+ prototype !== null &&
786
+ Object.prototype.isPrototypeOf.call(prototype, runtime.self);
760
787
  }
761
788
  function retryAfterMs(response) {
762
789
  const value = response.headers.get("retry-after");
@@ -899,7 +926,7 @@ export class RunInfra {
899
926
  /**
900
927
  * Audio surfaces (text-to-speech + speech-to-text).
901
928
  *
902
- * @experimental As of v0.1.2, these methods have NOT been verified end-to-end
929
+ * @experimental As of v0.1.3, these methods have NOT been verified end-to-end
903
930
  * against a live deployed pipeline in our canary suite. The HTTP envelope
904
931
  * matches the OpenAI Audio API contract and the request/response shapes are
905
932
  * stable, but you should test against your own deployed model before using
@@ -910,7 +937,7 @@ export class RunInfra {
910
937
  /**
911
938
  * Image generation surface.
912
939
  *
913
- * @experimental As of v0.1.2, this method has NOT been verified end-to-end
940
+ * @experimental As of v0.1.3, this method has NOT been verified end-to-end
914
941
  * against a live deployed pipeline in our canary suite. The HTTP envelope
915
942
  * matches the OpenAI Images API contract, but you should test against your
916
943
  * own deployed model before using in production. Live-canary verification
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runinfra/sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "RunInfra SDK for optimized inference deployments (beta; LLM + embeddings tested, image/audio surfaces experimental)",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://runinfra.ai/docs/tools-sdks/runinfra-sdk",