roe-typescript 1.1.0 → 1.1.2

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/client.js CHANGED
@@ -1,5 +1,5 @@
1
- import { AgentsAPI } from "./api/agents.js";
2
1
  import { createGeneratedApis } from "./api/_generated.js";
2
+ import { AgentsAPI } from "./api/agents.js";
3
3
  import { PoliciesAPI } from "./api/policies.js";
4
4
  import { UsersAPI } from "./api/users.js";
5
5
  import { RoeAuth } from "./auth.js";
package/dist/config.js CHANGED
@@ -11,7 +11,9 @@ export class RoeConfig {
11
11
  const organizationId = input.organizationId ?? process.env.ROE_ORGANIZATION_ID;
12
12
  const baseUrl = input.baseUrl ?? process.env.ROE_BASE_URL ?? "https://api.roe-ai.com";
13
13
  // Parse ROE_TIMEOUT with NaN check to avoid poisoning timeoutMs
14
- const timeoutSecondsEnvRaw = process.env.ROE_TIMEOUT ? Number(process.env.ROE_TIMEOUT) : undefined;
14
+ const timeoutSecondsEnvRaw = process.env.ROE_TIMEOUT
15
+ ? Number(process.env.ROE_TIMEOUT)
16
+ : undefined;
15
17
  const timeoutSecondsEnv = timeoutSecondsEnvRaw !== undefined && !Number.isNaN(timeoutSecondsEnvRaw)
16
18
  ? timeoutSecondsEnvRaw
17
19
  : undefined;
@@ -70,7 +70,9 @@ export function extractErrorMessage(data, statusCode) {
70
70
  const firstError = obj.errors[0];
71
71
  if (typeof firstError === "string")
72
72
  return firstError;
73
- if (typeof firstError === "object" && firstError !== null && typeof firstError.message === "string") {
73
+ if (typeof firstError === "object" &&
74
+ firstError !== null &&
75
+ typeof firstError.message === "string") {
74
76
  return firstError.message;
75
77
  }
76
78
  }
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export { RoeClient } from "./client.js";
2
- export { RoeConfig } from "./config.js";
3
- export type { RoeConfigInput } from "./config.js";
4
- export { RoeAuth } from "./auth.js";
5
- export { createRoeRawClient } from "./generated/client.js";
6
- export type { RoeApiComponents, RoeApiPaths, RoeRawClient } from "./generated/client.js";
7
- export type { components, paths } from "./generated/schema.js";
8
- export * from "./exceptions.js";
9
1
  export * from "./api/_generated.js";
10
2
  export * from "./api/agents.js";
11
3
  export * from "./api/policies.js";
12
4
  export * from "./api/users.js";
13
- export { Job, JobBatch, JobStatus } from "./models/job.js";
14
- export type { JobResult, JobBatchItem } from "./models/job.js";
5
+ export { RoeAuth } from "./auth.js";
6
+ export { RoeClient } from "./client.js";
7
+ export type { RoeConfigInput } from "./config.js";
8
+ export { RoeConfig } from "./config.js";
9
+ export * from "./exceptions.js";
10
+ export type { RoeApiComponents, RoeApiPaths, RoeRawClient, } from "./generated/client.js";
11
+ export { createRoeRawClient } from "./generated/client.js";
12
+ export type { components, paths } from "./generated/schema.js";
15
13
  export { FileUpload } from "./models/file.js";
14
+ export type { JobBatchItem, JobResult } from "./models/job.js";
15
+ export { Job, JobBatch, JobStatus } from "./models/job.js";
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- export { RoeClient } from "./client.js";
2
- export { RoeConfig } from "./config.js";
3
- export { RoeAuth } from "./auth.js";
4
- export { createRoeRawClient } from "./generated/client.js";
5
- export * from "./exceptions.js";
6
1
  export * from "./api/_generated.js";
7
2
  export * from "./api/agents.js";
8
3
  export * from "./api/policies.js";
9
4
  export * from "./api/users.js";
10
- export { Job, JobBatch, JobStatus } from "./models/job.js";
5
+ export { RoeAuth } from "./auth.js";
6
+ export { RoeClient } from "./client.js";
7
+ export { RoeConfig } from "./config.js";
8
+ export * from "./exceptions.js";
9
+ export { createRoeRawClient } from "./generated/client.js";
11
10
  export { FileUpload } from "./models/file.js";
11
+ export { Job, JobBatch, JobStatus } from "./models/job.js";
12
12
  // Hand-written response models removed in v1.0 (Agent, BaseAgent, Policy, PolicyVersion,
13
13
  // AgentVersion, AgentDatum, AgentJobResult, AgentJobStatus, Reference, JobDataDeleteResponse,
14
14
  // PaginatedResponse, UserInfo). Import the generated equivalents instead, e.g.:
15
- // import type { components } from "@roe-ai/typescript";
15
+ // import type { components } from "roe-typescript";
16
16
  // type Policy = components["schemas"]["Policy"];
@@ -1,5 +1,5 @@
1
- import fs from "fs";
2
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
3
  import mime from "mime-types";
4
4
  import { BadRequestError } from "../exceptions.js";
5
5
  /** Maximum file size: 2GB (aligned with main-roe backend) */
@@ -89,7 +89,9 @@ export class FileUpload {
89
89
  for await (const chunk of this.file) {
90
90
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
91
91
  }
92
- this._streamBlob = new Blob([Buffer.concat(chunks)], { type: this.effectiveMimeType });
92
+ this._streamBlob = new Blob([Buffer.concat(chunks)], {
93
+ type: this.effectiveMimeType,
94
+ });
93
95
  return this._streamBlob;
94
96
  }
95
97
  throw new Error("No file source available");
@@ -1,4 +1,4 @@
1
- import { AgentsAPI } from "../api/agents.js";
1
+ import type { AgentsAPI } from "../api/agents.js";
2
2
  import type { components } from "../generated/schema.js";
3
3
  export declare enum JobStatus {
4
4
  PENDING = 0,
@@ -81,7 +81,11 @@ export class JobBatch {
81
81
  }
82
82
  }
83
83
  get jobs() {
84
- return this.jobIds.map((id) => new Job({ agentsApi: this.agentsApi, jobId: id, timeoutSeconds: this.timeoutSeconds }));
84
+ return this.jobIds.map((id) => new Job({
85
+ agentsApi: this.agentsApi,
86
+ jobId: id,
87
+ timeoutSeconds: this.timeoutSeconds,
88
+ }));
85
89
  }
86
90
  async wait(params) {
87
91
  const intervalSeconds = params?.intervalSeconds ?? 5;
@@ -119,7 +123,8 @@ export class JobBatch {
119
123
  if (completedIds.length) {
120
124
  let resultBatch;
121
125
  try {
122
- resultBatch = await this.agentsApi.jobs.retrieveResultMany(completedIds);
126
+ resultBatch =
127
+ await this.agentsApi.jobs.retrieveResultMany(completedIds);
123
128
  }
124
129
  catch (err) {
125
130
  // Only synthesize for failed/cancelled — can't fake results for success/cached
@@ -145,7 +150,8 @@ export class JobBatch {
145
150
  }
146
151
  for (const res of resultBatch) {
147
152
  const jobStatus = res.status ?? this.statuses[res.id]?.status ?? null;
148
- const isFailed = jobStatus === JobStatus.FAILURE || jobStatus === JobStatus.CANCELLED;
153
+ const isFailed = jobStatus === JobStatus.FAILURE ||
154
+ jobStatus === JobStatus.CANCELLED;
149
155
  if (!res.agent_id || !res.agent_version_id) {
150
156
  if (!isFailed) {
151
157
  const id = res.id ?? "unknown";
@@ -190,7 +196,12 @@ export class JobBatch {
190
196
  async retrieveStatus() {
191
197
  const statusMap = {};
192
198
  const toQuery = [];
193
- const TERMINAL = new Set([JobStatus.SUCCESS, JobStatus.CACHED, JobStatus.FAILURE, JobStatus.CANCELLED]);
199
+ const TERMINAL = new Set([
200
+ JobStatus.SUCCESS,
201
+ JobStatus.CACHED,
202
+ JobStatus.FAILURE,
203
+ JobStatus.CANCELLED,
204
+ ]);
194
205
  for (const id of this.jobIds) {
195
206
  const cached = this.statuses[id];
196
207
  if (cached !== undefined && TERMINAL.has(cached.status)) {
@@ -27,7 +27,8 @@ export async function classifyInputs(inputs) {
27
27
  files[key] = value;
28
28
  continue;
29
29
  }
30
- if (typeof value === "object" && typeof value.pipe === "function") {
30
+ if (typeof value === "object" &&
31
+ typeof value.pipe === "function") {
31
32
  files[key] = new FileUpload({ file: value });
32
33
  continue;
33
34
  }
@@ -110,5 +111,6 @@ export async function postDynamicInputs(raw, path, pathParams, queryParams, inpu
110
111
  throw err;
111
112
  }
112
113
  }
113
- throw lastErr ?? new Error("postDynamicInputs exhausted retries without producing an error");
114
+ throw (lastErr ??
115
+ new Error("postDynamicInputs exhausted retries without producing an error"));
114
116
  }
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from "node:fs";
2
2
  const uuidRegex = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i;
3
3
  export function isUuidString(value) {
4
4
  return typeof value === "string" && uuidRegex.test(value);
@@ -1,5 +1,5 @@
1
1
  import type { Middleware } from "openapi-fetch";
2
- import { RoeAuth } from "../auth.js";
2
+ import type { RoeAuth } from "../auth.js";
3
3
  export declare function shouldBypassRetry(request: Request): boolean;
4
4
  export declare function authMiddleware(auth: RoeAuth): Middleware;
5
5
  export declare function retryMiddleware(maxRetries: number): Middleware;
@@ -1,4 +1,4 @@
1
- import { extractErrorMessage, getExceptionForStatusCode } from "../exceptions.js";
1
+ import { extractErrorMessage, getExceptionForStatusCode, } from "../exceptions.js";
2
2
  const RETRY_BYPASS_HEADER = "x-roe-retry-bypass";
3
3
  export function shouldBypassRetry(request) {
4
4
  if (request.headers.get(RETRY_BYPASS_HEADER))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roe-typescript",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "TypeScript SDK for the Roe API (feature parity with roe-python).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,6 +13,8 @@
13
13
  },
14
14
  "scripts": {
15
15
  "build": "tsc -p tsconfig.json",
16
+ "format": "biome check --write .",
17
+ "format:check": "biome ci .",
16
18
  "generate-sdk": "bash scripts/generate-sdk",
17
19
  "lint": "tsc --noEmit",
18
20
  "test": "vitest run tests/unit --passWithNoTests",
@@ -26,6 +28,7 @@
26
28
  "uuid": "^11.1.1"
27
29
  },
28
30
  "devDependencies": {
31
+ "@biomejs/biome": "2.4.9",
29
32
  "@types/mime-types": "^2.1.4",
30
33
  "@types/node": "^22.9.0",
31
34
  "@types/uuid": "^10.0.0",