roe-typescript 1.1.0 → 1.1.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/README.md +15 -5
- package/dist/api/agents.js +23 -7
- package/dist/api/discovery.d.ts +2 -0
- package/dist/api/discovery.js +6 -0
- package/dist/api/policies.d.ts +18 -6
- package/dist/api/policies.js +51 -33
- package/dist/api/tables.d.ts +2 -0
- package/dist/api/tables.js +6 -0
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +3 -3
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/config.js +3 -1
- package/dist/exceptions.js +3 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +6 -6
- package/dist/models/file.js +5 -3
- package/dist/models/job.d.ts +1 -1
- package/dist/models/job.js +15 -4
- package/dist/utils/dynamicInputs.js +4 -2
- package/dist/utils/fileDetection.js +1 -1
- package/dist/utils/middleware.d.ts +1 -1
- package/dist/utils/middleware.js +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
TypeScript/Node SDK for the [Roe](https://www.roe-ai.com/) API.
|
|
4
4
|
|
|
5
5
|
<!-- ROE-SDK:RELEASE-BANNER:START -->
|
|
6
|
-
> **v1.1.
|
|
7
|
-
>
|
|
8
|
-
>
|
|
6
|
+
> **v1.1.1** - SDK operation coverage is synchronized across Python,
|
|
7
|
+
> TypeScript, and Go. See `SDK_EXAMPLES.md` for copy-ready examples and use
|
|
8
|
+
> cases.
|
|
9
9
|
<!-- ROE-SDK:RELEASE-BANNER:END -->
|
|
10
10
|
|
|
11
11
|
> **v1.0.80** — `RoeHTTPClient`/axios were replaced by the generated
|
|
@@ -125,9 +125,9 @@ console.log(response.response.status);
|
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
<!-- ROE-SDK:GENERATED-FRIENDLY-APIS:START -->
|
|
128
|
-
##
|
|
128
|
+
## SDK Operation Groups
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
Common operations are available directly on the SDK client.
|
|
131
131
|
|
|
132
132
|
```typescript
|
|
133
133
|
const engines = await client.discovery.listAgentEngineTypes();
|
|
@@ -522,6 +522,16 @@ const agent = await client.agents.create({
|
|
|
522
522
|
| AML Investigation | `AMLInvestigationEngine` |
|
|
523
523
|
| Fraud Investigation | `FraudInvestigationEngine` |
|
|
524
524
|
|
|
525
|
+
## Development
|
|
526
|
+
|
|
527
|
+
Before opening a PR, format and lint the codebase by running:
|
|
528
|
+
|
|
529
|
+
```bash
|
|
530
|
+
./roe-cli format
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
CI runs the same checks (`biome ci`) on every pull request and on merges to `main`, and they must pass before a PR can be merged.
|
|
534
|
+
|
|
525
535
|
## Links
|
|
526
536
|
|
|
527
537
|
- [Roe](https://www.roe-ai.com/)
|
package/dist/api/agents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isUuidString } from "../utils/fileDetection.js";
|
|
2
|
-
import { postDynamicInputs } from "../utils/dynamicInputs.js";
|
|
3
1
|
import { BadRequestError, RoeAPIException } from "../exceptions.js";
|
|
4
2
|
import { Job, JobBatch } from "../models/job.js";
|
|
3
|
+
import { postDynamicInputs } from "../utils/dynamicInputs.js";
|
|
4
|
+
import { isUuidString } from "../utils/fileDetection.js";
|
|
5
5
|
function validateUuid(value, fieldName) {
|
|
6
6
|
if (!isUuidString(value)) {
|
|
7
7
|
throw new BadRequestError(`Invalid ${fieldName}: "${value}" is not a valid UUID`, 400);
|
|
@@ -30,7 +30,9 @@ export class AgentVersionsAPI {
|
|
|
30
30
|
async retrieve(agentId, versionId, getSupportsEval) {
|
|
31
31
|
validateUuid(agentId, "agentId");
|
|
32
32
|
validateUuid(versionId, "versionId");
|
|
33
|
-
const query = {
|
|
33
|
+
const query = {
|
|
34
|
+
organization_id: this.organizationId,
|
|
35
|
+
};
|
|
34
36
|
if (getSupportsEval !== undefined)
|
|
35
37
|
query.get_supports_eval = String(getSupportsEval).toLowerCase();
|
|
36
38
|
const { data } = await this.raw.GET("/v1/agents/{agent_id}/versions/{agent_version_id}/", {
|
|
@@ -169,7 +171,9 @@ export class AgentJobsAPI {
|
|
|
169
171
|
// The endpoint streams binary; openapi-fetch's typed GET expects a JSON
|
|
170
172
|
// response per the spec, so we use parseAs:"arrayBuffer" to skip JSON
|
|
171
173
|
// parsing and read raw bytes.
|
|
172
|
-
const query = {
|
|
174
|
+
const query = {
|
|
175
|
+
organization_id: this.organizationId,
|
|
176
|
+
};
|
|
173
177
|
if (asAttachment)
|
|
174
178
|
query.download = "true";
|
|
175
179
|
const result = await this.raw.GET("/v1/agents/jobs/{agent_job_id}/references/{resource_id}/", {
|
|
@@ -305,7 +309,11 @@ export class AgentsAPI {
|
|
|
305
309
|
validateUuid(params.agentId, "agentId");
|
|
306
310
|
const response = await postDynamicInputs(this.raw, "/v1/agents/run/{agent_id}/async/", { agent_id: params.agentId }, { organization_id: this.config.organizationId }, params.inputs, params.metadata, this.config.maxRetries);
|
|
307
311
|
const jobId = this.extractJobId(response);
|
|
308
|
-
return new Job({
|
|
312
|
+
return new Job({
|
|
313
|
+
agentsApi: this,
|
|
314
|
+
jobId,
|
|
315
|
+
timeoutSeconds: params.timeoutSeconds,
|
|
316
|
+
});
|
|
309
317
|
}
|
|
310
318
|
async runMany(params) {
|
|
311
319
|
validateUuid(params.agentId, "agentId");
|
|
@@ -328,7 +336,11 @@ export class AgentsAPI {
|
|
|
328
336
|
allJobIds.push(jobId);
|
|
329
337
|
}
|
|
330
338
|
}
|
|
331
|
-
return new JobBatch({
|
|
339
|
+
return new JobBatch({
|
|
340
|
+
agentsApi: this,
|
|
341
|
+
jobIds: allJobIds,
|
|
342
|
+
timeoutSeconds: params.timeoutSeconds,
|
|
343
|
+
});
|
|
332
344
|
}
|
|
333
345
|
async runSync(agentId, inputs, metadata) {
|
|
334
346
|
validateUuid(agentId, "agentId");
|
|
@@ -339,7 +351,11 @@ export class AgentsAPI {
|
|
|
339
351
|
validateUuid(params.versionId, "versionId");
|
|
340
352
|
const response = await postDynamicInputs(this.raw, "/v1/agents/run/{agent_id}/versions/{agent_version_id}/async/", { agent_id: params.agentId, agent_version_id: params.versionId }, { organization_id: this.config.organizationId }, params.inputs, params.metadata, this.config.maxRetries);
|
|
341
353
|
const jobId = this.extractJobId(response);
|
|
342
|
-
return new Job({
|
|
354
|
+
return new Job({
|
|
355
|
+
agentsApi: this,
|
|
356
|
+
jobId,
|
|
357
|
+
timeoutSeconds: params.timeoutSeconds,
|
|
358
|
+
});
|
|
343
359
|
}
|
|
344
360
|
async runVersionSync(agentId, versionId, inputs, metadata) {
|
|
345
361
|
validateUuid(agentId, "agentId");
|
package/dist/api/discovery.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare class DiscoveryAPI {
|
|
|
8
8
|
readonly raw: RoeRawClient;
|
|
9
9
|
/** API for discovering valid agent engine types and model IDs. */
|
|
10
10
|
constructor(config: RoeConfig, raw: RoeRawClient);
|
|
11
|
+
protected get rawClient(): RoeRawClient;
|
|
12
|
+
protected get organizationId(): string;
|
|
11
13
|
/** Return production engine_class_id values accepted by agent creation. */
|
|
12
14
|
listAgentEngineTypes(): Promise<AgentEngineTypeList>;
|
|
13
15
|
/** Return non-deprecated model IDs accepted in engine_config.model. */
|
package/dist/api/discovery.js
CHANGED
|
@@ -8,6 +8,12 @@ export class DiscoveryAPI {
|
|
|
8
8
|
this.config = config;
|
|
9
9
|
this.raw = raw;
|
|
10
10
|
}
|
|
11
|
+
get rawClient() {
|
|
12
|
+
return this.raw;
|
|
13
|
+
}
|
|
14
|
+
get organizationId() {
|
|
15
|
+
return this.config.organizationId;
|
|
16
|
+
}
|
|
11
17
|
/** Return production engine_class_id values accepted by agent creation. */
|
|
12
18
|
async listAgentEngineTypes() {
|
|
13
19
|
const result = await this.raw.GET("/v1/agents/types/");
|
package/dist/api/policies.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { RoeConfig } from "../config.js";
|
|
1
|
+
import type { RoeConfig } from "../config.js";
|
|
2
2
|
import type { RoeRawClient } from "../generated/client.js";
|
|
3
3
|
import type { components } from "../generated/schema.js";
|
|
4
|
-
type Policy = components["schemas"]["Policy"];
|
|
5
4
|
type CreatePolicy = components["schemas"]["CreatePolicy"];
|
|
6
|
-
type UpdatePolicy = components["schemas"]["UpdatePolicy"];
|
|
7
|
-
type PolicyVersion = components["schemas"]["PolicyVersion"];
|
|
8
5
|
type PaginatedPolicyList = components["schemas"]["PaginatedPolicyList"];
|
|
6
|
+
type Policy = components["schemas"]["Policy"];
|
|
7
|
+
type PolicyVersion = components["schemas"]["PolicyVersion"];
|
|
8
|
+
type UpdatePolicy = components["schemas"]["UpdatePolicy"];
|
|
9
9
|
export declare class PolicyVersionsAPI {
|
|
10
10
|
private readonly policiesApi;
|
|
11
|
+
/** API for managing the versions of a policy. */
|
|
11
12
|
constructor(policiesApi: PoliciesAPI);
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
protected get rawClient(): RoeRawClient;
|
|
14
|
+
protected get organizationId(): string;
|
|
15
|
+
/** List all versions of a policy. */
|
|
14
16
|
list(policyId: string): Promise<PolicyVersion[]>;
|
|
17
|
+
/** Retrieve a single policy version. */
|
|
15
18
|
retrieve(policyId: string, versionId: string): Promise<PolicyVersion>;
|
|
19
|
+
/** Create a new version of a policy. */
|
|
16
20
|
create(params: {
|
|
17
21
|
policyId: string;
|
|
18
22
|
content: Record<string, unknown>;
|
|
@@ -23,23 +27,31 @@ export declare class PolicyVersionsAPI {
|
|
|
23
27
|
export declare class PoliciesAPI {
|
|
24
28
|
readonly config: RoeConfig;
|
|
25
29
|
readonly raw: RoeRawClient;
|
|
30
|
+
/** API for managing Roe policies and their versions. */
|
|
26
31
|
readonly versions: PolicyVersionsAPI;
|
|
27
32
|
constructor(config: RoeConfig, raw: RoeRawClient);
|
|
33
|
+
protected get rawClient(): RoeRawClient;
|
|
34
|
+
protected get organizationId(): string;
|
|
35
|
+
/** List policies in the organization (paginated). */
|
|
28
36
|
list(params?: {
|
|
29
37
|
page?: number;
|
|
30
38
|
pageSize?: number;
|
|
31
39
|
}): Promise<PaginatedPolicyList>;
|
|
40
|
+
/** Retrieve a single policy by ID. */
|
|
32
41
|
retrieve(policyId: string): Promise<Policy>;
|
|
42
|
+
/** Create a new policy together with its first version. */
|
|
33
43
|
create(params: {
|
|
34
44
|
name: string;
|
|
35
45
|
content: Record<string, unknown>;
|
|
36
46
|
description?: string;
|
|
37
47
|
versionName?: string;
|
|
38
48
|
}): Promise<CreatePolicy>;
|
|
49
|
+
/** Update mutable fields of a policy. */
|
|
39
50
|
update(policyId: string, updates: {
|
|
40
51
|
name?: string;
|
|
41
52
|
description?: string;
|
|
42
53
|
}): Promise<UpdatePolicy>;
|
|
54
|
+
/** Delete a policy. */
|
|
43
55
|
delete(policyId: string): Promise<void>;
|
|
44
56
|
}
|
|
45
57
|
export {};
|
package/dist/api/policies.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
// Auto-generated friendly API facades for the Roe SDK.
|
|
2
|
+
// Generated by scripts/generate-sdk from openapi/wrappers.yml.
|
|
3
|
+
// Do not edit by hand.
|
|
2
4
|
import { BadRequestError, RoeAPIException } from "../exceptions.js";
|
|
3
|
-
|
|
4
|
-
* Validates that a value is a valid UUID string.
|
|
5
|
-
* @throws BadRequestError if the value is not a valid UUID
|
|
6
|
-
*/
|
|
5
|
+
import { isUuidString } from "../utils/fileDetection.js";
|
|
7
6
|
function validateUuid(value, fieldName) {
|
|
8
7
|
if (!isUuidString(value)) {
|
|
9
8
|
throw new BadRequestError(`Invalid ${fieldName}: "${value}" is not a valid UUID`, 400);
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
export class PolicyVersionsAPI {
|
|
12
|
+
/** API for managing the versions of a policy. */
|
|
13
13
|
constructor(policiesApi) {
|
|
14
14
|
this.policiesApi = policiesApi;
|
|
15
15
|
}
|
|
16
|
-
get
|
|
16
|
+
get rawClient() {
|
|
17
17
|
return this.policiesApi.raw;
|
|
18
18
|
}
|
|
19
19
|
get organizationId() {
|
|
20
20
|
return this.policiesApi.config.organizationId;
|
|
21
21
|
}
|
|
22
|
+
/** List all versions of a policy. */
|
|
22
23
|
async list(policyId) {
|
|
23
24
|
validateUuid(policyId, "policyId");
|
|
24
|
-
const { data } = await this.
|
|
25
|
+
const { data } = await this.rawClient.GET("/v1/policies/{policy_id}/versions/", {
|
|
25
26
|
params: {
|
|
26
27
|
path: { policy_id: policyId },
|
|
27
28
|
query: { organization_id: this.organizationId },
|
|
28
29
|
},
|
|
29
30
|
});
|
|
30
|
-
return data?.results ?? [];
|
|
31
|
+
return (data?.results ?? []);
|
|
31
32
|
}
|
|
33
|
+
/** Retrieve a single policy version. */
|
|
32
34
|
async retrieve(policyId, versionId) {
|
|
33
35
|
validateUuid(policyId, "policyId");
|
|
34
36
|
validateUuid(versionId, "versionId");
|
|
35
|
-
const { data } = await this.
|
|
37
|
+
const { data } = await this.rawClient.GET("/v1/policies/{policy_id}/versions/{version_id}/", {
|
|
36
38
|
params: {
|
|
37
39
|
path: { policy_id: policyId, version_id: versionId },
|
|
38
40
|
query: { organization_id: this.organizationId },
|
|
@@ -40,18 +42,21 @@ export class PolicyVersionsAPI {
|
|
|
40
42
|
});
|
|
41
43
|
return data;
|
|
42
44
|
}
|
|
45
|
+
/** Create a new version of a policy. */
|
|
43
46
|
async create(params) {
|
|
44
47
|
validateUuid(params.policyId, "policyId");
|
|
45
|
-
if (params.baseVersionId
|
|
48
|
+
if (params.baseVersionId != null)
|
|
46
49
|
validateUuid(params.baseVersionId, "baseVersionId");
|
|
47
50
|
const body = {
|
|
48
51
|
content: params.content,
|
|
52
|
+
...(params.versionName !== undefined
|
|
53
|
+
? { version_name: params.versionName }
|
|
54
|
+
: {}),
|
|
55
|
+
...(params.baseVersionId !== undefined
|
|
56
|
+
? { base_version_id: params.baseVersionId }
|
|
57
|
+
: {}),
|
|
49
58
|
};
|
|
50
|
-
|
|
51
|
-
body.version_name = params.versionName;
|
|
52
|
-
if (params.baseVersionId !== undefined)
|
|
53
|
-
body.base_version_id = params.baseVersionId;
|
|
54
|
-
const { data } = await this.raw.POST("/v1/policies/{policy_id}/versions/", {
|
|
59
|
+
const { data } = await this.rawClient.POST("/v1/policies/{policy_id}/versions/", {
|
|
55
60
|
params: {
|
|
56
61
|
path: { policy_id: params.policyId },
|
|
57
62
|
query: { organization_id: this.organizationId },
|
|
@@ -61,7 +66,6 @@ export class PolicyVersionsAPI {
|
|
|
61
66
|
if (!data?.id) {
|
|
62
67
|
throw new RoeAPIException(`Unexpected response from server: ${JSON.stringify(data)}`);
|
|
63
68
|
}
|
|
64
|
-
// POST returns a partial CreatePolicyVersion; re-fetch to get the full version.
|
|
65
69
|
return this.retrieve(params.policyId, data.id);
|
|
66
70
|
}
|
|
67
71
|
}
|
|
@@ -71,28 +75,39 @@ export class PoliciesAPI {
|
|
|
71
75
|
this.raw = raw;
|
|
72
76
|
this.versions = new PolicyVersionsAPI(this);
|
|
73
77
|
}
|
|
78
|
+
get rawClient() {
|
|
79
|
+
return this.raw;
|
|
80
|
+
}
|
|
81
|
+
get organizationId() {
|
|
82
|
+
return this.config.organizationId;
|
|
83
|
+
}
|
|
84
|
+
/** List policies in the organization (paginated). */
|
|
74
85
|
async list(params) {
|
|
75
|
-
const { data } = await this.
|
|
86
|
+
const { data } = await this.rawClient.GET("/v1/policies/", {
|
|
76
87
|
params: {
|
|
77
88
|
query: {
|
|
78
|
-
organization_id: this.
|
|
79
|
-
page: params?.page,
|
|
80
|
-
|
|
89
|
+
organization_id: this.organizationId,
|
|
90
|
+
...(params?.page !== undefined ? { page: params?.page } : {}),
|
|
91
|
+
...(params?.pageSize !== undefined
|
|
92
|
+
? { page_size: params?.pageSize }
|
|
93
|
+
: {}),
|
|
81
94
|
},
|
|
82
95
|
},
|
|
83
96
|
});
|
|
84
97
|
return data;
|
|
85
98
|
}
|
|
99
|
+
/** Retrieve a single policy by ID. */
|
|
86
100
|
async retrieve(policyId) {
|
|
87
101
|
validateUuid(policyId, "policyId");
|
|
88
|
-
const { data } = await this.
|
|
102
|
+
const { data } = await this.rawClient.GET("/v1/policies/{id}/", {
|
|
89
103
|
params: {
|
|
90
104
|
path: { id: policyId },
|
|
91
|
-
query: { organization_id: this.
|
|
105
|
+
query: { organization_id: this.organizationId },
|
|
92
106
|
},
|
|
93
107
|
});
|
|
94
108
|
return data;
|
|
95
109
|
}
|
|
110
|
+
/** Create a new policy together with its first version. */
|
|
96
111
|
async create(params) {
|
|
97
112
|
const body = {
|
|
98
113
|
name: params.name,
|
|
@@ -100,34 +115,37 @@ export class PoliciesAPI {
|
|
|
100
115
|
description: params.description ?? "",
|
|
101
116
|
version_name: params.versionName ?? "version 1",
|
|
102
117
|
};
|
|
103
|
-
const { data } = await this.
|
|
104
|
-
params: { query: { organization_id: this.
|
|
118
|
+
const { data } = await this.rawClient.POST("/v1/policies/", {
|
|
119
|
+
params: { query: { organization_id: this.organizationId } },
|
|
105
120
|
body,
|
|
106
121
|
});
|
|
107
122
|
return data;
|
|
108
123
|
}
|
|
124
|
+
/** Update mutable fields of a policy. */
|
|
109
125
|
async update(policyId, updates) {
|
|
110
126
|
validateUuid(policyId, "policyId");
|
|
111
|
-
const body = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
const body = {
|
|
128
|
+
...(updates.name !== undefined ? { name: updates.name } : {}),
|
|
129
|
+
...(updates.description !== undefined
|
|
130
|
+
? { description: updates.description }
|
|
131
|
+
: {}),
|
|
132
|
+
};
|
|
133
|
+
const { data } = await this.rawClient.PATCH("/v1/policies/{id}/", {
|
|
117
134
|
params: {
|
|
118
135
|
path: { id: policyId },
|
|
119
|
-
query: { organization_id: this.
|
|
136
|
+
query: { organization_id: this.organizationId },
|
|
120
137
|
},
|
|
121
138
|
body,
|
|
122
139
|
});
|
|
123
140
|
return data;
|
|
124
141
|
}
|
|
142
|
+
/** Delete a policy. */
|
|
125
143
|
async delete(policyId) {
|
|
126
144
|
validateUuid(policyId, "policyId");
|
|
127
|
-
await this.
|
|
145
|
+
await this.rawClient.DELETE("/v1/policies/{id}/", {
|
|
128
146
|
params: {
|
|
129
147
|
path: { id: policyId },
|
|
130
|
-
query: { organization_id: this.
|
|
148
|
+
query: { organization_id: this.organizationId },
|
|
131
149
|
},
|
|
132
150
|
});
|
|
133
151
|
}
|
package/dist/api/tables.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare class TablesAPI {
|
|
|
15
15
|
readonly raw: RoeRawClient;
|
|
16
16
|
/** API for uploading CSV files into Roe tables. */
|
|
17
17
|
constructor(config: RoeConfig, raw: RoeRawClient);
|
|
18
|
+
protected get rawClient(): RoeRawClient;
|
|
19
|
+
protected get organizationId(): string;
|
|
18
20
|
/** Upload a CSV file and create a Roe table. */
|
|
19
21
|
upload(params: TableUploadParams): Promise<TableUploadResponse>;
|
|
20
22
|
}
|
package/dist/api/tables.js
CHANGED
|
@@ -9,6 +9,12 @@ export class TablesAPI {
|
|
|
9
9
|
this.config = config;
|
|
10
10
|
this.raw = raw;
|
|
11
11
|
}
|
|
12
|
+
get rawClient() {
|
|
13
|
+
return this.raw;
|
|
14
|
+
}
|
|
15
|
+
get organizationId() {
|
|
16
|
+
return this.config.organizationId;
|
|
17
|
+
}
|
|
12
18
|
/** Upload a CSV file and create a Roe table. */
|
|
13
19
|
async upload(params) {
|
|
14
20
|
const inputs = {
|
package/dist/auth.d.ts
CHANGED
package/dist/auth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
4
|
// Resolve the package's own version at runtime so the User-Agent doesn't
|
|
5
5
|
// silently drift across releases when the auto-release pipeline bumps
|
|
6
6
|
// package.json without touching this file. Falls back to "0.0.0" if the
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AgentsAPI } from "./api/agents.js";
|
|
2
1
|
import { type GeneratedApis } 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";
|
|
6
|
-
import { RoeConfig, RoeConfigInput } from "./config.js";
|
|
6
|
+
import { RoeConfig, type RoeConfigInput } from "./config.js";
|
|
7
7
|
import { type RoeRawClient } from "./generated/client.js";
|
|
8
8
|
export declare class RoeClient {
|
|
9
9
|
readonly config: RoeConfig;
|
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
|
|
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;
|
package/dist/exceptions.js
CHANGED
|
@@ -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" &&
|
|
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 {
|
|
14
|
-
export
|
|
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,14 +1,14 @@
|
|
|
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 {
|
|
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.:
|
package/dist/models/file.js
CHANGED
|
@@ -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)], {
|
|
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");
|
package/dist/models/job.d.ts
CHANGED
package/dist/models/job.js
CHANGED
|
@@ -81,7 +81,11 @@ export class JobBatch {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
get jobs() {
|
|
84
|
-
return this.jobIds.map((id) => new Job({
|
|
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 =
|
|
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 ||
|
|
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([
|
|
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" &&
|
|
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 ??
|
|
114
|
+
throw (lastErr ??
|
|
115
|
+
new Error("postDynamicInputs exhausted retries without producing an error"));
|
|
114
116
|
}
|
|
@@ -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;
|
package/dist/utils/middleware.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|